Skip to content

Commit

Permalink
settings:opt.show.row.numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
JetMeta committed Aug 10, 2024
1 parent d0de87b commit 38b028a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CsvQuery/Forms/QueryWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions CsvQuery/Forms/QueryWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,31 @@ public QueryWindow()

private void OnSettingsChanged(object sender, SettingsChangedEventArgs e)
{
if (e.Changed.Contains(nameof(Settings.UseNppStyling)))
{
this.ApplyStyling(e.NewSettings.UseNppStyling);
}

if (e.Changed.Contains(nameof(Settings.ShowRowNumbers)))
{
this.contextmenuShowRowNumbers.Checked = e.NewSettings.ShowRowNumbers;
this.dataGrid.RowHeadersVisible = this.contextmenuShowRowNumbers.Checked;
this.FormatDataGrid();
}

/*
if (!e.Changed.Contains(nameof(Settings.UseNppStyling)))
return;
this.ApplyStyling(e.NewSettings.UseNppStyling);
*/
}

/// <summary>
/// Applies show row numbers
/// </summary>
public void ApplyShowRowNumbers(bool show)
{

}

/// <summary>
Expand Down Expand Up @@ -457,6 +479,7 @@ private void OnContextmenuSelectAll(object sender, EventArgs e)
private void OnContextmenuShowRowNumbers(object sender, EventArgs e)
{
this.contextmenuShowRowNumbers.Checked = this.dataGrid.RowHeadersVisible = !this.dataGrid.RowHeadersVisible;
Main.Settings.ShowRowNumbers = this.contextmenuShowRowNumbers.Checked;
this.FormatDataGrid();
}

Expand Down
12 changes: 7 additions & 5 deletions CsvQuery/PluginInfrastructure/SettingsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ public void ShowDialog()
{
// We bind a copy of this object and only apply it after they click "Ok"
var copy = (Settings) MemberwiseClone();


int ClientWidth = 800;
var ClientHeight = 600;
var dialog = new Form
{
Text = "Settings",
ClientSize = new Size(300, 300),
ClientSize = new Size(ClientWidth, ClientHeight),
MinimumSize = new Size(250, 250),
ShowIcon = false,
AutoScaleMode = AutoScaleMode.Font,
Expand All @@ -166,7 +168,7 @@ public void ShowDialog()
Text = "&Cancel",
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
Size = new Size(75, 23),
Location = new Point(300 - 75 - 13, 300 - 23 - 13),
Location = new Point(ClientWidth - 75 - 13, ClientHeight - 23 - 13),
UseVisualStyleBackColor = true
},
new Button
Expand All @@ -175,15 +177,15 @@ public void ShowDialog()
Text = "&Ok",
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
Size = new Size(75, 23),
Location = new Point(300 - 75 - 13 - 81, 300 - 23 - 13),
Location = new Point(ClientWidth - 75 - 13 - 81, ClientHeight - 23 - 13),
UseVisualStyleBackColor = true
},
new PropertyGrid
{
Name = "Grid",
Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
Location = new Point(13, 13),
Size = new Size(300 - 13 - 13, 300 - 55),
Size = new Size(ClientWidth - 13 - 13, ClientHeight - 55),
AutoScaleMode = AutoScaleMode.Font,
AutoScaleDimensions = new SizeF(6F,13F),
SelectedObject = copy
Expand Down

0 comments on commit 38b028a

Please sign in to comment.