mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Messed with some stuff. Probably broke some stuff.
This commit is contained in:
@@ -54,6 +54,8 @@ internal class WindowsConsole
|
||||
|
||||
public bool WriteToConsole (Size size, ExtendedCharInfo [] charInfoBuffer, Coord bufferSize, SmallRect window, bool force16Colors)
|
||||
{
|
||||
//Debug.WriteLine ("WriteToConsole");
|
||||
|
||||
if (_screenBuffer == nint.Zero)
|
||||
{
|
||||
ReadFromConsoleOutput (size, bufferSize, ref window);
|
||||
@@ -1297,6 +1299,7 @@ internal class WindowsDriver : ConsoleDriver
|
||||
Y = (short)Rows, //Clip.Height
|
||||
};
|
||||
|
||||
bool _dirty = false;
|
||||
for (var row = 0; row < Rows; row++)
|
||||
{
|
||||
if (!_dirtyLines [row])
|
||||
@@ -1320,6 +1323,7 @@ internal class WindowsDriver : ConsoleDriver
|
||||
}
|
||||
|
||||
_outputBuffer [position].Empty = false;
|
||||
_dirty = true;
|
||||
|
||||
if (Contents [row, col].Rune.IsBmp)
|
||||
{
|
||||
|
||||
@@ -270,7 +270,10 @@ public class Border : Adornment
|
||||
}
|
||||
|
||||
// BUGBUG: See https://github.com/gui-cs/Terminal.Gui/issues/3312
|
||||
if (!_dragPosition.HasValue && mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed))
|
||||
if (!_dragPosition.HasValue && mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed)
|
||||
// HACK: Prevents Window from being draggable if it's Top
|
||||
//&& Parent is Toplevel { Modal: true }
|
||||
)
|
||||
{
|
||||
Parent!.SetFocus ();
|
||||
|
||||
|
||||
@@ -91,17 +91,22 @@ public class Margin : Adornment
|
||||
/// <inheritdoc/>
|
||||
public override void OnDrawContent (Rectangle viewport)
|
||||
{
|
||||
if (!NeedsDisplay)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Rectangle screen = ViewportToScreen (viewport);
|
||||
Attribute normalAttr = GetNormalColor ();
|
||||
|
||||
Driver?.SetAttribute (normalAttr);
|
||||
|
||||
// This just draws/clears the thickness, not the insides.
|
||||
if (ShadowStyle != ShadowStyle.None)
|
||||
{
|
||||
screen = Rectangle.Inflate (screen, -1, -1);
|
||||
}
|
||||
|
||||
// This just draws/clears the thickness, not the insides.
|
||||
Thickness.Draw (screen, ToString ());
|
||||
|
||||
if (Subviews.Count > 0)
|
||||
|
||||
@@ -19,8 +19,8 @@ internal class KeyBindingsDialog : Dialog
|
||||
{
|
||||
Title = "Keybindings";
|
||||
|
||||
Height = Dim.Percent (80);
|
||||
Width = Dim.Percent (80);
|
||||
//Height = Dim.Percent (80);
|
||||
//Width = Dim.Percent (80);
|
||||
if (ViewTracker.Instance == null)
|
||||
{
|
||||
ViewTracker.Initialize ();
|
||||
|
||||
@@ -241,6 +241,8 @@ public class ASCIICustomButtonTest : Scenario
|
||||
{
|
||||
Add (titleLabel, _scrollView);
|
||||
}
|
||||
|
||||
Y = 1;
|
||||
}
|
||||
private void Button_Initialized (object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@ public class AllViewsTester : Scenario
|
||||
var label = new Label { X = 0, Y = 0, Text = "X:" };
|
||||
_locationFrame.Add (label);
|
||||
_xRadioGroup = new () { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
||||
_xRadioGroup.SelectedItemChanged += OnXRadioGroupOnSelectedItemChanged;
|
||||
_xRadioGroup.SelectedItemChanged += OnRadioGroupOnSelectedItemChanged;
|
||||
_xText = new () { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_xVal}" };
|
||||
|
||||
_xText.Accepting += (s, args) =>
|
||||
@@ -183,7 +183,7 @@ public class AllViewsTester : Scenario
|
||||
};
|
||||
_locationFrame.Add (_yText);
|
||||
_yRadioGroup = new () { X = Pos.X (label), Y = Pos.Bottom (label), RadioLabels = radioItems };
|
||||
_yRadioGroup.SelectedItemChanged += OnYRadioGroupOnSelectedItemChanged;
|
||||
_yRadioGroup.SelectedItemChanged += OnRadioGroupOnSelectedItemChanged;
|
||||
_locationFrame.Add (_yRadioGroup);
|
||||
|
||||
_sizeFrame = new ()
|
||||
@@ -200,7 +200,7 @@ public class AllViewsTester : Scenario
|
||||
label = new () { X = 0, Y = 0, Text = "Width:" };
|
||||
_sizeFrame.Add (label);
|
||||
_wRadioGroup = new () { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
||||
_wRadioGroup.SelectedItemChanged += OnWRadioGroupOnSelectedItemChanged;
|
||||
_wRadioGroup.SelectedItemChanged += OnRadioGroupOnSelectedItemChanged;
|
||||
_wText = new () { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_wVal}" };
|
||||
|
||||
_wText.Accepting += (s, args) =>
|
||||
@@ -260,7 +260,7 @@ public class AllViewsTester : Scenario
|
||||
_sizeFrame.Add (_hText);
|
||||
|
||||
_hRadioGroup = new () { X = Pos.X (label), Y = Pos.Bottom (label), RadioLabels = radioItems };
|
||||
_hRadioGroup.SelectedItemChanged += OnHRadioGroupOnSelectedItemChanged;
|
||||
_hRadioGroup.SelectedItemChanged += OnRadioGroupOnSelectedItemChanged;
|
||||
_sizeFrame.Add (_hRadioGroup);
|
||||
|
||||
_settingsPane.Add (_sizeFrame);
|
||||
@@ -333,13 +333,7 @@ public class AllViewsTester : Scenario
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
private void OnHRadioGroupOnSelectedItemChanged (object s, SelectedItemChangedArgs selected) { DimPosChanged (_curView); }
|
||||
|
||||
private void OnWRadioGroupOnSelectedItemChanged (object s, SelectedItemChangedArgs selected) { DimPosChanged (_curView); }
|
||||
|
||||
private void OnYRadioGroupOnSelectedItemChanged (object s, SelectedItemChangedArgs selected) { DimPosChanged (_curView); }
|
||||
|
||||
private void OnXRadioGroupOnSelectedItemChanged (object s, SelectedItemChangedArgs selected) { DimPosChanged (_curView); }
|
||||
private void OnRadioGroupOnSelectedItemChanged (object s, SelectedItemChangedArgs selected) { DimPosChanged (_curView); }
|
||||
|
||||
// TODO: Add Command.HotKey handler (pop a message box?)
|
||||
private void CreateCurrentView (Type type)
|
||||
@@ -407,7 +401,7 @@ public class AllViewsTester : Scenario
|
||||
|
||||
private void DimPosChanged (View view)
|
||||
{
|
||||
if (view == null)
|
||||
if (view == null || _updatingSettings)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -504,8 +498,10 @@ public class AllViewsTester : Scenario
|
||||
UpdateHostTitle (_curView);
|
||||
}
|
||||
|
||||
private bool _updatingSettings = false;
|
||||
private void UpdateSettings (View view)
|
||||
{
|
||||
_updatingSettings = true;
|
||||
var x = view.X.ToString ();
|
||||
var y = view.Y.ToString ();
|
||||
|
||||
@@ -528,27 +524,29 @@ public class AllViewsTester : Scenario
|
||||
_wRadioGroup.SelectedItem = _dimNames.IndexOf (_dimNames.First (s => w.Contains (s)));
|
||||
_hRadioGroup.SelectedItem = _dimNames.IndexOf (_dimNames.First (s => h.Contains (s)));
|
||||
|
||||
if (view.Width is DimAuto)
|
||||
if (view.Width.Has<DimAuto> (out _))
|
||||
{
|
||||
_wText.Text = "Auto";
|
||||
_wText.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_wText.Text = "100";
|
||||
_wText.Text = $"{view.Frame.Width}";
|
||||
_wText.Enabled = true;
|
||||
}
|
||||
|
||||
if (view.Height is DimAuto)
|
||||
if (view.Height.Has<DimAuto> (out _))
|
||||
{
|
||||
_hText.Text = "Auto";
|
||||
_hText.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hText.Text = "100";
|
||||
_hText.Text = $"{view.Frame.Height}";
|
||||
_hText.Enabled = true;
|
||||
}
|
||||
|
||||
_updatingSettings = false;
|
||||
}
|
||||
|
||||
private void UpdateHostTitle (View view) { _hostPane.Title = $"_Demo of {view.GetType ().Name}"; }
|
||||
@@ -560,25 +558,17 @@ public class AllViewsTester : Scenario
|
||||
return;
|
||||
}
|
||||
|
||||
if (view.Width is not DimAuto && (view.Width is null || view.Frame.Width == 0))
|
||||
if (!view.Width!.Has<DimAuto> (out _) || (view.Width is null || view.Frame.Width == 0))
|
||||
{
|
||||
view.Width = Dim.Fill ();
|
||||
}
|
||||
|
||||
if (view.Height is not DimAuto && (view.Height is null || view.Frame.Height == 0))
|
||||
if (!view.Height!.Has<DimAuto> (out _) || (view.Height is null || view.Frame.Height == 0))
|
||||
{
|
||||
view.Height = Dim.Fill ();
|
||||
}
|
||||
|
||||
_xRadioGroup.SelectedItemChanged -= OnXRadioGroupOnSelectedItemChanged;
|
||||
_yRadioGroup.SelectedItemChanged -= OnYRadioGroupOnSelectedItemChanged;
|
||||
_hRadioGroup.SelectedItemChanged -= OnHRadioGroupOnSelectedItemChanged;
|
||||
_wRadioGroup.SelectedItemChanged -= OnWRadioGroupOnSelectedItemChanged;
|
||||
UpdateSettings (view);
|
||||
_xRadioGroup.SelectedItemChanged += OnXRadioGroupOnSelectedItemChanged;
|
||||
_yRadioGroup.SelectedItemChanged += OnYRadioGroupOnSelectedItemChanged;
|
||||
_hRadioGroup.SelectedItemChanged += OnHRadioGroupOnSelectedItemChanged;
|
||||
_wRadioGroup.SelectedItemChanged += OnWRadioGroupOnSelectedItemChanged;
|
||||
|
||||
UpdateHostTitle (view);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user