From 4664b3e675ba74348bbc7baee9659ba6ddda092b Mon Sep 17 00:00:00 2001 From: Alexander Persson Date: Fri, 29 Dec 2017 11:19:47 +0100 Subject: [PATCH 1/4] Fixing Request #1. Now remembers latest position. --- ClassKPFloatingPanel.cs | 4 ++-- MainForm.cs | 29 ++++++++++++++++++++++++----- OptionsClass.cs | 11 +++++++++-- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/ClassKPFloatingPanel.cs b/ClassKPFloatingPanel.cs index 993af56..9bbec74 100644 --- a/ClassKPFloatingPanel.cs +++ b/ClassKPFloatingPanel.cs @@ -18,7 +18,7 @@ internal sealed class KPFloatingPanelExt : Plugin { private void InitForm() { FForm = new MainForm(); FForm.Host = FHost; - FForm.ResetPosition(); + FForm.RestorePosition(); FForm.Show(); } public override string UpdateUrl { @@ -76,7 +76,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.cs b/MainForm.cs index 525dd02..59c828c 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -133,12 +133,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) { @@ -216,6 +227,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(); } } @@ -839,6 +853,11 @@ protected override CreateParams CreateParams//allow us to be borderless and not return cp; } } + + private void MainForm_Load(object sender, EventArgs e) + { + + } } } diff --git a/OptionsClass.cs b/OptionsClass.cs index e32e766..48c053a 100644 --- a/OptionsClass.cs +++ b/OptionsClass.cs @@ -14,7 +14,9 @@ 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; @@ -46,6 +48,8 @@ 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")); @@ -80,7 +84,10 @@ 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); From 7ea8f98dd510db8178111d52547f6878452f4ecc Mon Sep 17 00:00:00 2001 From: Alexander Persson Date: Fri, 29 Dec 2017 14:26:21 +0100 Subject: [PATCH 2/4] Added Possibility to lock window in place in options so it wont move around so much when you use it. --- MainForm.Designer.cs | 350 +++++++++++++++++----------------- MainForm.cs | 11 +- MainForm.resx | 86 ++++----- OptionsClass.cs | 6 +- OptionsForm.Designer.cs | 408 +++++++++++++++++++++------------------- OptionsForm.cs | 6 +- 6 files changed, 443 insertions(+), 424 deletions(-) diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 2a0cb48..b8306b6 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -28,191 +28,189 @@ 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.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.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); + // + // 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.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(); } diff --git a/MainForm.cs b/MainForm.cs index 59c828c..0b4ab3d 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -214,9 +214,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; + } } @@ -860,4 +863,4 @@ private void MainForm_Load(object sender, EventArgs e) } } -} +} \ No newline at end of file diff --git a/MainForm.resx b/MainForm.resx index 90a8151..8db7bb2 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 @@ -171,7 +171,7 @@ 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 +189,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 +197,7 @@ 2 - + 96, 17 @@ -218,6 +218,12 @@ Save Database + + 180, 22 + + + LastOne + False @@ -230,33 +236,27 @@ 177, 6 - - 180, 22 - - - LastOne - - 181, 129 + 181, 101 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 + OAAAAk1TRnQBSQFMAgEBDQEAASQBAAEMAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABQAMAAQEBAAEYBgABMBIAAb0CiQGWAnABlQJvAcwCmLQAAU8BbwF/AQEBtQHhAQEBqwHaAW0CXwH2 At2xAAFcAWgBaQEBAegB/wEBAe4B/wEBAYMBtQGBAmgBvwKLrgABiAJsAQEB2gH0AQEB2QH3AQEBzAH6 AQEBuAHrAUABRQFsAdwCq6sAAe8CzAFwAmYBAQHbAfQBAQHaAfYBAQHuAf8BAQGaAdQBYwJdAbsCiAHw @@ -500,10 +500,10 @@ AcABDwEBA/8BwAE/AcABPwEBCf8L - + 453, 17 - + True @@ -512,7 +512,7 @@ True - + GrowAndShrink @@ -526,90 +526,90 @@ 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 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 48c053a..af89b0e 100644 --- a/OptionsClass.cs +++ b/OptionsClass.cs @@ -22,6 +22,7 @@ public class OptionsClass { internal bool shortcutAlt; internal bool shortcutCntrl; internal bool shortcutWin; + internal bool lockWindowPosition; internal string shortcutKeyQuick; internal bool shortcutShiftQuick; @@ -55,6 +56,7 @@ public void Load() { 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")); @@ -93,6 +95,7 @@ public void Save() { Key.SetValue("shortcutShift", shortcutShift); Key.SetValue("shortcutCntrl", shortcutCntrl); Key.SetValue("shortcutWin", shortcutWin); + Key.SetValue("lockWindowPosition", lockWindowPosition); Key.SetValue("shortcutKeyQuick", shortcutKeyQuick); Key.SetValue("shortcutAltQuick", shortcutAltQuick); @@ -120,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..968d51d 100644 --- a/OptionsForm.Designer.cs +++ b/OptionsForm.Designer.cs @@ -33,17 +33,14 @@ 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.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 +57,23 @@ 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.cbxLockPosition = new System.Windows.Forms.CheckBox(); 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,80 @@ 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; // + // 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 +298,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 +307,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,7 +316,7 @@ 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; @@ -389,7 +345,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 +375,137 @@ 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(258, 286); + 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; + // + // 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; // // 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 +519,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 +568,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..f7bcd27 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(); From 94d586bd8ec8fd9fbd569a58312cf9a51e2869b5 Mon Sep 17 00:00:00 2001 From: Alexander Persson Date: Fri, 29 Dec 2017 15:32:30 +0100 Subject: [PATCH 3/4] Added Posibility to Restore Keepass from the Right Click Menu. --- MainForm.Designer.cs | 9 +++++++++ MainForm.cs | 5 +++++ MainForm.resx | 16 ++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index b8306b6..a523dab 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -47,6 +47,7 @@ private void InitializeComponent() 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.openKeepassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pmMainMenu.SuspendLayout(); this.pmPasswords.SuspendLayout(); this.SuspendLayout(); @@ -65,6 +66,7 @@ private void InitializeComponent() // this.pmMainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.miHide, + this.openKeepassToolStripMenuItem, this.miSetup, this.toolStripSeparator2, this.miAbout, @@ -187,6 +189,12 @@ private void InitializeComponent() // this.timer_search.Tick += new System.EventHandler(this.timer_search_Tick); // + // openKeepassToolStripMenuItem + // + this.openKeepassToolStripMenuItem.Name = "openKeepassToolStripMenuItem"; + resources.ApplyResources(this.openKeepassToolStripMenuItem, "openKeepassToolStripMenuItem"); + this.openKeepassToolStripMenuItem.Click += new System.EventHandler(this.openKeepassToolStripMenuItem_Click); + // // MainForm // resources.ApplyResources(this, "$this"); @@ -233,5 +241,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 0b4ab3d..5708951 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -861,6 +861,11 @@ 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 8db7bb2..815ef2e 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -134,6 +134,12 @@ Hide this panel + + 141, 22 + + + Open Keepass + 141, 22 @@ -165,7 +171,7 @@ Exit KeePass - 142, 104 + 142, 148 pmMainMenu @@ -256,7 +262,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM - OAAAAk1TRnQBSQFMAgEBDQEAASQBAAEMAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA + OAAAAk1TRnQBSQFMAgEBDQEAARwBAAEcAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABQAMAAQEBAAEYBgABMBIAAb0CiQGWAnABlQJvAcwCmLQAAU8BbwF/AQEBtQHhAQEBqwHaAW0CXwH2 At2xAAFcAWgBaQEBAegB/wEBAe4B/wEBAYMBtQGBAmgBvwKLrgABiAJsAQEB2gH0AQEB2QH3AQEBzAH6 AQEBuAHrAUABRQFsAdwCq6sAAe8CzAFwAmYBAQHbAfQBAQHaAfYBAQHuAf8BAQGaAdQBYwJdAbsCiAHw @@ -606,6 +612,12 @@ System.Windows.Forms.Timer, 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 + MainForm From 049e5adf93b09f6008570114d9fdde443eae7a37 Mon Sep 17 00:00:00 2001 From: Alexander Persson Date: Sat, 30 Dec 2017 14:07:53 +0100 Subject: [PATCH 4/4] Added function so that it selects entry after auto open of URL/Edit7Copy etc. This is so that when you use open URL you can then use global autotype command without having to switch and select the entry manually or select it again from KPFloatingPanel --- ClassKPFloatingPanel.cs | 3 +++ MainForm.Designer.cs | 15 ++++++++------- MainForm.cs | 38 +++++++++++++++++++++++++++++++++++--- MainForm.resx | 18 +++++++++--------- OptionsForm.Designer.cs | 23 ++++++++++++----------- OptionsForm.cs | 7 ++++++- 6 files changed, 73 insertions(+), 31 deletions(-) diff --git a/ClassKPFloatingPanel.cs b/ClassKPFloatingPanel.cs index 9bbec74..a079b14 100644 --- a/ClassKPFloatingPanel.cs +++ b/ClassKPFloatingPanel.cs @@ -20,6 +20,8 @@ private void InitForm() { FForm.Host = FHost; 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"; diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index a523dab..e68c64c 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -33,6 +33,7 @@ private void InitializeComponent() 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(); @@ -47,7 +48,6 @@ private void InitializeComponent() 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.openKeepassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pmMainMenu.SuspendLayout(); this.pmPasswords.SuspendLayout(); this.SuspendLayout(); @@ -85,6 +85,12 @@ private void InitializeComponent() 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; @@ -126,6 +132,7 @@ private void InitializeComponent() 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 @@ -189,12 +196,6 @@ private void InitializeComponent() // this.timer_search.Tick += new System.EventHandler(this.timer_search_Tick); // - // openKeepassToolStripMenuItem - // - this.openKeepassToolStripMenuItem.Name = "openKeepassToolStripMenuItem"; - resources.ApplyResources(this.openKeepassToolStripMenuItem, "openKeepassToolStripMenuItem"); - this.openKeepassToolStripMenuItem.Click += new System.EventHandler(this.openKeepassToolStripMenuItem_Click); - // // MainForm // resources.ApplyResources(this, "$this"); diff --git a/MainForm.cs b/MainForm.cs index 5708951..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); + + } @@ -639,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); @@ -688,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) { @@ -708,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) { @@ -715,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); @@ -732,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(); + } @@ -865,6 +896,7 @@ private void MainForm_Load(object sender, EventArgs e) private void openKeepassToolStripMenuItem_Click(object sender, EventArgs e) { KeePass.Program.MainForm.EnsureVisibleForegroundWindow(true,true); + } } diff --git a/MainForm.resx b/MainForm.resx index 815ef2e..72a02a1 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -171,7 +171,7 @@ Exit KeePass - 142, 148 + 142, 126 pmMainMenu @@ -243,7 +243,7 @@ 177, 6 - 181, 101 + 181, 123 pmPasswords @@ -262,7 +262,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM - OAAAAk1TRnQBSQFMAgEBDQEAARwBAAEcAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA + OAAAAk1TRnQBSQFMAgEBDQEAASQBAAEkAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABQAMAAQEBAAEYBgABMBIAAb0CiQGWAnABlQJvAcwCmLQAAU8BbwF/AQEBtQHhAQEBqwHaAW0CXwH2 At2xAAFcAWgBaQEBAegB/wEBAe4B/wEBAYMBtQGBAmgBvwKLrgABiAJsAQEB2gH0AQEB2QH3AQEBzAH6 AQEBuAHrAUABRQFsAdwCq6sAAe8CzAFwAmYBAQHbAfQBAQHaAfYBAQHuAf8BAQGaAdQBYwJdAbsCiAHw @@ -534,6 +534,12 @@ 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 @@ -612,12 +618,6 @@ System.Windows.Forms.Timer, 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 - MainForm diff --git a/OptionsForm.Designer.cs b/OptionsForm.Designer.cs index 968d51d..3600de4 100644 --- a/OptionsForm.Designer.cs +++ b/OptionsForm.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.btOk = new System.Windows.Forms.Button(); this.pcOptions = new System.Windows.Forms.TabControl(); 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(); @@ -68,7 +69,6 @@ private void InitializeComponent() this.lbPanelColor = new System.Windows.Forms.Label(); this.lbTransp = new System.Windows.Forms.Label(); this.ColorDialog = new System.Windows.Forms.ColorDialog(); - this.cbxLockPosition = new System.Windows.Forms.CheckBox(); this.pnButtons.SuspendLayout(); this.pcOptions.SuspendLayout(); this.tsBehavior.SuspendLayout(); @@ -155,6 +155,15 @@ private void InitializeComponent() 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; @@ -322,6 +331,7 @@ private void InitializeComponent() 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 +399,7 @@ private void InitializeComponent() 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(258, 286); + this.tsView.Size = new System.Drawing.Size(260, 327); this.tsView.TabIndex = 0; this.tsView.Text = "View"; this.tsView.UseVisualStyleBackColor = true; @@ -492,15 +502,6 @@ private void InitializeComponent() this.ColorDialog.AnyColor = true; this.ColorDialog.FullOpen = 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; - // // OptionsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/OptionsForm.cs b/OptionsForm.cs index f7bcd27..4f8fc4e 100644 --- a/OptionsForm.cs +++ b/OptionsForm.cs @@ -123,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 {