diff --git a/LinearAppLauncher.csproj b/LinearAppLauncher.csproj index 479e7b1..4a17da8 100644 --- a/LinearAppLauncher.csproj +++ b/LinearAppLauncher.csproj @@ -7,7 +7,7 @@ {66C1C75C-3612-4D23-B937-C3DE0D653292} WinExe AppLauncher - LinearAppLauncher + fizzylauncher v4.7.2 512 true @@ -150,6 +150,9 @@ Form + + Form + Form @@ -215,6 +218,9 @@ EditListTileForm.cs + + OptionsForm.cs + EditTileForm.cs diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 27971b9..e19695a 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -39,10 +39,12 @@ this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem(); + this.optionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); @@ -75,10 +77,9 @@ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem4, this.toolStripMenuItem3, - this.toolStripSeparator1, - this.exitToolStripMenuItem}); + this.toolStripMenuItem9}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(100, 76); + this.contextMenuStrip1.Size = new System.Drawing.Size(181, 92); this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); // // toolStripMenuItem4 @@ -90,62 +91,76 @@ this.toolStripMenuItem8, this.toolStripSeparator3, this.toolStripMenuItem6, - this.toolStripMenuItem2}); + this.toolStripMenuItem2, + this.toolStripMenuItem10, + this.exitToolStripMenuItem}); this.toolStripMenuItem4.Name = "toolStripMenuItem4"; - this.toolStripMenuItem4.Size = new System.Drawing.Size(99, 22); + this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem4.Text = "&File"; // // toolStripMenuItem5 // this.toolStripMenuItem5.Name = "toolStripMenuItem5"; - this.toolStripMenuItem5.Size = new System.Drawing.Size(123, 22); + this.toolStripMenuItem5.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem5.Text = "&New"; this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click); // // toolStripMenuItem7 // this.toolStripMenuItem7.Name = "toolStripMenuItem7"; - this.toolStripMenuItem7.Size = new System.Drawing.Size(123, 22); + this.toolStripMenuItem7.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem7.Text = "&Open"; this.toolStripMenuItem7.Click += new System.EventHandler(this.toolStripMenuItem7_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6); // // toolStripMenuItem8 // this.toolStripMenuItem8.Name = "toolStripMenuItem8"; - this.toolStripMenuItem8.Size = new System.Drawing.Size(123, 22); + this.toolStripMenuItem8.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem8.Text = "&Close"; this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(120, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6); // // toolStripMenuItem6 // this.toolStripMenuItem6.Name = "toolStripMenuItem6"; - this.toolStripMenuItem6.Size = new System.Drawing.Size(123, 22); + this.toolStripMenuItem6.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem6.Text = "&Save"; this.toolStripMenuItem6.Click += new System.EventHandler(this.toolStripMenuItem6_Click); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(123, 22); + this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem2.Text = "Save &As..."; this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); // + // toolStripMenuItem10 + // + this.toolStripMenuItem10.Name = "toolStripMenuItem10"; + this.toolStripMenuItem10.Size = new System.Drawing.Size(177, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.exitToolStripMenuItem.Text = "E&xit"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); + // // toolStripMenuItem3 // this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem1}); this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(99, 22); + this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem3.Text = "&View"; // // toolStripMenuItem1 @@ -155,17 +170,20 @@ this.toolStripMenuItem1.Text = "Always On &Top"; this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); // - // toolStripSeparator1 + // toolStripMenuItem9 // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(96, 6); + this.toolStripMenuItem9.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.optionToolStripMenuItem}); + this.toolStripMenuItem9.Name = "toolStripMenuItem9"; + this.toolStripMenuItem9.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem9.Text = "&Tools"; // - // exitToolStripMenuItem + // optionToolStripMenuItem // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(99, 22); - this.exitToolStripMenuItem.Text = "E&xit"; - this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); + this.optionToolStripMenuItem.Name = "optionToolStripMenuItem"; + this.optionToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.optionToolStripMenuItem.Text = "&Options"; + this.optionToolStripMenuItem.Click += new System.EventHandler(this.optionToolStripMenuItem_Click); // // flowLayoutPanel1 // @@ -189,7 +207,6 @@ // // openFileDialog1 // - this.openFileDialog1.FileName = "openFileDialog1"; this.openFileDialog1.Filter = "Session files|*.jsonfig"; this.openFileDialog1.Title = "Choose session file"; // @@ -221,8 +238,6 @@ #endregion private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4; @@ -235,6 +250,10 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem8; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem10; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9; + private System.Windows.Forms.ToolStripMenuItem optionToolStripMenuItem; } } diff --git a/MainForm.cs b/MainForm.cs index 8f65215..7c61d2a 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -30,7 +30,9 @@ namespace AppLauncher protected int collapsedWidth = 40; protected int expandedWidth = 800; + protected OptionsForm optionsForm = null; protected string sessionFilename = null; + protected Point hotKey = new Point(-1, -1); public MainForm() : base() { @@ -43,7 +45,7 @@ namespace AppLauncher { base.OnLoad(e); - RegisterHotKey((IntPtr)Handle, 1, (MOD_CONTROL | MOD_ALT), (int)Keys.F10); + //RegisterHotKey((IntPtr)Handle, 1, (MOD_CONTROL | MOD_ALT), (int)Keys.F10); } protected override void OnShown(EventArgs e) @@ -66,7 +68,10 @@ namespace AppLauncher { base.OnClosing(e); - UnregisterHotKey((IntPtr)Handle, 1); + if (hotKey.X > 0) + { + UnregisterHotKey((IntPtr)Handle, 1); + } if (string.IsNullOrWhiteSpace(sessionFilename)) { @@ -77,7 +82,7 @@ namespace AppLauncher DialogResult dr = MessageBox.Show("Save existing session?", "Exit", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { - bool rv = saveFile(sessionFilename); + bool rv = saveFile(sessionFilename, false); if (!rv) { e.Cancel = true; @@ -109,6 +114,29 @@ namespace AppLauncher } } + public Point GlobalHotKey => hotKey; + + public void SetHotKey(Point value) + { + if (this.GlobalHotKey.X > 0) + { + UnregisterHotKey((IntPtr)Handle, 1); + } + + if (value.X < 0) + { + hotKey = new Point(-1, -1); + return; + } + + hotKey = value; + + if (hotKey.X > 0) + { + RegisterHotKey((IntPtr)Handle, 1, hotKey.X, hotKey.Y); + } + } + public async Task ToggleSize() { if (this.Width > collapsedWidth) @@ -279,6 +307,12 @@ namespace AppLauncher /// private void exitToolStripMenuItem_Click(object sender, EventArgs e) => this.Close(); + private void optionToolStripMenuItem_Click(object sender, EventArgs e) + { + if (optionsForm == null) optionsForm = new OptionsForm(this); + optionsForm.ShowDialog(); + } + protected async Task collapseWindow(int width, int increment = 6) { await Task.Run(() => @@ -365,8 +399,24 @@ namespace AppLauncher } } + // ui this.Width = maxWidth + SystemInformation.VerticalScrollBarWidth + 20 + flowLayoutPanel1.Left; this.Height = launcherSession.DefaultHeight; + + // hotkey + hotKey = new Point(launcherSession.HotKeyX, launcherSession.HotKeyY); + if (hotKey.X > 0) + { + RegisterHotKey((IntPtr)Handle, 1, hotKey.X, hotKey.Y); + } + else + { + hotKey = new Point(-1, -1); + } + + // + this.TopMost = launcherSession.AlwaysOnTop; + } protected void newSession() @@ -410,7 +460,10 @@ namespace AppLauncher LauncherSession launcherSession = new LauncherSession() { DefaultHeight = this.Height, - Groups = new List() + HotKeyX = this.GlobalHotKey.X, + HotKeyY = this.GlobalHotKey.Y, + Groups = new List(), + AlwaysOnTop = this.TopMost }; launcherSession.Groups = new List(); diff --git a/Models/LauncherSession.cs b/Models/LauncherSession.cs index bd333bc..5ebb43b 100644 --- a/Models/LauncherSession.cs +++ b/Models/LauncherSession.cs @@ -1,10 +1,15 @@ using System.Collections.Generic; +using System.Drawing; namespace AppLauncher.Models { public class LauncherSession { public int DefaultHeight { get; set; } = 280; + public int HotKeyX { get; set; } = -1; + public int HotKeyY { get; set; } = -1; + public bool AlwaysOnTop { get; set; } = false; + public List Groups { get; set; } = new List(); } } \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 136eabd..625c430 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Linear App Launcher")] -[assembly: AssemblyDescription("Application launcher (linear)")] +[assembly: AssemblyTitle("Fizzy App Launcher")] +[assembly: AssemblyDescription("Application and shortcut launcher")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Hi, I'm Ray")] -[assembly: AssemblyProduct("LinearAppLauncher")] +[assembly: AssemblyProduct("Fizzy App Launcher")] [assembly: AssemblyCopyright("Copyright © Ray Lam 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.0.0")] +[assembly: AssemblyVersion("0.1.1.035")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Windows/Forms/AForm.cs b/Windows/Forms/AForm.cs index d8de44a..4c4a3cd 100644 --- a/Windows/Forms/AForm.cs +++ b/Windows/Forms/AForm.cs @@ -35,6 +35,8 @@ namespace AppLauncher.Windows.Forms this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; } + + notifyIcon1.Text = "Fizzy App Launcher"; } protected override void OnLoad(EventArgs e) @@ -147,7 +149,7 @@ namespace AppLauncher.Windows.Forms g.DrawImageUnscaled(Properties.Resources.app_icon_24, 17, 17); - TextRenderer.DrawText(g, "Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171)); + TextRenderer.DrawText(g, "Fizzy App Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171)); } @@ -201,9 +203,9 @@ namespace AppLauncher.Windows.Forms ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); - // + // // imageBox3 - // + // this.imageBox3.BackColor = System.Drawing.Color.Transparent; this.imageBox3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.imageBox3.ErrorImage = null; @@ -220,9 +222,9 @@ namespace AppLauncher.Windows.Forms this.imageBox3.TabIndex = 146; this.imageBox3.TabStop = false; this.imageBox3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox3_MouseClick); - // + // // imageBox2 - // + // this.imageBox2.BackColor = System.Drawing.Color.Transparent; this.imageBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.imageBox2.ErrorImage = null; @@ -239,9 +241,9 @@ namespace AppLauncher.Windows.Forms this.imageBox2.TabIndex = 147; this.imageBox2.TabStop = false; this.imageBox2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox2_MouseClick); - // + // // imageBox1 - // + // this.imageBox1.BackColor = System.Drawing.Color.Transparent; this.imageBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.imageBox1.ErrorImage = null; @@ -258,17 +260,17 @@ namespace AppLauncher.Windows.Forms this.imageBox1.TabIndex = 148; this.imageBox1.TabStop = false; this.imageBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox1_MouseClick); - // + // // notifyIcon1 - // + // this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1; this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); this.notifyIcon1.Visible = true; this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click); this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_Click); - // + // // panel1 - // + // this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNS; this.panel1.Location = new System.Drawing.Point(109, 114); @@ -279,23 +281,23 @@ namespace AppLauncher.Windows.Forms this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove); this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp); - // + // // contextMenuStrip1 - // + // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exitToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(94, 26); - // + // // exitToolStripMenuItem - // + // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Size = new System.Drawing.Size(93, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); - // + // // AForm - // + // this.ClientSize = new System.Drawing.Size(421, 321); this.Controls.Add(this.panel1); this.Controls.Add(this.imageBox1); diff --git a/Windows/Forms/OptionsForm.cs b/Windows/Forms/OptionsForm.cs new file mode 100644 index 0000000..d093a46 --- /dev/null +++ b/Windows/Forms/OptionsForm.cs @@ -0,0 +1,191 @@ +using AppLauncher.Models; +using RyzStudio.Windows.ThemedForms; +using System; +using System.Drawing; +using System.Text; + +namespace AppLauncher.Windows.Forms +{ + public class OptionsForm : TDialogForm + { + private System.Windows.Forms.Label label1; + private TButton button1; + private TTextBox textBox1; + + public MainForm parentForm { get; set; } = null; + + protected Point hotKey = new Point(-1, -1); + + public OptionsForm(MainForm parent) : base() + { + InitializeComponent(); + + parentForm = parent; + + textBox1.InnerTextBox.ReadOnly = true; + textBox1.InnerTextBox.BackColor = Color.White; + textBox1.InnerTextBox.KeyUp += textBox1_KeyUp; + + } + + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm)); + this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); + this.SuspendLayout(); + // + // imgbxClose + // + this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image"))); + this.imgbxClose.Location = new System.Drawing.Point(367, 5); + // + // panel1 + // + this.panel1.Location = new System.Drawing.Point(394, 474); + // + // area1 + // + this.area1.Location = new System.Drawing.Point(1, 474); + this.area1.Size = new System.Drawing.Size(392, 5); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.BackColor = System.Drawing.Color.Transparent; + this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.textBox1.Location = new System.Drawing.Point(159, 50); + this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); + this.textBox1.Name = "textBox1"; + this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); + this.textBox1.Size = new System.Drawing.Size(220, 32); + this.textBox1.SubmitButton = null; + this.textBox1.TabIndex = 152; + this.textBox1.UseSystemPasswordChar = false; + // + // label1 + // + this.label1.BackColor = System.Drawing.Color.Transparent; + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); + this.label1.Location = new System.Drawing.Point(18, 50); + this.label1.Margin = new System.Windows.Forms.Padding(0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(131, 32); + this.label1.TabIndex = 153; + this.label1.Text = "Hotkey"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button1.BackColor = System.Drawing.Color.Transparent; + this.button1.DefaultImage = null; + this.button1.DownImage = null; + this.button1.IsSelected = false; + this.button1.LabelText = "&Save"; + this.button1.Location = new System.Drawing.Point(251, 427); + this.button1.Name = "button1"; + this.button1.OverImage = null; + this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); + this.button1.Size = new System.Drawing.Size(128, 32); + this.button1.TabIndex = 173; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // OptionsForm + // + this.ClientSize = new System.Drawing.Size(400, 480); + this.Controls.Add(this.button1); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "OptionsForm"; + this.Title = "Options"; + this.Controls.SetChildIndex(this.imgbxClose, 0); + this.Controls.SetChildIndex(this.panel1, 0); + this.Controls.SetChildIndex(this.area1, 0); + this.Controls.SetChildIndex(this.textBox1, 0); + this.Controls.SetChildIndex(this.label1, 0); + this.Controls.SetChildIndex(this.button1, 0); + ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); + this.ResumeLayout(false); + + } + + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + + if (parentForm != null) + { + bool control = false; + bool alt = false; + bool shift = false; + + int hotKeyCode = parentForm.GlobalHotKey.X; + if (hotKeyCode >= 4) + { + shift = true; + hotKeyCode -= 4; + } + + if (hotKeyCode >= 2) + { + control = true; + hotKeyCode -= 2; + } + + if (hotKeyCode >= 1) + { + alt = true; + hotKeyCode -= 1; + } + + StringBuilder sb = new StringBuilder(); + if (control) sb = sb.Append("Ctrl + "); + if (alt) sb = sb.Append("Alt + "); + if (shift) sb = sb.Append("Shift + "); + sb = sb.Append(((System.Windows.Forms.Keys)parentForm.GlobalHotKey.Y).ToString()); + + textBox1.Text = sb.ToString(); + } + + } + + private void button1_Click(object sender, EventArgs e) + { + if (parentForm != null) + { + parentForm.SetHotKey(hotKey); + } + + this.Close(); + } + + private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) + { + if (e.KeyCode == System.Windows.Forms.Keys.ControlKey) return; + if (e.KeyCode == System.Windows.Forms.Keys.ShiftKey) return; + if (e.KeyCode == System.Windows.Forms.Keys.Menu) return; + + StringBuilder sb = new StringBuilder(); + + if (e.Control) sb = sb.Append("Ctrl + "); + if (e.Alt) sb = sb.Append("Alt + "); + if (e.Shift) sb = sb.Append("Shift + "); + + int keyModifier = 0; + if (e.Alt) keyModifier += 1; + if (e.Control) keyModifier += 2; + if (e.Shift) keyModifier += 4; + + sb = sb.Append(e.KeyCode.ToString()); + + textBox1.Text = sb.ToString(); + + hotKey = new Point(keyModifier, (int)e.KeyCode); + } + + } +} \ No newline at end of file diff --git a/Windows/Forms/OptionsForm.resx b/Windows/Forms/OptionsForm.resx new file mode 100644 index 0000000..3747e00 --- /dev/null +++ b/Windows/Forms/OptionsForm.resx @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS4xYyqcSwAAANlJREFUOE+lU1sO + gjAQrHgRY6KemQ+VT9NrgAfgfRA+SawzdTAk2lhkkgm7s7vTAq0py/LUNM0dHEEXSfYWfd8fDQIOD23b + nvFMY6jeAcxpMFIwC1HX9YWzNOCWUunR4AxnvxpUVbV3zm2UGsbUlHoEDfBhdsgf4BWDCcmYGmtqCxtw + NeQcoJ6JjGn43hXy8CvIxDeIGbREZY+pHjLgtqeVHf7SzVq7VdmDM6x9GGj1/19h9UckVv3GWMwNRh5L + 6dGYH+UCHCTQ9SfV+7pMvJIIaLL0Oudd1x2eUQ8MyeAeq0cAAAAASUVORK5CYII= + + + \ No newline at end of file