forked from AgileEhsan/winasm-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Options.asm
2323 lines (1944 loc) · 65.7 KB
/
Options.asm
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
BIF_NEWDIALOGSTYLE EQU 40H
.DATA?
hImages DWORD ?
lpStartPath DWORD ?
.CODE
cbBrowse Proc hWin:DWORD,uMsg:DWORD,lParam :DWORD,lpData :DWORD
.If uMsg==BFFM_INITIALIZED;WM_INITDIALOG
Invoke SetWindowText,hWin,lpData
.If lpStartPath
Invoke SendMessage, hWin, BFFM_SETSELECTION, TRUE,lpStartPath
.EndIf
Invoke CenterWindow,hWin
.EndIf
RET
cbBrowse EndP
BrowseForAnyFolder Proc hParent:HWND,hTextBox:HWND,lpBuffer:DWORD
Local lpIDList:DWORD
Local bi:BROWSEINFO
Local Buffer[MAX_PATH]:BYTE
MOV bi.pidlRoot,0
MOV EAX,hParent
MOV bi.hwndOwner,EAX
MOV bi.pszDisplayName,0
MOV EAX,Offset szNULL
MOV bi.lpszTitle,EAX
MOV bi.lpfn,Offset cbBrowse
MOV EAX,Offset szBrowseForPathDialogTitle ;"WinAsm Studio - Browse For Path"
MOV bi.lParam,EAX
MOV bi.iImage,0
.If lpBuffer
.If InitDir[0]
MOV EDX,Offset InitDir
MOV lpStartPath,EDX
.Else
MOV lpStartPath,0
.EndIf
MOV bi.ulFlags,BIF_RETURNONLYFSDIRS OR BIF_DONTGOBELOWDOMAIN OR BIF_NEWDIALOGSTYLE
Invoke CoInitialize,NULL
.Else
MOV lpStartPath,0
MOV bi.ulFlags,BIF_RETURNONLYFSDIRS OR BIF_DONTGOBELOWDOMAIN
.EndIf
Invoke SHBrowseForFolder,ADDR bi
MOV lpIDList,EAX
.If lpIDList == 0
MOV EAX,0 ;If CANCEL return FALSE
PUSH EAX
JMP @F
.Else
Invoke SHGetPathFromIDList,lpIDList,ADDR Buffer
.If lpBuffer==0
Invoke SendMessage,hTextBox,WM_SETTEXT,0,ADDR Buffer
.Else
Invoke lstrcpy,lpBuffer,ADDR Buffer
.EndIf
MOV EAX,1 ;If OK, return TRUE
PUSH EAX
JMP @F
.EndIf
@@:
Invoke CoTaskMemFree,lpIDList
POP EAX
RET
BrowseForAnyFolder EndP
ShowOptionsFirstTab Proc fShow:DWORD
Invoke ShowWindow,hGoupBoxOnStartUp,fShow
Invoke ShowWindow,hOpenDlgOnStartUp,fShow
Invoke ShowWindow,hOpenLastProjectOnStartUp,fShow
Invoke ShowWindow,hShowRecentProjectsOnStartUp,fShow
Invoke ShowWindow,hNoneOnStartUp,fShow
Invoke ShowWindow,hShowSplash,fShow
Invoke ShowWindow,hAutoSave,fShow
Invoke ShowWindow,hShowOutOnSuccess,fShow
Invoke ShowWindow,hOnMinimizeToSysTray,fShow
Invoke ShowWindow,hAutoToolAndOptions,fShow
Invoke ShowWindow,hAutoClean,fShow
Invoke ShowWindow,hOpenChildrenMaximized,fShow
Invoke ShowWindow,hGradientMenuItems,fShow
RET
ShowOptionsFirstTab EndP
ShowOptionsSecondTab Proc fShow:DWORD
Invoke ShowWindow,hTextBinaryPath,fShow
Invoke ShowWindow,hLabelBinaryPath,fShow
Invoke ShowWindow,hBrowseForBinaryPath,fShow
Invoke ShowWindow,hTextIncludePath,fShow
Invoke ShowWindow,hLabelIncludePath,fShow
Invoke ShowWindow,hBrowseForIncludePath,fShow
Invoke ShowWindow,hTextLibraryPath,fShow
Invoke ShowWindow,hLabelLibraryPath,fShow
Invoke ShowWindow,hBrowseForLibraryPath,fShow
Invoke ShowWindow,hTextKeyFile,fShow
Invoke ShowWindow,hLabelKeyFile,fShow
Invoke ShowWindow,hBrowseKeyFile,fShow
Invoke ShowWindow,hTextAPIFunctionsFile,fShow
Invoke ShowWindow,hLabelAPIFunctionsFile,fShow
Invoke ShowWindow,hBrowseAPIFunctionsFile,fShow
Invoke ShowWindow,hTextAPIStructuresFile,fShow
Invoke ShowWindow,hLabelAPIStructuresFile,fShow
Invoke ShowWindow,hBrowseAPIStructuresFile,fShow
Invoke ShowWindow,hTextAPIConstantsFile,fShow
Invoke ShowWindow,hLabelAPIConstantsFile,fShow
Invoke ShowWindow,hBrowseAPIConstantsFile,fShow
Invoke ShowWindow,hTextHelpFile,fShow
Invoke ShowWindow,hLabelHelpFile,fShow
Invoke ShowWindow,hBrowseHelpFile,fShow
Invoke ShowWindow,hBrowseDefaultProjectDir,fShow
Invoke ShowWindow,hTextDefaultProjectDir,fShow
Invoke ShowWindow,hLabelDefaultProjectDir,fShow
RET
ShowOptionsSecondTab EndP
ShowOptionsThirdTab Proc fShow:DWORD
Invoke ShowWindow,hTabToSpaces,fShow
Invoke ShowWindow,hTabSizeLabel,fShow
Invoke ShowWindow,hTabSizeText,fShow
;Invoke ShowWindow,hTabSizeUpDown,fShow
Invoke ShowWindow,hAutoIndent,fShow
Invoke ShowWindow,hTabIndicators,fShow
Invoke ShowWindow,hShowScrollTips,fShow
Invoke ShowWindow,hShowLineNumbersOnOpen,fShow
Invoke ShowWindow,hAutoshowLineNumbersOnError,fShow
Invoke ShowWindow,hLnNrWidth,fShow
Invoke ShowWindow,hLnNrWidthText,fShow
Invoke ShowWindow,hProcAutoComplete,fShow
Invoke ShowWindow,hRetLabel,fShow
Invoke ShowWindow,hRetCombo,fShow
; Invoke ShowWindow,hEndPLabel,fShow
; Invoke ShowWindow,hEndPCombo,fShow
RET
ShowOptionsThirdTab EndP
ShowOptionsFourthTab Proc fShow:DWORD
Invoke ShowWindow,hFunctionTriggerList,fShow
Invoke ShowWindow,hOpeningParenthesis,fShow
Invoke ShowWindow,hAcceptsParameters,fShow
Invoke ShowWindow,hCanBeAParameter,fShow
Invoke ShowWindow,hFunctionTriggerLabel,fShow
Invoke ShowWindow,hFunctionNameEdit,fShow
Invoke ShowWindow,hAddFunctionButton,fShow
Invoke ShowWindow,hDeleteFunctionButton,fShow
Invoke ShowWindow,hApplyFunctionButton,fShow
Invoke ShowWindow,hAutoCompleteWithLabel,fShow
Invoke ShowWindow,hAutoCompleteWithSpace,fShow
Invoke ShowWindow,hAutoCompleteWithTab,fShow
Invoke ShowWindow,hAutoCompleteWithEnter,fShow
RET
ShowOptionsFourthTab EndP
ShowOptionsFifthTab Proc fShow:DWORD
Invoke ShowWindow,hGroupsLabel,fShow
Invoke ShowWindow,hGroupsList,fShow
Invoke ShowWindow,hKeyWordsLabel,fShow
Invoke ShowWindow,hKeyWordsList,fShow
Invoke ShowWindow,hRecycledLabel,fShow
Invoke ShowWindow,hRecycledList,fShow
Invoke ShowWindow,hToRecycled,fShow
Invoke ShowWindow,hFromRecycled,fShow
Invoke ShowWindow,hWordToAdd,fShow
Invoke ShowWindow,hAddButton,fShow
Invoke ShowWindow,hDeleteButton,fShow
Invoke ShowWindow,hBoldButton,fShow
Invoke ShowWindow,hItalicButton,fShow
Invoke ShowWindow,hApplyButton,fShow
RET
ShowOptionsFifthTab EndP
ShowOptionsSixthTab Proc fShow:DWORD
Invoke ShowWindow,hSchemesLabel,fShow
Invoke ShowWindow,hSchemesCombo,fShow
Invoke ShowWindow,hSaveSchemeButton,fShow
Invoke ShowWindow,hDeleteSchemeButton,fShow
Invoke ShowWindow,hColorsList,fShow
RET
ShowOptionsSixthTab EndP
ShowOptionsSeventhTab Proc fShow:DWORD
Invoke ShowWindow,hTextExtResEd,fShow
Invoke ShowWindow,hLabelExtResEd,fShow
Invoke ShowWindow,hBrowseForExtResEd,fShow
Invoke ShowWindow,hLaunchExeOnGoAll,fShow
Invoke ShowWindow,hUseQuotes,fShow
Invoke ShowWindow,hDebugUseQuotes,fShow
Invoke ShowWindow,hTextExtDebugger,fShow
Invoke ShowWindow,hLabelExtDebugger,fShow
Invoke ShowWindow,hBrowseForExtDebugger,fShow
Invoke ShowWindow,hObjectsFont,fShow
RET
ShowOptionsSeventhTab EndP
SelectColor Proc Color:DWORD
Local ccc:CHOOSECOLOR
MOV ccc.lStructSize,SizeOf CHOOSECOLOR
M2M ccc.hwndOwner,hFind
MOV EAX,hInstance
MOV ccc.hInstance,EAX
MOV ccc.lpCustColors,Offset CustColors
MOV ccc.Flags, CC_FULLOPEN OR CC_RGBINIT
MOV ccc.lCustData,0
MOV ccc.lpfnHook,0
MOV ccc.lpTemplateName,0
MOV EAX,Color
;Mask off font
AND EAX,0FFFFFFh
MOV ccc.rgbResult,EAX
Invoke ChooseColor,ADDR ccc
.If EAX
MOV EAX,ccc.rgbResult
.Else
MOV EAX,Color
.EndIf
RET
SelectColor EndP
RepaintAll Proc Uses EBX EDI hChild:DWORD
Invoke GetWindowLong,hChild,0
MOV EBX, EAX
Invoke GetWindowLong,CHILDWINDOWDATA.hEditor[EBX],GWL_STYLE
MOV EDI,EAX
.If ShowScrollTips
OR EDI,STYLE_SCROLLTIP
.Else
AND EDI,-1 XOR STYLE_SCROLLTIP
.EndIf
Invoke SendMessage, CHILDWINDOWDATA.hEditor[EBX],CHM_SETCOLOR,0,ADDR col
Invoke SendMessage, hOut,CHM_SETCOLOR, 0, ADDR col
; Invoke SendMessage,CHILDWINDOWDATA.hEditor[EBX],CHM_LINENUMBERWIDTH,LineNrWidth,0
Invoke SetFormat, CHILDWINDOWDATA.hEditor[EBX]
MOV EAX, CHILDWINDOWDATA.dwTypeOfFile[EBX]
;ASM=1, INC=2, RC=3,BAT=6
.If EAX==1 || EAX==2 || EAX==51 || EAX==3 || EAX==6 || EAX==101 || EAX==102 || EAX==103 || EAX==106
.If EAX==1 || EAX==2 || EAX==101 || EAX==102 || EAX==51
Invoke SetKeyWords, CHILDWINDOWDATA.hEditor[EBX],0
;Invoke GetWindowLong,CHILDWINDOWDATA.hEditor[EBX],GWL_STYLE
.If !TabIndicators
OR EDI,STYLE_NOTABINDICATORS
.Else
AND EDI,-1 XOR STYLE_NOTABINDICATORS
.EndIf
Invoke SetWindowLong,CHILDWINDOWDATA.hEditor[EBX],GWL_STYLE,EDI
.ElseIf EAX==3 || EAX==103
Invoke SetKeyWords, CHILDWINDOWDATA.hEditor[EBX],1
.Else
Invoke SetKeyWords, CHILDWINDOWDATA.hEditor[EBX],2
.EndIf
Invoke SendMessage, CHILDWINDOWDATA.hEditor[EBX],CHM_REPAINT,0,0
.EndIf
.If EAX==1 || EAX==2 || EAX==101 || EAX==102 || EAX==51 ;because we already did this (faster!)
.Else
Invoke SetWindowLong,CHILDWINDOWDATA.hEditor[EBX],GWL_STYLE,EDI
.EndIf
RET
RepaintAll EndP
SaveKeyWords Proc Uses EBX EDI ESI;Only One category is saved
Local Buffer[12]:BYTE
Local hMem:DWORD
Invoke SendMessage,hGroupsList,LB_GETCURSEL,0,0
.If EAX==0
LEA EBX, szC0COLOR
MOV ESI,lpC0WORDS
CALL GetIt
MOV C0,EAX
MOV lpC0WORDS,ESI
LEA EAX,szC0WORDS
CALL SaveOneCategory
.ElseIf EAX==1
LEA EBX,szC1COLOR
MOV ESI,lpC1WORDS
CALL GetIt
MOV C1,EAX
MOV lpC1WORDS,ESI
LEA EAX,szC1WORDS
CALL SaveOneCategory
.ElseIf EAX==2
LEA EBX, szC2COLOR
MOV ESI,lpC2WORDS
CALL GetIt
MOV C2,EAX
MOV lpC2WORDS,ESI
LEA EAX,szC2WORDS
CALL SaveOneCategory
.ElseIf EAX==3
LEA EBX, szC3COLOR
MOV ESI,lpC3WORDS
CALL GetIt
MOV C3,EAX
MOV lpC3WORDS,ESI
LEA EAX,szC3WORDS
CALL SaveOneCategory
.ElseIf EAX==4
LEA EBX, szC4COLOR
MOV ESI,lpC4WORDS
CALL GetIt
MOV C4,EAX
MOV lpC4WORDS,ESI
LEA EAX,szC4WORDS
CALL SaveOneCategory
.ElseIf EAX==5
LEA EBX, szC5COLOR
MOV ESI,lpC5WORDS
CALL GetIt
MOV C5,EAX
MOV lpC5WORDS,ESI
LEA EAX,szC5WORDS
CALL SaveOneCategory
.ElseIf EAX==6
LEA EBX, szC6COLOR
MOV ESI,lpC6WORDS
CALL GetIt
MOV C6,EAX
MOV lpC6WORDS,ESI
LEA EAX,szC6WORDS
CALL SaveOneCategory
.ElseIf EAX==7
LEA EBX, szC7COLOR
MOV ESI,lpC7WORDS
CALL GetIt
MOV C7,EAX
MOV lpC7WORDS,ESI
LEA EAX,szC7WORDS
CALL SaveOneCategory
.ElseIf EAX==8
LEA EBX, szC8COLOR
MOV ESI,0;lpAPIFunctions
CALL GetIt
MOV APIFunctionsColor,EAX
.ElseIf EAX==9
LEA EBX, szC9COLOR
MOV ESI,0;lpAPIStructures
CALL GetIt
MOV APIStructuresColor,EAX
.ElseIf EAX==10
LEA EBX,szC10COLOR
MOV ESI,0
CALL GetIt
MOV APIConstantsColor,EAX
.ElseIf EAX==11
LEA EBX,szC11COLOR
MOV ESI,lpC11WORDS
CALL GetIt
MOV C11,EAX
MOV lpC11WORDS,ESI
LEA EAX,szC0RC
CALL SaveOneCategory
.ElseIf EAX==12
LEA EBX,szC12COLOR
MOV ESI,lpC12WORDS
CALL GetIt
MOV C12,EAX
MOV lpC12WORDS,ESI
LEA EAX,szC1RC
CALL SaveOneCategory
.ElseIf EAX==13
LEA EBX, szC13COLOR
MOV ESI,lpC13WORDS
CALL GetIt
MOV C13,EAX
MOV lpC13WORDS,ESI
LEA EAX,szC0BAT
CALL SaveOneCategory
.ElseIf EAX==14
LEA EBX, szC14COLOR
MOV ESI,lpC14WORDS
CALL GetIt
MOV C14,EAX
MOV lpC14WORDS,ESI
LEA EAX,szC1BAT
CALL SaveOneCategory
.EndIf
RET
;--------------------------------------------------------------
GetIt:
Invoke SendMessage,hGroupsList,LB_GETITEMDATA,EAX,0
PUSH EAX
Invoke wsprintf,ADDR Buffer, Offset szColorTemplate, EAX
Invoke WritePrivateProfileString,Offset szCATEGORIES,EBX,ADDR Buffer,pKeyWordsFileName
.If ESI!=0
Invoke HeapFree,hMainHeap,0,ESI
Invoke HeapAlloc, hMainHeap, HEAP_ZERO_MEMORY, 16384
MOV hMem,EAX
MOV EDI,EAX
XOR ESI,ESI
@@:
Invoke SendMessage,hKeyWordsList,LB_GETTEXT,ESI,EDI
.If EAX!=LB_ERR
Invoke lstrlen,EDI
ADD EDI,EAX
MOV BYTE PTR [EDI],VK_SPACE
INC EDI
INC ESI
JMP @B
.EndIf
.If EDI!=hMem
MOV BYTE PTR [EDI-1],0
.EndIf
MOV ESI,hMem
.EndIf
POP EAX
RETN
;--------------------------------------------------------------
SaveOneCategory:
Invoke WritePrivateProfileString,Offset szCATEGORIES,EAX,ESI,pKeyWordsFileName
RETN
SaveKeyWords EndP
SaveOptions Proc Uses EBX EDI ESI
Local Buffer[MAX_PATH]:BYTE
;So that in case that the OLD constants are in the hListVariables, they will be deleted when FillVariablesList is called
Invoke SetWindowLong,hListVariables,GWL_USERDATA,0
LEA ESI,Buffer
Invoke WritePrivateProfileSection,Offset szTRIGGER,Offset szNULL,Offset IniFileName
MOV EDI,lpTrigger
XOR EBX,EBX
@@:
.If BYTE PTR [EDI]
INC EBX
Invoke BinToDec,EBX,ESI
Invoke WritePrivateProfileStruct,Offset szTRIGGER,ESI,EDI,SizeOf FUNCTIONLISTTRIGGER,Offset IniFileName
ADD EDI,SizeOf FUNCTIONLISTTRIGGER
JMP @B
.EndIf
MOV EBX,Offset IniFileName
;------------------------------------------------------------------------
MOV EDI,Offset szFILESANDPATHS
;Save Binary path in WinASM.ini
MOV ECX,hTextBinaryPath
LEA EDX,BinaryPath
CALL GetText
Invoke WritePrivateProfileString,EDI,Offset szBinaryPath,Offset BinaryPath, EBX
;Save Include path in WinASM.ini
MOV ECX,hTextIncludePath
LEA EDX,IncludePath
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szIncludePath, Offset IncludePath, EBX
;Save Library path in WinASM.ini
MOV ECX,hTextLibraryPath
LEA EDX,LibraryPath
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szLibraryPath, Offset LibraryPath, EBX
;Save KeyFile in WinASM.ini
MOV ECX,hTextKeyFile
LEA EDX,KeyWordsFileName
CALL GetText
Invoke GetKeyWords
Invoke WritePrivateProfileString, EDI, Offset szKeyFile, Offset KeyWordsFileName, EBX
;Save API Functions File in WinASM.ini
MOV ECX,hTextAPIFunctionsFile
LEA EDX,APIFunctionsFile
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szAPIFunctionsFile, Offset APIFunctionsFile, EBX
Invoke GetAPIFunctions
;Save API Structures File in WinASM.ini
MOV ECX,hTextAPIStructuresFile
LEA EDX,APIStructuresFile
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szAPIStructuresFile, Offset APIStructuresFile, EBX
Invoke GetAPIStructures
;Save API Constants File in WinASM.ini
MOV ECX,hTextAPIConstantsFile
LEA EDX,APIConstantsFile
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szAPIConstantsFile, Offset APIConstantsFile, EBX
Invoke GetAPIConstants
;Save HelpFile in WinASM.ini
MOV ECX,hTextHelpFile
LEA EDX,HelpFileName
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szHelpFile, Offset HelpFileName, EBX
;Save DefaultProjectDir in WinASM.ini
MOV ECX,hTextDefaultProjectDir
LEA EDX,InitDir
CALL GetText
Invoke WritePrivateProfileString, Offset szGENERAL, Offset szInitDir,Offset InitDir, EBX
;------------------------------------------------------------------------
MOV EDI,Offset szMISCELLANEOUS
MOV ECX,hTextExtResEd
LEA EDX,ExternalResourceEditor
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szExtResEdit, Offset ExternalResourceEditor, EBX
Invoke BinToDec,LaunchExeOnGoAll,ESI
Invoke WritePrivateProfileString, EDI, Offset szLaunchExeOnGoAll,ESI, EBX
Invoke BinToDec,UseQuotes,ESI
Invoke WritePrivateProfileString, EDI, Offset szUseQuotes, ESI, EBX
Invoke BinToDec,DebugUseQuotes,ESI
Invoke WritePrivateProfileString, EDI, Offset szDebugUseQuotes, ESI, EBX
MOV ECX,hTextExtDebugger
LEA EDX,ExternalDebugger
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szExtDebugger, Offset ExternalDebugger, EBX
Invoke BinToDec,ObjectsFont,ESI
Invoke WritePrivateProfileString, EDI, Offset szObjectsFont, ESI, EBX
;------------------------------------------------------------------------
MOV EDI,Offset szGENERAL
Invoke wsprintf, ESI, Offset szColorTemplate, col.TreeBackCol
Invoke WritePrivateProfileString, EDI, Offset szTreeBackColor, ESI, EBX
Invoke wsprintf, ESI, Offset szColorTemplate,col.TreeTextCol
Invoke WritePrivateProfileString, EDI, Offset szTreeTextColor, ESI, EBX
Invoke wsprintf, ESI, Offset szColorTemplate, col.TreeLineCol
Invoke WritePrivateProfileString, EDI, Offset szTreeLineColor, ESI, EBX
Invoke BinToDec,GradientMenuItems,ESI
Invoke WritePrivateProfileString, EDI, Offset szGradientMenuItems, ESI, EBX
Invoke BinToDec,AutoSave,ESI
Invoke WritePrivateProfileString, EDI, Offset szAutoSave, ESI, EBX
Invoke BinToDec,ShowOutOnSuccess,ESI
Invoke WritePrivateProfileString, EDI, Offset szShowOutOnSuccess, ESI, EBX
Invoke BinToDec,OnStartUp,ESI
Invoke WritePrivateProfileString, EDI, Offset szOnStartUp, ESI, EBX
Invoke BinToDec,ShowSplashOnStartUp,ESI
Invoke WritePrivateProfileString, EDI, Offset szShowSplash, ESI, EBX
Invoke BinToDec,OnMinimizeToSysTray,ESI
Invoke WritePrivateProfileString, EDI, Offset szOnMinimizeToSysTray, ESI, EBX
Invoke BinToDec,AutoToolAndOptions,ESI
Invoke WritePrivateProfileString, EDI, Offset szAutoToolAndOptions, ESI, EBX
Invoke BinToDec,AutoClean,ESI
Invoke WritePrivateProfileString, EDI, Offset szAutoClean, ESI, EBX
XOR EAX,EAX
.If OpenChildStyle
MOV EAX,1
.EndIf
;LEA ECX,Buffer
Invoke BinToDec,EAX,ESI
Invoke WritePrivateProfileString, EDI, Offset szOpenChildrenMaximized, ESI, EBX
;--------------------------------------------------------------------------------------------------------------
MOV EDI,Offset szEDITOR
Invoke wsprintf, ESI, Offset szColorTemplate, col.bckcol
LEA ECX, szBackColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.txtcol
LEA ECX, szTextColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.selbckcol
LEA ECX, szSelBackColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.seltxtcol
LEA ECX, szSelTextColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.cmntcol
LEA ECX, szCommentColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.strcol
LEA ECX, szStringColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.oprcol
LEA ECX, szOperatorColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.hicol1
LEA ECX, szHiliteColor1
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.hicol2
LEA ECX, szHiliteColor2
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.hicol3
LEA ECX, szHiliteColor3
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.selbarbck
LEA ECX, szSelBarBackColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.selbarpen
LEA ECX, szSelBarPen
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.lnrcol
LEA ECX, szLineNrColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.numcol
LEA ECX, szNumberColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.tltbckcol
LEA ECX, szTltBackColor
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate, col.TltActParamCol
LEA ECX, szTltActParamCol
CALL SaveIt
Invoke wsprintf, ESI, Offset szColorTemplate,col.RCBackCol
LEA ECX,szRCBackCol
CALL SaveIt
;--------------------------------------------------------------------------------------------------------------
;MOV EDI,Offset szEDITOR Already set!
MOV ECX,hTabSizeText
;LEA EDX,Buffer
MOV EDX,ESI
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szTabSize, ESI, EBX
;Get Tab Size back in numeric format
Invoke GetPrivateProfileInt, EDI, Offset szTabSize, 0, EBX
.If EAX<1
MOV TabSize,1
.ElseIf EAX>20
MOV TabSize,20
.Else
MOV TabSize,EAX
.EndIf
MOV ECX,hLnNrWidthText
;LEA EDX,Buffer
MOV EDX,ESI
CALL GetText
Invoke WritePrivateProfileString, EDI, Offset szLineNrWidth, ESI, EBX
;Get Tab Size back in numeric format
Invoke GetPrivateProfileInt, EDI, Offset szLineNrWidth, 0, EBX
MOV LineNrWidth,EAX
Invoke BinToDec,TabIndicators,ESI
Invoke WritePrivateProfileString, EDI, Offset szTabIndicators, ESI, EBX
Invoke BinToDec,ShowScrollTips,ESI
Invoke WritePrivateProfileString, EDI, Offset szShowScrollTips, ESI, EBX
Invoke BinToDec,ShowLineNumbersOnOpen,ESI
Invoke WritePrivateProfileString, EDI, Offset szShowLineNumbersOnOpen, ADDR Buffer, EBX
Invoke BinToDec,AutoshowLineNumbersOnError,ESI
Invoke WritePrivateProfileString, EDI, Offset szAutoshowLineNumbersOnError, ESI, EBX
Invoke BinToDec,AutoIndent,ESI
Invoke WritePrivateProfileString, EDI, Offset szAutoIndent, ESI, EBX
Invoke BinToDec,AutoLineNrWidth,ESI
Invoke WritePrivateProfileString, EDI, Offset szAutoLineNrWidth, ESI, EBX
.If AutoLineNrWidth
Invoke CalculateLineNrWidth
MOV LineNrWidth,EAX
.EndIf
Invoke BinToDec,TabToSpaces,ESI
Invoke WritePrivateProfileString, EDI, Offset szTabToSpaces, ESI, EBX
Invoke IsWindowEnabled,hGroupsList ;If not enabled, then masm.vas was not found so if now set properly if we save keywords then we delete first entry and list will never be enabled.
.If EAX
Invoke SaveKeyWords
.EndIf
Invoke SendMessage,hRetCombo,CB_GETCURSEL,0,0
;CB_ERR==-1
Invoke BinToDec,EAX,ESI
Invoke WritePrivateProfileString, EDI, Offset szRet, ESI, EBX
; Invoke SendMessage,hEndPCombo,CB_GETCURSEL,0,0
; ;CB_ERR==-1
; Invoke BinToDec,EAX,ESI
; Invoke WritePrivateProfileString, EDI, Offset szEndP, ESI, EBX
Invoke BinToDec,fAutoComplete,ESI
Invoke WritePrivateProfileString, Offset szINTELLISENSE , Offset szAutoComplete, ESI, EBX
Invoke LockWindowUpdate, WinAsmHandles.hMain
Invoke EnumProjectItems, Offset RepaintAll
Invoke EnumOpenedExternalFiles,Offset RepaintAll
Invoke LockWindowUpdate, 0
Invoke SetProjectTreeAndProcListColors
Invoke CreateTahomaFont
Invoke RefreshTahomaFont
Invoke EnumProjectItems,Offset RefreshComboBoxes
Invoke EnumOpenedExternalFiles,Offset RefreshComboBoxes
; Invoke SendMessage,hListProcedures,WM_SETFONT,hFont,FALSE
; Invoke SendMessage,hListStructures,WM_SETFONT,hFont,FALSE
; Invoke SendMessage,hListConstants,WM_SETFONT,hFont,FALSE
; Invoke SendMessage,hListStructureMembers,WM_SETFONT,hFont,FALSE
; Invoke SendMessage,hListVariables,WM_SETFONT,hFont,FALSE
; Invoke SendMessage,hListIncludes,WM_SETFONT,hFont,FALSE
;; Invoke SendMessage,hToolTip,WM_SETFONT,hFont,FALSE
.If hRCEditorWindow
Invoke InvalidateRect,hRCEditorWindow,NULL,TRUE
.EndIf
RET
;--------------------------------------------------------------
GetText:
Invoke SendMessage,ECX,WM_GETTEXT,MAX_PATH,EDX
RETN
;--------------------------------------------------------------
SaveIt:
Invoke WritePrivateProfileString,EDI,ECX,ESI,EBX
RETN
SaveOptions EndP
DeleteKeyWords Proc
Local nInx:DWORD
Local nCnt:DWORD
Invoke SendMessage,hKeyWordsList,LB_GETSELCOUNT,0,0
MOV nCnt,EAX
MOV nInx,0
.While nCnt
Invoke SendMessage,hKeyWordsList,LB_GETSEL,nInx,0
.If EAX
Invoke SendMessage,hKeyWordsList,LB_DELETESTRING,nInx,0
DEC nCnt
MOV EAX,1
.EndIf
XOR EAX,1
ADD nInx,EAX
.EndW
RET
DeleteKeyWords EndP
MoveKeyWords Proc hFrom:HWND,hTo:HWND
Local Buffer[64]:BYTE
Local nInx:DWORD
Local nCnt:DWORD
Invoke SendMessage,hFrom,LB_GETSELCOUNT,0,0
MOV nCnt,EAX
MOV nInx,0
.While nCnt
Invoke SendMessage,hFrom,LB_GETSEL,nInx,0
.If EAX
Invoke SendMessage,hFrom,LB_GETTEXT,nInx,ADDR Buffer
Invoke SendMessage,hFrom,LB_DELETESTRING,nInx,0
Invoke SendMessage,hTo,LB_ADDSTRING,0,ADDR Buffer
DEC nCnt
MOV EAX,1
.EndIf
XOR EAX,1
ADD nInx,EAX
.EndW
RET
MoveKeyWords EndP
SetKeyWordList Proc Uses EDI ESI EBX nInx:DWORD
Invoke EnableWindow,hKeyWordsList,TRUE
Invoke EnableWindow,hRecycledList,TRUE
Invoke EnableWindow,hWordToAdd,TRUE
Invoke SendMessage,hKeyWordsList,LB_RESETCONTENT,0,0
.If nInx==0
MOV EDI,lpC0WORDS
CALL ExtractWords
.ElseIf nInx==1
MOV EDI,lpC1WORDS
CALL ExtractWords
.ElseIf nInx==2
MOV EDI,lpC2WORDS
CALL ExtractWords
.ElseIf nInx==3
MOV EDI,lpC3WORDS
CALL ExtractWords
.ElseIf nInx==4
MOV EDI,lpC4WORDS
CALL ExtractWords
.ElseIf nInx==5
MOV EDI,lpC5WORDS
CALL ExtractWords
.ElseIf nInx==6
MOV EDI,lpC6WORDS
CALL ExtractWords
.ElseIf nInx==7
MOV EDI,lpC7WORDS
CALL ExtractWords
.ElseIf nInx==8 || nInx==9 || nInx==10
CALL API
CALL GetBoldItalic
.ElseIf nInx==11
MOV EDI,lpC11WORDS
CALL ExtractWords
.ElseIf nInx==12
MOV EDI,lpC12WORDS
CALL ExtractWords
.ElseIf nInx==13
MOV EDI,lpC13WORDS
CALL ExtractWords
.ElseIf nInx==14
MOV EDI,lpC14WORDS
CALL ExtractWords
.EndIf
RET
;--------------------------------------------------------------
ExtractWords:
.If EDI!=0
Invoke SendMessage,hKeyWordsList,WM_SETREDRAW,FALSE,0
MOV ESI,EDI
.While BYTE PTR [EDI]!=0
.If BYTE PTR [EDI]==" "
MOV BYTE PTR [EDI],0
Invoke SendMessage,hKeyWordsList,LB_ADDSTRING,0,ESI
MOV BYTE PTR [EDI]," "
MOV ESI,EDI
INC ESI
.EndIf
INC EDI
.EndW
;Last Word
Invoke SendMessage,hKeyWordsList,LB_ADDSTRING,0,ESI
Invoke SendMessage,hKeyWordsList,WM_SETREDRAW,TRUE,0
GetBoldItalic:
Invoke SendMessage,hGroupsList,LB_GETITEMDATA,nInx,0
SHR EAX,24
MOV ESI,EAX
MOV EAX,BST_UNCHECKED
TEST ESI,1
.If !ZERO?
MOV EAX,BST_CHECKED
.EndIf
Invoke SendMessage,hBoldButton,BM_SETCHECK,EAX,0
MOV EAX,BST_UNCHECKED
TEST ESI,2
.If !ZERO?
MOV EAX,BST_CHECKED
.EndIf
Invoke SendMessage,hItalicButton, BM_SETCHECK,EAX,0
.Else
Invoke EnableWindow,hGroupsList,FALSE
Invoke EnableWindow,hBoldButton,FALSE
Invoke EnableWindow,hItalicButton,FALSE
Invoke EnableWindow,hWordToAdd,FALSE
.EndIf
RETN
API:
Invoke SendMessage,hKeyWordsList,LB_RESETCONTENT,0,0
Invoke EnableWindow,hKeyWordsList,FALSE
Invoke EnableWindow,hRecycledList,FALSE
Invoke EnableWindow,hWordToAdd,FALSE
;MOV EDI,0
RETN
SetKeyWordList EndP
FillCategoriesList Proc Uses EDI; hOptionsDialog:HWND
MOV EAX,Offset szC0WORDS
MOV EDI,C0
CALL AddIt
MOV EAX,Offset szC1WORDS
MOV EDI,C1
CALL AddIt
MOV EAX,Offset szC2WORDS
MOV EDI,C2
CALL AddIt
MOV EAX,Offset szC3WORDS
MOV EDI,C3
CALL AddIt
MOV EAX,Offset szC4WORDS
MOV EDI,C4
CALL AddIt
MOV EAX,Offset szC5WORDS
MOV EDI,C5
CALL AddIt
MOV EAX,Offset szC6WORDS
MOV EDI,C6
CALL AddIt
MOV EAX,Offset szC7WORDS
MOV EDI,C7
CALL AddIt
MOV EAX,Offset szAPIFunctions
MOV EDI,APIFunctionsColor
CALL AddIt
MOV EAX,Offset szAPIStructures
MOV EDI,APIStructuresColor
CALL AddIt
MOV EAX,Offset szAPIConstants
MOV EDI,APIConstantsColor
CALL AddIt
MOV EAX,Offset szC0RC
MOV EDI,C11
CALL AddIt
MOV EAX,Offset szC1RC
MOV EDI,C12
CALL AddIt
MOV EAX,Offset szC0BAT
MOV EDI,C13
CALL AddIt
MOV EAX,Offset szC1BAT
MOV EDI,C14
CALL AddIt
RET
AddIt:
;----
Invoke SendMessage,hGroupsList,LB_ADDSTRING,0,EAX
Invoke SendMessage,hGroupsList,LB_SETITEMDATA,EAX,EDI
RETN