-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindowExtensions.ahk
128 lines (107 loc) · 4.1 KB
/
WindowExtensions.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
CoordMode, Mouse, Screen
SetFormat, float, 0.0
SetBatchLines, 10ms
SetTitleMatchMode, 2
;--------------------------------------------------------------------------------
; Application Details
AppName := "WindowExtensions"
AppTitle := "Window Extensions"
AppDescription := "Window Extensions Menu and HotKeys"
AppCopyright := "Copyright © 2020 Martin Smith"
AppNotes := "Concise and consistent control over Window Positions. Right-click right half of Window Caption bar to invoke, or hit WinKey-W"
AppURL := "https://github.com/martinsmith1968/WindowExtensions"
AppVersion := "1.6.7.0"
;--------------------------------------------------------------------------------
; Includes
#Include Lib\Logging.ahk
LogInit()
;--------------------------------------------------------------------------------
; System Information
SysGet, G_CaptionHeight, 4 ; SM_CYCAPTION
SysGet, G_BorderHeight, 5 ; SM_CXBORDER
SysGet, G_MenuDropAlignment, 40 ; SM_MENUDROPALIGNMENT
SysGet, G_MonitorCount, MonitorCount
SysGet, G_PrimaryMonitorIndex, MonitorPrimary
SplitPath A_ScriptFullPath, , ScriptFilePath, , ScriptFileNameNoExt
IconLibraryFileName := ScriptFilePath . "\" . ScriptFileNameNoExt . ".icl"
G_CaptionHitHeight := G_CaptionHeight + (G_BorderHeight * 2)
G_LeftAlignedMenus := (G_MenuDropAlignment = 0)
LogText("G_CaptionHeight: " G_CaptionHeight)
LogText("G_BorderHeight: " G_BorderHeight)
LogText("G_MonitorCount: " G_MonitorCount)
LogText("G_PrimaryMonitorIndex: " G_PrimaryMonitorIndex)
LogText("G_CaptionHitHeight: " G_CaptionHitHeight)
LogText("G_LeftAlignedMenus: " G_LeftAlignedMenus)
;--------------------------------------------------------------------------------
; Globals Declarations
G_UserConfig :=
G_ActiveWindow :=
G_CurrentMouse :=
G_MenuTitle := AppTitle
OnExit, ExitHandler
;--------------------------------------------------------------------------------
; Auto-Execute section
OnInit() ; Perform module initialisation - not reliant on other modules or globals
InitGlobals() ;
OnStartup() ; Perform module startup - may rely on other modules Init
return ; End of script's auto-execute section.
;--------------------------------------------------------------------------------
; Exit Handler
ExitHandler:
LogText("Raising OnExit...")
OnExit()
LogText("Exiting...")
; Must do this for the OnExit subroutine to actually Exit the script.
ExitApp
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Modules
#Include TrayMenu.ahk
#include WindowMenu.ahk
#Include WindowHotKeys.ahk
#Include WindowExtensionsUserConfigGui.ahk
#Include AboutGui.ahk
;--------------------------------------------------------------------------------
; Initialise global variables once everything else initialised
InitGlobals()
{
global G_UserConfig
G_UserConfig := new WindowExtensionsUserConfig()
}
;--------------------------------------------------------------------------------
; Module initialisation
OnInit()
{
WindowExtensionsUserConfig_OnInit()
WindowPositions_OnInit()
DesktopIcons_OnInit()
WindowMenu_OnInit()
TrayMenu_OnInit()
}
;--------------------------------------------------------------------------------
; OnStartup event
OnStartup()
{
WindowExtensionsUserConfig_OnStartup()
WindowMenu_OnStartup()
TrayMenu_OnStartup()
}
;--------------------------------------------------------------------------------
; OnExit event
OnExit()
{
WindowMenu_OnExit()
}
;--------------------------------------------------------------------------------
; OnUserConfigUpdated event
OnUserConfigUpdated()
{
BuildWindowMenu()
BuildTrayMenu()
WindowExtensionsUserConfig_OnConfigUpdated()
}