3
3
h2FontStyle:=" s22 w600 c505050 q5"
4
4
textFontStyle:=" s12 w400 cblack q5"
5
5
clientWidth:=320
6
+ header_gap:=" y+20 "
7
+ item_gap:=" y+5 "
6
8
7
9
ahko_setup := Gui (" +ToolWindow +AlwaysOnTop -DPIScale +OwnDialogs" ," ahko setup" )
8
10
ahko_setup.SetFont(, " Microsoft JhengHei" )
@@ -18,7 +20,7 @@ ahko_setup.Add("Text", "x0 y+-50 +BackgroundTrans", "____________________")
18
20
ahko_setup.SetFont(h2FontStyle)
19
21
ahko_setup.Add(" Text" ," x30 y+20 section" , " UI type" )
20
22
ahko_setup.SetFont(textFontStyle)
21
- ahkoSetup_uiType:=ahko_setup.Add(" DropDownList" , " y+10 w" clientWidth, [" Listview" ," Gridview" ," Gridview(Gdip)" ])
23
+ ahkoSetup_uiType:=ahko_setup.Add(" DropDownList" , item_gap " w" clientWidth, [" Listview(Deprecated) " ," Gridview" ," Gridview(Gdip)" ])
22
24
ahkoSetup_uiType.OnEvent(" Change" , uiType_update)
23
25
uiType_update (* ) {
24
26
if (ahkoSetup_uiType.Value>2 ) {
@@ -27,10 +29,10 @@ uiType_update(*) {
27
29
}
28
30
}
29
31
ahko_setup.SetFont(h2FontStyle)
30
- ahko_setup.Add(" Text" , " xs y+30 " , " Watch folder" )
32
+ ahko_setup.Add(" Text" , " xs " header_gap , " Watch folder" )
31
33
ahko_setup.SetFont(textFontStyle)
32
34
buttonWidth:=95
33
- AhkoSetup_path:=ahko_setup.Add(" Edit" , " y+10 r1 w" clientWidth- buttonWidth- 5 , "" )
35
+ AhkoSetup_path:=ahko_setup.Add(" Edit" , item_gap " r1 w" clientWidth- buttonWidth- 5 , "" )
34
36
pathSelectBtn := ahko_setup.Add(" Button" , " x+5 hp w" buttonWidth, " Select" )
35
37
pathSelectBtn.OnEvent(" Click" , setup_path)
36
38
setup_path (* ){
@@ -41,24 +43,81 @@ setup_path(*){
41
43
}
42
44
43
45
ahko_setup.SetFont(h2FontStyle)
44
- ahko_setup.Add(" Text" , " xs y+30 " , " Hotkey" )
46
+ ahko_setup.Add(" Text" , " xs " header_gap , " Hotkey" )
45
47
ahko_setup.SetFont(textFontStyle)
46
- ahkoSetup_hotkey:=ahko_setup.Add(" Hotkey" , " y+10 w" clientWidth- buttonWidth- 5 )
48
+ ahkoSetup_hotkey:=ahko_setup.Add(" Hotkey" , item_gap " w" clientWidth- buttonWidth- 5 )
47
49
ahkoSetup_hotkey.OnEvent(" Change" , hotkeyText_update)
48
50
ahkoSetup_hotkeyWin:=ahko_setup.Add(" CheckBox" , " x+10 hp w" buttonWidth, " Win" )
49
51
ahkoSetup_hotkeyWin.OnEvent(" Click" , hotkeyText_update)
50
52
51
53
ahko_setup.SetFont(" s10" )
52
- ahko_setup.Add(" Text" , " xs y+5 " , " Hotkey is " )
54
+ ahko_setup.Add(" Text" , " xs" item_gap , " Hotkey is " )
53
55
ahkoSetup_hotkeyText:=ahko_setup.Add(" Text" , " x+0 hp cc07070 w260" , "" )
54
56
55
57
ahko_setup.SetFont(h2FontStyle)
56
- ahko_setup.Add(" Text" , " xs y+30 " , " Other " )
58
+ ahko_setup.Add(" Text" , " xs " header_gap , " ahko where " )
57
59
ahko_setup.SetFont(textFontStyle)
58
- ahkoSetup_enable_fullscreen:=ahko_setup.Add(" CheckBox" , " y+10 hp" , " Enable in fullscreen" )
60
+ showAtDDL:=[" Primary monitor" ," Follow mouse" ," Follow active window" ]
61
+ For k, v in isFullScreen.monitors
62
+ {
63
+ showAtDDL.Push(" Monitor #" k)
64
+ }
65
+ ahkoSetup_showAt:=ahko_setup.Add(" DropDownList" , item_gap " w" clientWidth, showAtDDL)
66
+ ahkoSetup_showAt.OnEvent(" Change" , showAt_update)
67
+ showat_from_ddl (dd ) {
68
+ if (dd>=4 ) {
69
+ return dd- 3
70
+ } else if(dd>=1 ) {
71
+ if (dd == 1 ) {
72
+ return 0
73
+ }
74
+ if (dd == 2 ) {
75
+ return 10
76
+ }
77
+ if (dd == 3 ) {
78
+ return 11
79
+ }
80
+ }
81
+ return 1
82
+ }
83
+ ddl_from_showat (sw ) {
84
+ if (sw==0 ) {
85
+ return 1
86
+ }
87
+ if (sw==10 ) {
88
+ return 2
89
+ }
90
+ if (sw==11 ){
91
+ return 3
92
+ }
93
+ if (sw>=1 && sw<=9 ){
94
+ return sw+ 3
95
+ }
96
+ return 1
97
+ }
98
+ showAt_update (* ) {
99
+ global showat
100
+ ; MsgBox(ahkoSetup_showAt.Value)
101
+ if (ahkoSetup_showAt.Value>=4 ) {
102
+ showat:=showat_from_ddl(ahkoSetup_showAt.Value)
103
+ ahko_setup.Show(showat_monitor(showat))
104
+ } else {
105
+ showat:=showat_from_ddl(ahkoSetup_showAt.Value)
106
+ }
107
+ showat_monitor (n ){
108
+ global isFullScreen, ahko_setup
109
+ ahko_setup.GetClientPos(,,& w,& h)
110
+ Return " x" Round (isFullScreen.monitors[n].l+ isFullScreen.monitors[n].r- w)// 2 " y" Round (isFullScreen.monitors[n].t+ isFullScreen.monitors[n].b- h)// 2
111
+ }
112
+ }
113
+
114
+ ahko_setup.SetFont(h2FontStyle)
115
+ ahko_setup.Add(" Text" , " xs " header_gap, " Other" )
116
+ ahko_setup.SetFont(textFontStyle)
117
+ ahkoSetup_enable_fullscreen:=ahko_setup.Add(" CheckBox" , item_gap " hp" , " Enable in fullscreen" )
59
118
ahkoSetup_enable_fullscreen.OnEvent(" Click" , enable_fullscreen_update)
60
119
61
- ahkoSetup_autoStart:=ahko_setup.Add(" CheckBox" , " y+5 hp" , " Startup with Windows" )
120
+ ahkoSetup_autoStart:=ahko_setup.Add(" CheckBox" , " y+0 hp" , " Startup with Windows" )
62
121
ahkoSetup_autoStart.OnEvent(" Click" , autoStartup_update)
63
122
64
123
ahko_setup.SetFont(textFontStyle)
@@ -91,6 +150,7 @@ hotkeyText_update(*) {
91
150
ahko_setup_show (* ) {
92
151
global
93
152
ahkoSetup_uiType.Value:=uiType
153
+ ahkoSetup_showAt.Value:=ddl_from_showat(showat)
94
154
ahkoSetup_path.Value:=path
95
155
96
156
ahkoSetup_hotkey.Value:=RegExReplace (hotkeys, " #" )
@@ -124,6 +184,7 @@ ahko_setup_save(*) {
124
184
IniWrite (" key=" hotkeyStr, " setting.ini" , " hotkey" )
125
185
IniWrite (" fullscreen=" fullscreen_enable, " setting.ini" , " hotkey" )
126
186
IniWrite (" type=" ahkoSetup_uiType.Value, " setting.ini" , " ui" )
187
+ IniWrite (" showat=" showat, " setting.ini" , " settings" )
127
188
MsgBox (" In order for the changes to take effect`nahko is is about to be restarted" ," OK" ," Owner" ahko_setup.Hwnd)
128
189
Reload
129
190
}
0 commit comments