فهرست منبع

Resolved some changes requested.

BDisp 5 سال پیش
والد
کامیت
4234d9b614
3فایلهای تغییر یافته به همراه21 افزوده شده و 25 حذف شده
  1. 0 6
      Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs
  2. 2 2
      Terminal.Gui/Core/Event.cs
  3. 19 17
      UICatalog/Scenarios/Keys.cs

+ 0 - 6
Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs

@@ -392,12 +392,6 @@ namespace Terminal.Gui {
 				keyModifiers.Alt = true;
 			if (!keyModifiers.Ctrl && key.HasFlag (Key.CtrlMask))
 				keyModifiers.Ctrl = true;
-			//if (!keyModifiers.Capslock)
-			//	keyModifiers.Capslock = true;
-			//if (!keyModifiers.Numlock)
-			//	keyModifiers.Numlock = true;
-			//if (!keyModifiers.Scrolllock)
-			//	keyModifiers.Scrolllock = true;
 
 			return keyModifiers;
 		}

+ 2 - 2
Terminal.Gui/Core/Event.cs

@@ -9,7 +9,7 @@ using System;
 namespace Terminal.Gui {
 
 	/// <summary>
-	/// Manage the keys modifiers within a key event.
+	/// Identifies the state of the "shift"-keys within a event.
 	/// </summary>
 	public class KeyModifiers {
 		/// <summary>
@@ -333,7 +333,7 @@ namespace Terminal.Gui {
 		public Key Key;
 
 		/// <summary>
-		/// Check if the Shift key was pressed or not.
+		/// Indicates the "shift" state of the various shift-keys (e.g. Shift, Alt, Ctrl, NumLock, ...).
 		/// </summary>
 		public KeyModifiers KeyModifiers;
 

+ 19 - 17
UICatalog/Scenarios/Keys.cs

@@ -83,7 +83,6 @@ namespace UICatalog {
 				Y = Pos.Top (editLabel) + 2,
 			};
 			Win.Add (keyPressedLabel);
-			// BUGBUG: Label is not positioning right with Pos, so using TextField instead
 			var labelKeypress = new Label ("") {
 				X = Pos.Left (edit),
 				Y = Pos.Top (keyPressedLabel),
@@ -107,25 +106,13 @@ namespace UICatalog {
 			var keyStrokeListView = new ListView (keyStrokelist) {
 				X = 0,
 				Y = Pos.Top (keyLogLabel) + yOffset,
-				Width = 25,
+				Width = Dim.Percent (40),
 				Height = Dim.Fill (),
 			};
 			keyStrokeListView.ColorScheme = Colors.TopLevel;
 			Win.Add (keyStrokeListView);
 
-			void KeyDownPressUp (KeyEvent keyEvent, string updown)
-			{
-				var msg = $"Key{updown,-5}: {keyEvent.ToString ()}";
-				keyStrokelist.Add (msg);
-				keyStrokeListView.MoveDown ();
-			}
-
-			Win.KeyDown += (sender, a) => KeyDownPressUp (a.KeyEvent, "Down");
-			Win.KeyPress += (sender, a) => KeyDownPressUp (a.KeyEvent, "Press");
-			Win.KeyUp += (sender, a) => KeyDownPressUp (a.KeyEvent, "Up");
-
 			// ProcessKey log:
-			// BUGBUG: Label is not positioning right with Pos, so using TextField instead
 			var processKeyLogLabel = new Label ("ProcessKey log:") {
 				X = Pos.Right (keyStrokeListView) + 1,
 				Y = Pos.Top (editLabel) + 4,
@@ -136,7 +123,7 @@ namespace UICatalog {
 			var processKeyListView = new ListView (_processKeyList) {
 				X = Pos.Left (processKeyLogLabel),
 				Y = Pos.Top (processKeyLogLabel) + yOffset,
-				Width = 25,
+				Width = Dim.Percent (60),
 				Height = Dim.Fill (),
 			};
 			processKeyListView.ColorScheme = Colors.TopLevel;
@@ -154,7 +141,7 @@ namespace UICatalog {
 			var processHotKeyListView = new ListView (_processHotKeyList) {
 				X = Pos.Left (processHotKeyLogLabel),
 				Y = Pos.Top (processHotKeyLogLabel) + yOffset,
-				Width = 25,
+				Width = Dim.Percent (50),
 				Height = Dim.Fill (),
 			};
 			processHotKeyListView.ColorScheme = Colors.TopLevel;
@@ -172,9 +159,24 @@ namespace UICatalog {
 			var processColdKeyListView = new ListView (_processColdKeyList) {
 				X = Pos.Left (processColdKeyLogLabel),
 				Y = Pos.Top (processColdKeyLogLabel) + yOffset,
-				Width = 25,
+				Width = Dim.Fill (),
 				Height = Dim.Fill (),
 			};
+
+			Win.KeyDown += (sender, a) => KeyDownPressUp (a.KeyEvent, "Down");
+			Win.KeyPress += (sender, a) => KeyDownPressUp (a.KeyEvent, "Press");
+			Win.KeyUp += (sender, a) => KeyDownPressUp (a.KeyEvent, "Up");
+
+			void KeyDownPressUp (KeyEvent keyEvent, string updown)
+			{
+				var msg = $"Key{updown,-5}: {keyEvent}";
+				keyStrokelist.Add (msg);
+				keyStrokeListView.MoveDown ();
+				processKeyListView.MoveDown ();
+				processColdKeyListView.MoveDown ();
+				processHotKeyListView.MoveDown ();
+			}
+
 			processColdKeyListView.ColorScheme = Colors.TopLevel;
 			Win.Add (processColdKeyListView);
 		}