-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAHK-Studio v1.003.12 - smarq8 fixes
10143 lines (10105 loc) · 374 KB
/
AHK-Studio v1.003.12 - smarq8 fixes
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
#SingleInstance,Off
; #SingleInstance,force
SetBatchLines,-1
SetWorkingDir,%A_ScriptDir%
SetControlDelay,-1
#MaxHotkeysPerInterval,2000
DetectHiddenWindows,On
CoordMode,ToolTip,Screen
global v:=[],MainWin,settings:=new XML("settings","lib\Settings.xml"),files:=new XML("files"),Positions:=new XML("positions","lib\Positions.xml"),cexml:=new XML("cexml"),History:=new XML("HistoryXML"),vversion:=new XML("versions","lib\Versions.xml"),commands,menus,scintilla,TVC:=new EasyView(),RCMXML:=new XML("RCM","lib\RCM.xml"),TNotes,debugwin,Selection:=new SelectionClass(),Menus
if(!settings[]){
Run,lib\settings.xml
m("Oh boy...check the settings file to see what's up.")
}
v.LineEdited:=[]
,v.LinesEdited:=[]
,v.RunObject
; raplaced arg parsing
; \((.*)\) ---> \(([^\(\)\{\}\[\]]*)\)
; ,v.OmniFind:={Function: "OUm`n)^[\s|}]*((\w|[^\x00-\x7F])+)\((.*)\)(\s*;.*\R){0,}\s*(\{)(\s*;\R){0,}" ; old
,v.OmniFind:={Function: "OUm`n)^[\s|}]*((\w|[^\x00-\x7F])+)\(([^\(\)\{\}\[\]]*)\)(\s*;.*\R){0,}\s*(\{)(\s*;\R){0,}" ; new - for detect multiline args
,Class: "Oim`n)^[\s|}]*(class\s+((\w|[^\x00-\x7F])+))[\s+extends\s+\w+\s*]*(\s*;.*\R){0,}\s*(\{)"
,Property: "Om`n)^[\s|}]*((\w|[^\x00-\x7F])+)\[(.*)\](\s*;.*\R){0,}\s*(\{)"
,Label: "UOm`n)^\s*((\w|[^\x00-\x7F])+):[\s|\R][\s+;]?"
,Hotkey: "OUi`nm)^\s*(((\w|[^\x00-\x7F]|#|!|\^|\+|~|\$|&|<|>|\*)+\s+&\s+)*(\w|[^\x00-\x7F]|#|!|\^|\+|~|\$|&|<|>|\*|-|\[|\]|\\|\;|\'|\,|\.|\/)+)::"
,Bookmark: "OU);#\[(.*)\]"
,Breakpoint: "OU);\*\[(.*)\]"
,Instance: "OUi)(\w+)\s*:=\s*new\s*(\w+)\("}
; ,v.OmniFindText:={Function:[ "OUm`n)^[\s|}]*(",")\((.*)\)(\s*;.*\R){0,}\s*(\{)"] ; old
,v.OmniFindText:={Function:[ "OUm`n)^[\s|}]*(",")\(([^\(\)\{\}\[\]]*)\)(\s*;.*\R){0,}\s*(\{)"] ; new - for properly selection
,Class:[ "Oim`n)^[\s|}]*(class\s+(","))[\s+extends\s+\w+\s*]*(\s*;.*\R){0,}\s*(\{)"]
; ,Method:[ "OUm`n)^[\s|}]*(",")\((.*)\)(\s*;.*\R){0,}\s*(\{)"] ; old
,Method:[ "OUm`n)^[\s|}]*(",")\(([^\(\)\{\}\[\]]*)\)(\s*;.*\R){0,}\s*(\{)"] ; new - not sure is it required for something
,Property:[ "Om`n)^[\s|}]*(",")\[(.*)\](\s*;.*\R){0,}\s*(\{)"]
,Label:[ "UOm`n)^\s*(","):[\s|\R][\s+;]?"]
,Bookmark:[ "OU);#\[(",")\]"]
,Breakpoint:[ "OU);\*\[(",")\]"]
,Hotkey:[ "OUi`nm)^\s*(\Q","\E)::"]
,Instance:[ "OUi).*(",")\s*:=\s*new\s*(\w+)\("]}
,v.OmniFindMinimum:={Function:"OUm`n)^[\s|}]*((\w|[^\x00-\x7F])+)\(.*\)"
,Class:"Oim`n)^[\s|}]*(class\s+((\w|[^\x00-\x7F])+))"
,Property:"Om`n)^[\s|}]*((\w|[^\x00-\x7F])+)\[(.*)?\]"}
; ,v.OmniFindString:="OUm`n)(?<Function>^[\s|}]*((\w|[^\x00-\x7F])+)\((.*)\)(\s*;.*\R){0,}\s*(\{)(\s*;\R){0,})|(?<Class>^[\s|}]*(class\s+((\w|[^\x00-\x7F])+))[\s+extends\s+\w+\s*]*(\s*;.*\R){0,}\s*(\{))|(?<Property>^[\s|}]*((\w|[^\x00-\x7F])+)\[(.*)\](\s*;.*\R){0,}\s*(\{))|(?<Label>^\s*((\w|[^\x00-\x7F])+):[\s|\R][\s+;]?)|(?<Hotkey>^\s*(((\w|[^\x00-\x7F]|#|!|\^|\+|~|\$|&|<|>|\*)+\s+&\s+)*(\w|[^\x00-\x7F]|#|!|\^|\+|~|\$|&|<|>|\*|-|\[|\]|\\|\;|\'|\,|\.|\/)+)::)|(?<Bookmark>;#\[(.*)\])|(?<Breakpoint>;\*\[(.*)\])|(?<Instance>(\w+)\s*:=\s*new\s*(\w+)\()" ; old
,v.OmniFindString:="OUm`n)(?<Function>^[\s|}]*((\w|[^\x00-\x7F])+)\(([^\(\)\{\}\[\]]*)\)(\s*;.*\R){0,}\s*(\{)(\s*;\R){0,})|(?<Class>^[\s|}]*(class\s+((\w|[^\x00-\x7F])+))[\s+extends\s+\w+\s*]*(\s*;.*\R){0,}\s*(\{))|(?<Property>^[\s|}]*((\w|[^\x00-\x7F])+)\[(.*)\](\s*;.*\R){0,}\s*(\{))|(?<Label>^\s*((\w|[^\x00-\x7F])+):[\s|\R][\s+;]?)|(?<Hotkey>^\s*(((\w|[^\x00-\x7F]|#|!|\^|\+|~|\$|&|<|>|\*)+\s+&\s+)*(\w|[^\x00-\x7F]|#|!|\^|\+|~|\$|&|<|>|\*|-|\[|\]|\\|\;|\'|\,|\.|\/)+)::)|(?<Bookmark>;#\[(.*)\])|(?<Breakpoint>;\*\[(.*)\])|(?<Instance>(\w+)\s*:=\s*new\s*(\w+)\()" ; new - not sure is it required for something
;,Variable:"Osm`n)(\w+)\s*:=""
/*
Debugging Joe Glines{
have the option to have the Variable browser dockable to the side of debug window.
}
Darth_diggler{
Right Click and Edit from Explorer not selecting the proper file when opening
Downloading plugins does not work in compiled version
Re-Order Icons in toolbars not staying
Also ability to add launching applications from the toolbar
}
Run1e{
studio bugs:
the x-32000 y-32000 thing when maximizing the window the wrong way
highlighting a word underlines the other ones, but it dissapears after a bit and the select duplicates hotkey doesn't work
I think theres a massive memory leak somewhere.. studio slows down to a halt after a while
}
CUSTOM COMMANDS{
needs fixed, when changing things from auto-indent to another area it didn't save
}
#SingleInstance,Force
SysGet,Count,MonitorCount
Loop,%count%
{
SysGet,Mon,Monitor,%A_Index%
Monitors.="Monitor " A_Index "`n`nLeft: " MonLeft " Top: " MonTop " Right: " MonRight " Bottom: " MonBottom "`n`n"
}
MsgBox,% Clipboard:=Monitors "`n`nPlease send this to maestrith"
see if the caption area is within the visible area and if not move it.
when you close make sure that the coordinates are within the same screen that the window is on.
if not
move the coords to the top left or center of that screen and update.
have it check to see if the window (any part) is in the visible area
also check to see if the last GUI position is somewhere on that monitor
if it isn't
update the positions.
Monitor 1
Left: 0 Top: 0 Right: 1920 Bottom: 1200
Monitor 2
Left: 1920 Top: -454 Right: 3000 Bottom: 1466
Ok, I found it. For some reason, with the previous update,
auto complete was disabled in all its various incarnations (you have a lot of auto-complete options lol) and
I found the tooltip-from-documentation thingy I was talking about.
You designated it context sensitive help.
So, those weren't bugs per se, they were just disabled. Didn't expect that since I never had to enable them before
FileCheck(){
DefaultOptions make sure to have them checked for and if they are not in your menus.xml, when you add them in, have them
pre-selected
}
*/
/*
MISC NOT WORKING:
Undo:
When you undo something with more than 1 class it doesn't undo properly
Joe_Glines{
Check Edited Files On Focus:
have it so that it asks first to replace the text rather than automaticxally
More languages (programming)
}
Fix Bugs
Misc Ideas:
more languages (spoken)
When you edit/add a line with an include:{
have it scan that line (add a thing in the Scan_Line() for it)
}
*/
ComObjError(0),FileCheck(%true%),Options("startup"),menus:=new XML("menus","Lib\Menus.xml"),Keywords(),new Omni_Search_Class(),Gui(),DefaultRCM()
return
WinPos(hwnd){
VarSetCapacity(rect,16),DllCall("GetClientRect",ptr,hwnd,ptr,&rect)
WinGetPos,x,y,,,% "ahk_id" hwnd
w:=NumGet(rect,8),h:=NumGet(rect,12),text:=(x!=""&&y!=""&&w!=""&&h!="")?"x" x " y" y " w" w " h" h:""
return {x:x,y:y,w:w,h:h,ah:h-v.status-v.qfh,text:text}
}
DebugWindow(text){
static sc,NewWin
if(!WinExist("ahk_id" sc.sc)){
csc:=csc(),NewWin:=new GUIKeep("Debug"),NewWin.Add("s,w400 h200,,wh")
GuiControl,Debug:+g,% NewWin.sc.1.sc
NewWin.Show("Debug Window",,1),sc:=NewWin.sc.1,sc.2277(1),csc({hwnd:csc.sc})
}
text.="`n"
sc.2003(sc.2006,text),sc.2025(sc.2006)
}
DisplayStats(call){
static lastxml,lastfunc
ControlGetPos,x,y,w,h,,% "ahk_id" MainWin.gui.SSN("//*[@type='Toolbar']/@hwnd").text
MainWin.Gui.Transform()
WinGet,cl,ControlList,% MainWin.ID
(sc:=s.ctrl[MainWin.Gui.SSN("//win[@win='Tracked_Notes']/descendant::control[@type='Scintilla']/@hwnd").text]).2181(0,call "`n`n" MainWin.Gui[] "`n" lastfunc "`n`n" lastxml)
lastxml:=MainWin.Gui[],lastfunc:=call
MarginWidth()
return
}
#Include %A_ScriptDir%
About(){
about=
(
If you wish to use this software, great.
If you wish to use this as a part of your project I require payment.
If you wish to donate to help me with my living expenses please click the donate button at the bottom
I want to thank all of the people who helped this project become a reality.
Chris Mallet - Creator of the original AutoHotkey
All of the people who helped him.
Lexikos - For all of the amazing work on AHK 1.1
All of the people who helped him.
Help from friends who have given me great ideas and bug reports
Uberi,Coco,Tidbit,GeekDude,joedf,budRich,tomoe_uehara,hoppfrosch,Run1e and everyone who I have not listed I am thankful.
All of the editors that I have used for giving me ideas for this project
Special thanks to number1nub and Run1e for helping with the beta testing for the latest version
License for Scintilla and SciTE
Copyright 1998-2002 by Neil Hodgson <[email protected]>
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation.
NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE.
)
Setup(11),Hotkeys(11,{"Esc":"11Close"}), Version:="1.003.12"
Gui,Margin,0,0
sc:=new s(11,{pos:"x0 y0 w700 h500"}),csc({hwnd:sc})
Gui,Add,Button,gdonate,Donate
Gui,Add,Button,x+M gsite,Website
Gui,Show,w700 h550,AHK Studio Help Version: %version%
sc.2181(0,about),sc.2025(0),sc.2268(1)
return
11GuiClose:
11GuiEscape:
hwnd({rem:11})
return
site:
Run,https://github.com/maestrith/AHK-Studio
return
}
List_Variables(){
if(!debug.socket)
return m("Currently no file being debugged","time:1"),debug.off()
VarBrowser(),debug.Send("stack_get")
}
Testing(){
;BraceSetup(1)
sc:=csc()
VarSetCapacity(lang,4)
sc.4012(0,&lang)
if(StrGet(&lang,"UTF-8")="ahk")
sc.4006(0,"xml")
else
sc.4006(0,"ahk")
sc.4003(0,sc.2006)
Color(sc)
return
if(A_UserName!="maestrith")
return m("Testing")
;MouseGetPos,,,,ctrl,2
;m(ctrl+0,MainWin.pe,MainWin.ce,MainWin.tn)
;GuiControl,1:+c0xff00ff,Button1
/*
Gui,1:Font,c0xff00ff,Consolas
WinSet,Redraw,,% hwnd([1])
m(ErrorLevel)
*/
;RefreshThemes()
;m(MainWin.regex)
;GuiControl,1:+c0xff00ff,% MainWin.regex
Reload
/*
WinGet,cl,ControlList,% hwnd([1])
m(cl)
*/
/*
Loop,25
{
Manage_File_Types()
Sleep,1000
Send,{Down}
Sleep,900
Send,{Escape}
Sleep,400
ToolTip,Count: %A_Index%,0,0,4
}
*/
return
/*
sc:=csc()
sc.2198(0)
dup:=[]
cexml.XML.preserveWhiteSpace:=1
current:=Current(5)
list:=SN(current,"descendant::*[@type='Breakpoint']")
while(ll:=list.item[A_Index-1]),ea:=XML.EA(ll){
if(dup[ea.text])
Continue
sc.2686(0,sc.2006),search:=";*[" ea.text "]"
total:=SN(current,"descendant::*[@type='Breakpoint' and @text='" ea.text "']")
while((pos:=sc.2197(StrPut(search,"UTF-8")-1,search))>=0){
sc.2686(pos+1,sc.2006)
total.item[A_Index-1].SetAttribute("line",sc.2166(pos))
}
dup[ea.text]:=1
}
cexml.XML.preserveWhiteSpace:=0
sc.2198(0x2)
;debug.Send("breakpoint_set -t line -f " bpea.filename " -n" bpea.line)
return
*/
/*
;Display current in Code Explorer
SetWords(1),line:=ScanLines((LineNum:=sc.2166(sc.2008))),class:=GetCurrentClass(LineNum),word:=sc.GetWord(),SetWords()
for a,b in v.OmniFind{
if(RegExMatch(line.text,b,found)){
if(class.name){
node:=SSN(Current(5),"descendant::*[@type='Class' and @text='" class.name "']")
if(a="Class")
TVC.Modify(2,,SSN(node,"@cetv").text,"Select Vis Focus")
else if(tv:=SSN(node,"descendant::*[@type='" (a="Function"?"Method":a) "' and @text='" word "']/@cetv").text)
TVC.Modify(2,,tv,"Select Vis Focus")
Break
}else{
if(tv:=SSN(Current(5),"descendant::*[@type='" a "' and @text='" word "']/@cetv").text){
TVC.Modify(2,,tv,"Select Vis Focus")
Break
}
}
}
return
*/
/*
Gui,Separate:Default
doc:=csc().2357
sc:=new s("Separate",{pos:"w400 h400"})
sc.2358(0,doc)
Hotkeys("Separate")
BraceSetup("Separate")
Gui,Show
return
*/
/*
make this a universal thing.
save the last import directory by
*/
FileSelectFile,file,,D:\AHK\Duplicate Programs\AHK Studio,Import from main script,*.ahk
if(ErrorLevel)
return
if(!FileExist(file))
return m("File does not exist")
SplitPath,file,filename
FileCopy,%file%,%A_ScriptDir%\%filename%
if(ErrorLevel)
return m("already there")
sc:=csc(),sc.2003(sc.2008,"#Include " filename "`n"),sc.2025(sc.2008+StrPut("#Include " filename))
SplitPath,file,,dir
settings.Add("Import").text:=dir,Save(),Extract(Current(2).file),ScanFiles(),FEUpdate(1)
}
Activate(a,b,c,d){
if(a&&v.Options.Check_For_Edited_Files_On_Focus=1)
Check_For_Edited()
csc().2400
return 0
}
AddBookmark(line,search){
sc:=csc(),end:=sc.2136(line),start:=sc.2128(line),name:=(settings.SSN("//bookmark").text),name:=name?name:SubStr(StrSplit(Current(2).file,"\").pop(),1,-4)
for a,b in {"$file":SubStr(StrSplit(Current(3).file,"\").pop(),1,-4),"$project":SubStr(StrSplit(Current(2).file,"\").pop(),1,-4)}
name:=RegExReplace(name,"i)\Q" a "\E",b)
if(RegExMatch(name,"UO)\[(.*)\]",time)){
FormatTime,currenttime,%A_Now%,% time.1
name:=RegExReplace(name,"\Q[" time.1 "]\E",currenttime)
}sc.2003(end," " Chr(59) search.1 "[" name "]"),sc.2160(end+4,end+4+StrPut(name,utf-8)-1)
return name
}
AddMissing(){
all:=SN(Current(5),"descendant::*[not(@cetv)]")
while(aa:=all.item[A_Index-1]),ea:=XML.EA(aa){
if(!header:=SSN(aa.ParentNode,"@cetv").text)
header:=Header(ea.type)
aa.SetAttribute("cetv",TVC.Add(2,ea.text,header,(ea.type~="Method|Property"=0?"Sort":"")))
}
}
AddNewLines(text,current){
for a,b in GetAllTopClasses(text){
if((nodes:=SN(current,"descendant::*[@type='Class' and @text='" b.name "']")).length)
Code_Explorer.RemoveTV(nodes)
Class(b.text,current)
for c,d in v.OmniFind{
if(c~="Class|Function|Property")
Continue
pos:=1
while(RegExMatch(b.text,d,found,pos),pos:=found.Pos(1)+found.Len(1)){
if(!found.len(1))
Break
cexml.Under(current,"info",{type:c,text:found.1,upper:Upper(found.1),cetv:TVC.Add(2,found.1,Header(c),"Sort")})
}
}
StringReplace,text,text,% b.text
}
for a,b in v.OmniFind{
if(a="Class")
Continue
pos:=1
while(RegExMatch(text,b,found,pos),pos:=found.Pos(1)+found.Len(1)){
if(!found.len(1))
Break
Default("SysTreeView322")
new:=cexml.Under(current,"info",{type:a,text:found.1,upper:Upper(found.1),cetv:TVC.Add(2,found.1,Header(a),"Sort")})
if(a="Function")
new.SetAttribute("args",found.3)
if(a="Instance")
new.SetAttribute("class",found.2)
}
}
}
AddInclude(Filename:="",text:="",pos:="",Show:=1){
static new
file:=FileOpen(filename,"RW","UTF-8"),file.write(text),file.length(file.position),rel:=RelativePath(Current(2).file,filename),sc:=csc(),current:=Current(4)
SplitPath,filename,fn,dir,ext,nne,drive
FileGetTime,time,%filename%
if(v.Options.Includes_In_Place){
line:=sc.2166(sc.2008)
if(Trim(RegExReplace(sc.GetLine(line),"\R"))){
sc.2003(sc.2136(line),"`n#Include " rel)
if(v.Options.Full_Auto_Indentation)
NewIndent()
}else
sc.2003(sc.2008,"#Include " rel)
}else{
if(SSN(current,"@file").text=Current(3).file)
sc.2003(sc.2006,"`n#Include " rel)
else
Update({file:Current(2).file,text:Update({get:Current(2).file}) "`n#Include " rel}),current.RemoveAttribute("sc")
}
;#[Needs to check to see if it is in a folder first]
new:=files.Under(current,"file",{id:GetID(),encoding:"UTF-8",file:filename,include:"#Include " rel,inside:SSN(current,"@file").text,dir:dir,filename:fn,github:fn,nne:nne,time:time,encoding:"UTF-8",scan:1,tv:TVC.Add(1,fn,SSN(current,"@tv").text,"Sort")}),add:=Current(7).AppendChild(new.CloneNode(1)),add.SetAttribute("type","File"),Update({file:filename,text:text,encoding:"UTF-8",node:current}),ScanFiles(),Code_Explorer.Scan(new),Default("SysTreeView321")
if(Show)
tv(SSN(new,"@tv").text,pos)
}
AutoClass(){
sc:=csc(),line:=sc.2166(sc.2008),text:=sc.TextRange(sc.2128(line),sc.2008)
if(RegExMatch(text,"i)\bnew\b\s+" v.word)){
if(sc.2007(sc.2008)!=40)
sc.2003(sc.2008,"()"),sc.2025(sc.2008+1),Context()
return
}if(sc.2007(sc.2008)!=46)
InsertAll(".",1)
Show_Class_Methods(v.word)
}
AutoMenu(){
AutoMenu:
sc:=csc()
if(sc.2007(sc.2008-1)~="40|123")
return
command:=RegExReplace(Context(1).word,"#")
if(v.word&&sc.2102=0&&v.Options.Auto_Complete){
if(l:=commands.SSN("//Context/" command "/descendant-or-self::list[text()='" RegExReplace(v.word,"#") "']")){
if(!list:=SSN(l,"@list"))
return
Insert:=v.Options.Auto_Space_After_Comma?", ":","
if(sc.2007(sc.2008-StrLen(Insert))!=44)
sc.2003(sc.2008,Insert),sc.2025(sc.2008+StrLen(Insert))
sc.2100(0,list.text,v.word:="")
}}
return
}
BookEnd(add,hotkey){
if(!(add&&hotkey))
return
sc:=csc(),sc.2078,add:=add?add:v.match[hotkey]
loop,% sc.2570
start:=sc.2585(A_Index-1),end:=sc.2587(A_Index-1),sc.2686(end,end),sc.2194(1,add),sc.2686(start,start),sc.2194(1,hotkey),sc.2584(A_Index-1,start+1),sc.2586(A_Index-1,end+1)
sc.2079
}
BraceHighlight(){
sc:=csc()
if(sc.2353(sc.2008-1)>0)
sc.2351(v.bracestart:=sc.2008-1,v.braceend:=sc.2353(sc.2008-1)),v.highlight:=1
else if(sc.2353(sc.2008)>0)
sc.2351(v.bracestart:=sc.2008,v.braceend:=sc.2353(sc.2008)),v.highlight:=1
else if v.highlight
v.bracestart:=v.braceend:="",sc.2351(-1,-1),v.highlight:=0
}
BraceSetup(Win:=1){
static setup:={"<":">",(Chr(34)):Chr(34),"'":"'","(":")","%":"%","{":"}","[":"]","<^>{":"}","<^>[":"]"},keep:=[]
v.AutoAdd:=[],v.BraceMatch:=[],v.MatchBrace:=[],v.BraceDelete:=[],v.DeleteBrace:=[],list:=settings.SSN("//autoadd/@altgr").text?{"<^>[":"]","<^>{":"}"}:{"{":"}","[":"]"}
/*
make this list editable at some point.
*/
Hotkey,IfWinActive,% hwnd([win])
for a,b in setup
Try{
Hotkey,%a%,Brace,On
Hotkey,%b%,Brace,On
v.BraceMatch[a]:=b,v.MatchBrace[b]:=a,v.BraceDelete[SubStr(a,0)]:=b,v.DeleteBrace[b]:=SubStr(a,0)
}
all:=settings.SN("//autoadd/*")
while(aa:=all.item[A_Index-1]),ea:=XML.EA(aa){
Try
Hotkey,% ea.trigger,Brace,On
Catch,e
m(e.message,aa.xml)
v.AutoAdd[SubStr(ea.trigger,0)]:=ea.add ;,v.AutoAdd[ea.add]:=SubStr(ea.trigger,0)
;list.=ea.trigger " completes to " ea.add "`n"
}
if(!(nodes:=settings.SN("//autodelete/*")).length){
node:=settings.Add("autodelete")
for a,b in setup
settings.Under(node,"key",{open:a,close:b})
nodes:=settings.SN("//autodelete/*")
}
;m(list)
return
Brace:
;t(A_ThisHotkey)
ControlGetFocus,focus,A
if(!InStr(focus,"Scintilla")){
Send,{%A_ThisHotkey%}
return
}sc:=csc(),Hotkey:=SubStr(A_ThisHotkey,0),line:=sc.2166(sc.2008)
if(sc.2102)
sc.2101
if(sc.2008!=sc.2009)
return BookEnd(v.BraceMatch[Hotkey],Hotkey)
if(!v.AutoAdd[Hotkey]){
Loop,% sc.2570{
cpos:=sc.2585(A_Index-1)
if(Chr(sc.2007(cpos))=Hotkey)
GoToPos(A_Index-1,cpos+1)
else
sc.2686(cpos,cpos),sc.2194(1,Hotkey),GoToPos(A_Index-1,cpos+1)
}
return
}
if(hotkey="}"&&v.Options.Full_Auto_Indentation){
parent:=FoldParent(),end:=sc.2224(parent,-1)
if(Trim(sc.GetLine(line),"`t `n")="}"){
sc.2003(sc.2008,"}")
keep:={parent:parent,end:end}
SetTimer,BSFix,-1
return
BSFix:
FixLines(keep.parent,keep.end-(keep.parent-1),0),sc.Enable(1)
return
}
}
if(Hotkey=Chr(34)){
sc.2078
loop,% sc.2570{
cpos:=sc.2585(A_Index-1)
if(sc.2007(cpos)=34)
sc.2584(A_Index-1,cpos+1),sc.2586(A_Index-1,cpos+1)
else
bad:=sc.2010(cpos)=13,sc.2686(cpos,cpos),sc.2194(bad?1:2,(bad?Chr(34):Chr(34) Chr(34))),sc.2584(A_Index-1,cpos+1),sc.2586(A_Index-1,cpos+1)
}
return sc.2079
}else if(Hotkey="'"){
sc.2078
loop,% sc.2570{
cpos:=sc.2585(A_Index-1)
if(sc.2007(cpos)=39)
sc.2584(A_Index-1,cpos+1),sc.2586(A_Index-1,cpos+1)
else
one:=sc.2267(cpos-1,1)=cpos,sc.2686(cpos,cpos),sc.2194(one?1:2,(one?"'":"''")),sc.2584(A_Index-1,cpos+1),sc.2586(A_Index-1,cpos+1)
}
return sc.2079
}
if(sc.2102&&v.Options.Disable_Auto_Insert_Complete!=1&&(Hotkey~="\(|\{")){
word:=sc.GetWord()
VarSetCapacity(text,sc.2610),sc.2610(0,&text),word:=StrGet(&text,"UTF-8") Hotkey v.BraceMatch[Hotkey]
loop,% sc.2570
pos:=sc.2585(A_Index-1),start:=sc.2266(pos,1),end:=sc.2267(pos,1),sc.2686(start,end),sc.2194((len:=StrPut(word,"UTF-8")-1),[word]),GoToPos(A_Index-1,start+len-1),sc.2101()
return
}
Loop,% sc.2570{
index:=A_Index-1,cpos:=sc.2585(index),line:=sc.2166(cpos)
if(Chr(sc.2007(cpos))=Hotkey&&!v.Options.Disable_Auto_Advance){
sc.2584(index,cpos+1),sc.2586(index,cpos+1)
Continue
}
if(Hotkey="{"&&v.AutoAdd[Hotkey]){
sc.2078(),ind:=sc.2127(line),tab:=settings.Get("//tab",5)
if(sc.2128(line)=sc.2136(line)){
prev:=sc.GetLine(line-1)
if(RegExMatch(prev,"iA)(}|\s)*#?\b(" v.indentregex ")\b"))
if(SubStr(RegExReplace(prev,"\s+" Chr(59) ".*"),0,1)!="{")
if(sc.2127(line)>sc.2127(line-1))
sc.2126(line,sc.2127(line)-tab),GoToPos(index,(cpos:=sc.2128(line)))
if(v.Options.Inline_Brace)
sc.2686(cpos,cpos),sc.2194(4,"{`t`n}"),ind:=sc.2127(line),sc.2126(line+1,ind),sc.2584(index,sc.2136(line)),sc.2586(index,sc.2136(line)),sc.2399
else
sc.2686(cpos,cpos),sc.2194(4,"{`n`n}"),ind:=sc.2127(line),sc.2126(line+1,ind+tab),sc.2126(line+2,ind),sc.2584(index,sc.2128(line+1)),sc.2586(index,sc.2128(line+1)),sc.2399
}else if(sc.2128(line)=cpos)
end:=sc.2136(line),sc.2686(end,end),sc.2194(2,"`n}"),sc.2686(cpos,cpos),sc.2194(2,"{`n"),ind:=sc.2127(line),sc.2126(line+1,ind+tab),sc.2126(line+2,ind),sc.2584(index,sc.2128(line+1)),sc.2586(index,sc.2128(line+1)),sc.2399
else
sc.2686(cpos,cpos),sc.2194(2,hotkey v.AutoAdd[Hotkey]),sc.2584(index,cpos+1),sc.2586(index,cpos+1)
sc.2079
}else if(v.AutoAdd[Hotkey])
sc.2686(cpos,cpos),sc.2194(2,hotkey v.AutoAdd[Hotkey]),sc.2584(index,cpos+1),sc.2586(index,cpos+1)
else
sc.2686(cpos,cpos),sc.2194(1,hotkey),sc.2584(index,cpos+1),sc.2586(index,cpos+1)
}return SetStatus("Last Entered Character: " hotkey " Code:" Asc(hotkey),2)
return
if(Hotkey="}"){
FixBrace:
sc.2078
sc:=csc(),line:=sc.2166(sc.2008)
Sleep,100
match:=sc.2166(pos:=sc.2353(sc.2008-1))
if(line!=match&&pos>=0){
text:=sc.GetLine(line)
if(info:=RegExReplace(Trim(text),"(\}|\s|\R)"))
return sc.2079()
if(v.Options.Full_Auto_Indentation)
NewIndent()
else
sc.2126(line,sc.2127(match))
}
return sc.2079(),sc.Enable(1)
}
}
Center(win){
Gui,%win%:Show,Hide
WinGetPos,x,y,w,h,% hwnd([1])
WinGetPos,xx,yy,ww,hh,% hwnd([win])
centerx:=(Abs(w-ww)/2),centery:=Abs(h-hh)/2
return "x" x+centerx " y" y+centery
}
CenterSel(){
sc:=csc(),sc.2169,a:=sc.2166(sc.2585(sc.2575)),total:=sc.2370/2-1
if(v.Options.center_caret!=1){
sc.2403(0x04|0x08)
Sleep,1
sc.2169(),sc.2403(0x08,0)
}
}
Check_For_Edited(){
all:=files.SN("//file"),sc:=csc()
while,aa:=all.item[A_Index-1],ea:=XML.EA(aa){
FileGetTime,time,% ea.file
if(time!=ea.time&&ea.note!=1){
list.=ea.filename ",",aa.SetAttribute("time",time)
FileRead,text,% ea.file
text:=RegExReplace(text,"\r\n|\r","`n")
if(ea.sc=sc.2357)
sc.2181(0,[text])
else if(ea.sc&&ea.sc!=sc.2357)
sc.2377(ea.sc),aa.RemoveAttribute("sc")
Update({file:ea.file,text:text}),SetPos()
}
}
if(list)
SetStatus("Files Updated:" Trim(list,","),3)
return 1
}
class Code_Explorer{
static explore:=[]
Add(type,found,node:=""){
if(type="Class")
cexml.Under(Current(5),"info",{type:type,text:found.2,upper:Upper(found.2),cetv:TVC.Add(2,found.2,Header(type),"Sort")})
else{
new:=cexml.Under((node?node:Current(5)),"info",{type:type,text:found.1,upper:Upper(found.1),cetv:TVC.Add(2,found.1,Header(type),"Sort")})
Default("SysTreeView322"),TV_GetText(text,Header(type))
if(type~="Function|Method")
new.SetAttribute("args",found.3)
if(type="Instance")
new.SetAttribute("class",found.2)
if(type="Breakpoint")
new.SetAttribute("filename",Current(6).file)
}
}RemoveItem(current,type,text){
rem:=SSN(current,"descendant::*[@type='" type "' and @text='" text "']")
if(tv:=SSN(rem,"@cetv").text)
TVC.Delete(2,tv)
rem.ParentNode.RemoveChild(rem)
}
Scan(node,text:=""){
ea:=XML.EA(node)
if(SSN(node,"//*").NodeName="files"){
if(!ea.ID)
return
current:=cexml.SSN("//file[@id='" ea.id "']"),text:=Update({get:ea.file}),node:=current
}
this.ScanComments(text),this.ScanClass(text,node),this.ScanFM(text,node),no:=v.CommentArea
for type,find in {Hotkey:v.OmniFind.Hotkey,Label:v.OmniFind.Label}{
pos:=1
while,RegExMatch(text,find,fun,pos),pos:=fun.pos(1)+fun.len(1){
if(!fun.len(1))
Break
if(!no.SSN("//bad[@min<'" fun.pos(1) "' and @max>'" fun.pos(1) "' and @type!='Class']"))
cexml.under(node,"info",{type:type,pos:StrPut(SubStr(text,1,fun.Pos(1)),"utf-8")-3,text:fun.1,upper:Upper(fun.1)})
}}pos:=1
/*
add this.InComment to the other things...
*/
while,RegExMatch(text,v.OmniFind.Instance,found,pos),pos:=found.Pos(2)+found.len(2){
if(!found.len(1))
break
if(!no.SSN("//bad[@min<'" found.pos(1) "' and @max>'" found.pos(1) "' and @type!='Class']"))
cexml.Under(node,"info",{type:"Instance",upper:Upper(found.1),pos:StrPut(SubStr(text,1,found.Pos(1)),"utf-8")-3,text:found.1,class:found.2})
}pos:=1
while,RegExMatch(text,"OUi);gui\[(.*)\].*\R(.*)\R;/gui\[.*\]",found,pos),pos:=found.Pos(1)+found.len(1)
cexml.Under(node,"info",{type:"Gui",opos:found.Pos(1)-1,pos:ppp:=StrPut(SubStr(text,1,found.Pos(1)),"utf-8")-3,start:found.Pos(2)-1,end:found.Pos(2)+found.len(2),text:found.1,upper:Upper(found.1)})
for a,b in {Bookmark:"\s+;#\[(.*)\]",Breakpoint:"\s+;\*\[(.*)\]"}{
pos:=1
while,pos:=RegExMatch(text,"OU)" b,found,pos),pos:=found.Pos(1)+found.len(1){
nnn:=cexml.Under(node,"info",{type:a,upper:Upper(found.1),pos:StrPut(enter:=SubStr(text,1,found.Pos(0)),"utf-8"),text:found.1})
if(a="Breakpoint"){
RegExReplace(enter,"\R",,Count)
nnn.SetAttribute("line",Count),nnn.SetAttribute("filename",ea.file)
}}}}RemoveTV(nodes){
type:=SSN(nodes.item[0],"@type").text
while(nn:=nodes.item[A_Index-1]),ea:=XML.EA(nn){
if(ea.cetv)
TVC.Delete(2,ea.cetv)
nn.ParentNode.RemoveChild(nn)
}if(!SSN((Parent:=Current(7)),"descendant::info[@type='" type "']")){
node:=SSN(Parent,"descendant::header[@type='" type "']")
if(tv:=SSN(node,"@cetv").text)
TVC.Delete(2,tv)
node.ParentNode.RemoveChild(node)
}
}InComment(found,start:=0){
return v.CommentArea.SSN("//*[@min<" found.pos(0)+start " and @max>" found.pos(0)+start "]")?1:0
}
ScanClass(FileText,parent){
if(!v.startup)
this.ScanComments(FileText)
classes:=GetAllTopClasses(FileText),SubClass:=[],move:=[]
for a,b in classes{
pos:=1,start:=InStr(FileText,b.text)-1
while(RegExMatch(b.text,v.OmniFind.Class,found,pos)),pos:=found.pos(1)+found.len(1){
InComment:=this.InComment(found,start)
if(InComment)
Continue
if(!found.len(1))
break
if(A_Index=1){
main:=cexml.Under(parent,"info",{start:start+found.pos(1)-1,end:start+found.pos(1)+StrLen(b.text)-1,type:"Class",text:found.2,upper:Upper(found.2)})
}else
ScanText:=SubStr(b.text,found.pos(1)),CText:=GetClassText(ScanText,found.2),new:=cexml.Under(main,"info",{start:start+found.pos(1)-1,end:start+found.pos(1)+StrLen(CText)-1,type:"Class",text:found.2,upper:Upper(found.2)})
}
}
all:=SN(parent,"descendant::*")
while(aa:=all.item[A_Index-1]),ea:=XML.EA(aa){
inside:=SN(parent,"descendant::*[@start<" ea.start " and @end>" ea.end "]"),last:=[]
while(ii:=inside.item[A_Index-1]),ea:=XML.EA(ii)
last[ea.start]:=ii
if(last.MaxIndex())
move.push([last[last.MaxIndex()],aa])
}for a,b in move
b[1]["AppendChild"](b.2)
}
ScanComments(FileText){
static no:=new xml("no")
v.CommentArea:=no,no:=v.CommentArea,classes:=[],rem:=no.SSN("//bad"),rem.ParentNode.RemoveChild(rem),notop:=no.Add("bad"),pos:=1
while(RegExMatch("`n" FileText,"OU)(\n\s*\x2F\x2A.*\s*\x2A\x2F)",found,pos),pos:=found.pos(1)+found.len(1)){
if(!found.len(1))
Break
if(!found.len(1)&&!found.len(2))
Break
if(found.pos(1)){
pos:=found.pos(1)+found.len(1),no.under(notop,"bad",{min:found.pos(1)-3,max:found.pos(1)+found.len(1)-3,type:"comment"})
}
}pos:=1
while(RegExMatch(FileText,"OU)\R(\s*;.*)(\R|$)",found,pos),pos:=found.pos(1)+found.len(1)){
if(!found.len(1))
Break
no.under(notop,"bad",{min:found.pos(1)-3,max:found.pos(1)+found.len(1)-3,type:"comment",semi:1})
}
}
ScanFM(FileText,parent){
if(SSN(parent,"@type").text="class"){
top:=Current(5),start:=SSN(parent,"@start").text
for a,b in {Method:v.OmniFind.Function,Property:v.OmniFind.Property}{
pos:=1
while(RegExMatch(FileText,b,found,pos)),pos:=found.pos(1)+found.len(1){
if(!found.len(1))
Break
if(found.1~="i)if|while|RegExMatch|RegExReplace")
Continue
if(this.InComment(found)){
Continue
}
max:=[],all:=SN(top,"descendant::*[@type='Class' and @start<" start+found.pos(1) " and @end>" start+found.pos(1) "]")
while(aa:=all.item[A_Index-1]),ea:=XML.EA(aa)
max[ea.start]:=aa
node:=max[max.MaxIndex()]
TVC.Default(2),cexml.Under(node,"info",{class:SSN(node,"@text").text,text:found.1,upper:Upper(found.1),type:a,cetv:TV_Add(found.1,SSN(node,"@cetv").text,"Sort")})
}}}else{
for a,b in {Function:v.OmniFind.Function,Property:v.OmniFind.Property}{
pos:=1
while(RegExMatch(FileText,b,found,pos)),pos:=found.pos(1)+found.len(1){
; arg := StrReplace(found.3, "`n") ; this will show all args in one line othervise like in file
arg := found.3 ; as in file
last:=[]
if(!found.len(1))
break
if(found.1~="i)\b(" v.IndentRegex ")\b")
Continue
if(this.InComment(found))
Continue
list:=SN(parent,"descendant::*[@start<" found.pos(1) " and @end>" found.pos(1) "]")
while(ll:=list.item[A_Index-1]),ea:=XML.EA(ll){
last[ea.start]:=ll
}if((under:=last[last.MaxIndex()]).xml){
cexml.Under(under,"info",{args:arg,id:SSN(parent,"ancestor-or-self::file/@id").text,class:SSN(under,"@text").text,type:(a="Function"?"Method":a),text:found.1,upper:Upper(found.1)})
}else
cexml.Under(parent,"info",{type:a,text:found.1,id:SSN(parent,"ancestor-or-self::file/@id").text,args:arg,upper:Upper(found.1)})
}}}}
Remove(filename){
this.explore.remove(SSN(filename,"@file").text),list:=SN(filename,"@file")
while,ll:=list.item[A_Index-1]
this.explore.Remove(ll.text)
}Populate(){
Code_Explorer.Refresh_Code_Explorer()
}Refresh_Code_Explorer(){
if(v.opening)
return
if(!MainWin.Gui.SSN("//*[@type='Code Explorer']"))
return
SplashTextOff
TVC.Disable(2),TVC.Delete(2,0),fz:=cexml.SN("//main"),rem:=cexml.SN("//*[@cetv]")
while(rr:=rem.item[A_Index-1])
rr.RemoveAttribute("cetv")
rem:=cexml.SN("//header")
while(rr:=rem.item[A_Index-1])
rr.ParentNode.RemoveChild(rr)
while,fn:=fz.Item[A_Index-1]{
things:=SN(fn,"descendant::info"),filename:=SSN(fn,"@file").text
SplitPath,filename,file
TVC.Default(2),fn.SetAttribute("cetv",(main:=TV_Add(file,0,"Sort")))
while,tt:=things.Item[A_Index-1],ea:=XML.EA(tt){
if(!top:=SSN(fn,"descendant::header[@type='" ea.type "']"))
if(ea.type~="Method|Property"=0)
top:=cexml.Under(fn,"header",{type:ea.type,cetv:TV_Add(ea.type,SSN(fn,"@cetv").text,"Sort" (SSN(tt,"ancestor::main[@file='Libraries']")?"":" Vis"))})
if(ea.type~="(Method|Property)")
tt.SetAttribute("cetv",TV_Add(ea.text,((tv:=SSN(tt.ParentNode,"@cetv").text)?tv:SSN(top,"@cetv").text),"Sort"))
else
last:=tt,tt.SetAttribute("cetv",TV_Add(ea.text,((tv:=SSN(tt.ParentNode,"@cetv").text)?tv:SSN(top,"@cetv").text),(ea.type="Class"?"Sort":"Sort")))
}}TVC.Enable(2)
return
}CEGO(){
static last
CEGO:
if((node:=cexml.SSN("//*[@cetv='" A_EventInfo "']"))&&(A_GuiEvent="S"||A_GuiEvent="Normal")){
GetPos()
if(!tv:=files.SSN("//*[@id='" SSN(node,"ancestor-or-self::file/@id").text "']/@tv").text)
return
tv(tv),SelectText(node)
}
return
}AutoCList(node:=0){
static list:=[]
if(node=1){
all:=cexml.SN("//main")
while(aa:=all.item[A_Index-1]),mea:=XML.EA(aa){
obj:=list[mea.file]:=[],CF:=SN(aa,"descendant::*[@type='Class' or @type='Function' or @type='Instance']")
while(cc:=CF.item[A_Index-1]),ea:=XML.EA(cc){
if(mea.file="libraries")
v.keywords[SubStr(ea.text,1,1)].=" " ea.text
obj.list.=ea.text " "
}
obj.list:=Trim(obj.list)
}
return
}if(node){
parent:=SSN(node,"ancestor-or-self::main/@file").text
if(!obj:=IsObject(list[parent]))
obj:=list[parent]:=[]
obj.list:=[],all:=SN(node.ParentNode,"descendant::*[@type='Class' or @type='Function']")
while(aa:=all.item[A_Index-1]),ea:=XML.EA(aa)
obj.list.=ea.text " "
obj.list:=Trim(obj.list)
return
}else{
return list[Current(2).file].list
}}}
class EasyView{
Register(Control,hwnd,Label,win:=1){
WinGetClass,class,ahk_id%hwnd%
obj:=this.Controls[Control]:=[],obj.Label:=Label,obj.hwnd:=hwnd,obj.type:=InStr(class,"TreeView")?"TreeView":"ListView",this.win:=win
}Default(Control){
if(A_DefaultGUI!=this.win)
Gui,% this.win ":Default"
Gui,% this.win ":" this.Controls[Control].type,% this.Controls[Control].hwnd
}Delete(Control,Item:=0){
this.Default(Control),(this.Controls[Control].type="TreeView")?TV_Delete(item):LV_Delete(item)
}Add(Control,text,parentopt:=0,options:=""){
this.Default(Control),this.Controls[Control].type="TreeView"?(value:=TV_Add(text,parentopt,options)):(IsObject(text)?(value:=LV_Add(parentopt,text*)):value:=LV_Add(parentopt,text))
return value
}Modify(Control,text:="",Item:="",Options:=""){
this.Default(Control),this.Controls[Control].type="TreeView"?(text?TV_Modify(Item,Options,text):TV_Modify(Item,Options)):(LV_Modify(Item,Options,(IsObject(text)?text*:text)))
}Disable(Control){
this.Default(Control)
GuiControl,% this.win ":-Redraw",% this.Controls[Control].hwnd
GuiControl,% this.win ":+g",% this.Controls[Control].hwnd
}Enable(Control){
this.Default(Control)
GuiControl,% this.win ":+Redraw",% this.Controls[Control].hwnd
GuiControl,% this.win ":+g" this.Controls[Control].Label,% this.Controls[Control].hwnd
}Selection(Control){
dg:=A_DefaultGui,this.Default(Control),tv:=TV_GetSelection()
Gui,%dg%:Default
return tv
}
}
Class Icon_Browser{
static start:="",window:=[],keep:=[],newwin,caller
__New(obj,hwnd,win,pos:="xy",min:=300,Function:="",Reload:=""){
this.hwnd:=hwnd,this.win:=win,this.min:=min
if(min)
obj.Add("Button,xs gloadfile,Load File," pos,"Button,x+M gloaddefault,Default Icons," pos,"Button,x+M gIBWidth,Width," pos)
Icon_Browser.keep[win]:=this,this.Reload:=Reload=1?Function:Reload,this.Function:=Function,this.file:=settings.Get("//icons/@last","Shell32.dll"),this.start:=0,this.populate()
}
things(){
IBWidth:
this:=Icon_Browser.keep[A_Gui],min:=settings.Get("//IconBrowser/Win[@win='" this.win "']/@w",this.min)
InputBox,out,Icon Viewer Width,% "Only Numbers with a minimum of " this.min,,,,,,,,%min%
if(ErrorLevel)
return
if(out~="\D"||out<this.min)
return m("Invalid value. Must be a NUMBER at least " min)
if(!node:=settings.SSN("//IconBrowser/Win[@win='" this.win "']"))
node:=settings.Add("IconBrowser/Win",{win:this.win},,1)
node.SetAttribute("w",out)
if(func:=this.reload)
%func%()
return
SelectIcon:
this:=Icon_Browser.keep[A_Gui]
if(A_GuiEvent="I"&&ErrorLevel~="S")
function:=this.function,%function%({file:this.file,icon:A_EventInfo})
return
loadfile:
FileSelectFile,file,,,,*.exe;*.dll;*.png;*.jpg;*.gif;*.bmp;*.icl;*.ico
if(ErrorLevel)
return
this:=icon_browser.keep[A_Gui],this.file:=file,this.start:=0,this.populate(),settings.Add("icons",{"last":this.file})
return
loaddefault:
this:=icon_browser.keep[A_Gui],this.file:="Shell32.dll",this.start:=0,this.populate(),settings.Add("icons",{"last":this.file})
return
}Populate(){
Gui,% this.win ":Default"
Gui,% this.win ":ListView",% this.hwnd
GuiControl,% this.win ":-Redraw",% this.hwnd
il:=IL_Create(50,10,1),LV_SetImageList(il),LV_Delete()
if(this.file~="(.gif|.jpg|.png|.bmp|.exe)$")
icon:=IL_Add(il,this.file),LV_Add("Icon" icon)
else if(this.file~=".exe"=0){
count:=0
while(LoadPicture(this.file,"icon" A_Index))
count++
Loop,%count%
icon:=IL_Add(il,this.file,A_Index),LV_Add("Icon" icon)
}
SendMessage,0x1000+53,0,(47<<16)|(47&0xffff),,% "ahk_id" this.hwnd
GuiControl,% this.win ":+Redraw",% this.hwnd
}
}
Class LineStatus{
static xml:=new XML("LineStatus"),stored:=[],state:={1:21,2:20}
Add(line,state){
sc:=csc()
if(mask:=sc.2046(line)){
sc.2044(line,21),sc.2044(line,20)
}
if(sc.2046(line)&2**this.state[state]=0)
sc.2043(line,this.state[state])
if(!node:=this.XML.SSN("//*[@id='" (id:=Current(8)) "']"))
node:=this.XML.Add("state",{id:id},,1)
node.SetAttribute("state",state)
}Delete(start,end){
add:=start+1=end?0:1,sc:=csc()
Loop,% end+add-start
sc.2044(end+2-A_Index,-1)
}Clear(){
sc:=csc(),node:=this.XML.SSN("//*[@id='" Current(8) "']").SetAttribute("state",0),next:=0
while((next:=sc.2047(next,2**20+2**21))>=0)
this.RemoveStatus(next)
node.ParentNode.RemoveChild(node)
}Save(id){
this.XML.SSN("//*[@id='" id "']").SetAttribute("state",1)
}tv(){
sc:=csc(),state:=SSN(node:=this.XML.SSN("//*[@id='" Current(8) "']"),"@state").text
if(state=1){
next:=0
while((next:=sc.2047(next,2**20+2**21))>=0)
this.RemoveStatus(next),sc.2043(next,this.state[state]),next++
}node.SetAttribute("state",1)
}UpdateRange(){
sc:=csc()
for a,b in this.stored
this.Add(a,b)
this.stored:=[]
}RemoveStatus(line){
sc:=csc(),mask:=sc.2046(line)
if(mask&2**20)
sc.2044(line,20)
if(mask&2**21)
sc.2044(line,21)
}StoreEdited(start,end,add){
sc:=csc()
Loop,% (end+1)-start{
if(mask:=sc.2046(start+(A_Index-1)))
this.RemoveStatus(start+(A_Index-1)),this.stored[start+(A_Index-1)+add]:=(mask&2**20?2:1)
}
}DelayAdd(Line,Count){
static info:=[]
info:={Line:Line,Count:Count}
SetTimer,LSDA,-100
return
LSDA:
Loop,% info.Count
LineStatus.Add(info.Line+(A_Index-1),2)
return
}
}
Class MainWindowClass{
static keep:=[]
__New(){
;xx:=new XML() obj:=new MainWindowClass()
if(FileExist(A_ScriptDir "\AHKStudio.ico")){
Menu,Tray,Icon,AHKStudio.ico
}
Gui,+Resize +LabelMainWindowClass. +hwndmain +MinSize400x200 -DPIScale
Gui,Add,TreeView,x0 y0 w0 h0 hwndpe +0x400000
Gui,Add,TreeView,x0 y0 w0 h0 hwndce +0x400000 AltSubmit