From 323abc232e64e8f8717fa2d017e7ee0358d03ba8 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sat, 3 Jan 2026 14:55:00 +0100 Subject: [PATCH] Implement a hotkey to add clients to the group on the fly --- EVE-X-Preview.json | 105 --------------------------------------------- src/Main_Class.ahk | 61 ++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 105 deletions(-) diff --git a/EVE-X-Preview.json b/EVE-X-Preview.json index dddeb19..1febb06 100644 --- a/EVE-X-Preview.json +++ b/EVE-X-Preview.json @@ -268,111 +268,6 @@ "AutoForwardToggleHotkey":"SC029", "BackwardsHotkey":"+Tab", "Characters":[ - "Tertiale", - "Quartio", - "PhatPhuckDave" - ], - "ForwardsHotkey":"Tab" - } - }, - "Hotkeys":[ - { - "PhatPhuckDave":"lalt & 1" - }, - { - "Primorium":"lalt & 2" - }, - { - "Secundamen":"lalt & 3" - }, - { - "Tertiale":"lalt & 4" - }, - { - "Quartio":"lalt & 5" - } - ], - "Thumbnail Positions":{}, - "Thumbnail Settings":{ - "ClientHighligtBorderthickness":4, - "ClientHighligtColor":"#E36A0D", - "HideThumbnailsOnLostFocus":0, - "InactiveClientBorderColor":"#8A8A8A", - "InactiveClientBorderthickness":2, - "ShowAllColoredBorders":0, - "ShowClientHighlightBorder":1, - "ShowThumbnailTextOverlay":1, - "ShowThumbnailsAlwaysOnTop":1, - "ThumbnailOpacity":80, - "ThumbnailTextColor":"#FAC57A", - "ThumbnailTextFont":"Gill Sans MT", - "ThumbnailTextMargins":{ - "x":15, - "y":5 - }, - "ThumbnailTextSize":12 - }, - "Thumbnail Visibility":{} - }, - "Alternate 02":{ - "Client Possitions":{ - "PhatPhuckDave":{ - "IsMaximized":0, - "height":1440, - "width":2560, - "x":0, - "y":0 - }, - "Primorium":{ - "IsMaximized":0, - "height":1440, - "width":2560, - "x":0, - "y":0 - }, - "Secundamen":{ - "IsMaximized":0, - "height":1440, - "width":2560, - "x":0, - "y":0 - } - }, - "Client Settings":{ - "AlwaysMaximize":0, - "Dont_Minimize_Clients":[ - "Example Name1", - "Example Name2", - "Example Name3" - ], - "MinimizeInactiveClients":0, - "TrackClientPossitions":1 - }, - "Custom Colors":{ - "cColorActive":"0", - "cColors":{ - "Bordercolor":[ - "FFFFFF" - ], - "CharNames":[ - "PhatPhuckDave" - ], - "IABordercolor":[ - "FFFFFF" - ], - "TextColor":[ - "FFFFFF" - ] - } - }, - "Hotkey Groups":{ - "Daves":{ - "AutoForwardOnKeypress":1, - "AutoForwardToggle":1, - "AutoForwardToggleHotkey":"SC029", - "BackwardsHotkey":"+Tab", - "Characters":[ - "PhatPhuckDave", "Tertiale", "Quartio" ], diff --git a/src/Main_Class.ahk b/src/Main_Class.ahk index ac23c34..bf2168d 100644 --- a/src/Main_Class.ahk +++ b/src/Main_Class.ahk @@ -49,6 +49,7 @@ AutoForwardTimerPending := false ; Flag to prevent multiple timers from being scheduled CharacterNameOverlay := 0 ; GUI overlay for displaying current character name CharacterNameOverlayLastText := "" ; Track last displayed text to prevent flashing + CharacterNameOverlayLastColor := "" ; Track last color to detect changes LastActiveCharacter := "" ; Track last active character for AddCharacterToGroup CharacterNameOverlayX := 0 ; Stored X position for dragging CharacterNameOverlayY := 0 ; Stored Y position for dragging @@ -179,6 +180,19 @@ This.CharacterNameOverlay["CharacterNameText"].Text := activeTitle } + if (activeTitle != "") { + inGroup := This.IsCharacterInGroup(activeTitle) + baseColor := This.CharacterNameOverlayTextColor + textColor := inGroup ? This.TintColor(baseColor, 0.15) : baseColor + + if (textColor != This.CharacterNameOverlayLastColor || activeTitle != This.CharacterNameOverlayLastText) { + textWeight := This.CharacterNameOverlayTextBold ? "w700" : "w400" + This.CharacterNameOverlay.SetFont("s" This.CharacterNameOverlayTextSize " " textWeight " c" textColor, "Arial") + This.CharacterNameOverlay["CharacterNameText"].SetFont("s" This.CharacterNameOverlayTextSize " " textWeight " c" textColor, "Arial") + This.CharacterNameOverlayLastColor := textColor + } + } + hotkeyText := "" hotkeyValue := This._Hotkeys[activeTitle] if (hotkeyValue && hotkeyValue != "" && hotkeyValue != 0) { @@ -1236,9 +1250,11 @@ This.Hotkey_Groups[targetGroupName]["Characters"] := [] alreadyInGroup := false + removeIndex := 0 for index, charName in This.Hotkey_Groups[targetGroupName]["Characters"] { if (charName = currentTitle) { alreadyInGroup := true + removeIndex := index break } } @@ -1247,8 +1263,53 @@ This.Hotkey_Groups[targetGroupName]["Characters"].Push(currentTitle) SetTimer(This.Save_Settings_Delay_Timer, -200) This.NeedRestart := 1 + ToolTip("Added " currentTitle " to group") + SetTimer(() => ToolTip(), -1500) + This.UpdateCharacterNameOverlay() + } else { + This.Hotkey_Groups[targetGroupName]["Characters"].RemoveAt(removeIndex) + SetTimer(This.Save_Settings_Delay_Timer, -200) + This.NeedRestart := 1 + ToolTip("Removed " currentTitle " from group") + SetTimer(() => ToolTip(), -1500) + This.UpdateCharacterNameOverlay() } } + + IsCharacterInGroup(charName) { + if (!IsObject(This.Hotkey_Groups) || This.Hotkey_Groups.Count = 0) + return false + + for groupName, groupData in This.Hotkey_Groups { + if (IsObject(groupData["Characters"])) { + for index, name in groupData["Characters"] { + if (name = charName) + return true + } + } + } + return false + } + + TintColor(hexColor, tintAmount := 0.2) { + hexColor := RegExReplace(hexColor, "^#|^0x", "") + if (StrLen(hexColor) != 6) + return hexColor + + r := Integer("0x" SubStr(hexColor, 1, 2)) + g := Integer("0x" SubStr(hexColor, 3, 2)) + b := Integer("0x" SubStr(hexColor, 5, 2)) + + r := Round(r + (255 - r) * tintAmount) + g := Round(g + (255 - g) * tintAmount) + b := Round(b + (255 - b) * tintAmount) + + r := (r > 255 ? 255 : r < 0 ? 0 : r) + g := (g > 255 ? 255 : g < 0 ? 0 : g) + b := (b > 255 ? 255 : b < 0 ? 0 : b) + + return Format("{:02X}{:02X}{:02X}", r, g, b) + } SaveJsonToFile() { FileDelete("EVE-X-Preview.json")