-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathPropertyWin.ahk
1547 lines (1278 loc) · 56.3 KB
/
PropertyWin.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; -- Initialize variables
; -----------------------------------------------------------------
{
global PropertyWinHwnd
, PropertyWinHeaderHwnd
, PropertyWinContainerHwnd
, PropertyWinOverlayHwnd
, PropertyWinSubWin := {CurrentLayout: 0, Layouts: {}}
, PropertyWinWidth := 320
, PropertyWinHeaderHeight := 24
, PropertyNameColWidth := 150
, PropertyWinRowHeight := 23
, PropertyWinPageHeight
, PropertyWinRowHeightImageList := DllCall("ImageList_Create", Int,1, Int,PropertyWinRowHeight - 1, Int,ILC_COLOR4, Int,1, Int,1)
, PropertyWinListViews := {Count: 0, Current: [], CurrentCount: 0}
, PropertyWinCurrentControlType := 0
, PropertyWinCurrentItem := {ListView: 0, ItemIndex: -1, Selected: 0, OverlayWin: {ProcessFocusChange: 1}}
, PropertyWinPropertyTypeLayouts := {CurrentLayout: 0, NotificationTypes: {}}
, PropertyWinRedrawOverlayWindowFunc := Func("PropertyWinRedrawOverlayWindow")
}
; -- Functions
; -----------------------------------------------------------------
PropertyWinActivateListView(ListView){
Gui %PropertyWinContainerHwnd%:Default
Gui ListView, %ListView%
}
PropertyWinActiviteOverlayWindow(){
PropertyWinGetCurrentProperty(GroupName, PropertyName, Property)
PropertyLayout := PropertyWinPropertyTypeLayouts[Property.Get("Type")]
ControlFocus , , % "ahk_id " PropertyLayout.PrimaryControl
Hotkey $Esc, OnPropertyWinOverlayEscape, On
Hotkey $Enter, OnPropertyWinOverlayEscape, On
Sleep 0 ; Let the focus change and the list view redraw before redrawing the overlay window
PropertyWinRedrawOverlayWindow()
}
PropertyWinClearListViewSelection(){
if(PropertyWinCurrentItem.Selected){
PropertyWinActivateListView(PropertyWinCurrentItem.ListView)
LV_Modify(0, "-Select")
PropertyWinSelectItem(0, -1)
DllCall("SetFocus", Ptr,0)
}
}
PropertyWinControlTargetSelect(ControlHwnd){
if(ControlHwnd = Selection.Current)
return
PropertyWinGetCurrentProperty(PropertyGroup, PropertyName, Property)
PreviousTarget := CurrentControlData[PropertyName]
if(!ControlHwnd)
CurrentControlData[PropertyName] := 0
else{
Page := 0
TargetControlData := CurrentGui.Controls[ControlHwnd]
if(Property.Get("AllowParentPage")){
if(TargetControlData.ControlType = "Tab2")
Page := GetTabNumber(TargetControlData)
}
CurrentControlData[PropertyName] := TargetControlData.Index | (Page << 16 & 0xFFFF0000)
OnEditorWinPropertyEdit(PropertyGroup, PropertyName, CurrentControlData, 0, PreviousTarget)
OnPropertyWinPropertyChange(PropertyGroup, PropertyName)
}
}
PropertyWinCreateGui(){
DefaultPropertyWinHeight := 600
DefaultPropertyWinHeight := 700
Gui Properties:New, HwndPropertyWinHwnd OwnerMain LabelOnPropertyWin ToolWindow Resize MinSize%PropertyWinWidth%x200 MaxSize%PropertyWinWidth%x, Properties
SubClassWindow(PropertyWinHwnd, "OnPropertyWinWindowProc")
GroupAdd PropertyWinGroup, ahk_id %PropertyWinHwnd%
; --- Header
Gui Add, Custom, ClassSysHeader32 w%PropertyWinWidth% h%PropertyWinHeaderHeight% x0 y0 HwndPropertyWinHeaderHwnd -TabStop
HD_EX_Insert(PropertyWinHeaderHwnd, 1, "Property", PropertyNameColWidth + 1)
HD_EX_Insert(PropertyWinHeaderHwnd, 2, "Value", PropertyWinWidth - PropertyNameColWidth)
; Scroll view
; WS_EX_CONTROLPARENT enables tabbing between controls in child windows, required because of a bug in windows?
Gui New, HwndPropertyWinContainerHwnd Parent%PropertyWinHwnd% ToolWindow -Caption LastFound %WS_VSCROLL% E%WS_EX_CONTROLPARENT%
Gui %PropertyWinContainerHwnd%:Color, 0xFFFFFF
Gui %PropertyWinContainerHwnd%:Show
SubClassWindow(PropertyWinContainerHwnd, "OnPropertyWinContainerWindowProc")
PropertyWinCreatePropertyOverlayWindow()
PropertyWinUpdateGroups()
Gui Properties:Show, x2 y2 w%PropertyWinWidth% h%DefaultPropertyWinHeight% NoActivate
; Update the window width because MinSize and MaxSize settings seem to intefere with the size specified in the show command when MinSizeX = MaxSizeX
WinMove ahk_id %PropertyWinHwnd%, , , , %PropertyWinWidth%
}
PropertyWinCreatePropertyGroupListView(PropertiesName){
Gui %PropertyWinContainerHwnd%:Default
Properties := PropertiesDef[PropertiesName]
PropertyList := Properties.GroupIndexes
PropertiesHeader := Properties.GroupHeading
Width := PropertyWinWidth - SM_CXVSCROLL
ItemCount := PropertyList.MaxIndex()
for Index, PropertyName in PropertyList
if(Properties[PropertyName].NoDisplay)
ItemCount--
ListViewHeight := ItemCount * PropertyWinRowHeight
Gui Add, ListView, x0 y0 w%Width% h%ListViewHeight% Grid -Hdr -Multi -E%WS_EX_CLIENTEDGE% HwndListViewHwnd Hidden Disabled, Property|Value
SubClassWindow(ListViewHwnd, "OnPropertyWinListViewWindowProc")
LV_SetImageList(PropertyWinRowHeightImageList, 1)
LV_ModifyCol(1, PropertyNameColWidth)
LV_ModifyCol(2, Width - PropertyNameColWidth)
LV_ModifyCol(2, "Right")
PropertyWinListViews[++PropertyWinListViews.Count] := Properties.ListViewHwnd := ListViewHwnd
PropertyWinListViews[ListViewHwnd] := ListView := {Index:PropertyWinListViews.Count, PropertiesName: PropertiesName, HeaderPic: 0
, Height: ListViewHeight, MouseOver: 0, ItemIndexMap: ItemIndexMap := {}}
if(PropertiesHeader){
Gui Add, Picture, x0 y0 w%Width% h%PropertyWinRowHeight% HwndHeaderPic Hidden Disabled, images\item-header-grad.ico
Gui Font, Bold
Gui Add, Text, x5 y0 BackgroundTrans Hidden HwndHeaderText, %PropertiesHeader%
Gui Font
ListView.HeaderPic := HeaderPic, ListView.HeaderText := HeaderText
}
ItemIndex := 1
for Index, PropertyName in PropertyList{
Property := Properties[PropertyName]
if(Property.NoDisplay)
continue
ItemIndexMap[ItemIndex] := Index
Property.ItemIndex := ItemIndex++
if(!Property.HasKey("Name"))
Property.Name := PropertyName
LV_Add("", "", "")
}
}
PropertyWinCreatePropertyOverlayWindow(){
static ControlSelectBtn, ControlClearBtn
, FontClearBtn
, SubWinOptionsUpBtn, SubWinOptionsDownBtn, SubWinOptionsAddBtn, SubWinOptionsRemoveBtn
Gui New, HwndPropertyWinOverlayHwnd Parent%PropertyWinContainerHwnd% -Caption ToolWindow LastFound E%WS_EX_CONTROLPARENT% ; Enables tabbing between controls in this child window
Gui %PropertyWinOverlayHwnd%:Default
SubClassWindow(PropertyWinOverlayHwnd, "OnPropertyWinOverlayWindowProc")
Gui Color, 0xFFFFFF
Width := PropertyWinWidth - SM_CXVSCROLL - PropertyNameColWidth - 1
Height := PropertyWinRowHeight - 1
; Sub window
{
Gui New, HwndSubWinHwnd +Resize -Caption MinSize200x230 Owner%PropertyWinHwnd% AlwaysOnTop
PropertyWinSubWin.Hwnd := SubWinHwnd
SubClassWindow(PropertyWinSubWin.Hwnd, "OnPropertyWinSubWinWindowProc")
Gui %SubWinHwnd%:Show, w200 h230 Hide
Gui %PropertyWinOverlayHwnd%:Default
}
; Text
{
PropertyWinPropertyTypeLayouts.Text := CurrentLayout := {Controls: {}, Events: {}}
Gui Add, Edit, x0 y0 w%Width% h%Height% Right HwndControlHwnd Hidden Disabled
CurrentLayout.Controls.Edit := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
}
; TextToggle
{
PropertyWinPropertyTypeLayouts.TextToggle := CurrentLayout := {Controls: {}, Events: {}}
X := 21
W := Width - X
Gui Add, Checkbox, x4 y0 w17 h%Height% HwndSubControl1Hwnd Hidden Disabled ; Don't use the BS_NOTIFY because there is no need to focus a checkbox
Gui Add, Edit, x%X% y0 w%W% h%Height% Right HwndControlHwnd Hidden Disabled
CurrentLayout.Controls.Edit := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
CurrentLayout.Controls.Checkbox := SubControl1Hwnd, CurrentLayout.Events[SubControl1Hwnd] := "OnPropertyWinItemEdit"
}
; MultiText
{
PropertyWinPropertyTypeLayouts.MultiText := CurrentLayout := {Controls: {}, Events: {}}
W := Width - Height
Gui Add, Edit, x0 y0 w%W% h%Height% Right HwndControlHwnd Hidden Disabled
Gui Add, Button, x%W% y0 w%Height% h%Height% HwndSubControlHwnd Hidden Disabled, ...
CustomMouseDownEvents[SubControlHwnd] := {Threaded: Func("OnPropertyWinSubWinBtnClick"), Init: 1}
CurrentLayout.Controls.Edit := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
CurrentLayout.Controls.EditBtn := SubControlHwnd
PropertyWinSubWin.Layouts.MultiText := SubWinLayout := {Controls: {}, Events: {}, Anchors: {}}
Gui % PropertyWinSubWin.Hwnd ":Default"
Gui Add, Edit, x0 y0 w10 h10 HwndEditHwnd WantTab -Wrap HScroll Multi Hidden
Gui Add, Button, x0 y0 h26 w60 HwndCloseBtn Hidden, Close
SubWinLayout.Controls.Edit := EditHwnd, SubWinLayout.Events[EditHwnd] := "OnPropertyWinSubWinMultilineChange"
SubWinLayout.Controls.CloseBtn := CloseBtn, SubWinLayout.Events[CloseBtn] := "OnPropertyWinSubWinClose"
PropertyWinSubWinAnchor(SubWinLayout, EditHwnd, "L 4 T 4 R 4 B 38")
PropertyWinSubWinAnchor(SubWinLayout, CloseBtn, "L 4 B 4")
Gui %PropertyWinOverlayHwnd%:Default
}
; Int
{
PropertyWinPropertyTypeLayouts.Int := CurrentLayout := {Controls: {}, Events: {}}
Gui Add, Edit, x0 y0 w%Width% h%Height% Right HwndControlHwnd Hidden Disabled
Gui Add, UpDown, Range%MIN_INT%-%MAX_INT% %UDS_NOTHOUSANDS% HwndSubControlHwnd Hidden Disabled
RestrictInput(ControlHwnd, RI_INTEGER)
CurrentLayout.Controls.Edit := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
CurrentLayout.Controls.UpDown := SubControlHwnd
}
; IntToggle
{
PropertyWinPropertyTypeLayouts.IntToggle := CurrentLayout := {Controls: {}, Events: {}}
X := 21
W := Width - X
Gui Add, Checkbox, x4 y0 w17 h%Height% HwndSubControl1Hwnd Hidden Disabled ; Don't use the BS_NOTIFY because there is no need to focus a checkbox
Gui Add, Edit, x%X% y0 w%W% h%Height% Right HwndControlHwnd Hidden Disabled
Gui Add, UpDown, Range%MIN_INT%-%MAX_INT% %UDS_NOTHOUSANDS% HwndSubControl2Hwnd Hidden Disabled
RestrictInput(ControlHwnd, RI_INTEGER)
CurrentLayout.Controls.Edit := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
CurrentLayout.Controls.Checkbox := SubControl1Hwnd, CurrentLayout.Events[SubControl1Hwnd] := "OnPropertyWinItemEdit"
CurrentLayout.Controls.UpDown := SubControl2Hwnd
}
; Label
{
PropertyWinPropertyTypeLayouts.Label := CurrentLayout := {Controls: {}, Events: {}}
Gui Add, Edit, x0 y0 w%Width% h%Height% Right HwndControlHwnd Hidden Disabled
RestrictInput(ControlHwnd, RI_LABEL)
CurrentLayout.Controls.Edit := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
}
; Var
{
PropertyWinPropertyTypeLayouts.Var := CurrentLayout := {Controls: {}, Events: {}}
Gui Add, Edit, x0 y0 w%Width% h%Height% Limit253 Right HwndControlHwnd Hidden Disabled
RestrictInput(ControlHwnd, RI_VARIABLE)
CurrentLayout.Controls.Edit := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
}
; XY
{
PropertyWinPropertyTypeLayouts.XY := CurrentLayout := {Controls: {}, Events: {}}
W := (Width - 5) / 2
X := W + 5
Gui Add, Edit, x0 y0 w%W% h%Height% Right HwndControlHwnd Hidden Disabled
Gui Add, UpDown, Range%MIN_INT%-%MAX_INT% %UDS_NOTHOUSANDS% HwndSubControlHwnd Hidden Disabled
RestrictInput(ControlHwnd, RI_INTEGER)
CurrentLayout.Controls.EditX := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
CurrentLayout.Controls.UpDownX := SubControlHwnd
Gui Add, Edit, x%X% y0 w%W% h%Height% Right HwndControlHwnd Hidden Disabled
Gui Add, UpDown, Range%MIN_INT%-%MAX_INT% %UDS_NOTHOUSANDS% HwndSubControlHwnd Hidden Disabled
RestrictInput(ControlHwnd, RI_INTEGER)
CurrentLayout.Controls.EditY := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
CurrentLayout.Controls.UpDownY := SubControlHwnd
}
; Toggle
{
PropertyWinPropertyTypeLayouts.Toggle := CurrentLayout := {Controls: {}, Events: {}, DisableFocus: 1}
X := Width - 17
Gui Add, Checkbox, x%X% y4 HwndControlHwnd Hidden Disabled ; Don't use the BS_NOTIFY because there is no need to focus a checkbox
CurrentLayout.Controls.Checkbox := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
}
; Control
{
PropertyWinPropertyTypeLayouts.Control := CurrentLayout := {Controls: {}, Events: {}}
W := Width - Height * 2 - 2
Gui Add, Text, x0 y4 w%W% h%Height% Right HwndControlHwnd Hidden Disabled
X := Width - Height * 2
Gui Add, Button, x%X% y0 w%Height% h%Height% HwndSubControl1Hwnd vControlSelectBtn +%BS_NOTIFY% Hidden Disabled
X := Width - Height
Gui Add, Button, x%X% y0 w%Height% h%Height% HwndSubControl2Hwnd vControlClearBtn Hidden Disabled
GuiButtonIcon(SubControl1Hwnd, "images\target.ico", 1, 22, 10)
GuiButtonIcon(SubControl2Hwnd, "images\delete.ico", 1, 22, 6)
CustomMouseDownEvents[SubControl1Hwnd] := CustomMouseDownEvents[SubControl2Hwnd] := Func("OnPropertyWinOverlayControlBtnClick")
CurrentLayout.Controls.Label := ControlHwnd
CurrentLayout.Controls.TargetBtn := CurrentLayout.PrimaryControl := SubControl1Hwnd
CurrentLayout.Controls.ClearBtn := SubControl2Hwnd
}
; List
{
PropertyWinPropertyTypeLayouts.List := CurrentLayout := {Controls: {}, Events: {}, SubLayout: {}}
Gui Add, DropDownList, x0 y0 w%Width% h%Height% r20 -Lowercase HwndControlHwnd Hidden Disabled
CurrentLayout.Controls.DropDownList := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
CurrentLayout.SubLayout[ControlHwnd] := {Prop: "IsComboBox", Value: "", IsPrimary: 1, ControlName: "Edit"}
PropertyWinPropertyTypeLayouts.NotificationTypes[ControlHwnd] := "CBN"
Gui Add, ComboBox, x0 y0 w%Width% h%Height% r20 -Lowercase HwndControlHwnd Hidden Disabled
CurrentLayout.Controls.ComboBox := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
CurrentLayout.SubLayout[ControlHwnd] := {Prop: "IsComboBox", Value: 1, IsPrimary: 1, ControlName: "Edit"}
PropertyWinPropertyTypeLayouts.NotificationTypes[ControlHwnd] := "CBN"
}
; Font
{
PropertyWinPropertyTypeLayouts.Font := CurrentLayout := {Controls: {}, Events: {}}
W := Width - Height * 2 - 2
Gui Add, Text, x0 y4 w%W% h%Height% -Wrap HwndControlHwnd Hidden Disabled
X := Width - Height * 2
Gui Add, Button, x%X% y0 w%Height% h%Height% HwndSubControl1Hwnd Hidden Disabled, ...
X := Width - Height
Gui Add, Button, x%X% y0 w%Height% h%Height% HwndSubControl2Hwnd vFontClearBtn Hidden Disabled
GuiButtonIcon(SubControl2Hwnd, "images\delete.ico", 1, 22, 6)
CustomMouseDownEvents[SubControl1Hwnd] := {Threaded: Func("OnPropertyWinOverlayFontBtnClick"), Param: "FontSelectBtn"}
CustomMouseDownEvents[SubControl2Hwnd] := Func("OnPropertyWinOverlayFontBtnClick")
CurrentLayout.Controls.Label := ControlHwnd
CurrentLayout.Controls.ChooseBtn := SubControl1Hwnd
CurrentLayout.Controls.ClearBtn := SubControl2Hwnd
}
; Date
{
PropertyWinPropertyTypeLayouts.Date := CurrentLayout := {Controls: {}, Events: {}}
Gui Add, DateTime, x0 y0 w%Width% h%Height% 2 HwndControlHwnd Hidden Disabled
CurrentLayout.Controls.DateTime := CurrentLayout.PrimaryControl := ControlHwnd, CurrentLayout.Events[ControlHwnd] := "OnPropertyWinItemEdit"
}
; DateRange
{
PropertyWinPropertyTypeLayouts.DateRange := CurrentLayout := {Controls: {}, Events: {}}
W := (Width - 5) / 2
X := W + 5
Gui Add, DateTime, x0 y0 w%W% h%Height% 2 HwndControl1Hwnd Hidden Disabled
CurrentLayout.Controls.DateTimeMin := CurrentLayout.PrimaryControl := Control1Hwnd, CurrentLayout.Events[Control1Hwnd] := "OnPropertyWinItemEdit"
Gui Add, DateTime, x%X% y0 w%W% h%Height% 2 HwndControl2Hwnd Hidden Disabled
CurrentLayout.Controls.DateTimeMax := Control2Hwnd, CurrentLayout.Events[Control2Hwnd] := "OnPropertyWinItemEdit"
}
; Picture image load menu
{
Menu PictureLoadMenu, Add, Load from File, OnPropertyWinPictureLoadMenu
Menu PictureLoadMenu, Add, Load from Resource, OnPropertyWinPictureLoadMenu
}
; Options sub window
{
PropertyWinSubWin.Layouts.Options := SubWinLayout := {Controls: {}, Events: {}, Anchors: {}}
Gui % PropertyWinSubWin.Hwnd ":Default"
Gui Add, ListView, x0 y0 w100 h100 Grid -LV%LVS_EX_HEADERDRAGDROP% -ReadOnly NoSortHdr HwndListViewHwnd Hidden, Value
LV_ModifyCol(1, 180)
Gui Add, Button, x0 y0 h26 w40 HwndCloseBtn Hidden, Close
Gui Add, Button, x0 y0 h26 w26 HwndUpBtn vSubWinOptionsUpBtn Hidden
Gui Add, Button, x0 y0 h26 w26 HwndDownBtn vSubWinOptionsDownBtn Hidden
Gui Add, Button, x0 y0 h26 w26 HwndAddBtn vSubWinOptionsAddBtn Hidden
Gui Add, Button, x0 y0 h26 w26 HwndRemoveBtn vSubWinOptionsRemoveBtn Hidden
GuiButtonIcon(UpBtn, "images\up.ico", 1, 22, 6)
GuiButtonIcon(DownBtn, "images\down.ico", 1, 22, 6)
GuiButtonIcon(AddBtn, "images\add.ico", 1, 22, 6)
GuiButtonIcon(RemoveBtn, "images\remove.ico", 1, 22, 6)
SubWinLayout.Controls.ListView := ListViewHwnd
SubWinLayout.Controls.CloseBtn := CloseBtn, SubWinLayout.Events[CloseBtn] := "OnPropertyWinSubWinClose"
SubWinLayout.Controls.UpBtn := UpBtn, SubWinLayout.Events[UpBtn] := "OnPropertyWinSubWinOptionsButtonClick"
SubWinLayout.Controls.DownBtn := DownBtn, SubWinLayout.Events[DownBtn] := "OnPropertyWinSubWinOptionsButtonClick"
SubWinLayout.Controls.AddBtn := AddBtn, SubWinLayout.Events[AddBtn] := "OnPropertyWinSubWinOptionsButtonClick"
SubWinLayout.Controls.RemoveBtn := RemoveBtn, SubWinLayout.Events[RemoveBtn] := "OnPropertyWinSubWinOptionsButtonClick"
PropertyWinSubWinAnchor(SubWinLayout, ListViewHwnd, "L 4 T 4 R 4 B 38")
PropertyWinSubWinAnchor(SubWinLayout, CloseBtn, "L 4 B 4")
PropertyWinSubWinAnchor(SubWinLayout, UpBtn, "R 94 B 4")
PropertyWinSubWinAnchor(SubWinLayout, DownBtn, "R 64 B 4")
PropertyWinSubWinAnchor(SubWinLayout, AddBtn, "R 34 B 4")
PropertyWinSubWinAnchor(SubWinLayout, RemoveBtn, "R 4 B 4")
Gui %PropertyWinOverlayHwnd%:Default
}
Gui Show, x0 y0 w%Width% h%Height% Hide
WinSet Top, , ahk_id %PropertyWinOverlayHwnd%
}
PropertyWinGetCurrentProperty(ByRef GroupName, ByRef PropertyName, ByRef Property := 0){
ListViewProperties := PropertyWinListViews[PropertyWinCurrentItem.ListView]
GroupName := ListViewProperties.PropertiesName
Properties := PropertiesDef[GroupName]
PropertyName := Properties.GroupIndexes[ListViewProperties.ItemIndexMap[PropertyWinCurrentItem.ItemIndex + 1]]
Property := Properties[PropertyName]
}
PropertyWinGetPropertyAt(ListViewHwnd, ItemIndex, ByRef GroupName, ByRef PropertyName, ByRef Property := 0){
ListViewProperties := PropertyWinListViews[ListViewHwnd]
GroupName := ListViewProperties.PropertiesName
Properties := PropertiesDef[GroupName]
PropertyName := Properties.GroupIndexes[ListViewProperties.ItemIndexMap[ItemIndex + 1]]
Property := Properties[PropertyName]
}
PropertyWinGetItemRect(ListViewHwnd, ItemIndex, ByRef Left, ByRef Top, ByRef Right, ByRef Bottom){
VarSetCapacity(Rect, 16, 0)
NumPut(LVIR_BOUNDS, Rect, 0, "Int")
NumPut(0, Rect, 4, "Int")
SendMessage LVM_GETSUBITEMRECT, %ItemIndex%, &Rect, , ahk_id %ListViewHwnd%
Left := NumGet(Rect, 0, "Int"), Top := NumGet(Rect, 4, "Int")
Right := NumGet(Rect, 8, "Int"), Bottom := NumGet(Rect, 12, "Int")
}
PropertyWinRedrawOverlayWindow(){
WinSet Top, , ahk_id %PropertyWinOverlayHwnd%
WinSet Redraw, , ahk_id %PropertyWinOverlayHwnd%
}
PropertyWinScrollToItem(ListView, ItemNumber){
ItemNumber -= 1
VarSetCapacity(Rect, 16, 0)
NumPut(LVIR_BOUNDS, Rect, 0, "Int")
NumPut(0, Rect, 4, "Int")
SendMessage LVM_GETSUBITEMRECT, %ItemNumber%, &Rect, , ahk_id %ListView%
Top := NumGet(Rect, 4, "Int"), Bottom := NumGet(Rect, 12, "Int")
MapWindowPoints(ListView, PropertyWinContainerHwnd, 0, Top)
MapWindowPoints(ListView, PropertyWinContainerHwnd, 0, Bottom)
ScrollWindow(PropertyWinContainerHwnd, WM_VSCROLL, "ScrollTo", Top, Bottom)
}
PropertyWinSelectItem(ListView, ItemIndex, Hover := 0){
if(ItemIndex > -1){
if(PropertyWinCurrentItem.ListView != ListView or PropertyWinCurrentItem.ItemIndex != ItemIndex or !Hover){
if(PropertyWinCurrentItem.ListView != ListView or PropertyWinCurrentItem.ItemIndex != ItemIndex){
; Update the previous property ListView item if changes have been made to the property
if(PropertyWinCurrentItem.ListView and PropertyWinCurrentItem.ItemIndex > -1)
PropertyWinUpdateCurrentProperty()
if(PropertyWinCurrentItem.ListView and PropertyWinCurrentItem.ListView != ListView){
PropertyWinActivateListView(PropertyWinCurrentItem.ListView)
LV_Modify(0, "-Select")
}
PropertyWinCurrentItem.ListView := ListView
PropertyWinCurrentItem.ItemIndex := ItemIndex
PropertyWinGetCurrentProperty(GroupName, PropertyName, Property), PropertyClass.ControlType := CurrentControlData.ControlType
if(Property.Get("Disable") or Property.Get("ReadOnly")){
Gui %PropertyWinOverlayHwnd%:Hide
return
}
; Get the item's bounding rectangle and position the overlay window on top of it
PropertyWinGetItemRect(ListView, ItemIndex, Left, Top, Right, Bottom)
Width := Right - Left
MapWindowPoints(ListView, PropertyWinContainerHwnd, Left, Top)
WinGetPos, , , WinWidth, , ahk_id %PropertyWinOverlayHwnd%
Left -= WinWidth - Width ; Align the overlay window with the right side of the ListView
Gui %PropertyWinOverlayHwnd%:Show, x%Left% y%Top% NoActivate
PropertyWinUpdateOverlayWindow()
}
else{
PropertyWinGetCurrentProperty(GroupName, PropertyName, Property), PropertyClass.ControlType := CurrentControlData.ControlType
Gui %PropertyWinOverlayHwnd%:Show, NoActivate
}
if(PropertiesDef.PropertyTypeOptions["NoSelect" Property.Type] or Property.Get("NoSelect"))
PropertyWinActivateListView(PropertyWinCurrentItem.ListView), LV_Modify(0, "-Select -Focus")
else
PropertyWinCurrentItem.Selected := !Hover
PropertyWinRedrawOverlayWindow()
}
}
else if(PropertyWinCurrentItem.ItemIndex != -1){
PropertyWinUpdateCurrentProperty()
PropertyWinGetCurrentProperty(GroupName, PropertyName, Property)
PropertyClass.ControlType := ""
Gui %PropertyWinOverlayHwnd%:Hide
PropertyWinCurrentItem.ListView := 0
PropertyWinCurrentItem.ItemIndex := -1
PropertyWinCurrentItem.Selected := 0
}
}
PropertyWinSubWinAnchor(Layout, Control, Anchors){
Position := "", Amount := ""
Layout.Anchors[Control] := ControlAnchors := {}
Loop Parse, Anchors, %A_Space%
{
if(Position = ""){
Position := A_LoopField
continue
}
Amount := A_LoopField
ControlAnchors[Position] := Amount
Position := ""
}
}
PropertyWinUpdateCurrentProperty(FromSubWin := 0){
ListView := FromSubWin ? PropertyWinSubWin.ListView : PropertyWinCurrentItem.ListView
ItemIndex := FromSubWin ? PropertyWinSubWin.ItemIndex : PropertyWinCurrentItem.ItemIndex
PropertyWinGetPropertyAt(ListView, ItemIndex, GroupName, PropertyName, Property)
PropertyClass.ControlType := FromSubWin ? PropertyWinSubWin.ControlType : CurrentControlData.ControlType
Gui %PropertyWinContainerHwnd%:Default
Gui ListView, %ListView%
LV_Modify(ItemIndex + 1, "Col2", GetPropertyValue(GroupName, PropertyName, CurrentControlData, 1))
}
PropertyWinUpdateGroups(Force := 0){
Gui %PropertyWinContainerHwnd%:Default
ControlType := CurrentControlData.ControlType
Reposition := Force or PropertyWinCurrentControlType != ControlType
PropertyWinCurrentControlType := ControlType
GroupNames := PropertiesDef.GroupControlTypes[ControlType]
; Hide current options
if(Reposition){
Loop % PropertyWinListViews.CurrentCount {
ListViewHwnd := PropertiesDef[PropertyWinListViews.Current[A_Index]].ListViewHwnd
ListView := PropertyWinListViews[ListViewHwnd]
if(ListView.HeaderPic){
Control, Hide, , , % "ahk_id " ListView.HeaderPic
Control, Hide, , , % "ahk_id " ListView.HeaderText
}
Control, Hide, , , % "ahk_id " ListViewHwnd
Control, Disable, , , % "ahk_id " ListViewHwnd
}
ScrollWindow(PropertyWinContainerHwnd, WM_VSCROLL, SB_TOP, 0)
}
Y := 0
PropertyWinListViews.CurrentCount := GroupNames.MaxIndex()
for Index, GroupName in GroupNames{
Properties := PropertiesDef[GroupName]
if(!Properties.HasKey("ListViewHwnd"))
PropertyWinCreatePropertyGroupListView(GroupName)
PropertyWinListViews.Current[Index] := GroupName
ListViewHwnd := PropertiesDef[GroupName].ListViewHwnd
ListView := PropertyWinListViews[ListViewHwnd]
if(Reposition and (HeaderPic := ListView.HeaderPic)){
HeaderText := ListView.HeaderText
Control, Show, , , ahk_id %HeaderPic%
GuiControl Move, %HeaderPic%, y%Y%
TextY := Y + 4
Control, Show, , , ahk_id %HeaderText%
GuiControl Move, %HeaderText%, y%TextY%
Y += PropertyWinRowHeight
}
; Update property values
Gui ListView, %ListViewHwnd%
RowIndex := 1
for Index, PropertyName in Properties.GroupIndexes{
Property := Properties[PropertyName]
if(Property.NoDisplay)
continue
PropertyClass.ControlType := ControlType
LV_Modify(RowIndex, "Col2", GetPropertyValue(GroupName, PropertyName, CurrentControlData, 1))
LV_Modify(RowIndex++, "Col1", Property.Get("Name"))
}
; Show
if(Reposition){
Control, Show, , , ahk_id %ListViewHwnd%
Control, Enable, , , ahk_id %ListViewHwnd%
GuiControl %PropertyWinContainerHwnd%:Move, %ListViewHwnd%, y%Y%
Y += ListView.Height
}
}
if(Reposition){
GetClientSize(PropertyWinHwnd, WinWidth, WinHeight)
UpdateScrollBars(PropertyWinContainerHwnd, WinWidth, WinHeight - PropertyWinHeaderHeight)
}
}
PropertyWinUpdateOverlayWindow(UpdateLayout := 1){
Gui %PropertyWinOverlayHwnd%:Default
PropertyWinGetCurrentProperty(GroupName, PropertyName, Property)
PropertyClass.ControlType := CurrentControlData.ControlType
Type := Property.Get("Type")
PropertyLayout := PropertyWinPropertyTypeLayouts[PropertyWinPropertyTypeLayouts.CurrentLayout]
if(UpdateLayout and Type != PropertyWinPropertyTypeLayouts.CurrentLayout or PropertyLayout.HasKey("SubLayout")){
for Index, ControlHwnd in PropertyLayout.Controls{
GuiControl Hide, %ControlHwnd%
GuiControl Disable, %ControlHwnd%
}
PropertyWinPropertyTypeLayouts.CurrentLayout := Type
PropertyLayout := PropertyWinPropertyTypeLayouts[Type]
SubLayout := {}
for ControlHwnd, Condition in PropertyLayout.SubLayout{
if(Property.Get(Condition.Prop) = Condition.Value){
SubLayout[ControlHwnd] := 0
if(Condition.IsPrimary)
PropertyLayout.PrimaryControl := ControlHwnd
if(Condition.ControlName)
PropertyLayout.Controls[Condition.ControlName] := ControlHwnd
}
else
SubLayout[ControlHwnd] := 1
}
for Index, ControlHwnd in PropertyLayout.Controls{
if(SubLayout[ControlHwnd])
continue
GuiControl Show, %ControlHwnd%
GuiControl Enable, %ControlHwnd%
}
}
; Prevent g-labels from being called when the values are updated
for ControlHwnd, EventName in PropertyLayout.Events
GuiControl -g, % ControlHwnd
if(Type = "Int" or Type = "IntToggle"){
Range := Property.Get("Range")
RangeMin := Range[1], RangeMax := Range[2]
if RangeMin is not integer
Range := GetPropertyValue(RangeMin, RangeMax, CurrentControlData), RangeMin := Range[1], RangeMax := Range[2]
RangeMin := RangeMin = "" ? MIN_INT : RangeMin
RangeMax := RangeMax = "" ? MAX_INT : RangeMax
Value := GetPropertyValue(GroupName, PropertyName, CurrentControlData)
GuiControl, , % PropertyLayout.Controls.Edit, % Type = "IntToggle" ? Value[2] : Value
GuiControl +Range%RangeMin%-%RangeMax%, % PropertyLayout.Controls.UpDown
RestrictedInputs[PropertyLayout.Controls.Edit] := RangeMin != "" and RangeMin >= 0 ? RI_INTEGER_POSITIVE : RI_INTEGER
if(Type = "IntToggle"){
CheckType := Property.Get("Default") = "" ? "+Check3" : "-Check3"
GuiControl %CheckType%, % PropertyLayout.Controls.Checkbox
Value := Value[1]
CheckValue := Property.Get("Default") = "" and Value = "" ? "-1" : Value = "Yes" ? 1 : 0
GuiControl, , % PropertyLayout.Controls.Checkbox, %CheckValue%
}
}
else if(Type = "XY"){
Range := Property.Get("Range")
RangeMin := Range[1] = "" ? MIN_INT : Range[1]
RangeMax := Range[2] = "" ? MAX_INT : Range[2]
Value := GetPropertyValue(GroupName, PropertyName, CurrentControlData)
GuiControl, , % PropertyLayout.Controls.EditX, % Value[1]
GuiControl, , % PropertyLayout.Controls.EditY, % Value[2]
GuiControl +Range%RangeMin%-%RangeMax%, % PropertyLayout.Controls.UpDownX
GuiControl +Range%RangeMin%-%RangeMax%, % PropertyLayout.Controls.UpDownY
RestrictedInputs[PropertyLayout.Controls.EditX] := RangeMin != "" and RangeMin >= 0 ? RI_INTEGER_POSITIVE : RI_INTEGER
RestrictedInputs[PropertyLayout.Controls.EditY] := RangeMin != "" and RangeMin >= 0 ? RI_INTEGER_POSITIVE : RI_INTEGER
}
else if(Type = "Toggle"){
CheckType := Property.Get("Default") = "" ? "+Check3" : "-Check3"
GuiControl %CheckType%, % PropertyLayout.Controls.Checkbox
Value := GetPropertyValue(GroupName, PropertyName, CurrentControlData)
CheckValue := Property.Get("Default") = "" and Value = "" ? "-1" : Value = "Yes" ? 1 : 0
GuiControl, , % PropertyLayout.Controls.Checkbox, %CheckValue%
}
else if(Type = "Text" or Type = "TextToggle" or Type = "MultiText" or Type = "Label" or Type = "Var"){
ValueData := GetPropertyValue(GroupName, PropertyName, CurrentControlData)
Value := Type = "TextToggle" ? ValueData[2] : ValueData
if(Property.Get("GuiDelimiter"))
StringReplace Value, Value, %GUI_DELIMITER%, % CurrentGui.Delimiter, 1
GuiControl, , % PropertyLayout.Controls.Edit, %Value%
if(Property.Get("Limit"))
GuiControl % "+Limit" Property.Get("Limit"), % PropertyLayout.Controls.Edit
else
GuiControl -Limit, % PropertyLayout.Controls.Edit
if(Type = "TextToggle"){
CheckType := Property.Get("Default") = "" ? "+Check3" : "-Check3"
GuiControl %CheckType%, % PropertyLayout.Controls.Checkbox
Value := ValueData[1]
CheckValue := Property.Get("Default") = "" and Value = "" ? "-1" : Value = "Yes" ? 1 : 0
GuiControl, , % PropertyLayout.Controls.Checkbox, %CheckValue%
}
}
else if(Type = "Control"){
GuiControl, , % PropertyLayout.Controls.Label, % GetPropertyValue(GroupName, PropertyName, CurrentControlData, 1)
}
else if(Type = "List"){
Index := Property.Get("ListIndexes")[(Value := GetPropertyValue(GroupName, PropertyName, CurrentControlData))]
GuiControl, , % PropertyLayout.Controls.Edit, % "|" Property.Get("Options")
if(!Property.Get("IsComboBox") or Index)
GuiControl Choose, % PropertyLayout.Controls.Edit, %Index%
else
GuiControl Text, % PropertyLayout.Controls.Edit, %Value%
}
else if(Type = "Font"){
GuiControl, , % PropertyLayout.Controls.Label, % GetPropertyValue(GroupName, PropertyName, CurrentControlData, 1)
}
else if(Type = "Date"){
GuiControl Text, % PropertyLayout.Controls.DateTime, % Property.Get("ShowTime") ? "yyyy/MM/dd hh:mm:ss" : ""
Date := GetPropertyValue(GroupName, PropertyName, CurrentControlData)
if(Date = "")
GuiControl, , % PropertyLayout.Controls.DateTime, %A_Now%
GuiControl, , % PropertyLayout.Controls.DateTime, %Date%
}
else if(Type = "DateRange"){
Date := GetPropertyValue(GroupName, PropertyName, CurrentControlData, "Raw")
DateMin := SubStr(Date[1], 2)
DateMax := SubStr(Date[2], 2)
if(DateMin = "")
GuiControl, , % PropertyLayout.Controls.DateTimeMin, %A_Now%
if(DateMax = "")
GuiControl, , % PropertyLayout.Controls.DateTimeMax, %A_Now%
GuiControl, , % PropertyLayout.Controls.DateTimeMin, %DateMin%
GuiControl, , % PropertyLayout.Controls.DateTimeMax, %DateMax%
}
for ControlHwnd, EventName in PropertyLayout.Events
GuiControl +g%EventName%, % ControlHwnd
}
PropertyWinUpdateSubWinLayout(Layout){
Gui % PropertyWinSubWin.Hwnd ":Default"
PropertyLayout := PropertyWinSubWin.Layouts[PropertyWinSubWin.CurrentLayout]
if(Layout != PropertyWinSubWin.Layouts.CurrentLayout){
for Index, ControlHwnd in PropertyLayout.Controls{
GuiControl Hide, %ControlHwnd%
GuiControl Disable, %ControlHwnd%
}
PropertyWinSubWin.CurrentLayout := Layout
PropertyLayout := PropertyWinSubWin.Layouts[PropertyWinSubWin.CurrentLayout]
for Index, ControlHwnd in PropertyLayout.Controls{
GuiControl Show, %ControlHwnd%
GuiControl Enable, %ControlHwnd%
}
PropertyWinUpdateSubWinSize()
}
; Prevent g-labels from being called when the values are updated
for ControlHwnd, EventName in PropertyLayout.Events
GuiControl -g, % ControlHwnd
if(Layout = "MultiText"){
GuiControl, , % PropertyLayout.Controls.Edit, % GetPropertyValue(PropertyWinSubWin.GroupName, PropertyWinSubWin.PropertyName, CurrentControlData)
}
else if(Layout = "Options"){
PropertyWinSubWin.Options := StrSplit(CurrentControlData.Text, GUI_DELIMITER)
Gui % PropertyWinSubWin.Hwnd ":Default"
Gui ListView, % PropertyWinSubWin.Options.ListView
LV_Delete()
for Key, Value in PropertyWinSubWin.Options
LV_Add("", Value)
}
for ControlHwnd, EventName in PropertyLayout.Events
GuiControl +g%EventName%, % ControlHwnd
}
PropertyWinUpdateSubWinSize(){
Gui % PropertyWinSubWin.Hwnd ":Default"
GetClientSize(PropertyWinSubWin.Hwnd, WinWidth, WinHeight)
Anchors := PropertyWinSubWin.Layouts[PropertyWinSubWin.CurrentLayout].Anchors
for ControlHwnd, ControlAnchors in Anchors{
MoveCommand := ""
if(ControlAnchors.L != "" and ControlAnchors.R != "")
MoveCommand .= "x" ControlAnchors.L " w" (WinWidth - ControlAnchors.L - ControlAnchors.R) " "
else if(ControlAnchors.L != "")
MoveCommand .= "x" ControlAnchors.L " "
else if(ControlAnchors.R != ""){
GuiControlGet Control, Pos, %ControlHwnd%
MoveCommand .= "x" (WinWidth - ControlAnchors.R - ControlW) " "
}
if(ControlAnchors.T != "" and ControlAnchors.B != "")
MoveCommand .= "y" ControlAnchors.T " h" (WinHeight - ControlAnchors.T - ControlAnchors.B) " "
else if(ControlAnchors.T != "")
MoveCommand .= "y" ControlAnchors.T " "
else if(ControlAnchors.B != ""){
GuiControlGet Control, Pos, %ControlHwnd%
MoveCommand .= "y" (WinHeight - ControlAnchors.B - ControlH) " "
}
GuiControl,Move, %ControlHwnd%, % MoveCommand
}
}
; -- Events
; -----------------------------------------------------------------
PropertyWinSubroutinesDef(){
return
OnPropertyWinClose:
return
OnPropertyWinItemEdit:
OnPropertyWinItemEdit()
return
OnPropertyWinOverlayEscape:
OnPropertyWinOverlayEscape()
return
OnPropertyWinOverlayMouseMove:
OnPropertyWinOverlayMouseMove()
return
OnPropertyWinOverlayFocusChange:
OnPropertyWinOverlayFocusChange()
return
OnPropertyWinPictureLoadMenu:
OnPropertyWinPictureLoadMenu()
return
OnPropertyWinSubWinDeactivate:
OnPropertyWinSubWinDeactivate()
return
OnPropertyWinSubWinMultilineChange:
OnPropertyWinSubWinMultilineChange()
return
OnPropertyWinSubWinOptionsButtonClick:
OnPropertyWinSubWinOptionsButtonClick()
return
OnPropertyWinSubWinClose:
OnPropertyWinSubWinClose()
return
}
OnPropertyWinContainerWindowProc(hwnd, msg, wParam, lParam){
Critical
if(msg = WM_VSCROLL){
ScrollWindow(hwnd, msg, wParam, lParam)
PropertyWinClearListViewSelection()
}
if(CurrentAppAction){
if(msg = WM_NOTIFY){
Code := NumGet(lParam+0, A_PtrSize * 2, "Int")
if(Code = LVN_ITEMCHANGED){
NewState := NumGet(lParam+0, A_PtrSize * 3 + 8, "UInt")
if(NewState & LVIS_SELECTED)
PropertyWinActivateListView(hwndFrom := NumGet(lParam+0, 0, "Ptr"))
, LV_Modify(0, "-Select -Focus")
}
}
goto OnPropertyWinContainerWindowProc_CallWindowProc
}
if(msg = WM_NOTIFY){
Code := NumGet(lParam+0, A_PtrSize * 2, "Int")
if(Code = NM_CLICK){
PropertyWinActiviteOverlayWindow()
}
else if(Code = LVN_ITEMCHANGED){
NewState := NumGet(lParam+0, A_PtrSize * 3 + 8, "UInt")
if(NewState & LVIS_SELECTED){
PropertyWinGetCurrentProperty(GroupName, PropertyName, Property), PropertyClass.ControlType := CurrentControlData.ControlType
if(!Property.Get("Disable") and !Property.Get("ReadOnly")){
hwndFrom := NumGet(lParam+0, 0, "Ptr")
iItem := NumGet(lParam+0, A_PtrSize * 3, "Int")
PropertyWinScrollToItem(hwndFrom, iItem + 1)
PropertyWinActiviteOverlayWindow()
PropertyWinSelectItem(hwndFrom, iItem)
}
else{
PropertyWinActivateListView(PropertyWinCurrentItem.ListView)
LV_Modify(0, "-Select -Focus")
}
}
}
else if(Code = LVN_HOTTRACK){
hwndFrom := NumGet(lParam+0, 0, "Ptr")
if(!PropertyWinCurrentItem.Selected){
iItem := NumGet(lParam+0, A_PtrSize * 3, "Int")
PropertyWinSelectItem(hwndFrom, iItem, 1)
}
if(!PropertyWinListViews[hwndFrom].MouseOver){
VarSetCapacity(TRACKMOUSEEVENT, 8 + A_PtrSize * 2, 0)
NumPut(8 + A_PtrSize * 2, TRACKMOUSEEVENT, 0, "UInt")
NumPut(TME_LEAVE, TRACKMOUSEEVENT, 4, "UInt")
NumPut(hwndFrom, TRACKMOUSEEVENT, 8, "Ptr")
DllCall("TrackMouseEvent", Ptr, &TRACKMOUSEEVENT)
PropertyWinListViews[hwndFrom].MouseOver := 1
}
}
}
OnPropertyWinContainerWindowProc_CallWindowProc:
return DllCall("CallWindowProc", Ptr,A_EventInfo, Ptr,hwnd, UInt,msg, Ptr,wParam, Ptr,lParam)
}
OnPropertyWinItemEdit(){
PropertyWinGetCurrentProperty(GroupName, PropertyName, Property)
Type := Property.Get("Type")
PropertyLayout := PropertyWinPropertyTypeLayouts[Type]
if(Type = "Int" or Type = "IntToggle"){
GuiControlGet Value, , % PropertyLayout.Controls.Edit
ValidateIntegerValue(Value)
if(Type = "Int")
CurrentControlData[PropertyName] := Value
else{
CurrentControlData[PropertyName][2] := Value
GuiControlGet Value, , % PropertyLayout.Controls.Checkbox
CurrentControlData[PropertyName][1] := Value = -1 and Property.Get("Default") = ""
? ""
: Value = 1 ? "Yes" : "No"
}
}
else if(Type = "XY"){
GuiControlGet ValueX, , % PropertyLayout.Controls.EditX
GuiControlGet ValueY, , % PropertyLayout.Controls.EditY
ValidateIntegerValue(ValueX)
ValidateIntegerValue(ValueY)
if(!CurrentControlData.HasKey(PropertyName) or !IsObject(CurrentControlData[PropertyName]))
CurrentControlData[PropertyName] := [ValueX, ValueY]
else
CurrentControlData[PropertyName][1] := ValueX
, CurrentControlData[PropertyName][2] := ValueY
}
else if(Type = "Toggle"){
GuiControlGet Value, , % PropertyLayout.Controls.Checkbox
CurrentControlData[PropertyName] := Value = -1 and Property.Get("Default") = ""
? ""
: Value = 1 ? "Yes" : "No"
}
else if(Type = "Text" or Type = "TextToggle" or Type = "MultiText"){
GuiControlGet Value, , % PropertyLayout.Controls.Edit
if(Property.Get("GuiDelimiter"))
StringReplace Value, Value, % CurrentGui.Delimiter, %GUI_DELIMITER%, 1
if(Type = "TextToggle"){
CurrentControlData[PropertyName][2] := Value
GuiControlGet Value, , % PropertyLayout.Controls.Checkbox
CurrentControlData[PropertyName][1] := Value = -1 and Property.Get("Default") = ""
? ""
: Value = 1 ? "Yes" : "No"
}
else
CurrentControlData[PropertyName] := Value
}
else if(Type = "Date"){
GuiControlGet Value, , % PropertyLayout.Controls.DateTime