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

Fixes #3750 - MouseEnter/Leave #3751

Merged
merged 99 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
5ab424c
Initial commit. Fixed z-order
tig Aug 30, 2024
50e02cc
Re-fixed test
tig Aug 30, 2024
4f683d3
Added stopwatch
tig Aug 30, 2024
0899e0a
Mock up of pop up menu in Bars Scenario
tig Aug 30, 2024
002a102
Popup->Popover
tig Aug 30, 2024
f391f5b
popover refinement
tig Aug 30, 2024
92c9414
popover refinement
tig Aug 30, 2024
d625921
merged
tig Aug 31, 2024
963fd99
Merge branch 'v2_develop' into v2_2491-Overlapped
tig Aug 31, 2024
6008949
Merge branch 'gui-cs:v2_develop' into v2_2491-Overlapped
tig Sep 10, 2024
80bae9f
Adds ArragngementEditor.
tig Sep 10, 2024
85a97e6
Keyboard UI for move/resize POC
tig Sep 10, 2024
ce417f4
Fixed unit test
tig Sep 11, 2024
011f208
Fixed unit test
tig Sep 11, 2024
ba161b3
Cleaned up Command enum.
tig Sep 11, 2024
894ca06
Cleaned up Command enum.
tig Sep 11, 2024
889c59c
Made Window resizable by default
tig Sep 11, 2024
8cf6cde
Fixed focus issue
tig Sep 11, 2024
49c6f7a
Fixed datepicker tests
tig Sep 11, 2024
b3cb051
More #nullable enable
tig Sep 11, 2024
28b1326
More #nullable enable
tig Sep 11, 2024
6aba0e5
click outside of border cancels arrangemode
tig Sep 11, 2024
74cc910
Fixed unit test
tig Sep 12, 2024
74c0ac6
Added POC for mouse move/resize!
tig Sep 12, 2024
27b0ab8
Added POC for mouse move/resize! 2
tig Sep 12, 2024
0a6a41d
WIP: Working through adornment focus stuff.
tig Sep 16, 2024
a94b085
Enabled Adornment Focus
tig Sep 16, 2024
357bc32
Fixed focus issue - 2
tig Sep 16, 2024
697711a
Fixed focus issue - 3
tig Sep 17, 2024
b6adfb2
Enabled Adornment Focus in Adornmens scenario
tig Sep 17, 2024
a0fcfa0
Fixed release build issue
tig Sep 17, 2024
86d21ef
WIP of tiled-mode
tig Sep 17, 2024
b717892
Removed OverlappedTop.
tig Sep 17, 2024
78a3dff
WIP of new overlapped drawing
tig Sep 17, 2024
941a6ee
New overlapped drawing impl.
tig Sep 18, 2024
5b8c502
More Toplevel cleanup
tig Sep 18, 2024
556a2eb
Removed duplciate RequestStop
tig Sep 18, 2024
e2f671c
More Toplevel cleanup
tig Sep 18, 2024
176207e
More Toplevel cleanup
tig Sep 18, 2024
e01af59
Code cleanup/API docs
tig Sep 18, 2024
e09c2ad
Improved API docs
tig Sep 18, 2024
9a50905
doc updates
tig Sep 18, 2024
8ee6056
doc updates
tig Sep 18, 2024
04111d5
doc updates 2
tig Sep 18, 2024
071167b
doc updates 3
tig Sep 18, 2024
13a4126
Updated docfx template
tig Sep 18, 2024
b48982b
Updated docfx templates again
tig Sep 19, 2024
00336d8
Updated docfx
tig Sep 19, 2024
5e9d5a8
Updated docfx and fixed most warnings
tig Sep 19, 2024
3448027
Updated docfx and fixed most warnings
tig Sep 19, 2024
be5794b
Restore .docfx to match v2_develop
tig Sep 19, 2024
b0cd955
removed modern
tig Sep 19, 2024
b3f910d
Merge branch 'v2_develop' into v2_2491-Overlapped
tig Sep 19, 2024
5d4a814
fixed readme
tig Sep 19, 2024
12e3346
Prototype
tig Sep 20, 2024
8dbdccd
Refactored
tig Sep 20, 2024
ed921ed
Fixed. With more unit tests.
tig Sep 20, 2024
f4d63b0
Merge branch 'v2_develop' into v2_3750-MouseEnter
tig Sep 20, 2024
dfde8f6
Code cleanup
tig Sep 20, 2024
a5fa3c4
Merge branch 'v2_3750-MouseEnter' of tig:tig/Terminal.Gui into v2_375…
tig Sep 20, 2024
d5181fc
test traits
tig Sep 21, 2024
58d0781
Added View.Mouse tests
tig Sep 21, 2024
1dd2d9f
Added Application.Mouse tests
tig Sep 21, 2024
e95ff61
Refactored Enter event and added unit tests
tig Sep 21, 2024
f512cd4
Refactored Leave event and added unit tests
tig Sep 21, 2024
7d82873
Re enabled ViewDiagnostics.MouseEnter
tig Sep 21, 2024
f9e0c9f
Fixed unit test
tig Sep 21, 2024
8189667
Code cleanup
tig Sep 22, 2024
21e55cc
Enabled ViewHighlight.Hover
tig Sep 22, 2024
28fc3ea
Enabled ViewHighlight.Hover
tig Sep 22, 2024
3c1d6a8
Fixed diagnostcis
tig Sep 22, 2024
1f793b0
Consistent naming
tig Sep 22, 2024
7eb241e
Refactored Higlight event
tig Sep 22, 2024
72aac7f
WIP: Making Hover work menu-style
tig Sep 22, 2024
c33736d
Color schemes
tig Sep 22, 2024
5861277
Color schemes - unit test fixes
tig Sep 22, 2024
5293a84
charmap button issue
tig Sep 22, 2024
cdfc49e
unit test issue
tig Sep 22, 2024
c249e14
Code cleanup
tig Sep 22, 2024
4445abe
Code cleanup
tig Sep 22, 2024
1e6f6b8
unit test issue
tig Sep 23, 2024
0444293
moar unit tests
tig Sep 23, 2024
21e2187
moar unit tests
tig Sep 23, 2024
02e75f8
moar unit tests
tig Sep 23, 2024
37457ac
tryig to fix unit test fail that only happens in macos
tig Sep 23, 2024
2c39135
moar unit tests - button
tig Sep 23, 2024
0684c86
moar unit tests - button2
tig Sep 23, 2024
05ae843
Addressed review feedback.
tig Sep 23, 2024
21abe09
Attempting to figure out unit test fails and why tests are now slow.
tig Sep 23, 2024
8e4ddfa
Attempting to figure out unit test fails and why tests are now slow. 2
tig Sep 23, 2024
aed37f9
Fixed a bunch of unit test issues. Fixed color stuff I broke
tig Sep 23, 2024
c5cda74
ColorJsonConverter fix
tig Sep 23, 2024
7fcb500
Fixed TryParseW3CColorName
tig Sep 23, 2024
c2f5287
Made Highlight.Pressed effect semi-configurable
tig Sep 23, 2024
061281d
Re-enabled WantContinousbuttonPress/Highligh in Mouse Scenario
tig Sep 23, 2024
cdf0247
Merge branch 'v2_develop' into v2_2491-Overlapped
tig Sep 24, 2024
97870d7
Merge branch 'v2_develop' into v2_2491-Overlapped
tig Sep 24, 2024
2042951
Merge branch 'v2_develop' into v2_3750-MouseEnter
tig Sep 24, 2024
bff7794
Rebased onto v2_2491-Overlapped
tig Sep 24, 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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

* The current, stable, release of Terminal.Gui v1 is [![Version](https://img.shields.io/nuget/v/Terminal.Gui.svg)](https://www.nuget.org/packages/Terminal.Gui).
* The current `prealpha` release of Terminal.Gui v2 can be found on [Nuget](https://www.nuget.org/packages/Terminal.Gui).
* Developers starting new TUI projects are encouraged to target `v2`. The API is signifcantly changed, and significantly improved. There will be breaking changes in the API before Beta, but the core API is stable.
* Developers starting new TUI projects are encouraged to target `v2`. The API is significantly changed, and significantly improved. There will be breaking changes in the API before Beta, but the core API is stable.
* `v1` is in maintenance mode and we will only accept PRs for issues impacting existing functionality.

**Terminal.Gui**: A toolkit for building rich console apps for .NET, .NET Core, and Mono that works on Windows, the Mac, and Linux/Unix.
Expand All @@ -35,9 +35,9 @@ dotnet run
* [API Documentation](https://gui-cs.github.io/Terminal.GuiV2Docs/api/Terminal.Gui.html)
* [Documentation Home](https://gui-cs.github.io/Terminal.GuiV2Docs)

The above documentation matches the most recent Nuget release from the `v2_develop` branch. Get the [v1 documentation here](This is the v2 API documentation. For v1 go here: https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui.html)
The above documentation matches the most recent Nuget release from the `v2_develop` branch. Get the [v1 documentation here](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui.html).

See the [`Terminal.Gui/` README](https://github.com/gui-cs/Terminal.Gui/tree/master/Terminal.Gui) for an overview of how the library is structured.
See the [`Terminal.Gui/`README](https://github.com/gui-cs/Terminal.Gui/tree/master/Terminal.Gui) for an overview of how the library is structured.

## Showcase & Examples

Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Application/Application.Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static partial class Application // Driver abstractions

/// <summary>
/// Gets or sets whether <see cref="Application.Driver"/> will be forced to output only the 16 colors defined in
/// <see cref="ColorName"/>. The default is <see langword="false"/>, meaning 24-bit (TrueColor) colors will be output
/// <see cref="ColorName16"/>. The default is <see langword="false"/>, meaning 24-bit (TrueColor) colors will be output
/// as long as the selected <see cref="ConsoleDriver"/> supports TrueColor.
/// </summary>
[SerializableConfigurationProperty (Scope = typeof (SettingsScope))]
Expand Down
12 changes: 9 additions & 3 deletions Terminal.Gui/Application/Application.Initialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ internal static void InternalInit (
if (!calledViaRunT)
{
// Reset all class variables (Application is a singleton).
ResetState ();
ResetState (ignoreDisposed: true);
}

Navigation = new ();
Expand Down Expand Up @@ -198,10 +198,16 @@ internal static void InternalInit (
public static void Shutdown ()
{
// TODO: Throw an exception if Init hasn't been called.

bool wasInitialized = IsInitialized;
ResetState ();
PrintJsonErrors ();
bool init = IsInitialized;
InitializedChanged?.Invoke (null, new (in init));

if (wasInitialized)
{
bool init = IsInitialized;
InitializedChanged?.Invoke (null, new (in init));
}
}

/// <summary>
Expand Down
113 changes: 59 additions & 54 deletions Terminal.Gui/Application/Application.Keyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ public static partial class Application // Keyboard handling
{
private static Key _nextTabGroupKey = Key.F6; // Resources/config.json overrrides
private static Key _nextTabKey = Key.Tab; // Resources/config.json overrrides

private static Key _prevTabGroupKey = Key.F6.WithShift; // Resources/config.json overrrides

private static Key _prevTabKey = Key.Tab.WithShift; // Resources/config.json overrrides

private static Key _quitKey = Key.Esc; // Resources/config.json overrrides
private static Key _arrangeKey = Key.F5.WithCtrl; // Resources/config.json overrrides

static Application () { AddApplicationKeyBindings (); }

Expand Down Expand Up @@ -97,7 +95,7 @@ public static bool OnKeyDown (Key keyEvent)
return true;
}

if (Current is null)
if (Top is null)
{
foreach (Toplevel topLevel in TopLevels.ToList ())
{
Expand All @@ -114,7 +112,7 @@ public static bool OnKeyDown (Key keyEvent)
}
else
{
if (Current.NewKeyDownEvent (keyEvent))
if (Top.NewKeyDownEvent (keyEvent))
{
return true;
}
Expand Down Expand Up @@ -155,7 +153,7 @@ public static bool OnKeyDown (Key keyEvent)
}

/// <summary>
/// INTENRAL method to invoke one of the commands in <see cref="CommandImplementations"/>
/// INTENRAL method to invoke one of the commands in <see cref="CommandImplementations"/>
/// </summary>
/// <param name="command"></param>
/// <param name="keyEvent"></param>
Expand All @@ -174,6 +172,7 @@ public static bool OnKeyDown (Key keyEvent)
if (CommandImplementations.TryGetValue (command, out Func<CommandContext, bool?>? implementation))
{
var context = new CommandContext (command, keyEvent, appBinding); // Create the context here

return implementation (context);
}

Expand Down Expand Up @@ -262,24 +261,31 @@ public static Key QuitKey
}
}

/// <summary>Gets or sets the key to activate arranging views using the keyboard.</summary>
[SerializableConfigurationProperty (Scope = typeof (SettingsScope))]
public static Key ArrangeKey
{
get => _arrangeKey;
set
{
if (_arrangeKey != value)
{
ReplaceKey (_arrangeKey, value);
_arrangeKey = value;
}
}
}

internal static void AddApplicationKeyBindings ()
{
CommandImplementations = new ();

// Things this view knows how to do
AddCommand (
Command.QuitToplevel, // TODO: IRunnable: Rename to Command.Quit to make more generic.
Command.Quit,
static () =>
{
if (ApplicationOverlapped.OverlappedTop is { })
{
RequestStop (Current!);
}
else
{
RequestStop ();
}

RequestStop ();
return true;
}
);
Expand All @@ -295,54 +301,50 @@ internal static void AddApplicationKeyBindings ()
);

AddCommand (
Command.NextView,
Command.NextTabStop,
static () => Navigation?.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabStop));

AddCommand (
Command.PreviousView,
Command.PreviousTabStop,
static () => Navigation?.AdvanceFocus (NavigationDirection.Backward, TabBehavior.TabStop));

AddCommand (
Command.NextViewOrTop,
static () =>
{
// TODO: This OverlapppedTop tomfoolery goes away in addressing #2491
if (ApplicationOverlapped.OverlappedTop is { })
{
ApplicationOverlapped.OverlappedMoveNext ();

return true;
}
Command.NextTabGroup,
static () => Navigation?.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabGroup));

return Navigation?.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabGroup);
}
);
AddCommand (
Command.PreviousTabGroup,
static () => Navigation?.AdvanceFocus (NavigationDirection.Backward, TabBehavior.TabGroup));

AddCommand (
Command.PreviousViewOrTop,
Command.Refresh,
static () =>
{
// TODO: This OverlapppedTop tomfoolery goes away in addressing #2491
if (ApplicationOverlapped.OverlappedTop is { })
{
ApplicationOverlapped.OverlappedMovePrevious ();

return true;
}
Refresh ();

return Navigation?.AdvanceFocus (NavigationDirection.Backward, TabBehavior.TabGroup);
return true;
}
);

AddCommand (
Command.Refresh,
Command.Edit,
static () =>
{
Refresh ();
View? viewToArrange = Navigation?.GetFocused ();

return true;
}
);
// Go up the superview hierarchy and find the first that is not ViewArrangement.Fixed
while (viewToArrange is { SuperView: { }, Arrangement: ViewArrangement.Fixed })
{
viewToArrange = viewToArrange.SuperView;
}

if (viewToArrange is { })
{
return viewToArrange.Border?.EnterArrangeMode (ViewArrangement.Fixed);
}

return false;
});

KeyBindings.Clear ();

Expand All @@ -352,18 +354,21 @@ internal static void AddApplicationKeyBindings ()
NextTabGroupKey = Key.F6;
PrevTabGroupKey = Key.F6.WithShift;
QuitKey = Key.Esc;
ArrangeKey = Key.F5.WithCtrl;

KeyBindings.Add (QuitKey, KeyBindingScope.Application, Command.Quit);

KeyBindings.Add (QuitKey, KeyBindingScope.Application, Command.QuitToplevel);
KeyBindings.Add (Key.CursorRight, KeyBindingScope.Application, Command.NextTabStop);
KeyBindings.Add (Key.CursorDown, KeyBindingScope.Application, Command.NextTabStop);
KeyBindings.Add (Key.CursorLeft, KeyBindingScope.Application, Command.PreviousTabStop);
KeyBindings.Add (Key.CursorUp, KeyBindingScope.Application, Command.PreviousTabStop);
KeyBindings.Add (NextTabKey, KeyBindingScope.Application, Command.NextTabStop);
KeyBindings.Add (PrevTabKey, KeyBindingScope.Application, Command.PreviousTabStop);

KeyBindings.Add (Key.CursorRight, KeyBindingScope.Application, Command.NextView);
KeyBindings.Add (Key.CursorDown, KeyBindingScope.Application, Command.NextView);
KeyBindings.Add (Key.CursorLeft, KeyBindingScope.Application, Command.PreviousView);
KeyBindings.Add (Key.CursorUp, KeyBindingScope.Application, Command.PreviousView);
KeyBindings.Add (NextTabKey, KeyBindingScope.Application, Command.NextView);
KeyBindings.Add (PrevTabKey, KeyBindingScope.Application, Command.PreviousView);
KeyBindings.Add (NextTabGroupKey, KeyBindingScope.Application, Command.NextTabGroup);
KeyBindings.Add (PrevTabGroupKey, KeyBindingScope.Application, Command.PreviousTabGroup);

KeyBindings.Add (NextTabGroupKey, KeyBindingScope.Application, Command.NextViewOrTop);
KeyBindings.Add (PrevTabGroupKey, KeyBindingScope.Application, Command.PreviousViewOrTop);
KeyBindings.Add (ArrangeKey, KeyBindingScope.Application, Command.Edit);

// TODO: Refresh Key should be configurable
KeyBindings.Add (Key.F5, KeyBindingScope.Application, Command.Refresh);
Expand Down
Loading