/
TabWindow.bas
9018 lines (8822 loc) · 367 KB
/
TabWindow.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
'#########################################################
'# TabWindow.bas #
'# This file is part of VisualFBEditor #
'# Authors: Xusinboy Bekchanov (bxusinboy@mail.ru) #
'# Liu XiaLin (LiuZiQi.HK@hotmail.com) #
'#########################################################
#include once "TabWindow.bi"
#include once "frmImageManager.bi"
#include once "Debug.bi"
#include once "vbcompat.bi" ' for could using format function
#define TabSpace IIf(TabAsSpaces AndAlso ChoosedTabStyle = 0, WSpace(TabWidth), !"\t")
Dim Shared FPropertyItems As WStringList
Dim Shared FListItems As WStringList
Dim Shared txtCodeBi As EditControl
Dim Shared mnuCode As PopupMenu
pmnuCode = @mnuCode
Dim Shared MouseHoverTimerVal As Double
txtCodeBi.WithHistory = False
Destructor ExplorerElement
If FileName Then Deallocate_( FileName)
If TemplateFileName Then Deallocate_( TemplateFileName)
End Destructor
Constructor ProjectElement
WLet(FileDescription, "{ProjectDescription}")
WLet(ProductName, "{ProjectName}")
Manifest = True
End Constructor
Destructor ProjectElement
WDeAllocate MainFileName
WDeAllocate ResourceFileName
WDeAllocate IconResourceFileName
WDeAllocate ProjectName
WDeAllocate HelpFileName
WDeAllocate ProjectDescription
WDeAllocate ApplicationTitle
WDeAllocate ApplicationIcon
WDeAllocate CompanyName
WDeAllocate FileDescription
WDeAllocate InternalName
WDeAllocate LegalCopyright
WDeAllocate LegalTrademarks
WDeAllocate OriginalFilename
WDeAllocate ProductName
WDeAllocate CompilationArguments32Windows
WDeAllocate CompilationArguments64Windows
WDeAllocate CompilationArguments32Linux
WDeAllocate CompilationArguments64Linux
WDeAllocate CompilerPath
WDeAllocate CommandLineArguments
WDeAllocate AndroidSDKLocation
WDeAllocate AndroidNDKLocation
WDeAllocate JDKLocation
Files.Clear
End Destructor
Public Sub MoveCloseButtons(ptabCode As TabControl Ptr)
Dim As Rect RR
For i As Integer = 0 To ptabCode->TabCount - 1
Dim tb As TabWindow Ptr = Cast(TabWindow Ptr, ptabCode->Tabs[i])
If tb = 0 Then Continue For
#ifndef __USE_GTK__
SendMessage(ptabCode->Handle, TCM_GETITEMRECT, tb->Index, CInt(@RR))
MoveWindow tb->btnClose.Handle, RR.Right - ScaleX(18), ScaleY(4), ScaleX(14), ScaleY(14), True
If g_darkModeSupported AndAlso g_darkModeEnabled Then
UpdateWindow ptabCode->Handle
End If
#endif
Next i
End Sub
Sub PopupClick(ByRef Sender As My.Sys.Object)
Var tb = Cast(TabWindow Ptr, ptabCode->SelectedTab)
If tb = 0 OrElse tb->Des = 0 Then Exit Sub
Select Case Sender.ToString
Case "Default": DesignerDblClickControl(*tb->Des, tb->Des->SelectedControl)
Case "Copy": tb->Des->CopyControl()
Case "Cut": tb->Des->CutControl()
Case "Paste": tb->Des->PasteControl()
Case "Delete": tb->Des->DeleteControl()
Case "BringToFront": DesignerBringToFront(*tb->Des, tb->Des->SelectedControl)
Case "SendToBack": DesignerSendToBack(*tb->Des, tb->Des->SelectedControl)
Case "Properties": If tb->Des->OnClickProperties Then tb->Des->OnClickProperties(*tb->Des, tb->Des->SelectedControl)
End Select
End Sub
' Could not find in the child node
Function FileNameInTreeNode(tn As TreeNode Ptr, ByRef FileName As WString) As TreeNode Ptr
If tn = 0 Then Return 0
Dim As ExplorerElement Ptr ee
Dim As TreeNode Ptr FindNode
Dim tParent As Boolean
If tn->Tag <> 0 Then
ee = tn->Tag
If EqualPaths(*ee->FileName, FileName) Then Return tn
End If
If tn->Nodes.Count > 0 Then
For i As Integer = 0 To tn->Nodes.Count - 1
FindNode = FileNameInTreeNode(tn->Nodes.Item(i), FileName)
If FindNode <> 0 Then Return FindNode
Next
End If
Return 0
End Function
Sub FormatProject(UnFormat As Any Ptr)
Dim As TreeNode Ptr tn, tn1, tn2 = ptvExplorer->SelectedNode
Dim As ExplorerElement Ptr ee
Dim As EditControl txt
Dim As EditControl Ptr ptxt
Dim As TabWindow Ptr tb, tbCurrent = Cast(TabWindow Ptr, ptabCode->SelectedTab)
Dim FileEncoding As FileEncodings, NewLineType As NewLineTypes
If tn2 <> 0 Then tn2 = GetParentNode(tn2)
If tn2 = 0 OrElse tn2->ImageKey <> "Project" Then Exit Sub
If tbCurrent <> 0 Then tbCurrent->txtCode.UpdateLock
pfrmMain->Enabled = False
StartProgress
For i As Integer = 0 To tn2->Nodes.Count - 1
tn = tn2->Nodes.Item(i)
ee = tn->Tag
If ee = 0 Then
For j As Integer = 0 To tn->Nodes.Count - 1
tn1 = tn->Nodes.Item(j)
If tn1 <> 0 Then
ee = tn1->Tag
If ee <> 0 AndAlso (EndsWith(*ee->FileName, ".bas") OrElse EndsWith(*ee->FileName, ".bi") OrElse EndsWith(*ee->FileName, ".inc") OrElse EndsWith(*ee->FileName, ".frm")) Then
tb = GetTab(*ee->FileName)
If tb = 0 Then
txt.LoadFromFile(*ee->FileName, FileEncoding, NewLineType)
ptxt = @txt
Else
ptxt = @tb->txtCode
End If
If UnFormat Then ptxt->UnformatCode(True) Else ptxt->FormatCode(True)
If tb = 0 Then ptxt->SaveToFile(*ee->FileName, FileEncoding, NewLineType)
End If
End If
Next
ElseIf (EndsWith(*ee->FileName, ".bas") OrElse EndsWith(*ee->FileName, ".bi") OrElse EndsWith(*ee->FileName, ".inc") OrElse EndsWith(*ee->FileName, ".frm")) Then
tb = GetTab(*ee->FileName)
If tb = 0 Then
txt.LoadFromFile(*ee->FileName, FileEncoding, NewLineType)
ptxt = @txt
Else
ptxt = @tb->txtCode
End If
If UnFormat Then ptxt->UnformatCode(True) Else ptxt->FormatCode(True)
If tb = 0 Then ptxt->SaveToFile(*ee->FileName, FileEncoding, NewLineType)
End If
Next
StopProgress
pfrmMain->Enabled = True
If tbCurrent <> 0 Then tbCurrent->txtCode.UpdateUnLock
MsgBox ML("Done") & "!"
End Sub
Sub NumberingProject(pSender As Any Ptr)
Dim As TreeNode Ptr tn, tn1, tn2 = ptvExplorer->SelectedNode
Dim As ExplorerElement Ptr ee
Dim As Boolean bMacro = StartsWith(Cast(My.Sys.Object Ptr, pSender)->ToString, "ProjectMacroNumberOn")
Dim As Boolean bStartsOfProcs = EndsWith(Cast(My.Sys.Object Ptr, pSender)->ToString, "StartsOfProcs")
Dim As Boolean bPreprocesssor = StartsWith(Cast(My.Sys.Object Ptr, pSender)->ToString, "ProjectPreprocessor")
Dim As Boolean bRemove = Cast(My.Sys.Object Ptr, pSender)->ToString = "ProjectNumberOff"
Dim As Boolean bRemovePreprocessor = Cast(My.Sys.Object Ptr, pSender)->ToString = "ProjectPreprocessorNumberOff"
Dim As EditControl txt
Dim As EditControl Ptr ptxt
Dim As TabWindow Ptr tb, tbCurrent = Cast(TabWindow Ptr, ptabCode->SelectedTab)
Dim FileEncoding As FileEncodings, NewLineType As NewLineTypes
If tn2 <> 0 Then tn2 = GetParentNode(tn2)
If tn2 = 0 OrElse tn2->ImageKey <> "Project" Then Exit Sub
If tbCurrent <> 0 Then tbCurrent->txtCode.UpdateLock
pfrmMain->Enabled = False
StartProgress
For i As Integer = 0 To tn2->Nodes.Count - 1
tn = tn2->Nodes.Item(i)
ee = tn->Tag
If ee = 0 Then
For j As Integer = 0 To tn->Nodes.Count - 1
tn1 = tn->Nodes.Item(j)
If tn1 <> 0 Then
ee = tn1->Tag
If ee <> 0 AndAlso (EndsWith(*ee->FileName, ".bas") OrElse EndsWith(*ee->FileName, ".bi") OrElse EndsWith(*ee->FileName, ".inc") OrElse EndsWith(*ee->FileName, ".frm")) Then
tb = GetTab(*ee->FileName)
If tb = 0 Then
txt.LoadFromFile(*ee->FileName, FileEncoding, NewLineType)
ptxt = @txt
Else
ptxt = @tb->txtCode
End If
If bPreprocesssor Then
If bRemovePreprocessor Then PreprocessorNumberingOff(*ptxt, True) Else PreprocessorNumberingOn(*ptxt, *ee->FileName, True)
Else
If bRemove Then NumberingOff(0, ptxt->LinesCount - 1, *ptxt, True) Else NumberingOn(0, ptxt->LinesCount - 1, bMacro, *ptxt, True, bStartsOfProcs)
End If
If tb = 0 Then ptxt->SaveToFile(*ee->FileName, FileEncoding, NewLineType)
End If
End If
Next
ElseIf (EndsWith(*ee->FileName, ".bas") OrElse EndsWith(*ee->FileName, ".bi") OrElse EndsWith(*ee->FileName, ".inc") OrElse EndsWith(*ee->FileName, ".frm")) Then
tb = GetTab(*ee->FileName)
If tb = 0 Then
txt.LoadFromFile(*ee->FileName, FileEncoding, NewLineType)
ptxt = @txt
Else
ptxt = @tb->txtCode
End If
If bPreprocesssor Then
If bRemovePreprocessor Then PreprocessorNumberingOff(*ptxt, True) Else PreprocessorNumberingOn(*ptxt, *ee->FileName, True)
Else
If bRemove Then NumberingOff(0, ptxt->LinesCount - 1, *ptxt, True) Else NumberingOn(0, ptxt->LinesCount - 1, bMacro, *ptxt, True, bStartsOfProcs)
End If
If tb = 0 Then ptxt->SaveToFile(*ee->FileName, FileEncoding, NewLineType)
End If
Next
StopProgress
pfrmMain->Enabled = True
If tbCurrent <> 0 Then tbCurrent->txtCode.UpdateUnLock
MsgBox ML("Done") & "!"
End Sub
Function GetTab(ByRef FileName As WString) As TabWindow Ptr
Dim As TabWindow Ptr tb
For j As Integer = 0 To TabPanels.Count - 1
Var ptabCode = @Cast(TabPanel Ptr, TabPanels.Item(j))->tabCode
For i As Integer = 0 To ptabCode->TabCount - 1
tb = Cast(TabWindow Ptr, ptabCode->Tabs[i])
If EqualPaths(tb->FileName, FileName) Then Return tb
Next i
Next j
Return 0
End Function
Function GetTabFromTn(tn As TreeNode Ptr) As TabWindow Ptr
Dim As TabWindow Ptr tb
For j As Integer = 0 To TabPanels.Count - 1
Var ptabCode = @Cast(TabPanel Ptr, TabPanels.Item(j))->tabCode
For i As Integer = 0 To ptabCode->TabCount - 1
tb = Cast(TabWindow Ptr, ptabCode->Tabs[i])
If tb->tn = tn Then Return tb
Next i
Next j
Return 0
End Function
Sub ChangeMenuItemsEnabled
Dim bEnabled As Boolean = tvExplorer.Nodes.Count > 0
Dim bEnabledTab As Boolean = miWindow->Count > 3
mnuWindowSeparator->Visible = bEnabledTab
miCode->Enabled = bEnabledTab
miGoto->Enabled = bEnabledTab
miDefine->Enabled = bEnabledTab
miAddProcedure->Enabled = bEnabledTab
mnuSplitHorizontally->Enabled = bEnabledTab
mnuSplitVertically->Enabled = bEnabledTab
miSave->Enabled = bEnabled
tbtSave->Enabled = bEnabled
miSaveAs->Enabled = bEnabled
miSaveAll->Enabled = bEnabled
tbtSaveAll->Enabled = bEnabled
miClose->Enabled = bEnabled
miCloseAll->Enabled = bEnabled
miPrint->Enabled = bEnabled
miPrintPreview->Enabled = bEnabled
miPageSetup->Enabled = bEnabled
miOpenProjectFolder->Enabled = bEnabled
miExplorerOpenProjectFolder->Enabled = bEnabled
miImageManager->Enabled = bEnabled
miRemoveFileFromProject->Enabled = bEnabled
tbtRemoveFileFromProject->Enabled = bEnabled
miFind->Enabled = bEnabled
miFindNext->Enabled = bEnabled
miFindPrevious->Enabled = bEnabled
miReplace->Enabled = bEnabled
miNextBookmark->Enabled = bEnabled
miPreviousBookmark->Enabled = bEnabled
miClearAllBookmarks->Enabled = bEnabled
miClearAllBreakpoints->Enabled = bEnabled
mnuStart->Enabled = bEnabled
mnuStartWithCompile->Enabled = bEnabled
tbtFind->Enabled = bEnabled
tbtStart->Enabled = bEnabled
tbtStartWithCompile->Enabled = bEnabled
miSyntaxCheck->Enabled = bEnabled
tbtSyntaxCheck->Enabled = bEnabled
miCompile->Enabled = bEnabled
tbtCompile->Enabled = bEnabled
miCompileAll->Enabled = bEnabled
miBuildBundle->Enabled = bEnabled
miBuildAPK->Enabled = bEnabled
miGenerateSignedBundle->Enabled = bEnabled
miGenerateSignedAPK->Enabled = bEnabled
miMake->Enabled = bEnabled
miMakeClean->Enabled = bEnabled
dmiMake->Enabled = bEnabled
dmiMakeClean->Enabled = bEnabled
miFormatProject->Enabled = bEnabled
miUnformatProject->Enabled = bEnabled
miProjectMacroNumbering->Enabled = bEnabled
miProjectMacroNumberingStartsOfProcedures->Enabled = bEnabled
miRemoveProjectNumbering->Enabled = bEnabled
miProjectPreprocessorNumbering->Enabled = bEnabled
miRemoveProjectPreprocessorNumbering->Enabled = bEnabled
dmiProjectMacroNumbering->Enabled = bEnabled
dmiProjectMacroNumberingStartsOfProcedures->Enabled = bEnabled
dmiRemoveProjectNumbering->Enabled = bEnabled
dmiProjectPreprocessorNumbering->Enabled = bEnabled
dmiRemoveProjectPreprocessorNumbering->Enabled = bEnabled
miStepInto->Enabled = bEnabled
miStepOver->Enabled = bEnabled
End Sub
Function AddTab(ByRef FileName As WString = "", bNew As Boolean = False, TreeN As TreeNode Ptr = 0, bNoActivate As Boolean = False) As TabWindow Ptr
On Error Goto ErrorHandler
MouseHoverTimerVal = Timer
Dim bFind As Boolean
Dim As UString FileNameNew
Dim As TabWindow Ptr tb
FileNameNew = FileName
If EndsWith(FileNameNew, ":") Then FileNameNew = ..Left(FileNameNew, Len(FileNameNew) - 1)
If FileName <> "" Then
Dim As TabControl Ptr ptabCode
For j As Integer = 0 To TabPanels.Count - 1
ptabCode = @Cast(TabPanel Ptr, TabPanels.Item(j))->tabCode
For i As Integer = 0 To ptabCode->TabCount - 1
If EqualPaths(Cast(TabWindow Ptr, ptabCode->Tabs[i])->FileName, FileNameNew) Then
bFind = True
tb = Cast(TabWindow Ptr, ptabCode->Tabs[i])
If Not bNoActivate Then tb->SelectTab
Return tb
End If
Next i
Next j
If Not bFind Then
Dim tn2 As TreeNode Ptr
For i As Integer = 0 To ptvExplorer->Nodes.Count - 1
tn2 = FileNameInTreeNode(ptvExplorer->Nodes.Item(i), FileNameNew)
If tn2 <> 0 Then
TreeN = tn2
Exit For
End If
Next i
End If
End If
ptabCode->UpdateLock
If Not bFind Then
tb = New_( TabWindow(FileNameNew, bNew, TreeN))
If tb = 0 Then
MsgBox ML("Memory was not allocated")
Return 0
End If
With *tb
If FileName <> "" Then
#ifndef __USE_GTK__
.DateFileTime = GetFileLastWriteTime(FileNameNew)
#endif
End If
tb->UseVisualStyleBackColor = True
tb->CheckExtension FileName
'.txtCode.ContextMenu = @mnuCode
ptabCode->AddTab(Cast(TabPage Ptr, tb))
#ifdef __USE_GTK__
'.layout = gtk_layout_new(NULL, NULL)
'gtk_widget_set_size_request(.layout, 16, 16)
'gtk_layout_put(gtk_layout(.layout), .btnClose.widget, 0, 0)
gtk_box_pack_end (GTK_BOX (._Box), .btnClose.Handle, False, False, 0)
gtk_widget_show_all(._Box)
#else
ptabCode->Add(@.btnClose)
#endif
tb->ImageKey = GetIconName(FileNameNew)
If Not bNoActivate Then .SelectTab Else .Visible = True: ptabCode->RequestAlign: .Visible = False
.tbrTop.Buttons.Item(1)->Checked = True
If FileName <> "" Then
pApp = @VisualFBEditorApp
pApp->MainForm = @frmMain
.txtCode.LoadFromFile(FileNameNew, tb->FileEncoding, tb->NewLineType, True)
If bNew Then
Dim As String NewFormName
If TreeN <> 0 Then
NewFormName = ..Left(TreeN->Text, Len(TreeN->Text) - 5)
End If
For i As Integer = 0 To .txtCode.LinesCount - 1
If CreateFormTypesWithoutTypeWord Then
If .txtCode.Lines(i) = Chr(9) & "Type Form1Type Extends Form" Then
.txtCode.ReplaceLine(i, Chr(9) & "Type Form1 Extends Form")
ElseIf .txtCode.Lines(i) = Chr(9) & "Dim Shared Form1 As Form1Type" Then
.txtCode.ReplaceLine(i, Chr(9) & "Dim Shared fForm1 As Form1")
ElseIf .txtCode.Lines(i) = Chr(9) & Chr(9) & "Form1.Show" Then
.txtCode.ReplaceLine(i, Chr(9) & Chr(9) & "fForm1.Show")
End If
End If
If TreeN Then
If .txtCode.Lines(i) = Chr(9) & "Type Form1 Extends Form" Then
.txtCode.ReplaceLine(i, Chr(9) & "Type " & NewFormName & " Extends Form")
ElseIf .txtCode.Lines(i) = Chr(9) & "Type Form1Type Extends Form" Then
.txtCode.ReplaceLine(i, Chr(9) & "Type " & NewFormName & "Type Extends Form")
ElseIf .txtCode.Lines(i) = Chr(9) & "Dim Shared fForm1 As Form1" Then
.txtCode.ReplaceLine(i, Chr(9) & "Dim Shared f" & NewFormName & " As " & NewFormName)
ElseIf .txtCode.Lines(i) = Chr(9) & "Dim Shared Form1 As Form1Type" Then
.txtCode.ReplaceLine(i, Chr(9) & "Dim Shared " & NewFormName & " As " & NewFormName & "Type")
ElseIf .txtCode.Lines(i) = Chr(9) & Chr(9) & "fForm1.MainForm = True" Then
.txtCode.ReplaceLine(i, Chr(9) & Chr(9) & "f" & NewFormName & ".MainForm = True")
ElseIf .txtCode.Lines(i) = Chr(9) & Chr(9) & "Form1.MainForm = True" Then
.txtCode.ReplaceLine(i, Chr(9) & Chr(9) & NewFormName & ".MainForm = True")
ElseIf .txtCode.Lines(i) = Chr(9) & Chr(9) & "fForm1.Show" Then
.txtCode.ReplaceLine(i, Chr(9) & Chr(9) & "f" & NewFormName & ".Show")
Exit For
ElseIf .txtCode.Lines(i) = Chr(9) & Chr(9) & "Form1.Show" Then
.txtCode.ReplaceLine(i, Chr(9) & Chr(9) & NewFormName & ".Show")
Exit For
End If
End If
Next
End If
Else
#ifdef __FB_WIN32__
tb->NewLineType = NewLineTypes.WindowsCRLF
#else
tb->NewLineType = NewLineTypes.LinuxLF
#endif
tb->FileEncoding = FileEncodings.Utf8BOM
End If
ChangeFileEncoding tb->FileEncoding
ChangeNewLineType tb->NewLineType
.FormDesign(bNoActivate)
pApp->MainForm = @frmMain
If FileName <> "" Then
.txtCode.ClearUndo
.Modified = bNew
End If
.txtCode.ScrollToCaret
ChangeMenuItemsEnabled
End With
If tb->cboClass.Items.Count < 2 Then
miForm->Enabled = False
miCodeAndForm->Enabled = False
tb->tbrTop.Buttons.Item("Form")->Enabled = False
tb->tbrTop.Buttons.Item("CodeAndForm")->Enabled = False
tb->tbrTop.Buttons.Item("Code")->Checked = True: tbrTop_ButtonClick tb->tbrTop, *tb->tbrTop.Buttons.Item("Code")
SetRightClosedStyle True, True
Else
SetRightClosedStyle False, False
miForm->Enabled = True
miCodeAndForm->Enabled = True
tb->tbrTop.Buttons.Item("Form")->Enabled = True
tb->tbrTop.Buttons.Item("CodeAndForm")->Enabled = True
tabRight.SelectedTabIndex = 0
End If
MoveCloseButtons ptabCode
End If
tb->txtCode.SetFocus
ptabCode->UpdateUnLock
ptabCode->Update
Return tb
Exit Function
ErrorHandler:
MsgBox ErrDescription(Err) & " (" & Err & ") " & _
"in line " & Erl() & " " & _
"in function " & ZGet(Erfn()) & " " & _
"in module " & ZGet(Ermn())
End Function
Sub m(ByRef MSG As WString, InDebug As Boolean = False)
If InDebug AndAlso Not DisplayWarningsInDebug Then Exit Sub
ShowMessages MSG
End Sub
Sub OnChangeEdit(ByRef Sender As Control)
Static CurLine As Integer, bChanged As Boolean
Var tb = Cast(TabWindow Ptr, Sender.Tag)
If tb = 0 Then Exit Sub
tb->Modified = True
TextChanged = True
' 'Exit Sub
' With tb->txtCode
' If Not .Focused Then Exit Sub
' tb->FormDesign tb->tbrTop.Buttons.Item(1)->Checked
' End With
End Sub
'Declare Function get_var_value(VarName As String, LineIndex As Integer) As String
Sub OnMouseMoveEdit(ByRef Sender As Control, MouseButton As Integer, x As Integer, y As Integer, Shift As Integer)
' Var tb = Cast(TabWindow Ptr, Sender.Tag)
' If tb = 0 Then Exit Sub
' #ifndef __USE_GTK__
' Dim ByRef As HWND hwndTT = tb->txtCode.ToolTipHandle
' If hwndTT <> 0 Then
' Dim As TOOLINFO ti
' ZeroMemory(@ti, SizeOf(ti))
' ti.cbSize = SizeOf(ti)
' ti.hwnd = tb->txtCode.Handle
' SendMessage(hwndTT, TTM_GETTOOLINFO, 0, CInt(@ti))
' SendMessage(hwndTT, TTM_TRACKACTIVATE, False, Cast(LPARAM, @ti))
' End If
' #endif
End Sub
Sub OnMouseHoverEdit(ByRef Sender As Control, MouseButton As Integer, x As Integer, y As Integer, Shift As Integer)
#ifndef __USE_GTK__
If Not InDebug AndAlso Timer - MouseHoverTimerVal <= 4 Then Exit Sub
Static As Integer OldY, OldX
MouseHoverTimerVal = Timer
Var tb = Cast(TabWindow Ptr, Sender.Tag)
If tb = 0 OrElse tb->txtCode.LinesCount < 1 Then Exit Sub
If tb->txtCode.DropDownShowed Then Exit Sub
If tb->txtCode.ToolTipShowed And CBool((Abs(OldY - y) > 20 OrElse Abs(OldX - x) > 50)) Then
tb->txtCode.CloseToolTip
Exit Sub
End If
OldY = y: OldX = x
Dim As String sWord = tb->txtCode.GetWordAtPoint(UnScaleX(x), UnScaleY(y), True)
If sWord <> "" Then
' If Not InDebug Then
' Dim As Integer iSelEndLine, iSelEndChar
' iSelEndLine = tb->txtCode.LineIndexFromPoint(UnScaleX(X), UnScaleY(Y))
' iSelEndChar = tb->txtCode.CharIndexFromPoint(UnScaleX(X), UnScaleY(Y))
' tb->txtCode.SetSelection(iSelEndLine, iSelEndLine, iSelEndChar, iSelEndChar)
' OnKeyPressEdit(tb->txtCode, 5)
' Exit Sub
' End If
Dim As WString * 250 Value
If InDebug Then Value = get_var_value(sWord, tb->txtCode.LineIndexFromPoint(x, y)) Else Exit Sub
If Value <> "" Then
Dim ByRef As HWND hwndTT = tb->ToolTipHandle
Dim As TOOLINFO ti
ZeroMemory(@ti, SizeOf(ti))
ti.cbSize = SizeOf(ti)
ti.hwnd = tb->txtCode.Handle
'ti.uId = Cast(UINT, FHandle)
If hwndTT = 0 Then
hwndTT = CreateWindow(TOOLTIPS_CLASS, "", WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, Cast(HMENU, NULL), GetModuleHandle(NULL), NULL)
ti.uFlags = TTF_IDISHWND Or TTF_TRACK Or TTF_ABSOLUTE Or TTF_PARSELINKS Or TTF_TRANSPARENT
ti.hinst = GetModuleHandle(NULL)
ti.lpszText = @Value
'SendMessage(hwndTT, TTM_SETDELAYTIME, TTDT_INITIAL, 100)
SendMessage(hwndTT, TTM_ADDTOOL, 0, Cast(LPARAM, @ti))
Else
SendMessage(hwndTT, TTM_GETTOOLINFO, 0, CInt(@ti))
ti.lpszText = @Value
SendMessage(hwndTT, TTM_UPDATETIPTEXT, 0, CInt(@ti))
End If
Dim As Point Pt
Pt.X = x
Pt.Y = y
ClientToScreen tb->txtCode.Handle, @Pt
SendMessage(hwndTT, TTM_TRACKPOSITION, 0, MAKELPARAM(Pt.X, Pt.Y + 10))
SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, 1000)
SendMessage(hwndTT, TTM_TRACKACTIVATE, True, Cast(LPARAM, @ti))
tb->ToolTipHandle = hwndTT
Exit Sub
End If
End If
Dim ByRef As HWND hwndTT = tb->ToolTipHandle
If hwndTT <> 0 Then
Dim As TOOLINFO ti
ZeroMemory(@ti, SizeOf(ti))
ti.cbSize = SizeOf(ti)
ti.hwnd = tb->txtCode.Handle
SendMessage(hwndTT, TTM_GETTOOLINFO, 0, CInt(@ti))
SendMessage(hwndTT, TTM_TRACKACTIVATE, False, Cast(LPARAM, @ti))
End If
#endif
End Sub
Function IsLabel(ByRef LeftA As WString) As Boolean
Dim strLeftA As String = Trim(LeftA, Any !"\t ")
If EndsWith(strLeftA, ":") Then
strLeftA = LCase(..Left(strLeftA, Len(strLeftA) - 1))
Dim t As Integer
If InStr("," & SingleConstructions & ",", "," & strLeftA & ",") > 0 Then Return False
For i As Integer = 1 To Len(strLeftA)
t = Asc(Mid(strLeftA, i, 1))
If t >= 48 And t <= 57 Or t >= 65 And t <= 90 Or t >= 97 And t <= 122 Or t = Asc("_") Then
Else: Return False
End If
Next
Return True
Else
Return False
End If
End Function
Property TabWindow.Modified As Boolean
Return txtCode.Modified
End Property
Property TabWindow.Modified(Value As Boolean)
If Value Then
If Not EndsWith(Caption, "*") Then
Caption = Caption + "*"
MoveCloseButtons Cast(TabControl Ptr, This.Parent)
End If
Else
If EndsWith(Caption, "*") Then
Caption = ..Left(Caption, Len(Caption) - 1)
End If
End If
txtCode.Modified = Value
End Property
'Function Likes(a As String, ContructionPart As String) As Boolean
' Dim m As Variant, k As Long
' m = Split(ContructionPart, ",")
' For k = 0 To UBound(m)
' If LCase(Trim(a)) Like LCase(m(k)) Then
' Likes = True
' Exit Function
' End If
' Next k
'End Function
'
'Function GetLikeConstruction(a As String, Optional k As Integer = 0, Optional e As Integer = 0) As Long
' Dim i As Long
' GetLikeConstruction = -1
' If a = "" Then Exit Function
' For i = 0 To 12
' If Likes(a, Constructions(i, 0)) And Not Likes(a, Constructions(i, 3)) And k >= 0 Then
' GetLikeConstruction = i: e = 1
' Exit Function
' ElseIf Likes(a, Constructions(i, 1)) And k <= 0 Then
' GetLikeConstruction = i: e = 2
' Exit Function
' ElseIf Likes(a, Constructions(i, 2)) And k <= 1 Then
' GetLikeConstruction = i: e = 3
' Exit Function
' End If
' Next i
'End Function
'
Sub CloseButton_MouseUp(ByRef Sender As Control, MouseButton As Integer, x As Integer, y As Integer, Shift As Integer)
Dim tb As TabWindow Ptr = Cast(CloseButton Ptr, @Sender)->tbParent
If tb = 0 Then Exit Sub
CloseTab(tb)
End Sub
Sub CloseButton_MouseMove(ByRef Sender As Control, MouseButton As Integer, x As Integer, y As Integer, Shift As Integer)
Dim btn As CloseButton Ptr = Cast(CloseButton Ptr, @Sender)
If btn= 0 OrElse btn->BackColor = clRed Then Exit Sub
#ifndef __USE_GTK__
btn->BackColor = clRed
btn->Font.Color = clWhite
#endif
btn->MouseIn = True
'DeAllocate btn
End Sub
Sub CloseButton_MouseLeave(ByRef Sender As Control)
Dim btn As CloseButton Ptr = Cast(CloseButton Ptr, @Sender)
If btn= 0 Then Exit Sub
#ifndef __USE_GTK__
btn->BackColor = btn->OldBackColor
btn->Font.Color = btn->OldForeColor
#endif
btn->MouseIn = False
End Sub
#ifdef __USE_GTK__
Function CloseButton_OnDraw(widget As GtkWidget Ptr, cr As cairo_t Ptr, data1 As gpointer) As Boolean
Dim As CloseButton Ptr cb = Cast(Any Ptr, data1)
#ifdef __FB_WIN32__
cairo_select_font_face(cr, "Courier", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD)
#else
cairo_select_font_face(cr, "Noto Mono", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD)
#endif
cairo_set_font_size(cr, 11)
#ifdef __USE_GTK3__
Var width1 = gtk_widget_get_allocated_width (widget)
Var height1 = gtk_widget_get_allocated_height (widget)
#else
Var width1 = widget->allocation.width
Var height1 = widget->allocation.height
#endif
If cb->MouseIn Then
cairo_rectangle(cr, width1 - 16, (height1 - 16) / 2, 16, 16)
cairo_set_source_rgb(cr, 1.0, 0.0, 0.0)
cairo_fill (cr)
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0)
Else
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0)
End If
Dim As PangoRectangle extend
pango_layout_set_text(cb->layout, ToUtf8("×"), Len(ToUtf8("×")))
pango_cairo_update_layout(cr, cb->layout)
#ifdef pango_version
Dim As PangoLayoutLine Ptr pl = pango_layout_get_line_readonly(cb->layout, 0)
#else
Dim As PangoLayoutLine Ptr pl = pango_layout_get_line(cb->layout, 0)
#endif
pango_layout_line_get_pixel_extents(pl, NULL, @extend)
cairo_move_to(cr, width1 - 16 + (16 - extend.width) / 2, (height1 - extend.height) / 2 + extend.height - 3)
pango_cairo_show_layout_line(cr, pl)
Return False
End Function
Function CloseButton_OnExposeEvent(widget As GtkWidget Ptr, Event As GdkEventExpose Ptr, data1 As gpointer) As Boolean
Dim As cairo_t Ptr cr = gdk_cairo_create(Event->window)
CloseButton_OnDraw(widget, cr, data1)
cairo_destroy(cr)
Return False
End Function
#endif
Constructor CloseButton
Base.OnMouseUp = @CloseButton_MouseUp
OnMouseMove = @CloseButton_MouseMove
OnMouseLeave = @CloseButton_MouseLeave
OldBackColor = This.BackColor
OldForeColor = This.Font.Color
#ifdef __USE_GTK__
#ifdef __USE_GTK3__
g_signal_connect(widget, "draw", G_CALLBACK(@CloseButton_OnDraw), @This)
#else
g_signal_connect(widget, "expose-event", G_CALLBACK(@CloseButton_OnExposeEvent), @This)
#endif
This.Width = 20
This.Height = 20
Dim As PangoContext Ptr pcontext
pcontext = gtk_widget_create_pango_context(widget)
layout = pango_layout_new(pcontext)
Dim As PangoFontDescription Ptr desc
#ifdef __FB_WIN32__
desc = pango_font_description_from_string ("Courier 11")
#else
desc = pango_font_description_from_string ("Noto Mono 11")
#endif
pango_layout_set_font_description (layout, desc)
pango_font_description_free (desc)
#else
This.Alignment = taCenter
Caption = "×"
#endif
'SubClass = True
End Constructor
Destructor CloseButton
End Destructor
Property TabWindow.Caption ByRef As WString
Return WGet(FCaptionNew)
End Property
Property TabWindow.Caption(ByRef Value As WString)
FCaptionNew = Reallocate_(FCaptionNew, (Len(Value) + 1) * SizeOf(WString))
*FCaptionNew = Value
#ifdef __USE_GTK__
Base.Caption = Value
#else
Base.Caption = Value + Space(5)
#endif
End Property
Property TabWindow.FileName ByRef As WString
If WGet(FFileName) = "" Then
Return ML("Untitled")
Else
Return WGet(FFileName)
End If
End Property
Property TabWindow.FileName(ByRef Value As WString)
wLet(FFileName, Value)
End Property
Operator TabWindow.Cast As TabPage Ptr
Return Cast(TabPage Ptr, @This)
End Operator
Function TabWindow.SaveTab As Boolean
' It is important to creat a backup file by time.
'If txtCode.Modified = True Then
If AutoCreateBakFiles Then
FileCopy *FFileName, Str(GetBakFileName(*FFileName)) '
End If
txtCode.SaveToFile(*FFileName, FileEncoding, NewLineType) ', False
Modified = False
#ifndef __USE_GTK__
DateFileTime = GetFileLastWriteTime(*FFileName)
#endif
Var FileIndex = IncludeFiles.IndexOf(FileName)
If FileIndex <> 0 Then
MutexLock tlockSave
Dim As TypeElement Ptr te, te1
For i As Integer = pGlobalNamespaces->Count - 1 To 0 Step -1
te = pGlobalNamespaces->Object(i)
For j As Integer = te->Elements.Count - 1 To 0 Step -1
te1 = te->Elements.Object(j)
If te1->FileName = *FFileName Then
te->Elements.Remove j
End If
Next
Next
For i As Integer = pGlobalNamespaces->Count - 1 To 0 Step -1
te = pGlobalNamespaces->Object(i)
If te->FileName = FileName Then
te->Elements.Clear
Delete_(Cast(TypeElement Ptr, pGlobalNamespaces->Object(i)))
pGlobalNamespaces->Remove i
End If
Next
For i As Integer = pGlobalTypes->Count - 1 To 0 Step -1
te = pGlobalTypes->Object(i)
If te->FileName = FileName Then
For j As Integer = te->Elements.Count - 1 To 0 Step -1
Delete_(Cast(TypeElement Ptr, te->Elements.Object(j)))
Next
te->Elements.Clear
Delete_(Cast(TypeElement Ptr, pGlobalTypes->Object(i)))
pGlobalTypes->Remove i
Else
For j As Integer = te->Elements.Count - 1 To 0 Step -1
te1 = te->Elements.Object(j)
If te1->FileName = FileName Then
Delete_(Cast(TypeElement Ptr, te->Elements.Object(j)))
te->Elements.Remove j
End If
Next
End If
Next
For i As Integer = pComps->Count - 1 To 0 Step -1
te = pComps->Object(i)
If te->FileName = FileName Then
For j As Integer = te->Elements.Count - 1 To 0 Step -1
Delete_(Cast(TypeElement Ptr, te->Elements.Object(j)))
Next
te->Elements.Clear
Delete_(Cast(TypeElement Ptr, pComps->Object(i)))
pComps->Remove i
Else
For j As Integer = te->Elements.Count - 1 To 0 Step -1
te1 = te->Elements.Object(j)
If te1->FileName = FileName Then
Delete_(Cast(TypeElement Ptr, te->Elements.Object(j)))
te->Elements.Remove j
End If
Next
End If
Next
For i As Integer = pGlobalEnums->Count - 1 To 0 Step -1
te = pGlobalEnums->Object(i)
If te->FileName = FileName Then
For j As Integer = te->Elements.Count - 1 To 0 Step -1
Delete_(Cast(TypeElement Ptr, te->Elements.Object(j)))
Next
te->Elements.Clear
Delete_(Cast(TypeElement Ptr, pGlobalEnums->Object(i)))
pGlobalEnums->Remove i
End If
Next
For i As Integer = pGlobalFunctions->Count - 1 To 0 Step -1
te = pGlobalFunctions->Object(i)
If te->FileName = FileName Then
Delete_(Cast(TypeElement Ptr, pGlobalFunctions->Object(i)))
pGlobalFunctions->Remove i
End If
Next
For i As Integer = pGlobalArgs->Count - 1 To 0 Step -1
te = pGlobalArgs->Object(i)
If te->FileName = FileName Then
Delete_(Cast(TypeElement Ptr, pGlobalArgs->Object(i)))
pGlobalArgs->Remove i
End If
Next
If Not pLoadPaths->Contains(FileName) Then
pLoadPaths->Add FileName
End If
'LoadFunctions FileName, LoadParam.OnlyFilePathOverwrite, GlobalTypes, GlobalEnums, GlobalFunctions, GlobalArgs
MutexUnlock tlockSave
ThreadCounter(ThreadCreate_(@LoadOnlyFilePathOverwrite, @pLoadPaths->Item(pLoadPaths->IndexOf(FileName))))
End If
Return True
End Function
Function TabWindow.SaveAs As Boolean
SetSaveDialogParameters(FileName)
If pSaveD->Execute Then
WLet(LastOpenPath, GetFolderName(pSaveD->FileName))
If FileExists(pSaveD->FileName) Then
Select Case MsgBox(ML("Want to replace the file") & " """ & pSaveD->FileName & """?", App.Title, mtWarning, btYesNoCancel)
Case mrCancel: Return False
Case mrNo: Return SaveAs
End Select
End If
Caption = GetFileName(pSaveD->FileName)
tn->Text = Caption
mi->Caption = Caption
WLet(FFileName, pSaveD->FileName)
CheckExtension *FFileName
Dim As ExplorerElement Ptr ee = tn->Tag
Dim As TreeNode Ptr ptn = GetParentNode(tn)
If ee = 0 Then
ee = New_( ExplorerElement)
tn->Tag = ee
End If
If ptn <> 0 AndAlso ptn->ImageKey = "Project" Then
Dim As ProjectElement Ptr pee = ptn->Tag
If pee <> 0 Then
If WGet(pee->MainFileName) = WGet(ee->FileName) Then WLet(pee->MainFileName, pSaveD->FileName)
If WGet(pee->ResourceFileName) = WGet(ee->FileName) Then WLet(pee->ResourceFileName, pSaveD->FileName)
If WGet(pee->IconResourceFileName) = WGet(ee->FileName) Then WLet(pee->IconResourceFileName, pSaveD->FileName)
If Not EndsWith(ptn->Text, "*") Then ptn->Text & = "*"
End If
End If
WLet(ee->FileName, pSaveD->FileName)
AddMRUFile pSaveD->FileName
Return SaveTab
End If
Return False
End Function
Function TabWindow.Save As Boolean
If InStr(*FFileName, "/") > 0 OrElse InStr(*FFileName, "\") > 0 Then Return SaveTab Else Return SaveAs
End Function
Function CloseTab(ByRef tb As TabWindow Ptr, WithoutMessage As Boolean = False) As Boolean
If tb = 0 Then Return False
Dim As TabControl Ptr pParentTabCode = tb->Parent
If tb->CloseTab(WithoutMessage) Then
ChangeMenuItemsEnabled
If pfMenuEditor->tb = tb Then pfMenuEditor->CloseForm
If pfImageListEditor->tb = tb Then pfImageListEditor->CloseForm
Delete_(tb)
If pParentTabCode->TabCount = 0 Then
Dim As TabPanel Ptr ptabPanelParent = Cast(TabPanel Ptr, pParentTabCode->Parent)
Var Idx = ptabPanelParent->IndexOf(pParentTabCode)
If Idx >= 2 Then
Dim As TabPanel Ptr ptabPanelChild = Cast(TabPanel Ptr, ptabPanelParent->Controls[Idx - 2])
ptabPanelChild->Align = DockStyle.alClient
ptabPanelParent->Remove ptabPanelParent->Controls[Idx - 1]
pParentTabCode->Visible = False
ptabCode = @ptabPanelChild->tabCode
mnuTabs.ParentWindow = ptabCode
ptabPanelParent->RequestAlign
Else
Var ptabPanel = ptabPanelParent
Do While *ptabPanel->Parent Is TabPanel
Dim As TabPanel Ptr ptabPanelParent = Cast(TabPanel Ptr, ptabPanel->Parent)
Var Idx = ptabPanelParent->IndexOf(ptabPanel)
If Idx >= 2 AndAlso ptabPanel->Align = DockStyle.alClient Then
Dim As TabPanel Ptr ptabPanelChild = Cast(TabPanel Ptr, ptabPanelParent->Controls[Idx - 2])
ptabPanelChild->Align = DockStyle.alClient
ptabPanelParent->Remove ptabPanelParent->Controls[Idx - 1]
ptabPanelParent->Remove ptabPanel
TabPanels.Remove TabPanels.IndexOf(ptabPanel)
Delete_(ptabPanel)
ptabPanelParent->RequestAlign
ptabCode = @ptabPanelChild->tabCode
mnuTabs.ParentWindow = ptabCode
ptabPanel = 0
Exit Do
ElseIf ptabPanel->Align <> DockStyle.alClient Then
If ptabPanelParent->tabCode.Visible Then
ptabCode = @ptabPanelParent->tabCode
Else
ptabCode = @Cast(TabPanel Ptr, ptabPanelParent->Controls[Idx + 2])->tabCode
End If
mnuTabs.ParentWindow = ptabCode
ptabPanelParent->Remove ptabPanelParent->Controls[Idx + 1]
ptabPanelParent->Remove ptabPanel
TabPanels.Remove TabPanels.IndexOf(ptabPanel)
Delete_(ptabPanel)
ptabPanelParent->RequestAlign
ptabPanel = 0
Exit Do
Else
ptabPanelParent->Remove ptabPanel
TabPanels.Remove TabPanels.IndexOf(ptabPanel)
Delete_(ptabPanel)
ptabPanel = ptabPanelParent
End If
Loop
If ptabPanel > 0 AndAlso ptabPanel->Parent = pfrmMain Then
ptabPanel->tabCode.Visible = True
ptabCode = @ptabPanel->tabCode
mnuTabs.ParentWindow = ptabCode
End If
End If
End If
Return True
Else
Return False
End If
End Function
Function TabWindow.CloseTab(WithoutMessage As Boolean = False) As Boolean
If txtCode.Modified AndAlso Not WithoutMessage Then
Select Case MsgBox(ML("Want to save the file") & " """ & Caption & """?", "Visual FB Editor", mtWarning, btYesNoCancel)
Case mrYes: Save
Case mrNo:
Case mrCancel: Return False
End Select
End If