From 7ffdf8a0a696759558e07f5272aad8f683468a77 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 23 Aug 2019 21:41:21 +0300 Subject: [PATCH] Minor design changes in search panel --- Crypto Notepad/MainForm.Designer.cs | 31 ++++++++++++----------------- Crypto Notepad/MainForm.cs | 21 +------------------ 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/Crypto Notepad/MainForm.Designer.cs b/Crypto Notepad/MainForm.Designer.cs index 2ea1506..483ed95 100644 --- a/Crypto Notepad/MainForm.Designer.cs +++ b/Crypto Notepad/MainForm.Designer.cs @@ -577,15 +577,14 @@ public void InitializeComponent() // // SearchTextBox // - this.SearchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.SearchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.SearchTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(35))))); this.SearchTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.SearchTextBox.ForeColor = System.Drawing.Color.White; - this.SearchTextBox.Location = new System.Drawing.Point(191, 5); + this.SearchTextBox.Location = new System.Drawing.Point(3, 6); this.SearchTextBox.Name = "SearchTextBox"; - this.SearchTextBox.Size = new System.Drawing.Size(236, 14); + this.SearchTextBox.Size = new System.Drawing.Size(246, 14); this.SearchTextBox.TabIndex = 9; this.SearchTextBox.TabStop = false; this.SearchTextBox.TextChanged += new System.EventHandler(this.SearchTextBox_TextChanged); @@ -593,15 +592,13 @@ public void InitializeComponent() // // MatchCaseCheckBox // - this.MatchCaseCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.MatchCaseCheckBox.AutoSize = true; + this.MatchCaseCheckBox.Dock = System.Windows.Forms.DockStyle.Right; this.MatchCaseCheckBox.ForeColor = System.Drawing.Color.Gainsboro; this.MatchCaseCheckBox.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.MatchCaseCheckBox.Location = new System.Drawing.Point(95, 5); + this.MatchCaseCheckBox.Location = new System.Drawing.Point(255, 0); this.MatchCaseCheckBox.Name = "MatchCaseCheckBox"; - this.MatchCaseCheckBox.Size = new System.Drawing.Size(95, 17); + this.MatchCaseCheckBox.Size = new System.Drawing.Size(95, 25); this.MatchCaseCheckBox.TabIndex = 11; this.MatchCaseCheckBox.Text = "Case sensitive"; this.MatchCaseCheckBox.UseVisualStyleBackColor = false; @@ -609,16 +606,14 @@ public void InitializeComponent() // // WholeWordCheckBox // - this.WholeWordCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.WholeWordCheckBox.AutoSize = true; this.WholeWordCheckBox.BackColor = System.Drawing.Color.Transparent; + this.WholeWordCheckBox.Dock = System.Windows.Forms.DockStyle.Right; this.WholeWordCheckBox.ForeColor = System.Drawing.Color.Gainsboro; this.WholeWordCheckBox.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.WholeWordCheckBox.Location = new System.Drawing.Point(6, 5); + this.WholeWordCheckBox.Location = new System.Drawing.Point(350, 0); this.WholeWordCheckBox.Name = "WholeWordCheckBox"; - this.WholeWordCheckBox.Size = new System.Drawing.Size(83, 17); + this.WholeWordCheckBox.Size = new System.Drawing.Size(83, 25); this.WholeWordCheckBox.TabIndex = 12; this.WholeWordCheckBox.Text = "Whole word"; this.WholeWordCheckBox.UseVisualStyleBackColor = false; @@ -628,8 +623,8 @@ public void InitializeComponent() // this.SearchPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(35))))); this.SearchPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.SearchPanel.Controls.Add(this.SearchTextBox); this.SearchPanel.Controls.Add(this.MatchCaseCheckBox); + this.SearchPanel.Controls.Add(this.SearchTextBox); this.SearchPanel.Controls.Add(this.WholeWordCheckBox); this.SearchPanel.Controls.Add(this.FindNextButton); this.SearchPanel.Controls.Add(this.CloseSearchPanel); @@ -701,13 +696,13 @@ public void InitializeComponent() // // CloseToolbar // - this.CloseToolbar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.CloseToolbar.Cursor = System.Windows.Forms.Cursors.Hand; + this.CloseToolbar.Dock = System.Windows.Forms.DockStyle.Right; this.CloseToolbar.Image = global::Crypto_Notepad.Properties.Resources.close_g; this.CloseToolbar.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.CloseToolbar.Location = new System.Drawing.Point(497, 4); + this.CloseToolbar.Location = new System.Drawing.Point(499, 0); this.CloseToolbar.Name = "CloseToolbar"; - this.CloseToolbar.Size = new System.Drawing.Size(14, 14); + this.CloseToolbar.Size = new System.Drawing.Size(14, 23); this.CloseToolbar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.CloseToolbar.TabIndex = 14; this.CloseToolbar.TabStop = false; diff --git a/Crypto Notepad/MainForm.cs b/Crypto Notepad/MainForm.cs index c5c4ddb..08db53d 100644 --- a/Crypto Notepad/MainForm.cs +++ b/Crypto Notepad/MainForm.cs @@ -167,9 +167,7 @@ private void SendTo() PublicVar.okPressed = false; string de = AES.Decrypt(opnfile, TypedPassword.Value, null, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize); RichTextBox.Text = de; - Text = PublicVar.appName + " – " + NameWithotPath; - filePath = argsPath; string cc = RichTextBox.Text.Length.ToString(CultureInfo.InvariantCulture); RichTextBox.Select(Convert.ToInt32(cc), 0); @@ -204,7 +202,6 @@ private void SendToShortcut() string shortcutName = PublicVar.appName + ".lnk"; string shortcutLocation = Path.Combine(shortcutPath, shortcutName); string targetFileLocation = Assembly.GetEntryAssembly().Location; - WshShell shell = new WshShell(); IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation); shortcut.Description = PublicVar.appName; @@ -216,7 +213,6 @@ private void SendToShortcut() private void ContextMenuEncryptReplace() { - if (args[1].Contains(".cnp")) { MessageBox.Show("Looks like this file is already encrypted", PublicVar.appName, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -237,9 +233,7 @@ private void ContextMenuEncryptReplace() string cc2 = RichTextBox.Text.Length.ToString(CultureInfo.InvariantCulture); RichTextBox.Select(Convert.ToInt32(cc2), 0); PublicVar.openFileName = Path.GetFileName(args[1]); - string newFile = Path.GetDirectoryName(args[1]) + @"\" + Path.GetFileNameWithoutExtension(args[1]) + ".cnp"; - EnterKeyForm f2 = new EnterKeyForm(); f2.ShowDialog(); if (!PublicVar.okPressed) @@ -247,9 +241,7 @@ private void ContextMenuEncryptReplace() Application.Exit(); } PublicVar.okPressed = false; - File.Delete(args[1]); - string noenc = RichTextBox.Text; string en; en = AES.Encrypt(RichTextBox.Text, TypedPassword.Value, null, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize); @@ -408,7 +400,6 @@ private void CheckForUpdates(bool autoCheck) string content = reader.ReadToEnd(); string version = Application.ProductVersion; string exePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + @"\"; - int appVersion = Convert.ToInt32(version.Replace(".", "")), serverVersion = Convert.ToInt32(content.Replace(".", "")); if (serverVersion > appVersion) @@ -550,7 +541,6 @@ private void MenuIcons() OpenFileLocationToolStripMenuItem.Image = Properties.Resources.folder_horizontal; DeleteFileToolStripMenuItem.Image = Properties.Resources.document_minus; ExitToolStripMenuItem.Image = Properties.Resources.cross_button; - UndoToolStripMenuItem.Image = Properties.Resources.arrow_left; RedoToolStripMenuItem.Image = Properties.Resources.arrow_right; CutToolStripMenuItem.Image = Properties.Resources.scissors; @@ -561,11 +551,9 @@ private void MenuIcons() SelectAllToolStripMenuItem.Image = Properties.Resources.selection_input; WordWrapToolStripMenuItem.Image = Properties.Resources.wrap_option; ClearToolStripMenuItem.Image = Properties.Resources.document; - ChangeKeyToolStripMenuItem.Image = Properties.Resources.key; LockToolStripMenuItem.Image = Properties.Resources.lock_warning; SettingsToolStripMenuItem.Image = Properties.Resources.gear; - DocumentationToolStripMenuItem.Image = Properties.Resources.document_text; CheckForUpdatesToolStripMenuItem.Image = Properties.Resources.upload_cloud; AboutToolStripMenuItem.Image = Properties.Resources.information; @@ -596,16 +584,13 @@ private void MainWindow_Activated(object sender, EventArgs e) RichTextBox.ForeColor = ps.RichForeColor; RichTextBox.BackColor = ps.RichBackColor; BackColor = ps.RichBackColor; - LineNumbers_For_RichTextBox.Visible = bool.Parse(ps.LNVisible); LineNumbers_For_RichTextBox.BackColor = ps.LNBackgroundColor; LineNumbers_For_RichTextBox.ForeColor = ps.LNFontColorPanel; LineNumbers_For_RichTextBox.Font = new Font(ps.RichTextFont, ps.RichTextSize); - LineNumbers_For_RichTextBox.Show_BorderLines = bool.Parse(ps.BLShow); LineNumbers_For_RichTextBox.BorderLines_Color = ps.BLColor; LineNumbers_For_RichTextBox.BorderLines_Style = ps.BLStyle; - LineNumbers_For_RichTextBox.Show_GridLines = bool.Parse(ps.GLShow); LineNumbers_For_RichTextBox.GridLines_Color = ps.GLColor; LineNumbers_For_RichTextBox.GridLines_Style = ps.GLStyle; @@ -861,7 +846,6 @@ private void RichTextBox_LinkClicked(object sender, LinkClickedEventArgs e) private void RichTextBox_DragDrop(object sender, DragEventArgs e) { SaveConfirm(false); - string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string file in FileList) OpenFile.FileName = file; object fname = e.Data.GetData("FileDrop"); @@ -987,7 +971,6 @@ private void OpenToolStripMenuItem_Click(object sender, EventArgs e) #endregion RichTextBox.Modified = false; - if (PublicVar.okPressed) { PublicVar.okPressed = false; @@ -1027,10 +1010,8 @@ private void SaveToolStripMenuItem_Click(object sender, EventArgs e) string noenc = RichTextBox.Text; string en; - en = AES.Encrypt(RichTextBox.Text, PublicVar.encryptionKey.Get(), null, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize); RichTextBox.Text = en; - StreamWriter sw = new StreamWriter(filePath); int i = RichTextBox.Lines.Count(); int j = 0; @@ -1593,7 +1574,7 @@ private void MainVariablesToolStripMenuItem_Click(object sender, EventArgs e) Debug.WriteLine("RichTextBox.Modified: " + RichTextBox.Modified); Debug.WriteLine("EditorMenuStrip: " + EditorMenuStrip.Enabled); #endif - } + } /*Debug Menu*/ } } \ No newline at end of file