/
Main.bas
5852 lines (5559 loc) · 216 KB
/
Main.bas
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
'#########################################################
'# Main.bas #
'# This file is part of VisualFBEditor #
'# Authors: Xusinboy Bekchanov (bxusinboy@mail.ru) #
'# Liu XiaLin (LiuZiQi.HK@hotmail.com) #
'#########################################################
'#define __USE_GTK__
#include once "Main.bi"
#include once "mff/Dialogs.bi"
#include once "mff/Form.bi"
#include once "mff/TextBox.bi"
#include once "mff/RichTextBox.bi"
#include once "mff/TabControl.bi"
#include once "mff/StatusBar.bi"
#include once "mff/Splitter.bi"
#include once "mff/ToolBar.bi"
#include once "mff/ListControl.bi"
#include once "mff/CheckBox.bi"
#include once "mff/ComboBoxEdit.bi"
#include once "mff/ComboBoxEx.bi"
#include once "mff/RadioButton.bi"
#include once "mff/ProgressBar.bi"
#include once "mff/ScrollBarControl.bi"
#include once "mff/Label.bi"
#include once "mff/Panel.bi"
#include once "mff/TrackBar.bi"
#include once "mff/Clipboard.bi"
#include once "mff/TreeView.bi"
#include once "mff/TreeListView.bi"
#include once "mff/IniFile.bi"
#include once "vbcompat.bi"
Using My.Sys.Forms
Using My.Sys.Drawing
#include once "frmSplash.bi"
pfSplash->MainForm = False
pfSplash->Show
pApp->DoEvents
Dim Shared As VisualFBEditor.Application VisualFBEditorApp
Dim Shared As iniFile iniSettings, iniTheme
Dim Shared As Toolbar tbStandard, tbExplorer, tbForm, tbProperties, tbEvents, tbBottom, tbLeft, tbRight
Dim Shared As StatusBar stBar
Dim Shared As Splitter splLeft, splRight, splBottom, splProperties, splEvents
Dim Shared As ListControl lstLeft
Dim Shared As CheckBox chkLeft
Dim Shared As RadioButton radButton
Dim Shared As ScrollBarControl scrLeft
Dim Shared As Label lblLeft
Dim Shared As Panel pnlLeft, pnlRight, pnlBottom, pnlBottomTab, pnlLeftPin, pnlRightPin, pnlBottomPin, pnlPropertyValue
Dim Shared As Trackbar trLeft
Dim Shared As MainMenu mnuMain
Dim Shared As MenuItem Ptr mnuStartWithCompile, mnuStart, mnuBreak, mnuEnd, mnuRestart, miRecentProjects, miRecentFiles, miRecentFolders, miRecentSessions, miSetAsMain, miTabSetAsMain, miRemoveFiles
Dim Shared As ToolButton Ptr tbtStartWithCompile, tbtStart, tbtBreak, tbtEnd
Dim Shared As SaveFileDialog SaveD
#ifndef __USE_GTK__
Dim Shared As ScrollBarControl scrTool
Dim Shared As PageSetupDialog PageSetupD
Dim Shared As PrintDialog PrintD
Dim Shared As PrintPreviewDialog PrintPreviewD
Dim Shared As My.Sys.ComponentModel.Printer pPrinter
#endif
Dim Shared As List Tools
Dim Shared As WStringList GlobalNamespaces, Comps, GlobalTypes, GlobalEnums, GlobalFunctions, GlobalArgs, AddIns, IncludeFiles, LoadPaths, IncludePaths, LibraryPaths, mlKeys, mlTexts, MRUFiles, MRUFolders, MRUProjects, MRUSessions ' add Sessions
Dim Shared As WString Ptr RecentFiles '
Dim Shared As Dictionary Helps, HotKeys, Compilers, MakeTools, Debuggers, Terminals, OtherEditors
Dim Shared As ListView lvErrors, lvSearch, lvToDo
Dim Shared As ProgressBar prProgress
Dim Shared As TextBox txtPropertyValue, txtLabelProperty, txtLabelEvent
Dim Shared As ComboBoxEdit cboPropertyValue
Dim Shared As PopupMenu mnuForm, mnuVars, mnuExplorer, mnuTabs
Dim Shared As ImageList imgList, imgListD, imgListTools, imgListStates
Dim Shared As TreeListView lvProperties, lvEvents
Dim Shared As ToolPalette tbToolBox
Dim Shared As Panel pnlToolBox
Dim Shared As TabControl tabLeft, tabRight, tabDebug
Dim Shared As TreeView tvExplorer, tvVar, tvPrc, tvThd, tvWch
Dim Shared As TextBox txtOutput, txtImmediate, txtChangeLog ' Add Change Log
Dim Shared As TabControl tabCode, tabBottom
Dim Shared As Form frmMain
Dim Shared As Integer MainHeight =600, MainWidth = 800, tabItemHeight
Dim Shared As Integer miRecentMax =20 'David Changed
Dim Shared As Boolean mLoadLog, mLoadToDo, mChangeLogEdited, mStartLoadSession = True ' Add Change Log
Dim Shared As WString * MAX_PATH mChangelogName 'David Changed
pApp = @VisualFBEditorApp
pfrmMain = @frmMain
pSaveD = @SaveD
piniSettings = @iniSettings
piniTheme = @iniTheme
pComps = @Comps
pGlobalNamespaces = @GlobalNamespaces
pGlobalTypes = @GlobalTypes
pGlobalEnums = @GlobalEnums
pGlobalFunctions = @GlobalFunctions
pGlobalArgs = @GlobalArgs
pAddIns = @AddIns
pTools = @Tools
pCompilers = @Compilers
pMakeTools = @MakeTools
pDebuggers = @Debuggers
pTerminals = @Terminals
pOtherEditors = @OtherEditors
pHelps = @Helps
plvSearch = @lvSearch
plvToDo = @lvToDo '
ptbStandard = @tbStandard
plvProperties = @lvProperties
plvEvents = @lvEvents
pprProgress = @prProgress
pstBar = @stBar 'David Change
ptxtPropertyValue = @txtPropertyValue
ptvExplorer = @tvExplorer
ptabCode = @tabCode
ptabLeft = @tabLeft
ptabBottom = @tabBottom
ptabRight = @tabRight
pimgList = @imgList
pimgListTools = @imgListTools
pIncludeFiles = @IncludeFiles
pLoadPaths = @LoadPaths
pIncludePaths = @IncludePaths
pLibraryPaths = @LibraryPaths
LoadLanguageTexts
LoadSettings
#include once "file.bi"
#include once "Designer.bi"
#include once "TabWindow.bi"
#include once "Debug.bi"
#include once "frmFind.bi"
#include once "frmGoto.bi"
#include once "frmFindInFiles.bi"
#include once "frmAddIns.bi"
#include once "frmTools.bi"
#include once "frmAbout.bi"
#include once "frmOptions.bi"
#include once "frmTemplates.bi"
#include once "frmParameters.bi"
#include once "frmProjectProperties.bi"
Namespace VisualFBEditor
Function Application.ReadProperty(ByRef PropertyName As String) As Any Ptr
Select Case LCase(PropertyName)
Case "mainprojectfile", "mainfile", "exefile"
Dim As ProjectElement Ptr Project
Dim As ExplorerElement Ptr ee
Dim As TreeNode Ptr ProjectNode
Dim As UString ProjectFile = ""
Dim As UString MainFile = GetMainFile(, Project, ProjectNode)
Dim As UString FirstLine = GetFirstCompileLine(MainFile, Project)
Dim As UString ExeFile = GetExeFileName(MainFile, FirstLine)
If ProjectNode <> 0 Then ee = ProjectNode->Tag
If ee <> 0 Then ProjectFile = *ee->FileName
Select Case LCase(PropertyName)
Case "mainprojectfile": Return ProjectFile.vptr
Case "mainfile": Return MainFile.vptr
Case "exefile": Return ExeFile.vptr
End Select
Case "currentword"
Dim As UString CurrentWord = ""
Dim As TabWindow Ptr tb = Cast(TabWindow Ptr, ptabCode->SelectedTab)
If tb <> 0 Then CurrentWord = tb->txtCode.GetWordAtCursor
Return CurrentWord.vptr
Case Else: Return Base.ReadProperty(PropertyName)
End Select
Return 0
End Function
Function Application.WriteProperty(ByRef PropertyName As String, Value As Any Ptr) As Boolean
If Value = 0 Then
Select Case LCase(PropertyName)
Case Else: Return Base.WriteProperty(PropertyName, Value)
End Select
Else
Select Case LCase(PropertyName)
Case Else: Return Base.WriteProperty(PropertyName, Value)
End Select
End If
Return True
End Function
End Namespace
Function ML(ByRef V As WString) ByRef As WString
If LCase(CurLanguage) = "english" Then Return V
Dim As Integer tIndex = mlKeys.IndexOf(V) ' For improve the speed
If tIndex >= 0 Then '
If mlTexts.Item(tIndex) <> "" Then Return mlTexts.Item(tIndex)
Else
tIndex = mlKeys.IndexOf(Replace(V, "&", "")) '
If mlTexts.Item(tIndex) <> "" Then Return mlTexts.Item(tIndex)
End If
Return V
End Function
Sub ToolGroupsToCursor()
tbToolBox.Groups.Item(0)->Buttons.Item(0)->Checked = True
tbToolBox.Groups.Item(1)->Buttons.Item(0)->Checked = True
tbToolBox.Groups.Item(2)->Buttons.Item(0)->Checked = True
tbToolBox.Groups.Item(3)->Buttons.Item(0)->Checked = True
End Sub
Sub ClearMessages()
txtOutput.Text = ""
txtOutput.Update
End Sub
Sub tabCode_Paint(ByRef Sender As Control, ByRef Canvas As My.Sys.Drawing.Canvas)
MoveCloseButtons
End Sub
Sub SelectError(ByRef FileName As WString, iLine As Integer, tabw As TabWindow Ptr = 0)
Dim tb As TabWindow Ptr
If tabw <> 0 AndAlso ptabCode->IndexOfTab(tabw) <> -1 Then
tb = tabw
tb->SelectTab
Else
If FileName = "" Then Exit Sub
tb = AddTab(FileName)
End If
tb->txtCode.SetSelection iLine - 1, iLine - 1, 0, tb->txtCode.LineLength(iLine - 1)
End Sub
Sub lvProperties_CellEditing(ByRef Sender As TreeListView, ByRef Item As TreeListViewItem Ptr, ByVal SubItemIndex As Integer, CellEditor As Control Ptr)
'CellEditor = @cboPropertyValue
End Sub
Sub lvProperties_CellEdited(ByRef Sender As TreeListView, ByRef Item As TreeListViewItem Ptr, ByVal SubItemIndex As Integer, ByRef NewText As WString)
PropertyChanged Sender, NewText, False
End Sub
Sub txtPropertyValue_LostFocus(ByRef Sender As Control)
PropertyChanged Sender, txtPropertyValue.Text, False
End Sub
Sub cboPropertyValue_Change(ByRef Sender As Control)
PropertyChanged Sender, cboPropertyValue.Text, True
End Sub
Function GetShortFileName(ByRef FileName As WString, ByRef FilePath As WString) As UString
If StartsWith(FileName, GetFolderName(FilePath)) Then
Return Mid(FileName, Len(GetFolderName(FilePath)) + 1)
Else
Return FileName
End If
End Function
Function GetFullPath(ByRef Path As WString, ByRef FromFile As WString = "") As UString
If CInt(InStr(Path, ":") > 0) OrElse CInt(StartsWith(Path, "/")) OrElse CInt(StartsWith(Path, "\")) Then
Return Path
ElseIf StartsWith(Path, "./") OrElse StartsWith(Path, ".\") Then
If FromFile = "" Then
If EndsWith(ExePath, "\..") OrElse EndsWith(ExePath, "/..") Then
Return GetFolderName(GetFolderName(ExePath)) & Mid(Path, 3)
Else
Return ExePath & Slash & Mid(Path, 3)
End If
Else
Return GetFolderName(FromFile) & Mid(Path, 3)
End If
ElseIf StartsWith(Path, "../") OrElse StartsWith(Path, "..\") Then
If FromFile = "" Then
Return GetFolderName(ExePath) & Mid(Path, 4)
Else
Return GetFolderName(GetFolderName(FromFile)) & Mid(Path, 4)
End If
Else
Return Path
End If
End Function
Function GetFullPathInSystem(ByRef Path As WString) As UString
If InStr(Path, ":") > 0 Then
Return Path
Else
Dim As WString * MAX_PATH fullPath
#ifndef __USE_GTK__
Dim As WString Ptr lpFilePart
If SearchPath(null, Path, ".exe", MAX_PATH, @fullPath, @lpFilePart) = 0 Then
Print GetErrorString(GetLastError)
End If
#endif
Return fullPath
End If
End Function
Function GetFolderName(ByRef FileName As WString, WithSlash As Boolean = True) As UString
Dim Pos1 As Long = InStrRev(FileName, "\", Len(FileName) - 1)
Dim Pos2 As Long = InStrRev(FileName, "/", Len(FileName) - 1)
If Pos1 = 0 OrElse Pos2 > Pos1 Then Pos1 = Pos2
If Pos1 > 0 Then
If Not WithSlash Then Pos1 -= 1
Return Left(FileName, Pos1)
End If
Return ""
End Function
Function GetFileName(ByRef FileName As WString) As UString
Dim Pos1 As Long = InStrRev(FileName, "\")
Dim Pos2 As Long = InStrRev(FileName, "/")
If Pos1 = 0 OrElse Pos2 > Pos1 Then Pos1 = Pos2
If Pos1 > 0 Then
Return Mid(FileName, Pos1 + 1)
End If
Return FileName
End Function
Function GetBakFileName(ByRef FileName As WString) As UString
Dim Pos1 As Long = InStrRev(FileName, ".")
If Pos1 = 0 Then Pos1 = Len(FileName)
If Pos1 > 0 Then
Return FileName & ".bak" 'Left(FileName, Pos1 - 1) & "_bak" & Mid(FileName, Pos1)
End If
End Function
Function GetExeFileName(ByRef FileName As WString, ByRef sLine As WString) As UString
Dim As UString CompileWith = " " & LTrim(sLine)
Dim As UString pFileName = FileName
Dim As UString ExeFileName
Dim As String SearchChar
Dim As Long Pos1, Pos2
Pos1 = InStr(CompileWith, " -x ")
If Pos1 > 0 Then
If Mid(CompileWith, Pos1 + 4, 1) = """" Then
SearchChar = """"
Else
SearchChar = " "
End If
Pos2 = InStr(Pos1 + 5, CompileWith, SearchChar)
If Pos2 > 0 Then
ExeFileName = Mid(CompileWith, Pos1 + 5, Pos2 - Pos1 - 5)
If CInt(InStr(ExeFileName, ":") = 0) AndAlso CInt(Not StartsWith(ExeFileName, "/")) Then
Return GetFolderName(pFileName) + ExeFileName
Else
Return ExeFileName
End If
End If
End If
Pos1 = InStrRev(pFileName, ".")
If Pos1 = 0 Then Pos1 = Len(pFileName) + 1
If Pos1 > 0 Then
#ifdef __USE_GTK__
Return Left(pFileName, Pos1 - 1) & IIf(InStr(CompileWith, "-dll"), ".so", "")
#else
Return Left(pFileName, Pos1 - 1) & IIf(InStr(CompileWith, "-dll"), ".dll", ".exe")
#endif
End If
End Function
Function Compile(Parameter As String = "") As Integer
On Error Goto ErrorHandler
Dim As ProjectElement Ptr Project
Dim As TreeNode Ptr ProjectNode
ThreadsEnter()
Dim MainFile As WString Ptr: WLet(MainFile, GetMainFile(AutoSaveBeforeCompiling, Project, ProjectNode))
ThreadsLeave()
If Len(*MainFile) <= 0 Then
ThreadsEnter()
ShowMessages ML("No Main file specified for the project.") & "!"
ThreadsLeave()
WDeallocate MainFile
Return 0
End If
Dim FirstLine As WString Ptr: WLet(FirstLine, GetFirstCompileLine(*MainFile, Project))
Versioning *MainFile, *FirstLine, Project, ProjectNode
Dim FileOut As Integer
ThreadsEnter()
Dim As Boolean Bit32 = tbStandard.Buttons.Item("B32")->Checked
ThreadsLeave()
Dim ExeName As WString Ptr: WLet(ExeName, GetExeFileName(*MainFile, *FirstLine))
Dim CurrentCompiler As WString Ptr = IIf(Bit32, CurrentCompiler32, CurrentCompiler64)
Dim FbcExe As WString Ptr = IIf(Bit32, Compiler32Path, Compiler64Path)
If *FbcExe = "" Then
WDeallocate MainFile
ThreadsEnter()
ShowMessages ML("Invalid defined compiler path.")
ThreadsLeave()
Return 0
Else
#ifdef __USE_GTK__
If g_find_program_in_path(ToUTF8(*FbcExe)) = NULL Then
#else
If Not FileExists(*FbcExe) Then
#endif
WDeallocate MainFile
ThreadsEnter()
ShowMessages ML("File") & " """ & *FbcExe & """ " & ML("not found") & "!"
ThreadsLeave()
Return 0
End If
End If
Dim As UserToolType Ptr Tool
For i As Integer = 0 To Tools.Count - 1
Tool = Tools.Item(i)
If Tool->LoadType = LoadTypes.BeforeCompile Then Tool->Execute
Next
Dim LogFileName As WString Ptr '
Dim LogFileName2 As WString Ptr
Dim BatFileName As WString Ptr
Dim fbcCommand As WString Ptr
Dim CompileWith As WString Ptr
Dim MFFPathC As WString Ptr
Dim As WString Ptr ErrFileName, ErrTitle
Dim As Integer iLine
Dim LogText As WString Ptr
WLet(MFFPathC, *MFFPath)
If CInt(InStr(*MFFPathC, ":") = 0) AndAlso CInt(Not StartsWith(*MFFPathC, "/")) Then WLet(MFFPathC, ExePath & "/" & *MFFPath)
WLet(BatFileName, ExePath + "/debug.bat")
Dim As Boolean Band, Yaratilmadi
ChDir(GetFolderName(*MainFile))
If Parameter = "Check" Then
WLet(ExeName, "chk.dll")
End If
ClearMessages
FileOut = FreeFile
If Dir(*ExeName) <> "" Then 'delete exe if exist
If Kill(*ExeName) <> 0 Then
ThreadsEnter()
ShowMessages(Str(Time) & ": " & ML("Cannot compile - the program is now running") & " " & *ExeName) '
ThreadsLeave()
Band = True
WDeallocate fbcCommand '
WDeallocate CompileWith
WDeallocate MFFPathC
WDeallocate MainFile
WDeallocate FirstLine
WDeallocate ExeName
WDeallocate LogText
Return 0
End If
End If
Dim As Integer Idx
Dim As ToolType Ptr CompilerTool
If Parameter = "Make" Then
Idx = pMakeTools->IndexOfKey(*CurrentMakeTool1)
If Idx <> -1 Then CompilerTool = pMakeTools->Item(Idx)->Object
ElseIf Parameter = "MakeClean" Then
Idx = pMakeTools->IndexOfKey(*CurrentMakeTool2)
If Idx <> -1 Then CompilerTool = pMakeTools->Item(Idx)->Object
Else
Idx = pCompilers->IndexOfKey(*CurrentCompiler)
If Idx <> -1 Then CompilerTool = pCompilers->Item(Idx)->Object
End If
If CompilerTool <> 0 Then
WLet(CompileWith, CompilerTool->GetCommand(, True))
End If
WAdd(CompileWith, " " & *FirstLine)
If CInt(InStr(*CompileWith, " -s ") = 0) AndAlso CInt(tbStandard.Buttons.Item("GUI")->Checked) Then
WAdd CompileWith, " -s gui"
End If
If CInt(UseDebugger) OrElse CInt(CInt(Project) AndAlso CInt(Project->CreateDebugInfo)) Then WAdd CompileWith, " -g"
If Project Then
If Project->CompileToGCC Then
WAdd CompileWith, " -gen gcc" & IIf(Project->OptimizationLevel > 0, " -Wc -O" & WStr(Project->OptimizationLevel), IIf(Project->OptimizationFastCode, " -Wc -Ofast", IIf(Project->OptimizationSmallCode, " -Wc -Os", "")))
End If
End If
If IncludeMFFPath Then WAdd CompileWith, " -i """ & *MFFPathC & """"
For i As Integer = 0 To pIncludePaths->Count - 1
WAdd CompileWith, " -i """ & pIncludePaths->Item(i) & """"
Next
For i As Integer = 0 To pLibraryPaths->Count - 1
WAdd CompileWith, " -p """ & pLibraryPaths->Item(i) & """"
Next
'WLet LogFileName, ExePath & "/Temp/debug_compil.log"
WLet(LogFileName2, ExePath & "/Temp/Compile.log")
If InStr(*CompileWith, "{S}") > 0 Then
WLet(fbcCommand, Replace(*CompileWith, "{S}", """" & GetFileName(*MainFile) & """"))
Else
WLet(fbcCommand, """" & GetFileName(*MainFile) & """ " & *CompileWith)
End If
If Parameter <> "" AndAlso Parameter <> "Make" AndAlso Parameter <> "MakeClean" Then
If Parameter = "Check" Then WAdd fbcCommand, " -x """ & *ExeName & """"
End If
Dim As WString Ptr PipeCommand
If CInt(Parameter = "Make") OrElse CInt(CInt(Parameter = "Run") AndAlso CInt(UseMakeOnStartWithCompile) AndAlso CInt(FileExists(GetFolderName(*MainFile) & "/makefile"))) Then
Dim As String Colon = ""
#ifdef __USE_GTK__
Colon = ":"
#endif
WLet(PipeCommand, """" & *MakeToolPath1 & """ FBC" & Colon & "=""""""" & *fbcexe & """"""" XFLAG" & Colon & "=""-x """"" & *ExeName & """""""" & IIf(UseDebugger, " GFLAG" & Colon & "=-g", "") & " " & *Make1Arguments)
ElseIf Parameter = "MakeClean" Then
WLet(PipeCommand, """" & *MakeToolPath2 & """ " & *Make2Arguments)
Else
WLet(PipeCommand, """" & *fbcexe & """ " & *fbcCommand)
End If
' ' for better showing
' #ifdef __USE_GTK__
' *PipeCommand=Replace(Replace(*PipeCommand,"\","/"),"/./","/")
' #else
' *PipeCommand=Replace(Replace(*PipeCommand,"/","\"),"\.\","\")
' #endif
'OPEN *BatFileName For Output As #FileOut
'Print #FileOut, *fbcCommand + " > """ + *LogFileName + """" + " 2>""" + *LogFileName2 + """"
'Close #FileOut
'Shell("""" + BatFileName + """")
ChDir(GetFolderName(*MainFile))
'Shell(*fbcCommand + "> """ + *LogFileName + """" + " 2> """ + *LogFileName2 + """")
'Open Pipe *fbcCommand + "> """ + *LogFileName + """" + " 2> """ + *LogFileName2 + """" For Input As #Fn
'Close #Fn
'PipeCmd "", *PipeCommand & " > """ + *LogFileName + """" + " 2> """ + *LogFileName2 + """"
ThreadsEnter()
StartProgress
lvErrors.ListItems.Clear
ptabBottom->Tabs[1]->Caption = ML("Errors") ' 'Inits
ThreadsLeave()
Dim As Long nLen, nLen2
Dim As Boolean Log2_
Dim As Integer Result = -1, Fn = FreeFile
Dim Buff As WString * 2048 ' for V1.07 Line Input not working fine
#ifdef __USE_GTK__
WLetEx(PipeCommand, *PipeCommand & " 2> """ + *LogFileName2 + """", True)
#else
WLetEx PipeCommand, """" & *PipeCommand & " 2> """ + *LogFileName2 + """" & """", True
'ShowWindow(getconsolewindow,SW_HIDE)
#endif
If Parameter <> "Check" Then
ThreadsEnter()
ShowMessages(Str(Time) + ": " + IIf(Parameter = "MakeClean", ML("Clean"), ML("Compilation")) & ": " & *PipeCommand + WChr(13) + WChr(10))
ThreadsLeave()
End If
If Open Pipe(*PipeCommand For Input As #Fn) = 0 Then
While Not EOF(Fn)
Line Input #Fn, Buff
SplitError(Buff, ErrFileName, ErrTitle, iLine)
ThreadsEnter()
If *ErrFileName <> "" AndAlso InStr(*ErrFileName, "/") = 0 AndAlso InStr(*ErrFileName, "\") = 0 Then WLet(ErrFileName, GetFolderName(*MainFile) & *ErrFileName)
lvErrors.ListItems.Add *ErrTitle, IIf(InStr(*ErrTitle, "warning"), "Warning", IIf(InStr(LCase(*ErrTitle), "error"), "Error", "Info"))
lvErrors.ListItems.Item(lvErrors.ListItems.Count - 1)->Text(1) = WStr(iLine)
lvErrors.ListItems.Item(lvErrors.ListItems.Count - 1)->Text(2) = *ErrFileName
ShowMessages(Buff, False)
ThreadsLeave()
'*LogText = *LogText & *Buff & WChr(13) & WChr(10)
Wend
Close #Fn
End If
WDeallocate PipeCommand
#ifdef __USE_GTK__
Yaratilmadi = g_find_program_in_path(ToUTF8(*ExeName)) = NULL
#else
Yaratilmadi = Dir(*ExeName) = ""
#endif
Fn =FreeFile
Result=-1
Result = Open(*LogFileName2 For Input Encoding "utf-8" As #Fn)
If Result <> 0 Then Result = Open(*LogFileName2 For Input Encoding "utf-16" As #Fn)
If Result <> 0 Then Result = Open(*LogFileName2 For Input Encoding "utf-32" As #Fn)
If Result <> 0 Then Result = Open(*LogFileName2 For Input As #Fn)
If Result = 0 Then
While Not EOF(Fn)
Line Input #Fn, Buff
'If Trim(*Buff) <> "" Then lvErrors.ListItems.Add *Buff
SplitError(Buff, ErrFileName, ErrTitle, iLine)
ThreadsEnter()
If *ErrFileName <> "" AndAlso InStr(*ErrFileName, "/") = 0 AndAlso InStr(*ErrFileName, "\") = 0 Then WLet(ErrFileName, GetFolderName(*MainFile) & *ErrFileName)
lvErrors.ListItems.Add *ErrTitle, IIf(InStr(*ErrTitle, "warning"), "Warning", IIf(InStr(LCase(*ErrTitle), "error"), "Error", "Info"))
lvErrors.ListItems.Item(lvErrors.ListItems.Count - 1)->Text(1) = WStr(iLine)
lvErrors.ListItems.Item(lvErrors.ListItems.Count - 1)->Text(2) = *ErrFileName
ShowMessages(Buff, False)
ThreadsLeave()
'*LogText = *LogText & *Buff & WChr(13) & WChr(10)
Log2_ = True
Wend
Close #Fn
End If
ThreadsEnter()
If lvErrors.ListItems.Count <> 0 Then
ptabBottom->Tabs[1]->Caption = ML("Errors") & " (" & lvErrors.ListItems.Count & " " & ML("Pos") & ")"
Else
ptabBottom->Tabs[1]->Caption = ML("Errors")
End If
ThreadsLeave()
'If LogFileName Then Deallocate LogFileName
If LogFileName2 Then Deallocate_( LogFileName2)
If BatFileName Then Deallocate_( BatFileName)
WDeallocate fbcCommand
WDeallocate CompileWith
WDeallocate MFFPathC
WDeallocate MainFile
WDeallocate FirstLine
ThreadsEnter()
ShowMessages("")
StopProgress
ThreadsLeave()
For i As Integer = 0 To Tools.Count - 1
Tool = Tools.Item(i)
If Tool->LoadType = LoadTypes.AfterCompile Then Tool->Execute
Next
If Yaratilmadi Or Band Then
ThreadsEnter()
If Parameter <> "Check" Then
ShowMessages(Str(Time) & ": " & ML("Do not build file."))
If (Not Log2_) AndAlso lvErrors.ListItems.Count <> 0 Then ptabBottom->Tabs[1]->SelectTab
ElseIf lvErrors.ListItems.Count <> 0 Then
ShowMessages(Str(Time) & ": " & ML("Checking ended."))
ptabBottom->Tabs[1]->SelectTab
Else
ShowMessages(Str(Time) & ": " & ML("No errors or warnings were found."))
End If
ThreadsLeave()
WDeallocate LogText
Return 0
Else
ThreadsEnter()
If InStr(*LogText, "warning") > 0 Then
If Parameter <> "Check" Then
ShowMessages(Str(Time) & ": " & ML("Layout has been successfully completed, but there are warnings."))
End If
Else
If Parameter <> "Check" Then
ShowMessages(Str(Time) & ": " & ML("Layout succeeded!"))
Else
ShowMessages(Str(Time) & ": " & ML("Syntax errors not found!"))
End If
End If
ThreadsLeave()
WDeallocate LogText
WDeallocate ExeName
Return 1
End If
Exit Function
ErrorHandler:
ThreadsEnter()
MsgBox ErrDescription(Err) & " (" & Err & ") " & _
"in line " & Erl() & " " & _
"in function " & ZGet(Erfn()) & " " & _
"in module " & ZGet(Ermn())
ThreadsLeave()
End Function
Sub SelectSearchResult(ByRef FileName As WString, iLine As Integer, ByVal iSelStart As Integer =-1, ByVal iSelLength As Integer =-1, tabw As TabWindow Ptr = 0, ByRef SearchText As WString = "")
Dim tb As TabWindow Ptr
If tabw <> 0 AndAlso ptabCode->IndexOfTab(tabw) <> -1 Then
tb = tabw
tb->SelectTab
Else
If FileName = "" Then Exit Sub
tb = AddTab(FileName)
End If
If SearchText <> "" Then
If iSelStart = -1 AndAlso tb->txtCode.LinesCount > iLine - 1 Then iSelStart = InStr(LCase(tb->txtCode.Lines(iLine - 1)), LCase(SearchText))
If iSelLength = -1 Then iSelLength = Len(SearchText)
End If
#ifdef __USE_GTK__
pApp->DoEvents
#endif
tb->txtCode.TopLine = iLine - tb->txtCode.VisibleLinesCount / 2
tb->txtCode.SetSelection iLine - 1, iLine - 1, iSelStart - 1, iSelStart + iSelLength - 1
End Sub
Sub txtOutput_DblClick(ByRef Sender As Control)
Dim Buff As WString Ptr = @txtOutput.Lines(txtOutput.GetLineFromCharIndex)
Dim As WString Ptr ErrFileName, ErrTitle
Dim As ProjectElement Ptr Project
Dim As TreeNode Ptr ProjectNode
Dim As Integer iLine
Dim As WString Ptr Temp
SplitError(*Buff, ErrFileName, ErrTitle, iLine)
Dim MainFile As WString Ptr: WLet(MainFile, GetMainFile(False, Project, ProjectNode))
If *ErrFileName <> "" AndAlso InStr(*ErrFileName, "/") = 0 AndAlso InStr(*ErrFileName, "\") = 0 Then WLet(ErrFileName, GetFolderName(*MainFile) & *ErrFileName)
WDeallocate Temp
WDeallocate MainFile
SelectError(*ErrFileName, iLine)
End Sub
Function GetTreeNodeChild(tn As TreeNode Ptr, ByRef FileName As WString) As TreeNode Ptr
If tbExplorer.Buttons.Item(3)->Checked Then
If EndsWith(FileName, ".bi") Then
Return tn->Nodes.Item(0)
ElseIf EndsWith(FileName, ".frm") Then
Return tn->Nodes.Item(1)
ElseIf EndsWith(FileName, ".bas") OrElse EndsWith(FileName, ".inc") Then
Return tn->Nodes.Item(2)
ElseIf EndsWith(FileName, ".rc") Then
Return tn->Nodes.Item(3)
Else
Return tn->Nodes.Item(4)
End If
Else
Return tn
End If
End Function
Sub ClearTreeNode(ByRef tn As TreeNode Ptr)
If tn = 0 Then Exit Sub
For i As Integer = 0 To tn->Nodes.Count - 1
Delete_( Cast(ExplorerElement Ptr, tn->Nodes.Item(i)->Tag))
Next
tn->Nodes.Clear
End Sub
Function GetIconName(ByRef FileName As WString, ppe As ProjectElement Ptr = 0) As String
Dim As String sMain = ""
If ppe <> 0 Then
If FileName = WGet(ppe->MainFileName) OrElse FileName = WGet(ppe->ResourceFileName) OrElse FileName = WGet(ppe->IconResourceFileName) Then
sMain = "Main"
End If
End If
If EndsWith(LCase(FileName), ".rc") OrElse EndsWith(LCase(FileName), ".res") OrElse EndsWith(LCase(FileName), ".xpm") Then
Return sMain & "Resource"
ElseIf EndsWith(LCase(FileName), ".vfp") Then
Return sMain & "Project"
ElseIf EndsWith(LCase(FileName), ".frm") Then
Return sMain & "Form"
ElseIf EndsWith(LCase(FileName), ".bas") Then
Return sMain & "Module"
Else
Return sMain & "File"
End If
End Function
Sub ExpandFolder(ByRef tn As TreeNode Ptr)
If tn = 0 Then Exit Sub
Dim As ExplorerElement Ptr ee = tn->Tag, ee1
If ee = 0 OrElse ee->FileName = 0 Then Exit Sub
ClearTreeNode tn
Dim As TreeNode Ptr tn1
Dim As String f, IconName
Dim As UInteger Attr
Dim As WStringList Files
f = Dir(*ee->FileName & "/*", fbReadOnly Or fbHidden Or fbSystem Or fbDirectory Or fbArchive, Attr)
While f <> ""
If (Attr And fbDirectory) <> 0 Then
If f <> "." AndAlso f <> ".." Then
If FileExists(f & Slash & f & ".vfp") Then
IconName = "Project"
tn1 = tn->Nodes.Add(GetFileName(f), , f, IconName, IconName)
AddProject f & Slash & f & ".vfp", , tn1
WLet(Cast(ExplorerElement Ptr, tn1->Tag)->FileName, *ee->FileName & "/" & f)
Else
IconName = "Opened"
tn1 = tn->Nodes.Add(GetFileName(f), , f, IconName, IconName)
ee1 = New_( ExplorerElement)
WLet(ee1->FileName, *ee->FileName & "/" & f)
tn1->Tag = ee1
End If
tn1->Nodes.Add ""
End If
Else
Files.Add *ee->FileName & "/" & f
End If
f = Dir(Attr)
Wend
For i As Integer = 0 To Files.Count - 1
If tn->Tag <> 0 AndAlso *Cast(ExplorerElement Ptr, tn->Tag) Is ProjectElement Then
IconName = GetIconName(Files.Item(i), tn->Tag)
Else
IconName = GetIconName(Files.Item(i))
End If
' If EndsWith(LCase(Files.Item(i)), ".vfp") Then
' IconName = "Project"
' ElseIf EndsWith(LCase(Files.Item(i)), ".rc") OrElse EndsWith(LCase(Files.Item(i)), ".res") OrElse EndsWith(LCase(Files.Item(i)), ".xpm") Then
' IconName = "Resource"
' Else
' IconName = "File"
' End If
tn1 = tn->Nodes.Add(GetFileName(*ee->FileName & "/" & Files.Item(i)), , Files.Item(i), IconName, IconName)
ee1 = New_( ExplorerElement)
WLet(ee1->FileName, Files.Item(i))
tn1->Tag = ee1
Next i
End Sub
Sub CloseFolder(ByRef tn As TreeNode Ptr)
ClearTreeNode tn
Var Index = tvExplorer.Nodes.IndexOf(tn)
If Index <> -1 Then tvExplorer.Nodes.Remove Index
'Delete tn
End Sub
Function AddFolder(ByRef FolderName As WString) As TreeNode Ptr
Dim As TreeNode Ptr tn
If FolderName <> "" Then
AddMRUFolder FolderName
Dim As Integer Pos1
For i As Integer = 0 To tvExplorer.Nodes.Count - 1
If tvExplorer.Nodes.Item(i)->Tag <> 0 AndAlso EqualPaths(*Cast(ExplorerElement Ptr, tvExplorer.Nodes.Item(i)->Tag)->FileName, FolderName) Then
tvExplorer.Nodes.Item(i)->SelectItem
Return tvExplorer.Nodes.Item(i)
End If
Next
Dim As String IconName
If FileExists(FolderName & Slash & GetFileName(FolderName) & ".vfp") Then
IconName = "Project"
tn = tvExplorer.Nodes.Add(GetFileName(FolderName), , FolderName, IconName, IconName)
AddProject FolderName & Slash & GetFileName(FolderName) & ".vfp", , tn
WLet(Cast(ExplorerElement Ptr, tn->Tag)->FileName, FolderName)
Else
IconName = "Opened"
tn = tvExplorer.Nodes.Add(GetFileName(FolderName), , FolderName, IconName, IconName)
Dim As ExplorerElement Ptr ee
ee = New_( ExplorerElement)
WLet(ee->FileName, FolderName)
tn->Tag = ee
End If
ExpandFolder tn
tn->Expand
End If
Return tn
End Function
Function IfNegative(Value As Integer, NonNegative As Integer) As Integer
If Value < 0 Then
Return NonNegative
Else
Return Value
End If
End Function
Function AddProject(ByRef FileName As WString = "", pFilesList As WStringList Ptr = 0, tn As TreeNode Ptr = 0, bNew As Boolean = False) As TreeNode Ptr
Dim As ExplorerElement Ptr ee
Dim As TreeNode Ptr tn3
Dim As Boolean inFolder = tn <> 0
If Not inFolder Then
If FileName <> "" AndAlso Not bNew Then
If Not FileExists(FileName) Then
MsgBox ML("File not found") & ": " & FileName
Return tn
End If
AddMRUProject FileName
'Dim As WString Ptr buff '
Dim As Integer Pos1
For i As Integer = 0 To tvExplorer.Nodes.Count - 1
If tvExplorer.Nodes.Item(i)->Tag <> 0 AndAlso EqualPaths(*Cast(ExplorerElement Ptr, tvExplorer.Nodes.Item(i)->Tag)->FileName, FileName) Then
tvExplorer.Nodes.Item(i)->SelectItem
Return tvExplorer.Nodes.Item(i)
End If
Next
tn = tvExplorer.Nodes.Add(GetFileName(FileName), , FileName, "Project", "Project")
Else
Var n = 0
Dim As String ProjectName = "Project"
Dim NewName As String
Do
n = n + 1
NewName = ProjectName & Str(n)
Loop While tvExplorer.Nodes.Contains(NewName) OrElse tvExplorer.Nodes.Contains(NewName & "*")
tn = tvExplorer.Nodes.Add(NewName & "*", , , "Project", "Project")
End If
'If tn <> 0 Then
If tbExplorer.Buttons.Item(3)->Checked Then
tn->Nodes.Add ML("Includes"), "Includes", , "Opened", "Opened"
tn->Nodes.Add ML("Forms"), "Forms", , "Opened", "Opened"
tn->Nodes.Add ML("Modules"), "Modules", , "Opened", "Opened" '. Using "Modules" is better than "Sources"
tn->Nodes.Add ML("Resources"), "Resources", , "Opened", "Opened"
tn->Nodes.Add ML("Others"), "Others", , "Opened", "Opened"
'End if
End If
tn->SelectItem
End If
If FileName <> "" Then
Dim As TreeNode Ptr tn1, tn2
'Dim buff As WString Ptr '
Dim Pos1 As Integer
Dim bMain As Boolean
Dim As ProjectElement Ptr ppe
Dim As WStringList Files
Dim As WStringList Ptr pFiles
ppe = New_( ProjectElement)
If bNew Then
WLet(ppe->FileName, Left(tn->Text, Len(tn->Text) - 1))
WLet(ppe->TemplateFileName, FileName)
Else
WLet(ppe->FileName, FileName)
End If
tn->Tag = ppe
If pFilesList = 0 Then pFiles = @Files Else pFiles = pFilesList
Dim As String Parameter
Dim As String IconName
Dim As String ZvFile
Dim Buff As WString * 1024 ' for V1.07 Line Input not working fine
Dim As Integer Fn = FreeFile
Dim Result As Integer = -1
If bNew Then ZvFile = "*" Else ZvFile = ""
Result = Open(FileName For Input Encoding "utf-8" As #Fn)
If Result <> 0 Then Result = Open(FileName For Input Encoding "utf-16" As #Fn)
If Result <> 0 Then Result = Open(FileName For Input Encoding "utf-32" As #Fn)
If Result <> 0 Then Result = Open(FileName For Input As #Fn)
If Result = 0 Then
Do Until EOF(Fn)
Line Input #Fn, Buff
Pos1 = InStr(Buff, "=")
If Pos1 <> 0 Then
Parameter = Left(Buff, Pos1 - 1)
Else
Parameter = ""
End If
If Parameter = "File" OrElse Parameter = "*File" Then
bMain = StartsWith(Buff, "*")
Buff = Trim(Mid(Buff, Pos1+1 ))
ee = New_( ExplorerElement)
If CInt(InStr(Buff, ":") = 0) OrElse CInt(StartsWith(Buff, "/")) Then
#ifdef __USE_GTK__
WLet(ee->FileName, GetFolderName(FileName) & Buff)
#else
WLet(ee->FileName, GetFolderName(FileName) & Replace(Buff, "/", "\"))
#endif
Else
WLet(ee->FileName, Buff)
End If
If bNew Then
WLet(ee->TemplateFileName, WGet(ee->FileName))
WLet(ee->FileName, GetFileName(Buff))
End If
If Not inFolder Then
tn1 = GetTreeNodeChild(tn, Buff)
End If
Dim As Boolean FileEx = CInt(FileExists(*ee->FileName)) OrElse CInt(bNew)
If bMain Then
If EndsWith(LCase(*ee->FileName), ".rc") OrElse EndsWith(LCase(*ee->FileName), ".res") Then ' Then
WLet(ppe->ResourceFileName, *ee->FileName)
ElseIf EndsWith(LCase(*ee->FileName), ".xpm") Then '
WLet(ppe->IconResourceFileName, *ee->FileName)
Else
WLet(ppe->MainFileName, *ee->FileName)
End If
End If
IconName = GetIconName(*ee->FileName, ppe)
If Not FileEx Then IconName = "New"
If Not inFolder Then
tn2 = tn1->Nodes.Add(GetFileName(*ee->FileName) & ZvFile,, *ee->FileName, IconName, IconName, True)
If bMain Then
If MainNode = 0 Then SetMainNode GetParentNode(tn1)
If bNew AndAlso IconName <> "MainRes" Then AddTab *ee->TemplateFileName, bNew, tn2
End If
End If
If EndsWith(*ee->FileName, ".bas") OrElse EndsWith(*ee->FileName, ".frm") OrElse EndsWith(*ee->FileName, ".bi") OrElse EndsWith(*ee->FileName, ".inc") Then
pFiles->Add *ee->FileName
If Not LoadPaths.Contains(*ee->FileName) Then LoadPaths.Add *ee->FileName
ThreadCreate(@LoadOnlyFilePath, @LoadPaths.Item(LoadPaths.IndexOf(*ee->FileName)))
End If
If inFolder Then
ppe->Files.Add *ee->FileName
Delete_( ee)
Else
tn2->Tag = ee
End If
If bNew Then tn1->Expand
ElseIf Parameter = "ProjectType" Then
ppe->ProjectType = Val(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "ProjectName" Then
WLet(ppe->ProjectName, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "HelpFileName" Then
WLet(ppe->HelpFileName, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "ProjectDescription" Then
WLet(ppe->ProjectDescription, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "MajorVersion" Then
ppe->MajorVersion = Val(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "MinorVersion" Then
ppe->MinorVersion = Val(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "RevisionVersion" Then
ppe->RevisionVersion = Val(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "BuildVersion" Then
ppe->BuildVersion = Val(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "AutoIncrementVersion" Then
ppe->AutoIncrementVersion = CBool(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "ApplicationTitle" Then
WLet(ppe->ApplicationTitle, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "ApplicationIcon" Then
WLet(ppe->ApplicationIcon, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "CompanyName" Then
WLet(ppe->CompanyName, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "FileDescription" Then
WLet(ppe->FileDescription, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "InternalName" Then
WLet(ppe->InternalName, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "LegalCopyright" Then
WLet(ppe->LegalCopyright, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "LegalTrademarks" Then
WLet(ppe->LegalTrademarks, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "OriginalFilename" Then
WLet(ppe->OriginalFilename, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "ProductName" Then
WLet(ppe->ProductName, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "CompileToGCC" Then
ppe->CompileToGCC = CBool(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "OptimizationLevel" Then
ppe->OptimizationLevel = Val(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "OptimizationFastCode" Then
ppe->OptimizationFastCode = CBool(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "OptimizationSmallCode" Then
ppe->OptimizationFastCode = CBool(Mid(Buff, Pos1 + 1))
ElseIf Parameter = "CompilationArguments32Windows" Then
WLet(ppe->CompilationArguments32Windows, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "CompilationArguments64Windows" Then
WLet(ppe->CompilationArguments64Windows, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "CompilationArguments32Linux" Then
WLet(ppe->CompilationArguments32Linux, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "CompilationArguments64Linux" Then
WLet(ppe->CompilationArguments64Linux, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "CommandLineArguments" Then
WLet(ppe->CommandLineArguments, Mid(Buff, Pos1 + 2, Len(Buff) - Pos1 - 2))
ElseIf Parameter = "CreateDebugInfo" Then
ppe->CreateDebugInfo = CBool(Mid(Buff, Pos1 + 1))
End If
Loop