diff --git a/CsvQuery/Forms/QueryWindow.Designer.cs b/CsvQuery/Forms/QueryWindow.Designer.cs index d4209c7..536129d 100644 --- a/CsvQuery/Forms/QueryWindow.Designer.cs +++ b/CsvQuery/Forms/QueryWindow.Designer.cs @@ -130,6 +130,9 @@ private void InitializeComponent() this.contextmenuShowRowNumbers.Size = new System.Drawing.Size(295, 36); this.contextmenuShowRowNumbers.Text = "Show row numbers"; this.contextmenuShowRowNumbers.Click += new System.EventHandler(this.OnContextmenuShowRowNumbers); + this.contextmenuShowRowNumbers.Checked = this.dataGrid.RowHeadersVisible; + this.FormatDataGrid(); + // // btnAnalyze // diff --git a/CsvQuery/Forms/QueryWindow.cs b/CsvQuery/Forms/QueryWindow.cs index 331e226..95726e2 100644 --- a/CsvQuery/Forms/QueryWindow.cs +++ b/CsvQuery/Forms/QueryWindow.cs @@ -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); + */ + } + + /// + /// Applies show row numbers + /// + public void ApplyShowRowNumbers(bool show) + { + } /// @@ -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(); } diff --git a/CsvQuery/PluginInfrastructure/SettingsBase.cs b/CsvQuery/PluginInfrastructure/SettingsBase.cs index de34c77..94f31be 100644 --- a/CsvQuery/PluginInfrastructure/SettingsBase.cs +++ b/CsvQuery/PluginInfrastructure/SettingsBase.cs @@ -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, @@ -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 @@ -175,7 +177,7 @@ 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 @@ -183,7 +185,7 @@ public void ShowDialog() 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