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 VECTORSEPARATOR = ""
Public Const SERVICE_ADDRESS_SEPARATOR = ":" Public Const SERVICE_ADDRESS_SEPARATOR = ":"
Public Const HOTKEY_TOGGLE_WATCHER = 354522017 Public Const HOTKEY_TOGGLE_WATCHER As Integer = 354522017
Public Const HOTKEY_TRIGGER_WATCHER = 354523017 Public Const HOTKEY_TRIGGER_WATCHER As Integer = 354523017
Public Const NOTIFICATION_DELAY = 2500 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.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.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="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"> <Reference Include="Independentsoft.Msg">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\22_11_19\Independentsoft.Msg.dll</HintPath> <HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\22_11_19\Independentsoft.Msg.dll</HintPath>
</Reference> </Reference>
@@ -396,10 +387,22 @@
</None> </None>
</ItemGroup> </ItemGroup>
<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"> <ProjectReference Include="..\GUIs.ClipboardWatcher\ClipboardWatcher.vbproj">
<Project>{B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}</Project> <Project>{B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}</Project>
<Name>ClipboardWatcher</Name> <Name>ClipboardWatcher</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\GUIs.Common\Common.vbproj">
<Project>{d20a6bf2-c7c6-4a7a-b34d-fa27d775a049}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Config\Config.vbproj"> <ProjectReference Include="..\Modules.Config\Config.vbproj">
<Project>{44982F9B-6116-44E2-85D0-F39650B1EF99}</Project> <Project>{44982F9B-6116-44E2-85D0-F39650B1EF99}</Project>
<Name>Config</Name> <Name>Config</Name>

View File

@@ -34,6 +34,11 @@ Public Class frmFlowForm
Private ClassWindow As Window Private ClassWindow As Window
Private ProfileFilter As ProfileFilter Private ProfileFilter As ProfileFilter
Private ProfileLoader As ClassProfileLoader 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 ' Runtime Flags
Private ApplicationLoading As Boolean = True Private ApplicationLoading As Boolean = True
@@ -229,13 +234,13 @@ Public Class frmFlowForm
Select Case oFunctionKey Select Case oFunctionKey
Case "CTRL" 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" 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" 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" 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 End Select
AddHandler HotkeyClass.HotKeyPressed, AddressOf HotkeyClass_HotKeyPressed AddHandler HotkeyClass.HotKeyPressed, AddressOf HotkeyClass_HotKeyPressed
@@ -943,6 +948,8 @@ Public Class frmFlowForm
Select Case HotKeyID Select Case HotKeyID
Case HOTKEY_TRIGGER_WATCHER Case HOTKEY_TRIGGER_WATCHER
Animator.Highlight(Cursor.Position)
If oState.CurrentClipboardContents = String.Empty Then If oState.CurrentClipboardContents = String.Empty Then
Logger.Info("Current Clipboard Contents is empty. Exiting.") Logger.Info("Current Clipboard Contents is empty. Exiting.")
Exit Sub Exit Sub

View File

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

View File

@@ -1,4 +1,6 @@
Imports System.Windows.Forms Option Explicit On
Imports System.Windows.Forms
Public Class Hotkey Public Class Hotkey
Implements IMessageFilter Implements IMessageFilter
@@ -10,7 +12,7 @@ Public Class Hotkey
''' <summary> ''' <summary>
''' Diesem Event wird immer die zugewiesene HotKeyID übergeben, wenn eine HotKey Kombination gedrückt wurde. ''' Diesem Event wird immer die zugewiesene HotKeyID übergeben, wenn eine HotKey Kombination gedrückt wurde.
''' </summary> ''' </summary>
Public Event HotKeyPressed(ByVal HotKeyID As String) Public Event HotKeyPressed(HotKeyID As String)
''' <summary> ''' <summary>
''' Definiert verfügbare Modfier Keys ''' Definiert verfügbare Modfier Keys
@@ -22,7 +24,7 @@ Public Class Hotkey
MOD_WIN = 8 MOD_WIN = 8
End Enum End Enum
Sub New(ByVal pOwnerForm As Form) Sub New(pOwnerForm As Form)
_OwnerForm = pOwnerForm _OwnerForm = pOwnerForm
Application.AddMessageFilter(Me) Application.AddMessageFilter(Me)
End Sub End Sub
@@ -33,13 +35,12 @@ Public Class Hotkey
''' <param name="pKeyCode">Den KeyCode für die Taste</param> ''' <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="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> ''' <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 If _HotkeyIDList.ContainsKey(pHotKeyID) = True Then
Exit Sub Exit Sub
End If End If
Dim oHotkeyId As Short = NativeMethods.GlobalAddAtom(pHotKeyID) Dim oHotkeyId As Short = NativeMethods.GlobalAddAtom(pHotKeyID.ToString())
_HotkeyIDList.Add(pHotKeyID, oHotkeyId)
_HotkeyList.Add(oHotkeyId, New HotKeyObject(pKeyCode, pModifiers, pHotKeyID)) _HotkeyList.Add(oHotkeyId, New HotKeyObject(pKeyCode, pModifiers, pHotKeyID))
NativeMethods.RegisterHotKey(_OwnerForm.Handle, oHotkeyId, _HotkeyList(oHotkeyId).Modifier, _HotkeyList(oHotkeyId).HotKey) 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) RaiseEvent HotKeyPressed(_HotkeyList(CShort(m.WParam)).HotKeyID)
End If End If
End If End If
Return False
End Function End Function
Public Class HotKeyObject Public Class HotKeyObject
Public Property HotKey() As Keys Public Property HotKey As Keys
Public Property Modifier() As ModfierKey Public Property Modifier As ModfierKey
Public Property HotKeyID() As String Public Property HotKeyID As Integer
Public Property AtomID() As Short 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 HotKey = NewHotKey
Modifier = NewModifier Modifier = NewModifier
HotKeyID = NewHotKeyID HotKeyID = NewHotKeyID