From 8708bf007fc999944baf8372c9b056973036bd9d Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 7 Nov 2019 20:23:05 +0200 Subject: [PATCH] Able to change visibility of all labels in status panel (except Ready label) --- Crypto Notepad/App.config | 12 ++++ Crypto Notepad/MainForm.cs | 4 ++ .../Properties/Settings.Designer.cs | 52 ++++++++++++++ Crypto Notepad/Properties/Settings.settings | 12 ++++ Crypto Notepad/SettingsForm.Designer.cs | 71 +++++++++++++++++++ Crypto Notepad/SettingsForm.cs | 43 ++++++++++- 6 files changed, 191 insertions(+), 3 deletions(-) diff --git a/Crypto Notepad/App.config b/Crypto Notepad/App.config index b6fd681..070603b 100644 --- a/Crypto Notepad/App.config +++ b/Crypto Notepad/App.config @@ -129,6 +129,18 @@ False + + True + + + True + + + True + + + True + diff --git a/Crypto Notepad/MainForm.cs b/Crypto Notepad/MainForm.cs index 2c4e6b2..b7fb3bb 100644 --- a/Crypto Notepad/MainForm.cs +++ b/Crypto Notepad/MainForm.cs @@ -585,6 +585,10 @@ private void LoadSettings() statusPanel.ForeColor = settings.statusPanelFontColor; statusPanel.BackColor = settings.statusPanelBackColor; statusPanel.Visible = settings.statusPanelVisible; + statusPanelLengthLabel.Visible = settings.statusPanelLength; + statusPanelLinesLabel.Visible = settings.statusPanelLines; + statusPanelModifiedLabel.Visible = settings.statusPanelModified; + statusPanelSizeLabel.Visible = settings.statusPanelSize; richTextBox.WordWrap = settings.editorWrap; richTextBox.ForeColor = settings.editroForeColor; richTextBox.BackColor = settings.editorBackColor; diff --git a/Crypto Notepad/Properties/Settings.Designer.cs b/Crypto Notepad/Properties/Settings.Designer.cs index 6f8b01b..c021ddc 100644 --- a/Crypto Notepad/Properties/Settings.Designer.cs +++ b/Crypto Notepad/Properties/Settings.Designer.cs @@ -530,5 +530,57 @@ public bool singleInstance { this["singleInstance"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool statusPanelLength { + get { + return ((bool)(this["statusPanelLength"])); + } + set { + this["statusPanelLength"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool statusPanelLines { + get { + return ((bool)(this["statusPanelLines"])); + } + set { + this["statusPanelLines"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool statusPanelModified { + get { + return ((bool)(this["statusPanelModified"])); + } + set { + this["statusPanelModified"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool statusPanelSize { + get { + return ((bool)(this["statusPanelSize"])); + } + set { + this["statusPanelSize"] = value; + } + } } } diff --git a/Crypto Notepad/Properties/Settings.settings b/Crypto Notepad/Properties/Settings.settings index a582488..6aca5a9 100644 --- a/Crypto Notepad/Properties/Settings.settings +++ b/Crypto Notepad/Properties/Settings.settings @@ -119,5 +119,17 @@ False + + True + + + True + + + True + + + True + \ No newline at end of file diff --git a/Crypto Notepad/SettingsForm.Designer.cs b/Crypto Notepad/SettingsForm.Designer.cs index c63e57f..f09301c 100644 --- a/Crypto Notepad/SettingsForm.Designer.cs +++ b/Crypto Notepad/SettingsForm.Designer.cs @@ -65,6 +65,11 @@ private void InitializeComponent() this.hashAlgorithmLabel = new System.Windows.Forms.Label(); this.keySizeComboBox = new System.Windows.Forms.ComboBox(); this.statusPanelTabPage = new System.Windows.Forms.TabPage(); + this.statusPanelLabelsGroupBox = new System.Windows.Forms.GroupBox(); + this.statusPanelLengthCheckBox = new System.Windows.Forms.CheckBox(); + this.statusPanelSizeCheckBox = new System.Windows.Forms.CheckBox(); + this.statusPanelLinesCheckBox = new System.Windows.Forms.CheckBox(); + this.statusPanelModifiedCheckBox = new System.Windows.Forms.CheckBox(); this.statusPanelVisibleCheckBox = new System.Windows.Forms.CheckBox(); this.statusPanelBackColor = new System.Windows.Forms.Panel(); this.statusPanelFontColor = new System.Windows.Forms.Panel(); @@ -92,6 +97,7 @@ private void InitializeComponent() this.integrationTabPage.SuspendLayout(); this.encryptionTabPage.SuspendLayout(); this.statusPanelTabPage.SuspendLayout(); + this.statusPanelLabelsGroupBox.SuspendLayout(); this.toolbarTabPage.SuspendLayout(); this.searchPanelTabPage.SuspendLayout(); this.SuspendLayout(); @@ -513,6 +519,7 @@ private void InitializeComponent() // this.statusPanelTabPage.BackColor = System.Drawing.SystemColors.Window; this.statusPanelTabPage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.statusPanelTabPage.Controls.Add(this.statusPanelLabelsGroupBox); this.statusPanelTabPage.Controls.Add(this.statusPanelVisibleCheckBox); this.statusPanelTabPage.Controls.Add(this.statusPanelBackColor); this.statusPanelTabPage.Controls.Add(this.statusPanelFontColor); @@ -525,6 +532,63 @@ private void InitializeComponent() this.statusPanelTabPage.TabIndex = 5; this.statusPanelTabPage.Text = "stat"; // + // statusPanelLabelsGroupBox + // + this.statusPanelLabelsGroupBox.Controls.Add(this.statusPanelLengthCheckBox); + this.statusPanelLabelsGroupBox.Controls.Add(this.statusPanelSizeCheckBox); + this.statusPanelLabelsGroupBox.Controls.Add(this.statusPanelLinesCheckBox); + this.statusPanelLabelsGroupBox.Controls.Add(this.statusPanelModifiedCheckBox); + this.statusPanelLabelsGroupBox.Location = new System.Drawing.Point(9, 96); + this.statusPanelLabelsGroupBox.Name = "statusPanelLabelsGroupBox"; + this.statusPanelLabelsGroupBox.Size = new System.Drawing.Size(223, 129); + this.statusPanelLabelsGroupBox.TabIndex = 8; + this.statusPanelLabelsGroupBox.TabStop = false; + this.statusPanelLabelsGroupBox.Text = "Status panel labels"; + // + // statusPanelLengthCheckBox + // + this.statusPanelLengthCheckBox.AutoSize = true; + this.statusPanelLengthCheckBox.Location = new System.Drawing.Point(6, 22); + this.statusPanelLengthCheckBox.Name = "statusPanelLengthCheckBox"; + this.statusPanelLengthCheckBox.Size = new System.Drawing.Size(63, 19); + this.statusPanelLengthCheckBox.TabIndex = 4; + this.statusPanelLengthCheckBox.Text = "Length"; + this.statusPanelLengthCheckBox.UseVisualStyleBackColor = true; + this.statusPanelLengthCheckBox.Click += new System.EventHandler(this.StatusPanelLengthCheckBox_Click); + // + // statusPanelSizeCheckBox + // + this.statusPanelSizeCheckBox.AutoSize = true; + this.statusPanelSizeCheckBox.Location = new System.Drawing.Point(6, 97); + this.statusPanelSizeCheckBox.Name = "statusPanelSizeCheckBox"; + this.statusPanelSizeCheckBox.Size = new System.Drawing.Size(46, 19); + this.statusPanelSizeCheckBox.TabIndex = 7; + this.statusPanelSizeCheckBox.Text = "Size"; + this.statusPanelSizeCheckBox.UseVisualStyleBackColor = true; + this.statusPanelSizeCheckBox.Click += new System.EventHandler(this.statusPanelSizeCheckBox_Click); + // + // statusPanelLinesCheckBox + // + this.statusPanelLinesCheckBox.AutoSize = true; + this.statusPanelLinesCheckBox.Location = new System.Drawing.Point(6, 47); + this.statusPanelLinesCheckBox.Name = "statusPanelLinesCheckBox"; + this.statusPanelLinesCheckBox.Size = new System.Drawing.Size(53, 19); + this.statusPanelLinesCheckBox.TabIndex = 5; + this.statusPanelLinesCheckBox.Text = "Lines"; + this.statusPanelLinesCheckBox.UseVisualStyleBackColor = true; + this.statusPanelLinesCheckBox.Click += new System.EventHandler(this.StatusPanelLinesCheckBox_Click); + // + // statusPanelModifiedCheckBox + // + this.statusPanelModifiedCheckBox.AutoSize = true; + this.statusPanelModifiedCheckBox.Location = new System.Drawing.Point(6, 72); + this.statusPanelModifiedCheckBox.Name = "statusPanelModifiedCheckBox"; + this.statusPanelModifiedCheckBox.Size = new System.Drawing.Size(74, 19); + this.statusPanelModifiedCheckBox.TabIndex = 6; + this.statusPanelModifiedCheckBox.Text = "Modified"; + this.statusPanelModifiedCheckBox.UseVisualStyleBackColor = true; + this.statusPanelModifiedCheckBox.Click += new System.EventHandler(this.StatusPanelModifiedCheckBox_Click); + // // statusPanelVisibleCheckBox // this.statusPanelVisibleCheckBox.AutoSize = true; @@ -798,6 +862,8 @@ private void InitializeComponent() this.encryptionTabPage.PerformLayout(); this.statusPanelTabPage.ResumeLayout(false); this.statusPanelTabPage.PerformLayout(); + this.statusPanelLabelsGroupBox.ResumeLayout(false); + this.statusPanelLabelsGroupBox.PerformLayout(); this.toolbarTabPage.ResumeLayout(false); this.toolbarTabPage.PerformLayout(); this.searchPanelTabPage.ResumeLayout(false); @@ -865,5 +931,10 @@ private void InitializeComponent() private System.Windows.Forms.Label searchBorderLabel; private System.Windows.Forms.CheckBox toolbarCloseButtonCheckBox; private System.Windows.Forms.CheckBox singleInstanceCheckBox; + private System.Windows.Forms.CheckBox statusPanelLengthCheckBox; + private System.Windows.Forms.CheckBox statusPanelLinesCheckBox; + private System.Windows.Forms.CheckBox statusPanelModifiedCheckBox; + private System.Windows.Forms.CheckBox statusPanelSizeCheckBox; + private System.Windows.Forms.GroupBox statusPanelLabelsGroupBox; } } \ No newline at end of file diff --git a/Crypto Notepad/SettingsForm.cs b/Crypto Notepad/SettingsForm.cs index 2fe4f3c..9d2f8dd 100644 --- a/Crypto Notepad/SettingsForm.cs +++ b/Crypto Notepad/SettingsForm.cs @@ -52,6 +52,11 @@ private void LoadSettings() statusPanelBackColor.BackColor = settings.statusPanelBackColor; statusPanelFontColor.BackColor = settings.statusPanelFontColor; statusPanelVisibleCheckBox.Checked = settings.statusPanelVisible; + statusPanelLengthCheckBox.Checked = settings.statusPanelLength; + statusPanelLinesCheckBox.Checked = settings.statusPanelLines; + statusPanelModifiedCheckBox.Checked = settings.statusPanelModified; + statusPanelSizeCheckBox.Checked = settings.statusPanelSize; + statusPanelLabelsGroupBox.Visible = settings.statusPanelVisible; } private static void AssociateExtension(string applicationExecutablePath, string extension) @@ -137,7 +142,7 @@ private void SendToShortcut() #endregion - #region Form Events + #region Event Handlers private void SettingsForm_Load(object sender, EventArgs e) { string custom_colors = settings.customColor; @@ -191,7 +196,7 @@ private void PasswordIterationsTextBox_KeyPress(object sender, KeyPressEventArgs #endregion - #region Settings Section + #region Settings Events private void EditorFontColor_Click(object sender, EventArgs e) { colorDialog.Color = editorFontColor.BackColor; @@ -385,9 +390,11 @@ private void FontDialog_Apply(object sender, EventArgs e) private void StatusPanelVisibleCheckBox_Click(object sender, EventArgs e) { + statusPanelLabelsGroupBox.Visible = statusPanelVisibleCheckBox.Checked; + Application.DoEvents(); MainForm main = Owner as MainForm; main.statusPanel.Visible = statusPanelVisibleCheckBox.Checked; - main.richTextBox.SetInnerMargins(Convert.ToInt32(editorPaddingLeftTextBox.Text), 0, 0, 0); + //main.richTextBox.SetInnerMargins(Convert.ToInt32(editorPaddingLeftTextBox.Text), 0, 0, 0); settings.statusPanelVisible = statusPanelVisibleCheckBox.Checked; } @@ -587,6 +594,36 @@ private void SingleInstanceCheckBox_Click(object sender, EventArgs e) { settings.singleInstance = singleInstanceCheckBox.Checked; } + + private void StatusPanelLengthCheckBox_Click(object sender, EventArgs e) + { + MainForm main = Owner as MainForm; + main.statusPanelLengthLabel.Visible = statusPanelLengthCheckBox.Checked; + settings.statusPanelLength = statusPanelLengthCheckBox.Checked; + } + + private void StatusPanelLinesCheckBox_Click(object sender, EventArgs e) + { + MainForm main = Owner as MainForm; + main.statusPanelLinesLabel.Visible = statusPanelLinesCheckBox.Checked; + settings.statusPanelLines = statusPanelLinesCheckBox.Checked; + } + + private void StatusPanelModifiedCheckBox_Click(object sender, EventArgs e) + { + MainForm main = Owner as MainForm; + main.statusPanelModifiedLabel.Visible = statusPanelModifiedCheckBox.Checked; + settings.statusPanelModified = statusPanelModifiedCheckBox.Checked; + main.StatusPanelFileInfo(); + } + + private void statusPanelSizeCheckBox_Click(object sender, EventArgs e) + { + MainForm main = Owner as MainForm; + main.statusPanelSizeLabel.Visible = statusPanelSizeCheckBox.Checked; + settings.statusPanelSize = statusPanelSizeCheckBox.Checked; + main.StatusPanelFileInfo(); + } #endregion