diff --git a/ClassKPFloatingPanel.cs b/ClassKPFloatingPanel.cs index 993af56..a079b14 100644 --- a/ClassKPFloatingPanel.cs +++ b/ClassKPFloatingPanel.cs @@ -18,8 +18,10 @@ internal sealed class KPFloatingPanelExt : Plugin { private void InitForm() { FForm = new MainForm(); FForm.Host = FHost; - FForm.ResetPosition(); + FForm.RestorePosition(); FForm.Show(); + + } public override string UpdateUrl { get { @@ -34,6 +36,7 @@ public override bool Initialize(IPluginHost AHost) { InitForm(); + FMenuItem = new ToolStripMenuItem(); FMenuItem.Text = "Show Floating Panel"; FMenuItem.ToolTipText = "Shows floating panel with passwords in the top-right corner of screen"; @@ -76,7 +79,7 @@ private void OnShowPanelClick(object sender, EventArgs e) { FForm.TopMost = false; FForm.Hide(); FForm.TopMost = true; - FForm.ResetPosition(); + FForm.RestorePosition(); FForm.Show(); FForm.BringToFront(); if (FForm.Opacity < 0.2) diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 2a0cb48..e68c64c 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -28,191 +28,198 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - this.lbClock = new System.Windows.Forms.Label(); - this.pmMainMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this.miHide = new System.Windows.Forms.ToolStripMenuItem(); - this.miSetup = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.miAbout = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.ToolStripMenuExitKeePass = new System.Windows.Forms.ToolStripMenuItem(); - this.pmPasswords = new System.Windows.Forms.ContextMenuStrip(this.components); - this.miNoPasswords = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuSaveDatabase = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripTextSearch = new System.Windows.Forms.ToolStripTextBox(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.LastOne = new System.Windows.Forms.ToolStripMenuItem(); - this.tmClock = new System.Windows.Forms.Timer(this.components); - this.ilIcons = new System.Windows.Forms.ImageList(this.components); - this.timer_search = new System.Windows.Forms.Timer(this.components); - this.pmMainMenu.SuspendLayout(); - this.pmPasswords.SuspendLayout(); - this.SuspendLayout(); - // - // lbClock - // - resources.ApplyResources(this.lbClock, "lbClock"); - this.lbClock.ContextMenuStrip = this.pmMainMenu; - this.lbClock.ForeColor = System.Drawing.SystemColors.InfoText; - this.lbClock.Name = "lbClock"; - this.lbClock.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbClock_MouseMove); - this.lbClock.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbClock_MouseDown); - this.lbClock.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbClock_MouseUp); - // - // pmMainMenu - // - this.pmMainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + this.lbClock = new System.Windows.Forms.Label(); + this.pmMainMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.miHide = new System.Windows.Forms.ToolStripMenuItem(); + this.openKeepassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.miSetup = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.miAbout = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.ToolStripMenuExitKeePass = new System.Windows.Forms.ToolStripMenuItem(); + this.pmPasswords = new System.Windows.Forms.ContextMenuStrip(this.components); + this.miNoPasswords = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuSaveDatabase = new System.Windows.Forms.ToolStripMenuItem(); + this.LastOne = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripTextSearch = new System.Windows.Forms.ToolStripTextBox(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.tmClock = new System.Windows.Forms.Timer(this.components); + this.ilIcons = new System.Windows.Forms.ImageList(this.components); + this.timer_search = new System.Windows.Forms.Timer(this.components); + this.pmMainMenu.SuspendLayout(); + this.pmPasswords.SuspendLayout(); + this.SuspendLayout(); + // + // lbClock + // + resources.ApplyResources(this.lbClock, "lbClock"); + this.lbClock.ContextMenuStrip = this.pmMainMenu; + this.lbClock.ForeColor = System.Drawing.SystemColors.InfoText; + this.lbClock.Name = "lbClock"; + this.lbClock.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbClock_MouseDown); + this.lbClock.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbClock_MouseMove); + this.lbClock.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbClock_MouseUp); + // + // pmMainMenu + // + this.pmMainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.miHide, + this.openKeepassToolStripMenuItem, this.miSetup, this.toolStripSeparator2, this.miAbout, this.toolStripSeparator1, this.ToolStripMenuExitKeePass}); - this.pmMainMenu.Name = "pmMainMenu"; - this.pmMainMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; - this.pmMainMenu.ShowImageMargin = false; - resources.ApplyResources(this.pmMainMenu, "pmMainMenu"); - // - // miHide - // - this.miHide.AutoToolTip = true; - this.miHide.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.miHide.Name = "miHide"; - resources.ApplyResources(this.miHide, "miHide"); - this.miHide.Click += new System.EventHandler(this.miHide_Click); - // - // miSetup - // - this.miSetup.AutoToolTip = true; - this.miSetup.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.miSetup.Name = "miSetup"; - resources.ApplyResources(this.miSetup, "miSetup"); - this.miSetup.Click += new System.EventHandler(this.miSetup_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2"); - // - // miAbout - // - this.miAbout.Name = "miAbout"; - resources.ApplyResources(this.miAbout, "miAbout"); - this.miAbout.Click += new System.EventHandler(this.miAbout_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1"); - // - // ToolStripMenuExitKeePass - // - this.ToolStripMenuExitKeePass.Name = "ToolStripMenuExitKeePass"; - resources.ApplyResources(this.ToolStripMenuExitKeePass, "ToolStripMenuExitKeePass"); - this.ToolStripMenuExitKeePass.Click += new System.EventHandler(this.ToolStripMenuExitKeePass_Click); - // - // pmPasswords - // - this.pmPasswords.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.pmMainMenu.Name = "pmMainMenu"; + this.pmMainMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + this.pmMainMenu.ShowImageMargin = false; + resources.ApplyResources(this.pmMainMenu, "pmMainMenu"); + // + // miHide + // + this.miHide.AutoToolTip = true; + this.miHide.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.miHide.Name = "miHide"; + resources.ApplyResources(this.miHide, "miHide"); + this.miHide.Click += new System.EventHandler(this.miHide_Click); + // + // openKeepassToolStripMenuItem + // + this.openKeepassToolStripMenuItem.Name = "openKeepassToolStripMenuItem"; + resources.ApplyResources(this.openKeepassToolStripMenuItem, "openKeepassToolStripMenuItem"); + this.openKeepassToolStripMenuItem.Click += new System.EventHandler(this.openKeepassToolStripMenuItem_Click); + // + // miSetup + // + this.miSetup.AutoToolTip = true; + this.miSetup.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.miSetup.Name = "miSetup"; + resources.ApplyResources(this.miSetup, "miSetup"); + this.miSetup.Click += new System.EventHandler(this.miSetup_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2"); + // + // miAbout + // + this.miAbout.Name = "miAbout"; + resources.ApplyResources(this.miAbout, "miAbout"); + this.miAbout.Click += new System.EventHandler(this.miAbout_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1"); + // + // ToolStripMenuExitKeePass + // + this.ToolStripMenuExitKeePass.Name = "ToolStripMenuExitKeePass"; + resources.ApplyResources(this.ToolStripMenuExitKeePass, "ToolStripMenuExitKeePass"); + this.ToolStripMenuExitKeePass.Click += new System.EventHandler(this.ToolStripMenuExitKeePass_Click); + // + // pmPasswords + // + this.pmPasswords.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.miNoPasswords, this.toolStripMenuSaveDatabase, - this.LastOne, + this.LastOne, this.toolStripTextSearch, - this.toolStripSeparator3 - - }); - this.pmPasswords.Name = "pmPasswords"; - this.pmPasswords.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; - resources.ApplyResources(this.pmPasswords, "pmPasswords"); - this.pmPasswords.Click += new System.EventHandler(this.pmPasswords_Click); - // - // miNoPasswords - // - resources.ApplyResources(this.miNoPasswords, "miNoPasswords"); - this.miNoPasswords.Name = "miNoPasswords"; - this.miNoPasswords.Click += new System.EventHandler(this.miNoPasswords_Click); - // - // toolStripMenuSaveDatabase - // - this.toolStripMenuSaveDatabase.Image = global::KPFloatingPanel.Properties.Resources.B16x16_FileSave; - this.toolStripMenuSaveDatabase.Name = "toolStripMenuSaveDatabase"; - resources.ApplyResources(this.toolStripMenuSaveDatabase, "toolStripMenuSaveDatabase"); - this.toolStripMenuSaveDatabase.Click += new System.EventHandler(this.toolStripMenuSaveDatabase_Click); - // - // toolStripTextSearch - // - this.toolStripTextSearch.AcceptsReturn = true; - resources.ApplyResources(this.toolStripTextSearch, "toolStripTextSearch"); - this.toolStripTextSearch.Name = "toolStripTextSearch"; - this.toolStripTextSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.toolStripTextSearch_KeyDown); - this.toolStripTextSearch.GotFocus += new System.EventHandler(this.toolStripTextSearch_GotFocus); - this.toolStripTextSearch.TextChanged += new System.EventHandler(this.toolStripTextSearch_TextChanged); - this.toolStripTextSearch.Click += new System.EventHandler(this.toolStripTextSearch_GotFocus); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3"); - // - // LastOne - // - this.LastOne.Name = "LastOne"; - resources.ApplyResources(this.LastOne, "LastOne"); - // - // tmClock - // - this.tmClock.Enabled = true; - this.tmClock.Interval = 1000; - this.tmClock.Tick += new System.EventHandler(this.tmClock_Tick); - // - // ilIcons - // - this.ilIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilIcons.ImageStream"))); - this.ilIcons.TransparentColor = System.Drawing.Color.Transparent; - this.ilIcons.Images.SetKeyName(0, "0.ico"); - this.ilIcons.Images.SetKeyName(1, "1.ico"); - this.ilIcons.Images.SetKeyName(2, "2.ico"); - this.ilIcons.Images.SetKeyName(3, "3.ico"); - this.ilIcons.Images.SetKeyName(4, "4.ico"); - this.ilIcons.Images.SetKeyName(5, "5.ico"); - this.ilIcons.Images.SetKeyName(6, "B16x16_LockWorkspace.png"); - this.ilIcons.Images.SetKeyName(7, "x.png"); - this.ilIcons.Images.SetKeyName(8, "3.png"); - this.ilIcons.Images.SetKeyName(9, "2.png"); - this.ilIcons.Images.SetKeyName(10, "4.png"); - this.ilIcons.Images.SetKeyName(11, "5.png"); - this.ilIcons.Images.SetKeyName(12, "1.png"); - // - // timer_search - // - this.timer_search.Interval = 100; - this.timer_search.Tick += new System.EventHandler(this.timer_search_Tick); - // - // MainForm - // - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.Info; - this.ContextMenuStrip = this.pmMainMenu; - this.Controls.Add(this.lbClock); - this.Cursor = System.Windows.Forms.Cursors.Hand; - this.DoubleBuffered = true; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.TopMost = true; - this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbClock_MouseUp); - this.pmMainMenu.ResumeLayout(false); - this.pmPasswords.ResumeLayout(false); - this.pmPasswords.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); + this.toolStripSeparator3}); + this.pmPasswords.Name = "pmPasswords"; + this.pmPasswords.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + resources.ApplyResources(this.pmPasswords, "pmPasswords"); + this.pmPasswords.Opening += new System.ComponentModel.CancelEventHandler(this.pmPasswords_Opening); + this.pmPasswords.Click += new System.EventHandler(this.pmPasswords_Click); + // + // miNoPasswords + // + resources.ApplyResources(this.miNoPasswords, "miNoPasswords"); + this.miNoPasswords.Name = "miNoPasswords"; + this.miNoPasswords.Click += new System.EventHandler(this.miNoPasswords_Click); + // + // toolStripMenuSaveDatabase + // + this.toolStripMenuSaveDatabase.Image = global::KPFloatingPanel.Properties.Resources.B16x16_FileSave; + this.toolStripMenuSaveDatabase.Name = "toolStripMenuSaveDatabase"; + resources.ApplyResources(this.toolStripMenuSaveDatabase, "toolStripMenuSaveDatabase"); + this.toolStripMenuSaveDatabase.Click += new System.EventHandler(this.toolStripMenuSaveDatabase_Click); + // + // LastOne + // + this.LastOne.Name = "LastOne"; + resources.ApplyResources(this.LastOne, "LastOne"); + // + // toolStripTextSearch + // + this.toolStripTextSearch.AcceptsReturn = true; + resources.ApplyResources(this.toolStripTextSearch, "toolStripTextSearch"); + this.toolStripTextSearch.Name = "toolStripTextSearch"; + this.toolStripTextSearch.GotFocus += new System.EventHandler(this.toolStripTextSearch_GotFocus); + this.toolStripTextSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.toolStripTextSearch_KeyDown); + this.toolStripTextSearch.Click += new System.EventHandler(this.toolStripTextSearch_GotFocus); + this.toolStripTextSearch.TextChanged += new System.EventHandler(this.toolStripTextSearch_TextChanged); + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3"); + // + // tmClock + // + this.tmClock.Enabled = true; + this.tmClock.Interval = 1000; + this.tmClock.Tick += new System.EventHandler(this.tmClock_Tick); + // + // ilIcons + // + this.ilIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilIcons.ImageStream"))); + this.ilIcons.TransparentColor = System.Drawing.Color.Transparent; + this.ilIcons.Images.SetKeyName(0, "0.ico"); + this.ilIcons.Images.SetKeyName(1, "1.ico"); + this.ilIcons.Images.SetKeyName(2, "2.ico"); + this.ilIcons.Images.SetKeyName(3, "3.ico"); + this.ilIcons.Images.SetKeyName(4, "4.ico"); + this.ilIcons.Images.SetKeyName(5, "5.ico"); + this.ilIcons.Images.SetKeyName(6, "B16x16_LockWorkspace.png"); + this.ilIcons.Images.SetKeyName(7, "x.png"); + this.ilIcons.Images.SetKeyName(8, "3.png"); + this.ilIcons.Images.SetKeyName(9, "2.png"); + this.ilIcons.Images.SetKeyName(10, "4.png"); + this.ilIcons.Images.SetKeyName(11, "5.png"); + this.ilIcons.Images.SetKeyName(12, "1.png"); + // + // timer_search + // + this.timer_search.Tick += new System.EventHandler(this.timer_search_Tick); + // + // MainForm + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.Info; + this.ContextMenuStrip = this.pmMainMenu; + this.Controls.Add(this.lbClock); + this.Cursor = System.Windows.Forms.Cursors.Hand; + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "MainForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.TopMost = true; + this.Load += new System.EventHandler(this.MainForm_Load); + this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbClock_MouseUp); + this.pmMainMenu.ResumeLayout(false); + this.pmPasswords.ResumeLayout(false); + this.pmPasswords.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -235,5 +242,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; private System.Windows.Forms.ToolStripMenuItem LastOne; + private System.Windows.Forms.ToolStripMenuItem openKeepassToolStripMenuItem; } } \ No newline at end of file diff --git a/MainForm.cs b/MainForm.cs index 525dd02..f761a8a 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -15,7 +15,8 @@ using KeePassLib.Security; using KeePassLib.Utility; -using System.Runtime.InteropServices; // for SetWindowsPos +using System.Runtime.InteropServices; +using System.Reflection; // for SetWindowsPos namespace KPFloatingPanel { internal partial class MainForm : Form { @@ -25,7 +26,8 @@ internal partial class MainForm : Form { private string FLastName; private OptionsClass FOptions; internal IPluginHost Host; - + private MethodInfo mSelectEntriesMethod; + private const int SpaceForButtons = 300; private HotKeyboardHook kb_shortcut; private HotKeyboardHook kb_shortcut_quick; @@ -49,8 +51,12 @@ public MainForm() { tmClock_Tick(null, null); ApplyOptions(); + + Program.Translation.ApplyTo(this); Program.Translation.ApplyTo("KeePass.Forms.Plugins.PCFloatingPanel.MainForm.MainMenu", pmMainMenu.Items); + + } @@ -133,12 +139,23 @@ private void ApplyOptions() { } TopMost = true; } + public void RestorePosition() + { + Rectangle R = Screen.GetWorkingArea(Host.MainWindow); + Top = R.Top; + Left = R.Left + R.Width - Width - SpaceForButtons; - public void ResetPosition() { - Rectangle R = Screen.GetWorkingArea(Host.MainWindow); - Top = R.Top; - Left = R.Left + R.Width - Width - SpaceForButtons; - } + if ((FOptions.lastPositionY > 0) && (FOptions.lastPositionY <= R.Height)) + { + Top = FOptions.lastPositionY; + } + + if ((FOptions.lastPositionX !=0) && (FOptions.lastPositionX <= (R.Left + R.Width - Width - SpaceForButtons))) + { + Left = FOptions.lastPositionX; + } + } + private bool last_show_clock; private void tmClock_Tick(object sender, EventArgs e) { @@ -203,9 +220,12 @@ private void miSetup_Click(object sender, EventArgs e) { } private void lbClock_MouseDown(object sender, MouseEventArgs e) { - FOldX = Cursor.Position.X; - FOldY = Cursor.Position.Y; - FMoving = e.Button == MouseButtons.Left ? 1 : 0; + if (FOptions.lockWindowPosition == false) + { + FOldX = Cursor.Position.X; + FOldY = Cursor.Position.Y; + FMoving = e.Button == MouseButtons.Left ? 1 : 0; + } } @@ -216,6 +236,9 @@ private void lbClock_MouseMove(object sender, MouseEventArgs e) { Location = new Point(Location.X + Cursor.Position.X - FOldX, Location.Y + Cursor.Position.Y - FOldY); FOldX = Cursor.Position.X; FOldY = Cursor.Position.Y; + FOptions.lastPositionY = FOldY; + FOptions.lastPositionX = FOldX; + FOptions.Save(); } } @@ -622,6 +645,7 @@ private void miItem_AutoType(object sender, EventArgs e) { try { AutoType.PerformIntoPreviousWindow(this, Entry,Host.Database); + SelectEntries(new PwObjectList { Entry }, true, true); } catch (Exception ex) { MessageService.ShowWarning(ex); @@ -671,11 +695,31 @@ private void miItem_OpenURL(object sender, EventArgs e) { FieldAction(Item, PwDefs.UrlField, FIELD_ACTION.CLIPBOARD_COPY); else throw new Exception("Internal error in miItem_OpenURL (FOptions.URLAction)"); + SelectEntries(new PwObjectList { Entry }, true, true); } + // Copied from AutoTypeShow plugin + private void SelectEntries(PwObjectList lEntries, bool bDeselectOthers, bool bFocusFirst) + { + if (Host != null) + { + var mainWindowType = Host.MainWindow.GetType(); + mSelectEntriesMethod = mainWindowType.GetMethod("SelectEntries", BindingFlags.Instance | BindingFlags.NonPublic); + if (mSelectEntriesMethod != null) + { + mSelectEntriesMethod.Invoke(Host.MainWindow, new object[] { lEntries, bDeselectOthers, bFocusFirst }); + } + else + { + System.Diagnostics.Debug.Fail("Could not select the auto-typed entry, method not found"); + } + } + } + void miItem_Click(object sender, EventArgs e) { ToolStripMenuItem Item = (ToolStripMenuItem)sender; FieldAction(Item, Item.Text, FIELD_ACTION.CLIPBOARD_COPY); + } private enum FIELD_ACTION { CLIPBOARD_COPY, DRAG_DROP }; private void FieldAction(ToolStripMenuItem Item, string FieldName, FIELD_ACTION action) { @@ -691,6 +735,7 @@ private void FieldAction(ToolStripMenuItem Item, string FieldName, FIELD_ACTION Entry.Expires = true; Host.MainWindow.RefreshEntriesList(); Host.MainWindow.UpdateUI(false, null, false, null, false, null, true); + } if (action == FIELD_ACTION.CLIPBOARD_COPY) { @@ -698,6 +743,7 @@ private void FieldAction(ToolStripMenuItem Item, string FieldName, FIELD_ACTION true, Program.Config.MainWindow.MinimizeAfterClipboardCopy ? Host.MainWindow : null, Entry, Host.MainWindow.DocumentManager.ActiveDatabase); Host.MainWindow.StartClipboardCountdown(); + SelectEntries(new PwObjectList { Entry }, true, true); } else if (action == FIELD_ACTION.DRAG_DROP) Item.DoDragDrop(Entry.Strings.ReadSafe(FieldName), DragDropEffects.Copy); @@ -715,7 +761,9 @@ private void miItem_Edit(object sender, EventArgs e) { if ((myForm.ShowDialog() == DialogResult.OK)) Host.MainWindow.UpdateUI(false, null, Host.MainWindow.DocumentManager.ActiveDatabase.UINeedsIconUpdate, null, true, null, true); - Host.MainWindow.RefreshEntriesList(); + SelectEntries(new PwObjectList { Entry }, true, true); + Host.MainWindow.RefreshEntriesList(); + } @@ -839,6 +887,17 @@ protected override CreateParams CreateParams//allow us to be borderless and not return cp; } } + + private void MainForm_Load(object sender, EventArgs e) + { + + } + + private void openKeepassToolStripMenuItem_Click(object sender, EventArgs e) + { + KeePass.Program.MainForm.EnsureVisibleForegroundWindow(true,true); + + } } -} +} \ No newline at end of file diff --git a/MainForm.resx b/MainForm.resx index 90a8151..72a02a1 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -112,19 +112,19 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + True - + 306, 17 - + 141, 22 @@ -134,6 +134,12 @@ Hide this panel + + 141, 22 + + + Open Keepass + 141, 22 @@ -165,13 +171,13 @@ Exit KeePass - 142, 104 + 142, 126 pmMainMenu - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2, 2 @@ -189,7 +195,7 @@ lbClock - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -197,7 +203,7 @@ 2 - + 96, 17 @@ -218,6 +224,12 @@ Save Database + + 180, 22 + + + LastOne + False @@ -230,33 +242,27 @@ 177, 6 - - 180, 22 - - - LastOne - - 181, 129 + 181, 123 pmPasswords - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 215, 17 - + 424, 17 - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM - OAAAAk1TRnQBSQFMAgEBDQEAAQ4BAAEEAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA + OAAAAk1TRnQBSQFMAgEBDQEAASQBAAEkAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABQAMAAQEBAAEYBgABMBIAAb0CiQGWAnABlQJvAcwCmLQAAU8BbwF/AQEBtQHhAQEBqwHaAW0CXwH2 At2xAAFcAWgBaQEBAegB/wEBAe4B/wEBAYMBtQGBAmgBvwKLrgABiAJsAQEB2gH0AQEB2QH3AQEBzAH6 AQEBuAHrAUABRQFsAdwCq6sAAe8CzAFwAmYBAQHbAfQBAQHaAfYBAQHuAf8BAQGaAdQBYwJdAbsCiAHw @@ -500,10 +506,10 @@ AcABDwEBA/8BwAE/AcABPwEBCf8L - + 453, 17 - + True @@ -512,7 +518,7 @@ True - + GrowAndShrink @@ -526,90 +532,96 @@ miHide - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + openKeepassToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 miSetup - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 toolStripSeparator2 - System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 miAbout - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 toolStripSeparator1 - System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ToolStripMenuExitKeePass - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 miNoPasswords - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 toolStripMenuSaveDatabase - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + LastOne + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 toolStripTextSearch - System.Windows.Forms.ToolStripTextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripTextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 toolStripSeparator3 - System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - LastOne - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tmClock - System.Windows.Forms.Timer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ilIcons - System.Windows.Forms.ImageList, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 timer_search - System.Windows.Forms.Timer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MainForm - System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/OptionsClass.cs b/OptionsClass.cs index e32e766..af89b0e 100644 --- a/OptionsClass.cs +++ b/OptionsClass.cs @@ -14,12 +14,15 @@ public class OptionsClass { internal bool showSearch; internal bool showLastOne; internal bool foldersFirst; - internal string startGroupUUID; + internal int lastPositionX; + internal int lastPositionY; + internal string startGroupUUID; internal string shortcutKey; internal bool shortcutShift; internal bool shortcutAlt; internal bool shortcutCntrl; internal bool shortcutWin; + internal bool lockWindowPosition; internal string shortcutKeyQuick; internal bool shortcutShiftQuick; @@ -46,11 +49,14 @@ public void Load() { showSearch = Convert.ToBoolean((string)Key.GetValue("ShowSearch")); showLastOne = Convert.ToBoolean((string)Key.GetValue("ShowLastOne")); foldersFirst = Convert.ToBoolean((string)Key.GetValue("foldersFirst")); + lastPositionX = (int)Key.GetValue("lastPositionX", (int)lastPositionX); + lastPositionY = (int)Key.GetValue("lastPositionY", (int)lastPositionY); shortcutShift = Convert.ToBoolean((string)Key.GetValue("shortcutShift")); shortcutAlt = Convert.ToBoolean((string)Key.GetValue("shortcutAlt")); shortcutCntrl = Convert.ToBoolean((string)Key.GetValue("shortcutCntrl")); shortcutWin = Convert.ToBoolean((string)Key.GetValue("shortcutWin")); + lockWindowPosition = Convert.ToBoolean((string)Key.GetValue("lockWindowPosition")); shortcutKey = (string)Key.GetValue("shortcutKey"); shortcutShiftQuick = Convert.ToBoolean((string)Key.GetValue("shortcutShiftQuick")); @@ -80,12 +86,16 @@ public void Save() { Key.SetValue("ShowSearch", showSearch); //s² Key.SetValue("ShowLastOne", showLastOne); //s² Key.SetValue("foldersFirst", foldersFirst); //s² - Key.SetValue("startGroupUUID", startGroupUUID); + Key.SetValue("lastPositionX", (int)lastPositionX); + Key.SetValue("lastPositionY", (int)lastPositionY); + + Key.SetValue("startGroupUUID", startGroupUUID); Key.SetValue("shortcutKey", shortcutKey); Key.SetValue("shortcutAlt", shortcutAlt); Key.SetValue("shortcutShift", shortcutShift); Key.SetValue("shortcutCntrl", shortcutCntrl); Key.SetValue("shortcutWin", shortcutWin); + Key.SetValue("lockWindowPosition", lockWindowPosition); Key.SetValue("shortcutKeyQuick", shortcutKeyQuick); Key.SetValue("shortcutAltQuick", shortcutAltQuick); @@ -113,7 +123,8 @@ public OptionsClass() { foldersFirst = true; shortcutAlt = shortcutCntrl = shortcutShift = shortcutWin = shortcutAltQuick = shortcutCntrlQuick = shortcutShiftQuick = shortcutWinQuick = false; shortcutKey = shortcutKeyQuick = ""; - Load(); + lockWindowPosition = false; + Load(); } } } diff --git a/OptionsForm.Designer.cs b/OptionsForm.Designer.cs index 18e7d92..3600de4 100644 --- a/OptionsForm.Designer.cs +++ b/OptionsForm.Designer.cs @@ -33,17 +33,15 @@ private void InitializeComponent() this.btCancel = new System.Windows.Forms.Button(); this.btOk = new System.Windows.Forms.Button(); this.pcOptions = new System.Windows.Forms.TabControl(); - this.tsView = new System.Windows.Forms.TabPage(); - this.pnFontColor = new System.Windows.Forms.Panel(); - this.pnPanelColor = new System.Windows.Forms.Panel(); - this.edPercent = new System.Windows.Forms.NumericUpDown(); - this.btChangeFontColor = new System.Windows.Forms.Button(); - this.btChangePanelColor = new System.Windows.Forms.Button(); - this.lbPercent = new System.Windows.Forms.Label(); - this.lbFontColor = new System.Windows.Forms.Label(); - this.lbPanelColor = new System.Windows.Forms.Label(); - this.lbTransp = new System.Windows.Forms.Label(); this.tsBehavior = new System.Windows.Forms.TabPage(); + this.cbxLockPosition = new System.Windows.Forms.CheckBox(); + this.label5 = new System.Windows.Forms.Label(); + this.cbxShortcutWinQuick = new System.Windows.Forms.CheckBox(); + this.cbxShortcutAltQuick = new System.Windows.Forms.CheckBox(); + this.cbxShortcutShiftQuick = new System.Windows.Forms.CheckBox(); + this.cbxShortcutCntrlQuick = new System.Windows.Forms.CheckBox(); + this.txtShortcutKeyQuick = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); this.cbxShowLastOne = new System.Windows.Forms.CheckBox(); this.label4 = new System.Windows.Forms.Label(); this.cbxShortcutWin = new System.Windows.Forms.CheckBox(); @@ -60,19 +58,22 @@ private void InitializeComponent() this.cbxSortAlphabetical = new System.Windows.Forms.CheckBox(); this.cbURLAction = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); + this.tsView = new System.Windows.Forms.TabPage(); + this.pnFontColor = new System.Windows.Forms.Panel(); + this.pnPanelColor = new System.Windows.Forms.Panel(); + this.edPercent = new System.Windows.Forms.NumericUpDown(); + this.btChangeFontColor = new System.Windows.Forms.Button(); + this.btChangePanelColor = new System.Windows.Forms.Button(); + this.lbPercent = new System.Windows.Forms.Label(); + this.lbFontColor = new System.Windows.Forms.Label(); + this.lbPanelColor = new System.Windows.Forms.Label(); + this.lbTransp = new System.Windows.Forms.Label(); this.ColorDialog = new System.Windows.Forms.ColorDialog(); - this.label5 = new System.Windows.Forms.Label(); - this.cbxShortcutWinQuick = new System.Windows.Forms.CheckBox(); - this.cbxShortcutAltQuick = new System.Windows.Forms.CheckBox(); - this.cbxShortcutShiftQuick = new System.Windows.Forms.CheckBox(); - this.cbxShortcutCntrlQuick = new System.Windows.Forms.CheckBox(); - this.txtShortcutKeyQuick = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); this.pnButtons.SuspendLayout(); this.pcOptions.SuspendLayout(); + this.tsBehavior.SuspendLayout(); this.tsView.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edPercent)).BeginInit(); - this.tsBehavior.SuspendLayout(); this.SuspendLayout(); // // pnButtons @@ -81,9 +82,9 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.pnButtons.Controls.Add(this.btCancel); this.pnButtons.Controls.Add(this.btOk); - this.pnButtons.Location = new System.Drawing.Point(0, 314); + this.pnButtons.Location = new System.Drawing.Point(0, 355); this.pnButtons.Name = "pnButtons"; - this.pnButtons.Size = new System.Drawing.Size(266, 41); + this.pnButtons.Size = new System.Drawing.Size(268, 41); this.pnButtons.TabIndex = 0; // // btCancel @@ -117,123 +118,12 @@ private void InitializeComponent() this.pcOptions.Location = new System.Drawing.Point(0, 0); this.pcOptions.Name = "pcOptions"; this.pcOptions.SelectedIndex = 0; - this.pcOptions.Size = new System.Drawing.Size(266, 312); + this.pcOptions.Size = new System.Drawing.Size(268, 353); this.pcOptions.TabIndex = 1; // - // tsView - // - this.tsView.Controls.Add(this.pnFontColor); - this.tsView.Controls.Add(this.pnPanelColor); - this.tsView.Controls.Add(this.edPercent); - this.tsView.Controls.Add(this.btChangeFontColor); - this.tsView.Controls.Add(this.btChangePanelColor); - this.tsView.Controls.Add(this.lbPercent); - this.tsView.Controls.Add(this.lbFontColor); - this.tsView.Controls.Add(this.lbPanelColor); - this.tsView.Controls.Add(this.lbTransp); - this.tsView.Location = new System.Drawing.Point(4, 22); - this.tsView.Name = "tsView"; - this.tsView.Padding = new System.Windows.Forms.Padding(3); - this.tsView.Size = new System.Drawing.Size(260, 251); - this.tsView.TabIndex = 0; - this.tsView.Text = "View"; - this.tsView.UseVisualStyleBackColor = true; - // - // pnFontColor - // - this.pnFontColor.BackColor = System.Drawing.SystemColors.InfoText; - this.pnFontColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.pnFontColor.Location = new System.Drawing.Point(19, 176); - this.pnFontColor.Name = "pnFontColor"; - this.pnFontColor.Size = new System.Drawing.Size(121, 25); - this.pnFontColor.TabIndex = 11; - this.pnFontColor.DoubleClick += new System.EventHandler(this.pnFontColor_DoubleClick); - // - // pnPanelColor - // - this.pnPanelColor.BackColor = System.Drawing.SystemColors.Info; - this.pnPanelColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.pnPanelColor.Location = new System.Drawing.Point(19, 104); - this.pnPanelColor.Name = "pnPanelColor"; - this.pnPanelColor.Size = new System.Drawing.Size(121, 25); - this.pnPanelColor.TabIndex = 10; - this.pnPanelColor.DoubleClick += new System.EventHandler(this.pnPanelColor_DoubleClick); - // - // edPercent - // - this.edPercent.Location = new System.Drawing.Point(19, 41); - this.edPercent.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.edPercent.Name = "edPercent"; - this.edPercent.Size = new System.Drawing.Size(120, 20); - this.edPercent.TabIndex = 9; - this.edPercent.Value = new decimal(new int[] { - 100, - 0, - 0, - 0}); - // - // btChangeFontColor - // - this.btChangeFontColor.Location = new System.Drawing.Point(164, 176); - this.btChangeFontColor.Name = "btChangeFontColor"; - this.btChangeFontColor.Size = new System.Drawing.Size(75, 23); - this.btChangeFontColor.TabIndex = 8; - this.btChangeFontColor.Text = "Change..."; - this.btChangeFontColor.UseVisualStyleBackColor = true; - this.btChangeFontColor.Click += new System.EventHandler(this.btChangeFontColor_Click); - // - // btChangePanelColor - // - this.btChangePanelColor.Location = new System.Drawing.Point(164, 104); - this.btChangePanelColor.Name = "btChangePanelColor"; - this.btChangePanelColor.Size = new System.Drawing.Size(75, 23); - this.btChangePanelColor.TabIndex = 7; - this.btChangePanelColor.Text = "Change..."; - this.btChangePanelColor.UseVisualStyleBackColor = true; - this.btChangePanelColor.Click += new System.EventHandler(this.btChangePanelColor_Click); - // - // lbPercent - // - this.lbPercent.AutoSize = true; - this.lbPercent.Location = new System.Drawing.Point(153, 43); - this.lbPercent.Name = "lbPercent"; - this.lbPercent.Size = new System.Drawing.Size(15, 13); - this.lbPercent.TabIndex = 4; - this.lbPercent.Text = "%"; - // - // lbFontColor - // - this.lbFontColor.AutoSize = true; - this.lbFontColor.Location = new System.Drawing.Point(16, 152); - this.lbFontColor.Name = "lbFontColor"; - this.lbFontColor.Size = new System.Drawing.Size(57, 13); - this.lbFontColor.TabIndex = 2; - this.lbFontColor.Text = "Font color:"; - // - // lbPanelColor - // - this.lbPanelColor.AutoSize = true; - this.lbPanelColor.Location = new System.Drawing.Point(16, 80); - this.lbPanelColor.Name = "lbPanelColor"; - this.lbPanelColor.Size = new System.Drawing.Size(103, 13); - this.lbPanelColor.TabIndex = 1; - this.lbPanelColor.Text = "Floating Panel color:"; - // - // lbTransp - // - this.lbTransp.AutoSize = true; - this.lbTransp.Location = new System.Drawing.Point(16, 16); - this.lbTransp.Name = "lbTransp"; - this.lbTransp.Size = new System.Drawing.Size(75, 13); - this.lbTransp.TabIndex = 0; - this.lbTransp.Text = "Transparency:"; - // // tsBehavior // + this.tsBehavior.Controls.Add(this.cbxLockPosition); this.tsBehavior.Controls.Add(this.label5); this.tsBehavior.Controls.Add(this.cbxShortcutWinQuick); this.tsBehavior.Controls.Add(this.cbxShortcutAltQuick); @@ -260,14 +150,89 @@ private void InitializeComponent() this.tsBehavior.Location = new System.Drawing.Point(4, 22); this.tsBehavior.Name = "tsBehavior"; this.tsBehavior.Padding = new System.Windows.Forms.Padding(3); - this.tsBehavior.Size = new System.Drawing.Size(258, 286); + this.tsBehavior.Size = new System.Drawing.Size(260, 327); this.tsBehavior.TabIndex = 1; this.tsBehavior.Text = "Behavior"; this.tsBehavior.UseVisualStyleBackColor = true; // + // cbxLockPosition + // + this.cbxLockPosition.Location = new System.Drawing.Point(20, 233); + this.cbxLockPosition.Name = "cbxLockPosition"; + this.cbxLockPosition.Size = new System.Drawing.Size(220, 24); + this.cbxLockPosition.TabIndex = 24; + this.cbxLockPosition.Text = "Lock Panel Position"; + this.cbxLockPosition.UseVisualStyleBackColor = true; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(198, 304); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(13, 13); + this.label5.TabIndex = 23; + this.label5.Text = "+"; + // + // cbxShortcutWinQuick + // + this.cbxShortcutWinQuick.AutoSize = true; + this.cbxShortcutWinQuick.Location = new System.Drawing.Point(153, 303); + this.cbxShortcutWinQuick.Name = "cbxShortcutWinQuick"; + this.cbxShortcutWinQuick.Size = new System.Drawing.Size(45, 17); + this.cbxShortcutWinQuick.TabIndex = 22; + this.cbxShortcutWinQuick.Text = "Win"; + this.cbxShortcutWinQuick.UseVisualStyleBackColor = true; + // + // cbxShortcutAltQuick + // + this.cbxShortcutAltQuick.AutoSize = true; + this.cbxShortcutAltQuick.Location = new System.Drawing.Point(115, 303); + this.cbxShortcutAltQuick.Name = "cbxShortcutAltQuick"; + this.cbxShortcutAltQuick.Size = new System.Drawing.Size(38, 17); + this.cbxShortcutAltQuick.TabIndex = 21; + this.cbxShortcutAltQuick.Text = "Alt"; + this.cbxShortcutAltQuick.UseVisualStyleBackColor = true; + // + // cbxShortcutShiftQuick + // + this.cbxShortcutShiftQuick.AutoSize = true; + this.cbxShortcutShiftQuick.Location = new System.Drawing.Point(67, 303); + this.cbxShortcutShiftQuick.Name = "cbxShortcutShiftQuick"; + this.cbxShortcutShiftQuick.Size = new System.Drawing.Size(47, 17); + this.cbxShortcutShiftQuick.TabIndex = 20; + this.cbxShortcutShiftQuick.Text = "Shift"; + this.cbxShortcutShiftQuick.UseVisualStyleBackColor = true; + // + // cbxShortcutCntrlQuick + // + this.cbxShortcutCntrlQuick.AutoSize = true; + this.cbxShortcutCntrlQuick.Location = new System.Drawing.Point(21, 303); + this.cbxShortcutCntrlQuick.Name = "cbxShortcutCntrlQuick"; + this.cbxShortcutCntrlQuick.Size = new System.Drawing.Size(47, 17); + this.cbxShortcutCntrlQuick.TabIndex = 19; + this.cbxShortcutCntrlQuick.Text = "Cntrl"; + this.cbxShortcutCntrlQuick.UseVisualStyleBackColor = true; + // + // txtShortcutKeyQuick + // + this.txtShortcutKeyQuick.Location = new System.Drawing.Point(217, 301); + this.txtShortcutKeyQuick.MaxLength = 1; + this.txtShortcutKeyQuick.Name = "txtShortcutKeyQuick"; + this.txtShortcutKeyQuick.Size = new System.Drawing.Size(24, 20); + this.txtShortcutKeyQuick.TabIndex = 18; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(28, 286); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(214, 13); + this.label6.TabIndex = 17; + this.label6.Text = "QuickPass Hot Key (leave blank to disable):"; + // // cbxShowLastOne // - this.cbxShowLastOne.Location = new System.Drawing.Point(20, 222); + this.cbxShowLastOne.Location = new System.Drawing.Point(20, 257); this.cbxShowLastOne.Name = "cbxShowLastOne"; this.cbxShowLastOne.Size = new System.Drawing.Size(220, 24); this.cbxShowLastOne.TabIndex = 16; @@ -342,7 +307,7 @@ private void InitializeComponent() // // cbxShowFoldersBeforeEntries // - this.cbxShowFoldersBeforeEntries.Location = new System.Drawing.Point(18, 158); + this.cbxShowFoldersBeforeEntries.Location = new System.Drawing.Point(19, 161); this.cbxShowFoldersBeforeEntries.Name = "cbxShowFoldersBeforeEntries"; this.cbxShowFoldersBeforeEntries.Size = new System.Drawing.Size(220, 24); this.cbxShowFoldersBeforeEntries.TabIndex = 7; @@ -351,7 +316,7 @@ private void InitializeComponent() // // cbxShowSearch // - this.cbxShowSearch.Location = new System.Drawing.Point(19, 202); + this.cbxShowSearch.Location = new System.Drawing.Point(19, 209); this.cbxShowSearch.Name = "cbxShowSearch"; this.cbxShowSearch.Size = new System.Drawing.Size(220, 24); this.cbxShowSearch.TabIndex = 6; @@ -360,12 +325,13 @@ private void InitializeComponent() // // cbxShowClock // - this.cbxShowClock.Location = new System.Drawing.Point(19, 180); + this.cbxShowClock.Location = new System.Drawing.Point(19, 185); this.cbxShowClock.Name = "cbxShowClock"; this.cbxShowClock.Size = new System.Drawing.Size(220, 24); this.cbxShowClock.TabIndex = 5; this.cbxShowClock.Text = "Show Clock"; this.cbxShowClock.UseVisualStyleBackColor = true; + this.cbxShowClock.CheckedChanged += new System.EventHandler(this.cbxShowClock_CheckedChanged); // // label2 // @@ -389,7 +355,7 @@ private void InitializeComponent() // // cbxSortAlphabetical // - this.cbxSortAlphabetical.Location = new System.Drawing.Point(18, 137); + this.cbxSortAlphabetical.Location = new System.Drawing.Point(19, 137); this.cbxSortAlphabetical.Name = "cbxSortAlphabetical"; this.cbxSortAlphabetical.Size = new System.Drawing.Size(220, 24); this.cbxSortAlphabetical.TabIndex = 2; @@ -419,82 +385,128 @@ private void InitializeComponent() this.label1.TabIndex = 0; this.label1.Text = "URL item action:"; // - // ColorDialog + // tsView // - this.ColorDialog.AnyColor = true; - this.ColorDialog.FullOpen = true; + this.tsView.Controls.Add(this.pnFontColor); + this.tsView.Controls.Add(this.pnPanelColor); + this.tsView.Controls.Add(this.edPercent); + this.tsView.Controls.Add(this.btChangeFontColor); + this.tsView.Controls.Add(this.btChangePanelColor); + this.tsView.Controls.Add(this.lbPercent); + this.tsView.Controls.Add(this.lbFontColor); + this.tsView.Controls.Add(this.lbPanelColor); + this.tsView.Controls.Add(this.lbTransp); + this.tsView.Location = new System.Drawing.Point(4, 22); + this.tsView.Name = "tsView"; + this.tsView.Padding = new System.Windows.Forms.Padding(3); + this.tsView.Size = new System.Drawing.Size(260, 327); + this.tsView.TabIndex = 0; + this.tsView.Text = "View"; + this.tsView.UseVisualStyleBackColor = true; // - // label5 + // pnFontColor // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(195, 264); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(13, 13); - this.label5.TabIndex = 23; - this.label5.Text = "+"; + this.pnFontColor.BackColor = System.Drawing.SystemColors.InfoText; + this.pnFontColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.pnFontColor.Location = new System.Drawing.Point(19, 176); + this.pnFontColor.Name = "pnFontColor"; + this.pnFontColor.Size = new System.Drawing.Size(121, 25); + this.pnFontColor.TabIndex = 11; + this.pnFontColor.DoubleClick += new System.EventHandler(this.pnFontColor_DoubleClick); // - // cbxShortcutWinQuick + // pnPanelColor // - this.cbxShortcutWinQuick.AutoSize = true; - this.cbxShortcutWinQuick.Location = new System.Drawing.Point(150, 263); - this.cbxShortcutWinQuick.Name = "cbxShortcutWinQuick"; - this.cbxShortcutWinQuick.Size = new System.Drawing.Size(45, 17); - this.cbxShortcutWinQuick.TabIndex = 22; - this.cbxShortcutWinQuick.Text = "Win"; - this.cbxShortcutWinQuick.UseVisualStyleBackColor = true; + this.pnPanelColor.BackColor = System.Drawing.SystemColors.Info; + this.pnPanelColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.pnPanelColor.Location = new System.Drawing.Point(19, 104); + this.pnPanelColor.Name = "pnPanelColor"; + this.pnPanelColor.Size = new System.Drawing.Size(121, 25); + this.pnPanelColor.TabIndex = 10; + this.pnPanelColor.DoubleClick += new System.EventHandler(this.pnPanelColor_DoubleClick); // - // cbxShortcutAltQuick + // edPercent // - this.cbxShortcutAltQuick.AutoSize = true; - this.cbxShortcutAltQuick.Location = new System.Drawing.Point(112, 263); - this.cbxShortcutAltQuick.Name = "cbxShortcutAltQuick"; - this.cbxShortcutAltQuick.Size = new System.Drawing.Size(38, 17); - this.cbxShortcutAltQuick.TabIndex = 21; - this.cbxShortcutAltQuick.Text = "Alt"; - this.cbxShortcutAltQuick.UseVisualStyleBackColor = true; + this.edPercent.Location = new System.Drawing.Point(19, 41); + this.edPercent.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.edPercent.Name = "edPercent"; + this.edPercent.Size = new System.Drawing.Size(120, 20); + this.edPercent.TabIndex = 9; + this.edPercent.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); // - // cbxShortcutShiftQuick + // btChangeFontColor // - this.cbxShortcutShiftQuick.AutoSize = true; - this.cbxShortcutShiftQuick.Location = new System.Drawing.Point(64, 263); - this.cbxShortcutShiftQuick.Name = "cbxShortcutShiftQuick"; - this.cbxShortcutShiftQuick.Size = new System.Drawing.Size(47, 17); - this.cbxShortcutShiftQuick.TabIndex = 20; - this.cbxShortcutShiftQuick.Text = "Shift"; - this.cbxShortcutShiftQuick.UseVisualStyleBackColor = true; + this.btChangeFontColor.Location = new System.Drawing.Point(164, 176); + this.btChangeFontColor.Name = "btChangeFontColor"; + this.btChangeFontColor.Size = new System.Drawing.Size(75, 23); + this.btChangeFontColor.TabIndex = 8; + this.btChangeFontColor.Text = "Change..."; + this.btChangeFontColor.UseVisualStyleBackColor = true; + this.btChangeFontColor.Click += new System.EventHandler(this.btChangeFontColor_Click); // - // cbxShortcutCntrlQuick + // btChangePanelColor // - this.cbxShortcutCntrlQuick.AutoSize = true; - this.cbxShortcutCntrlQuick.Location = new System.Drawing.Point(18, 263); - this.cbxShortcutCntrlQuick.Name = "cbxShortcutCntrlQuick"; - this.cbxShortcutCntrlQuick.Size = new System.Drawing.Size(47, 17); - this.cbxShortcutCntrlQuick.TabIndex = 19; - this.cbxShortcutCntrlQuick.Text = "Cntrl"; - this.cbxShortcutCntrlQuick.UseVisualStyleBackColor = true; + this.btChangePanelColor.Location = new System.Drawing.Point(164, 104); + this.btChangePanelColor.Name = "btChangePanelColor"; + this.btChangePanelColor.Size = new System.Drawing.Size(75, 23); + this.btChangePanelColor.TabIndex = 7; + this.btChangePanelColor.Text = "Change..."; + this.btChangePanelColor.UseVisualStyleBackColor = true; + this.btChangePanelColor.Click += new System.EventHandler(this.btChangePanelColor_Click); // - // txtShortcutKeyQuick + // lbPercent // - this.txtShortcutKeyQuick.Location = new System.Drawing.Point(214, 261); - this.txtShortcutKeyQuick.MaxLength = 1; - this.txtShortcutKeyQuick.Name = "txtShortcutKeyQuick"; - this.txtShortcutKeyQuick.Size = new System.Drawing.Size(24, 20); - this.txtShortcutKeyQuick.TabIndex = 18; + this.lbPercent.AutoSize = true; + this.lbPercent.Location = new System.Drawing.Point(153, 43); + this.lbPercent.Name = "lbPercent"; + this.lbPercent.Size = new System.Drawing.Size(15, 13); + this.lbPercent.TabIndex = 4; + this.lbPercent.Text = "%"; // - // label6 + // lbFontColor // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(25, 246); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(214, 13); - this.label6.TabIndex = 17; - this.label6.Text = "QuickPass Hot Key (leave blank to disable):"; + this.lbFontColor.AutoSize = true; + this.lbFontColor.Location = new System.Drawing.Point(16, 152); + this.lbFontColor.Name = "lbFontColor"; + this.lbFontColor.Size = new System.Drawing.Size(57, 13); + this.lbFontColor.TabIndex = 2; + this.lbFontColor.Text = "Font color:"; + // + // lbPanelColor + // + this.lbPanelColor.AutoSize = true; + this.lbPanelColor.Location = new System.Drawing.Point(16, 80); + this.lbPanelColor.Name = "lbPanelColor"; + this.lbPanelColor.Size = new System.Drawing.Size(103, 13); + this.lbPanelColor.TabIndex = 1; + this.lbPanelColor.Text = "Floating Panel color:"; + // + // lbTransp + // + this.lbTransp.AutoSize = true; + this.lbTransp.Location = new System.Drawing.Point(16, 16); + this.lbTransp.Name = "lbTransp"; + this.lbTransp.Size = new System.Drawing.Size(75, 13); + this.lbTransp.TabIndex = 0; + this.lbTransp.Text = "Transparency:"; + // + // ColorDialog + // + this.ColorDialog.AnyColor = true; + this.ColorDialog.FullOpen = true; // // OptionsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(264, 353); + this.ClientSize = new System.Drawing.Size(266, 394); this.Controls.Add(this.pcOptions); this.Controls.Add(this.pnButtons); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; @@ -508,11 +520,11 @@ private void InitializeComponent() this.Load += new System.EventHandler(this.OptionsForm_Load); this.pnButtons.ResumeLayout(false); this.pcOptions.ResumeLayout(false); + this.tsBehavior.ResumeLayout(false); + this.tsBehavior.PerformLayout(); this.tsView.ResumeLayout(false); this.tsView.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.edPercent)).EndInit(); - this.tsBehavior.ResumeLayout(false); - this.tsBehavior.PerformLayout(); this.ResumeLayout(false); } @@ -557,6 +569,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox cbxShortcutShiftQuick; private System.Windows.Forms.CheckBox cbxShortcutCntrlQuick; private System.Windows.Forms.TextBox txtShortcutKeyQuick; - private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.CheckBox cbxLockPosition; } } \ No newline at end of file diff --git a/OptionsForm.cs b/OptionsForm.cs index 549fc58..4f8fc4e 100644 --- a/OptionsForm.cs +++ b/OptionsForm.cs @@ -64,7 +64,8 @@ private void OptionsForm_Load(object sender, EventArgs e) cbxShortcutShiftQuick.Checked = Options.shortcutShiftQuick; cbxShortcutWinQuick.Checked = Options.shortcutWinQuick; cbxShowFoldersBeforeEntries.Checked = Options.foldersFirst; - cbxShowSearch.Checked = Options.showSearch; + cbxShowSearch.Checked = Options.showSearch; + cbxLockPosition.Checked = Options.lockWindowPosition; cbxShowLastOne.Checked = Options.showLastOne; txtShortcutKey.Text = Options.shortcutKey; txtShortcutKeyQuick.Text = Options.shortcutKeyQuick; @@ -105,7 +106,8 @@ private void btOk_Click(object sender, EventArgs e) Options.foldersFirst = cbxShowFoldersBeforeEntries.Checked; Options.shortcutKeyQuick = txtShortcutKeyQuick.Text.ToUpper(); Options.shortcutKey = txtShortcutKey.Text.ToUpper(); - Options.showSearch = cbxShowSearch.Checked; + Options.showSearch = cbxShowSearch.Checked; + Options.lockWindowPosition = cbxLockPosition.Checked; Options.showLastOne = cbxShowLastOne.Checked; Options.Save(); @@ -121,7 +123,12 @@ private void pnPanelColor_DoubleClick(object sender, EventArgs e) private void pnFontColor_DoubleClick(object sender, EventArgs e) { btChangeFontColor_Click(sender, e); - } + } + + private void cbxShowClock_CheckedChanged(object sender, EventArgs e) + { + + } } class StartGroupDropdown {