Menu

[r23]: / Modules / ModApplication.bas  Maximize  Restore  History

Download this file

875 lines (742 with data), 29.2 kB

  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
Attribute VB_Name = "modApplication"
'Flamebird MX
'Copyright (C) 2003-2007 Flamebird Team
'Contact:
' JaViS: javisarias@ gmail.com (JaViS)
' Danko: lord_danko@users.sourceforge.net (Darío Cutillas)
' Zubiaurre: izubiaurre@users.sourceforge.net (Imanol Zubiaurre)
'
'This program is free software; you can redistribute it and/or modify
'it under the terms of the GNU General Public License as published by
'the Free Software Foundation; either version 2 of the License, or
'(at your option) any later version.
'
'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'GNU General Public License for more details.
Option Explicit
Public Const CONF_FILE As String = "/conf/config.ini"
Public Const EDITOR_CONF_FILE As String = "/conf/editor.ini"
Public Const RES_FOLDER As String = "/Resources"
Public Ini As New cInifile
Public FSO As New FileSystemObject
Public G_ProcHelpLine As Integer ' -1: don't show, 0: upper, 1: under
Public fenixDir As String
Public R_Compiler As Integer
Public R_Debug As Boolean
Public R_Stub As Boolean
Public R_AutoDeclare As Boolean
Public R_MsDos As Boolean
Public R_DebugDCB As Boolean
Public R_Paths As Boolean
Public R_PathsList As String
Public R_Dcb As Boolean
Public R_DcbName As String
Public R_AllFiles As Boolean
Public R_Files As Boolean
Public R_FilesList As String
Public R_Macros As Boolean
Public R_MAcrosText As String
'Public R_filter As Boolean
'Public R_DoubleBuf As Boolean
Public R_SaveBeforeCompiling As Integer
Public A_StyleXP As Boolean 'Use XP menu and toolbars look
Public A_Bitmaps As Boolean
Public A_Color As Integer
Public A_Flametracker As Integer
Public M_Style As Variant 'Menu style
Public T_Style As Variant 'Toolbar style
Public IS_Show As Boolean
Public IS_Sensitive As Integer
Public IS_LangDefConst As Boolean
Public IS_LangDefVar As Boolean
Public IS_LangDefFunc As Boolean
Public IS_UserDefConst As Boolean
Public IS_UserDefVar As Boolean
Public IS_UserDefFunc As Boolean
Public IS_UserDefProc As Boolean
Public PI_Active As Boolean
Public PI_ShowConsts As Boolean
Public PI_ShowGlobals As Boolean
Public PI_ShowLocals As Boolean
Public PI_ShowPrivates As Boolean
Public PI_OnlyConstHeader As Boolean
Public PI_OnlyGlobalHeader As Boolean
Public PI_OnlyLocalHeader As Boolean
Public operatorList() As String
Public typeList() As String
Public sentenceList() As String
Public preprocessList() As String
Public constList() As String
Public globalList() As String
Public localList() As String
Public globalStructList() As String
Public localStructList() As String
Public Propiedades As Globals
Public Bennu As Language
'Type for storing cmColorItems info (for editor configuration)
Public Type clrStyle
name As String
cmItem As cmColorItem
cmStyleItem As cmFontStyleItem
extended As Boolean 'If true, the clrStyle has two colors (background and foreground)
End Type
Private styles() As clrStyle
'XP Theme
Private Type tagInitCommonControlsEx
lngSize As Long
lngICC As Long
End Type
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" _
(iccex As tagInitCommonControlsEx) As Boolean
Private Const ICC_USEREX_CLASSES = &H200
'Stores opened project
Public openedProject As cProject
' Command history ---------------------------------------------------------------
Private Type CALL_LIST
commands(100) As String
lastCommandIndex As Integer
paths(100) As String
lastPathIndex As Integer
' to run out this form the last command
publicLastCommand As String
publicLastPath As String
End Type
Public callList As CALL_LIST
Public lastCommandEnabled As Boolean
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'START ACTIVE X & DLL
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'Registers Active X & dlls controls form the related directory
Private Sub RegisterAppComponents()
Dim fileString As String
Dim result As Variant
fileString = Dir(App.Path & "/Related/")
fileString = LCase(fileString)
Do Until fileString = ""
If Right(fileString, 4) = ".dll" Or _
Right(fileString, 4) = ".ocx" Or _
Right(fileString, 4) = ".exe" Then
SetSplashMessage "Registering " & fileString
DoEvents
result = Register(App.Path & "/Related/" & fileString)
Select Case result
Case 1: MsgBox "File Could Not Be Loaded Into Memory Space "
Case 2: MsgBox "Not A Valid ActiveX Component"
Case 3: MsgBox "ActiveX Component Registration Failed"
Case 5: MsgBox "ActiveX Component UnRegister Successful"
Case 6: MsgBox "ActiveX Component UnRegistration Failed"
Case 7: MsgBox "No File Provided"
End Select
DoEvents
End If
fileString = Dir
fileString = LCase(fileString)
Loop
End Sub
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'END ACTIVE X & DLL
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'START LANGUAGE
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'Loads language definition
Private Sub LoadLan()
Dim linea As String
Dim Seccion As String, Str_func As String, Str_keyw As String
Dim Str_op As String, Str_data As String
Dim num As Integer, num1 As Integer, Contador1 As Integer
Dim cntTypes As Integer, cntOperators As Integer, cntSentences As Integer
Dim cntPreprocesses As Integer, cntConsts As Integer, cntGlobals As Integer
Dim cntLocals As Integer, cntGlobalStructs As Integer, cntLocalStructs As Integer
On Error GoTo errhandler
Str_func = ""
Str_keyw = ""
Seccion = -2
num = FreeFile
If FSO.FileExists(App.Path & "/Help/fdl.lan") = False Then
MsgBox App.Path & "/Help/fdl.lan" & " is missing!. ", vbCritical, "Fatal error"
'End
End If
'Clear types and operators lists
Erase typeList
Erase operatorList
Erase sentenceList
Erase preprocessList
Erase constList
Erase globalList
Erase localList
Erase globalStructList
Erase localStructList
cntTypes = 0
cntOperators = 0
cntSentences = 0
cntPreprocesses = 0
cntConsts = 0
cntGlobals = 0
cntLocals = 0
cntGlobalStructs = 0
cntLocalStructs = 0
Open App.Path & "/Help/fdl.lan" For Input As #num
Do Until EOF(num)
' reads a line
Line Input #num, linea
If InStr(linea, "//#") <> 1 And linea <> "" Then 'si no es una palabra de seccion
linea = Trim(linea)
Select Case Seccion
Case "SENTENCE"
ReDim Preserve sentenceList(cntSentences) As String
sentenceList(cntSentences) = linea
cntSentences = cntSentences + 1
If Str_keyw = "" Then
Str_keyw = linea
Else
Str_keyw = Str_keyw & Chr(10) & linea
End If
Case "PREPROCESS"
ReDim Preserve preprocessList(cntPreprocesses) As String
preprocessList(cntPreprocesses) = linea
cntPreprocesses = cntPreprocesses + 1
If Str_keyw = "" Then
Str_keyw = linea
Else
Str_keyw = Str_keyw & Chr(10) & linea
End If
Case "TYPE"
ReDim Preserve typeList(cntTypes) As String
typeList(cntTypes) = linea
cntTypes = cntTypes + 1
If Str_keyw = "" Then
Str_keyw = linea
Else
Str_keyw = Str_keyw & Chr(10) & linea
End If
Case "OPERATOR"
ReDim Preserve operatorList(cntOperators) As String
operatorList(cntOperators) = linea
cntOperators = cntOperators + 1
If Str_op = "" Then
Str_op = linea
Else
Str_op = Str_op & Chr(10) & linea
End If
Case "CONST"
ReDim Preserve constList(cntConsts) As String
constList(cntConsts) = linea
cntConsts = cntConsts + 1
If Str_data = "" Then
Str_data = linea
Else
Str_data = Str_data & Chr(10) & linea
End If
Case "GLOBAL"
ReDim Preserve globalList(cntGlobals) As String
globalList(cntGlobals) = linea
cntGlobals = cntGlobals + 1
If Str_data = "" Then
Str_data = linea
Else
Str_data = Str_data & Chr(10) & linea
End If
Case "LOCAL"
ReDim Preserve localList(cntLocals) As String
localList(cntLocals) = linea
cntLocals = cntLocals + 1
If Str_data = "" Then
Str_data = linea
Else
Str_data = Str_data & Chr(10) & linea
End If
Case "GLOBAL_STRUCT"
ReDim Preserve globalStructList(cntGlobalStructs) As String
globalStructList(cntGlobalStructs) = linea
cntGlobalStructs = cntGlobalStructs + 1
If Str_data = "" Then
Str_data = linea
Else
Str_data = Str_data & Chr(10) & linea
End If
Case "LOCAL_STRUCT"
ReDim Preserve localStructList(cntLocalStructs) As String
localStructList(cntLocalStructs) = linea
cntLocalStructs = cntLocalStructs + 1
If Str_data = "" Then
Str_data = linea
Else
Str_data = Str_data & Chr(10) & linea
End If
' Case "SENTENS", "PREPROCESS", "DATATYPE": 'keywords
' 'la agrega a la lista de palabras reservadas
' If Str_keyw = "" Then
' Str_keyw = linea
' Else
' Str_keyw = Str_keyw & Chr(10) & linea
' End If
'
' If Seccion = "DATATYPE" Then
' ReDim Preserve typeList(cntTypes) As String
' typeList(cntTypes) = linea
' cntTypes = cntTypes + 1
' End If
'
' Case "SIMBOLS": 'operadores
' ReDim Preserve operatorList(cntOperators) As String
' operatorList(cntOperators) = linea
' cntOperators = cntOperators + 1
'
' 'la agrega a la lista de palabras reservadas
' If Str_op = "" Then
' Str_op = linea
' Else
' Str_op = Str_op & Chr(10) & linea
' End If
' Case "MISC": 'locales, globales y constantes
'
' 'la agrega a la lista de palabras reservadas
' If Str_data = "" Then
' Str_data = linea
' Else
' Str_data = Str_data & Chr(10) & linea
' End If
End Select
Else
linea = replace(linea, "-", "")
linea = Trim(linea)
linea = Mid(linea, 4)
Seccion = UCase(linea)
End If
Loop
Close #num
Set Propiedades = New Globals
Set Bennu = New Language
With Bennu
.TagAttributeNames = Str_data
.TagElementNames = "//#Section:" 'usado para IDEkeywords
.CaseSensitive = False
.StringDelims = Chr(34)
.Keywords = Str_keyw
.SingleLineComments = "//"
.Operators = Str_op
.MultiLineComments1 = "/*"
.MultiLineComments2 = "*/"
End With
Propiedades.RegisterLanguage "Bennu", Bennu
Exit Sub
errhandler:
If Err.Number > 0 Then ShowError ("LoadLan"): Resume Next
End Sub
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'END LANGUAGE
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'START EDITOR STYLES
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'Add a new style to our ColorStyle array
Public Property Get StyleItem(Index As Integer) As clrStyle
StyleItem = styles(Index)
End Property
Public Property Get StyleItemCount() As Integer
StyleItemCount = UBound(styles) + 1
End Property
Private Sub AddStyle(name As String, cmItem As cmColorItem, extended As Boolean, cmStyleItem As cmFontStyleItem)
Static stylescount As Integer
ReDim Preserve styles(stylescount) As clrStyle
With styles(stylescount)
.name = name
.cmItem = cmItem
.cmStyleItem = cmStyleItem
.extended = extended
End With
stylescount = stylescount + 1
End Sub
Private Sub InitStyles()
Dim i As Integer
AddStyle "Window", cmClrWindow, False, -1
AddStyle "Text", cmClrText, True, cmStyText
AddStyle "KeyWord", cmClrKeyword, True, cmStyKeyword
AddStyle "Comment", cmClrComment, True, cmStyComment
AddStyle "LineNumber", cmClrLineNumber, True, cmStyLineNumber
AddStyle "Operator", cmClrOperator, True, cmStyOperator
AddStyle "Number", cmClrNumber, True, cmStyNumber
AddStyle "String", cmClrString, True, cmStyString
AddStyle "ScopeKeyword", cmClrScopeKeyword, True, cmStyScopeKeyword
AddStyle "LeftMargin", cmClrLeftMargin, False, -1
AddStyle "Bookmark", cmClrBookmark, True, -1
AddStyle "HighlightedLine", cmClrHighlightedLine, False, -1
AddStyle "HDividerLines", cmClrHDividerLines, False, -1
AddStyle "VDividerLines", cmClrVDividerLines, False, -1
AddStyle "TagText", cmClrTagText, True, cmStyTagText
AddStyle "TagEntity", cmClrTagEntity, True, cmStyTagEntity
AddStyle "TagElementName", cmClrTagElementName, True, cmStyTagElementName
AddStyle "TagAttributeName", cmClrTagAttributeName, True, cmStyTagAttributeName
End Sub
Public Sub LoadCSConf(cs As Object, Optional ByVal sConfFile As String)
Dim i As Integer
With Ini
.Path = App.Path & "/Conf/editor.ini"
If sConfFile <> "" Then
If FSO.FileExists(sConfFile) Then
.Path = sConfFile
End If
End If
.Section = "EditorConfig"
.Key = "Font"
.Default = "Courier New"
cs.font.name = .Value
.Key = "FontSize"
.Default = "12"
cs.font.Size = CLng(Val(.Value))
For i = 0 To UBound(styles)
.Key = styles(i).name
cs.SetColor styles(i).cmItem, CLng(Val(.Value))
If styles(i).extended Then
.Key = styles(i).name & "Bk"
cs.SetColor styles(i).cmItem + 1, CLng(Val(.Value))
End If
If styles(i).cmStyleItem > -1 Then
.Key = styles(i).name & "Style"
cs.SetFontStyle styles(i).cmStyleItem, CLng(Val(.Value))
End If
Next
.Key = "LineNumering"
cs.LineNumbering = CBool(CInt(.Value))
.Key = "BookmarkMargin"
cs.DisplayLeftMargin = CBool(CInt(.Value))
.Key = "ColorSyntax"
cs.ColorSyntax = CBool(CInt(.Value))
.Key = "NormalizeCase"
cs.NormalizeCase = CBool(CInt(.Value))
.Key = "DisplayWhiteSpaces"
cs.DisplayWhitespace = CBool(CInt(.Value))
.Key = "SmoothScrolling"
cs.SmoothScrolling = CBool(CInt(.Value))
.Key = "ConfineCaretToText"
cs.SelBounds = CInt(.Value)
.Key = "IndentMode"
cs.AutoIndentMode = CInt(.Value)
.Key = "TabSize"
cs.TabSize = CInt(.Value)
End With
End Sub
Public Sub SaveCSConf(cs As Object, Optional sConfFile As String)
Dim i As Integer
With Ini
.Path = App.Path & "/Conf/editor.ini"
If sConfFile <> "" Then
.Path = sConfFile
End If
.Section = "EditorConfig"
.Key = "Font"
.Value = cs.font.name
.Key = "FontSize"
.Value = CStr(cs.font.Size)
'Styles
For i = 0 To UBound(styles)
.Key = styles(i).name
.Value = "&H" & hex(cs.GetColor(styles(i).cmItem)) & "&"
If styles(i).extended Then
.Key = styles(i).name & "Bk"
.Value = "&H" & hex(cs.GetColor(styles(i).cmItem + 1)) & "&"
End If
If styles(i).cmStyleItem > -1 Then
.Key = styles(i).name & "Style"
.Value = "&H" & hex(cs.GetFontStyle(styles(i).cmStyleItem)) & "&"
End If
Next
.Key = "LineNumering"
.Value = CStr(CInt(cs.LineNumbering))
.Key = "BookmarkMargin"
.Value = CStr(CInt(cs.DisplayLeftMargin))
.Key = "ColorSyntax"
.Value = CStr(CInt(cs.ColorSyntax))
.Key = "NormalizeCase"
.Value = CStr(CInt(cs.NormalizeCase))
.Key = "DisplayWhiteSpaces"
.Value = CStr(CInt(cs.DisplayWhitespace))
.Key = "SmoothScrolling"
.Value = CStr(CInt(cs.SmoothScrolling))
.Key = "ConfineCaretToText"
.Value = CStr(CInt(cs.SelBounds))
.Key = "IndentMode"
.Value = CStr(cs.AutoIndentMode)
.Key = "TabSize"
.Value = CStr(cs.TabSize)
End With
End Sub
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'END EDITOR STYLES
'·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-'
'Returns an string containig all the opened files belonging to the project
Public Function FileArray() As String
Dim sFiles As String
Dim ff As IFileForm
Dim f As Form
For Each f In Forms
If TypeOf f Is IFileForm Then
Set ff = f
If openedProject.FileExist(ff.FilePath) Then 'The file belongs to the project
sFiles = sFiles & ff.FilePath & "|"
End If
End If
Next
If Not sFiles = "" Then sFiles = Left(sFiles, Len(sFiles) - 1) 'Remove the last |
FileArray = sFiles
End Function
' Loads commands history
Public Sub loadCommandHistory()
Dim sCommands As String, sPaths As String
Dim i As Integer
On Error GoTo errhandler:
With Ini
.Path = App.Path & "/Conf/command.ini"
.Section = "General"
.Key = "lastCommand"
callList.lastCommandIndex = .Value
.Key = "lastPath"
callList.lastPathIndex = .Value
.Section = "Commands"
For i = 0 To 100
.Key = "cmd_" & i
If i <= callList.lastCommandIndex Then
callList.commands(i) = .Value
Else
callList.commands(i) = ""
End If
Next i
.Section = "Paths"
For i = 0 To 100
.Key = "path_" & i
If i <= callList.lastPathIndex Then
callList.paths(i) = .Value
Else
callList.paths(i) = ""
End If
Next i
End With
Exit Sub
errhandler:
If Err.Number > 0 Then ShowError ("loadCommandHistory")
End Sub
'Loads the configuration file Config.ini
Private Sub LoadConf()
With Ini
.Path = App.Path & CONF_FILE
.Section = "General"
.Key = "ProcHelpLine"
.Default = "1"
G_ProcHelpLine = IIf(.Value = "0", 0, IIf(.Value = "1", 1, -1))
.Section = "Appearance"
.Key = "XPStyle"
.Default = "1"
A_StyleXP = IIf(.Value = "1", True, False)
.Key = "BitmapBacks"
.Default = "0"
A_Bitmaps = IIf(.Value = "1", True, False)
.Key = "Color"
.Default = "1"
A_Color = IIf(.Value = "1" Or .Value = "2" Or .Value = "3" Or .Value = "4" Or .Value = "5" Or .Value = "6" Or .Value = "7" Or .Value = "8" Or .Value = "9" Or .Value = "0", .Value, 1)
.Key = "Flametracker"
.Default = "9"
A_Flametracker = IIf(.Value = "1" Or .Value = "2" Or .Value = "3" Or .Value = "4" Or .Value = "5" Or .Value = "6" Or .Value = "7" Or .Value = "8" Or .Value = "9" Or .Value = "10" Or .Value = "11" Or .Value = "12" Or .Value = "13" Or .Value = "0", .Value, 9)
.Section = "Run"
.Key = "Compiler"
R_Compiler = .Value
If .Value = 0 Then
.Key = "FenixPath"
Else
.Key = "BennuPath"
End If
.Default = " "
fenixDir = .Value
Debug.Print fenixDir
' .Key = "Compiler"
' .Default = "1"
' R_Compiler = IIf(.Value = True, "0", "1")
.Key = "Debug"
.Default = "1"
R_Debug = IIf(.Value = "1", True, False)
.Key = "AutoDeclare"
.Default = "1"
R_AutoDeclare = IIf(.Value = 1, True, False)
.Key = "Stub"
.Default = "0"
R_Stub = IIf(.Value = 1, True, False)
.Key = "MsDos"
.Default = "0"
R_MsDos = IIf(.Value = 1, True, False)
.Key = "DebugDCB"
.Default = "1"
R_DebugDCB = IIf(.Value = "1", True, False)
.Key = "Paths"
.Default = "1"
R_Paths = IIf(.Value = "1", True, False)
' .Key = "Filter"
' .Default = "0"
' R_filter = IIf(.value = "1", True, False)
'
' .Key = "DoubleBuffer"
' .Default = "0"
' R_DoubleBuf = IIf(.value = "1", True, False)
.Key = "SaveBeforeCompiling"
.Default = "0"
R_SaveBeforeCompiling = IIf(.Value = "1", 1, IIf(.Value = "2", 2, IIf(.Value = "3", 3, 0)))
.Section = "IntelliSense"
.Key = "Show"
.Default = "1"
IS_Show = IIf(.Value = 1, True, False)
'If IS_Show Then
.Key = "Sensitive"
.Default = "2"
IS_Sensitive = CLng(.Value)
.Key = "LangDefConst"
.Default = "1"
IS_LangDefConst = IIf(.Value = 1, True, False)
.Key = "LangDefVar"
.Default = "1"
IS_LangDefVar = IIf(.Value = 1, True, False)
.Key = "LangDefFunc"
.Default = "1"
IS_LangDefFunc = IIf(.Value = 1, True, False)
.Key = "UserDefConst"
.Default = "1"
IS_UserDefConst = IIf(.Value = 1, True, False)
.Key = "UserDefvar"
.Default = "1"
IS_UserDefVar = IIf(.Value = 1, True, False)
.Key = "UserDefFunc"
.Default = "1"
IS_UserDefFunc = IIf(.Value = 1, True, False)
.Key = "UserDefProc"
.Default = "1"
IS_UserDefProc = IIf(.Value = 1, True, False)
'End If
.Section = "ProgramInspector"
.Key = "Active"
.Default = "1"
PI_Active = IIf(.Value = 1, True, False)
.Key = "ShowConsts"
.Default = "1"
PI_ShowConsts = IIf(.Value = 1, True, False)
.Key = "ShowGlobals"
.Default = "1"
PI_ShowGlobals = IIf(.Value = 1, True, False)
.Key = "ShowLocals"
.Default = "1"
PI_ShowLocals = IIf(.Value = 1, True, False)
.Key = "ShowPrivates"
.Default = "1"
PI_ShowPrivates = IIf(.Value = 1, True, False)
.Key = "OnlyConstHeader"
.Default = "1"
PI_OnlyConstHeader = IIf(.Value = 1, True, False)
.Key = "OnlyGlobalHeader"
.Default = "1"
PI_OnlyGlobalHeader = IIf(.Value = 1, True, False)
.Key = "OnlyLocalHeader"
.Default = "1"
PI_OnlyLocalHeader = IIf(.Value = 1, True, False)
End With
'Determine whether to use or not XP styles for menus and toolbars
If A_StyleXP = True Then
M_Style = mds_XP
T_Style = CTBDrawOfficeXPStyle
Else
M_Style = mds_3D
T_Style = CTBDrawStandard
End If
End Sub
'Verify if supported file types are registered with FB
Private Sub CheckFileAssoc()
Dim ask As Boolean
'THIS SHOULD BE CHANGED TO SOMETHING MORE GENERAL
If FileAssociated(".fbp", "FlameBird.Project") = False _
Or FileAssociated(".prg", "Bennu/Fenix.Source") = False _
Or FileAssociated(".map", "Bennu/Fenix.ImageFile") = False Or _
FileAssociated(".dcb", "Bennu/Fenix.Bin") = False Then
With Ini
.Path = App.Path & CONF_FILE
.Section = "General"
.Key = "AskFileRegister"
.Default = "1"
ask = IIf(.Value = "1", True, False)
End With
If ask = True Then
frmRegisterFiletypes.Show vbModal
End If
End If
End Sub
'Sets the lbl message of the Splash form
Public Sub SetSplashMessage(sMsg As String)
frmSplash.lblMessage.Caption = sMsg
DoEvents
End Sub
'APPLICATION ENTRY POINT
Public Sub Main()
On Error GoTo errhandler
LoadConf
' Select XP / Normal style
If A_StyleXP Then
InitCommonControlsVB
End If
frmSplash.Show
'Register dlls and ocx of the related dir
'RegisterAppComponents
'Language definition
SetSplashMessage "Loading languaje definition"
LoadLan
'Command History
SetSplashMessage "Loading command history"
loadCommandHistory
'Editor Styles
SetSplashMessage "Initializating editor styles"
InitStyles
' General configuration
' SetSplashMessage "Loading general configuration"
' LoadConf
'Init FMOD sound system
SetSplashMessage "Initializing Audio System"
initFMOD
'Load External Tools
SetSplashMessage "Loading external tools configuration"
LoadExternalTools
'FileFilter
SetSplashMessage "Creating file filters"
CreateFileFilters
'Register user-defined plugins
RegisterPlugins
'Create color conversion tables
SetSplashMessage "Loading conversion tables"
initConversionTables
'Verify if supported file types are registered with FB
SetSplashMessage "Checking registration info"
CheckFileAssoc
'Load MDI form
SetSplashMessage ("Loading main application")
Load frmMain
Unload frmSplash
'FBMX Starts :D. GO Go go!
frmMain.Show
Exit Sub
errhandler:
If Err.Number > 0 Then ShowError ("Main"): Resume Next
End Sub
'Just fot debuggin purposes
Public Sub ShowError(str As String)
MsgBox "Error in " & str & vbCrLf & "Description: " & Err.description _
& vbCrLf & "Number: " & Err.Number, vbCritical '& vbCrLf & Err.Source
Err.Clear
End Sub
' Just for XP themes
Public Function InitCommonControlsVB() As Boolean
On Error Resume Next
Dim iccex As tagInitCommonControlsEx
' Ensure CC available:
With iccex
.lngSize = LenB(iccex)
.lngICC = ICC_USEREX_CLASSES
End With
InitCommonControlsEx iccex
InitCommonControlsVB = (Err.Number = 0)
On Error GoTo 0
End Function