3 Commits

Author SHA1 Message Date
Jonathan Jenne
b35e8fa588 ZooFlow: Add Animator, Improve Hotkey Usage 2021-03-03 10:33:43 +01:00
Jonathan Jenne
b0da663756 Windows: Improve Hotkey 2021-03-03 10:32:36 +01:00
Jonathan Jenne
1d315a15b8 Windows: fix animator not disappearing, add topmost 2021-03-03 09:57:45 +01:00
5 changed files with 42 additions and 29 deletions

View File

@@ -22,8 +22,8 @@
Public Const VECTORSEPARATOR = ""
Public Const SERVICE_ADDRESS_SEPARATOR = ":"
Public Const HOTKEY_TOGGLE_WATCHER = 354522017
Public Const HOTKEY_TRIGGER_WATCHER = 354523017
Public Const HOTKEY_TOGGLE_WATCHER As Integer = 354522017
Public Const HOTKEY_TRIGGER_WATCHER As Integer = 354523017
Public Const NOTIFICATION_DELAY = 2500

View File

@@ -56,15 +56,6 @@
<Reference Include="DevExpress.XtraLayout.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraPrinting.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraTreeList.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DigitalData.Controls.DocumentViewer">
<HintPath>..\Controls.DocumentViewer\bin\Debug\DigitalData.Controls.DocumentViewer.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Controls.LookupGrid">
<HintPath>..\Controls.LookupGrid\bin\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
</Reference>
<Reference Include="DigitalData.GUIs.Common">
<HintPath>..\GUIs.Common\bin\Debug\DigitalData.GUIs.Common.dll</HintPath>
</Reference>
<Reference Include="Independentsoft.Msg">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\22_11_19\Independentsoft.Msg.dll</HintPath>
</Reference>
@@ -396,10 +387,22 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Controls.DocumentViewer\DocumentViewer.vbproj">
<Project>{0958cddf-4a16-41f6-8837-8335f71d599c}</Project>
<Name>DocumentViewer</Name>
</ProjectReference>
<ProjectReference Include="..\Controls.LookupGrid\LookupControl.vbproj">
<Project>{3dcd6d1a-c830-4241-b7e4-27430e7ea483}</Project>
<Name>LookupControl</Name>
</ProjectReference>
<ProjectReference Include="..\GUIs.ClipboardWatcher\ClipboardWatcher.vbproj">
<Project>{B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}</Project>
<Name>ClipboardWatcher</Name>
</ProjectReference>
<ProjectReference Include="..\GUIs.Common\Common.vbproj">
<Project>{d20a6bf2-c7c6-4a7a-b34d-fa27d775a049}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Config\Config.vbproj">
<Project>{44982F9B-6116-44E2-85D0-F39650B1EF99}</Project>
<Name>Config</Name>

View File

@@ -34,6 +34,11 @@ Public Class frmFlowForm
Private ClassWindow As Window
Private ProfileFilter As ProfileFilter
Private ProfileLoader As ClassProfileLoader
Private Animator As New Animator() With {
.PopupColor = Color.FromArgb(255, 214, 49),
.PopupOpacity = 0.8,
.PopupSize = New Size(100, 30)
}
' Runtime Flags
Private ApplicationLoading As Boolean = True
@@ -229,13 +234,13 @@ Public Class frmFlowForm
Select Case oFunctionKey
Case "CTRL"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_CONTROL, ClassConstants.HOTKEY_TRIGGER_WATCHER)
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_CONTROL, HOTKEY_TRIGGER_WATCHER)
Case "SHIFT"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_SHIFT, ClassConstants.HOTKEY_TRIGGER_WATCHER)
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_SHIFT, HOTKEY_TRIGGER_WATCHER)
Case "ALT"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_ALT, ClassConstants.HOTKEY_TRIGGER_WATCHER)
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_ALT, HOTKEY_TRIGGER_WATCHER)
Case "WIN"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_WIN, ClassConstants.HOTKEY_TRIGGER_WATCHER)
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_WIN, HOTKEY_TRIGGER_WATCHER)
End Select
AddHandler HotkeyClass.HotKeyPressed, AddressOf HotkeyClass_HotKeyPressed
@@ -943,6 +948,8 @@ Public Class frmFlowForm
Select Case HotKeyID
Case HOTKEY_TRIGGER_WATCHER
Animator.Highlight(Cursor.Position)
If oState.CurrentClipboardContents = String.Empty Then
Logger.Info("Current Clipboard Contents is empty. Exiting.")
Exit Sub

View File

@@ -36,11 +36,11 @@ Public Class Animator
_PopupColor = Color.FromArgb(255, 214, 49)
End Sub
Public Sub Highlight(Position As Point)
Public Async Sub Highlight(Position As Point)
Dim oForm = GetPopup(Position, PopupSize)
oForm.Show()
FadeIn(oForm, _PopupOpacity, _AnimationSpeed / 2)
Task.Delay(_AnimationInterval)
Await Task.Delay(_AnimationInterval)
FadeOut(oForm, _AnimationSpeed * 2)
End Sub
@@ -57,7 +57,8 @@ Public Class Animator
.MinimumSize = PopupSize,
.Opacity = 0,
.ShowInTaskbar = False,
.BackColor = _PopupColor
.BackColor = _PopupColor,
.TopMost = True
}
End Function

View File

@@ -1,4 +1,6 @@
Imports System.Windows.Forms
Option Explicit On
Imports System.Windows.Forms
Public Class Hotkey
Implements IMessageFilter
@@ -10,7 +12,7 @@ Public Class Hotkey
''' <summary>
''' Diesem Event wird immer die zugewiesene HotKeyID übergeben, wenn eine HotKey Kombination gedrückt wurde.
''' </summary>
Public Event HotKeyPressed(ByVal HotKeyID As String)
Public Event HotKeyPressed(HotKeyID As String)
''' <summary>
''' Definiert verfügbare Modfier Keys
@@ -22,7 +24,7 @@ Public Class Hotkey
MOD_WIN = 8
End Enum
Sub New(ByVal pOwnerForm As Form)
Sub New(pOwnerForm As Form)
_OwnerForm = pOwnerForm
Application.AddMessageFilter(Me)
End Sub
@@ -33,13 +35,12 @@ Public Class Hotkey
''' <param name="pKeyCode">Den KeyCode für die Taste</param>
''' <param name="pModifiers">Die Zusatztasten wie z.B. Strg oder Alt, diese können auch mit OR kombiniert werden</param>
''' <param name="pHotKeyID">Die ID die der Hotkey bekommen soll um diesen zu identifizieren</param>
Public Sub AddHotKey(ByVal pKeyCode As Keys, ByVal pModifiers As ModfierKey, ByVal pHotKeyID As Integer)
Public Sub AddHotKey(pKeyCode As Keys, pModifiers As ModfierKey, pHotKeyID As Integer)
If _HotkeyIDList.ContainsKey(pHotKeyID) = True Then
Exit Sub
End If
Dim oHotkeyId As Short = NativeMethods.GlobalAddAtom(pHotKeyID)
_HotkeyIDList.Add(pHotKeyID, oHotkeyId)
Dim oHotkeyId As Short = NativeMethods.GlobalAddAtom(pHotKeyID.ToString())
_HotkeyList.Add(oHotkeyId, New HotKeyObject(pKeyCode, pModifiers, pHotKeyID))
NativeMethods.RegisterHotKey(_OwnerForm.Handle, oHotkeyId, _HotkeyList(oHotkeyId).Modifier, _HotkeyList(oHotkeyId).HotKey)
@@ -67,15 +68,16 @@ Public Class Hotkey
RaiseEvent HotKeyPressed(_HotkeyList(CShort(m.WParam)).HotKeyID)
End If
End If
Return False
End Function
Public Class HotKeyObject
Public Property HotKey() As Keys
Public Property Modifier() As ModfierKey
Public Property HotKeyID() As String
Public Property AtomID() As Short
Public Property HotKey As Keys
Public Property Modifier As ModfierKey
Public Property HotKeyID As Integer
Public Property AtomID As Short
Sub New(ByVal NewHotKey As Keys, ByVal NewModifier As ModfierKey, ByVal NewHotKeyID As String)
Sub New(NewHotKey As Keys, NewModifier As ModfierKey, NewHotKeyID As Integer)
HotKey = NewHotKey
Modifier = NewModifier
HotKeyID = NewHotKeyID