Crypto-Notepad/Crypto Notepad/SettingsForm.cs

594 lines
24 KiB
C#
Raw Normal View History

2019-10-11 10:39:15 +00:00
using IWshRuntimeLibrary;
2019-09-28 19:27:05 +00:00
using Microsoft.Win32;
2016-01-06 14:47:38 +00:00
using System;
using System.Drawing;
2019-09-28 19:27:05 +00:00
using System.IO;
2019-08-21 11:15:16 +00:00
using System.Linq;
2016-01-06 14:47:38 +00:00
using System.Reflection;
using System.Windows.Forms;
2016-01-09 20:46:25 +00:00
namespace Crypto_Notepad
2016-01-06 14:47:38 +00:00
{
public partial class SettingsForm : Form
{
2019-09-28 19:27:05 +00:00
Properties.Settings settings = Properties.Settings.Default;
2016-01-06 14:47:38 +00:00
public SettingsForm()
{
InitializeComponent();
}
2016-01-15 16:14:42 +00:00
#region Methods
2019-10-04 18:44:30 +00:00
private void LoadSettings()
{
2019-10-13 11:54:45 +00:00
editorFontColor.BackColor = settings.editroForeColor;
editorBackColor.BackColor = settings.editorBackColor;
editorInsertKeyComboBox.Text = settings.insertKey;
editorPaddingLeftTextBox.Text = settings.editorPaddingLeft;
editorOpenLinksWithComboBox.Text = settings.openLinks;
editorBorderComboBox.Text = settings.editorBorder;
2019-10-04 18:44:30 +00:00
fontDialog.Font = settings.editorFont;
2019-10-13 11:54:45 +00:00
autoLockOnMinimizeCheckBox.Checked = settings.autoLock;
autoCheckUpdatesCheckBox.Checked = settings.autoCheckUpdate;
mainMenuCheckBox.Checked = settings.mainMenuVisible;
menuIconsCheckBox.Checked = settings.menuIcons;
minimizeToTrayCheckBox.Checked = settings.minimizeToTray;
closeToTrayCheckBox.Checked = settings.closeToTray;
2019-10-20 19:59:52 +00:00
singleInstanceCheckBox.Checked = settings.singleInstance;
2019-10-13 11:54:45 +00:00
integrateCheckBox.Checked = settings.explorerIntegrate;
associateCheckBox.Checked = settings.explorerAssociate;
sendToCheckBox.Checked = settings.explorerSendTo;
hashAlgorithmComboBox.Text = settings.HashAlgorithm;
keySizeComboBox.Text = settings.KeySize;
passwordIterationsTextBox.Text = settings.PasswordIterations;
2019-10-04 18:44:30 +00:00
searchBackColor.BackColor = settings.searchPanelBackColor;
searchFontColor.BackColor = settings.searchPanelForeColor;
2019-10-17 21:27:17 +00:00
searchBorderComboBox.Text = settings.searchPanelBorder;
2019-10-04 18:44:30 +00:00
toolbarBackColor.BackColor = settings.toolbarBackColor;
2019-10-13 11:54:45 +00:00
toolbarBorderCheckBox.Checked = settings.toolbarBorder;
toolbarVisibleCheckBox.Checked = settings.toolbarVisible;
toolbarOldIconsCheckBox.Checked = settings.oldToolbarIcons;
toolbarCloseButtonCheckBox.Checked = settings.toolbarCloseButton;
2019-10-13 11:54:45 +00:00
statusPanelBackColor.BackColor = settings.statusPanelBackColor;
statusPanelFontColor.BackColor = settings.statusPanelFontColor;
statusPanelVisibleCheckBox.Checked = settings.statusPanelVisible;
2019-10-04 18:44:30 +00:00
}
private static void AssociateExtension(string applicationExecutablePath, string extension)
{
try
2016-01-06 14:47:38 +00:00
{
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Classes", true);
key.CreateSubKey("." + extension).SetValue(string.Empty, extension + "_auto_file");
key = key.CreateSubKey(extension + "_auto_file");
2016-01-15 16:14:42 +00:00
key.CreateSubKey("DefaultIcon").SetValue(string.Empty, applicationExecutablePath + ",0");
key = key.CreateSubKey("Shell");
key.SetValue(string.Empty, "Open");
key = key.CreateSubKey("Open");
key.CreateSubKey("Command").SetValue(string.Empty, "\"" + applicationExecutablePath + "\" \"%1\" /o");
key.CreateSubKey("ddeexec\\Topic").SetValue(string.Empty, "System");
2016-01-06 14:47:38 +00:00
}
catch (Exception)
{
2016-01-06 14:47:38 +00:00
2018-12-06 13:24:12 +00:00
}
2016-01-06 14:47:38 +00:00
}
2018-12-17 12:58:07 +00:00
private static void DissociateExtension(string applicationExecutablePath, string extension)
2016-01-06 14:47:38 +00:00
{
try
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Classes", true);
RegistryKey subKeyTree = Registry.CurrentUser.OpenSubKey(@"Software\Classes\" + extension + "_auto_file", true);
if (subKeyTree != null)
{
key.DeleteSubKeyTree(extension + "_auto_file");
key.DeleteSubKeyTree("." + extension);
}
}
catch { }
2016-01-06 14:47:38 +00:00
}
private static void MenuIntegrate(string action)
2018-12-17 12:58:07 +00:00
{
string appExePath = Assembly.GetEntryAssembly().Location;
try
{
if (action == "enable")
{
2018-12-17 14:42:08 +00:00
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\*\", true);
key = key.CreateSubKey("shell");
2018-12-17 12:58:07 +00:00
key.CreateSubKey("Crypto Notepad").SetValue("icon", appExePath);
key.CreateSubKey("Crypto Notepad").SetValue("SubCommands", "");
key.CreateSubKey(@"Crypto Notepad\shell");
2018-12-17 13:58:37 +00:00
key.CreateSubKey(@"Crypto Notepad\shell\cmd1\").SetValue("MUIVerb", "Encrypt");
key.CreateSubKey(@"Crypto Notepad\shell\cmd1\command").SetValue(string.Empty, "\"" + appExePath + "\" \"%1\" /er");
key.CreateSubKey(@"Crypto Notepad\shell\cmd2\").SetValue("MUIVerb", "Decrypt");
2018-12-17 12:58:07 +00:00
key.CreateSubKey(@"Crypto Notepad\shell\cmd2\command").SetValue(string.Empty, "\"" + appExePath + "\" \"%1\" /o");
}
if (action == "disable")
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\*\shell\", true);
RegistryKey subKeyTree = Registry.CurrentUser.OpenSubKey(@"Software\Classes\*\shell\Crypto Notepad", true);
if (subKeyTree != null)
{
key.DeleteSubKeyTree("Crypto Notepad");
}
2018-12-17 12:58:07 +00:00
}
}
catch { }
2018-12-17 12:58:07 +00:00
}
2019-09-28 19:27:05 +00:00
private void SendToShortcut()
{
string shortcutPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\SendTo";
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;
shortcut.IconLocation = targetFileLocation;
shortcut.TargetPath = targetFileLocation;
shortcut.Arguments = "/s";
shortcut.Save();
}
#endregion
2018-12-17 12:58:07 +00:00
#region Form Events
private void SettingsForm_Load(object sender, EventArgs e)
2016-01-06 14:47:38 +00:00
{
2019-09-28 19:27:05 +00:00
string custom_colors = settings.customColor;
int[] array_of_colors = custom_colors.Split(';').Select(n => Convert.ToInt32(n)).ToArray();
colorDialog.CustomColors = array_of_colors;
settingsTabControl.Appearance = TabAppearance.FlatButtons;
settingsTabControl.ItemSize = new Size(0, 1);
settingsTabControl.SizeMode = TabSizeMode.Fixed;
2019-10-13 11:54:45 +00:00
settingsNavigation.SelectedIndex = 0;
2019-10-11 10:31:24 +00:00
TopMost = settings.alwaysOnTop;
2019-10-16 19:25:04 +00:00
settingsTabControl.TabStop = false;
2019-10-04 18:44:30 +00:00
LoadSettings();
2019-09-28 19:27:05 +00:00
}
2019-10-13 11:54:45 +00:00
private void EditorPaddingLeftTextBox_Click(object sender, EventArgs e)
2019-09-28 19:27:05 +00:00
{
2019-10-13 11:54:45 +00:00
editorPaddingLeftTextBox.SelectAll();
2019-09-28 19:27:05 +00:00
}
private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e)
{
MainForm main = Owner as MainForm;
string customColor = string.Join(";", colorDialog.CustomColors);
settings.customColor = customColor;
if (string.IsNullOrWhiteSpace(settings.PasswordIterations))
{
2019-09-28 19:27:05 +00:00
settings.PasswordIterations = "1";
}
2019-10-13 11:54:45 +00:00
if (string.IsNullOrWhiteSpace(editorPaddingLeftTextBox.Text))
2019-09-28 19:27:05 +00:00
{
settings.editorPaddingLeft = "0";
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
}
settings.Save();
}
private void EditorPaddingLeftTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}
private void PasswordIterationsTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}
#endregion
#region Settings Section
2019-09-28 19:27:05 +00:00
private void EditorFontColor_Click(object sender, EventArgs e)
{
2019-10-13 11:54:45 +00:00
colorDialog.Color = editorFontColor.BackColor;
2019-09-28 19:27:05 +00:00
using (new CenterWinDialog(this))
{
2019-09-28 19:27:05 +00:00
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.richTextBox.ForeColor = colorDialog.Color;
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
2019-10-04 18:44:30 +00:00
settings.editroForeColor = colorDialog.Color;
2019-10-13 11:54:45 +00:00
editorFontColor.BackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
}
2019-09-28 19:27:05 +00:00
}
2019-10-13 11:54:45 +00:00
private void EditorBackColor_Click(object sender, EventArgs e)
2019-09-28 19:27:05 +00:00
{
2019-10-13 11:54:45 +00:00
colorDialog.Color = editorBackColor.BackColor;
2019-09-28 19:27:05 +00:00
using (new CenterWinDialog(this))
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.richTextBox.BackColor = colorDialog.Color;
main.BackColor = colorDialog.Color;
2019-10-04 18:44:30 +00:00
settings.editorBackColor = colorDialog.Color;
2019-10-13 11:54:45 +00:00
editorBackColor.BackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
}
}
2019-10-13 11:54:45 +00:00
private void SettingsNavigation_Click(object sender, EventArgs e)
2019-09-28 19:27:05 +00:00
{
2019-10-13 11:54:45 +00:00
switch (settingsNavigation.SelectedIndex)
2019-09-28 19:27:05 +00:00
{
case 0:
settingsTabControl.SelectedTab = applicationTabPage;
2019-09-28 19:27:05 +00:00
break;
case 1:
settingsTabControl.SelectedTab = toolbarTabPage;
2019-09-28 19:27:05 +00:00
break;
case 2:
settingsTabControl.SelectedTab = statusPanelTabPage;
break;
case 3:
settingsTabControl.SelectedTab = searchPanelTabPage;
2019-09-28 19:27:05 +00:00
break;
case 4:
settingsTabControl.SelectedTab = editorTabPage;
2019-09-28 19:27:05 +00:00
break;
case 5:
settingsTabControl.SelectedTab = encryptionTabPage;
2019-09-28 19:27:05 +00:00
break;
2019-10-25 21:23:36 +00:00
case 6:
settingsTabControl.SelectedTab = integrationTabPage;
2019-09-28 19:27:05 +00:00
break;
}
2019-09-28 19:27:05 +00:00
}
private void SettingsTabControl_SelectedIndexChanged(object sender, EventArgs e)
{
settingsTabControl.Focus();
}
2019-10-13 11:54:45 +00:00
private void ToolbarVisibleCheckBox_Click(object sender, EventArgs e)
2019-09-28 19:27:05 +00:00
{
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
main.toolbarPanel.Visible = toolbarVisibleCheckBox.Checked;
2019-10-04 18:44:30 +00:00
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
2019-10-13 11:54:45 +00:00
settings.toolbarVisible= toolbarVisibleCheckBox.Checked;
2016-01-06 14:47:38 +00:00
}
2019-09-28 19:27:05 +00:00
private void AssociateCheckBox_Click(object sender, EventArgs e)
2016-01-06 14:47:38 +00:00
{
2019-10-13 11:54:45 +00:00
if (associateCheckBox.Checked)
2019-09-28 19:27:05 +00:00
{
AssociateExtension(Assembly.GetEntryAssembly().Location, "cnp");
}
else
{
DissociateExtension(Assembly.GetEntryAssembly().Location, "cnp");
}
2019-10-13 11:54:45 +00:00
settings.explorerAssociate = associateCheckBox.Checked;
}
2019-09-28 19:27:05 +00:00
private void IntegrateCheckBox_Click(object sender, EventArgs e)
{
2019-10-13 11:54:45 +00:00
if (integrateCheckBox.Checked)
2019-09-28 19:27:05 +00:00
{
MenuIntegrate("enable");
}
else
{
MenuIntegrate("disable");
}
2019-10-13 11:54:45 +00:00
settings.explorerIntegrate = integrateCheckBox.Checked;
2019-09-28 19:27:05 +00:00
}
2019-10-13 11:54:45 +00:00
private void EditorPaddingLeftTextBox_TextChanged(object sender, EventArgs e)
{
2019-09-28 19:27:05 +00:00
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
if (editorPaddingLeftTextBox.Text.Length >= 1)
{
2019-10-13 11:54:45 +00:00
if (settings.editorPaddingLeft != editorPaddingLeftTextBox.Text)
2019-09-28 19:27:05 +00:00
{
2019-10-13 11:54:45 +00:00
main.richTextBox.SetInnerMargins(Convert.ToInt32(editorPaddingLeftTextBox.Text), 0, 0, 0);
2019-09-28 19:27:05 +00:00
main.richTextBox.Refresh();
2019-10-13 11:54:45 +00:00
settings.editorPaddingLeft = editorPaddingLeftTextBox.Text;
2019-09-28 19:27:05 +00:00
}
}
2016-01-06 14:47:38 +00:00
}
2019-09-28 19:27:05 +00:00
private void SendToCheckBox_Click(object sender, EventArgs e)
{
2019-10-13 11:54:45 +00:00
if (sendToCheckBox.Checked)
2019-09-28 19:27:05 +00:00
{
SendToShortcut();
}
else
{
string shortcutPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\SendTo\Crypto Notepad.lnk";
if (System.IO.File.Exists(shortcutPath))
{
System.IO.File.Delete(shortcutPath);
}
}
2019-10-13 11:54:45 +00:00
settings.explorerSendTo = sendToCheckBox.Checked;
2019-09-28 19:27:05 +00:00
}
2019-10-13 11:54:45 +00:00
private void EditorInsertKeyComboBox_DropDownClosed(object sender, EventArgs e)
2019-09-28 19:27:05 +00:00
{
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
if (settings.insertKey != editorInsertKeyComboBox.Text)
2019-09-28 19:27:05 +00:00
{
2019-10-13 11:54:45 +00:00
if (editorInsertKeyComboBox.Text == "Disable")
2019-10-04 18:44:30 +00:00
{
2019-10-13 11:54:45 +00:00
main.insertMainMenu.ShortcutKeys = Keys.Insert;
2019-10-04 18:44:30 +00:00
}
else
{
2019-10-13 11:54:45 +00:00
main.insertMainMenu.ShortcutKeys = Keys.None;
2019-10-04 18:44:30 +00:00
}
2019-10-13 11:54:45 +00:00
settings.insertKey = editorInsertKeyComboBox.Text;
2019-09-28 19:27:05 +00:00
}
}
private void MenuIconsCheckBox_Click(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
settings.menuIcons = menuIconsCheckBox.Checked;
main.MenuIcons(settings.menuIcons);
2019-09-28 19:27:05 +00:00
}
2019-10-13 11:54:45 +00:00
private void EditorFontButton_Click(object sender, EventArgs e)
{
using (new CenterWinDialog(this))
{
2019-09-28 19:27:05 +00:00
if (fontDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.richTextBox.Font = fontDialog.Font;
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
2019-10-28 18:25:22 +00:00
settings.editorFont = fontDialog.Font;
2019-09-28 19:27:05 +00:00
}
}
}
private void KeySizeComboBox_DropDownClosed(object sender, EventArgs e)
{
2019-10-13 11:54:45 +00:00
if (keySizeComboBox.Text != settings.KeySize)
2019-09-28 19:27:05 +00:00
{
2019-10-13 11:54:45 +00:00
settings.KeySize = keySizeComboBox.Text;
2019-09-28 19:27:05 +00:00
}
}
2019-10-13 11:54:45 +00:00
private void HashAlgorithmComboBox_DropDownClosed(object sender, EventArgs e)
2019-09-28 19:27:05 +00:00
{
2019-10-13 11:54:45 +00:00
if (hashAlgorithmComboBox.Text != settings.HashAlgorithm)
2019-09-28 19:27:05 +00:00
{
2019-10-13 11:54:45 +00:00
settings.HashAlgorithm = hashAlgorithmComboBox.Text;
2019-09-28 19:27:05 +00:00
}
}
private void FontDialog_Apply(object sender, EventArgs e)
{
2019-09-28 19:27:05 +00:00
MainForm main = Owner as MainForm;
main.richTextBox.Font = fontDialog.Font;
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
2019-10-04 18:44:30 +00:00
settings.editorFont = fontDialog.Font;
2019-09-28 19:27:05 +00:00
}
2019-10-13 11:54:45 +00:00
private void StatusPanelVisibleCheckBox_Click(object sender, EventArgs e)
2019-09-28 19:27:05 +00:00
{
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
main.statusPanel.Visible = statusPanelVisibleCheckBox.Checked;
main.richTextBox.SetInnerMargins(Convert.ToInt32(editorPaddingLeftTextBox.Text), 0, 0, 0);
settings.statusPanelVisible = statusPanelVisibleCheckBox.Checked;
}
2019-08-21 09:23:51 +00:00
2019-10-13 11:54:45 +00:00
private void StatusPanelBackColor_Click(object sender, EventArgs e)
2019-08-21 09:23:51 +00:00
{
2019-10-13 11:54:45 +00:00
colorDialog.Color = statusPanelBackColor.BackColor;
2019-08-21 09:23:51 +00:00
using (new CenterWinDialog(this))
{
2019-09-28 19:27:05 +00:00
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.statusPanel.BackColor = colorDialog.Color;
2019-10-13 11:54:45 +00:00
statusPanelBackColor.BackColor = colorDialog.Color;
2019-10-04 18:44:30 +00:00
settings.statusPanelBackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
2019-08-21 09:23:51 +00:00
}
}
2019-10-13 11:54:45 +00:00
private void StatusPanelFontColor_Click(object sender, EventArgs e)
2019-08-21 09:23:51 +00:00
{
2019-10-13 11:54:45 +00:00
colorDialog.Color = statusPanelFontColor.BackColor;
2019-08-21 09:23:51 +00:00
using (new CenterWinDialog(this))
{
2019-09-28 19:27:05 +00:00
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.statusPanel.ForeColor = colorDialog.Color;
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
2019-10-13 11:54:45 +00:00
statusPanelFontColor.BackColor = colorDialog.Color;
2019-10-04 18:44:30 +00:00
settings.statusPanelFontColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
2019-08-21 09:23:51 +00:00
}
}
2019-09-28 19:27:05 +00:00
private void ToolbarBackColor_Click(object sender, EventArgs e)
2019-08-21 09:23:51 +00:00
{
2019-09-28 19:27:05 +00:00
colorDialog.Color = toolbarBackColor.BackColor;
2019-08-21 09:23:51 +00:00
using (new CenterWinDialog(this))
{
2019-09-28 19:27:05 +00:00
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.toolbarPanel.BackColor = colorDialog.Color;
2019-10-04 18:44:30 +00:00
settings.toolbarBackColor = colorDialog.Color;
toolbarBackColor.BackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
}
}
2019-10-13 11:54:45 +00:00
private void ToolbarBorderCheckBox_Click(object sender, EventArgs e)
2019-09-28 19:27:05 +00:00
{
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
if (toolbarBorderCheckBox.Checked)
2019-09-28 19:27:05 +00:00
{
main.toolbarPanel.BorderStyle = BorderStyle.FixedSingle;
}
else
{
main.toolbarPanel.BorderStyle = BorderStyle.None;
2019-08-21 09:23:51 +00:00
}
2019-10-13 11:54:45 +00:00
settings.toolbarBorder = toolbarBorderCheckBox.Checked;
2019-08-21 09:23:51 +00:00
}
2019-09-28 19:27:05 +00:00
private void SearchBackColor_Click(object sender, EventArgs e)
2019-08-21 09:23:51 +00:00
{
2019-09-28 19:27:05 +00:00
colorDialog.Color = searchBackColor.BackColor;
2019-08-21 09:23:51 +00:00
using (new CenterWinDialog(this))
{
2019-09-28 19:27:05 +00:00
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.searchPanel.BackColor = colorDialog.Color;
main.searchTextBox.BackColor = colorDialog.Color;
2019-10-04 18:44:30 +00:00
settings.searchPanelBackColor = colorDialog.Color;
searchBackColor.BackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
2019-08-21 09:23:51 +00:00
}
}
2019-09-28 19:27:05 +00:00
private void SearchFontColor_Click(object sender, EventArgs e)
2019-08-21 11:15:16 +00:00
{
2019-09-28 19:27:05 +00:00
colorDialog.Color = searchFontColor.BackColor;
using (new CenterWinDialog(this))
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.searchTextBox.ForeColor = colorDialog.Color;
2019-10-13 11:54:45 +00:00
main.searchCaseSensitiveCheckBox.ForeColor = colorDialog.Color;
main.searchWholeWordCheckBox.ForeColor = colorDialog.Color;
main.searchFindNextButton.ForeColor = colorDialog.Color;
main.searchCloseButton.ForeColor = colorDialog.Color;
2019-10-04 18:44:30 +00:00
settings.searchPanelForeColor = colorDialog.Color;
searchFontColor.BackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
}
2019-08-21 11:15:16 +00:00
}
2019-09-28 19:27:05 +00:00
private void MainMenuCheckBox_Click(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
if (mainMenuCheckBox.Checked)
2019-09-28 19:27:05 +00:00
{
main.mainMenu.Visible = true;
}
else
{
main.mainMenu.Visible = false;
}
2019-10-13 11:54:45 +00:00
settings.mainMenuVisible = mainMenuCheckBox.Checked;
2019-09-28 19:27:05 +00:00
}
2019-10-02 16:24:52 +00:00
2019-10-13 11:54:45 +00:00
private void ToolbarOldIconsCheckBox_Click(object sender, EventArgs e)
2019-10-02 16:24:52 +00:00
{
2019-10-13 11:54:45 +00:00
settings.oldToolbarIcons = toolbarOldIconsCheckBox.Checked;
2019-10-02 16:24:52 +00:00
MainForm main = Owner as MainForm;
2019-10-18 10:34:14 +00:00
main.ToolbarIcons(settings.oldToolbarIcons);
2019-10-02 16:24:52 +00:00
}
2019-10-04 18:46:10 +00:00
2019-10-13 11:54:45 +00:00
private void EditorOpenLinksWithComboBox_DropDownClosed(object sender, EventArgs e)
2019-10-04 18:46:10 +00:00
{
2019-10-13 11:54:45 +00:00
if (settings.openLinks != editorOpenLinksWithComboBox.Text)
2019-10-04 18:46:10 +00:00
{
2019-10-13 11:54:45 +00:00
settings.openLinks = editorOpenLinksWithComboBox.Text;
2019-10-04 18:46:10 +00:00
}
}
2019-10-13 11:54:45 +00:00
private void AutoLockOnMinimizeCheckBox_Click(object sender, EventArgs e)
2019-10-04 18:46:10 +00:00
{
2019-10-13 11:54:45 +00:00
settings.autoLock = autoLockOnMinimizeCheckBox.Checked;
2019-10-04 18:46:10 +00:00
}
2019-10-13 11:54:45 +00:00
private void AutoCheckUpdatesCheckBox_Click(object sender, EventArgs e)
2019-10-04 18:46:10 +00:00
{
2019-10-13 11:54:45 +00:00
settings.autoCheckUpdate = autoCheckUpdatesCheckBox.Checked;
2019-10-04 18:46:10 +00:00
}
2019-10-13 11:54:45 +00:00
private void PasswordIterationsTextBox_TextChanged(object sender, EventArgs e)
2019-10-04 18:46:10 +00:00
{
2019-10-13 11:54:45 +00:00
if (passwordIterationsTextBox.Text != settings.PasswordIterations)
2019-10-04 18:46:10 +00:00
{
2019-10-13 11:54:45 +00:00
settings.PasswordIterations = passwordIterationsTextBox.Text;
2019-10-04 18:46:10 +00:00
}
2019-10-25 21:23:36 +00:00
}
2019-10-11 10:39:15 +00:00
2019-10-13 11:54:45 +00:00
private void MinimizeToTrayCheckBox_Click(object sender, EventArgs e)
2019-10-11 10:39:15 +00:00
{
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
if (closeToTrayCheckBox.Checked == false & minimizeToTrayCheckBox.Checked == false)
2019-10-11 10:39:15 +00:00
{
main.trayIcon.Visible = false;
}
2019-10-13 11:54:45 +00:00
if (minimizeToTrayCheckBox.Checked == true)
2019-10-11 10:39:15 +00:00
{
main.trayIcon.Visible = true;
}
2019-10-13 11:54:45 +00:00
settings.minimizeToTray = minimizeToTrayCheckBox.Checked;
2019-10-11 10:39:15 +00:00
}
2019-10-13 11:54:45 +00:00
private void CloseToTrayCheckBox_Click(object sender, EventArgs e)
2019-10-11 10:39:15 +00:00
{
MainForm main = Owner as MainForm;
2019-10-13 11:54:45 +00:00
if (closeToTrayCheckBox.Checked == false & minimizeToTrayCheckBox.Checked ==false )
2019-10-11 10:39:15 +00:00
{
main.trayIcon.Visible = false;
}
2019-10-13 11:54:45 +00:00
if (closeToTrayCheckBox.Checked == true)
2019-10-11 10:39:15 +00:00
{
main.trayIcon.Visible = true;
}
2019-10-13 11:54:45 +00:00
settings.closeToTray = closeToTrayCheckBox.Checked;
2019-10-11 10:39:15 +00:00
}
2019-10-13 11:54:45 +00:00
private void EditorBorderComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
main.richTextBoxPanel.BorderStyle = (BorderStyle)Enum.Parse(typeof(BorderStyle), editorBorderComboBox.Text);
settings.editorBorder = editorBorderComboBox.Text;
}
2019-10-17 21:27:17 +00:00
private void SearchBorderComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
main.searchPanel.CellBorderStyle = (TableLayoutPanelCellBorderStyle)Enum.Parse(typeof(TableLayoutPanelCellBorderStyle), searchBorderComboBox.Text);
settings.searchPanelBorder = searchBorderComboBox.Text;
}
private void ToolbarCloseButtonCheckBox_Click(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
main.closeToolbarButton.Visible = toolbarCloseButtonCheckBox.Checked;
settings.toolbarCloseButton = toolbarCloseButtonCheckBox.Checked;
}
2019-10-20 19:59:52 +00:00
private void SingleInstanceCheckBox_Click(object sender, EventArgs e)
{
settings.singleInstance = singleInstanceCheckBox.Checked;
}
#endregion
2019-09-28 19:27:05 +00:00
2016-01-06 14:47:38 +00:00
}
2019-09-28 19:27:05 +00:00
}