-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrayMenu.ahk
109 lines (82 loc) · 4.06 KB
/
TrayMenu.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
#Include Lib\Logging.ahk
#Include Lib\MenuFunctions.ahk
;--------------------------------------------------------------------------------
; Globals
TrayMenuName :=
;--------------------------------------------------------------------------------
; Initialisation
TrayMenu_OnInit()
{
global TrayMenuName
TrayMenuName := "Tray"
}
;--------------------------------------------------------------------------------
; OnStartup
TrayMenu_OnStartup()
{
BuildTrayMenu()
}
;--------------------------------------------------------------------------------
; Setup Tray Menu
BuildTrayMenu()
{
global AppTitle
global G_UserConfig
global MenuLocationTrayMenu
global TrayMenuName
global IconLibraryFileName
desktopSize := GetDesktopSize()
menuIndex := 0
ResetMenu(TrayMenuName)
Menu, %TrayMenuName%, NoStandard
Menu, %TrayMenuName%, Tip, %AppTitle%
menuIndex := AddMenuItemWithIcon(TrayMenuName, "Con&figure...", "TrayConfigureHandler", A_ScriptFullPath, 0, menuIndex)
; Window Positions
if (ContainsFlag(G_UserConfig.MenuControl_WindowPositionsMenuLocation, MenuLocationTrayMenu))
{
menuIndex := AddMenuItemSeparator(TrayMenuName, menuIndex)
saveTitle := "Save Window &Positions (" . desktopSize.DimensionsText . ")"
menuIndex := AddMenuItemWithIcon(TrayMenuName, saveTitle, "SaveWindowPositionsHandler", IconLibraryFileName, GetIconLibraryIndex("POSITION_SAVE"), menuIndex)
restoreTitle := "Restore Last Window &Positions (" . desktopSize.DimensionsText . ")"
menuIndex := AddMenuItemWithIcon(TrayMenuName, restoreTitle, "RestoreWindowPositionsHandler", IconLibraryFileName, GetIconLibraryIndex("POSITION_RESTORE"), menuIndex)
restoreEnabled := HasSavedWindowPositionsFile(desktopSize)
EnableMenuItem(TrayMenuName, restoreTitle, restoreEnabled)
if (HasMultipleSavedWindowPositionsFiles(desktopSize))
{
restoreTitle := "Restore Window &Positions (" . desktopSize.DimensionsText . ")..."
menuIndex := AddMenuItemWithIcon(TrayMenuName, restoreTitle, "RestoreMultipleWindowPositionsHandler", IconLibraryFileName, GetIconLibraryIndex("POSITION_RESTORE"), menuIndex)
}
}
; Desktop Icons
if (ContainsFlag(G_UserConfig.MenuControl_DesktopIconsMenuLocation, MenuLocationTrayMenu))
{
menuIndex := AddMenuItemSeparator(TrayMenuName, menuIndex)
saveTitle := "Save &Desktop Icons (" . desktopSize.DimensionsText . ")"
menuIndex := AddMenuItemWithIcon(TrayMenuName, saveTitle, "SaveDesktopIconsHandler", IconLibraryFileName, GetIconLibraryIndex("DESKTOPICONS_SAVE"), menuIndex)
restoreTitle := "Restore &Desktop Icons (" . desktopSize.DimensionsText . ")"
menuIndex := AddMenuItemWithIcon(TrayMenuName, restoreTitle, "RestoreDesktopIconsHandler", IconLibraryFileName, GetIconLibraryIndex("DESKTOPICONS_RESTORE"), menuIndex)
restoreEnabled := HasSavedDesktopIconsFile(desktopSize)
EnableMenuItem(TrayMenuName, restoreTitle, restoreEnabled)
if (HasMultipleSavedDesktopIconsFiles(desktopSize))
{
restoreTitle := "Restore &Desktop Icons (" . desktopSize.DimensionsText . ")..."
menuIndex := AddMenuItemWithIcon(TrayMenuName, restoreTitle, "RestoreMultipleDesktopIconsHandler", IconLibraryFileName, GetIconLibraryIndex("DESKTOPICONS_RESTORE"), menuIndex)
}
}
menuIndex := AddMenuItemSeparator(TrayMenuName, menuIndex)
menuIndex := AddMenuItem(TrayMenuName, "&About...", "TrayAboutHandler", menuIndex)
menuIndex := AddMenuItemSeparator(TrayMenuName, menuIndex)
menuIndex := AddMenuItem(TrayMenuName, "Exit", "TrayExitHandler", menuIndex)
}
;--------------------------------------------------------------------------------
TrayConfigureHandler:
ShowConfigGui()
return
;--------------------------------------------------------------------------------
TrayAboutHandler:
ShowAboutGui()
return
;--------------------------------------------------------------------------------
TrayExitHandler:
ExitApp
return