Skip to content

Commit

Permalink
- Do not let ReSharper loose on nullables any more (Doing it by hand !)
Browse files Browse the repository at this point in the history
- Weekends work on Nullables (Still not complete yet)
- Work on some xml intellisense warnings
- Add `?` to all event type declarations
- Start to work on using `##?.Invoke` for eventhandlers
- Replace `new()` with a standard format so that ?## new() is not confusing

#1020
  • Loading branch information
Smurf-IV committed Jul 2, 2023
1 parent 2d337f5 commit bb94144
Show file tree
Hide file tree
Showing 706 changed files with 56,656 additions and 6,639 deletions.
12 changes: 12 additions & 0 deletions Source/Krypton Components/Krypton Toolkit Suite 2022 - VS2022.sln
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestForm", "TestForm\TestFo
{F9E31BD7-42BE-48E8-92CC-74CA1871B4E6} = {F9E31BD7-42BE-48E8-92CC-74CA1871B4E6}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dictionary-en-gb", "dictionary-en-gb", "{CAB40818-55B1-4E1D-AD8E-C94642EA5124}"
ProjectSection(SolutionItems) = preProject
..\..\dictionary-en-gb\index.aff = ..\..\dictionary-en-gb\index.aff
..\..\dictionary-en-gb\index.d.ts = ..\..\dictionary-en-gb\index.d.ts
..\..\dictionary-en-gb\index.dic = ..\..\dictionary-en-gb\index.dic
..\..\dictionary-en-gb\index.js = ..\..\dictionary-en-gb\index.js
..\..\dictionary-en-gb\license.txt = ..\..\dictionary-en-gb\license.txt
..\..\dictionary-en-gb\package.json = ..\..\dictionary-en-gb\package.json
..\..\dictionary-en-gb\readme.md = ..\..\dictionary-en-gb\readme.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Canary|Any CPU = Canary|Any CPU
Expand Down Expand Up @@ -180,6 +191,7 @@ Global
{B1BEF7ED-96F3-4BA3-AD05-428987BC2491} = {511519DD-C887-40E5-8961-658AE4CA5D46}
{6C07B04E-D571-4E73-B760-180EA9DD6CC5} = {F59A6624-A207-40B8-8B1B-36FC4F4199CA}
{802E9C3A-7D20-452F-B36E-83FBB2897EFD} = {405E4318-4C8A-4DC7-B624-8F7097CDFF60}
{CAB40818-55B1-4E1D-AD8E-C94642EA5124} = {56F1A41E-584B-4F91-9E98-7D8BF678210C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C8204ACC-48AA-49AC-8236-6E9C162EC2FA}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QAT/@EntryIndexedValue">QAT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=LocalConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:Boolean x:Key="/Default/InstalledDictionaries/InstalledDictionaries/=Z_003A_005CGitHub_005CKrypton_002DSuite_005CStandard_002DToolkit_005Cdictionary_002Den_002Dgb_005Cindex_002Edic/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/InstalledDictionaries/UseBundled/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=acti/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=actioned/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=actioning/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -25,6 +27,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=ourself/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Propogate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=redirector/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=textbox/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=The/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=The_0020ke/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=toolstrip/@EntryIndexedValue">True</s:Boolean>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ public void StorePages(string[]? uniqueNames)
if ((page is { } and not KryptonStorePage))
{
// Notify that we are storing a page, so handlers can ensure it will be unique to the auto hidden location
OnStoringPage(new(page.UniqueName));
OnStoringPage(new UniqueNameEventArgs(page.UniqueName));

// Replace the existing page with a placeholder that has the same unique name
KryptonStorePage placeholder = new(uniqueName, "AutoHiddenGroup");
var placeholder = new KryptonStorePage(uniqueName, "AutoHiddenGroup");
Pages.Insert(Pages.IndexOf(page), placeholder);
Pages.Remove(page);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ public KryptonAutoHiddenPanel(DockingEdge edge)
switch (edge)
{
case DockingEdge.Left:
Padding = new(0, 0, EXTRA_PADDING, 0);
Padding = new Padding(0, 0, EXTRA_PADDING, 0);
break;
case DockingEdge.Right:
Padding = new(EXTRA_PADDING, 0, 0, 0);
Padding = new Padding(EXTRA_PADDING, 0, 0, 0);
break;
case DockingEdge.Top:
Padding = new(0, 0, 0, EXTRA_PADDING);
Padding = new Padding(0, 0, 0, EXTRA_PADDING);
break;
case DockingEdge.Bottom:
Padding = new(0, EXTRA_PADDING, 0, 0);
Padding = new Padding(0, EXTRA_PADDING, 0, 0);
break;
default:
break;
Expand Down Expand Up @@ -104,7 +104,7 @@ public override Size GetPreferredSize(Size proposedSize)
height += Padding.Vertical;
}

return new(width, height);
return new Size(width, height);
}
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

// ReSharper disable MemberCanBeInternal

using Timer = System.Windows.Forms.Timer;

namespace Krypton.Docking
{
/// <summary>
Expand Down Expand Up @@ -117,22 +119,22 @@ public KryptonAutoHiddenSlidePanel(Control control, DockingEdge edge, KryptonAut
_checkMakeHidden = OnCheckMakeHidden!;

// We need to a timer to automate sliding in and out
_slideTimer = new()
_slideTimer = new Timer
{
Interval = SLIDE_INTERVAL
};
_slideTimer.Tick += OnSlideTimerTick!;

// Timer used to delay between notification of need to slide inwards and performing actual slide
_dismissTimer = new()
_dismissTimer = new Timer
{
Interval = DISMISS_INTERVAL
};
_dismissTimer.Tick += OnDismissTimerTick!;
_dismissRunning = false;

// Create inner panel that holds the actual dockspace and separator
_dockspaceSlide = new()
_dockspaceSlide = new KryptonDockspaceSlide
{
Dock = DockStyle.Fill,
AutoHiddenHost = true
Expand All @@ -141,23 +143,23 @@ public KryptonAutoHiddenSlidePanel(Control control, DockingEdge edge, KryptonAut
_dockspaceSlide.PageAutoHiddenClicked += OnDockspacePageAutoHiddenClicked!;
_dockspaceSlide.PageDropDownClicked += OnDockspacePageDropDownClicked!;

SeparatorControl = new(edge, true);
SeparatorControl = new KryptonDockspaceSeparator(edge, true);
SeparatorControl.SplitterMoving += OnDockspaceSeparatorMoving!;
SeparatorControl.SplitterMoved += OnDockspaceSeparatorMoved!;
SeparatorControl.SplitterMoveRect += OnDockspaceSeparatorMoveRect!;

_inner = new();
_inner = new KryptonPanel();
_inner.Controls.AddRange(new Control[] { _dockspaceSlide, SeparatorControl });
Controls.Add(_inner);

// Do not show ourself until we are needed
Visible = false;

// Add a Button that is not showing and used to push focus away from the dockspace
_dummyTarget = new()
_dummyTarget = new Button
{
Location = new(-200, -200),
Size = new(100, 100)
Location = new Point(-200, -200),
Size = new Size(100, 100)
};
Controls.Add(_dummyTarget);

Expand Down Expand Up @@ -338,11 +340,8 @@ public void SlideOut(KryptonPage? page, KryptonAutoHiddenGroup group, bool selec
KryptonWorkspaceCell? cell = DockspaceControl.FirstVisibleCell();
if (cell == null)
{
cell = new();
if (DockspaceControl.Root.Children != null)
{
DockspaceControl.Root.Children.Add(cell);
}
cell = new KryptonWorkspaceCell();
DockspaceControl.Root.Children?.Add(cell);
}

// Replace any existing page with the new one
Expand All @@ -366,7 +365,7 @@ public void SlideOut(KryptonPage? page, KryptonAutoHiddenGroup group, bool selec

// Switch to new state and start animation timer
_state = DockingAutoHiddenShowState.SlidingOut;
AutoHiddenShowingStateEventArgs args = new(Page, _state);
var args = new AutoHiddenShowingStateEventArgs(Page, _state);
_slideTimer?.Start();

// Are we requested to set focus to the sliding in dockspace?
Expand Down Expand Up @@ -430,7 +429,7 @@ public void UpdateSize(int width, int height)
// Update the page with the new size to use in the future
if (Page != null)
{
Page.AutoHiddenSlideSize = new(Page.AutoHiddenSlideSize.Width + width, Page.AutoHiddenSlideSize.Height);
Page.AutoHiddenSlideSize = new Size(Page.AutoHiddenSlideSize.Width + width, Page.AutoHiddenSlideSize.Height);
}

break;
Expand All @@ -443,7 +442,7 @@ public void UpdateSize(int width, int height)
// Update the page with the new size to use in the future
if (Page != null)
{
Page.AutoHiddenSlideSize = new(Page.AutoHiddenSlideSize.Width - width, Page.AutoHiddenSlideSize.Height);
Page.AutoHiddenSlideSize = new Size(Page.AutoHiddenSlideSize.Width - width, Page.AutoHiddenSlideSize.Height);
}

break;
Expand All @@ -455,7 +454,7 @@ public void UpdateSize(int width, int height)
// Update the page with the new size to use in the future
if (Page != null)
{
Page.AutoHiddenSlideSize = new(Page.AutoHiddenSlideSize.Width, Page.AutoHiddenSlideSize.Height + height);
Page.AutoHiddenSlideSize = new Size(Page.AutoHiddenSlideSize.Width, Page.AutoHiddenSlideSize.Height + height);
}

break;
Expand All @@ -468,7 +467,7 @@ public void UpdateSize(int width, int height)
// Update the page with the new size to use in the future
if (Page != null)
{
Page.AutoHiddenSlideSize = new(Page.AutoHiddenSlideSize.Width, Page.AutoHiddenSlideSize.Height - height);
Page.AutoHiddenSlideSize = new Size(Page.AutoHiddenSlideSize.Width, Page.AutoHiddenSlideSize.Height - height);
}

break;
Expand Down Expand Up @@ -558,7 +557,7 @@ public bool PreFilterMessage(ref Message msg)
_mouseTrackWindow = msg.HWnd;

// This structure needs to know its own size in bytes
PI.TRACKMOUSEEVENTS tme = new()
var tme = new PI.TRACKMOUSEEVENTS
{
cbSize = (uint)Marshal.SizeOf(typeof(PI.TRACKMOUSEEVENTS)),
dwHoverTime = 100,
Expand Down Expand Up @@ -607,7 +606,7 @@ private void MakeHidden()
{
// Set state so timer processing does not perform any slide action
_state = DockingAutoHiddenShowState.Hidden;
AutoHiddenShowingStateEventArgs args = new(Page, _state);
var args = new AutoHiddenShowingStateEventArgs(Page, _state);

// Remove cached references
Page = null;
Expand Down Expand Up @@ -645,7 +644,7 @@ private void MakeSlideIn()
{
// Switch to sliding inwards by changing state and starting slide timer
_state = DockingAutoHiddenShowState.SlidingIn;
AutoHiddenShowingStateEventArgs args = new(Page, _state);
var args = new AutoHiddenShowingStateEventArgs(Page, _state);
_slideTimer?.Start();

// If the dockspace has the focus we need to push focus elsewhere
Expand All @@ -667,7 +666,7 @@ private void CalculateStartAndEnd()
{
Size dockspacePreferred = Page.AutoHiddenSlideSize;
Size separatorPreferred = SeparatorControl.GetPreferredSize(_control.Size);
Size slideSize = new(separatorPreferred.Width + dockspacePreferred.Width,
var slideSize = new Size(separatorPreferred.Width + dockspacePreferred.Width,
separatorPreferred.Height + dockspacePreferred.Height);

// Find the maximum allowed size based on the owning control client area reduced by a sensible minimum
Expand Down Expand Up @@ -702,20 +701,20 @@ private void CalculateStartAndEnd()
switch (_edge)
{
case DockingEdge.Left:
_startRect = new(_panel.Width, _panel.Top, 0, _panel.Height);
_endRect = new(_panel.Width, _panel.Height, slideSize.Width, _panel.Height);
_startRect = new Rectangle(_panel.Width, _panel.Top, 0, _panel.Height);
_endRect = new Rectangle(_panel.Width, _panel.Height, slideSize.Width, _panel.Height);
break;
case DockingEdge.Right:
_startRect = new(_panel.Left, _panel.Top, 0, _panel.Height);
_endRect = new(_panel.Left - slideSize.Width, _panel.Height, slideSize.Width, _panel.Height);
_startRect = new Rectangle(_panel.Left, _panel.Top, 0, _panel.Height);
_endRect = new Rectangle(_panel.Left - slideSize.Width, _panel.Height, slideSize.Width, _panel.Height);
break;
case DockingEdge.Top:
_startRect = new(_panel.Left, _panel.Height, _panel.Width, 0);
_endRect = new(_panel.Left, _panel.Height, _panel.Width, slideSize.Height);
_startRect = new Rectangle(_panel.Left, _panel.Height, _panel.Width, 0);
_endRect = new Rectangle(_panel.Left, _panel.Height, _panel.Width, slideSize.Height);
break;
case DockingEdge.Bottom:
_startRect = new(_panel.Left, _panel.Top, _panel.Width, 0);
_endRect = new(_panel.Left, _panel.Top - slideSize.Height, _panel.Width, slideSize.Height);
_startRect = new Rectangle(_panel.Left, _panel.Top, _panel.Width, 0);
_endRect = new Rectangle(_panel.Left, _panel.Top - slideSize.Height, _panel.Width, slideSize.Height);
break;
}
}
Expand Down Expand Up @@ -804,7 +803,7 @@ private void OnSlideTimerTick(object sender, EventArgs e)
{
// When finished we no longer need the timer and enter the showing state
_state = DockingAutoHiddenShowState.Showing;
AutoHiddenShowingStateEventArgs args = new(Page, _state);
var args = new AutoHiddenShowingStateEventArgs(Page, _state);
OnAutoHiddenShowingStateChanged(args);
_slideTimer?.Stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ protected virtual void OnPageDropDownClicked(CancelDropDownEventArgs e)
private void OnPagesInserting(object sender, TypedCollectionEventArgs<KryptonPage> e)
{
// Generate event so the docking element can decide on extra actions to be taken
OnCellPageInserting(new(e.Item, e.Index));
OnCellPageInserting(new KryptonPageEventArgs(e.Item, e.Index));
}

private void OnShowContextMenu(object sender, ShowContextMenuArgs e)
{
// Make sure we have a menu for displaying
e.KryptonContextMenu ??= new();
e.KryptonContextMenu ??= new KryptonContextMenu();

// Use event to allow customization of the context menu
CancelDropDownEventArgs args = new(e.KryptonContextMenu, e.Item)
var args = new CancelDropDownEventArgs(e.KryptonContextMenu, e.Item)
{
Cancel = e.Cancel
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public KryptonDockableWorkspace()
/// Gets a string representation of the instance.
/// </summary>
/// <returns>String.</returns>
public override string ToString() => "KryptonDockableWorkspace " + Dock.ToString();
public override string ToString() => $"KryptonDockableWorkspace {Dock}";

#endregion

Expand Down Expand Up @@ -101,12 +101,9 @@ protected override void OnActiveCellChanged(ActiveCellChangedEventArgs e)
#region Implementation
private void OnCellCloseAction(object sender, CloseActionEventArgs e)
{
if (e.Item != null)
if (e.Item?.UniqueName != null)
{
if (e.Item.UniqueName != null)
{
OnPageCloseClicked(new(e.Item.UniqueName));
}
OnPageCloseClicked(new UniqueNameEventArgs(e.Item.UniqueName));
}
}
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class KryptonDockspace : KryptonSpace
public KryptonDockspace()
: base(@"Docked") =>
// Define a sensible default minimum size
base.MinimumSize = new(150, 150);
base.MinimumSize = new Size(150, 150);

/// <summary>
/// Gets a string representation of the class.
Expand Down
Loading

0 comments on commit bb94144

Please sign in to comment.