Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start working on updating to pre710 nuget package #289

Merged
merged 46 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c9a20bb
Start working on updating to pre636 nuget package
tznind Mar 22, 2024
e1adf23
Work on handling more v2 changes
tznind Mar 29, 2024
8bd852a
Fix bugs around the removal of argumented constructors
tznind Mar 31, 2024
fbc6812
Main program now compiles
tznind Mar 31, 2024
5fb16c2
Unit tests compiling except Frame
tznind Mar 31, 2024
c738106
Remove references to Frame which has now been removed
tznind Mar 31, 2024
a2a24a5
Update to 2.0.0-pre.774
tznind Apr 14, 2024
b1bd27b
Start trying to repair mouse and key handling
tznind Apr 14, 2024
53626d9
Fix test around tab view
tznind Apr 14, 2024
a5946b5
Update to 2.0.0-pre.949
tznind May 8, 2024
66e26ec
Mouse point changes
tznind May 13, 2024
67f806e
Work with new dependencies
tznind May 13, 2024
03a2876
Fix ColorSchemeToCode to call constructor
tznind May 14, 2024
86ed9c1
Nuke fixed test, Dim now never null
tznind May 14, 2024
1219d0c
Start trying to fix PosView (relative to)
tznind May 14, 2024
be9427c
Fix not setting DisplayText on tab properly
tznind May 15, 2024
dbbdf07
More fixes of tabview display text
tznind May 15, 2024
234779c
Fix DisplayText on cloning TaabView.
BDisp May 15, 2024
fffc329
Fix ButtonRename unit test and keystroke.
BDisp May 15, 2024
dd6d775
Rename DeleteChar to Delete.
BDisp May 15, 2024
1f9036a
Fix unit test using ExpectedKeysYamlContent.
BDisp May 15, 2024
e57f598
Fix mouse drag views.
BDisp May 15, 2024
a04ad25
View dim cannot be null.
BDisp May 15, 2024
66d64f1
Trying to fix SupportedViewTypes.
BDisp May 15, 2024
95932a4
Fixing more Tab unit tests.
BDisp May 15, 2024
267ba6c
Merge pull request #290 from BDisp/tznind_pre636-support
tznind May 16, 2024
3719d46
Fix various dialogs that don't look or behave correct
tznind May 19, 2024
c05a7a1
Fix for v2 refactoring button to split MouseClick and Accept
tznind May 19, 2024
1343c45
Update to 2.0.0-pre.1322
tznind May 23, 2024
e8359c7
Less reflection in PosExtensions
tznind May 25, 2024
777bb88
Remove reflection in DimExtensions
tznind May 25, 2024
6959cf6
Remove 'f' now that Percent methods take int
tznind May 25, 2024
2907ce9
Switch float to int for Percent (Pos and Dim)
tznind May 27, 2024
374e3be
Use full namespace name for Color to avoid collision with System.Draw…
tznind May 27, 2024
03ed08b
Fixes for free Text modification
tznind May 27, 2024
05ebe72
Add IsDimAuto
tznind May 27, 2024
cbf093f
Support for file scoped namespace declarations
tznind May 27, 2024
d8e31eb
Designer support for DimAuto
tznind May 27, 2024
c7db195
Update to no ContentSize and new Dim.Auto
tznind May 31, 2024
f7553c1
Suppress Text on slider and radio
tznind Jun 1, 2024
6b5f7be
Keyboard handling fixes and ignore ContentSize
tznind Jun 1, 2024
51a3bb0
Suppress test equality check on DimAuto
tznind Jun 1, 2024
e4a66a3
Fix drag resizing TabView
tznind Jun 1, 2024
9cf4b15
Fix bug characters in direct Text typing changes
tznind Jun 1, 2024
718bfc2
Comment out failing test and fix rename tab operation
tznind Jun 15, 2024
2481c6c
Fix unit test
tznind Jun 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ You can add new code to `MyDialog.cs` but avoid making any changes to `MyDialog.
For example in `MyDialog.cs` after `InitializeComponent()` add the following:

```csharp
button1.Clicked += ()=>MessageBox.Query("Hello","Hello World","Ok");
button1.Accept += ()=>MessageBox.Query("Hello","Hello World","Ok");
```
Now when run clicking the button will trigger a message box.

Expand Down
25 changes: 0 additions & 25 deletions src/ApplicationExtensions.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/AttributeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public static class AttributeExtensions
/// <returns>Code construct <paramref name="a"/>.</returns>
public static string ToCode(this Terminal.Gui.Attribute a)
{
return $"new Terminal.Gui.Attribute(Color.{a.Foreground},Color.{a.Background})";
return $"new Terminal.Gui.Attribute(Terminal.Gui.Color.{a.Foreground},Terminal.Gui.Color.{a.Background})";
}
}
66 changes: 36 additions & 30 deletions src/DefaultColorSchemes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,49 @@ public class DefaultColorSchemes
/// </summary>
public DefaultColorSchemes()
{
this.RedOnBlack = new NamedColorScheme("redOnBlack");
this.RedOnBlack.Scheme.Normal = new Terminal.Gui.Attribute(Terminal.Gui.Color.Red, Terminal.Gui.Color.Black);
this.RedOnBlack.Scheme.HotNormal = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightRed, Terminal.Gui.Color.Black);
this.RedOnBlack.Scheme.Focus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Red, Terminal.Gui.Color.Yellow);
this.RedOnBlack.Scheme.HotFocus = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightRed, Terminal.Gui.Color.Yellow);
this.RedOnBlack.Scheme.Disabled = new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black);
this.RedOnBlack = new NamedColorScheme("redOnBlack",
new ColorScheme(
normal: new Terminal.Gui.Attribute(Terminal.Gui.Color.Red, Terminal.Gui.Color.Black),
hotNormal: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightRed, Terminal.Gui.Color.Black),
focus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Red, Terminal.Gui.Color.Yellow),
hotFocus: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightRed, Terminal.Gui.Color.Yellow),
disabled: new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black)
));

this.GreenOnBlack = new NamedColorScheme("greenOnBlack");
this.GreenOnBlack.Scheme.Normal = new Terminal.Gui.Attribute(Terminal.Gui.Color.Green, Terminal.Gui.Color.Black);
this.GreenOnBlack.Scheme.HotNormal = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightGreen, Terminal.Gui.Color.Black);
this.GreenOnBlack.Scheme.Focus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Green, Terminal.Gui.Color.Magenta);
this.GreenOnBlack.Scheme.HotFocus = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightGreen, Terminal.Gui.Color.Magenta);
this.GreenOnBlack.Scheme.Disabled = new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black);
this.GreenOnBlack = new NamedColorScheme("greenOnBlack",
new ColorScheme(
normal : new Terminal.Gui.Attribute(Terminal.Gui.Color.Green, Terminal.Gui.Color.Black),
hotNormal: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightGreen, Terminal.Gui.Color.Black),
focus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Green, Terminal.Gui.Color.Magenta),
hotFocus: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightGreen, Terminal.Gui.Color.Magenta),
disabled : new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black)));

this.BlueOnBlack = new NamedColorScheme("blueOnBlack");
this.BlueOnBlack.Scheme.Normal = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightBlue, Terminal.Gui.Color.Black);
this.BlueOnBlack.Scheme.HotNormal = new Terminal.Gui.Attribute(Terminal.Gui.Color.Cyan, Terminal.Gui.Color.Black);
this.BlueOnBlack.Scheme.Focus = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightBlue, Terminal.Gui.Color.BrightYellow);
this.BlueOnBlack.Scheme.HotFocus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Cyan, Terminal.Gui.Color.BrightYellow);
this.BlueOnBlack.Scheme.Disabled = new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black);
this.BlueOnBlack = new NamedColorScheme("blueOnBlack",
new ColorScheme(
normal : new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightBlue, Terminal.Gui.Color.Black),
hotNormal: new Terminal.Gui.Attribute(Terminal.Gui.Color.Cyan, Terminal.Gui.Color.Black),
focus: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightBlue, Terminal.Gui.Color.BrightYellow),
hotFocus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Cyan, Terminal.Gui.Color.BrightYellow),
disabled: new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black)));

this.GrayOnBlack = new NamedColorScheme("greyOnBlack");
this.GrayOnBlack.Scheme.Normal = new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black);
this.GrayOnBlack.Scheme.HotNormal = new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black);
this.GrayOnBlack.Scheme.Focus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Black, Terminal.Gui.Color.DarkGray);
this.GrayOnBlack.Scheme.HotFocus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Black, Terminal.Gui.Color.DarkGray);
this.GrayOnBlack.Scheme.Disabled = new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black);
this.GrayOnBlack = new NamedColorScheme("greyOnBlack",
new ColorScheme(
normal : new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black),
hotNormal: new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black),
focus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Black, Terminal.Gui.Color.DarkGray),
hotFocus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Black, Terminal.Gui.Color.DarkGray),
disabled: new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black)));

this.TerminalGuiDefault = new NamedColorScheme("tgDefault");
this.TerminalGuiDefault.Scheme.Normal = new Terminal.Gui.Attribute(Color.White, Color.Blue);
this.TerminalGuiDefault.Scheme.HotNormal = new Terminal.Gui.Attribute(Color.BrightCyan, Color.Blue);
this.TerminalGuiDefault.Scheme.Focus = new Terminal.Gui.Attribute(Color.Black, Color.Gray);
this.TerminalGuiDefault.Scheme.HotFocus = new Terminal.Gui.Attribute(Color.BrightBlue, Color.Gray);
this.TerminalGuiDefault = new NamedColorScheme("tgDefault",
new ColorScheme(
normal : new Terminal.Gui.Attribute(Color.White, Color.Blue),
hotNormal : new Terminal.Gui.Attribute(Color.BrightCyan, Color.Blue),
focus : new Terminal.Gui.Attribute(Color.Black, Color.Gray),
hotFocus : new Terminal.Gui.Attribute(Color.BrightBlue, Color.Gray),

// HACK : Keeping this foreground as Brown because otherwise designer will think this is legit
// the real default and assume user has not chosen it. See: https://github.com/gui-cs/TerminalGuiDesigner/issues/133
this.TerminalGuiDefault.Scheme.Disabled = new Terminal.Gui.Attribute(Color.Yellow, Color.Blue);
disabled: new Terminal.Gui.Attribute(Color.Yellow, Color.Blue)));
}

/// <summary>
Expand Down
19 changes: 10 additions & 9 deletions src/Design.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,8 @@ private IEnumerable<Property> LoadDesignableProperties()

yield return this.CreateSuppressedProperty(nameof(this.View.Visible), true);

yield return this.CreateSuppressedProperty(nameof(this.View.Arrangement), ViewArrangement.Movable);

yield return new ColorSchemeProperty(this);

// its important that this comes before Text because
Expand All @@ -671,11 +673,10 @@ private IEnumerable<Property> LoadDesignableProperties()
yield return this.CreateProperty(nameof(Slider.Orientation));
yield return this.CreateProperty(nameof(Slider.RangeAllowSingle));
yield return this.CreateProperty(nameof(Slider.AllowEmpty));
yield return this.CreateProperty(nameof(Slider.AutoSize));
yield return this.CreateProperty(nameof(Slider.InnerSpacing));
yield return this.CreateProperty(nameof(Slider.MinimumInnerSpacing));
yield return this.CreateProperty(nameof(Slider.LegendsOrientation));
yield return this.CreateProperty(nameof(Slider.ShowLegends));
yield return this.CreateProperty(nameof(Slider.ShowSpacing));
yield return this.CreateProperty(nameof(Slider.ShowEndSpacing));
yield return this.CreateProperty(nameof(Slider.Type));
}

Expand All @@ -688,11 +689,6 @@ private IEnumerable<Property> LoadDesignableProperties()
viewType.GetProperty(nameof(SpinnerView.Style)) ?? throw new Exception($"Could not find expected Property SpinnerView.Style on View of Type '{this.View.GetType()}'"));
}

if (this.View is ScrollView)
{
yield return this.CreateProperty(nameof(ScrollView.ContentSize));
}

if (this.View is TextView)
{
yield return this.CreateProperty(nameof(TextView.AllowsTab));
Expand Down Expand Up @@ -836,7 +832,6 @@ private IEnumerable<Property> LoadDesignableProperties()
if (this.View is RadioGroup)
{
yield return this.CreateProperty(nameof(RadioGroup.RadioLabels));
yield return this.CreateProperty(nameof(RadioGroup.DisplayMode));
}
}

Expand Down Expand Up @@ -866,6 +861,12 @@ private bool ShowTextProperty()
return false;
}

// Do not let Text be set on Slider or Slider<> implementations as weird stuff happens
if(this.View.GetType().Name.StartsWith("Slider") || View is RadioGroup)
{
return false;
}

return !this.excludeTextPropertyFor.Contains(this.View.GetType());
}

Expand Down
4 changes: 2 additions & 2 deletions src/DesignState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ private void DrawContentComplete(object? sender, DrawEventArgs r)
{
if (this.Design.View.IsBorderlessContainerView() && Editor.ShowBorders)
{
this.DrawBorderlessViewFrame(r.Rect);
this.DrawBorderlessViewFrame(r.NewViewport);
}
}

private void DrawBorderlessViewFrame(Rect r)
private void DrawBorderlessViewFrame(Rectangle r)
{
bool isSelected = SelectionManager.Instance.Selected.Contains(this.Design);

Expand Down
Loading
Loading