diff --git a/Crypto Notepad/App.config b/Crypto Notepad/App.config index de1d8e5..302f2a2 100644 --- a/Crypto Notepad/App.config +++ b/Crypto Notepad/App.config @@ -171,6 +171,9 @@ False + + True + diff --git a/Crypto Notepad/Crypto Notepad.csproj b/Crypto Notepad/Crypto Notepad.csproj index 0c9912a..3456ad5 100644 --- a/Crypto Notepad/Crypto Notepad.csproj +++ b/Crypto Notepad/Crypto Notepad.csproj @@ -199,6 +199,7 @@ + diff --git a/Crypto Notepad/Forms/MainForm.Designer.cs b/Crypto Notepad/Forms/MainForm.Designer.cs index e9da065..57c7933 100644 --- a/Crypto Notepad/Forms/MainForm.Designer.cs +++ b/Crypto Notepad/Forms/MainForm.Designer.cs @@ -56,6 +56,7 @@ public void InitializeComponent() this.mainMenuSeparator6 = new System.Windows.Forms.ToolStripSeparator(); this.selectAllMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.wordWrapMainMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.readOnlyMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.mainMenuSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.clearMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.toolsMainMenu = new System.Windows.Forms.ToolStripMenuItem(); @@ -280,6 +281,7 @@ public void InitializeComponent() this.mainMenuSeparator6, this.selectAllMainMenu, this.wordWrapMainMenu, + this.readOnlyMainMenu, this.mainMenuSeparator7, this.clearMainMenu}); this.editMainMenu.ForeColor = System.Drawing.SystemColors.ControlText; @@ -381,6 +383,15 @@ public void InitializeComponent() this.wordWrapMainMenu.Text = "Word Wrap"; this.wordWrapMainMenu.Click += new System.EventHandler(this.WordWrapMainMenu_Click); // + // readOnlyMainMenu + // + this.readOnlyMainMenu.CheckOnClick = true; + this.readOnlyMainMenu.Name = "readOnlyMainMenu"; + this.readOnlyMainMenu.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R))); + this.readOnlyMainMenu.Size = new System.Drawing.Size(180, 22); + this.readOnlyMainMenu.Text = "Readonly"; + this.readOnlyMainMenu.Click += new System.EventHandler(this.ReadOnlyMainMenu_Click); + // // mainMenuSeparator7 // this.mainMenuSeparator7.Name = "mainMenuSeparator7"; @@ -1357,5 +1368,6 @@ public void InitializeComponent() protected internal System.Windows.Forms.PictureBox newToolbarButton; protected internal System.Windows.Forms.ToolStripMenuItem newMainMenu; protected internal System.Windows.Forms.ToolStripMenuItem fileMainMenu; + private System.Windows.Forms.ToolStripMenuItem readOnlyMainMenu; } } diff --git a/Crypto Notepad/Forms/MainForm.cs b/Crypto Notepad/Forms/MainForm.cs index 10c74fc..be18d4f 100644 --- a/Crypto Notepad/Forms/MainForm.cs +++ b/Crypto Notepad/Forms/MainForm.cs @@ -416,6 +416,7 @@ protected internal void StatusPanelFileInfo() StatusPanelTextInfo(); } } + statusPanelReadonlyLabel.Text = "Readonly: " + readOnlyMainMenu.Checked.ToString(); } } @@ -560,6 +561,7 @@ private void LoadSettings() statusPanelLinesLabel.Visible = settings.statusPanelLines; statusPanelModifiedLabel.Visible = settings.statusPanelModified; statusPanelSizeLabel.Visible = settings.statusPanelSize; + statusPanelReadonlyLabel.Visible = settings.statusPanelReadonly; richTextBox.WordWrap = settings.editorWrap; richTextBox.ForeColor = settings.editroForeColor; richTextBox.BackColor = settings.editorBackColor; @@ -596,6 +598,7 @@ public void MenuIcons(bool menuIcons) findMainMenu.Image = Resources.magnifier; selectAllMainMenu.Image = Resources.selection_input; wordWrapMainMenu.Image = Resources.wrap_option; + readOnlyMainMenu.Image = Resources.document__pencil; clearMainMenu.Image = Resources.document; changePasswordMainMenu.Image = Resources.key; lockMainMenu.Image = Resources.lock_warning; @@ -836,6 +839,7 @@ private async void MainWindow_Load(object sender, EventArgs e) Methods.DeleteUpdateFiles(); MenuIcons(settings.menuIcons); ToolbarIcons(settings.oldToolbarIcons); + statusPanelReadonlyLabel.Text = "Readonly: " + readOnlyMainMenu.Checked.ToString(); if (args.Length == 2) /*drag & drop to executable*/ { OpenAsotiations(); @@ -1350,6 +1354,12 @@ private void SelectAllMainMenu_Click(object sender, EventArgs e) } } + private void ReadOnlyMainMenu_Click(object sender, EventArgs e) + { + richTextBox.ReadOnly = readOnlyMainMenu.Checked; + statusPanelReadonlyLabel.Text = "Readonly: " + readOnlyMainMenu.Checked.ToString(); + } + private void WordWrapMainMenu_Click(object sender, EventArgs e) { if (wordWrapMainMenu.Checked) @@ -1363,12 +1373,16 @@ private void WordWrapMainMenu_Click(object sender, EventArgs e) settings.menuWrap = wordWrapMainMenu.Checked; settings.editorWrap = richTextBox.WordWrap; settings.Save(); + statusPanelWordwrapLabel.Text = "Word Wrap: " + wordWrapMainMenu.Checked.ToString(); } private void ClearMainMenu_Click(object sender, EventArgs e) { - richTextBox.SelectAll(); - richTextBox.SelectedText = " "; + if (!readOnlyMainMenu.Checked) + { + richTextBox.SelectAll(); + richTextBox.SelectedText = " "; + } } /*Edit*/ @@ -1549,7 +1563,10 @@ private void RightToLeftContextMenu_Click(object sender, EventArgs e) private void ClearContextMenu_Click(object sender, EventArgs e) { - ClearMainMenu_Click(this, new EventArgs()); + if (!readOnlyMainMenu.Checked) + { + ClearMainMenu_Click(this, new EventArgs()); + } } #endregion @@ -1924,6 +1941,8 @@ private void VariablesMainMenu_Click(object sender, EventArgs e) Debug.WriteLine("metadataCorrupt: " + PublicVar.metadataCorrupt); #endif } + + #endregion diff --git a/Crypto Notepad/Forms/SettingsForm.cs b/Crypto Notepad/Forms/SettingsForm.cs index e5d10b1..a97460a 100644 --- a/Crypto Notepad/Forms/SettingsForm.cs +++ b/Crypto Notepad/Forms/SettingsForm.cs @@ -57,6 +57,7 @@ private void LoadSettings() statusPanelModifiedCheckBox.Checked = settings.statusPanelModified; statusPanelSizeCheckBox.Checked = settings.statusPanelSize; statusPanelLabelsGroupBox.Visible = settings.statusPanelVisible; + statusPanelReadonlyCheckBox.Checked = settings.statusPanelReadonly; encryptionHintLabel.Visible = settings.encryptionHint; } #endregion @@ -556,6 +557,13 @@ private void StatusPanelSizeCheckBox_Click(object sender, EventArgs e) } #endregion + private void StatusPanelReadonlyCheckBox_Click(object sender, EventArgs e) + { + MainForm main = Owner as MainForm; + main.statusPanelReadonlyLabel.Visible = statusPanelReadonlyCheckBox.Checked; + settings.statusPanelReadonly = statusPanelReadonlyCheckBox.Checked; + main.StatusPanelFileInfo(); + } } } \ No newline at end of file diff --git a/Crypto Notepad/Properties/Resources.resx b/Crypto Notepad/Properties/Resources.resx index 474d9c5..a21fe8e 100644 --- a/Crypto Notepad/Properties/Resources.resx +++ b/Crypto Notepad/Properties/Resources.resx @@ -1053,4 +1053,7 @@ xJcYtFboYiS58tuSgL/TRqSIfPg4hwAAAABJRU5ErkJggg== + + ..\Resources\document--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Crypto Notepad/Properties/Settings.Designer.cs b/Crypto Notepad/Properties/Settings.Designer.cs index ab2538f..578a04e 100644 --- a/Crypto Notepad/Properties/Settings.Designer.cs +++ b/Crypto Notepad/Properties/Settings.Designer.cs @@ -712,5 +712,17 @@ public bool passwordGeneratorAdditional { this["passwordGeneratorAdditional"] = value; } } + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool statusPanelReadonly { + get { + return ((bool)(this["statusPanelReadonly"])); + } + set { + this["statusPanelReadonly"] = value; + } + } } } diff --git a/Crypto Notepad/Properties/Settings.settings b/Crypto Notepad/Properties/Settings.settings index 2f82f62..e29c345 100644 --- a/Crypto Notepad/Properties/Settings.settings +++ b/Crypto Notepad/Properties/Settings.settings @@ -161,5 +161,8 @@ False + + True + \ No newline at end of file diff --git a/Crypto Notepad/Resources/document--pencil.png b/Crypto Notepad/Resources/document--pencil.png new file mode 100644 index 0000000..775dfcd Binary files /dev/null and b/Crypto Notepad/Resources/document--pencil.png differ