-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfrmObjectsP.vb
2390 lines (1846 loc) · 76.9 KB
/
frmObjectsP.vb
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
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Imports FSUIPC
Friend Class FrmObjectsP
'Dim LatAircraft As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H560)
'Dim LonAircraft As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H568)
'Dim AltAircraft As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H568)
'Dim PitchAircraft As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H568)
'Dim BankAircraft As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H568)
'Dim HeadingAircraft As Offset(Of Long) = New FSUIPC.Offset(Of Long)(&H568)
Private Mode As String ' One or Many or RGN
Private IsReady As Boolean 'to sign that combox can start!
Private IsInit As Boolean = True ' to sign that opt controls should do nothing
'Private ListObj1 As Integer
'Private ListObj2 As Integer
Private Sub CmbLibCat_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbLibCat.SelectedIndexChanged
Dim K As Integer
Dim a, LibCat As String
If Not IsReady Then Exit Sub
'first remove all listings
lstLib.Items.Clear()
' get the category index
K = cmbLibCat.SelectedIndex + 1
Dim g
For Each g In LibCategories(K).Objs
lstLib.Items.Add(g.Name)
Next
If LibCategories(K).Objs.Count = 0 Then
txtLibWidth.Text = ""
txtLibLength.Text = ""
txtLibScale.Text = ""
txtLibName.Text = ""
cmdUpDefault.Enabled = False
txtLibID.Text = ""
txtComment.Text = ""
a = My.Application.Info.DirectoryPath & "\tools\bmps\na.jpg"
imgLib.Image = System.Drawing.Image.FromFile(a)
ImageFileName = a
Exit Sub
End If
LibCat = LibCategories(K).Name
Dim myLibObj As LibObject = LibCategories(K).Objs(0)
lstLib.SelectedIndex = 0
txtLibID.Text = myLibObj.ID
txtLibWidth.Text = CStr(myLibObj.Width)
txtLibLength.Text = CStr(myLibObj.Length)
txtLibScale.Text = CStr(myLibObj.Scaling)
txtLibName.Text = myLibObj.Name
cmdUpDefault.Enabled = False
' after 205
txtComment.Text = myLibObj.Name
ObjLibType = CInt(myLibObj.Type)
If ObjLibType = 0 Then
labelFS.Text = "Old FS8 Library Object"
ElseIf ObjLibType = 1 Then
labelFS.Text = "Old FS9 Library Object"
ElseIf ObjLibType = 2 Then
labelFS.Text = "New FSX Library Object"
End If
cmdUpDefault.Enabled = False
a = LibObjectsPath & "\" & LibCat & "\" & txtLibID.Text & ".jpg"
ImageFileNameTrue = a
If Not File.Exists(a) Then
a = My.Application.Info.DirectoryPath & "\tools\bmps\na.jpg"
End If
Dim fs As New System.IO.FileStream(a, IO.FileMode.Open, IO.FileAccess.Read)
'imgLib.Image = System.Drawing.Image.FromFile(a)
imgLib.Image = Image.FromStream(fs)
fs.Close()
ImageFileName = a
End Sub
Private Sub CmbMacroCat_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbMacroCat.SelectedIndexChanged
Dim N, K As Integer
If Not IsReady Then Exit Sub
' first remove all listings
N = lstMacro.Items.Count
For K = N To 1 Step -1
lstMacro.Items.RemoveAt(K - 1)
Next K
' get the category index
K = cmbMacroCat.SelectedIndex + 1
For N = 1 To MacroCategories(K).NOB
lstMacro.Items.Add(MacroCategories(K).MacroObjects(N).Name)
Next N
lstMacro.SelectedIndex = 0
ShowMacro(K, 1)
MacroID = MacroCategories(K).MacroObjects(1).File
IsReady = True
End Sub
Private Sub CmbRwy12Cat_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbRwy12Cat.SelectedIndexChanged
Dim N, K As Integer
Dim a As String
If Not IsReady Then Exit Sub
' first remove all listings
N = lstRwy12.Items.Count
For K = N To 1 Step -1
lstRwy12.Items.RemoveAt(K - 1)
Next K
' get the category index
K = cmbRwy12Cat.SelectedIndex + 1
For N = 1 To Rwy12Categories(K).NOB
lstRwy12.Items.Add(Rwy12Categories(K).Rwy12Objects(N).Name)
Next N
lstRwy12.SelectedIndex = 0
txtRwy12ID.Text = Rwy12Categories(K).Rwy12Objects(1).ID
txtRwy12Width.Text = CStr(100)
txtRwy12Length.Text = CStr(100)
txtRwy12Scale.Text = CStr(1)
a = Rwy12Path & "\img\" & Rwy12Categories(K).Rwy12Objects(1).Texture
ImageFileNameTrue = a
If Not File.Exists(a) Then
a = My.Application.Info.DirectoryPath & "\tools\bmps\na.jpg"
End If
Dim fs As New System.IO.FileStream(a, IO.FileMode.Open, IO.FileAccess.Read)
'imgRwy12.Image = System.Drawing.Image.FromFile(a)
imgRwy12.Image = Image.FromStream(fs)
fs.Close()
ImageFileName = a
End Sub
Private Sub CmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdCancel.Click
Dispose()
End Sub
Private Sub CmdExpand_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdExpand.Click
FrmExtraMacro.ShowDialog()
End Sub
Private Sub CmdMacroEdit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdMacroEdit.Click
Dim N, K As Integer
Dim a, b As String
'On Error Resume Next
N = lstMacro.SelectedIndex + 1
K = cmbMacroCat.SelectedIndex + 1
b = MacroCategories(K).MacroObjects(N).File
a = VB.Right(b, 3)
If a = "API" Then a = MacroAPIPath & "\"
If a = "SCM" Then a = MacroASDPath & "\"
ChDir(a)
b = a & b
a = "notepad.exe " & b
N = ExecCmd(a)
End Sub
Private Sub SetObjectProperties(ByVal N As Integer)
Dim Macro As String
On Error GoTo erro
' insert here checking of values
Objects(N).Width = 10
Objects(N).Length = 10
Objects(N).Heading = CSng(txtHeading.Text)
Objects(N).Pitch = CSng(txtPitch.Text)
Objects(N).Bank = CSng(txtBank.Text)
Objects(N).BiasX = CSng(txtBiasX.Text)
Objects(N).BiasY = CSng(txtBiasY.Text)
Objects(N).BiasZ = CSng(txtBiasZ.Text)
Objects(N).Altitude = CSng(txtAltitude.Text)
Objects(N).AGL = ckAGL.CheckState
If opVSparse.Checked Then Objects(N).Complexity = 0
If opSparse.Checked Then Objects(N).Complexity = 1
If opNormal.Checked Then Objects(N).Complexity = 2
If opDense.Checked Then Objects(N).Complexity = 3
If opVDense.Checked Then Objects(N).Complexity = 4
If opEDense.Checked Then Objects(N).Complexity = 5
If optLib.Checked Then
If ObjLibType = 0 Then
Objects(N).Type = 1
ElseIf ObjLibType = 1 Then
Objects(N).Type = 2
ElseIf ObjLibType = 2 Then
Objects(N).Type = 0
End If
ObjLibID = txtLibID.Text
ObjLibScale = CSng(txtLibScale.Text)
ObjLibV1 = CSng(txtV1.Text)
ObjLibV2 = CSng(txtV2.Text)
Objects(N).Width = CSng(txtLibWidth.Text)
Objects(N).Length = CSng(txtLibLength.Text)
End If
If optRwy12.Checked Then
Objects(N).Type = 3
ObjLibID = txtRwy12ID.Text
ObjLibScale = CSng(txtRwy12Scale.Text)
Objects(N).Width = CSng(txtRwy12Width.Text)
Objects(N).Length = CSng(txtRwy12Length.Text)
End If
Macro = ""
If optMacro.Checked Then
If VB.Right(MacroID, 3) = "API" Then Macro = "API"
If VB.Right(MacroID, 3) = "SCM" Then Macro = "ASD"
End If
If Macro = "API" Then
Objects(N).Type = 4
Objects(N).Width = CSng(txtMacroWidth.Text)
Objects(N).Length = CSng(txtMacroLength.Text)
MacroScale = CSng(txtMacroScale.Text)
MacroRange = CInt(txtMacroRange.Text)
MacroVisibility = CSng(txtV1.Text)
MacroV2Value = CSng(txtV2.Text)
MacroP6Value = txtP6.Text
MacroP7Value = txtP7.Text
MacroP8Value = txtP8.Text
MacroP9Value = txtP9.Text
End If
If Macro = "ASD" Then
Objects(N).Type = 5
Objects(N).Width = CSng(txtMacroWidth.Text)
Objects(N).Length = CSng(txtMacroLength.Text)
MacroScale = CSng(txtMacroScale.Text)
MacroRange = CInt(txtMacroRange.Text)
MacroVisibility = CSng(txtV1.Text)
MacroP6Value = txtP6.Text
MacroP7Value = txtP7.Text
MacroP8Value = txtP8.Text
If lbP9.Visible Then MacroP9Value = txtP9.Text
End If
If optTaxiwaySign.Checked Then
Objects(N).Type = 8
ObjTaxSize = CInt(combTaxiwaySize.Text)
ObjTaxJust = combTaxiwayJustification.Text
ObjTaxLabel = txtTaxiwayText.Text
End If
If optEffect.Checked Then
Objects(N).Type = 16
ObjEffName = txtEffectName.Text
ObjEffParameters = txtEffectParameters.Text
End If
If optBeacon.Checked Then
Objects(N).Type = 32
ObjBeaCivil = 0
ObjBeaMil = 0
ObjBeaAirport = 0
ObjBeaHeliport = 0
ObjBeaSeaBase = 0
If optBeaconCivilian.Checked Then ObjBeaCivil = 1
If optBeaconMil.Checked Then ObjBeaMil = 1
If optBeaconAirport.Checked Then ObjBeaAirport = 1
If optBeaconSeaBase.Checked Then ObjBeaSeaBase = 1
If optBeaconHeliport.Checked Then ObjBeaHeliport = 1
End If
If optWindsock.Checked Then
Objects(N).Type = 64
ObjWinLight = 0
If ckWindsockLight.CheckState = 1 Then ObjWinLight = 1
ObjWinLength = CSng(txtWindsockLength.Text)
ObjWinHeight = CSng(txtWindsockHeight.Text)
ObjWindPoleColor = CInt(System.Drawing.ColorTranslator.ToOle(txtWindsockHeight.BackColor))
ObjWindSockColor = CInt(System.Drawing.ColorTranslator.ToOle(txtWindsockLength.BackColor))
End If
If optMDL.Checked Then
Objects(N).Width = CSng(txtMDLWidth.Text)
Objects(N).Length = CSng(txtMDLLength.Text)
ObjMDLFile = txtMDLFile.Text
ObjMDLGuid = labelMDLguid.Text
ObjMDLScale = Val(txtMDLscale.Text)
ObjMDLName = labelMDLName.Text
If Mid(ObjMDLGuid, 1, 1) = "{" Then
Objects(N).Type = 128 ' FSX type
Else
Objects(N).Type = 129 ' FS9 type
End If
End If
If optGenB.Checked Then
Objects(N).Width = CSng(nUPsizeX.Value)
Objects(N).Length = CSng(nUPsizeZ.Value)
If optGbFlat.Checked Then Objects(N).Type = 256
If optGbPeaked.Checked Then Objects(N).Type = 257
If optGbRidge.Checked Then Objects(N).Type = 258
If optGbSlant.Checked Then Objects(N).Type = 259
If optGbPyramidal.Checked Then Objects(N).Type = 260
If optGbMultiSided.Checked Then Objects(N).Type = 261
scale_gb = nUPscale.Value
End If
Exit Sub
erro:
MsgBox("Could not set object properties!", MsgBoxStyle.Exclamation)
End Sub
Private Sub CmdOK_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOK.Click
If optLib.Checked Then
If lstLib.SelectedIndex = -1 Then
Close() ' unknow so do nothing
Exit Sub
End If
End If
Dim N As Integer
Dirty = True
If Mode = "One" Then
N = POPIndex
If N > NoOfObjects Then
ReDim Preserve Objects(N)
NoOfObjects = NoOfObjects + 1
' added October 2017
BackUp()
End If
SetObjectProperties(N)
'IniObjType = Objects(N).Type
Objects(N).lat = Str2Lat(txtLat.Text)
Objects(N).lon = Str2Lon(txtLon.Text)
ObjComment = txtComment.Text
ObjComment = Replace(ObjComment, " ", "_")
Objects(N).Description = MakeDescription(N)
AddLatLonToObjects(N)
'ElseIf Mode = "RGN" Then
' SetRGNProperties()
' RGNPointType1 = MakeRGNPointType1
' RGNPointType2 = MakeRGNPointType2
ElseIf Mode = "Many" Then
For N = 1 To NoOfObjects
If Objects(N).Selected Then
'ObjComment = GetObjectName(N)
ObjComment = txtComment.Text
SetObjectProperties(N)
Objects(N).Description = MakeDescription(N)
AddLatLonToObjects(N)
End If
Next N
End If
RebuildDisplay()
' should I realy comment the following? October 2017
'Close()
Dispose()
End Sub
Private Sub CmdOption_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOption.Click
If optLib.Checked Then SSTab1.SelectedIndex = 1
If optGenB.Checked Then SSTab1.SelectedIndex = 2
If optMacro.Checked Then SSTab1.SelectedIndex = 3
If optRwy12.Checked Then SSTab1.SelectedIndex = 4
If optBeacon.Checked Then SSTab1.SelectedIndex = 5
If optTaxiwaySign.Checked Then SSTab1.SelectedIndex = 5
If optEffect.Checked Then SSTab1.SelectedIndex = 5
If optWindsock.Checked Then SSTab1.SelectedIndex = 5
If optMDL.Checked Then SSTab1.SelectedIndex = 5
End Sub
Private Sub CmdOrder_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOrder.Click
If NoOfObjects < 2 Then
MsgBox("At least 2 objects must exist!", MsgBoxStyle.Information)
Exit Sub
End If
ObjOrder = False
FrmOrder.ShowDialog()
If ObjOrder Then Dispose()
End Sub
Private Sub CmdPosFs_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPosFs.Click
Dim Bank, Altitude, Pitch, Heading As Single
Dim Lat, Lon As Double
Try
If AircraftVIEW Then ' this on May 25 2009
FSUIPCConnection.Close()
frmStart.UpdateAircraft(0)
frmStart.ShowAircraftMenuItem.Checked = False
AircraftVIEW = False
End If
FSUIPCConnection.Open()
FSUIPCConnection.Process()
Lat = CDbl(frmStart.LatAircraft.Value)
Lat = Lat * 90.0 / (10001750.0 * 65536.0 * 65536.0)
Lon = CDbl(frmStart.LonAircraft.Value)
Lon = Lon * 360.0 / (65536.0 * 65536.0 * 65536.0 * 65536.0)
Altitude = CSng(frmStart.Alt1Aircraft.Value)
Altitude = Altitude + CSng(frmStart.Alt2Aircraft.Value) / (65536.0! * 65536.0!)
Altitude = Altitude - AircraftAltitudeOffset
Bank = CSng(frmStart.BankAircraft.Value) * 360.0! / (65536.0! * 65536.0!)
Pitch = CSng(frmStart.PitchAircraft.Value) * 360.0! / (65536.0! * 65536.0!)
Heading = CSng(frmStart.HeadingAircraft.Value) * 360.0! / (65536.0! * 65536.0!)
If Heading < 0 Then Heading = Heading + 360
FSUIPCConnection.Close()
Catch ex As Exception
FSUIPCConnection.Close()
MsgBox("Error communicating with FSUIPC!", MsgBoxStyle.Information)
Exit Sub
End Try
txtLon.Text = Lon2Str(Lon)
txtLat.Text = Lat2Str(Lat)
txtAltitude.Text = Format(Altitude, "0.000")
txtBank.Text = Format(Bank, "0.000")
txtPitch.Text = Format(Pitch, "0.000")
txtHeading.Text = Format(Heading, "0.000")
End Sub
Private Sub CmdTaxiwayHelp_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdTaxiwayHelp.Click
FrmTaxSign.ShowDialog()
End Sub
Public Sub ShowForAllSelected()
Mode = "Many"
lbComment.Enabled = False
txtComment.Enabled = False
cmdOrder.Enabled = False
txtLat.Enabled = False
txtLon.Enabled = False
Label1.Enabled = False
Label2.Enabled = False
cmdPosFs.Enabled = False
' optLib_CheckedChanged(optLib, New System.EventArgs())
If Not LibObjectsIsOn Then optLib.Enabled = False
If Not Rwy12IsOn Then optRwy12.Enabled = False
If MacroAPIIsOn = False And MacroASDIsOn = False Then optMacro.Enabled = False
If LibObjectsIsOn Then FillLibList()
If Rwy12IsOn Then FillRwy12List()
If MacroAPIIsOn Then FillMacroList()
End Sub
Public Sub ShowObjectProperties(ByVal N As Integer)
Dim K As Integer
Dim a As String
IsReady = False
Mode = "One"
SSTab1.SelectedIndex = 0
'cmdOrder.Enabled = True
If N > NoOfObjects Then
cmdOrder.Enabled = False
End If
If Not LibObjectsIsOn Then optLib.Enabled = False
If Not Rwy12IsOn Then optRwy12.Enabled = False
If MacroAPIIsOn = False And MacroASDIsOn = False Then optMacro.Enabled = False
DisableAllTypes()
If N > NoOfObjects Then ' is a new object place with mouse
If ObjMYes Then
txtHeading.Text = CStr(ObjMHead)
ObjMYes = False
End If
txtLat.Text = Lat2Str(LatObj)
txtLon.Text = Lon2Str(LonObj)
If LibObjectsIsOn Then
optLib.Checked = True
SetEnableLib(True)
FillLibList()
SSTab1.SelectedIndex = 1
Else
optLib.Checked = False
SSTab1.SelectedIndex = 0
End If
'ShowIniObject()
Else ' it is an existing object >> show the properties
optLib.Checked = False
optMacro.Checked = False
optRwy12.Checked = False
optTaxiwaySign.Checked = False
optEffect.Checked = False
optBeacon.Checked = False
optWindsock.Checked = False
optMDL.Checked = False
optGenB.Checked = False
If Objects(N).Type = 0 Then
optLib.Checked = True
SetEnableLib(True)
a = Objects(N).Description
K = InStr(1, a, "|")
ObjLibID = Mid(a, 1, K - 1)
FillLibList()
ObjLibType = 2
AnalyseLibObject(N)
txtLibID.Text = ObjLibID
txtLibScale.Text = CStr(ObjLibScale)
txtLibWidth.Text = CStr(Objects(N).Width)
txtLibLength.Text = CStr(Objects(N).Length)
'cmdUpDefault.Enabled = True
txtV1.Text = "0"
txtV2.Text = "0"
SSTab1.SelectedIndex = 1
End If
If Objects(N).Type = 1 Then
optLib.Checked = True
SetEnableLib(True)
a = Objects(N).Description
K = InStr(1, a, "|")
ObjLibID = Mid(a, 1, K - 1)
FillLibList()
ObjLibType = 0
AnalyseLibObject(N)
txtLibID.Text = ObjLibID
txtLibScale.Text = CStr(ObjLibScale)
txtLibWidth.Text = CStr(Objects(N).Width)
txtLibLength.Text = CStr(Objects(N).Length)
'cmdUpDefault.Enabled = True
txtV1.Text = CStr(ObjLibV1)
txtV2.Text = CStr(ObjLibV2)
SSTab1.SelectedIndex = 1
End If
If Objects(N).Type = 2 Then
optLib.Checked = True
SetEnableLib(True)
a = Objects(N).Description
K = InStr(1, a, "|")
ObjLibID = Mid(a, 1, K - 1)
FillLibList()
ObjLibType = 1
AnalyseLibObject(N)
txtLibID.Text = ObjLibID
txtLibScale.Text = CStr(ObjLibScale)
txtLibWidth.Text = CStr(Objects(N).Width)
txtLibLength.Text = CStr(Objects(N).Length)
'cmdUpDefault.Enabled = True
txtV1.Text = "0"
txtV2.Text = "0"
SSTab1.SelectedIndex = 1
End If
If Objects(N).Type = 3 Then
If Rwy12IsOn Then
optRwy12.Checked = True
SetEnableRwy12(True)
a = Objects(N).Description
K = InStr(1, a, "|")
ObjLibID = Mid(a, 1, K - 1)
FillRwy12List()
ObjLibType = 1
AnalyseLibObject(N)
txtRwy12ID.Text = ObjLibID
txtRwy12Scale.Text = CStr(ObjLibScale)
txtRwy12Width.Text = CStr(Objects(N).Width)
txtRwy12Length.Text = CStr(Objects(N).Length)
SSTab1.SelectedIndex = 4
Else
MsgBox("You can not edit this object as a Rwy12 object!", MsgBoxStyle.Exclamation)
optLib.Checked = True
SetEnableLib(True)
a = Objects(N).Description
K = InStr(1, a, "|")
ObjLibID = Mid(a, 1, K - 1)
FillLibList()
ObjLibType = 1
AnalyseLibObject(N)
txtLibID.Text = ObjLibID
txtLibScale.Text = CStr(ObjLibScale)
txtLibWidth.Text = CStr(Objects(N).Width)
txtLibLength.Text = CStr(Objects(N).Length)
'cmdUpDefault.Enabled = True
SSTab1.SelectedIndex = 1
End If
End If
If Objects(N).Type = 4 Then
If MacroAPIIsOn Then
optMacro.Checked = True
SetEnableMacro(True)
a = Objects(N).Description
K = InStr(1, a, "|")
MacroID = Mid(a, 1, K - 1)
FillMacroList() ' uses MacroID
AnalyseAPIMacro(N)
txtMacroScale.Text = CStr(MacroScale)
txtMacroRange.Text = CStr(MacroRange)
txtMacroWidth.Text = CStr(Objects(N).Width)
txtMacroLength.Text = CStr(Objects(N).Length)
txtV1.Text = CStr(MacroVisibility)
txtV2.Text = CStr(MacroV2Value)
txtP6.Text = MacroP6Value
txtP7.Text = MacroP7Value
txtP8.Text = MacroP8Value
txtP9.Text = MacroP9Value
SSTab1.SelectedIndex = 3
Else
MsgBox("You can not edit this object as an API macro!", MsgBoxStyle.Exclamation)
End If
End If
If Objects(N).Type = 5 Then
If MacroASDIsOn Then
optMacro.Checked = True
SetEnableMacro(True)
a = Objects(N).Description
K = InStr(1, a, "|")
MacroID = Mid(a, 1, K - 1)
FillMacroList() ' uses MacroID
AnalyseASDMacro(N)
txtMacroScale.Text = CStr(MacroScale)
txtMacroRange.Text = CStr(MacroRange)
txtMacroWidth.Text = CStr(Objects(N).Width)
txtMacroLength.Text = CStr(Objects(N).Length)
txtV1.Text = CStr(MacroVisibility)
txtP6.Text = MacroP6Value
txtP7.Text = MacroP7Value
txtP8.Text = MacroP8Value
txtP9.Text = MacroP9Value
SSTab1.SelectedIndex = 3
Else
MsgBox("You can not edit this object as an ASD macro!", MsgBoxStyle.Exclamation)
End If
End If
If Objects(N).Type = 8 Then
optTaxiwaySign.Checked = True
SetEnableTaxiway(True)
AnalyseTaxiwayObject(N)
txtTaxiwayText.Text = ObjTaxLabel
combTaxiwaySize.Text = CStr(ObjTaxSize)
combTaxiwayJustification.Text = ObjTaxJust
SSTab1.SelectedIndex = 5
End If
If Objects(N).Type = 16 Then
optEffect.Checked = True
SetEnableEffect(True)
AnalyseEffectObject(N)
txtEffectName.Text = ObjEffName
txtEffectParameters.Text = ObjEffParameters
SSTab1.SelectedIndex = 5
End If
If Objects(N).Type = 32 Then
optBeacon.Checked = True
SetEnableBeacon(True)
AnalyseBeaconObject(N)
optBeaconCivilian.Checked = False
optBeaconMil.Checked = False
optBeaconAirport.Checked = False
optBeaconSeaBase.Checked = False
optBeaconHeliport.Checked = False
If ObjBeaCivil = 1 Then optBeaconCivilian.Checked = True
If ObjBeaMil = 1 Then optBeaconMil.Checked = True
If ObjBeaAirport = 1 Then optBeaconAirport.Checked = True
If ObjBeaSeaBase = 1 Then optBeaconSeaBase.Checked = True
If ObjBeaHeliport = 1 Then optBeaconHeliport.Checked = True
SSTab1.SelectedIndex = 5
End If
If Objects(N).Type = 64 Then
optWindsock.Checked = True
SetEnableWindSock(True)
AnalyseWindsockObject(N)
ckWindsockLight.CheckState = ObjWinLight
txtWindsockHeight.Text = CStr(ObjWinHeight)
txtWindsockLength.Text = CStr(ObjWinLength)
txtWindsockHeight.BackColor = System.Drawing.ColorTranslator.FromOle(ObjWindPoleColor)
txtWindsockLength.BackColor = System.Drawing.ColorTranslator.FromOle(ObjWindSockColor)
txtWindsockHeight.ForeColor = InvertColor(txtWindsockHeight.BackColor)
txtWindsockLength.ForeColor = InvertColor(txtWindsockLength.BackColor)
SSTab1.SelectedIndex = 5
End If
If Objects(N).Type = 128 Or Objects(N).Type = 129 Then
optMDL.Checked = True
SetEnableMDL(True)
AnalyseMDLObject(N)
txtMDLWidth.Text = CStr(Objects(N).Width)
txtMDLLength.Text = CStr(Objects(N).Length)
txtMDLFile.Text = ObjMDLFile
labelMDLName.Text = ObjMDLName
labelMDLguid.Text = ObjMDLGuid
txtMDLscale.Text = CStr(ObjMDLScale)
SSTab1.SelectedIndex = 5
End If
If Objects(N).Type > 255 Then
optGenB.Checked = True
If Objects(N).Type = 256 Then optGbFlat.Checked = True
If Objects(N).Type = 257 Then optGbPeaked.Checked = True
If Objects(N).Type = 258 Then optGbRidge.Checked = True
If Objects(N).Type = 259 Then optGbSlant.Checked = True
If Objects(N).Type = 260 Then optGbPyramidal.Checked = True
If Objects(N).Type = 261 Then optGbMultiSided.Checked = True
SetEnableGenB(True)
FillGenBList()
AnalyseGenBObject(N)
sizeX = Objects(N).Width
sizeZ = Objects(N).Length
nUPsizeX.Value = sizeX
nUPsizeZ.Value = sizeZ
nUPscale.Value = scale_gb
SSTab1.SelectedIndex = 2
End If
txtLat.Text = Lat2Str(Objects(N).lat)
txtLon.Text = Lon2Str(Objects(N).lon)
txtHeading.Text = CStr(Objects(N).Heading)
txtPitch.Text = CStr(Objects(N).Pitch)
txtBank.Text = CStr(Objects(N).Bank)
txtBiasX.Text = CStr(Objects(N).BiasX)
txtBiasY.Text = CStr(Objects(N).BiasY)
txtBiasZ.Text = CStr(Objects(N).BiasZ)
txtAltitude.Text = CStr(Objects(N).Altitude)
If Objects(N).Complexity = 0 Then opVSparse.Checked = True
If Objects(N).Complexity = 1 Then opSparse.Checked = True
If Objects(N).Complexity = 2 Then opNormal.Checked = True
If Objects(N).Complexity = 3 Then opDense.Checked = True
If Objects(N).Complexity = 4 Then opVDense.Checked = True
If Objects(N).Complexity = 5 Then opEDense.Checked = True
ckAGL.CheckState = Objects(N).AGL
txtComment.Text = ObjComment
End If
IsInit = False
IsReady = True
End Sub
Private Sub DisableAllTypes()
SetEnableBeacon(False)
SetEnableTaxiway(False)
SetEnableEffect(False)
SetEnableLib(False)
SetEnableWindSock(False)
SetEnableMacro(False)
SetEnableRwy12(False)
SetEnableMDL(False)
SetEnableGenB(False)
End Sub
Private Sub SetEnableRwy12(ByVal Flag As Boolean)
'frRwy12.Enabled = Flag
txtRwy12Width.Enabled = Flag
txtRwy12Length.Enabled = Flag
txtRwy12Scale.Enabled = Flag
LabelRwy12Length.Enabled = Flag
LabelRwy12Width.Enabled = Flag
LabelRwy12Scale.Enabled = Flag
labelRwy12Mouse.Enabled = Flag
LabelRwy121.Enabled = Flag
LabelRwy12Cat.Enabled = Flag
cmbRwy12Cat.Enabled = Flag
imgRwy12.Visible = Flag
lstRwy12.Enabled = Flag
txtRwy12ID.Enabled = Flag
End Sub
Private Sub SetEnableMacro(ByVal Flag As Boolean)
'frMacro.Enabled = Flag
'frMacro1.Enabled = Flag
lbP6.Enabled = Flag
lbP7.Enabled = Flag
lbP8.Enabled = Flag
lbP9.Enabled = Flag
txtP6.Enabled = Flag
txtP7.Enabled = Flag
txtP8.Enabled = Flag
txtP9.Enabled = Flag
txtMacroWidth.Enabled = Flag
txtMacroLength.Enabled = Flag
txtMacroRange.Enabled = Flag
txtMacroScale.Enabled = Flag
LabelMacroLength.Enabled = Flag
LabelMacroWidth.Enabled = Flag
LabelMacroScale.Enabled = Flag
LabelMacroRange.Enabled = Flag
LabelMacro1.Enabled = Flag
labelMacroMouse.Enabled = Flag
LabelMacroCat.Enabled = Flag
cmbMacroCat.Enabled = Flag
imgMacro.Visible = Flag
lstMacro.Enabled = Flag
cmdExpand.Visible = False
cmdMacroEdit.Enabled = Flag
End Sub
Private Sub SetEnableBeacon(ByVal Flag As Boolean)
'frBeaconType.Enabled = Flag
'frBeaconBase.Enabled = Flag
optBeaconCivilian.Enabled = Flag
optBeaconMil.Enabled = Flag
optBeaconAirport.Enabled = Flag
optBeaconHeliport.Enabled = Flag
optBeaconSeaBase.Enabled = Flag
End Sub
Private Sub SetEnableWindSock(ByVal Flag As Boolean)
'frWindsock.Enabled = Flag
txtWindsockLength.Enabled = Flag
txtWindsockHeight.Enabled = Flag
ckWindsockLight.Enabled = Flag
LabelWin1.Enabled = Flag
LabelWin2.Enabled = Flag
LabelWin3.Enabled = Flag
End Sub
Private Sub SetEnableTaxiway(ByVal Flag As Boolean)
'frTaxiway.Enabled = Flag
txtTaxiwayText.Enabled = Flag
combTaxiwaySize.Enabled = Flag
combTaxiwayJustification.Enabled = Flag
LabelTax1.Enabled = Flag
LabelTax2.Enabled = Flag
LabelTax3.Enabled = Flag
cmdTaxiwayHelp.Enabled = Flag
End Sub
Private Sub SetEnableEffect(ByVal Flag As Boolean)
'frEffect.Enabled = Flag
txtEffectName.Enabled = Flag
txtEffectParameters.Enabled = Flag
LabelEffect1.Enabled = Flag
LabelEffect2.Enabled = Flag
End Sub
Private Sub SetEnableMDL(ByVal Flag As Boolean)
'frMDL.Enabled = Flag
txtMDLWidth.Enabled = Flag
txtMDLLength.Enabled = Flag
txtMDLFile.Enabled = Flag
LabelMDL1.Enabled = Flag
LabelMDL2.Enabled = Flag
LabelMDL3.Enabled = Flag
labelMDLguid.Enabled = Flag
labelMDLName.Enabled = Flag
cmdMDL.Enabled = Flag
End Sub
Private Sub SetEnableGenB(ByVal Flag As Boolean)
frGenB.Enabled = Flag
'frGenBTextures.Enabled = Flag
nUPsizeX.Enabled = Flag
nUPsizeZ.Enabled = Flag
nUPscale.Enabled = Flag
lbgb1.Enabled = Flag
lbgb2.Enabled = Flag
lbgb3.Enabled = Flag
cmdGbLoad.Enabled = Flag
cmdGbStore.Enabled = Flag
cmdGBDelete.Enabled = Flag
'cmdGBFind.Enabled = Flag
cmdGbDetail.Enabled = Flag
lstGenB.Enabled = Flag
imgGenB.Visible = Flag
Label14.Enabled = Flag
Label15.Enabled = Flag
End Sub
Private Sub SetEnableLib(ByVal Flag As Boolean)
frLib.Enabled = Flag
txtLibWidth.Enabled = Flag
txtLibLength.Enabled = Flag
txtLibScale.Enabled = Flag
txtLibName.Enabled = Flag
LabelLib1.Enabled = Flag
labelLib2.Enabled = Flag
LabelLib3.Enabled = Flag
LabelLibName.Enabled = Flag
labelLibMouse.Enabled = Flag
labelFS.Enabled = Flag