Cleanup code

This commit is contained in:
Alexander 2018-12-09 16:09:42 +02:00
parent 569ae5cbe1
commit c45c52cca2

View file

@ -101,11 +101,11 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
}
DecryptAES();
/*workaround, strange behavior with the cursor in customRTB fix*/
#region workaround, strange behavior with the cursor in customRTB fix
customRTB.DetectUrls = false;
customRTB.DetectUrls = true;
customRTB.Modified = false;
/*workaround, strange behavior with the cursor in customRTB fix*/
#endregion
if (publicVar.okPressed == true)
{
@ -266,7 +266,7 @@ private void MainWindow_Load(object sender, EventArgs e)
customRTB.WordWrap = ps.RichWrap;
panel2.Visible = ps.ShowToolbar;
if (ps.ShowToolbar == false)
if (!ps.ShowToolbar)
{
panel2.Visible = false;
int h = customRTB.Height;
@ -275,12 +275,12 @@ private void MainWindow_Load(object sender, EventArgs e)
customRTB.Location = new Point(6, 29);
}
if (ps.ShowToolbar == true)
if (ps.ShowToolbar)
{
panel2.Visible = true;
}
if (ps.AutoCheckUpdate == true)
if (ps.AutoCheckUpdate)
{
Thread up = new Thread(() => сheckForUpdates(false));
up.Start();
@ -621,17 +621,30 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
private void MainWindow_Activated(object sender, EventArgs e)
{
if (publicVar.settingsChanged == true)
{
{
publicVar.settingsChanged = false;
customRTB.Font = new Font(ps.RichTextFont, ps.RichTextSize);
customRTB.ForeColor = ps.RichForeColor;
customRTB.BackColor = ps.RichBackColor;
this.BackColor = ps.RichBackColor;
/*workaround, unhighlight URLs fix*/
if (ps.SendTo)
{
SendToShortcut();
}
else
{
string shortcutPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\SendTo\Crypto Notepad.lnk";
if (File.Exists(shortcutPath))
{
File.Delete(shortcutPath);
}
}
#region workaround, unhighlight URLs fix
customRTB.DetectUrls = false;
customRTB.DetectUrls = true;
/*workaround, unhighlight URLs fix*/
#endregion
if (ps.ShowToolbar == false && panel2.Visible == true)
{
@ -685,11 +698,6 @@ private void chkMatchWholeWord_CheckedChanged(object sender, EventArgs e)
bool isexist = customRTB.Highlight(searchTextBox.Text, ps.HighlightsColor, chkMatchCase.Checked, chkMatchWholeWord.Checked);
}
private void pictureBox1_Click(object sender, EventArgs e)
{
findToolStripMenuItem2_Click(this, new EventArgs());
}
private void findToolStripMenuItem2_Click(object sender, EventArgs e)
{
if (panel1.Visible == false)
@ -732,6 +740,11 @@ private void documentationToolStripMenuItem_Click(object sender, EventArgs e)
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
findToolStripMenuItem2_Click(this, new EventArgs());
}
private void pictureBox2_Click(object sender, EventArgs e)
{
newToolStripMenuItem_Click_1(this, new EventArgs());
@ -813,6 +826,11 @@ private void pictureBox1_MouseLeave(object sender, EventArgs e)
pictureBox1.Image = Properties.Resources.close_g;
}
private void pictureBox13_Click(object sender, EventArgs e)
{
AutoLock(false);
}
private void правкаToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
if (customRTB.SelectionLength != 0)
@ -966,11 +984,6 @@ protected override void WndProc(ref Message m)
base.WndProc(ref m);
}
private void pictureBox13_Click(object sender, EventArgs e)
{
AutoLock(false);
}
private void lockToolStripMenuItem_Click(object sender, EventArgs e)
{
AutoLock(false);