Initial commit

This commit is contained in:
g0nzo83
2024-02-11 07:47:20 +01:00
commit 01190f5a9a
12 changed files with 3563 additions and 0 deletions

BIN
Icon-Suspend.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
Icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

73
Lib/DefaultJSON.ahk Normal file
View File

@@ -0,0 +1,73 @@
default_JSON := "
(
{
"global_Settings": {
"Suspend_Hotkeys_Hotkey": "",
"Global_Hotkeys": 1,
"LastUsedProfile": "Default",
"Minimize_Delay": 100,
"ThumbnailStartLocation": {
"x": 20,
"y": 20,
"width": 250,
"height": 140
},
"ThumbnailBackgroundColor":"#57504E",
"ThumbnailSnap": true,
"ThumbnailSnap_Distance": 20,
"ThumbnailMinimumSize": {
"width": 50,
"height": 50
}
},
"_Profiles": {
"Default": {
"Client Settings": {
"MinimizeInactiveClients": false,
"AlwaysMaximize": false,
"TrackClientPossitions": false,
"Dont_Minimize_Clients": [
"Example Name1",
"Example Name2",
"Example Name3"
]
},
"Thumbnail Settings": {
"ShowThumbnailTextOverlay": true,
"ThumbnailTextColor":"#FAC57A",
"ThumbnailTextSize": 12,
"ThumbnailTextFont": "Gill Sans MT",
"ThumbnailTextMargins": {
"x": 15,
"y": 5
},
"ShowClientHighlightBorder": true,
"ClientHighligtColor": "#E36A0D",
"ClientHighligtBorderthickness": 4,
"HideThumbnailsOnLostFocus": false,
"ThumbnailOpacity": 80,
"ShowThumbnailsAlwaysOnTop": true,
"ShowAllColoredBorders":0
},
"Hotkeys":[
{"Example Name1":"1"},
{"Example Name2":"ctrl & 1"},
{"Example Name3":"Xbutton1 & 1"},
{"Example Name4":"^XButton1 & 1"}
],
"Thumbnail Positions": {},
"Client Possitions": {},
"Thumbnail Visibility":{},
"Hotkey Groups":{},
"Custom Colors":{
"cColorActive": "0",
"cColors": {
"CharNames": ["Example Char"],
"TextColor": ["FFFFFF"],
"Bordercolor":["FFFFFF"]
}
}
}
}
}
)"

330
Lib/LiveThumb.ahk Normal file
View File

@@ -0,0 +1,330 @@
; ----------------------------------------------------------------------------------------------------------------------
; Name .........: LiveThumb class library
; Description ..: Windows live thumbnails implementation (requires AERO to be enabled).
; AHK Version ..: AHK v2 2.0.3
; Author .......: cyruz - http://ciroprincipe.info
; v2 Convertion : Gonz0
; Forum .......: Ahk V1: https://www.autohotkey.com/boards/viewtopic.php?t=66585
; Thanks .......: maul-esel - https://github.com/maul-esel/AeroThumbnail
; License ......: WTFPL - http://www.wtfpl.net/txt/copying/
; Changelog ....: Feb. 21, 2019 - v0.1.0 - First version.
; ..............: Mar. 04, 2019 - v0.1.1 - Added active properties management and propertes getters.
; ..............: Jul. 28, 2019 - v0.1.2 - Added "Discard" method. Fixed LoadLibrary return type and a wrong behavior
; ..............: when returning false from the constructor (thanks Helgef).
; ..............: Sep. 21, 2019 - v0.1.3 - Fixed potential issue with HRESULT return code. Used internal memory
; ..............: management instead of LocalAlloc.
; ..............: Sep. 21, 2019 - v0.1.4 - Fixed Object.SetCapacity not zero-filling allocated memory.
; ..............: Nov. 15, 2022 - v0.1.5 - Fixed DWM_THUMB_PROPERTIES structure offsets (thanks swagfag).
; ..............: Jun. 26, 2023 - v0.1.5 - Conerverted to Autohotkey version 2
; Remarks ......: The class registers a thumbnail and waits for properties update. When all the desired properties have
; ..............: been updated, the "Update()" method should be called to submit the properties. Getting a property
; ..............: when an update has not been performed before, will result in the string "NOT UPDATED" to be returned.
; ..............: Due to some internal unknown reason, the instantiated object must be in the global namespace to work.
; Info .........: Implements the following functions and structures from Win32 API.
; ..............: "DwmRegisterThumbnail" Win32 function:
; ..............: https://docs.microsoft.com/en-us/windows/desktop/api/dwmapi/nf-dwmapi-dwmregisterthumbnail
; ..............: "SIZE" Win32 structure:
; ..............: https://docs.microsoft.com/en-us/previous-versions//dd145106(v=vs.85)
; ..............: "DwmQueryThumbnailSourceSize" Win32 function:
; ..............: https://docs.microsoft.com/en-us/windows/desktop/api/dwmapi/nf-dwmapi-dwmquerythumbnailsourcesize
; ..............: "DWM_THUMB_PROPERTIES" Win32 structure:
; ..............: https://docs.microsoft.com/en-us/windows/desktop/api/dwmapi/ns-dwmapi-_dwm_thumbnail_properties
; ..............: "DWM_TNP" Constants for the dwFlags field:
; ..............: https://docs.microsoft.com/en-us/windows/desktop/dwm/dwm-tnp-constants
; ..............: "DwmUpdateThumbnailProperties" Win32 function:
; ..............: https://docs.microsoft.com/en-us/windows/desktop/api/dwmapi/nf-dwmapi-dwmupdatethumbnailproperties
; ..............: "DwmUnregisterThumbnail" Win32 function:
; ..............: https://docs.microsoft.com/en-us/windows/desktop/api/dwmapi/nf-dwmapi-dwmunregisterthumbnail
; ----------------------------------------------------------------------------------------------------------------------
; * How to use:
; -------------
; Instantiate the object:
; thumb := LiveThumb(HWND Source Window, HWND Destination Window)
; Modify its properties:
; thumb.Source := [x, y, w, h] ;Size of the Source Window Thumbnail. Should be the same Size of the Source Window or it shows free space
; thumb.Destination := [x, y, w, h] ;Size of the Destination Window Thumbnail. Shrinks or streches the Thumbnail to the given size. To show the full area its should be the same size like the Destination Window
; thumb.Visible := True ;True or False Set the Thumbnail Visible
; hLT.SourceClientAreaOnly := True ;Optional: True or False Set Show Client Area Only.
; hLT.Opacity := 255 ;Optional: value between 0 and 255
; Update the properties:
; thumb.Update() ;Updates the given Propertys. This should be called everytime if some value is changed.
; Get a property:
; aProp := thumb.Visible ; Shows 1 or 0
; * Example:
; ----------
; #SingleInstance Force
; #Include <LiveThumb>
; Run("notepad", , , &PID := 0)
; WinWait("ahk_pid " PID)
; hwndNotepad := WinExist("ahk_pid " PID)
; WinGetPos( &X, &Y, &W, &H, "ahk_pid " PID)
; Mygui := Gui()
; hLT := LiveThumb(hwndNotepad, Mygui.Hwnd)
; hLT.Source := [0, 0, W, H]
; hLT.Destination := [0, 0, W, H]
; hLT.SourceClientAreaOnly := False
; hLT.Visible := True
; hLT.Opacity := 255
; hLT.Update()
; Mygui.Show("w" W "h" H)
; Name .........: LiveThumb - PUBLIC CLASS
; Description ..: Manages thumbnails creation and destruction.
Class LiveThumb
{
Static Dll_Module := 0,
OBJ_COUNTER := 0,
DTP_SIZE := 48,
DTP_DWFLAGS := { Destination: 0x0001,
Source: 0x0002,
Opacity: 0x0004,
Visible: 0x0008,
SourceClientAreaOnly: 0x0010 },
DTP_OFFSETS := { dwFlags: 0,
Destination: 4,
Source: 20,
Opacity: 36,
Visible: 37,
SourceClientAreaOnly: 41 }
; Name .........: __New - PRIVATE CONSTRUCTOR
; Description ..: Initialize the object, registering a new thumbnail and allocating the memory.
; Parameters ...: hSource = Handle to the window to be previewed.
; ..............: hDest = Handle to the window containing the live preview.
; Return .......: LiveThumb object on success - False on error.
__New( hSource, hDest )
{
; Load the library on first run.
If ( !LiveThumb.DLL_MODULE )
LiveThumb.DLL_MODULE := DllCall("LoadLibrary", "Str","dwmapi.dll", "Ptr")
LiveThumb.OBJ_COUNTER += 1
; Register a thumbnail to get an ID.
If ( DllCall( "dwmapi.dll\DwmRegisterThumbnail"
, "Ptr", hDest
, "Ptr", hSource
, "Ptr*", &phThumb := 0
, "UPtr" ) )
Return False
this.THUMB_ID := phThumb
this.THUMB_UPDATED := False
this.THUMB_PENDING_UPDATE := True
; We define 2 portions of memory used for properties update and active properties tracking.
this.THUMB_UPD_PROP_PTR := Buffer(LiveThumb.DTP_SIZE,0)
this.THUMB_ACT_PROP_PTR := Buffer(LiveThumb.DTP_SIZE,0)
; Object.SetCapacity doesn't zero-fill the allocated memory so we call the Discard method.
this.Discard( )
Return this
}
; Name .........: __Delete - PRIVATE DESTRUCTOR
; Description ..: Unregister the thumbnail and deallocate memory.
__Delete( )
{
; Unregister thumbnail ID.
If ( this.THUMB_ID )
DllCall( "dwmapi.dll\DwmUnregisterThumbnail"
, "Ptr", this.THUMB_ID )
; If it's last instantiated object, free the library.
If ( LiveThumb.DLL_MODULE && !(LiveThumb.OBJ_COUNTER -= 1) )
{
DllCall("FreeLibrary", "Ptr",LiveThumb.DLL_MODULE)
LiveThumb.DLL_MODULE := 0
}
}
__Get(aName, Params) {
If ( LiveThumb.HasOwnProp(aName))
return LiveThumb.%aName%
}
; Name .........: QuerySourceSize - PUBLIC METHOD
; Description ..: Return the size (width/height) of the source thumbnail.
; Return .......: Array with width and height values - False on error.
QuerySourceSize( )
{
SIZE := Buffer(8,0)
If ( DllCall( "dwmapi.dll\DwmQueryThumbnailSourceSize"
, "Ptr", this.THUMB_ID
, "Ptr", SIZE
, "UPtr" ) ) {
SIZE := Buffer(0)
Return False
}
SourceSize := [NumGet(SIZE, 0, "Int"), NumGet(SIZE, 4, "Int")]
SIZE := Buffer(0)
Return SourceSize
}
; Name .........: Update - PUBLIC METHOD
; Description ..: Update thumbnail properties and zero fill the dwFlags memory to be ready for next update.
; Return .......: True on success - False on error.
Update( )
{
; If no update is pending, return false.
; If ( !this.THUMB_PENDING_UPDATE )
; Return False
; Update properties.
If ( DllCall( "dwmapi.dll\DwmUpdateThumbnailProperties"
, "Ptr", this.THUMB_ID
, "Ptr", this.THUMB_UPD_PROP_PTR
, "UPtr" ) )
Return False
; Flag as updated and copy memory so that we can use this portion to track active properties with getters.
this.THUMB_UPDATED := True
DllCall( "NtDll.dll\RtlCopyMemory"
, "Ptr", this.THUMB_ACT_PROP_PTR
, "Ptr", this.THUMB_UPD_PROP_PTR
, "UInt", LiveThumb.DTP_SIZE )
; Use the "Discard" method to reset dwFlags and return.
this.Discard( )
Return True
}
; Name .........: Discard - PUBLIC METHOD
; Description ..: Discard set properties, resetting dwFlags memory.
Discard( )
{
; Zero-fill dwFlags memory in the properties update memory portion.
NumPut("UInt", 0, this.THUMB_UPD_PROP_PTR, LiveThumb.DTP_OFFSETS.dwFlags)
this.THUMB_PENDING_UPDATE := False
}
; Name .........: Destination - PUBLIC PROPERTY
; Description ..: The area in the destination window where the thumbnail will be rendered.
; Value ........: Array with 4 client related coordinates [ left, top, right, bottom ].
; Remarks ......: "Destination" property is of "RECT" type (16 bytes structure) and starts from offset 4.
Destination {
Get {
If (!this.THUMB_UPDATED)
Return "NOT UPDATED"
arrRet := []
Loop 4
arrRet.Push(NumGet(this.THUMB_ACT_PROP_PTR, LiveThumb.DTP_OFFSETS.Destination * A_Index, "Int"))
Return arrRet
}
Set {
This.SetDwFlags("Destination")
Loop 4
NumPut("Int", value[A_Index], this.THUMB_UPD_PROP_PTR, LiveThumb.DTP_OFFSETS.Destination * A_Index)
}
}
; Name .........: Source - PUBLIC PROPERTY
; Description ..: The region of the source window to use as the thumbnail. Default is the entire window.
; Value ........: Array with 4 client related coordinates [ left, top, right, bottom ].
; Remarks ......: "Source" property is of "RECT" type (16 bytes structure) and starts from offset 20.
Source {
Get {
If (!this.THUMB_UPDATED)
Return "NOT UPDATED"
arrRet := []
Loop 4
arrRet.Push(NumGet(this.THUMB_ACT_PROP_PTR, LiveThumb.DTP_OFFSETS.Source + 4*(A_Index-1), "Int"))
Return arrRet
}
Set {
This.SetDwFlags("Source")
Loop 4
NumPut("Int", value[A_Index], this.THUMB_UPD_PROP_PTR, LiveThumb.DTP_OFFSETS.Source + 4*(A_Index-1))
}
}
; Name .........: Opacity - PUBLIC PROPERTY
; Description ..: The opacity with which to render the thumbnail. 0: transparent - 255: opaque. Default is 255.
; Value ........: Integer value from 0 to 255.
; Remarks ......: "Opacity" property is of "BYTE" type (1 byte + 3 padding) and starts from offset 36.
Opacity {
Get {
If (!this.THUMB_UPDATED)
Return "NOT UPDATED"
Return NumGet(this.THUMB_ACT_PROP_PTR, LiveThumb.DTP_OFFSETS.Opacity, "UChar")
}
Set {
This.SetDwFlags("Opacity")
NumPut("UChar", value, this.THUMB_UPD_PROP_PTR, LiveThumb.DTP_OFFSETS.Opacity)
}
}
; Name .........: Visible - PUBLIC PROPERTY
; Description ..: True to make the thumbnail visible, otherwise False. Default is False.
; Value ........: Boolean True/False or integer 1/0 value.
; Remarks ......: "Visible" property is of "BOOL" type (4 bytes) and starts from offset 40.
Visible {
Get {
If (!this.THUMB_UPDATED)
Return "NOT UPDATED"
Return NumGet(this.THUMB_ACT_PROP_PTR, LiveThumb.DTP_OFFSETS.Visible, "Int")
}
Set {
This.SetDwFlags("Visible")
NumPut("Int", value, this.THUMB_UPD_PROP_PTR, LiveThumb.DTP_OFFSETS.Visible)
}
}
; Name .........: SourceClientAreaOnly - PUBLIC PROPERTY
; Description ..: True to use only the thumbnail source's client area, otherwise False. Default is False.
; Value ........: Boolean True/False or integer 1/0 value.
; Remarks ......: "SourceClientAreaOnly" property is of "BOOL" type (4 bytes) and starts from offset 44.
SourceClientAreaOnly {
Get {
If (!this.THUMB_UPDATED)
Return "NOT UPDATED"
Return NumGet(this.THUMB_ACT_PROP_PTR, LiveThumb.DTP_OFFSETS.SourceClientAreaOnly, "Int")
}
Set {
This.SetDwFlags("SourceClientAreaOnly")
NumPut("Uint", value, this.THUMB_UPD_PROP_PTR, LiveThumb.DTP_OFFSETS.SourceClientAreaOnly)
}
}
;Writes the DWFlags from the given Property into Memory.
SetDwFlags(aName)
{
If (LiveThumb.DTP_DWFLAGS.HasOwnProp(aName)) {
NumPut( "UInt", NumGet( this.THUMB_UPD_PROP_PTR,
LiveThumb.DTP_OFFSETS.dwFlags, "UInt" ) | LiveThumb.DTP_DWFLAGS.%aName%,
this.THUMB_UPD_PROP_PTR,
LiveThumb.DTP_OFFSETS.dwFlags)
this.THUMB_PENDING_UPDATE := true
}
}
}

158
Lib/json.ahk Normal file
View File

@@ -0,0 +1,158 @@
/************************************************************************
* @Mdodified by G0nzo
* @description: JSON格式字符串序列化和反序列化, [HotKeyIt/Yaml](https://github.com/HotKeyIt/Yaml)
* true/false/null类型的支持,
* @author thqby, HotKeyIt
* @date 2023/05/12
* @version 1.0.5
***********************************************************************/
class JSON {
static null := ComValue(1, 0), true := ComValue(0xB, 1), false := ComValue(0xB, 0)
/**
* Converts a AutoHotkey Object Notation JSON string into an object.
* @param text A valid JSON string.
* @param keepbooltype convert true/false/null to JSON.true / JSON.false / JSON.null where it's true, otherwise 1 / 0 / ''
* @param as_map object literals are converted to map, otherwise to object
*/
static Load(text, keepbooltype := false, as_map := true) {
keepbooltype ? (_true := JSON.true, _false := JSON.false, _null := JSON.null) : (_true := true, _false := false, _null := "")
as_map ? (map_set := (maptype := Map).Prototype.Set) : (map_set := (obj, key, val) => obj.%key% := val, maptype := Object)
NQ := "", LF := "", LP := 0, P := "", R := ""
D := [C := (A := InStr(text := LTrim(text, " `t`r`n"), "[") = 1) ? [] : maptype()], text := LTrim(SubStr(text, 2), " `t`r`n"), L := 1, N := 0, V := K := "", J := C, !(Q := InStr(text, '"') != 1) ? text := LTrim(text, '"') : ""
Loop Parse text, '"' {
Q := NQ ? 1 : !Q
NQ := Q && (SubStr(A_LoopField, -3) = "\\\" || (SubStr(A_LoopField, -1) = "\" && SubStr(A_LoopField, -2) != "\\"))
if !Q {
if (t := Trim(A_LoopField, " `t`r`n")) = "," || (t = ":" && V := 1)
continue
else if t && (InStr("{[]},:", SubStr(t, 1, 1)) || RegExMatch(t, "^-?\d*(\.\d*)?\s*[,\]\}]")) {
Loop Parse t {
if N && N--
continue
if InStr("`n`r `t", A_LoopField)
continue
else if InStr("{[", A_LoopField) {
if !A && !V
throw Error("Malformed JSON - missing key.", 0, t)
C := A_LoopField = "[" ? [] : maptype(), A ? D[L].Push(C) : map_set(D[L], K, C), D.Has(++L) ? D[L] := C : D.Push(C), V := "", A := Type(C) = "Array"
continue
} else if InStr("]}", A_LoopField) {
if !A && V
throw Error("Malformed JSON - missing value.", 0, t)
else if L = 0
throw Error("Malformed JSON - to many closing brackets.", 0, t)
else C := --L = 0 ? "" : D[L], A := Type(C) = "Array"
} else if !(InStr(" `t`r,", A_LoopField) || (A_LoopField = ":" && V := 1)) {
if RegExMatch(SubStr(t, A_Index), "m)^(null|false|true|-?\d+\.?\d*)\s*[,}\]\r\n]", &R) && (N := R.Len(0) - 2, R := R.1, 1) {
if A
C.Push(R = "null" ? _null : R = "true" ? _true : R = "false" ? _false : IsNumber(R) ? R + 0 : R)
else if V
map_set(C, K, R = "null" ? _null : R = "true" ? _true : R = "false" ? _false : IsNumber(R) ? R + 0 : R), K := V := ""
else throw Error("Malformed JSON - missing key.", 0, t)
} else {
; Added support for comments without '"'
if A_LoopField == '/' {
nt := SubStr(t, A_Index + 1, 1), N := 0
if nt == '/' {
if nt := InStr(t, '`n', , A_Index + 2)
N := nt - A_Index - 1
} else if nt == '*' {
if nt := InStr(t, '*/', , A_Index + 2)
N := nt + 1 - A_Index
} else nt := 0
if N
continue
}
throw Error("Malformed JSON - unrecognized character-", 0, A_LoopField " in " t)
}
}
}
} else if InStr(t, ':') > 1
throw Error("Malformed JSON - unrecognized character-", 0, SubStr(t, 1, 1) " in " t)
} else if NQ && (P .= A_LoopField '"', 1)
continue
else if A
LF := P A_LoopField, C.Push(InStr(LF, "\") ? UC(LF) : LF), P := ""
else if V
LF := P A_LoopField, map_set(C, K, InStr(LF, "\") ? UC(LF) : LF), K := V := P := ""
else
LF := P A_LoopField, K := InStr(LF, "\") ? UC(LF) : LF, P := ""
}
return J
UC(S, e := 1) {
static m := Map(Ord('"'), '"', Ord("a"), "`a", Ord("b"), "`b", Ord("t"), "`t", Ord("n"), "`n", Ord("v"), "`v", Ord("f"), "`f", Ord("r"), "`r")
local v := ""
Loop Parse S, "\"
if !((e := !e) && A_LoopField = "" ? v .= "\" : !e ? (v .= A_LoopField, 1) : 0)
v .= (t := InStr("ux", SubStr(A_LoopField, 1, 1)) ? SubStr(A_LoopField, 1, RegExMatch(A_LoopField, "i)^[ux]?([\dA-F]{4})?([\dA-F]{2})?\K") - 1) : "") && RegexMatch(t, "i)^[ux][\da-f]+$") ? Chr(Abs("0x" SubStr(t, 2))) SubStr(A_LoopField, RegExMatch(A_LoopField, "i)^[ux]?([\dA-F]{4})?([\dA-F]{2})?\K")) : m.has(Ord(A_LoopField)) ? m[Ord(A_LoopField)] SubStr(A_LoopField, 2) : "\" A_LoopField, e := A_LoopField = "" ? e : !e
return v
}
}
/**
* Converts a AutoHotkey Array/Map/Object to a Object Notation JSON string.
* @param obj A AutoHotkey value, usually an object or array or map, to be converted.
* @param expandlevel The level of JSON string need to expand, by default expand all.
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
*/
static Dump(obj, expandlevel := unset, space := " ") {
expandlevel := IsSet(expandlevel) ? Abs(expandlevel) : 10000000
return Trim(CO(obj, expandlevel))
CO(O, J := 0, R := 0, Q := 0) {
static M1 := "{", M2 := "}", S1 := "[", S2 := "]", N := "`n", C := ",", S := "- ", E := "", K := ":"
if (OT := Type(O)) = "Array" {
D := !R ? S1 : ""
for key, value in O {
F := (VT := Type(value)) = "Array" ? "S" : InStr("Map,Object", VT) ? "M" : E
Z := VT = "Array" && value.Length = 0 ? "[]" : ((VT = "Map" && value.count = 0) || (VT = "Object" && ObjOwnPropCount(value) = 0)) ? "{}" : ""
D .= (J > R ? "`n" CL(R + 2) : "") (F ? (%F%1 (Z ? "" : CO(value, J, R + 1, F)) %F%2) : ES(value)) (OT = "Array" && O.Length = A_Index ? E : C)
}
} else {
D := !R ? M1 : ""
for key, value in (OT := Type(O)) = "Map" ? (Y := 1, O) : (Y := 0, O.OwnProps()) {
F := (VT := Type(value)) = "Array" ? "S" : InStr("Map,Object", VT) ? "M" : E
Z := VT = "Array" && value.Length = 0 ? "[]" : ((VT = "Map" && value.count = 0) || (VT = "Object" && ObjOwnPropCount(value) = 0)) ? "{}" : ""
D .= (J > R ? "`n" CL(R + 2) : "") (Q = "S" && A_Index = 1 ? M1 : E) ES(key) K (F ? (%F%1 (Z ? "" : CO(value, J, R + 1, F)) %F%2) : ES(value)) (Q = "S" && A_Index = (Y ? O.count : ObjOwnPropCount(O)) ? M2 : E) (J != 0 || R ? (A_Index = (Y ? O.count : ObjOwnPropCount(O)) ? E : C) : E)
if J = 0 && !R
D .= (A_Index < (Y ? O.count : ObjOwnPropCount(O)) ? C : E)
}
}
if J > R
D .= "`n" CL(R + 1)
if R = 0
D := RegExReplace(D, "^\R+") (OT = "Array" ? S2 : M2)
return D
}
ES(S) {
switch Type(S) {
case "Float":
if (v := '', d := InStr(S, 'e'))
v := SubStr(S, d), S := SubStr(S, 1, d - 1)
if ((StrLen(S) > 17) && (d := RegExMatch(S, "(99999+|00000+)\d{0,3}$")))
S := Round(S, Max(1, d - InStr(S, ".") - 1))
return S v
case "Integer":
return S
case "String":
S := StrReplace(S, "\", "\\")
S := StrReplace(S, "`t", "\t")
S := StrReplace(S, "`r", "\r")
S := StrReplace(S, "`n", "\n")
S := StrReplace(S, "`b", "\b")
S := StrReplace(S, "`f", "\f")
S := StrReplace(S, "`v", "\v")
S := StrReplace(S, '"', '\"')
return '"' S '"'
default:
return S == JSON.true ? "true" : S == JSON.false ? "false" : "null"
}
}
CL(i) {
Loop (s := "", space ? i - 1 : 0)
s .= space
return s
}
}
}

153
Main.ahk Normal file
View File

@@ -0,0 +1,153 @@
#Requires AutoHotkey v2.0
#Include <DefaultJSON> ; The Default Settings Values
#Include <JSON>
#Include <LiveThumb>
#Include <../src/Main_Class>
#Include <../src/ThumbWindow>
#Include <../src/TrayMenu>
#Include <../src/Propertys>
#Include <../src/Settings_Gui>
#SingleInstance Force
Persistent
ListLines False
KeyHistory 0
CoordMode "Mouse", "Screen" ; to track Window Mouse possition while DragMoving the thumbnails
SetWinDelay -1
FileEncoding("UTF-8") ; Encoding for JSSON file
SetTitleMatchMode 3
A_MaxHotKeysPerInterval := 10000
/*
TODO #########################
*/
;@Ahk2Exe-Let U_version = 1.0.0.
;@Ahk2Exe-SetVersion %U_version%
;@Ahk2Exe-SetFileVersion %U_version%
;@Ahk2Exe-SetCopyright gonzo83
;@Ahk2Exe-SetDescription EVE-X-Preview
;@Ahk2Exe-SetProductName EVE-X-Preview
;@Ahk2Exe-ExeName EVE-X-Preview
;@Ahk2Exe-AddResource icon.ico, 160 ; Replaces 'H on blue'
;@Ahk2Exe-AddResource icon-suspend.ico, 206 ; Replaces 'S on green'
;@Ahk2Exe-AddResource icon.ico, 207 ; Replaces 'H on red'
;@Ahk2Exe-AddResource icon-suspend.ico, 208 ; Replaces 'S on red'
;@Ahk2Exe-SetMainIcon icon.ico
if !(A_IsCompiled)
TraySetIcon("icon.ico",,true)
OnError(Error_Handler)
Call := Main_Class()
Load_JSON() {
DJSON := JSON.Load(default_JSON)
if !(FileExist("EVE-X-Preview.json")) {
FileAppend(JSON.Dump(DJSON,," " ), "EVE-X-Preview.json")
_JSON := JSON.Load(FileRead("EVE-X-Preview.json"))
return _JSON
}
else {
Try {
if (FileExist("EVE-X-Preview.json")) {
;if needed because of Backward combativity from the alpha versions
MergeJson()
}
_JSON := JsonMergeNoOverwrite(
DJSON,
JSON.Load(FileRead("EVE-X-Preview.json"))
)
FileDelete("EVE-X-Preview.json")
FileAppend(JSON.Dump(_JSON,," " ), "EVE-X-Preview.json")
}
catch as e {
value := MsgBox("The settings file is corrupted. Do you want to create a new one?",,"OKCancel")
if (value = "Cancel")
ExitApp()
FileDelete("EVE-X-Preview.json")
FileAppend(JSON.Dump(DJSON,, " "), "EVE-X-Preview.json")
_JSON := JSON.Load(FileRead("EVE-X-Preview.json"))
}
}
return _JSON
}
;Compare the User json wit the default Json to check if any key changed for possible future updates.
JsonMergeNoOverwrite(obj1, obj2) {
for key, value in obj1 {
if (obj2.Has(key)) {
if (IsObject(value) && IsObject(obj2[key]))
obj2[key] := JsonMergeNoOverwrite(value, obj2[key])
} else {
obj2[key] := value
}
}
return obj2
}
;THis function is only used to merge the Json from old versions into the new one
MergeJson(Settingsfile := "EVE-X-Preview.json", dJson := JSON.Load(default_JSON)) {
;Load the content from the existing Json File
fileObj := FileOpen(Settingsfile,"r", "Utf-8")
JsonRaw := fileObj.Read(), fileObj.Close()
OldJson := JSON.Load(JsonRaw)
savetofile := 0
for Profiles, settings in OldJson["_Profiles"] {
if (Profiles = "Default") {
continue
}
dJson["_Profiles"][Profiles] := Map()
for k, v in settings {
if (OldJson["_Profiles"][Profiles].Has("ClientPossitions")) {
savetofile := 1
if (k = "ClientPossitions")
dJson["_Profiles"][Profiles]["Client Possitions"] := v
else if (k = "ClientSettings")
dJson["_Profiles"][Profiles]["Client Settings"] := v
else if (k = "ThumbnailSettings")
dJson["_Profiles"][Profiles]["Thumbnail Settings"] := v
else if (k = "ThumbnailPositions")
dJson["_Profiles"][Profiles]["Thumbnail Positions"] := v
else if (k = "Thumbnail_visibility")
dJson["_Profiles"][Profiles]["Thumbnail Visibility"] := v
else if (k = "Custom_Colors")
dJson["_Profiles"][Profiles]["Custom Colors"] := dJson["_Profiles"]["Default"]["Custom Colors"]
else if (k = "Hotkey_Groups")
dJson["_Profiles"][Profiles]["Hotkey Groups"] := v
else if (k = "Hotkeys") {
if (Type(v) = "Map") {
Arr := []
for char, hotkey in v
Arr.Push(Map(char, hotkey))
dJson["_Profiles"][Profiles]["Hotkeys"] := Arr
}
}
}
}
}
if savetofile {
dJson["global_Settings"] := OldJson["global_Settings"]
fileObj := FileOpen(Settingsfile,"w", "Utf-8")
fileObj.Write(JSON.Dump(dJson,, " ")), fileObj.Close()
}
}
; Hanles unmanaged Errors
Error_Handler(Thrown, Mode) {
return -1
}

154
README.MD Normal file
View File

@@ -0,0 +1,154 @@
## EVE-X-Preview
EVE-X-Preview is a tool for Windows that makes it easy to manage and use multiple EVE clients.
It allows displaying thumbnails of the running EVE clients and bringing EVE clients to the foreground with a click on the thumbnail or with a set hotkey. Mouse and keyboard buttons are supported.
It is possible to create multiple profiles to quickly change the hotkey assignments, thumbnail position, and color adjustments
**In summary, this tool offers the following features:**
* Display thumbnails of active EVE clients.
* Bring an EVE client to the foreground with a hotkey, including full keyboard and mouse support.
* Create multiple profiles.
* Customize text color, size, borders, font, and position.
* Display thumbnails of varying sizes.
* Create hotkey groups.
* Save EVE client positions and restore them.
* Graphical user interface to configure all settings
**The following is not supported**
* The simultaneous sending of keyboard or mouse inputs to multiple EVE clients, also known as input broadcasting.
* Sending individual keyboard or mouse inputs.
* Displaying excerpts from the client as thumbnails.
* Manipulating EVE clients.
#### EVE-X-Preview does not interact directly with the game clients in any way. It only allows changing the foreground window with the help of hotkeys and thumbnails. <br> No features will be added now or in the future that violate the EULA and Terms of Service of EVE Online.
## How To Use
1. Download the EXE file from here https://github.com/g0nzo83/EVE-X-Preview/releases
2. Create a new Folder on Dektop or in Documents or where you like with the exception of the Programs folders. And move EVE-X-Preview.exe to the created folder.
3. Start EVE-X-Preview.exe. It should create a json file. This file must always be in the same folder as EVE-X-Preview.exe. It contains all your settings
4. A tray icon should then appear at the bottom right of the taskbar. Right-click on it to access the settings.
5. Right Click on the Tryicon and klick "Open" or double klick it and klick on "Profile Settings" create a new Profile.
6. From here on you can adjust as you like
`Important Note:` <br> `some settings require a restart of the tool. The settings window must be closed so that the settings made there are applied`
## Run from Source
1. Download and install [Autohotkey v2](https://www.autohotkey.com/)
2. Download the Zip file from https://github.com/g0nzo83/EVE-X-Preview/releases
3. Unpack the Zip file and Run the file `Main.ahk`
## Will I get banned if I use it?
As I understand the EVE Online EULA and Terms of Service, this tool does not break any rules. <br>
Since EVE-X-Preview uses the same methods as [EVE-O Preview](https://github.com/EveOPlus/eve-o-preview), another tool which offers similar functions and is permitted, I assume that this also applies to EVE-X-Preview. <br>
Nevertheless I want to point out that the use of EVE-X-Preview or any other Thrid-Party tool is at your own risk. <br>
**I assume no liability whatsoever**
## Application Options
### **Tray Menu - Settings**
| Option | Description |
| --- | --- |
| Open | Opens the settings window |
| Suspend Hotkeys | Deactivates the hotkeys |
| Close all EVE clients | Closes all open EVE windows |
| Restore Client Positions | Toggles On/ Off <br> Restores the previously saved client positions automatically if activated |
| Save Client Positions | Saves the current position of all EVE clients so that they can be restored with Restore Client Positions <br> Positions are not saved automatically. If the position has been changed, it must be saved again |
| Save Thumbnail Positions | Saves the current position of the thumbnails. Thumbnail positions are not saved automatically. If the position has been changed, it must be saved again |
| Reload | If problems occur with the tool, it can simply be restarted with this option |
| Exit | Exits the program |
### **Global Settings**
| Option | Description |
| --- | --- |
| Suspend Hotkeys - Hotkey |Allows you to set a hotkey to su all active hotkeys. The tray icon changes when the pause is activated and a short message is displayed next to the cursor |
| Hotkey activation Scope | **Global: ->** Allows you to activate an EVE client with a hotkey regardless of which window you are in. <br><br> **If an EVE window is Active: ->** Activates the hotkeys only when any EVE Window is in the foreground|
| Thumbnail Background Color | Setting the background color of the thumbnail. This is only visible if the content of the thumbnail is not visible, such as when the EVE window is minimized and the thumbnail was created afterwards <br> **HEX: ->** 0xFFFFFF or #FFFFFF or FFFFFF <br> **RGB: ->** RGB(225,255,255) or (225,255,255) or 225,255,255|
| Thumbnail Default Location | Setting the dafault thumbnail position such as the thumbnail of the character selection screen |
| Thumbnail Minimum Size | Allows you to set a minimum size of the thumbnail to prevent it from becoming too small to edit |
| Thumbnail Snap | Allows you to switch the automatic alignment of the thumbnails to each other to On or Off |
| Thumbnail Snap Distance | Defines the range up to which the thumbnails automatically align with each other. <br> This only has an effect when Thumbnail Snap is activated |
| Minimize EVE Window Delay | Sets the delay before an inactive client is minimized after another one has been activated. This option is only used if "Minimize Inactive Client" has been activated |
### **Profile Settings - Client Settings**
| Option | Description |
| --- | --- |
| Minimize Inactive Clients | If this option is activated, all inactive clients are minimized if they are not entered in the "Dont Minimize Clients" list |
| Always Maximize Clients | Thumbnails width. Can be set to any value from **100** to **640** points |
| Thumbnail Height | This is an important option. This means that the client is always maximized. This largely prevents the overview of the EVE client from shifting when the PC is on heavily load |
| Dont Minimize CLients| All EVE character names entered here are exempt from minimization. This is useful if you always need a current preview image of the client. Since a preview image of a minimized client can only be shown frozen |
### **Profile Settings - Custom Colors**
| Allows you to set custom colors for the font and borders|
| --- |
| The supported syntax is: <br>HEX: -> 0xFFFFFF or #FFFFFF or FFFFFF <br> RGB: -> RGB(225,255,255) or (225,255,255) or 225,255,255|
### **Profile Settings - Hotkey Groups**
| Option | Description |
| --- | --- |
| Select Group | Enables the creation and deletion of hotkey groups. Each group must have a unique name |
| Hotkey Groups Text field| The character names that belong to the group are entered here. The names must be entered one below the other. The activation sequence is from top to bottom |
| Forwards Hotkey <br> Backwards Hotkey | *Explanation of the hotkeys, see below* |
### **Profile Settings - Hotkeys**
|**The character names must be entered one below the other and the corresponding hotkey on the opposite side <br> The same hotkey may only be assigned to one character!** <br> *Explanation of the hotkeys, see below*|
|---|
### **Hotkeys - Explanation**
There are several ways to specify hotkeys <br> For a detailed description you can have a look at the following pages <br> [Hotkey Modifier Symbols](https://www.autohotkey.com/docs/v2/Hotkeys.htm#Symbols) and [List Of Keys](https://www.autohotkey.com/docs/v2/KeyList.htm)
| Hotkey | Description |
| ---| --- |
| 1 <br> 2 <br> Tab <br> ~ <br> Lbutton <br> Rbutton <br> Xbutton1 <br> Xbutton2 <br>Ctrl <br> Shift | These are simple hotkeys. They are defined by the letter itself or the name of the key. virtual key codes are also supported <br><br> It is not recommended to use the left or right mouse button as a simple hotkey. This would prevent you from being able to use the buttons. <br> These hotkeys can only be triggered when they are pressed alone. If another button is pressed that is not part of the hotkey, the hotkey is not triggered |
| ........Modifierkeys:.......... <br> ^1 = Ctrl & 1 <br> +1 = Shift & 1 <br> #1 = Win & 1<br> !1 = Alt & 1 | Both Hotkey combos are valid here. <br> the difference is that a hotkey defined with a prefix allows any number of prefixes, for example: <br> `+^1` means Shift+Control+1 <br> while the assignment of 2 buttons as a hotkey is limited to 2 for example: <br> `Shift & Ctrl & 1` is not permitted <br> while these symbols are translated into Modifierkeys like `Ctrl`and `Shift` if used as a prefix but they do not mean it if they stand alone like: `+` alone means means the actual plus key |
| Special Prefix: <br> *1 | The `*` prefix allows the hotkey to be triggered even if it is pressed together with another button <br> This is a very useful prefix as you are not forced to press the additional key again like: <br> `*1`
### **Profile Settings - Thumbnail Settings**
| Option | Description |
| --- | --- |
| Show Thumbnail Text Overlay | Shows or removes the character name on the thumbnail |
| Thumbnail Text Colour | Sets the color of the text of the character name on the thumbnail <br> The supported syntax is: <br> HEX: -> 0xFFFFFF or #FFFFFF or FFFFFF <br> RGB: -> RGB(225,255,255) or (225,255,255) or 225,255,255 |
|Thumbnail Text Size | Changes the size of the text of the character name. |
| Thumbnail Text Font | Changes the font of the text on the Thubnail. The font must be available in the Windows system. |
| Thumbnail Text Margins | Changes the distance of the thumbnail text to the edges of the thumbnail |
| Client Highlight Color | Changes the color of the color frame displayed on the thumbnail of the active client. <br> The supported syntax is: <br> HEX: -> 0xFFFFFF or #FFFFFF or FFFFFF <br> RGB: -> RGB(225,255,255) or (225,255,255) or 225,255,255|
|Client Highlight Border thickness | Changes the thickness of color frame displayed on the thumbnail of the active client |
| Show Client Highlight Border | Activates or deactivates the display of the color frame displayed on the thumbnail of the active client |
| Hide Thumbnails on Lost Focus | If activated, the thumbnails are not displayed if no EVE client is in the foreground and active. |
| Thumbnail Opacity | Sets the transparency of the thumbnail. The values are in percent from 0-100 |
| Show Thumbnails AlwaysOnTop | If activated, the thumbnails are always displayed above all windows. |
### **Profile Settings - Thumbnail Visibility**
|The thumbnails of the selected characters are not displayed |
|---|
### Mouse Gestures and Actions
Mouse gestures are applied to the thumbnail window currently being hovered over.
| Action | Gesture |
| --- | --- |
| Activate the EVE Online client and bring it to front | Left click the thumbnail |
| Minimize the EVE Online client | Hold Control key and click the thumbnail |
| Move thumbnail to a new position | Press right mouse button and move the mouse |
| Move all thumbnails | Hold Control and right Mousebutton and move the mouse |
| Adjust all thumbnails height and width | Press both left and right mouse buttons and move the mouse up or down |
|Adjust a single thumbnails height and width | Hold Control and the right+left mouse button and move the mouse|
## About
EVE-X-Preview is Created and Maintained by [g0nzo83](https://github.com/g0nzo83) also known as "*John Xer*" in EVE Online

730
src/Main_Class.ahk Normal file
View File

@@ -0,0 +1,730 @@

Class Main_Class extends ThumbWindow {
Static WM_DESTROY := 0x02,
WM_SIZE := 0x05,
WM_NCCALCSIZE := 0x83,
WM_NCHITTEST := 0x84,
WM_NCLBUTTONDOWN := 0xA1,
WM_SYSKEYDOWN := 0x104,
WM_SYSKEYUP := 0x105,
WM_MOUSEMOVE := 0x200,
WM_LBUTTONDOWN := 0x201,
WM_LBUTTONUP := 0x0202,
WM_RBUTTONDOWN := 0x0204,
WM_RBUTTONUP := 0x0205,
WM_KEYDOWN := 0x0100,
WM_MOVE := 0x03,
WM_MOUSELEAVE := 0x02A2
;! This key is for the internal Hotkey to bring the Window in forgeround
;! it is possible this key needs to be changed if Windows updates and changes the unused virtual keys
static virtualKey := "vk0xE8"
LISTENERS := [
Main_Class.WM_LBUTTONDOWN,
Main_Class.WM_RBUTTONDOWN
;Main_Class.WM_SIZE,
;Main_Class.WM_MOVE
]
EVEExe := "Ahk_Exe exefile.exe"
; Values for WM_NCHITTEST
; Size from the invisible edge for resizing
border_size := 4
HT_VALUES := [[13, 12, 14], [10, 1, 11], [16, 15, 17]]
;### Predifining Arrays and Maps #########
EventHooks := Map()
ThumbWindows := {}
ThumbHwnd_EvEHwnd := Map()
__New() {
This._JSON := Load_JSON()
This.default_JSON := JSON.Load(default_JSON)
This.TrayMenu()
This.MinimizeDelay := This.Minimizeclients_Delay
;Hotkey to trigger by the script to get permissions t bring a Window in foreground
;Register all posible modifire combinations
prefixArr := ["","^","!", "#", "+", "+^", "+#", "+!", "^#", "^!","#!", "^+!", "^+#", "^#!", "+!#","^+#!"]
for index, prefix in prefixArr
Hotkey( prefix . Main_Class.virtualKey, ObjBindMethod(This, "ActivateForgroundWindow"), "P1")
; Register Hotkey for Puase Hotkeys if the user has is Set
if (This.Suspend_Hotkeys_Hotkey != "") {
HotIf (*) => WinExist(This.EVEExe)
try {
Hotkey This.Suspend_Hotkeys_Hotkey, ( * ) => This.Suspend_Hotkeys(), "S1"
}
catch ValueError as e {
MsgBox(e.Message ": --> " e.Extra " <-- in: Global Settings -> Suspend Hotkeys-Hotkey" )
}
}
; The Timer property for Asycn Minimizing.
this.timer := ObjBindMethod(this, "EVEMinimize")
;margins for DwmExtendFrameIntoClientArea. higher values extends the shadow
This.margins := Buffer(16, 0)
NumPut("Int", 0, This.margins)
;Register all messages wich are inside LISTENERS
for i, message in this.LISTENERS
OnMessage(message, ObjBindMethod(This, "_OnMessage"))
;Property for the delay to hide Thumbnails if not client is in foreground and user has set Hide on lost Focus
This.CheckforActiveWindow := ObjBindMethod(This, "HideOnLostFocusTimer")
;The Main Timer who checks for new EVE Windows or closes Windows
SetTimer(ObjBindMethod(This, "HandleMainTimer"), 50)
This.Save_Settings_Delay_Timer := ObjBindMethod(This, "SaveJsonToFile")
;Timer property to remove Thumbnails for closed EVE windows
This.DestroyThumbnails := ObjBindMethod(This, "EvEWindowDestroy")
This.DestroyThumbnailsToggle := 1
;Register the Hotkeys for cycle groups
This.Register_Hotkey_Groups()
This.BorderActive := 0
return This
}
HandleMainTimer() {
static HideShowToggle := 0, WinList := {}
try
WinList := WinGetList(This.EVEExe)
Catch
return
; If any EVE Window exist
if (WinList.Length) {
try {
;Check if a window exist without Thumbnail and if the user is in Character selection screen or not
for index, hwnd in WinList {
WinList.%hwnd% := { Title: This.CleanTitle(WinGetTitle(hwnd)) }
if !This.ThumbWindows.HasProp(hwnd) {
This.EVE_WIN_Created(hwnd, WinList.%hwnd%.title)
if (!This.HideThumbnailsOnLostFocus)
This.ShowThumb(hwnd, "Show")
HideShowToggle := 1
}
;if in Character selection screen
else if (This.ThumbWindows.HasProp(hwnd)) {
if (This.ThumbWindows.%hwnd%["Window"].Title != WinList.%hwnd%.Title) {
This.EVENameChange(hwnd, WinList.%hwnd%.Title)
}
}
}
}
catch
return
try {
;if HideThumbnailsOnLostFocus is selectet check if a eve window is still in foreground, runs a timer once with a delay to prevent stuck thumbnails
ActiveProcessName := WinGetProcessName("A")
if ((DllCall("IsIconic","UInt", WinActive("ahk_exe exefile.exe")) || ActiveProcessName != "exefile.exe") && !HideShowToggle && This.HideThumbnailsOnLostFocus) {
SetTimer(This.CheckforActiveWindow, -500)
HideShowToggle := 1
}
else if ( ActiveProcessName = "exefile.exe" && !DllCall("IsIconic","UInt", WinActive("ahk_exe exefile.exe"))) {
Ahwnd := WinExist("A")
if HideShowToggle {
for EVEHWND in This.ThumbWindows.OwnProps() {
This.ShowThumb(EVEHWND, "Show")
}
HideShowToggle := 0
This.BorderActive := 0
}
; sets the Border to the active window thumbnail
else if (Ahwnd != This.BorderActive) {
;Shows the Thumbnail on top of other thumbnails
WinSetAlwaysOnTop(1,This.ThumbWindows.%Ahwnd%["Window"].Hwnd )
This.ShowActiveBorder(Ahwnd)
This.UpdateThumb_AfterActivation(, Ahwnd)
This.BorderActive := Ahwnd
}
}
}
}
; Check if a Thumbnail exist without EVE Window. if so destroy the Thumbnail and free memory
if ( This.DestroyThumbnailsToggle ) {
for k, v in This.ThumbWindows.Clone().OwnProps() {
if !Winlist.HasProp(k) {
SetTimer(This.DestroyThumbnails, -500)
This.DestroyThumbnailsToggle := 0
}
}
}
}
; The function for the timer which gets started if no EVE window is in focus
HideOnLostFocusTimer() {
Try {
ForegroundPName := WinGetProcessName("A")
if (ForegroundPName = "exefile.exe") {
if (DllCall("IsIconic", "UInt", WinActive("ahk_exe exefile.exe"))) {
for EVEHWND in This.ThumbWindows.OwnProps() {
This.ShowThumb(EVEHWND, "Hide")
}
}
}
else if (ForegroundPName != "exefile.exe") {
for EVEHWND in This.ThumbWindows.OwnProps() {
This.ShowThumb(EVEHWND, "Hide")
}
}
}
}
;Register set Hotkeys by the user in settings
RegisterHotkeys(title, EvE_hwnd) {
static registerGroups := 0
;if the user has set Hotkeys in Options
if (This._Hotkeys[title]) {
;if the user has selected Global Hotkey. This means the Hotkey will alsways trigger as long at least 1 EVE Window exist.
;if a Window does not Exist which was assigned to the hotkey the hotkey will be dissabled until the Window exist again
if(This.Global_Hotkeys) {
HotIf (*) => WinExist(This.EVEExe) && WinExist("EVE - " title ) && !WinActive("EVE-X-Preview - Settings")
try {
Hotkey This._Hotkeys[title], (*) => This.ActivateEVEWindow(,,title), "P1"
}
catch ValueError as e {
MsgBox(e.Message ": --> " e.Extra " <-- in Profile Settings - " This.LastUsedProfile " Hotkeys" )
}
}
;if the user has selected (Win Active) the hotkeys will only trigger if at least 1 EVE Window is Active and in Focus
;This makes it possible to still use all keys outside from EVE
else {
HotIf (*) => WinExist("EVE - " title ) && WinActive(This.EVEExe)
try {
Hotkey This._Hotkeys[title], (*) => This.ActivateEVEWindow(,,title),"P1"
}
catch ValueError as e {
MsgBox(e.Message ": --> " e.Extra " <-- in Profile Settings - " This.LastUsedProfile " Hotkeys" )
}
}
}
}
;Register the Hotkeys for cycle Groups if any set
Register_Hotkey_Groups() {
static Fkey := "", BKey := "", Arr := []
if (IsObject(This.Hotkey_Groups) && This.Hotkey_Groups.Count != 0) {
for k, v in This.Hotkey_Groups {
;If any EVE Window Exist and at least 1 character matches the the list from the group windows
if(This.Global_Hotkeys) {
if( v["ForwardsHotkey"] != "" ) {
Fkey := v["ForwardsHotkey"], Arr := v["Characters"]
HotIf (*) => This.OneWinExist(Arr) && !WinActive("EVE-X-Preview - Settings")
try {
Hotkey( v["ForwardsHotkey"], ObjBindMethod(This, "Cycle_Hotkey_Groups",Arr,"ForwardsHotkey"), "P1")
}
catch ValueError as e {
MsgBox(e.Message ": --> " e.Extra " <-- in Profile Settings - " This.LastUsedProfile " - Hotkey Groups - " k " - Forwards Hotkey" )
}
}
if( v["BackwardsHotkey"] != "" ) {
Fkey := v["BackwardsHotkey"], Arr := v["Characters"]
HotIf (*) => This.OneWinExist(Arr) && !WinActive("EVE-X-Preview - Settings")
try {
Hotkey( v["BackwardsHotkey"], ObjBindMethod(This, "Cycle_Hotkey_Groups",Arr,"BackwardsHotkey"), "P1")
}
catch ValueError as e {
MsgBox(e.Message ": --> " e.Extra " <-- in Profile Settings - " This.LastUsedProfile " Hotkey Groups - " k " - Backwards Hotkey" )
}
}
}
;If any EVE Window is Active
else {
if( v["ForwardsHotkey"] != "" ) {
Fkey := v["ForwardsHotkey"], Arr := v["Characters"]
HotIf (*) => This.OneWinExist(Arr) && WinActive("Ahk_exe exefile.exe")
try {
Hotkey( v["ForwardsHotkey"], ObjBindMethod(This, "Cycle_Hotkey_Groups",Arr,"ForwardsHotkey"), "P1")
}
catch ValueError as e {
MsgBox(e.Message ": --> " e.Extra " <-- in Profile Settings - " This.LastUsedProfile " - Hotkey Groups - " k " - Forwards Hotkey" )
}
}
if( v["BackwardsHotkey"] != "" ) {
Fkey := v["BackwardsHotkey"], Arr := v["Characters"]
HotIf (*) => This.OneWinExist(Arr) && WinActive("Ahk_exe exefile.exe")
try {
Hotkey( v["BackwardsHotkey"], ObjBindMethod(This, "Cycle_Hotkey_Groups",Arr,"BackwardsHotkey"), "P1")
}
catch ValueError as e {
MsgBox(e.Message ": --> " e.Extra " <-- in Profile Settings - " This.LastUsedProfile " Hotkey Groups - " k " - Backwards Hotkey" )
}
}
}
}
}
}
; The method to make it possible to cycle throw the EVE Windows. Used with the Hotkey Groups
Cycle_Hotkey_Groups(Arr, direction,*) {
static Index := 0
length := Arr.Length
if (direction == "ForwardsHotkey") {
Try
Index := (n := IsActiveWinInGroup(This.CleanTitle(WinGetTitle("A")), Arr)) ? n+1 : 1
if (Index > length)
Index := 1
if (This.OneWinExist(Arr)) {
Try {
if !(WinExist("EVE - " This.CleanTitle(Arr[Index]))) {
while (!(WinExist("EVE - " This.CleanTitle(Arr[Index])))) {
index += 1
if (Index > length)
Index := 1
}
}
This.ActivateEVEWindow(,,This.CleanTitle(Arr[Index]))
}
}
}
else if (direction == "BackwardsHotkey") {
Try
Index := (n := IsActiveWinInGroup(This.CleanTitle(WinGetTitle("A")), Arr)) ? n-1 : length
if (Index <= 0)
Index := length
if (This.OneWinExist(Arr)) {
if !(WinExist("EVE - " This.CleanTitle(Arr[Index]))) {
while (!(WinExist("EVE - " This.CleanTitle(Arr[Index])))) {
Index -= 1
if (Index <= 0)
Index := length
}
}
This.ActivateEVEWindow(,,This.CleanTitle(Arr[Index]))
}
}
IsActiveWinInGroup(Title, Arr) {
for index, names in Arr {
if names = Title
return index
}
return false
}
}
; To Check if atleast One Win stil Exist in the Array for the cycle groups hotkeys
OneWinExist(Arr, *) {
for index, Name in Arr {
If WinExist("EVE - " Name " Ahk_Exe exefile.exe")
return true
}
return false
}
;## Updates the Thumbnail in the GUI after Activation
;## Do not Update thumbnails from minimized windows or this will leed in no picture for the Thumbnail
UpdateThumb_AfterActivation(event?, hwnd?) {
MinMax := -1
try MinMax := WinGetMinMax("ahk_id " hwnd)
if (This.ThumbWindows.HasProp(hwnd)) {
if !(MinMax == -1) {
This.Update_Thumb(false, This.ThumbWindows.%hwnd%["Window"].Hwnd)
}
}
}
;This function updates the Thumbnails and hotkeys if the user switches Charakters in the character selection screen
EVENameChange(hwnd, title) {
if (This.ThumbWindows.HasProp(hwnd)) {
This.SetThumbnailText[hwnd] := title
; moves the Window to the saved positions if any stored, a bit of sleep is usfull to give the window time to move before creating the thumbnail
This.RestoreClientPossitions(hwnd, title)
if (title = "") {
This.EvEWindowDestroy(hwnd, title)
This.EVE_WIN_Created(hwnd,title)
}
else If (This.ThumbnailPositions.Has(title)) {
This.EvEWindowDestroy(hwnd, title)
This.EVE_WIN_Created(hwnd,title)
rect := This.ThumbnailPositions[title]
This.ShowThumb(hwnd, "Hide")
This.ThumbMove( rect["x"],
rect["y"],
rect["width"],
rect["height"],
This.ThumbWindows.%hwnd% )
This.BorderSize(This.ThumbWindows.%hwnd%["Window"].Hwnd, This.ThumbWindows.%hwnd%["Border"].Hwnd)
This.Update_Thumb(true)
If ( This.HideThumbnailsOnLostFocus && WinActive(This.EVEExe) || !This.HideThumbnailsOnLostFocus && !WinActive(This.EVEExe) || !This.HideThumbnailsOnLostFocus && WinActive(This.EVEExe)) {
for k, v in This.ThumbWindows.OwnProps()
This.ShowThumb(k, "Show")
}
}
This.BorderActive := 0
This.RegisterHotkeys(title, hwnd)
}
}
;#### Gets Called after receiveing a mesage from the Listeners
;#### Handels Window Border, Resize, Activation
_OnMessage(wparam, lparam, msg, hwnd) {
If (This.ThumbHwnd_EvEHwnd.Has(hwnd) ) {
; Move the Window with right mouse button
If (msg == Main_Class.WM_RBUTTONDOWN) {
while (GetKeyState("RButton")) {
if !(GetKeyState("LButton")) {
;sleep 1
This.Mouse_DragMove(wparam, lparam, msg, hwnd)
This.Window_Snap(hwnd, This.ThumbWindows)
}
else
This.Mouse_ResizeThumb(wparam, lparam, msg, hwnd)
}
return 0
}
; Wparam - 9 Ctrl+Lclick
; 5 Shift+Lclick
; 13 Shift+ctrl+click
Else If (msg == Main_Class.WM_LBUTTONDOWN) {
;Activates the EVE Window by clicking on the Thumbnail
if (wparam = 1) {
if !(WinActive(This.ThumbHwnd_EvEHwnd[hwnd]))
This.ActivateEVEWindow(hwnd)
}
; Ctrl+Lbutton, Minimizes the Window on whose thumbnail the user clicks
else if (wparam = 9) {
; Minimize
if (!GetKeyState("RButton"))
PostMessage 0x0112, 0xF020, , , This.ThumbHwnd_EvEHwnd[hwnd]
}
return 0
}
}
}
; Creates a new thumbnail if a new window got created
EVE_WIN_Created(Win_Hwnd, Win_Title) {
; Moves the Window to the saved possition if any are stored
This.RestoreClientPossitions(Win_Hwnd, Win_Title)
;Creates the Thumbnail and stores the EVE Hwnd in the array
If !(This.ThumbWindows.HasProp(Win_Hwnd)) {
This.ThumbWindows.%Win_Hwnd% := This.Create_Thumbnail(Win_Hwnd, Win_Title)
This.ThumbHwnd_EvEHwnd[This.ThumbWindows.%Win_Hwnd%["Window"].Hwnd] := Win_Hwnd
;if the User is in character selection screen show the window always
if (This.ThumbWindows.%Win_Hwnd%["Window"].Title = "") {
This.SetThumbnailText[Win_Hwnd] := Win_Title
;if the Title is just "EVE" that means it is in the Charakter selection screen
;in this case show always the Thumbnail
This.ShowThumb(Win_Hwnd, "Show")
return
}
;if the user loged in into a Character then move the Thumbnail to the right possition
else If (This.ThumbnailPositions.Has(Win_Title)) {
This.SetThumbnailText[Win_Hwnd] := Win_Title
rect := This.ThumbnailPositions[Win_Title]
This.ThumbMove( rect["x"],
rect["y"],
rect["width"],
rect["height"],
This.ThumbWindows.%Win_Hwnd% )
This.BorderSize(This.ThumbWindows.%Win_Hwnd%["Window"].Hwnd, This.ThumbWindows.%Win_Hwnd%["Border"].Hwnd)
This.Update_Thumb(true)
If ( This.HideThumbnailsOnLostFocus && WinActive(This.EVEExe) || !This.HideThumbnailsOnLostFocus && !WinActive(This.EVEExe) || !This.HideThumbnailsOnLostFocus && WinActive(This.EVEExe)) {
for k, v in This.ThumbWindows.OwnProps()
This.ShowThumb(k, "Show")
}
}
This.RegisterHotkeys(Win_Title, Win_Hwnd)
}
}
;if a EVE Window got closed this destroyes the Thumbnail and frees the memory.
EvEWindowDestroy(hwnd?, WinTitle?) {
if (IsSet(hwnd) && This.ThumbWindows.HasProp(hwnd)) {
for k, v in This.ThumbWindows.Clone().%hwnd% {
if (K = "Thumbnail")
continue
v.Destroy()
;This.ThumbWindows.%Win_Hwnd%.Delete()
}
This.ThumbWindows.DeleteProp(hwnd)
Return
}
;If a EVE Windows get destroyed
for Win_Hwnd,v in This.ThumbWindows.Clone().OwnProps() {
if (!WinExist("Ahk_Id " Win_Hwnd)) {
for k,v in This.ThumbWindows.Clone().%Win_Hwnd% {
if (K = "Thumbnail")
continue
v.Destroy()
}
This.ThumbWindows.DeleteProp(Win_Hwnd)
}
}
This.DestroyThumbnailsToggle := 1
}
ActivateEVEWindow(hwnd?,ThisHotkey?, title?) {
; If the user clicks the Thumbnail then hwnd stores the Thumbnail Hwnd. Here the Hwnd gets changed to the contiguous EVE window hwnd
if (IsSet(hwnd) && This.ThumbHwnd_EvEHwnd.Has(hwnd)) {
hwnd := WinExist(This.ThumbHwnd_EvEHwnd[hwnd])
title := This.CleanTitle(WinGetTitle("Ahk_id " Hwnd))
}
;if the user presses the Hotkey
Else if (IsSet(title)) {
title := "EVE - " title
hwnd := WinExist(title " Ahk_exe exefile.exe")
}
;return when the user tries to bring a window to foreground which is already in foreground
if (WinActive("Ahk_id " hwnd))
Return
If (DllCall("IsIconic", "UInt", hwnd)) {
if (This.AlwaysMaximize) || ( This.TrackClientPossitions && This.ClientPossitions[This.CleanTitle(title)]["IsMaximized"] ) {
; ; Maximize
This.ShowWindowAsync(hwnd, 3)
}
else {
; Restore
This.ShowWindowAsync(hwnd)
}
}
Else {
; Use the virtual key to trigger the internal Hotkey.
This.ActivateHwnd := hwnd
SendEvent("{Blind}{" Main_Class.virtualKey "}")
}
;Sets the timer to minimize client if the user enable this.
if (This.MinimizeInactiveClients) {
This.wHwnd := hwnd
SetTimer(This.timer, -This.MinimizeDelay)
}
}
;The function for the Internal Hotkey to bring a not minimized window in foreground
ActivateForgroundWindow(*) {
; 2 attempts for brining the window in foreground
try {
if !(DllCall("SetForegroundWindow", "UInt", This.ActivateHwnd)) {
DllCall("SetForegroundWindow", "UInt", This.ActivateHwnd)
}
;If the user has selected to always maximize. this prevents wrong sized windows on heavy load.
if (This.AlwaysMaximize && WinGetMinMax("ahk_id " This.ActivateHwnd) = 0) || ( This.TrackClientPossitions && This.ClientPossitions[This.CleanTitle(WinGetTitle("Ahk_id " This.ActivateHwnd))]["IsMaximized"] && WinGetMinMax("ahk_id " This.ActivateHwnd) = 0 )
This.ShowWindowAsync(This.ActivateHwnd, 3)
}
Return
}
; Minimize All windows after Activting one with the exception of Titels in the DontMinimize Wintitels
; gets called by the timer to run async
EVEMinimize() {
for EveHwnd, GuiObj in This.ThumbWindows.OwnProps() {
ThumbHwnd := GuiObj["Window"].Hwnd
try
WinTitle := WinGetTitle("Ahk_Id " EveHwnd)
catch
continue
if (EveHwnd = This.wHwnd || Dont_Minimze_Enum(EveHwnd, WinTitle) || WinTitle == "EVE" || WinTitle = "")
continue
else {
; Just to make sure its not minimizeing the active Window
if !(EveHwnd = WinExist("A")) {
This.ShowWindowAsync(EveHwnd, 11)
}
}
}
;to check which names are in the list that should not be minimized
Dont_Minimze_Enum(hwnd, EVEwinTitle) {
WinTitle := This.CleanTitle(EVEwinTitle)
if !(WinTitle = "") {
for k in This.Dont_Minimize_Clients {
value := This.CleanTitle(k)
if value == WinTitle
return 1
}
return 0
}
}
}
; Function t move the Thumbnails into the saved positions from the user
ThumbMove(x := "", y := "", Width := "", Height := "", GuiObj := "") {
for Names, Obj in GuiObj {
if (Names = "Thumbnail")
continue
WinMove(x, y, Width, Height, Obj.Hwnd)
}
}
;Saves the possitions of all Windows and stores
Client_Possitions() {
IDs := WinGetList("Ahk_Exe " This.EVEExe)
for k, v in IDs {
Title := This.CleanTitle(WinGetTitle("Ahk_id " v))
if !(Title = "") {
;If Minimzed then restore before saving the coords
if (DllCall("IsIconic", "UInt", v)) {
This.ShowWindowAsync(v)
;wait for getting Active for maximum of 2 seconds
if (WinWaitActive("Ahk_Id " v, , 2)) {
Sleep(200)
WinGetPos(&X, &Y, &Width, &Height, "Ahk_Id " v)
;If the Window is Maximized
if (DllCall("IsZoomed", "UInt", v)) {
This.ClientPossitions[Title] := [X, Y, Width, Height, 1]
}
else {
This.ClientPossitions[Title] := [X, Y, Width, Height, 0]
}
}
}
;If the Window is not Minimized
else {
WinGetPos(&X, &Y, &Width, &Height, "Ahk_Id " v)
;is the window Maximized?
if (DllCall("IsZoomed", "UInt", v)) {
This.ClientPossitions[Title] := [X, Y, Width, Height, 1]
}
else
This.ClientPossitions[Title] := [X, Y, Width, Height, 0]
}
}
}
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
;Restore the clients to the saved positions
RestoreClientPossitions(hwnd, title) {
if (This.TrackClientPossitions) {
if ( This.TrackClientPossitions && This.ClientPossitions[title] ) {
if (DllCall("IsIconic", "UInt", hwnd) && This.ClientPossitions[title]["IsMaximized"] || DllCall("IsZoomed", "UInt", hwnd) && This.ClientPossitions[title]["IsMaximized"]) {
This.SetWindowPlacement(hwnd,This.ClientPossitions[title]["x"], This.ClientPossitions[title]["y"],
This.ClientPossitions[title]["width"], This.ClientPossitions[title]["height"], 9 )
This.ShowWindowAsync(hwnd, 3)
Return
}
else if (DllCall("IsIconic", "UInt", hwnd) && !This.ClientPossitions[title]["IsMaximized"] || DllCall("IsZoomed", "UInt", hwnd) && !This.ClientPossitions[title]["IsMaximized"]) {
This.SetWindowPlacement(hwnd,This.ClientPossitions[title]["x"], This.ClientPossitions[title]["y"],
This.ClientPossitions[title]["width"], This.ClientPossitions[title]["height"], 9 )
This.ShowWindowAsync(hwnd, 4)
Return
}
else if ( This.ClientPossitions[title]["IsMaximized"]) {
This.SetWindowPlacement(hwnd,This.ClientPossitions[title]["x"], This.ClientPossitions[title]["y"],
This.ClientPossitions[title]["width"], This.ClientPossitions[title]["height"] )
This.ShowWindowAsync(hwnd, 3)
Return
}
else if ( !This.ClientPossitions[title]["IsMaximized"]) {
This.SetWindowPlacement(hwnd,This.ClientPossitions[title]["x"], This.ClientPossitions[title]["y"],
This.ClientPossitions[title]["width"], This.ClientPossitions[title]["height"], 4 )
This.ShowWindowAsync(hwnd, 4)
Return
}
}
}
}
;*WinApi Functions
;Gets the normal possition from the Windows. Not to use for Maximized Windows
GetWindowPlacement(hwnd) {
DllCall("User32.dll\GetWindowPlacement", "Ptr", hwnd, "Ptr", WP := Buffer(44))
Lo := NumGet(WP, 28, "Int") ; X coordinate of the upper-left corner of the window in its original restored state
To := NumGet(WP, 32, "Int") ; Y coordinate of the upper-left corner of the window in its original restored state
Wo := NumGet(WP, 36, "Int") - Lo ; Width of the window in its original restored state
Ho := NumGet(WP, 40, "Int") - To ; Height of the window in its original restored state
CMD := NumGet(WP, 8, "Int") ; ShowCMD
flags := NumGet(WP, 4, "Int") ; flags
MinX := NumGet(WP, 12, "Int")
MinY := NumGet(WP, 16, "Int")
MaxX := NumGet(WP, 20, "Int")
MaxY := NumGet(WP, 24, "Int")
WP := ""
return { X: Lo, Y: to, W: Wo, H: Ho , cmd: CMD, flags: flags, MinX: MinX, MinY: MinY, MaxX: MaxX, MaxY: MaxY }
}
;Moves the window to the given possition immediately
SetWindowPlacement(hwnd:="", X:="", Y:="", W:="", H:="", action := 9) {
;hwnd := hwnd = "" ? WinExist("A") : hwnd
DllCall("User32.dll\GetWindowPlacement", "Ptr", hwnd, "Ptr", WP := Buffer(44))
Lo := NumGet(WP, 28, "Int") ; X coordinate of the upper-left corner of the window in its original restored state
To := NumGet(WP, 32, "Int") ; Y coordinate of the upper-left corner of the window in its original restored state
Wo := NumGet(WP, 36, "Int") - Lo ; Width of the window in its original restored state
Ho := NumGet(WP, 40, "Int") - To ; Height of the window in its original restored state
L := X = "" ? Lo : X ; X coordinate of the upper-left corner of the window in its new restored state
T := Y = "" ? To : Y ; Y coordinate of the upper-left corner of the window in its new restored state
R := L + (W = "" ? Wo : W) ; X coordinate of the bottom-right corner of the window in its new restored state
B := T + (H = "" ? Ho : H) ; Y coordinate of the bottom-right corner of the window in its new restored state
NumPut("UInt",action,WP,8)
NumPut("UInt",L,WP,28)
NumPut("UInt",T,WP,32)
NumPut("UInt",R,WP,36)
NumPut("UInt",B,WP,40)
Return DllCall("User32.dll\SetWindowPlacement", "Ptr", hwnd, "Ptr", WP)
}
ShowWindowAsync(hWnd, nCmdShow := 9) {
DllCall("ShowWindowAsync", "UInt", hWnd, "UInt", nCmdShow)
}
GetActiveWindow() {
Return DllCall("GetActiveWindow", "Ptr")
}
SetActiveWindow(hWnd) {
Return DllCall("SetActiveWindow", "Ptr", hWnd)
}
SetFocus(hWnd) {
Return DllCall("SetFocus", "Ptr", hWnd)
}
SetWindowPos(hWnd, x, y, w, h, hWndInsertAfter := 0, uFlags := 0x0020) {
; SWP_FRAMECHANGED 0x0020
; SWP_SHOWWINDOW 0x40
Return DllCall("SetWindowPos", "Ptr", hWnd, "Ptr", hWndInsertAfter, "Int", x, "Int", y, "Int", w, "Int", h, "UInt", uFlags)
}
;removes "EVE" from the Titel and leaves only the Character names
CleanTitle(title) {
Return RegExReplace(title, "^(?i)eve(?:\s*-\s*)?\b", "")
;RegExReplace(title, "(?i)eve\s*-\s*", "")
}
SaveJsonToFile() {
FileDelete("EVE-X-Preview.json")
FileAppend(JSON.Dump(This._JSON, , " "), "EVE-X-Preview.json")
}
}

600
src/Propertys.ahk Normal file
View File

@@ -0,0 +1,600 @@

class Propertys extends TrayMenu {
;######################
;## Script Propertys
SetThumbnailText[hwnd, *] {
set {
if (This.ThumbWindows.HasProp(hwnd)) {
;RegExReplace(Value, "(EVE)(?: - )?", "")
newtext := Value
for k, v in This.ThumbWindows.%hwnd% {
if (k = "Thumbnail" || k = "Border")
continue
if (k = "TextOverlay") {
for chwnd, cobj in v {
cobj.Value := newtext
;ControlSetText "New Text Here", cobj
}
}
if (k = "Window")
v.Title := newtext
}
}
}
}
Profiles => This._JSON["_Profiles"]
;######################
;## global Settings
ThumbnailStartLocation[key] {
get => This._JSON["global_Settings"]["ThumbnailStartLocation"][key]
set => This._JSON["global_Settings"]["ThumbnailStartLocation"][key] := value
}
Minimizeclients_Delay {
get => This._JSON["global_Settings"]["Minimize_Delay"]
set => This._JSON["global_Settings"]["Minimize_Delay"] := (value < 50 ? "50" : value)
}
Suspend_Hotkeys_Hotkey {
get => This._JSON["global_Settings"]["Suspend_Hotkeys_Hotkey"]
set => This._JSON["global_Settings"]["Suspend_Hotkeys_Hotkey"] := value
}
ThumbnailBackgroundColor {
get => convertToHex(This._JSON["global_Settings"]["ThumbnailBackgroundColor"])
set => This._JSON["global_Settings"]["ThumbnailBackgroundColor"] := convertToHex(value)
}
ThumbnailSnap[*] {
get => This._JSON["global_Settings"]["ThumbnailSnap"]
set => This._JSON["global_Settings"]["ThumbnailSnap"] := Value
}
Global_Hotkeys {
get => This._JSON["global_Settings"]["Global_Hotkeys"]
set => This._JSON["global_Settings"]["Global_Hotkeys"] := value
}
ThumbnailSnap_Distance {
get => This._JSON["global_Settings"]["ThumbnailSnap_Distance"]
set => This._JSON["global_Settings"]["ThumbnailSnap_Distance"] := (value ? value : "20")
}
ThumbnailMinimumSize[key] {
get => This._JSON["global_Settings"]["ThumbnailMinimumSize"][key]
set => This._JSON["global_Settings"]["ThumbnailMinimumSize"][key] := value
}
;########################
;## Profile ThumbnailSettings
ShowAllColoredBorders {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ShowAllColoredBorders"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ShowAllColoredBorders"] := value
}
LastUsedProfile {
get => This._JSON["global_Settings"]["LastUsedProfile"]
set => This._JSON["global_Settings"]["LastUsedProfile"] := value
}
_ProfileProps {
get {
Arr := []
for k in This._JSON["_Profiles"][This.LastUsedProfile] {
If (k = "Thumbnail Positions" || k = "Client Possitions")
continue
Arr.Push(k)
}
return Arr
}
}
Thumbnail_visibility[key?] {
get {
return This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Visibility"]
; if IsSet(Key) {
; Arr := Array()
; for k, v in This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail_visibility"]
; Arr.Push(k)
; return Arr
; }
; else
; return This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail_visibility"]
}
set {
if (IsObject(value)) {
This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Visibility"] := value
; for k, v in Value {
; This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail_visibility"][k] := v
; }
}
This.Save_Settings()
}
}
HideThumbnailsOnLostFocus {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["HideThumbnailsOnLostFocus"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["HideThumbnailsOnLostFocus"] := value
}
ShowThumbnailsAlwaysOnTop {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ShowThumbnailsAlwaysOnTop"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ShowThumbnailsAlwaysOnTop"] := value
}
ThumbnailOpacity {
get {
percentage := This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailOpacity"]
return Round((percentage < 0 ? 0 : percentage > 100 ? 100 : percentage) * 2.55)
}
set {
This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailOpacity"] := Value
}
}
ClientHighligtBorderthickness {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ClientHighligtBorderthickness"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ClientHighligtBorderthickness"] := Trim(value, "`n ")
}
ClientHighligtColor {
get => convertToHex(This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ClientHighligtColor"])
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ClientHighligtColor"] := convertToHex(Trim(value, "`n "))
}
ShowClientHighlightBorder {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ShowClientHighlightBorder"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ShowClientHighlightBorder"] := value
}
ThumbnailTextFont {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailTextFont"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailTextFont"] := Trim(value, "`n ")
}
ThumbnailTextSize {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailTextSize"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailTextSize"] := Trim(value, "`n ")
}
ThumbnailTextColor {
get => convertToHex(This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailTextColor"])
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailTextColor"] := convertToHex(Trim(value, "`n "))
}
ShowThumbnailTextOverlay {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ShowThumbnailTextOverlay"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ShowThumbnailTextOverlay"] := value
}
ThumbnailTextMargins[var] {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailTextMargins"][var]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Settings"]["ThumbnailTextMargins"][var] := Trim(value, "`n ")
}
;########################
;## Profile ClientSettings
CustomColorsGet[CName?] {
get {
name := "", nameIndex := 0, ctext := "", cBorder := ""
for index, names in This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["CharNames"] {
if (names = CName) {
nameIndex := index
name := names
break
}
else
nameIndex := index
}
if (nameIndex) {
if (This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["Bordercolor"].Length >= nameIndex) {
cBorder := This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["Bordercolor"][nameIndex]
}
if (This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["TextColor"].Length >= nameIndex)
ctext := This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["TextColor"][nameIndex]
}
return Map("Char", name, "Border", cBorder, "Text", ctext)
}
}
IndexcChars => This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["CharNames"].Length
IndexcBorder => This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["Bordercolor"].Length
IndexcText => This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["TextColor"].Length
CustomColors_AllCharNames {
get {
names := ""
for k, v in This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["CharNames"] {
if (A_Index < This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["CharNames"].Length)
names .= k ": " v "`n"
else
names .= k ": " v
}
return names
}
set {
tempvar := []
ListChars := StrSplit(value, "`n")
for k, v in ListChars {
chars := RegExReplace(This.CleanTitle(Trim(v, "`n ")), ".*:\s*", "")
tempvar.Push(chars)
}
This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["CharNames"] := tempvar
}
}
CustomColors_AllBColors {
get {
names := ""
for k, v in This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["Bordercolor"] {
if (A_Index < This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["Bordercolor"].Length)
names .= k ": " v "`n"
else
names .= k ": " v
}
return names
}
set {
tempvar := []
ListChars := StrSplit(value, "`n")
for k, v in ListChars {
chars := RegExReplace(convertToHex(Trim(v, "`n ")), ".*:\s*", "")
tempvar.Push(chars)
}
This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["Bordercolor"] := tempvar
}
}
CustomColors_AllTColors {
get {
names := ""
for k, v in This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["TextColor"] {
if (A_Index < This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["TextColor"].Length)
names .= k ": " v "`n"
else
names .= k ": " v
}
return names
}
set {
tempvar := []
ListChars := StrSplit(value, "`n")
for k, v in ListChars {
chars := RegExReplace(convertToHex(Trim(v, "`n ")), ".*:\s*", "")
tempvar.Push(chars)
}
This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColors"]["TextColor"] := tempvar
}
}
CustomColorsActive {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColorActive"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Custom Colors"]["cColorActive"] := Value
}
MinimizeInactiveClients {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["MinimizeInactiveClients"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["MinimizeInactiveClients"] := value
}
AlwaysMaximize {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["AlwaysMaximize"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["AlwaysMaximize"] := value
}
TrackClientPossitions {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["TrackClientPossitions"]
set => This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["TrackClientPossitions"] := value
}
Dont_Minimize_Clients {
get => This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["Dont_Minimize_Clients"]
set {
This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["Dont_Minimize_Clients"] := []
For index, Client in StrSplit(Value, ["`n", ","]) {
if (Client = "")
continue
This._JSON["_Profiles"][This.LastUsedProfile]["Client Settings"]["Dont_Minimize_Clients"].Push(Trim(Client, "`n "))
}
}
}
ThumbnailPositions[wTitle?] {
get {
if (IsSet(wTitle))
return This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Positions"][wTitle]
return This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Positions"]
}
set {
form := ["x", "y", "width", "height"]
if !(This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Positions"].Has(wTitle))
This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Positions"][wTitle] := Map()
for v in form {
This._JSON["_Profiles"][This.LastUsedProfile]["Thumbnail Positions"][wTitle][v] := value[A_Index]
}
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
}
ClientPossitions[wTitle] {
get {
if (This._JSON["_Profiles"][This.LastUsedProfile]["Client Possitions"].Has(wTitle))
return This._JSON["_Profiles"][This.LastUsedProfile]["Client Possitions"][wTitle]
else
return 0
}
set {
form := ["x", "y", "width", "height", "IsMaximized"]
if !(This._JSON["_Profiles"][This.LastUsedProfile]["Client Possitions"].Has(wTitle))
This._JSON["_Profiles"][This.LastUsedProfile]["Client Possitions"][wTitle] := Map()
for v in form {
This._JSON["_Profiles"][This.LastUsedProfile]["Client Possitions"][wTitle][v] := value[A_Index]
}
}
}
;########################
;## Profile Hotkeys
Hotkey_Groups[key?] {
get {
if (IsSet(key)) {
return This._JSON["_Profiles"][This.LastUsedProfile]["Hotkey Groups"][key]
}
else
return This._JSON["_Profiles"][This.LastUsedProfile]["Hotkey Groups"]
}
set {
This._JSON["_Profiles"][This.LastUsedProfile]["Hotkey Groups"][Key] := Map("Characters", value, "ForwardsHotkey", "", "BackwardsHotkey", "")
}
}
; Hotkey_Groups_Hotkeys[Name?, Hotkey?] {
; get {
; }
; set {
; This._JSON["_Profiles"][This.LastUsedProfile]["Hotkey_Groups"][Name][Hotkey] := Value
; }
; }
_Hotkeys[key?] {
get {
if (IsSet(Key)) {
loop This._JSON["_Profiles"][This.LastUsedProfile]["Hotkeys"].Length {
if (This._JSON["_Profiles"][This.LastUsedProfile]["Hotkeys"][A_Index].Has(key)) {
return This._JSON["_Profiles"][This.LastUsedProfile]["Hotkeys"][A_Index][key]
}
}
return 0
}
if !(IsSet(Key))
return This._JSON["_Profiles"][This.LastUsedProfile]["Hotkeys"]
}
set => This._JSON["_Profiles"][This.LastUsedProfile]["Hotkeys"] := Value
}
_Hotkey_Delete(*) {
if (This.LV_Item) {
try {
HKey_Char_Name := This.LV.GetText(This.LV_Item)
if (This._Hotkeys.Has(HKey_Char_Name)) {
This._Hotkeys.Delete(HKey_Char_Name)
This.LV.Delete(This.LV_Item)
;This.Save_Settings()
}
}
}
}
_Hotkey_Add(*) {
Obj := InputBox("Enter the Char Name", "Add New Char", "w200 h90")
if (Obj.Result = "OK") {
This._Hotkeys[Trim(Obj.Value, " ")] := ""
This.LV.Add(, Trim(Obj.Value, " "))
;This.Save_Settings()
}
}
_Hotkey_Edit(*) {
if (This.LV_Item) {
HKey_Char_Key := This.LV.GetText(This.LV_Item, 2), HKey_Char_Name := This.LV.GetText(This.LV_Item)
if (This._Hotkeys.Has(HKey_Char_Name)) {
Obj := InputBox(HKey_Char_Key, "Edit Hotkey for -> " HKey_Char_Name, "w250 h100")
if (Obj.Result = "OK") {
This._Hotkeys[HKey_Char_Name] := Trim(Obj.Value, " ")
This.LV.Modify(This.LV_Item, , , Trim(Obj.Value, " "))
This.LV.Modify(This.LV_Item, "+Focus +Select")
;This.Save_Settings()
}
}
}
}
_Tv_LVSelectedRow(GuiCtrlObj, Item, Checked) {
Obj := Map()
if (GuiCtrlObj == This.Tv_LV) {
loop {
RowNumber := This.Tv_LV.GetNext(A_Index - 1, "Checked")
if not RowNumber ; The above returned zero, so there are no more selected rows.
break
Obj[This.Tv_LV.GetText(RowNumber)] := 1
This.Thumbnail_visibility[This.Tv_LV.GetText(RowNumber)] := 1
;MsgBox(GuiCtrlObj.value)
}
This.Thumbnail_visibility := Obj
SetTimer(This.Save_Settings_Delay_Timer, -200)
;This.LV_Item := Item
; ddd := GuiCtrlObj.GetText(Item)
; ToolTip(Item ", " ddd " -, " Checked)
}
}
_LVSelectedRow(GuiCtrlObj, Item, Selected) {
if (GuiCtrlObj == This.LV && Selected) {
This.LV_Item := Item
ddd := GuiCtrlObj.GetText(Item)
;ToolTip(Item ", " ddd " -, " Selected)
}
}
;######################
;## Methods
Suspend_Hotkeys(*) {
static state := 0
ToolTip()
state := !state
state ? ToolTip("Hotkeys disabled") : ToolTip("Hotkeys enabled")
Suspend(-1)
SetTimer((*) => ToolTip(), -1500)
}
Delete_Profile(*) {
if (This.SelectProfile_DDL.Text = "Default") {
MsgBox("You cannot delete the default settings")
Return
}
if (This.SelectProfile_DDL.Text = This.LastUsedProfile) {
This.LastUsedProfile := "Default"
}
This._JSON["_Profiles"].Delete(This.SelectProfile_DDL.Text)
if (This.LastUsedProfile = "" || !This.Profiles.Has(This.LastUsedProfile))
This.LastUsedProfile := "Default"
; FileDelete("EVE-X-Preview.json")
; FileAppend(JSON.Dump(This._JSON, , " "), "EVE-X-Preview.json")
SetTimer(This.Save_Settings_Delay_Timer, -200)
;Index := This.SelectProfile_DDL.Value
This.SelectProfile_DDL.Delete(This.SelectProfile_DDL.Value)
This.SelectProfile_DDL.Redraw()
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL {
for _, ob in v {
ob.Enabled := 0
}
}
;This.S_Gui.Show("AutoSize")
}
Create_Profile(*) {
Obj := InputBox("Enter a Profile Name", "Create New Profile", "w200 h90")
if (Obj.Result != "OK" || Obj.Result = "")
return
if (This.Profiles.Has(Obj.value)) {
MsgBox("A profile with this name already exists")
return
}
if !(This.LastUsedProfile = "Default") {
Result := MsgBox("Do you want to use the current settings for the new profile?", , "YesNo")
}
else
Result := "No"
if Result = "Yes"
This._JSON["_Profiles"][Obj.value] := JSON.Load(FileRead("EVE-X-Preview.json"))["_Profiles"][This.LastUsedProfile]
else if Result = "No"
This._JSON["_Profiles"][Obj.value] := This.default_JSON["_Profiles"]["Default"]
else
Return 0
FileDelete("EVE-X-Preview.json")
FileAppend(JSON.Dump(This._JSON, , " "), "EVE-X-Preview.json")
This.SelectProfile_DDL.Delete()
This.SelectProfile_DDL.Add(This.Profiles_to_Array())
This.LastUsedProfile := "Default"
Return
}
Save_ThumbnailPossitions() {
for EvEHwnd, GuiObj in This.ThumbWindows.OwnProps() {
for Names, Obj in GuiObj {
if (Names = "Window" && Obj.Title = "" || Obj.Title = "EVE")
continue
Else if (Names = "Window") {
WinGetPos(&wX, &wY, &wWidth, &wHeight, Obj.Hwnd)
This.ThumbnailPositions[Obj.Title] := [wX, wY, wWidth, wHeight]
}
}
}
}
;### Stores the Thumbnail Size and Possitions in the Json file
Save_Settings() {
if !(This.Tray_Profile_scwitch) {
for EvEHwnd, GuiObj in This.ThumbWindows.OwnProps() {
for Names, Obj in GuiObj {
if (Names = "Window" && Obj.Title = "" || Obj.Title = "EVE")
continue
Else if (Names = "Window") {
WinGetPos(&wX, &wY, &wWidth, &wHeight, Obj.Hwnd)
This.ThumbnailPositions[Obj.Title] := [wX, wY, wWidth, wHeight]
}
}
}
}
SetTimer(This.Save_Settings_Delay_Timer, -200)
; var := Json.Dump(This._JSON, , " ")
; FileDelete("EVE-X-Preview.json")
; FileAppend(var, "EVE-X-Preview.json")
}
}
;########################
;## Functions
Add_New_Profile() {
return
}
convertToHex(rgbString) {
; Check if the string corresponds to the decimal value format (e.g. "255, 255, 255" or "rgb(255, 255, 255)")
if (RegExMatch(rgbString, "^\s*(rgb\s*\(?)?\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)?\s*$", &matches)) {
red := matches[2], green := matches[3], blue := matches[4]
; covert decimal to hex
hexValue := Format("{:02X}{:02X}{:02X}", red, green, blue)
return hexValue
}
; Check whether the string corresponds to the hexadecimal value format (e.g "#FFFFFF" or "0xFFFFFF")
if (RegExMatch(rgbString, "^\s*(#|0x)?([0-9A-Fa-f]{6})\s*$", &matches)) {
hexValue := matches[2]
hexValue := StrLower(hexValue)
return hexValue
}
; If no match was found or the string is already in hexadecimal value format, return directly
return rgbString
}

862
src/Settings_Gui.ahk Normal file
View File

@@ -0,0 +1,862 @@
Class Settings_Gui {
MainGui() {
;if settings got chnaged which require a restart to apply
This.NeedRestart := 0
;MsgBox(This.CustomColorsGet["Example Char"]["Char"])
SetControlDelay(-1)
This.S_Gui := Gui("+OwnDialogs +MinimizeBox -Resize -MaximizeBox -DPIScale SysMenu +MinSize500x250")
This.S_Gui.Title := "EVE-X-Preview - Settings"
;Font options for the Buttons
This.S_Gui.SetFont("s10 w700")
;Sets Margins for the following Buttons
This.S_Gui.MarginX := 80, This.S_Gui.MarginY := 20
This.S_Gui.Add("Button", " x140 y20 w120 h40 vGlobal_Settings", "Global Settings").OnEvent("Click", (obj, *) => Button_Handler(obj))
This.S_Gui.Add("Button", "x+40 y+-40 wp hp vProfile_Settings", "Profile Settings").OnEvent("Click", (obj, *) => Button_Handler(obj))
This.S_Gui.Show("hide")
;Create the Arrays which hold the GUI objects for the controls
This.S_Gui.Controls := [], This.S_Gui.ClientSettings := []
;Sets Margins for the following controls
This.S_Gui.MarginX := 25
;Default Font options for the controls
This.S_Gui.SetFont("s9 w400")
;Creates the Controls
This.Global_Settings(), This.Profile_Settings(), This.ClientSettings_Ctrl(), This.Custom_ColorsCtrl()
This.Hotkey_GroupsCtrl(), This.HotkeysCtrl(), This.ThumbnailSettings_Ctrl(), This.Thumbnail_visibilityCtrl()
This.S_Gui.Show("AutoSize Center")
This._Button_Load()
This.Seetings_DDL.OnEvent("Change", (Obj, *) => SettingsDDL_Handler(Obj))
This.S_Gui.OnEvent("Close", (*) => GuiDestroy())
GuiDestroy(*) {
This.S_Gui.Destroy()
if (This.NeedRestart)
Reload()
}
SettingsDDL_Handler(Obj) {
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL {
if k = Obj.Text {
for _, ob in v
ob.Visible := 1
}
else {
for _, ob in v
ob.Visible := 0
}
}
This.S_Gui.Show("AutoSize")
}
Button_Handler(obj) {
if (obj.Name = "Global_Settings") {
for ButtonName, Controls in This.S_Gui.Controls.OwnProps() {
if ButtonName = obj.Name {
for _, Ctrl in Controls {
Ctrl.Visible := 1
}
}
else {
for _, Ctrl in Controls {
Ctrl.Visible := 0
}
for _, Ctrl in This.S_Gui.Controls.Profile_Settings.PsDDL {
for k, v in Ctrl
v.Visible := 0
}
}
}
}
else if (obj.Name = "Profile_Settings") {
for ButtonName, Controls in This.S_Gui.Controls.OwnProps() {
if ButtonName = obj.Name {
for _, Ctrl in Controls {
Ctrl.Visible := 1
}
for _, Ctrl in This.S_Gui.Controls.Profile_Settings.PsDDL {
if (This.Seetings_DDL.Text = _) {
for k, v in Ctrl {
v.Visible := 1
}
}
}
}
else {
for _, Ctrl in Controls {
Ctrl.Visible := 0
}
}
}
if (This.Profiles.Count = 1 && This.SelectProfile_DDL.Text = "Default")
MsgBox("you must first create a profile to change the settings")
}
This.S_Gui.Show("AutoSize")
}
}
;This Function creates all Settings controls for the Global Settings Button
Global_Settings(visible?) {
This.S_Gui.Controls.Global_Settings := []
This.S_Gui.SetFont("s10 w400")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("GroupBox", "x20 y80 h280 w500")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xp+15 yp+20 Section", "Suspend Hotkeys - Hotkey:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+15", "Hotkey activation Scope:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+15", "Thumbnail Background Color:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+15", "Thumbnail Default Location:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+15", "Thumbnail Minimum Size:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+15", "Thumbnail Snap:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+15", "Thumbnail Snap Distance:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+15", "Minimize EVE Window Delay:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "xs+230 ys-3 w150 Section vSuspend_Hotkeys_Hotkey", This.Suspend_Hotkeys_Hotkey)
This.S_Gui["Suspend_Hotkeys_Hotkey"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("DDL", "xp y+5 w180 vTTT vHotkey_Scoope Choose" (This.Global_Hotkeys ? 1 : 2), ["Global", "If an EVE window is Active"])
This.S_Gui["Hotkey_Scoope"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "xp y+5 w120 section vThumbnailBackgroundColor", This.ThumbnailBackgroundColor)
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xp+130 yp+4", "Hex or RGB")
This.S_Gui["ThumbnailBackgroundColor"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs+2 y+17 section", "x:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "x+5 y+-18 w40 vThumbnailStartLocationx", This.ThumbnailStartLocation["x"])
This.S_Gui["ThumbnailStartLocationx"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "x+8 ys ", "y:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "x+5 y+-18 w40 vThumbnailStartLocationy", This.ThumbnailStartLocation["y"])
This.S_Gui["ThumbnailStartLocationy"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "x+8 ys ", "w:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "x+5 y+-18 w40 vThumbnailStartLocationwidth", This.ThumbnailStartLocation["width"])
This.S_Gui["ThumbnailStartLocationwidth"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "x+8 ys ", "h:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "x+5 y+-18 w40 vThumbnailStartLocationheight", This.ThumbnailStartLocation["height"])
This.S_Gui["ThumbnailStartLocationheight"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+10 section ", "width:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "x+5 y+-18 w40 vThumbnailMinimumSizewidth", This.ThumbnailMinimumSize["width"])
This.S_Gui["ThumbnailMinimumSizewidth"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "x+8 ys ", "height:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "x+5 y+-18 w40 vThumbnailMinimumSizeheight", This.ThumbnailMinimumSize["height"])
This.S_Gui["ThumbnailMinimumSizeheight"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Radio", "xs y+10 w37 vThumbnailSnapOn Checked" This.ThumbnailSnap, "On")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Radio", " xp+50 yp w37 vThumbnailSnapOff Checked" (This.ThumbnailSnap ? 0 : 1), "Off")
This.S_Gui["ThumbnailSnapOn"].OnEvent("Click", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui["ThumbnailSnapOff"].OnEvent("Click", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+15 ", "pixel:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "x+5 y+-18 w40 vThumbnailSnap_Distance", This.ThumbnailSnap_Distance)
This.S_Gui["ThumbnailSnap_Distance"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Text", "xs y+9 ", "Milliseconds:")
This.S_Gui.Controls.Global_Settings.Push This.S_Gui.Add("Edit", "xp+80 yp-3 w40 vMinimizeclients_Delay", This.Minimizeclients_Delay)
This.S_Gui["Minimizeclients_Delay"].OnEvent("Change", (obj, *) => gSettings_EventHandler(obj))
gSettings_EventHandler(obj) {
if (obj.name = "Suspend_Hotkeys_Hotkey") {
This.Suspend_Hotkeys_Hotkey := Trim(obj.value, "`n ")
This.NeedRestart := 1
}
else if (obj.name = "Hotkey_Scoope") {
This.Global_Hotkeys := (obj.value = 1 ? 1 : 0)
This.NeedRestart := 1
}
else if (obj.name = "ThumbnailBackgroundColor") {
This.ThumbnailBackgroundColor := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ThumbnailStartLocationx") {
This.ThumbnailStartLocation["x"] := obj.value
}
else if (obj.name = "ThumbnailStartLocationy") {
This.ThumbnailStartLocation["y"] := obj.value
}
else if (obj.name = "ThumbnailStartLocationwidth") {
This.ThumbnailStartLocation["width"] := obj.value
}
else if (obj.name = "ThumbnailStartLocationheight") {
This.ThumbnailStartLocation["height"] := obj.value
}
else if (obj.name = "ThumbnailMinimumSizewidth") {
This.ThumbnailMinimumSize["width"] := obj.value
}
else if (obj.name = "ThumbnailMinimumSizeheight") {
This.ThumbnailMinimumSize["height"] := obj.value
}
else if (obj.name = "ThumbnailSnapOn") {
This.ThumbnailSnap := 1
}
else if (obj.name = "ThumbnailSnapOff") {
This.ThumbnailSnap := 0
}
else if (obj.name = "ThumbnailSnap_Distance") {
This.ThumbnailSnap_Distance := obj.value
}
else if (obj.name = "Minimizeclients_Delay") {
This.Minimizeclients_Delay := obj.value
This.NeedRestart := 1
}
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
}
;This Function creates all Settings controls for the Profile Settings Button
Profile_Settings(visible?) {
This.S_Gui.Controls.Profile_Settings := [], This.S_Gui.Controls.Profile_Settings.PsDDL := Map()
;This.S_Gui.Controls.Profile_Settings.Push This.S_Gui.Add("GroupBox", "x20 y80 h200 w500 vPSGroupBox", "")
This.S_Gui.Controls.Profile_Settings.Push This.S_Gui.Add("Text", "x58 y95", "Select Profile:")
This.SelectProfile_DDL := This.S_Gui.Add("DDL", "w200 xp-30 yp+18 Section vSelectedProfile", This.Profiles_to_Array())
This.S_Gui.Controls.Profile_Settings.Push This.SelectProfile_DDL
This.SelectProfile_DDL.Choose(This.LastUsedProfile)
This.SelectProfile_DDL.OnEvent("Change", (obj,*) => This._Button_Load(Obj))
Button_Delete := This.S_Gui.Add("Button", "w60 xs+360 yp-2 ", "Delete")
This.S_Gui.Controls.Profile_Settings.Push Button_Delete
Button_Delete.OnEvent("Click", ObjBindMethod(This, "Delete_Profile"))
Button_New := This.S_Gui.Add("Button", "wp x+5 yp ", "New")
This.S_Gui.Controls.Profile_Settings.Push Button_New
Button_New.OnEvent("Click", ObjBindMethod(This, "Create_Profile"))
;*Seperator line
This.Seperator_text := This.S_Gui.Add("Text", "xs+15 y+5 w460 h2 +0x10")
This.S_Gui.Controls.Profile_Settings.Push This.Seperator_text
This.S_Gui.Controls.Profile_Settings.Push This.S_Gui.Add("Text", "xp+190 y+5", "Profile Settings:")
This.Seetings_DDL := This.S_Gui.Add("DDL", "w180 xp-40 y+5 vSeetings_Props", This._ProfileProps)
This.Seetings_DDL.Choose(1)
;This.Seetings_DDL.OnEvent("Change", ObjBindMethod(This, "ProfileSettings_DDL"))
This.S_Gui.Controls.Profile_Settings.Push This.Seetings_DDL
;*Seperator line
This.S_Gui.Controls.Profile_Settings.Push This.S_Gui.Add("Text", "x150 yp+30 w260 h2 Section +0x10")
;Sets all controls invisible at beginning
for k, v in This.S_Gui.Controls.Profile_Settings
v.Visible := 0
}
ClientSettings_Ctrl(visible?) {
This.S_Gui.Controls.Profile_Settings.PsDDL["Client Settings"] := [], ClientSettings := []
ClientSettings.Push This.S_Gui.Add("GroupBox", "x20 y80 h400 w500 Section", "")
ClientSettings.Push This.S_Gui.Add("Text", " xp+15 yp+140 Section ", "Minimize Inactive Clients:")
ClientSettings.Push This.S_Gui.Add("Text", "xs y+15 ", "Always Maximize Clients:")
ClientSettings.Push This.S_Gui.Add("Text", "xs y+15 ", "Dont Minimize Clients:")
ClientSettings.Push This.S_Gui.Add("CheckBox", "xs+230 ys Section vMinimizeInactiveClients Checked" This.MinimizeInactiveClients, "On/Off")
This.S_Gui["MinimizeInactiveClients"].OnEvent("Click", (obj, *) => cSettings_EventHandler(obj))
ClientSettings.Push This.S_Gui.Add("CheckBox", "xs y+15 vAlwaysMaximize Checked" This.AlwaysMaximize, "On/Off")
This.S_Gui["AlwaysMaximize"].OnEvent("Click", (obj, *) => cSettings_EventHandler(obj))
ClientSettings.Push This.S_Gui.Add("Edit", "xs y+15 w220 h180 vDont_Minimize_Clients -Wrap", This.Dont_Minimize_List())
This.S_Gui["Dont_Minimize_Clients"].OnEvent("Change", (obj, *) => cSettings_EventHandler(obj))
;Pulls the GUI Object into the Map
This.S_Gui.Controls.Profile_Settings.PsDDL["Client Settings"] := ClientSettings
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL["Client Settings"]
v.Visible := 0
cSettings_EventHandler(obj) {
if (obj.name = "MinimizeInactiveClients") {
This.MinimizeInactiveClients := obj.value
}
else if (obj.name = "AlwaysMaximize") {
This.AlwaysMaximize := obj.value
}
else if (obj.name = "TrackClientPossitions") {
This.TrackClientPossitions := obj.value
}
else if (obj.name = "Dont_Minimize_Clients") {
This.Dont_Minimize_Clients := obj.value
}
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
}
;TODO Needs to be implemented - Add Propertys
; User defined colurs per Client
Custom_ColorsCtrl() {
This.S_Gui.Controls.Profile_Settings.PsDDL["Custom Colors"] := [], CustomColors := []
CustomColors.Push This.S_Gui.Add("GroupBox", "x20 y80 h480 w500 Section", "")
CustomColors.Push This.S_Gui.Add("Text", " xp+25 yp+140 Section ", "Custom Colors Active On/Off")
CustomColors.Push This.S_Gui.Add("Text", " x70 yp+40 ", "Character name")
CustomColors.Push This.S_Gui.Add("Text", " xp+150 yp ", "Border Color")
CustomColors.Push This.S_Gui.Add("Text", " xp+130 yp ", "Text Color")
CustomColors.Push This.S_Gui.Add("CheckBox", " xs+200 ys vCcoloractive Checked" This.CustomColorsActive, " ON / Off")
This.S_Gui["Ccoloractive"].OnEvent("Click", (obj, *) => Cclors_Eventhandler(obj))
CustomColors.Push This.S_Gui.Add("Edit", " x60 yp+60 w150 h250 -Wrap vCchars", This.CustomColors_AllCharNames)
This.S_Gui["Cchars"].OnEvent("Change", (obj, *) => Cclors_Eventhandler(obj))
CustomColors.Push This.S_Gui.Add("Edit", " x+10 yp w120 hp -Wrap vCBorderColor", This.CustomColors_AllBColors)
This.S_Gui["CBorderColor"].OnEvent("Change", (obj, *) => Cclors_Eventhandler(obj))
CustomColors.Push This.S_Gui.Add("Edit", " x+10 yp wp hp -Wrap vCTextColor", This.CustomColors_AllTColors)
This.S_Gui["CTextColor"].OnEvent("Change", (obj, *) => Cclors_Eventhandler(obj))
This.S_Gui.Controls.Profile_Settings.PsDDL["Custom Colors"] := CustomColors
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL["Custom Colors"]
v.Visible := 0
Cclors_Eventhandler(obj) {
if (obj.Name = "Ccoloractive") {
This.CustomColorsActive := obj.value
}
else if (obj.Name = "Cchars") {
indexOld := This.IndexcChars
This.CustomColors_AllCharNames := obj.value
if (indexOld < This.IndexcChars) {
obj.value := This.CustomColors_AllCharNames
ControlSend("^{End}", obj.Hwnd)
}
This.NeedRestart := 1
}
else if (obj.Name = "CBorderColor") {
indexOld := This.IndexcBorder
This.CustomColors_AllBColors := obj.value
if (indexOld < This.IndexcBorder) {
obj.value := This.CustomColors_AllBColors
ControlSend("^{End}", obj.Hwnd)
}
This.NeedRestart := 1
}
else if (obj.Name = "CTextColor") {
indexOld := This.IndexcText
This.CustomColors_AllTColors := obj.value
if (indexOld < This.IndexcText) {
obj.value := This.CustomColors_AllTColors
ControlSend("^{End}", obj.Hwnd)
}
This.NeedRestart := 1
}
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
}
Hotkey_GroupsCtrl() {
This.S_Gui.Controls.Profile_Settings.PsDDL["Hotkey Groups"] := [], Hotkey_Groups := []
Hotkey_Groups.Push This.S_Gui.Add("GroupBox", "x20 y80 h440 w500 Section", "")
Hotkey_Groups.Push This.S_Gui.Add("Text", "x58 yp+130", "Select Group:")
ddl := This.S_Gui.Add("DropDownList", " xp-30 yp+18 w180 vHotkeyGroupDDL", This.GetGroupList())
Hotkey_Groups.Push ddl
This.S_Gui["HotkeyGroupDDL"].OnEvent("Change", (*) => SetEditText(ddl, EditBox, HKForwards, HKBackwards))
DeleteButton := This.S_Gui.Add("Button", "xs+370 yp-1 w60", "Delete")
NewButton := This.S_Gui.Add("Button", "x+5 yp w60", "New")
DeleteButton.OnEvent("Click", (*) => Delete_Group(ddl, HKForwards, HKBackwards, EditBox))
NewButton.OnEvent("Click", (*) => CreateNewGroup(ddl, HKForwards, HKBackwards, EditBox))
Hotkey_Groups.Push DeleteButton
Hotkey_Groups.Push NewButton
EditBox := This.S_Gui.Add("Edit", "xs+8 y275 w250 h225 -Wrap +HScroll Disabled vHKCharlist")
Hotkey_Groups.Push EditBox
This.S_Gui["HKCharlist"].OnEvent("Change", (obj, *) => SaveHKGroupList(obj))
Hotkey_Groups.Push This.S_Gui.Add("Text", "xs300 yp20", "Forwards Hotkey:")
HKForwards := This.S_Gui.Add("Edit", "xp yp+20 w150 Disabled vForwardsKey")
Hotkey_Groups.Push HKForwards
This.S_Gui["ForwardsKey"].OnEvent("Change", (obj, *) => SaveHKGroupList(obj))
Hotkey_Groups.Push This.S_Gui.Add("Text", "xp yp50", "Backwards Hotkey:")
HKBackwards := This.S_Gui.Add("Edit", "xp yp+20 w150 Disabled vBackwardsdKey")
Hotkey_Groups.Push HKBackwards
This.S_Gui["BackwardsdKey"].OnEvent("Change", (obj, *) => SaveHKGroupList(obj))
This.S_Gui.Controls.Profile_Settings.PsDDL["Hotkey Groups"] := Hotkey_Groups
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL["Hotkey Groups"]
v.Visible := 0
CreateNewGroup(ddlObj, ForwardHKObj, BackwardHKObj, EditObj) {
ArrayIndex := 0
Obj := InputBox("Enter a Groupname", "Create New Group", "w200 h90")
if (Obj.Result != "OK")
return
This.Hotkey_Groups[Obj.value] := []
ddlObj.Delete()
ddlObj.Add(This.GetGroupList())
for k in This.Hotkey_Groups {
if k = Obj.value {
ArrayIndex := A_Index
break
}
}
EditObj.value := "", ForwardHKObj.value := "", BackwardHKObj.value := ""
ForwardHKObj.Enabled := 1, BackwardHKObj.Enabled := 1, EditObj.Enabled := 1
ddlObj.Choose(ArrayIndex)
This.NeedRestart := 1
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
Delete_Group(ddlObj, ForwardHKObj, BackwardHKObj, EditObj) {
if (ddlObj.Text != "" && This.Hotkey_Groups.Has(ddlObj.Text))
This.Hotkey_Groups.Delete(ddlObj.Text)
ddlObj.Delete()
ddlObj.Add(This.GetGroupList())
ForwardHKObj.value := "", BackwardHKObj.value := "", EditObj.value := ""
ForwardHKObj.Enabled := 0, BackwardHKObj.Enabled := 0, EditObj.Enabled := 0
This.NeedRestart := 1
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
SetEditText(ddlObj, EditObj, ForwardHKObj?, BackwardHKObj?) {
text := ""
if (ddlObj.Text != "" && This.Hotkey_Groups.Has(ddlObj.Text)) {
for index, Names in This.Hotkey_Groups[ddlObj.Text]["Characters"] {
text .= Names "`n"
}
EditObj.value := text, EditObj.Enabled := 1
ForwardHKObj.value := This.Hotkey_Groups[ddlObj.Text]["ForwardsHotkey"], ForwardHKObj.Enabled := 1
BackwardHKObj.value := This.Hotkey_Groups[ddlObj.Text]["BackwardsHotkey"], BackwardHKObj.Enabled := 1
}
}
SaveHKGroupList(obj) {
if (obj.Name = "HKCharlist" && ddl.Text != "") {
Arr := []
for k, v in StrSplit(obj.value, "`n") {
Chars := Trim(v, "`n ")
if (Chars = "")
continue
Arr.Push(Chars)
}
This.Hotkey_Groups[ddl.Text]["Characters"] := Arr
}
else if (obj.Name = "ForwardsKey" && ddl.Text != "") {
This.Hotkey_Groups[ddl.Text]["ForwardsHotkey"] := Trim(obj.value, "`n ")
}
else if (obj.Name = "BackwardsdKey" && ddl.Text != "") {
This.Hotkey_Groups[ddl.Text]["BackwardsHotkey"] := Trim(obj.value, "`n ")
}
This.NeedRestart := 1
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
}
HotkeysCtrl() {
This.S_Gui.Controls.Profile_Settings.PsDDL["Hotkeys"] := [], Hotkeys := []
Hotkeys.Push This.S_Gui.Add("GroupBox", "x20 y80 h530 w500 Section", "")
Charlist := "", Hklist := ""
for index, value in This._Hotkeys {
for name, hotkey in value {
Charlist .= name "`n"
Hklist .= hotkey "`n"
}
}
Hotkeys.Push This.S_Gui.Add("Text", " x115 yp+130 section", "Charactername:")
HKCharList := This.S_Gui.Add("Edit", " xp-30 yp20 w180 h350 -Wrap vHotkeyCharList", Charlist)
Hotkeys.Push HKCharList
HKCharList.OnEvent("Change", (obj, *) => EventHandler(obj))
Hotkeys.Push This.S_Gui.Add("Text", " xs+210 ys", "Hotkeys:")
HKKeylist := This.S_Gui.Add("Edit", " xp-50 yp20 w180 h350 -Wrap vHotkeyList", Hklist)
Hotkeys.Push HKKeylist
HKKeylist.OnEvent("Change", (obj, *) => EventHandler(obj))
This.S_Gui.Controls.Profile_Settings.PsDDL["Hotkeys"] := Hotkeys
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL["Hotkeys"]
v.Visible := 0
;Parse All hotkeys to a Array on value change
EventHandler(obj) {
tempvar := []
ListChars := StrSplit(This.S_Gui["HotkeyCharList"].value, "`n"), ListHotkeys := StrSplit(This.S_Gui["HotkeyList"].value, "`n")
for k, v in ListChars {
chars := "", keys := ""
if (A_Index <= ListChars.Length) {
chars := Trim(ListChars[A_Index], "`n ")
}
if (A_Index <= ListHotkeys.Length) {
keys := Trim(ListHotkeys[A_Index], "`n ")
}
if (A_Index > ListHotkeys.Length) {
keys := ""
}
if (chars = "")
continue
tempvar.Push Map(chars, keys)
}
this._Hotkeys := tempvar
This.NeedRestart := 1
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
}
ThumbnailSettings_Ctrl() {
This.S_Gui.Controls.Profile_Settings.PsDDL["Thumbnail Settings"] := [], ThumbnailSettings := []
ThumbnailSettings.Push This.S_Gui.Add("GroupBox", "x20 y80 h530 w500 Section", "")
ThumbnailSettings.Push This.S_Gui.Add("Text", "xp+15 yp+140 Section", "Show Thumbnail Text Overlay:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Thumbnail Text Color:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Thumbnail Text Size:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Thumbnail Text Font:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Thumbnail Text Margins:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Client Highligt Color:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Client Highligt Border thickness:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Show Client Highlight Border:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Hide Thumbnails On Lost Focus:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Thumbnail Opacity:")
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "Show Thumbnails AlwaysOnTop:")
ThumbnailSettings.Push This.S_Gui.Add("CheckBox", "xs+230 ys Section vShowThumbnailTextOverlay Checked" This.ShowThumbnailTextOverlay, "On/Off")
This.S_Gui["ShowThumbnailTextOverlay"].OnEvent("Click", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("Edit", "xs y+11 w120 vThumbnailTextColor -Wrap", This.ThumbnailTextColor)
ThumbnailSettings.Push This.S_Gui.Add("Text", " x+5 yp+3 ", "Hex or RGB")
This.S_Gui["ThumbnailTextColor"].OnEvent("Change", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("Edit", "xs y+10 w30 vThumbnailTextSize -Wrap", This.ThumbnailTextSize)
This.S_Gui["ThumbnailTextSize"].OnEvent("Change", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("Edit", "xs y+8 w120 vThumbnailTextFont -Wrap", This.ThumbnailTextFont)
This.S_Gui["ThumbnailTextFont"].OnEvent("Change", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+12", "width px:")
ThumbnailSettings.Push This.S_Gui.Add("Edit", "x+5 yp-4 w40 vThumbnailTextMarginsx -Wrap", This.ThumbnailTextMargins["x"])
This.S_Gui["ThumbnailTextMarginsx"].OnEvent("Change", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs+100 yp+4 ", "height px:")
ThumbnailSettings.Push This.S_Gui.Add("Edit", "xp+60 yp-4 w40 vThumbnailTextMarginsy -Wrap", This.ThumbnailTextMargins["y"])
This.S_Gui["ThumbnailTextMarginsy"].OnEvent("Change", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("Edit", "xs y+7 w120 vClientHighligtColor -Wrap", This.ClientHighligtColor)
ThumbnailSettings.Push This.S_Gui.Add("Text", " x+5 yp+3 ", "Hex or RGB")
This.S_Gui["ClientHighligtColor"].OnEvent("Change", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "px:")
ThumbnailSettings.Push This.S_Gui.Add("Edit", "x+5 yp-3 w30 vClientHighligtBorderthickness -Wrap", This.ClientHighligtBorderthickness)
This.S_Gui["ClientHighligtBorderthickness"].OnEvent("Change", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("CheckBox", "xs y+10 vShowClientHighlightBorder Checked" This.ShowClientHighlightBorder, "On/Off")
This.S_Gui["ShowClientHighlightBorder"].OnEvent("Click", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("CheckBox", "xs y+16 vHideThumbnailsOnLostFocus Checked" This.HideThumbnailsOnLostFocus, "On/Off")
This.S_Gui["HideThumbnailsOnLostFocus"].OnEvent("Click", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("Text", " xs y+15 ", "%")
ThumbnailSettings.Push This.S_Gui.Add("Edit", "x+4 yp-4 w40 vThumbnailOpacity -Wrap", IntegerToPercentage(This.ThumbnailOpacity))
This.S_Gui["ThumbnailOpacity"].OnEvent("Change", (obj, *) => ThumbnailSettings_EventHandler(obj))
ThumbnailSettings.Push This.S_Gui.Add("CheckBox", "xs y+12 vShowThumbnailsAlwaysOnTop Checked" This.ShowThumbnailsAlwaysOnTop, "On/Off")
This.S_Gui["ShowThumbnailsAlwaysOnTop"].OnEvent("Click", (obj, *) => ThumbnailSettings_EventHandler(obj))
This.S_Gui.Controls.Profile_Settings.PsDDL["Thumbnail Settings"] := ThumbnailSettings
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL["Thumbnail Settings"] {
v.Visible := 0
}
;Parse All hotkeys to a Array on value change
ThumbnailSettings_EventHandler(obj) {
if (obj.name = "ShowThumbnailTextOverlay") {
This.ShowThumbnailTextOverlay := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ThumbnailTextColor") {
This.ThumbnailTextColor := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ThumbnailTextSize") {
This.ThumbnailTextSize := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ThumbnailTextFont") {
This.ThumbnailTextFont := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ThumbnailTextMarginsx") {
This.ThumbnailTextMargins["x"] := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ThumbnailTextMarginsy") {
This.ThumbnailTextMargins["y"] := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ClientHighligtColor") {
This.ClientHighligtColor := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ClientHighligtBorderthickness") {
This.ClientHighligtBorderthickness := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ShowClientHighlightBorder") {
This.ShowClientHighlightBorder := obj.value
}
else if (obj.name = "HideThumbnailsOnLostFocus") {
This.HideThumbnailsOnLostFocus := obj.value
}
else if (obj.name = "ThumbnailOpacity") {
This.ThumbnailOpacity := obj.value
This.NeedRestart := 1
}
else if (obj.name = "ShowThumbnailsAlwaysOnTop") {
This.ShowThumbnailsAlwaysOnTop := obj.value
This.NeedRestart := 1
}
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
}
Thumbnail_visibilityCtrl() {
This.S_Gui.Controls.Profile_Settings.PsDDL["Thumbnail Visibility"] := [], Thumbnail_visibility := []
Thumbnail_visibility.Push This.S_Gui.Add("GroupBox", "x20 y80 h610 w500 Section", "")
Thumbnail_visibility.Push This.S_Gui.Add("Text", "xp+140 yp+130 w250", "Select any Client to hide the Thumbnail")
This.Tv_LV := This.S_Gui.Add("ListView", "xp+15 yp+30 w210 Checked -LV0x10 -Multi r20 -Sort vVisibility_List", ["Client Name "])
Thumbnail_visibility.Push This.Tv_LV
for k, v in This.compare_openclients_with_list() {
if (k != "EVE" || v != "") {
if This.Thumbnail_visibility.Has(v)
This.Tv_LV.Add("Check", v,)
else
This.Tv_LV.Add("", v,)
}
}
This.Tv_LV.ModifyCol(1, 150), This.Tv_LV.ModifyCol(2, 115)
This.Tv_LV.OnEvent("ItemCheck", ObjBindMethod(This, "_Tv_LVSelectedRow"))
This.S_Gui.Controls.Profile_Settings.PsDDL["Thumbnail Visibility"] := Thumbnail_visibility
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL["Thumbnail Visibility"]
v.Visible := 0
}
On_WM_MOUSEMOVE(wParam, lParam, msg, Hwnd) {
static PrevHwnd := 0
if (Hwnd != PrevHwnd) {
Text := "", ToolTip() ; Turn off any previous tooltip.
CurrControl := GuiCtrlFromHwnd(Hwnd)
if CurrControl {
if !CurrControl.HasProp("ToolTip")
return ; No tooltip for this control.
Text := CurrControl.ToolTip
SetTimer () => ToolTip(Text), -1000
SetTimer () => ToolTip(), -4000 ; Remove the tooltip.
}
PrevHwnd := Hwnd
}
}
Profiles_to_Array() {
ll := []
for k, v in This.Profiles
ll.Push(k)
return ll
}
Dont_Minimize_List() {
list := ""
for k in This.Dont_Minimize_Clients {
list .= k "`n"
}
return list
}
_Button_Load(obj?,*) {
if (IsSet(obj))
This.NeedRestart := 1
This.LastUsedProfile := This.S_Gui["SelectedProfile"].Text
This.Refresh_ControlValues()
if (This.S_Gui["SelectedProfile"].Text = "Default") {
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL {
for _, ob in v {
ob.Enabled := 0
}
}
}
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
Refresh_ControlValues() {
; Global Settings
This.S_Gui["Suspend_Hotkeys_Hotkey"].value := This.Suspend_Hotkeys_Hotkey
This.S_Gui["Hotkey_Scoope"].value := (This.Global_Hotkeys ? 1 : 2)
This.S_Gui["ThumbnailBackgroundColor"].value := This.ThumbnailBackgroundColor
This.S_Gui["ThumbnailStartLocationx"].value := This.ThumbnailStartLocation["x"]
This.S_Gui["ThumbnailStartLocationy"].value := This.ThumbnailStartLocation["y"]
This.S_Gui["ThumbnailStartLocationwidth"].value := This.ThumbnailStartLocation["width"]
This.S_Gui["ThumbnailStartLocationheight"].value := This.ThumbnailStartLocation["height"]
This.S_Gui["ThumbnailMinimumSizewidth"].value := This.ThumbnailMinimumSize["width"]
This.S_Gui["ThumbnailMinimumSizeheight"].value := This.ThumbnailMinimumSize["height"]
This.S_Gui["ThumbnailSnapOn"].value := This.ThumbnailSnap
This.S_Gui["ThumbnailSnapOff"].value := (This.ThumbnailSnap ? 0 : 1)
This.S_Gui["ThumbnailSnap_Distance"].value := This.ThumbnailSnap_Distance
;Client Settings
This.S_Gui["MinimizeInactiveClients"].value := This.MinimizeInactiveClients
This.S_Gui["Minimizeclients_Delay"].value := This.Minimizeclients_Delay
This.S_Gui["AlwaysMaximize"].value := This.AlwaysMaximize
This.S_Gui["Dont_Minimize_Clients"].value := This.Dont_Minimize_List()
;Custom Colors
This.S_Gui["Ccoloractive"].value := This.CustomColorsActive
This.S_Gui["Cchars"].value := This.CustomColors_AllCharNames
This.S_Gui["CBorderColor"].value := This.CustomColors_AllBColors
This.S_Gui["CTextColor"].value := This.CustomColors_AllTColors
;Hotkey Groups
This.S_Gui["HotkeyGroupDDL"].Delete()
This.S_Gui["HotkeyGroupDDL"].Add(This.GetGroupList())
This.S_Gui["ForwardsKey"].value := "", This.S_Gui["ForwardsKey"].Enabled := 0
This.S_Gui["BackwardsdKey"].value := "", This.S_Gui["BackwardsdKey"].Enabled := 0
This.S_Gui["HKCharlist"].value := "", This.S_Gui["HKCharlist"].Enabled := 0
;Hotkeys
Charlist := "", Hklist := ""
for index, value in This._Hotkeys {
for name, hotkey in value {
Charlist .= name "`n"
Hklist .= hotkey "`n"
}
}
This.S_Gui["HotkeyCharList"].value := Charlist
This.S_Gui["HotkeyList"].value := Hklist
;Thumbnail Settings
This.S_Gui["ShowThumbnailTextOverlay"].value := This.ShowThumbnailTextOverlay
This.S_Gui["ThumbnailTextColor"].value := This.ThumbnailTextColor
This.S_Gui["ThumbnailTextSize"].value := This.ThumbnailTextSize
This.S_Gui["ThumbnailTextFont"].value := This.ThumbnailTextFont
This.S_Gui["ThumbnailTextMarginsx"].value := This.ThumbnailTextMargins["x"]
This.S_Gui["ThumbnailTextMarginsy"].value := This.ThumbnailTextMargins["y"]
This.S_Gui["ClientHighligtColor"].value := This.ClientHighligtColor
This.S_Gui["ClientHighligtBorderthickness"].value := This.ClientHighligtBorderthickness
This.S_Gui["ShowClientHighlightBorder"].value := This.ShowClientHighlightBorder
This.S_Gui["HideThumbnailsOnLostFocus"].value := This.HideThumbnailsOnLostFocus
This.S_Gui["ThumbnailOpacity"].value := IntegerToPercentage(This.ThumbnailOpacity)
This.S_Gui["ShowThumbnailsAlwaysOnTop"].value := This.ShowThumbnailsAlwaysOnTop
;Thumbnail Visibility
This.S_Gui["Visibility_List"].Delete()
for k, v in This.compare_openclients_with_list() {
if (k != "EVE" || v != "") {
if This.Thumbnail_visibility.Has(v)
This.Tv_LV.Add("Check", v,)
else
This.Tv_LV.Add("", v,)
}
}
for k, v in This.S_Gui.Controls.Profile_Settings.PsDDL {
for _, ob in v {
ob.Enabled := 1
}
This.S_Gui["HKCharlist"].Enabled := 0
This.S_Gui["ForwardsKey"].Enabled := 0
This.S_Gui["BackwardsdKey"].Enabled := 0
}
}
compare_openclients_with_list() {
EvENameList := []
for EveHwnd in This.ThumbWindows.OwnProps() {
try {
if title := This.CleanTitle(WinGetTitle("Ahk_Id " EveHwnd) = "") {
continue
}
EvENameList.Push This.CleanTitle(WinGetTitle("Ahk_Id " EveHwnd))
}
}
return EvENameList
}
GetGroupList() {
List := []
if (IsObject(This.Hotkey_Groups)) {
for k in This.Hotkey_Groups {
List.Push(k)
}
return List
}
else
return []
}
}
;Class End
IntegerToPercentage(integerValue) {
percentage := (integerValue < 0 ? 0 : integerValue > 255 ? 100 : Round(integerValue * 100 / 255))
return percentage
}
CompareArrays(arr1, arr2) {
commonValues := {}
for _, value in arr1 {
if (IsInArray(value, arr2))
commonValues.%value% := 1
else
commonValues.%value% := 0
}
for _, value in arr2 {
if (!IsInArray(value, arr1))
commonValues.%value% := 0
}
return commonValues
}
IsInArray(value, arr) {
for _, item in arr {
if (item = value)
return true
}
return false
}

410
src/ThumbWindow.ahk Normal file
View File

@@ -0,0 +1,410 @@

Class ThumbWindow extends Propertys {
Create_Thumbnail(Win_Hwnd, Win_Title) {
ThumbObj := Map()
; Remove the "EVE -" part from the Titel to show only the Name and if no Name is present yet show nothing
ThumbObj["Window"] := Gui("+Owner +LastFound AlwaysOnTop -Caption +ToolWindow -DPIScale +E0x08000000", Win_Title) ;WS_EX_NOACTIVATE -> +E0x08000000
ThumbObj["Window"].OnEvent("Close", GUI_Close_Button)
; The Backcolor which is visible when no thumbnail is displayed
Try
ThumbObj["Window"].BackColor := This.ThumbnailBackgroundColor
catch as e {
ThumbObj["Window"].BackColor := 0x57504e
This.ThumbnailBackgroundColor := 0x57504e
ThumbObj["Window"].BackColor := This.ThumbnailBackgroundColor
MsgBox( "Invalid Color: Global Settings -> Thumbnail Background Color`n`nUse the following syntax:`n HEX =>: #FFFFFF or 0xFFFFFF or FFFFFF`nRGB =>: 255, 255, 255 or rgb(255, 255, 255)`n`nColor is now set to default")
}
;Enable Shadow
DllCall("Dwmapi\DwmExtendFrameIntoClientArea",
"Ptr", ThumbObj["Window"].Hwnd, ; HWND hWnd
"Ptr", This.margins, ; MARGINS *pMarInset
)
;Set The Opacity who is set in the JSON File, its important to set this on the MainWindow and not on the Thumbnail itself
WinSetTransparent(This.ThumbnailOpacity)
;creates the GUI but Hides it
ThumbObj["Window"].Show("Hide")
WinMove( This.ThumbnailStartLocation["x"],
This.ThumbnailStartLocation["y"],
This.ThumbnailStartLocation["width"],
This.ThumbnailStartLocation["height"]
)
;#### Register Thumbnail
; gets the EVE Window sizes
WinGetClientPos(, , &W, &H, "ahk_id " Win_Hwnd)
; These values for the Thumbnails should not be touched
ThumbObj["Thumbnail"] := LiveThumb(Win_Hwnd, ThumbObj["Window"].Hwnd)
ThumbObj["Thumbnail"].Source := [0, 0, W, H]
ThumbObj["Thumbnail"].Destination := [0, 0, This.ThumbnailStartLocation["width"], This.ThumbnailStartLocation["height"]]
ThumbObj["Thumbnail"].SourceClientAreaOnly := True
ThumbObj["Thumbnail"].Visible := True
ThumbObj["Thumbnail"].Opacity := 255
ThumbObj["Thumbnail"].Update()
;#### Create the Thumbnail TextOverlay
;####
ThumbObj["TextOverlay"] := Gui("AlwaysOnTop +LastFound -Caption +E0x20 +Owner" ThumbObj["Window"].Hwnd, Win_Title) ; WS_EX_CLICKTHROUGH -> +E0x20
ThumbObj["TextOverlay"].MarginX := This.ThumbnailTextMargins["x"]
ThumbObj["TextOverlay"].MarginY := This.ThumbnailTextMargins["y"]
CheckError := 0
if (This.CustomColorsActive) {
if (This.CustomColorsGet[Win_Title]["Char"] != "" && This.CustomColorsGet[Win_Title]["Text"] != "") {
try {
ThumbObj["TextOverlay"].SetFont("s" This.ThumbnailTextSize " q6 w500 c" This.CustomColorsGet[Win_Title]["Text"] , This.ThumbnailTextFont)
}
catch as e {
CheckError := 1
MsgBox("Error: Thumbnail Text Color is wrong´nin: Profile Settings - " This.LastUsedProfile " - Custom Colors -> " Win_Title "`nUse the following syntax:`n HEX =>: #FFFFFF or 0xFFFFFF or FFFFFF`nRGB =>: 255, 255, 255 or rgb(255, 255, 255)")
}
}
else
CheckError := 1
}
if (CheckError || !This.CustomColorsActive) {
try {
ThumbObj["TextOverlay"].SetFont("s" This.ThumbnailTextSize " q6 w500 c" This.ThumbnailTextColor, This.ThumbnailTextFont)
}
catch as e {
MsgBox("Error: Thumbnail Text Color Or Thumbnail Text Font are wrong´nin: Profile Settings - " This.LastUsedProfile " - Thumbnail Settings`nUse the following syntax:`n HEX =>: #FFFFFF or 0xFFFFFF or FFFFFF`nRGB =>: 255, 255, 255 or rgb(255, 255, 255)`nValues are now Set to Default")
This.ThumbnailTextSize := "12", This.ThumbnailTextColor := "0xfac57a", This.ThumbnailTextFont := "Gill Sans MT"
ThumbObj["TextOverlay"].SetFont("s" This.ThumbnailTextSize " q6 w500 c" This.ThumbnailTextColor, This.ThumbnailTextFont)
}
}
ThumbTitle := ThumbObj["TextOverlay"].Add("Text", "vOverlayText w" This.ThumbnailStartLocation["width"], Win_Title)
;Sets a Color for the Text Control to make it also invisible, same as background color
ThumbTitle.Opt("+Background040101")
ThumbObj["TextOverlay"].BackColor := "040101" ;Sets a Color for the Text Control to make it also invisible, same as background color
WinSetTransColor("040101")
ThumbObj["TextOverlay"].Show("Hide")
WinMove(This.ThumbnailStartLocation["x"],
This.ThumbnailStartLocation["y"],
This.ThumbnailStartLocation["width"],
This.ThumbnailStartLocation["height"]
)
;#### Create Borders
;####
border_thickness := This.ClientHighligtBorderthickness
border_color := This.ClientHighligtColor
ThumbObj["Border"] := Gui("-Caption +E0x20 +Owner" ThumbObj["Window"].Hwnd)
CheckError := 0
if (This.CustomColorsActive) {
if (This.CustomColorsGet[Win_Title]["Char"] != "" && This.CustomColorsGet[Win_Title]["Border"] != "") {
try {
ThumbObj["Border"].BackColor := This.CustomColorsGet[Win_Title]["Border"]
}
catch as e {
CheckError := 1
MsgBox("Error: Client Highligt Color are wrong´nin: Profile Settings - " This.LastUsedProfile " - Custom Colors - " Win_Title "`nUse the following syntax:`n HEX =>: #FFFFFF or 0xFFFFFF or FFFFFF`nRGB =>: 255, 255, 255 or rgb(255, 255, 255)")
}
}
else
CheckError := 1
}
if (CheckError || !This.CustomColorsActive) {
try {
ThumbObj["Border"].BackColor := border_color
}
catch as e {
MsgBox("Error: Client Highligt Color are wrong´nin: Profile Settings - " This.LastUsedProfile " - Thumbnail Settings`nUse the following syntax:`n HEX =>: #FFFFFF or 0xFFFFFF or FFFFFF`nRGB =>: 255, 255, 255 or rgb(255, 255, 255)`nValues are now Set to Default")
This.ClientHighligtColor := "0xe36a0d"
ThumbObj["Border"].BackColor := This.ClientHighligtColor
}
}
size := This.BorderSize(ThumbObj["Window"].Hwnd, ThumbObj["Border"].Hwnd)
ThumbObj["Border"].Show("w" size.w " h" size.h " x" size.x " y" size.y "NoActivate Hide")
return ThumbObj
GUI_Close_Button(*) {
return
}
}
BorderSize(DesinationHwnd, BorderHwnd) {
border_thickness := This.ClientHighligtBorderthickness
WinGetPos(&dx, &dy, &dw, &dh, DesinationHwnd)
offset := 0
outerX := offset
outerY := offset
outerX2 := dw - offset
outerY2 := dh - offset
innerX := border_thickness + offset
innerY := border_thickness + offset
innerX2 := dw - border_thickness - offset
innerY2 := dh - border_thickness - offset
newX := dx
newY := dy
newW := dw
newH := dh
WinSetRegion(outerX "-" outerY " " outerX2 "-" outerY " " outerX2 "-" outerY2 " " outerX "-" outerY2 " " outerX "-" outerY " " innerX "-" innerY " " innerX2 "-" innerY " " innerX2 "-" innerY2 " " innerX "-" innerY2 " " innerX "-" innerY, BorderHwnd)
return { x: newX, y: newY, w: newW, h: newH }
}
;## Moves the Window by holding down the Right Mousebutton
;## By Holding CTRL and SHIFT it moves all Windows
Mouse_DragMove(wparam, lparam, msg, hwnd) {
This.Resize := 1
dragging := 0
ThumbMap := Map()
MouseGetPos(&x0, &y0, &window_id) ;gets the current Mouse possition
if !(This.ThumbHwnd_EvEHwnd.Has(window_id))
return
WinGetPos &wx, &wy, &wn, &wh, window_id ;gets the current window possition what the user clicks on
;Store the current size and position of all Thumbnails
for ThumbIDs in This.ThumbHwnd_EvEHwnd {
if (ThumbIDs == This.ThumbHwnd_EvEHwnd[hwnd])
continue
if This.ThumbWindows.HasProp(This.ThumbHwnd_EvEHwnd[ThumbIDs]) {
for k, v in This.ThumbWindows.%This.ThumbHwnd_EvEHwnd[ThumbIDs]% {
WinGetPos(&Tempx, &Tempy, , , v.Hwnd)
ThumbMap[v.Hwnd] := { x: Tempx, y: Tempy }
}
}
}
while (GetKeyState("RButton") && !GetKeyState("LButton")) {
;Moves a Single Window
MouseGetPos &x, &y
Nx := x - x0, NEUx := wx + Nx ;Nx -> stores the pixel diffrenz from Start to stop Moveing, NEUx -> Calculates the new Position
Ny := y - y0, NEUy := wy + Ny ;Ny -> stores the pixel diffrenz from Start to stop Moveing, NEUy -> Calculates the new Position
if This.ThumbWindows.HasProp(This.ThumbHwnd_EvEHwnd[hwnd]) {
for k, v in This.ThumbWindows.%This.ThumbHwnd_EvEHwnd[hwnd]% {
WinMove(NEUx, NEUy, , , v.Hwnd)
}
}
;Moves all windows
if (wparam = 10) { ; Ctrl+RButton
for k, v in This.ThumbWindows.OwnProps() {
for type, Obj in v {
if (hwnd == Obj.Hwnd)
continue
;Calculates the new Position for all the other Windows
Ax := ThumbMap[Obj.Hwnd].x + Nx
Ay := ThumbMap[Obj.Hwnd].y + Ny
WinMove(Ax, Ay, , , Obj.Hwnd)
}
}
}
}
}
; wparam, lparam, msg, hwnd
Mouse_ResizeThumb(wparam, lparam, msg, hwnd) {
This.Resize := 0
while (GetKeyState("LButton") && GetKeyState("RButton")) {
Sleep 10
if !(This.Resize) {
WinGetPos(&Rx, &Ry, &Width, &Height, hwnd)
MouseGetPos(&Bx, &By)
This.Resize := 1
}
MouseGetPos(&DragX, &DragY)
x := DragX - Bx, Wn := Width + x
y := DragY - BY, Wh := Height + y
;ensures that the minimum size cannot be undershot
if (Wn < This.ThumbnailMinimumSize["width"]) {
Wn := This.ThumbnailMinimumSize["width"]
}
if (Wh < This.ThumbnailMinimumSize["height"]) {
Wh := This.ThumbnailMinimumSize["height"]
}
for k, v in This.ThumbWindows.%This.ThumbHwnd_EvEHwnd[hwnd]% {
WinMove(, , Wn, Wh, v.hwnd)
}
This.Update_Thumb(false, hwnd)
This.BorderSize(This.ThumbWindows.%This.ThumbHwnd_EvEHwnd[hwnd]%["Window"].Hwnd, This.ThumbWindows.%This.ThumbHwnd_EvEHwnd[hwnd]%["Border"].Hwnd)
if (!GetKeyState("LCtrl")) {
for ThumbIDs in This.ThumbHwnd_EvEHwnd {
if (ThumbIDs == This.ThumbHwnd_EvEHwnd[hwnd])
continue
for k, v in This.ThumbWindows.%This.ThumbHwnd_EvEHwnd[ThumbIDs]% {
if k = "Window"
window := v.Hwnd
WinMove(, , Wn, Wh, v.Hwnd)
if (k = "Border") {
border := v.Hwnd
}
if (k = "TextOverlay") {
TextOverlay := v.Hwnd
;WinMove(,,Wn,Wh, v.Hwnd )
continue
}
}
This.BorderSize(window, border)
}
This.Update_Thumb()
}
}
}
; Snaps the window to the nearest corner of another window if it is within SnapRange in pixels
Window_Snap(hwnd, GuiObject, SnapRange := 20) {
if (This.ThumbnailSnap) {
SnapRange := This.ThumbnailSnap_Distance
;stores the coordinates of the corners from moving window
WinGetPos(&X, &Y, &Width, &Height, hwnd)
A_RECT := { TL: [X, Y],
TR: [X + Width, Y],
BL: [X, Y + Height],
BR: [X + Width, Y + Height] }
destX := X, destY := Y, shouldMove := false
;loops through all created GUIs and checks the distanz between the corners
for index, _Gui in GuiObject.OwnProps() {
if (hwnd = _Gui["Window"].Hwnd) {
continue
}
WinGetPos(&X, &Y, &Width, &Height, _Gui["Window"].Hwnd)
Gui_RECT := { TL: [X, Y],
TR: [X + Width, Y],
BL: [X, Y + Height],
BR: [X + Width, Y + Height] }
for _, corner in A_RECT.OwnProps() {
for _, neighborCorner in Gui_RECT.OwnProps() {
dist := Distance(corner, neighborCorner)
if (dist <= SnapRange) {
shouldMove := true
destX := neighborCorner[1] - (corner = A_RECT.TR || corner = A_RECT.BR ? Width : 0)
destY := neighborCorner[2] - (corner = A_RECT.BL || corner = A_RECT.BR ? Height : 0)
}
}
}
}
;If some window is in range then Snap the moving window into it
; Snap the full GUI Obj stack
if (shouldMove) {
for k, v in This.ThumbWindows.%This.ThumbHwnd_EvEHwnd[hwnd]%
WinMove(destX, destY, , , v.Hwnd)
}
}
;Nested Function for the Window Calculation
Distance(pt1, pt2) {
return Sqrt((pt1[1] - pt2[1]) ** 2 + (pt1[2] - pt2[2]) ** 2)
}
}
ShowThumb(EVEWindowHwnd, HideOrShow) {
try
title := WinGetTitle("Ahk_Id " EVEWindowHwnd)
catch
title := 0
if (!This.Thumbnail_visibility.Has(This.CleanTitle(title))) {
if (HideOrShow = "Show") {
for k, v in This.ThumbWindows.%EVEWindowHwnd% {
if (k = "Thumbnail")
continue
if (k = "Border" && !This.ShowAllColoredBorders) || (k = "TextOverlay" && !This.ShowThumbnailTextOverlay)
continue
This.ThumbWindows.%EVEWindowHwnd%[k].Show("NoActivate")
This.ThumbWindows.%EVEWindowHwnd%["TextOverlay"].Show("NoActivate")
}
}
else {
if (This.ThumbWindows.%EVEWindowHwnd%["Window"].Title = "") {
This.ThumbWindows.%EVEWindowHwnd%["Border"].Show("Hide")
return
}
for k, v in This.ThumbWindows.%EVEWindowHwnd% {
if (k = "Thumbnail")
continue
This.ThumbWindows.%EVEWindowHwnd%[k].Show("Hide")
}
}
}
}
Update_Thumb(AllOrOne := true, ThumbHwnd?) {
If (AllOrOne && !IsSet(ThumbHwnd)) {
for EvEHwnd, ThumbObj in This.ThumbWindows.OwnProps() {
for Name, Obj in ThumbObj {
if (Name = "Window") {
WinGetPos(, , &TWidth, &THeight, Obj.Hwnd)
WinGetClientPos(, , &EWidth, &EHeight, "Ahk_Id" EvEHwnd)
ThumbObj["Thumbnail"].Source := [0, 0, EWidth, EHeight]
ThumbObj["Thumbnail"].Destination := [0, 0, TWidth, THeight]
ThumbObj["Thumbnail"].Update()
}
}
}
}
else {
If (IsSet(ThumbHwnd)) {
WinGetPos(, , &TWidth, &THeight, ThumbHwnd)
WinGetClientPos(, , &EWidth, &EHeight, This.ThumbHwnd_EvEHwnd[ThumbHwnd])
ThumbObj := This.ThumbWindows.%This.ThumbHwnd_EvEHwnd[ThumbHwnd]%
ThumbObj["Thumbnail"].Source := [0, 0, EWidth, EHeight]
ThumbObj["Thumbnail"].Destination := [0, 0, TWidth, THeight]
ThumbObj["Thumbnail"].Update()
}
}
}
ShowActiveBorder(EVEHwnd?, ThumbHwnd?) {
if (IsSet(EVEHwnd) && This.ShowClientHighlightBorder) {
if (This.ThumbWindows.HasProp(EVEHwnd) && !This.ShowAllColoredBorders) {
for EW_Hwnd, Objs in This.ThumbWindows.OwnProps() {
for names, GuiObj in Objs {
if (names = "Border") {
GuiObj.Show("Hide")
}
}
}
}
if !(This.Thumbnail_visibility.Has(This.CleanTitle(WinGetTitle("Ahk_Id " EVEHwnd)))) {
Show_Border := This.ThumbWindows.%EVEHwnd%["Border"]
Show_Border.Show("NoActivate")
}
}
}
}

93
src/TrayMenu.ahk Normal file
View File

@@ -0,0 +1,93 @@

Class TrayMenu extends Settings_Gui {
TrayMenuObj := A_TrayMenu
Saved_overTray := 0
Tray_Profile_scwitch := 0
TrayMenu() {
Profiles_Submenu := Menu()
for k in This.Profiles {
If (k = This.LastUsedProfile) {
Profiles_Submenu.Add(This.LastUsedProfile, MenuHandler)
Profiles_Submenu.Check(This.LastUsedProfile)
}
Profiles_Submenu.Add(k, MenuHandler)
}
;Profiles_Submenu.Add() ;*Seperator line
TrayMenu := This.TrayMenuObj
TrayMenu.Delete() ; Delete the Default TrayMenu Items
TrayMenu.Add("Open", MenuHandler)
TrayMenu.Add() ; Seperator
TrayMenu.Add("Profiles", Profiles_Submenu)
TrayMenu.Add() ; Seperator
TrayMenu.Add("Suspend Hotkeys", MenuHandler)
TrayMenu.Add()
TrayMenu.Add()
TrayMenu.Add("Close all EVE Clients", (*) => This.CloseAllEVEWindows())
TrayMenu.Add()
TrayMenu.Add()
TrayMenu.Add("Restore Client Positions", MenuHandler)
if (This.TrackClientPossitions)
TrayMenu.check("Restore Client Positions")
else
TrayMenu.Uncheck("Restore Client Positions")
TrayMenu.Add("Save Client Positions", (*) => This.Client_Possitions())
TrayMenu.Add()
TrayMenu.Add()
TrayMenu.Add("Save Thumbnail Positions", MenuHandler) ; Creates a separator line.
TrayMenu.Add("Reload", (*) => Reload())
TrayMenu.Add()
TrayMenu.Add("Exit", (*) => ExitApp()) ; Creates a new menu item.
TrayMenu.Default := "Open"
MenuHandler(ItemName, ItemPos, MyMenu) {
If (ItemName = "Exit")
ExitApp
Else if (ItemName = "Save Thumbnail Positions") {
;* Saved Thumbnail Positions only if the Saved button is used on the Traymenu
This.Save_ThumbnailPossitions
}
Else if (ItemName = "Restore Client Positions") {
This.TrackClientPossitions := !This.TrackClientPossitions
TrayMenu.ToggleCheck("Restore Client Positions")
SetTimer(This.Save_Settings_Delay_Timer, -200)
}
Else if (This.Profiles.Has(ItemName)) {
This.Tray_Profile_scwitch := 1
This.LastUsedProfile := ItemName
This.Save_Settings()
This.Tray_Profile_scwitch := 0
Reload()
}
Else if (ItemName = "Open") {
if WinExist("EVE-X-Preview - Settings") {
WinActivate("EVE-X-Preview - Settings")
Return
}
This.MainGui()
}
Else If (ItemName = "Suspend Hotkeys") {
Suspend(-1)
TrayMenu.ToggleCheck("Suspend Hotkeys")
}
}
}
CloseAllEVEWindows(*) {
try {
list := WinGetList("Ahk_Exe exefile.exe")
GroupAdd("EVE", "Ahk_Exe exefile.exe")
for k in list {
PostMessage 0x0112, 0xF060, , , k
Sleep(50)
}
}
}
}