Crypto-Notepad/Crypto Notepad/SettingsForm.cs

786 lines
30 KiB
C#
Raw Normal View History

2019-10-04 18:46:10 +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-08-21 09:23:51 +00:00
using System.Drawing.Drawing2D;
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
2019-10-04 18:44:30 +00:00
/*Methods*/
private void LoadSettings()
{
editorFontColor.BackColor = settings.editroForeColor;
editorBGColor.BackColor = settings.editorBackColor;
insKeyComboBox.Text = settings.insKey;
paddingLeftTextBox.Text = settings.editorPaddingLeft;
linksComboBox.Text = settings.openLinks;
fontDialog.Font = settings.editorFont;
autoLockCheckBox.Checked = settings.autoLock;
updatesCheckBox.Checked = settings.autoCheckUpdate;
mainMenuCheckBox.Checked = settings.mainMenuVisible;
menuIconsCheckBox.Checked = settings.menuIcons;
integrateCheckBox.Checked = settings.explorerIntegrate;
associateCheckBox.Checked = settings.explorerAssociate;
sendToCheckBox.Checked = settings.explorerSendTo;
hashComboBox.Text = settings.HashAlgorithm;
keySizeComboBox.Text = settings.KeySize;
pwdIterationsTextBox.Text = settings.PasswordIterations;
searchBackColor.BackColor = settings.searchPanelBackColor;
searchFontColor.BackColor = settings.searchPanelForeColor;
toolbarBackColor.BackColor = settings.toolbarBackColor;
toolbarBorder.Checked = settings.toolbarBorder;
toolbarVisible.Checked = settings.toolbarVisible;
toolbarOldIcons.Checked = settings.oldToolbarIcons;
statusBackColor.BackColor = settings.statusPanelBackColor;
statusFontColor.BackColor = settings.statusPanelFontColor;
statusPanelVisible.Checked = settings.statusPanelVisible;
LNVisibleComboBox.Text = settings.lnVisible;
LNBackColor.BackColor = settings.lnBackColor;
LNFontColor.BackColor = settings.lnForeColor;
BLShowСomboBox.Text = settings.blShow;
BLColor.BackColor = settings.blColor;
BLStyleComboBox.Text = settings.blStyle;
GLShowComboBox.Text = settings.glShow;
GLColor.BackColor = settings.glColor;
GLStyleComboBox.Text = settings.glStyle;
MLVisibleComboBox.Text = settings.mlVisible;
MLColor.BackColor = settings.mlColor;
MLStyleComboBox.Text = settings.mlStyle;
MLSideComboBox.Text = settings.mlSide;
}
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();
}
2019-10-04 18:44:30 +00:00
/*Methods*/
2018-12-17 12:58:07 +00:00
/*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;
settingsNav.SelectedIndex = 0;
2019-10-04 18:44:30 +00:00
LoadSettings();
2019-09-28 19:27:05 +00:00
}
private void PaddingLeftTextBox_Click(object sender, EventArgs e)
{
paddingLeftTextBox.SelectAll();
}
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-09-28 19:27:05 +00:00
if (string.IsNullOrWhiteSpace(paddingLeftTextBox.Text))
{
settings.editorPaddingLeft = "0";
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
}
settings.Save();
}
/*Form Events*/
2019-09-28 19:27:05 +00:00
/*Settings Section*/
private void EditorFontColor_Click(object sender, EventArgs e)
{
colorDialog.Color = editorFontColor.BackColor;
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;
editorFontColor.BackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
}
2019-09-28 19:27:05 +00:00
}
private void EditorBGColor_Click(object sender, EventArgs e)
{
colorDialog.Color = editorBGColor.BackColor;
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;
editorBGColor.BackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
}
}
2019-09-28 19:27:05 +00:00
private void LNBackColor_Click(object sender, EventArgs e)
{
colorDialog.Color = LNBackColor.BackColor;
using (new CenterWinDialog(this))
{
2019-09-28 19:27:05 +00:00
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.RTBLineNumbers.BackColor = colorDialog.Color;
2019-10-04 18:44:30 +00:00
LNBackColor.BackColor = colorDialog.Color;
settings.lnBackColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
}
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 LNFontColor_Click(object sender, EventArgs e)
{
colorDialog.Color = LNFontColor.BackColor;
using (new CenterWinDialog(this))
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.RTBLineNumbers.ForeColor = colorDialog.Color;
2019-10-04 18:44:30 +00:00
LNFontColor.BackColor = colorDialog.Color;
settings.lnForeColor = colorDialog.Color;
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 BLColor_Click(object sender, EventArgs e)
{
colorDialog.Color = BLColor.BackColor;
using (new CenterWinDialog(this))
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.RTBLineNumbers.BorderLines_Color = colorDialog.Color;
2019-10-04 18:44:30 +00:00
BLColor.BackColor = colorDialog.Color;
settings.blColor = colorDialog.Color;
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 GLColor_Click(object sender, EventArgs e)
2016-01-06 14:47:38 +00:00
{
2019-09-28 19:27:05 +00:00
colorDialog.Color = GLColor.BackColor;
using (new CenterWinDialog(this))
{
2019-09-28 19:27:05 +00:00
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.RTBLineNumbers.GridLines_Color = colorDialog.Color;
2019-10-04 18:44:30 +00:00
GLColor.BackColor = colorDialog.Color;
settings.glColor = colorDialog.Color;
2019-09-28 19:27:05 +00:00
}
}
}
2019-09-28 19:27:05 +00:00
private void SettingsNav_Click(object sender, EventArgs e)
{
switch (settingsNav.SelectedIndex)
{
case 0:
settingsTabControl.SelectedTab = editorTabPage;
break;
case 1:
settingsTabControl.SelectedTab = lineNumbersTabPage;
break;
case 2:
settingsTabControl.SelectedTab = statusPanelTabPage;
break;
case 3:
settingsTabControl.SelectedTab = toolbarTabPage;
break;
case 4:
settingsTabControl.SelectedTab = applicationTabPage;
break;
case 5:
settingsTabControl.SelectedTab = searchPanelTabPage;
break;
case 6:
settingsTabControl.SelectedTab = integrationTabPage;
break;
case 7:
settingsTabControl.SelectedTab = encryptionTabPage;
break;
}
}
private void SettingsTabControl_SelectedIndexChanged(object sender, EventArgs e)
{
settingsTabControl.Focus();
}
private void ToolbarVisible_Click(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
2019-10-04 18:44:30 +00:00
main.toolbarPanel.Visible = toolbarVisible.Checked;
main.RTBLineNumbers.Height = 1;
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
settings.toolbarVisible= toolbarVisible.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-09-28 19:27:05 +00:00
if (associateCheckBox.Checked)
{
AssociateExtension(Assembly.GetEntryAssembly().Location, "cnp");
}
else
{
DissociateExtension(Assembly.GetEntryAssembly().Location, "cnp");
}
2019-10-04 18:44:30 +00:00
settings.explorerAssociate = associateCheckBox.Checked;
}
2019-09-28 19:27:05 +00:00
private void IntegrateCheckBox_Click(object sender, EventArgs e)
{
if (integrateCheckBox.Checked)
{
MenuIntegrate("enable");
}
else
{
MenuIntegrate("disable");
}
2019-10-04 18:44:30 +00:00
settings.explorerIntegrate = integrateCheckBox.Checked;
2019-09-28 19:27:05 +00:00
}
2019-09-28 19:27:05 +00:00
private void PaddingLeftTextBox_TextChanged(object sender, EventArgs e)
{
2019-09-28 19:27:05 +00:00
MainForm main = Owner as MainForm;
if (paddingLeftTextBox.Text.Length >= 1)
{
2019-09-28 19:27:05 +00:00
if (settings.editorPaddingLeft != paddingLeftTextBox.Text)
{
main.richTextBox.SetInnerMargins(Convert.ToInt32(paddingLeftTextBox.Text), 0, 0, 0);
main.richTextBox.Refresh();
2019-10-04 18:44:30 +00:00
settings.editorPaddingLeft = paddingLeftTextBox.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)
{
if (sendToCheckBox.Checked)
{
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-04 18:44:30 +00:00
settings.explorerSendTo = sendToCheckBox.Checked;
2019-09-28 19:27:05 +00:00
}
private void InsKeyComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
2019-10-04 18:44:30 +00:00
if (settings.insKey != insKeyComboBox.Text)
2019-09-28 19:27:05 +00:00
{
2019-10-04 18:44:30 +00:00
if (insKeyComboBox.Text == "Disable")
{
main.insMainMenu.ShortcutKeys = Keys.Insert;
}
else
{
main.insMainMenu.ShortcutKeys = Keys.None;
}
settings.insKey = insKeyComboBox.Text;
2019-09-28 19:27:05 +00:00
}
}
private void MenuIconsCheckBox_Click(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
2019-10-04 18:44:30 +00:00
settings.menuIcons = menuIconsCheckBox.Checked;
main.MenuIcons(settings.menuIcons);
2019-09-28 19:27:05 +00:00
}
private void FontButton_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.RTBLineNumbers.Font = fontDialog.Font;
main.richTextBox.SetInnerMargins(Convert.ToInt32(settings.editorPaddingLeft), 0, 0, 0);
}
}
}
private void LNVisibleComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (settings.lnVisible != LNVisibleComboBox.Text)
{
settings.lnVisible = LNVisibleComboBox.Text;
main.RTBLineNumbers.Visible = bool.Parse(settings.lnVisible);
main.RTBLineNumbers.Height = 1;
2019-10-04 18:44:30 +00:00
settings.lnVisible = LNVisibleComboBox.Text;
2019-09-28 19:27:05 +00:00
}
}
private void BLShowСomboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (settings.blShow != BLShowСomboBox.Text)
{
settings.blShow = BLShowСomboBox.Text;
main.RTBLineNumbers.Show_BorderLines = bool.Parse(settings.blShow);
}
}
private void BLStyleComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (settings.blStyle != BLStyleComboBox.Text)
{
switch (BLStyleComboBox.Text)
{
case "Solid":
settings.blStyle = DashStyle.Solid.ToString();
break;
case "Dash":
settings.blStyle = DashStyle.Dash.ToString();
break;
case "Dot":
settings.blStyle = DashStyle.Dot.ToString();
break;
case "DashDot":
settings.blStyle = DashStyle.DashDot.ToString();
break;
case "DashDotDot":
settings.blStyle = DashStyle.DashDotDot.ToString();
break;
}
main.RTBLineNumbers.BorderLines_Style = (DashStyle)Enum.Parse(typeof(DashStyle), settings.blStyle);
}
}
private void GLShowComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (settings.glShow != GLShowComboBox.Text)
{
settings.glShow = GLShowComboBox.Text;
main.RTBLineNumbers.Show_GridLines = bool.Parse(settings.glShow);
}
}
private void GLStyleComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (settings.glStyle.ToString() != GLStyleComboBox.Text)
{
switch (GLStyleComboBox.Text)
{
case "Solid":
settings.glStyle = DashStyle.Solid.ToString(); ;
break;
case "Dash":
settings.glStyle = DashStyle.Dash.ToString();
break;
case "Dot":
settings.glStyle = DashStyle.Dot.ToString();
break;
case "DashDot":
settings.glStyle = DashStyle.DashDot.ToString();
break;
case "DashDotDot":
settings.glStyle = DashStyle.DashDotDot.ToString();
break;
}
main.RTBLineNumbers.GridLines_Style = (DashStyle)Enum.Parse(typeof(DashStyle), settings.glStyle);
}
}
private void KeySizeComboBox_DropDownClosed(object sender, EventArgs e)
{
2019-10-04 18:44:30 +00:00
if (keySizeComboBox.Text != settings.KeySize)
2019-09-28 19:27:05 +00:00
{
settings.KeySize = keySizeComboBox.Text;
}
}
private void HashComboBox_DropDownClosed(object sender, EventArgs e)
{
if (hashComboBox.Text != settings.HashAlgorithm)
{
settings.HashAlgorithm = hashComboBox.Text;
}
}
private void PaddingLeftTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}
private void PwdIterationsTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}
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.RTBLineNumbers.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
}
private void StatusPanelVisible_Click(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
2019-10-04 18:44:30 +00:00
main.statusPanel.Visible = statusPanelVisible.Checked;
2019-09-28 19:27:05 +00:00
main.richTextBox.SetInnerMargins(Convert.ToInt32(paddingLeftTextBox.Text), 0, 0, 0);
2019-10-04 18:44:30 +00:00
settings.statusPanelVisible = statusPanelVisible.Checked;
}
2019-08-21 09:23:51 +00:00
2019-09-28 19:27:05 +00:00
private void StatusBackColor_Click(object sender, EventArgs e)
2019-08-21 09:23:51 +00:00
{
2019-09-28 19:27:05 +00:00
colorDialog.Color = statusBackColor.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-04 18:44:30 +00:00
statusBackColor.BackColor = colorDialog.Color;
settings.statusPanelBackColor = 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 StatusFontColor_Click(object sender, EventArgs e)
2019-08-21 09:23:51 +00:00
{
2019-09-28 19:27:05 +00:00
colorDialog.Color = statusFontColor.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-04 18:44:30 +00:00
statusFontColor.BackColor = colorDialog.Color;
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
}
}
}
private void ToolbarBorder_Click(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (toolbarBorder.Checked)
{
main.toolbarPanel.BorderStyle = BorderStyle.FixedSingle;
}
else
{
main.toolbarPanel.BorderStyle = BorderStyle.None;
2019-08-21 09:23:51 +00:00
}
2019-10-04 18:44:30 +00:00
settings.toolbarBorder = toolbarBorder.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;
main.caseSensitiveCheckBox.ForeColor = colorDialog.Color;
main.wholeWordCheckBox.ForeColor = colorDialog.Color;
main.findNextButton.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;
if (mainMenuCheckBox.Checked)
{
main.mainMenu.Visible = true;
}
else
{
main.mainMenu.Visible = false;
}
2019-10-04 18:44:30 +00:00
settings.mainMenuVisible = mainMenuCheckBox.Checked;
2019-09-28 19:27:05 +00:00
}
2019-10-02 16:24:52 +00:00
private void ToolbarOldIcons_Click(object sender, EventArgs e)
{
settings.oldToolbarIcons = toolbarOldIcons.Checked;
MainForm main = Owner as MainForm;
main.Toolbaricons(settings.oldToolbarIcons);
}
2019-10-04 18:46:10 +00:00
private void LinksComboBox_DropDownClosed(object sender, EventArgs e)
{
if (settings.openLinks != linksComboBox.Text)
{
settings.openLinks = linksComboBox.Text;
}
}
private void AutoLockCheckBox_Click(object sender, EventArgs e)
{
settings.autoLock = autoLockCheckBox.Checked;
}
private void UpdatesCheckBox_Click(object sender, EventArgs e)
{
settings.autoCheckUpdate = updatesCheckBox.Checked;
}
private void PwdIterationsTextBox_TextChanged(object sender, EventArgs e)
{
if (pwdIterationsTextBox.Text != settings.PasswordIterations)
{
settings.PasswordIterations = pwdIterationsTextBox.Text;
}
}
private void MLVisibleComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (settings.mlVisible != MLVisibleComboBox.Text)
{
settings.mlVisible = MLVisibleComboBox.Text;
main.RTBLineNumbers.Show_MarginLines = bool.Parse(settings.mlVisible);
}
}
private void MLSideComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (settings.mlSide.ToString() != MLSideComboBox.Text)
{
switch (MLSideComboBox.Text)
{
case "None":
settings.mlSide = LineNumbers.LineNumbers.LineNumberDockSide.None.ToString();
break;
case "Left":
settings.mlSide = LineNumbers.LineNumbers.LineNumberDockSide.Left.ToString();
break;
case "Right":
settings.mlSide = LineNumbers.LineNumbers.LineNumberDockSide.Right.ToString();
break;
case "Height":
settings.mlSide = LineNumbers.LineNumbers.LineNumberDockSide.Height.ToString();
break;
}
main.RTBLineNumbers.MarginLines_Side = (LineNumbers.LineNumbers.LineNumberDockSide)Enum.Parse(typeof(LineNumbers.LineNumbers.LineNumberDockSide), settings.mlSide);
}
}
private void MLStyleComboBox_DropDownClosed(object sender, EventArgs e)
{
MainForm main = Owner as MainForm;
if (settings.mlStyle != MLStyleComboBox.Text)
{
switch (MLStyleComboBox.Text)
{
case "Solid":
settings.mlStyle = DashStyle.Solid.ToString();
break;
case "Dash":
settings.mlStyle = DashStyle.Dash.ToString();
break;
case "Dot":
settings.mlStyle = DashStyle.Dot.ToString();
break;
case "DashDot":
settings.mlStyle = DashStyle.DashDot.ToString();
break;
case "DashDotDot":
settings.mlStyle = DashStyle.DashDotDot.ToString();
break;
}
main.RTBLineNumbers.MarginLines_Style = (DashStyle)Enum.Parse(typeof(DashStyle), settings.mlStyle);
}
}
private void MLColor_Click(object sender, EventArgs e)
{
colorDialog.Color = MLColor.BackColor;
using (new CenterWinDialog(this))
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
MainForm main = Owner as MainForm;
main.RTBLineNumbers.MarginLines_Color = colorDialog.Color;
MLColor.BackColor = colorDialog.Color;
settings.mlColor = colorDialog.Color;
}
}
}
/*Settings Section*/
2019-09-28 19:27:05 +00:00
2016-01-06 14:47:38 +00:00
}
2019-09-28 19:27:05 +00:00
}