-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathRM2.ahk
1983 lines (1921 loc) · 74.6 KB
/
RM2.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
;Modified by Electrocret from compatibility with Harmony
;===Description=========================================================================
/*
RM2module (Radial menu 2 module)
Author: Boris Mudrinić (Learning one on AHK forum)
Contact: [email protected]
Thanks: Chris Mallett, Tic (Tariq Porter), Majkinetor (Miodrag Milić), TomXIII, and others...
Link: www.autohotkey.com/community/viewtopic.php?f=2&t=50813
Version: 2.22
Requires Gdip.ahk by Tic: www.autohotkey.com/community/viewtopic.php?f=2&t=32238
LICENSE:
As the author of "RM2module", I'm reserving all my rights but I'm allowing the following:
You may use this module in your personal, non-commercial AutoHotkey scripts, written by you.
Without my written permission, nobody is allowed to have any profit from this module or any script/program that uses it.
You may upload any part of this module only on english AutoHotkey forum or www.autohotkey.net. Description section must
remain at beginning of this module. I'm not responsible for any damages arising from the use of this module. Everyone is
encouraged to improve it, but no matter how much anyone improve it, my share in authorship will always be minimum 91%.
If you notice any sort of license or copyright violation by any person, you agree that you will report that to me
immediately and that you will testify on court in case of litigation. On issues not regulated with this license Croatian
laws apply. In case of litigation, Croatian laws and language apply and Municipal court in Zagreb has jurisdiction.
If you don't agree on all terms in this license, you are not allowed to use this module on any way, you can't even just take
a look at it or study it, and you must delete it from computer and any other device that can store electronic data immediately.
*/
;===Documentation=======================================================================
/*
this.RM2_On(SkinDir,SkinOverride="",ItemGlowGuiNum=99)
Call this function before you start creating menus.
SkinDir loads skin form specified directory
SkinOverride you can override any skin attribute + ItemLayoutPerRing here. Syntax example: "ItemSize.80 RadiusSizeFactor.0.85 TextRendering.4"
ItemGlowGuiNum Item glow consumes one GUI per all created menus in script. Here you can specify its GUI number.
This function checks was GDI+ initialized or not.
If GDI+ is not initialized, than this.RM2_On() automatically calls this.Gdip_Startup(), stores pToken in this.RM2_Reg("pToken"), and calling this.RM2_Off() will automatically call this.Gdip_Shutdown().
If GDI+ is initialized, than this.RM2_On() will not call this.Gdip_Startup() again, and calling this.RM2_Off() will not call this.Gdip_Shutdown(), so user will have to call it himself.
this.RM2_Off() ; Call this function after you created all menus you need. It disposes of loaded skin images and frees memory. If pToken is stored in this.RM2_Reg("pToken"), it automatically calls this.Gdip_Shutdown() and shuts down GDI+.
this.RM2_CreateMenu(GuiNum,ItemAttributes,SpecMenuBack="",SpecMenuFore="",OneRingerAtt="",CentralTextOrImageAtt="")
Creates radial menu. Returns "GuiNum"
GuiNum:
Every menu uses one GUI, so here specify menu's GUI number.
ItemAttributes:
"|" is separator between items
">" is separator between item's Text>Icon>Tooltip>Submenu>SpecItemBack>SpecItemFore
Blank item "||" is separator.
Example: "Item1Text|Item2Text>C:\Item2Icon.png>Item2Tooltip||>C:\Item4Icon.png"
"ntt" in Tooltip means "no Tooltip", if <blank>, Tooltip is automated, if something else - specified Tooltip applies.
For SpecItemBack SpecItemFore the same logic as for SpecMenuBack and SpecForeBack applies.
"Submenu" doesn't create real link between main menu and its submenus (for now), it just creates submenu mark in item - two tiny stars.
SpecMenuBack can be:
<blank> than menu background from skin applies
<full path of special menu background>
"nb" which means no background
(Note: specified SpecMenuBack overrides menu background from skin)
SpecMenuFore can be:
<blank> than menu foreground from skin applies
<full path of special menu foreground>
"nf" which means no foreground
(Note: specified SpecMenuFore is drawn above menu foreground from skin)
OneRingerAtt:
if blank, menu is multi ringer, if anything else it's one ringer. Supports two optional subparameters:
FixedRadius.<value> Menu radius is automated - it depends on number of items unless it's fixed.
MinRadius.<value> 58 is default.
examples:
this.RM2_CreateMenu(1, "1|2|3|4|5|6|7|8|9", "", "",1 ) ; creates one ring menu with auto radius
this.RM2_CreateMenu(1, "1|2|3|4|5|6|7|8|9", "", "", "FixedRadius.100") ; creates one ring menu with radius fixed at 100 pixels.
CentralTextOrImageAtt:
">" is separator between CentralText>CentralImage>CentralImageSizeFactor
To get handle of menu's window (WinodwID), call: this.RM2_Reg("M" GuiNum "#HWND"). Example: Menu3HWND := this.RM2_Reg("M3#HWND")
this.RM2_Show(GuiNum, x="", y="")
x, y parameters. If x is :
<blank> shows menu under mouse
"c" or "Center" shows menu on the center of the screen
<else> shows menu centered at x,y coordinates relative to screen
this.RM2_ShowAsSubmenu(ChildGuiNum, ParentGuiNum, ParentItemNumber)
; for example, this.RM2_ShowAsSubmenu(2, 1, 3) means: show menu number 2 as submenu that belongs to 3. item in menu number 1.
this.RM2_Hide(GuiNum)
this.RM2_GetSelectedItem(GuiNum, SelectMethod="", key="", options="", StartX="", StartY="")
Returns selected item.
SelectMethod:
"c" click to select
<anything else> release to select
key: a key that has to be clicked or released to return from this function.
If key is <blank>, if SelectMethod is:
- "click to select" key is automatically set to LButton
- "release to select" key is automatically set to refined A_ThisHotkey.
If key is <not blank>, specified key applies.
Options (white space separated):
"gn" appends "|" and menu's Gui number to return value if item is selected. Think about it as %A_ThisMenuItem%|%A_ThisMenu%
"pos" returns item's position instead of it's refined text. Refined text is item's text (precedence) or icon's file name without extension.
"rc" after selection, return mouse to the center of menu, but if user doesn't select anything, don't return it. Similar to "ri" in RMmodule.
"ntt" no ToolTips
"bc.<value>" blink count if user selected item
"bs.<value>" blink sleep (sleep between blinks) if user selected item
"iicr.<value>" "is in circle return" - returns specified value if user selected "close menu circle" (center of menu). Return value should be some
forbidden character like: "|" or ">"
"foh.<FunctionName>.<parameter1>.<parameter2>" "function on hoover" Function to call when mouse is over new item. Designed for SoundOnHover in RM app.
for example "foh.RMApp_PostMessage.RMSoundOnHover.1" option calls "RMApp_PostMessage("RMSoundOnHover",1)"
this.RM2_Handler(GuiNum, SelectMethod="", key="", options="",ShowPosX="", ShowPosY="")
This function is a shortcut that combines this.RM2_Show(), this.RM2_GetSelectedItem() and this.RM2_Hide() in one.
For first 4 parameters see this.RM2_GetSelectedItem(). For last 2 parameters see this.RM2_Show()
Returns selected item.
this.RM2_Version() ; returns RM2modules' version
this.RM2_CreateLayeredWin(GuiNum,pBitmap,DrawControlOutline=0) ; Creates layered window from pBitmap and returns its HWND (WinID)
this.RM2_CreateItemBitmap(ItemAttributes="",ItemSize="")
Creates Item/Dock bitmap. Returns pBitmap.
ItemAttributes ">" is separator between item's Text>Icon>Tooltip>Submenu>SpecItemBack>SpecItemFore. (Just one item)
ItemSize if blank --> ItemSize from skin applies, else --> specified size applies (not finished yet!)
this.RM2_SaveButtonToFile(FilePath, ItemAttributes="", Size="")
For "ItemAttributes" and "Size" see this.RM2_CreateItemBitmap(). Use ".png" formats!
;====== RM as dock ======
this.RM2_CreateDock(GuiNum, ItemAttributes="", ChildMenu="", Size="") {
Creates dock. Returns GuiNum.
GuiNum Every dock uses one GUI, so here specify dock's GUI number.
ItemAttributes ">" is separator between item's Text>Icon>Tooltip>Submenu>SpecItemBack>SpecItemFore. (Just one item).
ChildMenu specify which menu (GuiNum) you want to show when you click on dock. To show nothing, leave it blank.
Size if blank --> ItemSize from skin applies, else --> specified size applies (not finished yet!)
To get handle of dock's window (WinodwID), call: this.RM2_Reg("M" GuiNum "#HWND"). Example: Dock3HWND := this.RM2_Reg("M3#HWND")
this.RM2_DockHandler(SelectMethod="", Options = "", EnableMoveKey = "Control") {
This function is responsible for getting selected item or moving dock if EnableMoveKey + LButton are down.
"Dock to handle" is a window on which user clicked, if it is a dock.
Returns selected item from ChildMenu. If dock hasn't got assigned ChildMenu, function returns "|" A_Gui
SelectMethod same as for this.RM2_GetSelectedItem() (release or click to select)
Options same as for this.RM2_GetSelectedItem() + one aditional;
"cm" - centers mouse on the dock after click down
EnableMoveKey EnableMoveKey + LButton down enables moving dock
this.RM2_DockHandler2(SelectMethod="", Options = "", EnableMoveKey = "Control") { ; custom version of this.RM2_DockHandler()
Same as this.RM2_DockHandler, but here "dock to handle" is window under mouse (not active, clicked window), if it is a dock. Allows to handle not active dock.
this.RM2_ShowDocks(DocksToShowList="") {
Comma delimited list of docks to show. Hides all other. ShowDocks() hides all docks (like this.RM2_HideAllDocks())
this.RM2_IsDockUnderMouse() { ; returns 1 if dock is under mouse
this.RM2_IsDock(GuiNum) ; checks is specified GuiNum dock or not.
this.RM2_ShowAllDocks()
this.RM2_HideAllDocks()
To show/hide just one dock, use;
- RM_Show(GuiNum) and RM_Hide(GuiNum), or
- "Gui %GuiNum%:Show" and "Gui %GuiNum%:Hide"
this.RM2_SetDocksToDesktop(GuiNumbers="")
Comma delimited list of docks to set to desktop. If blank, sets all existing docks to desktop.
Examples: this.RM2_SetDocksToDesktop("2,4,6"), this.RM2_SetDocksToDesktop()
;======RM in standard GUI======
this.RM2_DrawOnPic(ControlHwnd,ItemAttributes="",Size="") {
Creates and draws button on a GUI picture (which must have "0xE" style).
ControlHwnd hwnd of control on which you want to draw button
ItemAttributes, Size same as for this.RM2_CreateDock().
this.RM2_PicHandler(MenuToShow, ControlHwnd="",Options="", SelectMethod="") {
Shows menu above GUI picture and returns selected item.
MenuToShow here specify which menu you want to show when you click on GUI picture.
ControlHwnd hwnd of control above which you want to show menu. If blank, control under mouse applies.
Options same as for this.RM2_GetSelectedItem()
SelectMethod same as for this.RM2_GetSelectedItem() (release or click to select)
;====== Other functions ======
this.RM2_IsGdipStartedUp() returns 1 if Gdip is started up or blank value otherwise
this.RM2_IsRM2moduleOn() returns 1 if RM2module is turned on or blank value otherwise
this.RM2_DoesExist(GuiNum) returns 1 if menu or dock (identified by GuiNum) exists or blank value otherwise
this.RM2_IsDock(GuiNum) returns 1 if GuiNum is dock or blank value otherwise
this.RM2_IsMenu(GuiNum) returns 1 if GuiNum is menu or blank value otherwise
this.RM2_Reg("MenusList") returns list of existing menus. Example: "11,12,13"
this.RM2_Reg("DocksList") returns list of existing docks. Example: "17,18"
this.RM2_GetMenusHwndList() returns comma delimited list of menu window hwnds
this.RM2_GetDocksHwndList() returns comma delimited list of dock window hwnds
this.RM2_IsMenuUnderMouse() returns 1 if menu is under mouse
this.RM2_IsDockUnderMouse() returns 1 if dock is under mouse
this.RM2_Delete(GuiNum) deletes menu or dock, empties/updates registers and destroys GUI
this.RM2_Redraw() redraws all radial menus and docks. Useful if you have "layered windows are not visible after resuming from hibernation" problem.
;====== Notes ======
If you are using:
- AutoHotkey (_L), GuiNum in all RM2 functions can be number or string (named Gui)
- AutoHotkey Basic, GuiNum in all RM2 functions can be only number
*/
;===Functions===========================================================================
RM2_Version() {
return 2.22
}
RM2_On(SkinDir,SkinOverride="",ItemGlowGuiNum=99) {
static SkinAttributes := "ItemSize,RadiusSizeFactor,ItemLayoutPerRing,AutoSubmenuMarking,AutoSubmenuMark,TextBoxShrink,ItemGlow,TextFont,TextSize,TextColor,TextTrans,TextRendering,TextShadow,TextShadowColor,TextShadowTrans,TextShadowOffset,IconShrink,IconTrans,ItemBack,ItemBackShrink,ItemBackTrans,ItemFore,ItemForeShrink,ItemForeTrans,ItemShadow,ItemShadowShrink,ItemShadowTrans,MenuBack,MenuBackSize,MenuBackTrans,MenuBackOuterRim,MenuBackOuterRimWidth,MenuBackOuterRimTrans,MenuFore,MenuForeSize,MenuForeTrans,SkinText,SkinAuthor,SkinAbout,MenuShadowWidth,MenuShadowInnerColor,MenuShadowOuterColor,MenuBackHatchStyle,MenuBackHatchFrontColor,MenuBackHatchBackColor,MenuBackHatchShrink,MenuBackOuterRimHatchStyle,MenuBackOuterRimHatchFrontColor,MenuBackOuterRimHatchBackColor,MenuBackOuterRimHatchShrink,ItemBackHatchStyle,ItemBackHatchFrontColor,ItemBackHatchBackColor,ItemBackHatchShrink,MenuBackCenter,MenuBackCenterShrink"
if (this.RM2_Reg("IsRM2moduleOn") = 1)
return
if (this.RM2_IsGdipStartedUp() != 1) {
pToken := this.Gdip_Startup()
if !pToken
{
MsgBox, 64, GDI+ error, GDI+ failed to start. Please ensure you have GDI+ on your system.`n`nApplication will exit.
}
this.RM2_Reg("pToken", pToken)
}
FileRead, Variables, %SkinDir%\Skin definition.txt
if ErrorLevel
{
MsgBox,64, RM2module error, Skin definition not found:`n%SkinDir%\Skin definition.txt`n`nApplication will exit.
}
StringReplace, Variables, Variables, `r, ,all
Loop, parse, Variables, `n
{
Field := A_LoopField
if Field is space
Continue
while (SubStr(Field,1,1) = A_space or SubStr(Field,1,1) = A_Tab)
StringTrimLeft, Field, Field, 1
if (SubStr(Field, 1, 1) = ";")
Continue
While (SubStr(Field,0,1) = A_space or SubStr(Field,0,1) = A_Tab or SubStr(Field,0,1) = "`r")
StringTrimRight, Field, Field, 1
EqualPos := InStr(Field, "=")
if (EqualPos = 0)
Continue
var := SubStr(Field, 1, EqualPos-1)
StringReplace, var, var, %A_Space%, ,all
StringReplace, var, var, %A_Tab%, ,all
if var is space
Continue
val := SubStr(Field, EqualPos+1)
while (SubStr(val,1,1) = A_space or SubStr(val,1,1) = A_Tab)
StringTrimLeft, val, val, 1
if val is space
val =
%var% := val
}
if (SkinOverride != "")
{
Loop, Parse, SkinOverride, %A_Space%
{
Field := A_LoopField
DotPos := InStr(Field, ".")
if (DotPos = 0)
Continue
var := SubStr(Field, 1, DotPos-1)
val := SubStr(Field, DotPos+1)
%var% := val
}
}
this.RM2_Default(ItemBackShrink,1), this.RM2_Default(ItemForeShrink,1), this.RM2_Default(ItemShadowShrink,1), this.RM2_Default(MenuBackOuterRimTrans,1)
this.RM2_Default(AutoSubmenuMark, "**")
ItemLayoutPerRing := this.RM2_RefineItemLayoutPerRing(ItemLayoutPerRing)
StringSplit, v, ItemLayoutPerRing, .
MaxItemsPerMenu := v1 + v2 + v3 + v4, this.RM2_Reg("MaxItemsPerMenu",MaxItemsPerMenu)
RefineMatrixList = IconTrans ItemBackTrans ItemForeTrans ItemShadowTrans MenuBackTrans MenuBackOuterRimTrans MenuForeTrans
Loop, parse, RefineMatrixList, %A_space%
this.RM2_RefineMatrix(%A_LoopField%)
Loop, parse, SkinAttributes, `,
{
CurValue := %A_LoopField%
this.RM2_Reg(A_LoopField,CurValue)
}
this.RM2_Reg("SkinDir", SkinDir), this.RM2_Reg("SkinOverride", SkinOverride, 1), this.RM2_Reg("RadiusSizeFactor", RadiusSizeFactor)
pItemBack := this.RM2_ResizeBitmap(ItemSize, SkinDir "\" ItemBack)
pItemFore := this.RM2_ResizeBitmap(ItemSize, SkinDir "\" ItemFore)
pItemShadow := this.RM2_ResizeBitmap(ItemSize, SkinDir "\" ItemShadow)
this.RM2_RegBitmaps("pItemBack",pItemBack), this.RM2_RegBitmaps("pItemFore",pItemFore), this.RM2_RegBitmaps("pItemShadow",pItemShadow)
if (FileExist(SkinDir "\" MenuBackCenter) != "") {
MenuBackCenterSize := ItemSize-MenuBackCenterShrink*2
pMenuBackCenter := this.RM2_ResizeBitmap(MenuBackCenterSize, SkinDir "\" MenuBackCenter)
this.RM2_RegBitmaps("pMenuBackCenter", pMenuBackCenter), this.RM2_Reg("MenuBackCenterSize", MenuBackCenterSize)
}
this.RM2_GetLayout(ItemSize,RadiusSizeFactor,ItemLayoutPerRing, RadiusRingAll,SizeRingAll,Offsets)
this.RM2_Reg("RadiusRingAll",RadiusRingAll), this.RM2_Reg("SizeRingAll",SizeRingAll), this.RM2_Reg("Offsets",Offsets)
FromSkin := TextBoxShrink "|" TextFont "|" TextSize "|" TextColor "|" TextTrans "|" TextRendering "|" TextShadow "|" TextShadowColor "|" TextShadowTrans "|" TextShadowOffset "|" IconShrink "|" IconTrans "|" ItemBackShrink "|" ItemBackTrans "|" ItemForeShrink "|" ItemForeTrans "|" ItemShadowShrink "|" ItemShadowTrans
this.RM2_Reg("FromSkin",FromSkin)
pItemGlow := this.RM2_ResizeBitmap(ItemSize, SkinDir "\" ItemGlow)
ItemGlowHWND := this.RM2_CreateLayeredWin(ItemGlowGuiNum,pItemGlow)
this.Gdip_DisposeImage(pItemGlow)
this.RM2_Reg("ItemGlowHWND", ItemGlowHWND), this.RM2_Reg("ItemGlowGuiNum", ItemGlowGuiNum)
this.RM2_Reg("ItemSize", ItemSize), this.RM2_Reg("ItemGlow", ItemGlow)
this.RM2_Reg("IsRM2moduleOn", 1)
}
RM2_Off() {
if (this.RM2_Reg("IsRM2moduleOn") != 1)
return
this.Gdip_DisposeImage(this.RM2_RegBitmaps("pItemBack")), this.RM2_RegBitmaps("pItemBack", "", 1)
this.Gdip_DisposeImage(this.RM2_RegBitmaps("pItemFore")), this.RM2_RegBitmaps("pItemFore", "", 1)
this.Gdip_DisposeImage(this.RM2_RegBitmaps("pItemShadow")), this.RM2_RegBitmaps("pItemShadow", "", 1)
this.Gdip_DisposeImage(this.RM2_RegBitmaps("pMenuBackCenter")), this.RM2_RegBitmaps("pMenuBackCenter", "", 1)
Loop, 3
{
this.Gdip_DisposeImage(this.RM2_RegBitmaps("pMenuBackLayerRing" A_index)), this.RM2_RegBitmaps("pMenuBackLayerRing" A_index, "", 1)
this.Gdip_DisposeImage(this.RM2_RegBitmaps("pMenuForeLayerRing" A_index)), this.RM2_RegBitmaps("pMenuForeLayerRing" A_index, "", 1)
}
pToken := this.RM2_Reg("pToken")
if (pToken != "")
this.Gdip_Shutdown(pToken), this.RM2_Reg("pToken", "", 1)
this.RM2_Reg("IsRM2moduleOn", "", 1)
}
RM2_IsGdipStartedUp() {
pPen := this.Gdip_CreatePen("0xffffffff", 1)
if pPen
this.Gdip_DeletePen(pPen1), ToReturn := 1
return ToReturn
}
RM2_IsRM2moduleOn() {
return this.RM2_Reg("IsRM2moduleOn")
}
RM2_DoesExist(GuiNum) {
if (this.RM2_Reg("M" GuiNum "#HWND") != "")
return 1
}
RM2_IsMenu(GuiNum) {
MenusList := this.RM2_Reg("MenusList")
if GuiNum in %MenusList%
return 1
}
RM2_Delete(GuiNum) {
if (this.RM2_DoesExist(GuiNum) = 1) {
Gui %GuiNum%: Destroy
this.RM2_Reg("M" GuiNum "#HWND", "", 1)
this.RM2_Reg("M" GuiNum "#MenuRadius", "", 1)
this.RM2_Reg("M" GuiNum "#LastShowCoords", "", 1)
if (this.RM2_IsMenu(GuiNum) = 1) {
MaxItemsPerMenu := this.RM2_Reg("MaxItemsPerMenu")
Loop % MaxItemsPerMenu
{
this.RM2_RegTOI("M" GuiNum "#I" A_Index, "", 1)
this.RM2_RegTT("M" GuiNum "#I" A_Index, "", 1)
}
if this.RM2_Reg("M" GuiNum "#IsOneRinger") {
TotalItems := this.RM2_RegOR("M" GuiNum "#TotalItems")
Loop % TotalItems
this.RM2_RegOR("M" GuiNum "#I" A_index "#Offset", "", 1)
this.RM2_RegOR("M" GuiNum "#RingRadius", "", 1)
this.RM2_RegOR("M" GuiNum "#TotalItems", "", 1)
this.RM2_Reg("M" GuiNum "#IsOneRinger", "", 1)
}
this.RM2_Reg("M" GuiNum "#TotalRings", "", 1)
NewMenusList := this.RM2_RemoveFromList(this.RM2_Reg("MenusList"), GuiNum)
this.RM2_Reg("MenusList", NewMenusList, 1)
this.RM2_RegBackup("M" GuiNum "#ItemAttributes", "", 1)
this.RM2_RegBackup("M" GuiNum "#SpecMenuBack", "", 1)
this.RM2_RegBackup("M" GuiNum "#SpecMenuFore", "", 1)
this.RM2_RegBackup("M" GuiNum "#OneRingerAtt", "", 1)
this.RM2_RegBackup("M" GuiNum "#CentralTextOrImageAtt", "", 1)
}
else if (this.RM2_IsDock(GuiNum) = 1) {
this.RM2_RegD("D" GuiNum "#ChildMenu", "", 1), this.RM2_RegD("D" GuiNum "#ToolTip", "", 1)
NewDocksList := this.RM2_RemoveFromList(this.RM2_Reg("DocksList"), GuiNum)
this.RM2_Reg("DocksList", NewDocksList, 1)
this.RM2_RegBackup("M" GuiNum "#ItemAttributes", "", 1)
this.RM2_RegBackup("M" GuiNum "#ChildMenu", "", 1)
this.RM2_RegBackup("M" GuiNum "#Size", "", 1)
}
}
}
RM2_Redraw() {
if (this.RM2_Reg("IsRM2moduleOn") != 1) {
this.RM2_On(this.RM2_Reg("SkinDir"), this.RM2_Reg("SkinOverride"), this.RM2_Reg("ItemGlowGuiNum"))
TurnItOff := 1
}
else {
pItemGlow := this.RM2_ResizeBitmap(this.RM2_Reg("ItemSize"), this.RM2_Reg("SkinDir") "\" this.RM2_Reg("ItemGlow"))
ItemGlowHWND := this.RM2_CreateLayeredWin(this.RM2_Reg("ItemGlowGuiNum"), pItemGlow)
this.Gdip_DisposeImage(pItemGlow)
this.RM2_Reg("ItemGlowHWND", ItemGlowHWND)
}
MenusList := this.RM2_Reg("MenusList")
DocksList := this.RM2_Reg("DocksList")
Loop, parse, MenusList, `,
{
GuiNum := A_LoopField
if (DllCall("IsWindowVisible", A_PtrSize ? "Ptr" : "UInt", this.RM2_Reg("M" GuiNum "#HWND")) = 1)
ShowMe := 1
LastShowCoords := this.RM2_Reg("M" GuiNum "#LastShowCoords")
StringSplit, coord, LastShowCoords, |
ItemAttributes := this.RM2_RegBackup("M" GuiNum "#ItemAttributes")
SpecMenuBack := this.RM2_RegBackup("M" GuiNum "#SpecMenuBack")
SpecMenuFore := this.RM2_RegBackup("M" GuiNum "#SpecMenuFore")
OneRingerAtt := this.RM2_RegBackup("M" GuiNum "#OneRingerAtt")
CentralTextOrImageAtt := this.RM2_RegBackup("M" GuiNum "#CentralTextOrImageAtt")
this.RM2_CreateMenu(GuiNum,ItemAttributes,SpecMenuBack,SpecMenuFore,OneRingerAtt,CentralTextOrImageAtt)
if (ShowMe = 1)
this.RM2_Show(GuiNum, coord1, coord2)
else
this.RM2_Show(GuiNum, coord1, coord2, 1)
ShowMe := "", coord1 := "", coord2 := ""
}
Loop, parse, DocksList, `,
{
GuiNum := A_LoopField
if (DllCall("IsWindowVisible", A_PtrSize ? "Ptr" : "UInt", this.RM2_Reg("M" GuiNum "#HWND")) = 1)
ShowMe := 1
LastShowCoords := this.RM2_Reg("M" GuiNum "#LastShowCoords")
StringSplit, coord, LastShowCoords, |
ItemAttributes := this.RM2_RegBackup("M" GuiNum "#ItemAttributes")
ChildMenu := this.RM2_RegBackup("M" GuiNum "#ChildMenu")
Size := this.RM2_RegBackup("M" GuiNum "#Size")
this.RM2_CreateDock(GuiNum, ItemAttributes, ChildMenu, Size)
if (ShowMe = 1)
this.RM2_Show(GuiNum, coord1, coord2)
else
this.RM2_Show(GuiNum, coord1, coord2, 1)
ShowMe := "", coord1 := "", coord2 := ""
}
if (TurnItOff = 1)
this.RM2_Off()
}
RM2_CreateMenu(GuiNum,ItemAttributes,SpecMenuBack="",SpecMenuFore="",OneRingerAtt="",CentralTextOrImageAtt=""){
this.RM2_Delete(GuiNum)
this.RM2_RegBackup("M" GuiNum "#ItemAttributes", ItemAttributes, 1)
this.RM2_RegBackup("M" GuiNum "#SpecMenuBack", SpecMenuBack, 1)
this.RM2_RegBackup("M" GuiNum "#SpecMenuFore", SpecMenuFore, 1)
this.RM2_RegBackup("M" GuiNum "#OneRingerAtt", OneRingerAtt, 1)
this.RM2_RegBackup("M" GuiNum "#CentralTextOrImageAtt", CentralTextOrImageAtt, 1)
MaxItemsPerMenu := this.RM2_Reg("MaxItemsPerMenu")
Loop, parse, ItemAttributes, |
{
c++
if (c > MaxItemsPerMenu) {
c -= 1
break
}
CurItem := A_LoopField
StringSplit, ia, CurItem, >
Texts .= ia1 "|"
Icons .= ia2 "|"
Submenus .= ia4 "|"
SpecItemBacks .= ia5 "|"
SpecItemFores .= ia6 "|"
if !(ia1 = "" and ia2 = "")
{
if !(ia1 = "")
{
AutoTooltip := ia1
this.RM2_RegTOI("M" GuiNum "#I" A_Index, ia1)
}
else
{
SplitPath, ia2,,,,OutNameNoExt
AutoTooltip := OutNameNoExt
this.RM2_RegTOI("M" GuiNum "#I" A_Index, OutNameNoExt)
}
if ia3
{
if (ia3 = "ntt")
CurTooltip := ""
else
{
Transform, ia3, Deref, %ia3%
CurTooltip := ia3
}
}
else
CurTooltip := AutoTooltip
this.RM2_RegTT("M" GuiNum "#I" A_Index, CurTooltip, 1)
}
Loop, 6
ia%A_Index% =
}
TotalItems := c
ItemLayoutPerRing := this.RM2_Reg("ItemLayoutPerRing")
Loop, parse, ItemLayoutPerRing, .
{
if (A_Index = 1)
i := A_LoopField
else
i += A_LoopField
if (TotalItems <= i)
{
TotalRings := A_Index
break
}
}
this.RM2_Reg("M" GuiNum "#TotalRings", TotalRings)
SizeRingAll := this.RM2_Reg("SizeRingAll")
StringSplit, v, SizeRingAll, |
LastRingSize := v%TotalRings%
ItemSize := this.RM2_Reg("ItemSize"), SkinDir := this.RM2_Reg("SkinDir")
if (OneRingerAtt != "")
{
pi :=4*Atan(1)
Loop, Parse, OneRingerAtt, %A_Space%
{
Field := A_LoopField
DotPos := InStr(Field, ".")
if (DotPos = 0)
{
if Field in ntt,gn,rc,pos
%Field% = 1
}
else
{
var := SubStr(Field, 1, DotPos-1)
val := SubStr(Field, DotPos+1)
if var in FixedRadius,MinRadius
%var% := val
}
}
MinRadius := (MinRadius = "") ? "58" : MinRadius
if FixedRadius =
{
RadiusSizeFactor := this.RM2_Reg("RadiusSizeFactor")
RingRadius := ItemSize/(2*Sin(pi/TotalItems))*RadiusSizeFactor
if (RingRadius < MinRadius)
RingRadius := MinRadius
}
Else
RingRadius := FixedRadius
LastRingSize := Round(RingRadius*2 + ItemSize)
Loop, %TotalItems%
{
if A_index = 1
rad := 90*pi/180
Else
{
deg := deg ? deg+(360/TotalItems): (360/TotalItems)+90
rad := deg*pi/180
}
xOffset := RingRadius*(-1*Cos(rad))-ItemSize/2, yOffset := RingRadius*(-1*Sin(rad))-ItemSize/2
xOffset := Round(xOffset), yOffset := Round(yOffset)
Offsets .= xOffset ":" yOffset "|"
this.RM2_RegOR("M" GuiNum "#I" A_index "#Offset", xOffset ":" yOffset)
}
this.RM2_TrimEnd(Offsets)
this.RM2_RegOR("M" GuiNum "#RingRadius", RingRadius)
this.RM2_RegOR("M" GuiNum "#TotalItems", TotalItems)
this.RM2_Reg("M" GuiNum "#IsOneRinger", 1)
}
MenuBack := this.RM2_Reg("MenuBack"), MenuBackSize := this.RM2_Reg("MenuBackSize"), MenuBackTrans := this.RM2_Reg("MenuBackTrans")
MenuBackOuterRim := this.RM2_Reg("MenuBackOuterRim"), MenuBackOuterRimWidth := this.RM2_Reg("MenuBackOuterRimWidth")
MenuBackOuterRimTrans := this.RM2_Reg("MenuBackOuterRimTrans")
IfExist, %SpecMenuBack%
pMenuBackLayerFinal := this.RM2_CreateMenuBackLayer(LastRingSize,ItemSize, SkinDir "\" MenuBackOuterRim "|" MenuBackOuterRimTrans "|" MenuBackOuterRimWidth
, SpecMenuBack "|" MenuBackTrans "|" MenuBackSize)
else if (SpecMenuBack = "nb" or SpecMenuBack = "no back")
pMenuBackLayerFinal =
else if !(OneRingerAtt = "")
pMenuBackLayerFinal := this.RM2_CreateMenuBackLayer(LastRingSize,ItemSize, SkinDir "\" MenuBackOuterRim "|" MenuBackOuterRimTrans "|" MenuBackOuterRimWidth
, SkinDir "\" MenuBack "|" MenuBackTrans "|" MenuBackSize)
else
{
MenuBackForThisRing := this.RM2_RegBitmaps("pMenuBackLayerRing" TotalRings)
if MenuBackForThisRing
pMenuBackLayerFinal := this.RM2_CloneBitmap(MenuBackForThisRing)
else
{
pMenuBackLayer := this.RM2_CreateMenuBackLayer(LastRingSize,ItemSize, SkinDir "\" MenuBackOuterRim "|" MenuBackOuterRimTrans "|" MenuBackOuterRimWidth
, SkinDir "\" MenuBack "|" MenuBackTrans "|" MenuBackSize)
this.RM2_RegBitmaps("pMenuBackLayerRing" TotalRings, pMenuBackLayer)
pMenuBackLayerFinal := this.RM2_CloneBitmap(pMenuBackLayer)
}
}
pItemBack := this.RM2_RegBitmaps("pItemBack"), pItemFore := this.RM2_RegBitmaps("pItemFore"), pItemShadow := this.RM2_RegBitmaps("pItemShadow")
AutoSubmenuMarking := this.RM2_Reg("AutoSubmenuMarking"), FromSkin := this.RM2_Reg("FromSkin")
this.RM2_TrimEnd(Texts), this.RM2_TrimEnd(Icons), this.RM2_TrimEnd(SpecItemBacks), this.RM2_TrimEnd(SpecItemFores), this.RM2_TrimEnd(Submenus)
if !(OneRingerAtt = "")
{
pBackAndItemsLayer := this.RM2_CreateBackAndItemsLayerOR(pMenuBackLayerFinal, pItemBack,pItemFore,pItemShadow,Offsets,ItemSize,LastRingSize,AutoSubmenuMarking
,FromSkin,Texts,Icons,SpecItemBacks,SpecItemFores,Submenus,CentralTextOrImageAtt)
}
else
{
Offsets := this.RM2_Reg("Offsets")
pBackAndItemsLayer := this.RM2_CreateBackAndItemsLayer(pMenuBackLayerFinal, pItemBack,pItemFore,pItemShadow,Offsets,ItemSize,SizeRingAll,ItemLayoutPerRing,AutoSubmenuMarking
,FromSkin,Texts,Icons,SpecItemBacks,SpecItemFores,Submenus,CentralTextOrImageAtt)
}
MenuFore := this.RM2_Reg("MenuFore"), MenuForeSize := this.RM2_Reg("MenuForeSize"), MenuForeTrans := this.RM2_Reg("MenuForeTrans")
if (SpecMenuFore = "nf" or SpecMenuFore = "no fore")
pMenuForeLayerFinal =
else if !(OneRingerAtt = "")
{
MenuForeSize := (MenuForeSize = "") ? "Add+0" : MenuForeSize
pMenuForeLayerFinal := this.RM2_CreateMenuForeLayer(LastRingSize,ItemSize, SkinDir "\" MenuFore "|" MenuForeTrans "|" MenuForeSize)
}
else
{
MenuForeForThisRing := this.RM2_RegBitmaps("pMenuForeLayerRing" TotalRings)
if MenuForeForThisRing
pMenuForeLayerFinal := this.RM2_CloneBitmap(MenuForeForThisRing)
else
{
pMenuForeLayer := this.RM2_CreateMenuForeLayer(LastRingSize,ItemSize, SkinDir "\" MenuFore "|" MenuForeTrans "|" MenuForeSize)
this.RM2_RegBitmaps("pMenuForeLayerRing" TotalRings, pMenuForeLayer)
pMenuForeLayerFinal := this.RM2_CloneBitmap(pMenuForeLayer)
}
}
if !(SpecMenuFore = "nf" or SpecMenuFore = "no fore")
{
IfExist, %SpecMenuFore%
{
if pMenuForeLayerFinal
{
Gspec := this.Gdip_GraphicsFromImage(pMenuForeLayerFinal)
pSpecMenuFore := this.Gdip_CreateBitmapFromFile(SpecMenuFore)
this.Gdip_DrawImage(Gspec, pSpecMenuFore, 1, 1, this.Gdip_GetImageWidth(pMenuForeLayerFinal)-1, this.Gdip_GetImageHeight(pMenuForeLayerFinal)-1)
this.Gdip_DisposeImage(pSpecMenuFore)
this.Gdip_DeleteGraphics(Gspec)
}
else
{
MenuForeSize := (MenuForeSize = "") ? "Add+0" : MenuForeSize
pMenuForeLayerFinal := this.RM2_CreateMenuForeLayer(LastRingSize,ItemSize, SpecMenuFore "|1|" MenuForeSize)
}
}
}
pMenu := this.RM2_MergeMenuLayers(pBackAndItemsLayer,pMenuForeLayerFinal, MenuRadius)
this.Gdip_DisposeImage(pMenuBackLayerFinal), this.Gdip_DisposeImage(pBackAndItemsLayer), this.Gdip_DisposeImage(pMenuForeLayerFinal)
MenuHWND := this.RM2_CreateLayeredWin(GuiNum, pMenu)
this.Gdip_DisposeImage(pMenu)
this.RM2_Reg("M" GuiNum "#" "HWND", MenuHWND)
this.RM2_Reg("M" GuiNum "#" "MenuRadius", MenuRadius)
MenusList := this.RM2_Reg("MenusList")
MenusList := (MenusList = "") ? GuiNum : MenusList "," GuiNum
this.RM2_Reg("MenusList", MenusList)
Return GuiNum
}
RM2_Show(GuiNum, x="", y="", Hide=0) {
if (this.RM2_DoesExist(GuiNum) != 1)
return
CoordMode, mouse, screen
if (x = "")
MouseGetPos, x,y
else if (x = "Center" or x = "c")
x := A_ScreenWidth/2, y := A_ScreenHeight/2
if (this.RM2_Reg("ItemGlowGuiNum") = GuiNum)
MenuRadius := this.RM2_Reg("ItemSize")/2
else
MenuRadius := this.RM2_Reg("M" GuiNum "#" "MenuRadius")
x := Round(x), y := Round(y)
MenuX := Round(x - MenuRadius), MenuY := Round(y - MenuRadius)
if (Hide = 1)
Gui %GuiNum%:Show, x%MenuX% y%MenuY% Hide
else
Gui %GuiNum%:Show, x%MenuX% y%MenuY% NA
this.RM2_Reg("M" GuiNum "#LastShowCoords", x "|" y)
}
RM2_ShowAsSubmenu(ChildGuiNum, ParentGuiNum, ParentItemNumber) {
if (this.RM2_IsMenu(ChildGuiNum) != 1)
return
if (this.RM2_IsMenu(ParentGuiNum) != 1)
return
ParentMenuHWND := this.RM2_Reg("M" ParentGuiNum "#" "HWND")
ParentMenuRadius := this.RM2_Reg("M" ParentGuiNum "#" "MenuRadius")
ItemSize := this.RM2_Reg("ItemSize")
oldDHW := A_DetectHiddenWindows
DetectHiddenWindows, on
WinGetPos, ParentMenuX, ParentMenuY,,, ahk_id %ParentMenuHWND%
IsOneRinger := this.RM2_Reg("M" ParentGuiNum "#IsOneRinger")
if IsOneRinger
CurOffset := this.RM2_RegOR("M" ParentGuiNum "#I" ParentItemNumber "#Offset")
else
CurOffset := this.RM2_Reg("Offset" ParentItemNumber)
StringSplit, co, CurOffset, :
ChildMenuX := ParentMenuX+ParentMenuRadius+co1+ItemSize/2, ChildMenuY := ParentMenuY+ParentMenuRadius+co2+ItemSize/2
this.RM2_Show(ChildGuiNum, ChildMenuX, ChildMenuY)
DetectHiddenWindows, %oldDHW%
}
RM2_Hide(GuiNum){
Gui %GuiNum%: hide
}
RM2_GetSelectedItem(GuiNum, SelectMethod="", key="", options="", StartX="", StartY="") {
Thread, NoTimers
if (this.RM2_DoesExist(GuiNum) != 1)
return
CoordMode, mouse, screen
if (StartX = "") {
LastShowCoords := this.RM2_Reg("M" GuiNum "#LastShowCoords")
StringSplit, lsc, LastShowCoords, |
StartX := lsc1, StartY := lsc2
}
else if (StartX = "Center" or StartX = "c")
StartX := A_ScreenWidth/2, StartY := A_ScreenHeight/2
if (options != "") {
Loop, Parse, options, %A_Space%
{
Field := A_LoopField
DotPos := InStr(Field, ".")
if (DotPos = 0) {
if Field in ntt,gn,rc,pos
%Field% := 1
}
else {
var := SubStr(Field, 1, DotPos-1)
val := SubStr(Field, DotPos+1)
if var in bc,bs,iicr,foh
%var% := val
}
}
}
ItemGlowGuiNum := this.RM2_Reg("ItemGlowGuiNum"), ItemGlowHWND := this.RM2_Reg("ItemGlowHWND")
ItemSize := this.RM2_Reg("ItemSize"), IsOneRinger := this.RM2_Reg("M" GuiNum "#IsOneRinger")
if (foh != "") {
StringSplit, v, foh, .
foh := v1, param1 := v2, param2 := v3
}
if (key = "") {
if (SelectMethod = "c")
key := "LButton"
else
key := RegExReplace(A_ThisHotkey, (A_IsUnicode = 1) ? "(*UCP)^(\w* & |\W*)" : "^(\w* & |\W*)")
}
if (SelectMethod = "c") {
KeyWait, %key%
state := 0
}
else
state := 1
While, (GetKeyState(key,"p") = state) {
Sleep, 20
MouseGetPos, EndX, EndY
if IsOneRinger
SelectedItemNumber := this.RM2_GetSelectedItemNumberOR(StartX, StartY, EndX, EndY, GuiNum)
else
SelectedItemNumber := this.RM2_GetSelectedItemNumber(StartX, StartY, EndX, EndY, GuiNum)
if !(this.RM2_RegTOI("M" GuiNum "#" "I" SelectedItemNumber))
{
SelectedItem := "", LastItemUM := ""
this.RM2_ToolTipFM()
Gui %ItemGlowGuiNum%: hide
}
else
{
SelectedItem := SelectedItemNumber
if !(ntt = 1)
{
CurTT := this.RM2_RegTT("M" GuiNum "#I" SelectedItem)
if (CurTT = "")
this.RM2_ToolTipFM()
else
this.RM2_ToolTipFM(CurTT)
}
if (SelectedItem = LastItemUM)
continue
if IsOneRinger
CurOffset := this.RM2_RegOR("M" GuiNum "#I" SelectedItem "#Offset")
else
CurOffset := this.RM2_Reg("Offset" SelectedItem)
StringSplit, co, CurOffset, :
CurItemGlowX := Round(StartX+co1), CurItemGlowY := Round(StartY+co2)
if foh
%foh%(param1,param2)
Gui %ItemGlowGuiNum%:Show, x%CurItemGlowX% y%CurItemGlowY% NA
LastItemUM := SelectedItem
}
}
this.RM2_ToolTipFM()
if (SelectedItem = "")
{
if (iicr != "") {
RadiusSizeFactor := this.RM2_Reg("RadiusSizeFactor")
IsInCircle := this.RM2_IsInCircle(StartX, StartY, EndX, EndY, (ItemSize*RadiusSizeFactor)/2)
if IsInCircle
{
Gui %ItemGlowGuiNum%: hide
return iicr
}
}
Gui %ItemGlowGuiNum%: hide
return
}
else
{
if (bc = "" or bs = "")
Gui %ItemGlowGuiNum%:hide
else
this.RM2_ItemGlowBlink(ItemGlowGuiNum,bc,bs)
if rc
MouseMove, %StartX%, %StartY%
if !pos
SelectedItem := this.RM2_RegTOI("M" GuiNum "#I" SelectedItem)
if gn
SelectedItem .= "|" GuiNum
}
return SelectedItem
}
RM2_Handler(GuiNum, SelectMethod="", key="", options="",ShowPosX="", ShowPosY="") {
if (this.RM2_DoesExist(GuiNum) != 1)
return
if (ShowPosX = "" or ShowPosX = "c" or ShowPosX = "Center")
ShowPosY := ""
this.RM2_Show(GuiNum, ShowPosX, ShowPosY)
SelectedItem := this.RM2_GetSelectedItem(GuiNum, SelectMethod,key,options), this.RM2_Hide(GuiNum)
return SelectedItem
}
RM2_ItemGlowBlink(ItemGlowGuiNum, Count=1, Sleep=90) {
Loop, %Count%
{
Gui %ItemGlowGuiNum%: hide
Sleep, %Sleep%
Gui %ItemGlowGuiNum%:Show, NA
Sleep, %Sleep%
}
Gui %ItemGlowGuiNum%:hide
}
RM2_CreateBackAndItemsLayer(pMenuBackLayer, pItemBack,pItemFore,pItemShadow,Offsets,ItemSize,SizeRingAll,ItemLayoutPerRing,AutoSubmenuMarking, FromSkin, Texts,Icons,SpecItemBacks,SpecItemFores,Submenus,CentralTextOrImageAtt=""){
static FromSkinOrder := "TextBoxShrink|TextFont|TextSize|TextColor|TextTrans|TextRendering|TextShadow|TextShadowColor|TextShadowTrans|TextShadowOffset|IconShrink|IconTrans|ItemBackShrink|ItemBackTrans|ItemForeShrink|ItemForeTrans|ItemShadowShrink|ItemShadowTrans"
If (Texts = "" and Icons = "")
return
StringSplit, Offset, Offsets, |
StringSplit, SizeRing, SizeRingAll, |
StringSplit, TotalItemsRing, ItemLayoutPerRing, .
StringSplit, value, FromSkin, |
Loop, Parse, FromSkinOrder, |
%A_LoopField% := value%A_Index%
StringSplit, Text, Texts, |
StringSplit, Icon, Icons, |
StringSplit, SpecItemBack, SpecItemBacks, |
StringSplit, SpecItemFore, SpecItemFores, |
StringSplit, Submenu, Submenus, |
StringSplit, ctoi, CentralTextOrImageAtt, >
CentralText := ctoi1, CentralImage := ctoi2, CentralImageSizeFactor := ctoi3
TotalItemsRingAll := TotalItemsRing1 + TotalItemsRing2 + TotalItemsRing3 + TotalItemsRing4
TotalItems := (Text0 >= Icon0) ? Text0 : Icon0
if (TotalItems > TotalItemsRingAll)
TotalItems := TotalItemsRingAll
if (TotalItems <= TotalItemsRing1)
TotalRings = 1
Else if (TotalItems <= TotalItemsRing1 + TotalItemsRing2)
TotalRings = 2
Else if (TotalItems <= TotalItemsRing1 + TotalItemsRing2 + TotalItemsRing3)
TotalRings = 3
Else if (TotalItems <= TotalItemsRing1 + TotalItemsRing2 + TotalItemsRing3 + TotalItemsRing4)
TotalRings = 4
LayerSize := SizeRing%TotalRings%
ShadowWidth := this.Gdip_GetImageWidth(pItemShadow), ShadowHeight := this.Gdip_GetImageHeight(pItemShadow)
LayerSize += ShadowHeight
BackLayerSize := this.Gdip_GetImageWidth(pMenuBackLayer)
if (BackLayerSize > LayerSize)
LayerSize := BackLayerSize, BackLayerX := BackLayerY := 0
else
BackLayerX := BackLayerY := (LayerSize- BackLayerSize)/2
pLayer := this.Gdip_CreateBitmap(LayerSize, LayerSize), G := this.Gdip_GraphicsFromImage(pLayer)
this.Gdip_DrawImage(G, pMenuBackLayer, BackLayerX, BackLayerX, BackLayerSize, BackLayerSize)
CenterX := CenterY := Round(LayerSize/2)
ItemShadowShrink := ItemSize-ItemShadowShrink*ItemSize
ItemBackShrink := ItemSize-ItemBackShrink*ItemSize
ItemForeShrink := ItemSize-ItemForeShrink*ItemSize
TextBoxShrink := ItemSize-TextBoxShrink*ItemSize
TextW := ItemSize-TextBoxShrink*2, TextH := ItemSize-TextBoxShrink*2
IconShrink := ItemSize-IconShrink*ItemSize
if AutoSubmenuMarking
AutoSubmenuMarking := ItemSize-AutoSubmenuMarking*ItemSize
this.Gdip_FontFamilyCreate(TextFont)
ItemBackHatchStyle := this.RM2_Reg("ItemBackHatchStyle")
ItemBackHatchFrontColor := this.RM2_Reg("ItemBackHatchFrontColor")
ItemBackHatchBackColor := this.RM2_Reg("ItemBackHatchBackColor")
ItemBackHatchShrink := this.RM2_Reg("ItemBackHatchShrink")
Loop, %TotalItems%
{
StringSplit, off, offset%A_Index%, :
x := CenterX + off1, y := CenterY + off2
if (Text%A_index% = "" and Icon%A_index% = "")
Continue
this.Gdip_DrawImage(G, pItemShadow, x+ItemShadowShrink, y+ItemSize-ShadowHeight/2
, ItemSize-ItemShadowShrink*2, ShadowHeight,"","","","",ItemShadowTrans)
CurrentSpecItemBack := SpecItemBack%A_index%
if CurrentSpecItemBack
{
if !(CurrentSpecItemBack = "nb" or CurrentSpecItemBack = "no back") {
pCurrentSpecItemBack := this.Gdip_CreateBitmapFromFile(CurrentSpecItemBack)
this.Gdip_DrawImage(G, pCurrentSpecItemBack, x+ItemBackShrink, y+ItemBackShrink, ItemSize-ItemBackShrink*2, ItemSize-ItemBackShrink*2)
this.Gdip_DisposeImage(pCurrentSpecItemBack)
if (ItemBackHatchStyle != "") {
pBrush := this.Gdip_BrushCreateHatch("0x" ItemBackHatchFrontColor, "0x" ItemBackHatchBackColor, ItemBackHatchStyle)
this.Gdip_FillEllipse(G, pBrush, x+ItemBackShrink+ItemBackHatchShrink, y+ItemBackShrink+ItemBackHatchShrink
, ItemSize-ItemBackShrink*2-ItemBackHatchShrink*2, ItemSize-ItemBackShrink*2-ItemBackHatchShrink*2)
this.Gdip_DeleteBrush(pBrush)
}
}
}
Else {
this.Gdip_DrawImage(G, pItemBack, x+ItemBackShrink, y+ItemBackShrink, ItemSize-ItemBackShrink*2, ItemSize-ItemBackShrink*2,"","","","",ItemBackTrans)
if (ItemBackHatchStyle != "") {
pBrush := this.Gdip_BrushCreateHatch("0x" ItemBackHatchFrontColor, "0x" ItemBackHatchBackColor, ItemBackHatchStyle)
this.Gdip_FillEllipse(G, pBrush, x+ItemBackShrink+ItemBackHatchShrink, y+ItemBackShrink+ItemBackHatchShrink
, ItemSize-ItemBackShrink*2-ItemBackHatchShrink*2, ItemSize-ItemBackShrink*2-ItemBackHatchShrink*2)
this.Gdip_DeleteBrush(pBrush)
}
}
CurrentIcon := Icon%A_index%
pCurrentIcon := this.Gdip_CreateBitmapFromFile(CurrentIcon)
this.Gdip_DrawImage(G, pCurrentIcon, x+IconShrink, y+IconShrink
, ItemSize-IconShrink*2, ItemSize-IconShrink*2,"","","","",IconTrans)
this.Gdip_DisposeImage(pCurrentIcon)
TextX := x+TextBoxShrink, TextY := y+TextBoxShrink
if TextShadow
{
ShadowX := TextX + TextShadowOffset, ShadowY := TextY + TextShadowOffset
Options = x%ShadowX% y%ShadowY% Center Vcenter c%TextShadowTrans%%TextShadowColor% r%TextRendering% s%TextSize%
this.Gdip_TextToGraphics(G, Text%A_index%, Options, TextFont,TextW, TextH )
}
Options = x%TextX% y%TextY% Center Vcenter c%TextTrans%%TextColor% r%TextRendering% s%TextSize%
this.Gdip_TextToGraphics(G, Text%A_index%, Options, TextFont,TextW, TextH )
CurrentSubmenu := Submenu%A_index%
if CurrentSubmenu
{
if AutoSubmenuMarking
{
SubMarkX := x, SubMarkY := y+AutoSubmenuMarking
if TextShadow
{
SubMarkXShadow := SubMarkX + TextShadowOffset, SubMarkYShadow := SubMarkY + TextShadowOffset
Options = x%SubMarkXShadow% y%SubMarkYShadow% Center c%TextShadowTrans%%TextShadowColor% r%TextRendering% s%TextSize%
this.Gdip_TextToGraphics(G, this.RM2_Reg("AutoSubmenuMark"), Options, TextFont,ItemSize, ItemSize-AutoSubmenuMarking*2 )
}
Options = x%SubMarkX% y%SubMarkY% Center c%TextTrans%%TextColor% r%TextRendering% s%TextSize%
this.Gdip_TextToGraphics(G, this.RM2_Reg("AutoSubmenuMark"), Options, TextFont,ItemSize,ItemSize-AutoSubmenuMarking*2)
}
}
CurrentSpecItemFore := SpecItemFore%A_index%
if !(CurrentSpecItemFore = "nf" or CurrentSpecItemFore = "no fore")
{
this.Gdip_DrawImage(G, pItemFore, x+ItemForeShrink, y+ItemForeShrink
, ItemSize-ItemForeShrink*2, ItemSize-ItemForeShrink*2,"","","","",ItemForeTrans)
if CurrentSpecItemFore
{
pCurrentSpecItemFore := this.Gdip_CreateBitmapFromFile(CurrentSpecItemFore)
this.Gdip_DrawImage(G, pCurrentSpecItemFore, x+ItemForeShrink, y+ItemForeShrink
, ItemSize-ItemForeShrink*2, ItemSize-ItemForeShrink*2)
this.Gdip_DisposeImage(pCurrentSpecItemFore)
}
}
}
if FileExist(CentralImage)
{
pCentralImage := this.Gdip_CreateBitmapFromFile(CentralImage)
if CentralImageSizeFactor
{
CentralImageSize := ItemSize*CentralImageSizeFactor
this.Gdip_DrawImage(G, pCentralImage, CenterX - CentralImageSize/2, CenterY - CentralImageSize/2
, CentralImageSize, CentralImageSize)
}
else
{
this.Gdip_DrawImage(G, pCentralImage, CenterX - ItemSize/2+IconShrink, CenterY - ItemSize/2+IconShrink
, ItemSize-IconShrink*2, ItemSize-IconShrink*2,"","","","",IconTrans)
}
this.Gdip_DisposeImage(pCentralImage)
}
if !(CentralText = "")
{
TextX := CenterX - ItemSize/2+TextBoxShrink, TextY := CenterX - ItemSize/2+TextBoxShrink
if TextShadow
{
ShadowX := TextX + TextShadowOffset, ShadowY := TextY + TextShadowOffset
Options = x%ShadowX% y%ShadowY% Center Vcenter c%TextShadowTrans%%TextShadowColor% r%TextRendering% s%TextSize%
this.Gdip_TextToGraphics(G, CentralText, Options, TextFont,TextW, TextH )
}
Options = x%TextX% y%TextY% Center Vcenter c%TextTrans%%TextColor% r%TextRendering% s%TextSize%
this.Gdip_TextToGraphics(G, CentralText, Options, TextFont,TextW, TextH )
}
this.Gdip_DeleteGraphics(G)
Return pLayer
}
RM2_CreateBackAndItemsLayerOR(pMenuBackLayer, pItemBack,pItemFore,pItemShadow,Offsets,ItemSize,LayerSize,AutoSubmenuMarking, FromSkin, Texts,Icons,SpecItemBacks,SpecItemFores,Submenus,CentralTextOrImageAtt="") {
static FromSkinOrder := "TextBoxShrink|TextFont|TextSize|TextColor|TextTrans|TextRendering|TextShadow|TextShadowColor|TextShadowTrans|TextShadowOffset|IconShrink|IconTrans|ItemBackShrink|ItemBackTrans|ItemForeShrink|ItemForeTrans|ItemShadowShrink|ItemShadowTrans"