-
Notifications
You must be signed in to change notification settings - Fork 0
/
LCAR.bas
5795 lines (5190 loc) · 217 KB
/
LCAR.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
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=StaticCode
Version=6.77
@EndOfDesignText@
'X/Y locations
'>MaxInt % of width/height relative to left/top (%= (value-MaxInt) * 0.01)
'<MinINT % of width/height relative to width/height (%= (value+MinINT) * 0.01)
'=>0 relative to left/top
'<0 relative to width/height
'LCAR_Button
'LWidth=Width of left curved part, RWidth=Width of right curved part, Number is only drawn if >-1
'LCAR_Timer
'Not drawn, but will still move if visible=true, so you can use it to delay the LCAR_StoppedMoving event
'LCAR_Slider, LCAR_Meter, LCAR_Chart
'Lwidth=current percent, rwidth=desired percent, align=LCAR_Random randomizes rwidth when lwidth=rwidth
'LCAR_Chart Align -1= top edge, LCAR_Random or 0=graph item, 1=bottom edge, sidetext=0,empty = normal, sidetext=-1 = left edge, sidetext=1 = right edge
'LCAR_SensorGrid
'Lwidth=current X, rwidth=current y, element.Align=desired X, element.TextAlign=desired y, Enabled=true randomizes desired when = to current
'LCAR_Picture
'LWidth=Picture ID/Index, Align=5 Picture is centered on X/Y
'LCAR_Textbox
'Lwidth=Selection start, RWidth=Selection Width
'LCAR_Elbow
'Lwidth=BarWidth, Rwidth=BarHeight
'LCAR_Numbers
'LWidth=Number list ID
'LCAR_List
'Style 0=normal, 1(LCAR_Chart), 2(LCAR_Graph) =Chart ShowNumber=true randomizes item Number when Number = whitespace, Number=Desired Percent, WhiteSpace=Current Percent
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim ScaleWidth As Int, ScaleHeight As Int , BiggestHeight As Int, Landscape As Boolean , MultiTouchEnabled As Boolean ,SpeedSensor As Int, WasPlaying As Int , ChartWidth As Int, ChartEdgeHeight As Int, ChartHeight As Int , ChartSpace As Int, ListIsMoving As Boolean
Dim LCAR_Black As Int, LCAR_DarkOrange As Int, LCAR_Orange As Int, LCAR_LightOrange As Int,LCAR_Purple As Int, LCAR_RedAlert As Int, LCAR_LightPurple As Int,LCAR_LightBlue As Int, LCAR_Red As Int, LCAR_Yellow As Int, LCAR_DarkBlue As Int, LCAR_DarkYellow As Int, LCAR_DarkPurple As Int, LCAR_White As Int,LCAR_Random As Int ,LCAR_RandomTheme As Int
Dim LCARcolors As List , Mute As Boolean, ElementMoving As Boolean , BlinkState As Boolean , ListitemWhiteSpace As Int,NumberWhiteSpace As Int, NumberTextSize As Int , Alphaspeed As Int,Stage As Int,MeterWidth As Int
Dim Looping As Int, HalfWhite As Int, FPS As Int, FramesDrawn As Int ,AlphaBlending As Boolean ,SelectedIP As Int,VisibleList As Int, BackupKB As APIKeyboard
Dim MaxINT As Int, MinINT As Int, MAXDIM As Int, MINDIM As Int, BatteryPercent As Int, OldBattery As Int, isCharging As Boolean , LCAR_NumberTextSize As Int
'ElementTypes: 0=button
Type Point(X As Int, Y As Int)
Type ColorTheme (Name As String, ColorList(5) As Int, ColorCount As Int)
Type LCARColor (Name As String, Normal As Int, Selected As Int, nR As Int, nG As Int, nB As Int, sR As Int, sG As Int, SB As Int)
Type tween (currX As Int, currY As Int, offX As Int, offY As Int)
Type TweenAlpha (Current As Int, Desired As Int)
Type ElementClicked (ElementType As Int, X As Int, Y As Int, Index As Int, Dimensions As tween, X2 As Int, Y2 As Int, Index2 As Int , EventType As Int , RespondToAll As Boolean )
Type LCARnumberlist (Rows As Int, ShowRows As Int, Cols As List)
Type LCARnumberCol (Numbers As List, Width As Int, Digits As Int, Align As Int)
Type LCARpicture (Name As String, Picture As Bitmap, Dir As String )
Type LCARlistitem (Text As String, Side As String, Tag As String , Selected As Boolean, Number As Int, IsClean As Boolean , ColorID As Int, WhiteSpace As Int)
Type LCARlist (Opacity As TweenAlpha, LastMint As Int, ForcedMint As LCARlistitem , ForcedMintCount As Int, Style As Int, ColsPortrait As Int, ColsLandscape As Int, Start As Int, LOC As tween, Size As tween ,SurfaceID As Int, ShowNumber As Boolean , Name As String,RhasCurve As Boolean , Tag As String, IsClean As Boolean , MultiSelect As Boolean , SelectedItems As Int, SelectedItem As Int, isDown As Boolean,isScrolling As Boolean , Visible As Boolean , RedX As Int, RedY As Int,Red As Int, WhiteSpace As Int, LWidth As Int, RWidth As Int, Alignment As Int, ListItems As List,Locked As Boolean, OneColOnly As Boolean ,Async As Boolean, SelectedXY As Point, Offset As Int,Ydown As Float)
Type LCARelement (LOC As tween , Size As tween, Opacity As TweenAlpha, ElementType As Int, ColorID As Int, IsDown As Boolean, Name As String,SurfaceID As Int, Tag As String, Group As Int,Text As String,SideText As String, LWidth As Int, RWidth As Int, IsClean As Boolean , TextAlign As Int, RedAlertHold As Int, RedAlertCycles As Int, State As Boolean, Visible As Boolean, Enabled As Boolean,Align As Int,Blink As Boolean, Async As Boolean , RespondToAll As Boolean )
Type LCARgroup (Visible As Boolean, RedAlert As Int, LCARlist As List, HoldList As List, Hold As Int )
Dim LCARelements As List , LCARGroups As List , LCARlists As List , LCARnumberlists As LCARnumberlist, LCARVisibleLists As List, LCAR_Grey As Int, ClearLocked As Boolean
Dim Fontsize As Int, LCARfont As Typeface , LCARfontheight As Int, RedAlert As Boolean , IsClean As Boolean, LCAR_Block As String ' , NeedsEnumerating As Boolean
Dim KBListID As Int, KBCancelID As Int, KBGroup As Int, KBShift As Boolean , NumListID As Int, NumButtonID As Int, NumGroup As Int, KBCaps As Boolean
Dim ItemHeight As Int, AntiAliasing As Boolean, WebviewOffset As Int, LessRandom As Boolean, CurrRandom As Int, CurrListID As Int: AntiAliasing=True
Dim LCARCorner As Bitmap, LCARCornerSlider As Bitmap, LCARCornerElbow As Bitmap, LCARCornerElbow2 As Bitmap, ScreenIsOn As Boolean
Dim LCARCornera As Bitmap, LCARCornerSlidera As Bitmap, LCARCornerElbowa As Bitmap, LCARCornerElbow2a As Bitmap, UseAnotherFolder As Boolean
Dim LCAR_List As Int, LCAR_Button As Int, LCAR_Elbow As Int, LCAR_Textbox As Int, LCAR_Slider As Int, LCAR_CodeChanged As Int, LCAR_Meter As Int, LCAR_Keyboard As Int
Dim LCAR_StoppedMoving As Int, LCAR_Timer As Int, LCAR_StoppedPlaying As Int, LCAR_Chart As Int, LCAR_Picture As Int, LCAR_SensorGrid As Int, LCAR_ChartNeg As Int, LCAR_Navigation As Int
Dim LCAR_SensorChanged As Int, LCAR_IGNORE As String, LCAR_TimerIncrement As Int, leftside As Int, Zoom As Int , LoadedFilename As String, LOD As Boolean , LCAR_OK As Int
Dim LCAR_Tactical As Int, LCAR_LastListitem As Int,SymboardID As Int , ElbowTextHeight As Int, LCAR_Borg As Int, SmallScreen As Boolean , LCAR_Okuda As Int ',method1 As Boolean ,
Dim LCAR_Dpad As Int, LCAR_Alert As Int, Classic_Yellow As Int, Classic_Green As Int, Classic_Blue As Int, Classic_LightBlue As Int, LCAR_HardwareBTN As Int, LCAR_HorSlider As Int
Dim LCAR_Matrix As Int, LCAR_StarBase As Int, LCAR_Analysis As Int, Klingon_Button As Int, Klingon_Frame As Int, Legacy_Button As Int, LCAR_ToastDone As Int, LCAR_Graph As Int
Dim LCAR_Engineering As Int , PCAR_Button As Int, LCAR_SensorSweep As Int, LCAR_Clear As Int, LCAR_BigText As Int, LCAR_Omega As Int, LCAR_Ruler As Int , LCAR_MultiSpectral As Int
Dim LCAR_ShieldStatus As Int, LCAR_PdP As Int, PCAR_Frame As Int , LCAR_PdPSelector As Int,LCAR_Static As Int, SBALLS_Plaid As Int, TOS_Moires As Int, Legacy_Sonar As Int
Dim Classic_Turq As Int, LCAR_RndNumbers As Int, TOS_RndNumbers As Int, LCAR_TextButton As Int, LCAR_PToE As Int, LCAR_MSD As Int, LCAR_NCC1701D As Int, BTTF_Flux As Int
Dim LCAR_LWP As Int, LCAR_MiniButton As Int, LCAR_WarpCore As Int, LCAR_ShuttleBay As Int, IsInternal As Boolean, LCAR_ASquare As Int , LCAR_Starfield As Int, LCAR_MultiLine As Int
Dim LCAR_SMS As Int, LCAR_Answer As Int, LCAR_AnswerMade As Int, LCAR_PhoneState As Int, AnswerScreen As Int = 54
Type LCARSound (Name As String, Filename As String, Dir As String, Length As Int, SPID As Int) 'UseSoundPool As Int,)
Type GesturePoint (Id As Int, prevX As Int, prevY As Int, Element As ElementClicked )
Dim GestureMap As List, EventList As List, SoundList As List , PictureList As List, MP As MediaPlayer, ThemeList As List, CurrentTheme As ColorTheme, CTindex As Int
'Dim MP2 As MediaPlayer
Dim Event_Down As Int, Event_Up As Int, Event_Move As Int, Event_Scroll As Int, OldX As Int, OldY As Int, MinTimer As Long,TimerPeriod As Int, VibratePeriod As Int ,didIncrementNumbers As Boolean
Dim IsAAon As Boolean ,cVol As Int, SmoothScrolling As Boolean,DoVector As Boolean ,ResetVol As Boolean, Locked As Boolean ,BGisInit As Boolean,SymbolsEnabled As Boolean, BypassHardwareKB As Boolean
Dim VolOpacity As Int, VolSeconds As Int ,VolVisible As Int ,FPSCounter As Boolean,DrawFPS As Boolean ,VolText As String , VolTextList As List,VolInc As Int ,VolDimensions As Point
Dim HasHardwareKeyboard As Boolean, KBisVisible As Boolean,ToastAlign As Boolean ,CurrSound As LCARSound ,Fontfactor As Int, Vibrate As PhoneVibrate, RumbleUnit As Int ,IsRumbling As Boolean
'Dim SP As SoundPool,PlayID As Int :PlayID=-1:SP.Initialize(1)
LCAR_StoppedPlaying=-5: LCAR_Timer=-4: LCAR_StoppedMoving=-3: LCAR_CodeChanged=-2: LCAR_List=-1: LCAR_Button=0: LCAR_Elbow=1
LCAR_Textbox=2: LCAR_Slider=3: LCAR_Meter=4: LCAR_SensorGrid=5: LCAR_Picture =6: LCAR_Chart=7: LCAR_Navigation=8
LCAR_Tactical=9: LCAR_LastListitem=-999: LCAR_Borg =10: LCAR_Okuda=11: LCAR_Dpad=12: LCAR_Alert=13: LCAR_HorSlider=14
LCAR_ChartNeg=-6: LCAR_SensorChanged=-7: LCAR_IGNORE="IGNORETHIS": LCAR_TimerIncrement=-8: LCAR_OK=-9: LCAR_Keyboard=-10: LCAR_HardwareBTN=-11
LCAR_Matrix=15: LCAR_StarBase=16: LCAR_Analysis=17: Klingon_Button=18: Klingon_Frame=19: Legacy_Button=20: LCAR_ToastDone =21
LCAR_Graph=22: LCAR_Engineering=23: PCAR_Button=24: LCAR_SensorSweep=25: LCAR_Omega=26: LCAR_Ruler=27: LCAR_MultiSpectral=28
LCAR_ShieldStatus=29: LCAR_PdP=30: PCAR_Frame=31: LCAR_PdPSelector=32: LCAR_Static=33: SBALLS_Plaid=34: TOS_Moires=35
Legacy_Sonar=36: LCAR_RndNumbers=37: TOS_RndNumbers=38: LCAR_TextButton=39: LCAR_PToE=40: LCAR_MSD=41: LCAR_NCC1701D=42
BTTF_Flux=43: LCAR_LWP=44: LCAR_MiniButton=45: LCAR_WarpCore=46: LCAR_PhoneState=47: LCAR_ASquare=48: LCAR_Starfield=49
LCAR_MultiLine=50: LCAR_SMS=51: LCAR_Answer =52: LCAR_AnswerMade=53
LCAR_RandomTheme=-9998: MeterWidth=60: ListitemWhiteSpace=3: SpeedSensor=2: Alphaspeed=16: LCAR_Random=-9999: ChartWidth=40
ChartEdgeHeight=13: ChartHeight=62: ChartSpace=5: CurrListID=-1: HalfWhite =Colors.ARGB(128,255,255,255)
MaxINT= 2147483647: MinINT = -2147483648: MAXDIM=MaxINT-100: MINDIM=MinINT+100
LCARCornerElbowa.Initialize(File.DirAssets,"elbow.gif"): LCARCornerElbow2a.Initialize(File.DirAssets,"elbow2.gif")
LCARCornerElbow.Initialize(File.DirAssets,"elbow.png"): LCARCornerElbow2.Initialize(File.DirAssets,"elbow2.png")
VolTextList.Initialize
Dim LCAR_SelectedItem As Int = -999, ButtonList As Int=-1 ,isInstalled As Boolean ,DirExternal As String ="",MinWidth As Int,ClickedOK As Boolean
Dim TextPos As Point , CharSize As Point ,LCAR_Sidebar As Int ,LCAR_ScreenEnabled As Boolean =True,KBLayout As Int ,LCAR_Beeps As Int ,CrazyRez As Float, LCARSDrawn As Int
End Sub
Sub GUIcreated As Boolean
Return LCARelements.Size>0 And LCARlists.Size>0
End Sub
Sub GetInfo As Boolean
'Dim PM As PackageManager , Pic As Bitmap, tempstr As String
Try
isInstalled = API.IsPackageInstalled("com.omnicorp.lcarui.test")
'If Not(isInstalled) Then
' tempstr = PM.GetApplicationLabel("com.omnicorp.lcarui.test")
' isInstalled = tempstr = "LCARS"
'End If
'debug(PM.GetApplicationLabel("com.omnicorp.lcarui.test"))
'End If
'API.debug("isInstalled=" & isInstalled & " (" & PM.GetApplicationLabel("com.omnicorp.lcarui.test") & ")")
'Pic = API.GetBmpFromDrawable(PM.GetApplicationIcon("com.omnicorp.lcarui.test"))
'tempstr = Pic.GetPixel(Pic.Width/2, Pic.height/2)
'If tempstr <> -862348852 Then
' Log("ICONFAIL: " & tempstr)
' isInstalled = False
'End If
'API.debug("isInstalled=" & isInstalled & " (" & Pic.GetPixel(Pic.Width/2, Pic.height/2) & " should be -2056128")
'If PM.GetVersionCode("com.omnicorp.lcarui.test") < 151 Then isInstalled = False
'debug("VER FAIL: " & PM.GetVersionCode("com.omnicorp.lcarui.test"))
'isInstalled = False
'End If
Return isInstalled
Catch
Return False
End Try
End Sub
Sub DirDefaultExternal As String
Dim tempstr As String
If DirExternal.Length=0 Then
If GetInfo Or isInstalled Then
tempstr = File.Combine(File.DirRootExternal, "LCARS")
If File.Exists(tempstr, "settings.ini") Then 'AND (DateTime.Now- File.LastModified(tempstr,"settings.ini")) / DateTime.TicksPerMinute >15 Then
DirExternal= tempstr
Else
tempstr= File.DirDefaultExternal.Replace(".dialer", ".test")
If File.Exists(tempstr, "settings.ini") Then DirExternal= tempstr
End If
End If
End If
'API.debug("isInstalled: " & isInstalled & " Found directory: " & DirExternal)
Return DirExternal
End Sub
Sub SetupTheVariables As Boolean
If Event_Down=0 Then
'LCARCornerElbowa.Initialize(File.DirAssets,"elbow.gif"): LCARCornerElbow2a.Initialize(File.DirAssets,"elbow2.gif")
'LCARCornerElbow.Initialize(File.DirAssets,"elbow.png"): LCARCornerElbow2.Initialize(File.DirAssets,"elbow2.png")
GestureMap.Initialize: EventList.Initialize: SoundList.Initialize: PictureList.Initialize: MP.Initialize2("MP") : ThemeList.Initialize': MP2.Initialize
LCARelements.Initialize: LCARGroups.Initialize: LCARlists.Initialize: LCARnumberlists.Initialize : LCARVisibleLists.Initialize
Event_Down=1: Event_Move=2:Event_Scroll=3
'MultiTouchEnabled = True:
LOD=True:AlphaBlending=True:SelectedIP=-1':method1=False
cVol=100
VolVisible=5
Fontfactor=50
'DoVector=True
LCAR_Block = "‖"
LCAR_Clear=Colors.ARGB(0,0,0,0)
LCAR_BigText=-999'"BiGtExT"
RumbleUnit=0
LCAR_NumberTextSize=9999
KBCaps=True
Return True
End If
Return False
End Sub
Sub HandleRumbleTimer(CurrentTime As Int, StartTime As Int, EndTime As Int, Period As Int) As Boolean
If CurrentTime >= StartTime AND CurrentTime< EndTime AND Period <> VibratePeriod Then
RumblePeriod(Period)
Return True
End If
End Sub
Sub RumblePeriod(MS As Int)
VibratePeriod=MS
If MS =-1 Then
StopRumble
Else
RumblePattern( Array As Long( MS, RumbleUnit))
End If
End Sub
Sub rumble(Units As Int)
If RumbleUnit>0 Then Vibrate.Vibrate(Units*RumbleUnit)
End Sub
Sub RumblePattern(Pattern() As Long)
Dim r As Reflector' 0=pause 1=rumble
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "vibrator", "java.lang.String")
r.RunMethod4("vibrate", Array As Object(Pattern, 0), Array As String("[J", "java.lang.int"))
IsRumbling=True
End Sub
Sub StopRumble
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "vibrator", "java.lang.String")
r.RunMethod("cancel")
IsRumbling=False
End Sub
Sub ActivateAA(BG As Canvas, AAstate As Boolean ) As Boolean
Dim Obj1 As Reflector
If AntiAliasing Then
'If AAstate =True AND AntiAliasing=False Then Return False
Obj1.Target = BG
Obj1.Target = Obj1.GetField("paint")
Obj1.RunMethod2("setAntiAlias", AAstate, "java.lang.boolean")
IsAAon=AAstate
'debug("AA=" & AAstate)
Return AAstate
End If
End Sub
Sub LoadLCARSize(BG As Canvas)
Dim NewLeftSide As Int , temp As Int, Lists As LCARlist , Filename As String
If Zoom>0 Then Filename=Zoom
SetupColors
LCARCorner.Initialize(File.DirAssets,"test1" & Filename & ".png")
LCARCornera.Initialize(File.DirAssets,"test1" & Filename & ".gif")
LCARCornerSlider.Initialize(File.DirAssets,"test2" & Filename & ".png")
LCARCornerSlidera.Initialize(File.DirAssets,"test2" & Filename & ".gif")
LoadedFilename= "test1" & Filename
ItemHeight = LCARCorner.Height
LCARfontheight=ItemHeight*(Fontfactor*0.01)
If BG=Null Then
'If Fontsize=0 Then Fontsize=10
Dim BMP As Bitmap ,tempBG As Canvas
BMP.InitializeMutable(1,1)
tempBG.Initialize2(BMP)
'debug("BG IS NULL: " & (BG=Null) & " BMP: " & BMP.IsInitialized )
'Fontsize= API.GetTextHeight(tempBG, LCARfontheight, "ABC123", LCARfont) '14+(Zoom*2)
BG=tempBG
'Else
End If
Fontsize= API.GetTextHeight(BG, LCARfontheight, "ABC123", LCARfont) '14+(Zoom*2)
'End If
MinWidth = (LCARCorner.Width*2) + 4 + TextWidth(BG, "YES")
NumberWhiteSpace=0
NewLeftSide = LCARCorner.Width+4
If leftside>0 Then
For temp = 0 To LCARlists.Size-1
Lists=LCARlists.Get(temp)
If Lists.LWidth = leftside Then
Lists.LWidth=NewLeftSide
LCARlists.Set(temp,Lists)
End If
Next
End If
leftside=NewLeftSide
End Sub
Sub NewTheme(Name As String, ColorList As List) As Int
Dim Theme As ColorTheme , temp As Int
Theme.Initialize
Theme.ColorCount=ColorList.Size
For temp=0 To ColorList.Size -1
Theme.ColorList(temp) = ColorList.Get(temp)
Next
ThemeList.Add(Theme)
Return ThemeList.Size -1
End Sub
Sub ChangeTheme(Index As Int)
CurrentTheme = ThemeList.Get(Index)
CTindex = Index
End Sub
Sub LoadPicture(Filename As String, Dir As String)As Int
Dim temp As LCARpicture, Index As Int
Index=FindPicture(Filename,Dir)
If Index>-1 Then Return Index
temp.Initialize
temp.Name = Filename
If Dir.Length = 0 Then Dir = File.DirAssets
temp.Dir = Dir
temp.Picture.Initialize(Dir,Filename)
If temp.Picture.IsInitialized Then
PictureList.Add(temp)
Return PictureList.Size-1
Else
Log(File.Combine(Dir, Filename) & " failed to load")
Return -1
End If
End Sub
Sub FindPicture(Filename As String, Dir As String) As Int
Dim temp As Int ,Picture As LCARpicture
If Dir.Length = 0 Then Dir = File.DirAssets
For temp = 0 To PictureList.Size-1
Picture = PictureList.Get(temp)
If Picture.Name=Filename Then
If Picture.Dir = Dir Then Return temp
End If
Next
Return -1
End Sub
Sub IsToastVisible(BG As Canvas, Resize As Boolean ) As Int
If VolSeconds >0 OR VolOpacity >0 Then
If VolText.Length = 0 Then
Return 1
Else
If BG <> Null AND Resize Then SizeToast(BG, VolText.Replace(" " & CRLF , " "))
Return 2
End If
End If
End Sub
Sub ToastMessage(BG As Canvas, Text As String, Seconds As Int)
Dim temp As LCARtimer 'VolOpacity VolOpacity
If Text.Length>0 Then
Log("TOAST: " & Text)
If VolSeconds >0 OR VolOpacity >0 OR Not( BGisInit ) Then'the toast is visible, push it onto the stack
temp.Initialize
temp.Name = Text
temp.Duration = Seconds
VolTextList.Add(temp)
Else
VolSeconds=(1000/VolInc)*Seconds
SizeToast(BG,Text)
End If
End If
End Sub
Sub SizeToast(BG As Canvas,Text As String)
Dim MaxWidth As Int
MaxWidth = ScaleWidth-50' Min(ScaleWidth,ScaleHeight)-50
VolText= API.TextWrap(BG, LCARfont, Fontsize, Text.ToUpperCase, MaxWidth)
If VolText.Contains(CRLF) Then
MaxWidth= API.CountInstances(VolText,CRLF)' (Regex.Matcher(CRLF, VolText).GroupCount+1)
'debug(MaxWidth & " returns in " & VolText)
Else
MaxWidth=1
End If
VolDimensions=Trig.SetPoint(API.TextWidthAtHeight(BG,LCARfont,VolText,Fontsize), TextHeight(BG, "TEST")*MaxWidth + API.IIF(MaxWidth=1, 0,2))
End Sub
Sub PullNextToast(BG As Canvas)
Dim temp As LCARtimer
If VolSeconds=0 AND VolOpacity=0 Then
If VolTextList.Size =0 Then
VolText=""
Else
temp = VolTextList.Get(0)
ToastMessage(BG, temp.Name, temp.Duration )
VolTextList.RemoveAt(0)
End If
End If
End Sub
Sub PlaySoundAnyway(Index As Int)
Dim temp As Boolean
temp=Mute
Mute=False
MP.SetVolume(1,1)
ResetVol=True
PlaySound(Index,False)
Mute=temp
End Sub
Sub EnumSounds(ListID As Int)
Dim temp As Int ,Sound As LCARSound
'lcar_clearlist(listid,0)
For temp=0 To SoundList.Size-1
Sound = SoundList.Get(temp)
LCAR_AddListItem(ListID, Sound.Name , LCAR_Random, File.Size(Sound.Dir, Sound.Filename) , Sound.Filename ,False, "", 0, False,-1)
Next
End Sub
Sub Volume(Value As Int, ShowToast As Boolean )As Int
Dim temp As Double
If Value<0 Then Value=0
If Value>100 Then Value=100
If Value=0 Then
Mute=True
Stop
Else
Mute=False
End If
temp=Value*0.01
Try
MP.SetVolume(temp,temp)
Catch
MP.Initialize2("MP")
MP.SetVolume(temp,temp)
End Try
'MP2.SetVolume(temp,temp)
'If PlayID>-1 Then SP.SetVolume(PlayID, Value*0.01, Value*0.01)
If ShowToast Then
'VolOpacity=255
VolSeconds=VolVisible
End If
cVol = Value
Return cVol
End Sub
Sub SetVol(Direction As Boolean)As Boolean
Dim temp As Int ,Ret As Boolean
temp = cVol
Ret = Volume(cVol+ API.IIF(Direction, 10,-10), True) <> temp
If STimer.CurrentPhoneState>0 Then Ret=False
Return Ret
End Sub
Sub IsPlaying As Boolean
Return MP.IsPlaying 'OR MP2.IsPlaying 'OR PlayID>-1
End Sub
Sub Stop
Looping=-1
MP.Stop
'MP2.Stop
'If PlayID>-1 Then
' SP.Stop (PlayID)
' SP.Unload(PlayID)
' PlayID=-1
'End If
End Sub
Sub PlaySound(Index As Int, doLoop As Boolean )As Boolean
If ResetVol Then Volume(cVol,False)
If Not(Mute) AND Index < SoundList.Size Then
If MP.IsPlaying Then
If (WasPlaying<>Looping) AND Not(doLoop) Then Return False'prevent interuptions
MP.Stop
End If
If Index<0 Then Index = Rnd(0, SoundList.Size)
If doLoop Then Looping = Index
CurrSound = SoundList.Get(Index)
WasPlaying=Index
' If CurrSound.UseSoundPool>0 Then
' ' PlayID=SP.Load(Sound.Dir, Sound.Filename)
' ' SP.Play(PlayID, cVol*0.01, cVol*0.01, 9999,-1,1)
' MP2.Load(CurrSound.Dir, CurrSound.Filename)
' End If
'Else
Try
MP.Load(CurrSound.Dir, CurrSound.Filename)
MP.Looping=doLoop 'AND (CurrSound.UseSoundPool=0)
MP.Play
'MP.Looping=doLoop
'End If
Catch
Return False
End Try
Return True
End If
End Sub
Sub CheckLoopingSound( )
Dim Clicked As ElementClicked
If WasPlaying>-1 Then
If MP.IsPlaying = False Then 'AND MP2.IsPlaying=False Then
If CurrSound.Length=0 Then CurrSound.Length = MP.Position
If Looping=WasPlaying Then'AND CurrSound.UseSoundPool>0 Then
'MP.Position=0
'MP.Play
'MP.Looping=True
Else
Clicked.ElementType = LCAR_StoppedPlaying
Clicked.Index = WasPlaying
Clicked.Index2= MP.Position
WasPlaying=-1
EventList.Add(Clicked)
If Looping>-1 Then PlaySound(Looping,True)
End If
' Else If CurrSound.UseSoundPool>0 Then
' CheckSound(MP,MP2)
' CheckSound(MP2,MP)
End If
End If
End Sub
'Sub CheckSound(MP1 As MediaPlayer, aMP2 As MediaPlayer)
' If MP1.IsPlaying AND MP1.Position>= CurrSound.UseSoundPool Then
' If aMP2.IsPlaying Then
' If aMP2.Position>0 Then
' MP1.Pause
' MP1.Position=0
' End If
' Else
' aMP2.Play
' End If
' End If
'End Sub
Sub FindSound(Name As String) As Int
Dim temp As Int,Sound As LCARSound
'If dir.Length = 0 Then dir = File.DirAssets
For temp = 0 To SoundList.Size-1
Sound=SoundList.Get(temp)
If Sound.Name.EqualsIgnoreCase(Name) Then Return temp
Next
Return -1
End Sub
Sub AddSound(Name As String , Filename As String, Dir As String)As Int
Dim Sound As LCARSound,temp As Int
temp=FindSound(Name)
If Dir.Length = 0 Then Dir = File.DirAssets
If temp>-1 Then
Sound = SoundList.Get(temp)
Sound.Filename=Filename
Sound.Dir =Dir
Return temp
End If
Sound.Initialize
Sound.Name = Name
Sound.Filename = Filename
Sound.Dir = Dir
SoundList.Add(Sound)
Return SoundList.Size-1
End Sub'1610
Sub SetSoundLength(SoundID As Int, Length As Int)
Dim Sound As LCARSound
Sound=SoundList.Get(SoundID)
Sound.Length=Length
End Sub
'Sub SetSoundPool(SoundID As Int, UseSoundPool As Int)
' Dim Sound As LCARSound
' Sound=SoundList.Get(SoundID)
' Sound.UseSoundPool=UseSoundPool
'End Sub
Sub GetColor2(ColorID As Int, State As Boolean) As Int
Return GetColor(ColorID,State,255)
End Sub
Sub GetColor(ColorID As Int, State As Boolean, Alpha As Int)As Int
Dim Color As LCARColor ,temp As Int
If RedAlert AND ColorID< LCAR_White AND ColorID>LCAR_Black Then ColorID = LCAR_RedAlert
If ColorID<0 Then ColorID=CurrentTheme.ColorList( Abs(ColorID)-1)
If ColorID>= LCARcolors.Size Then ColorID= LCAR_Orange
Color = LCARcolors.Get(ColorID)
If Alpha<0 Then
Alpha=Abs(Alpha)
If State Then
If ColorID = LCAR_RedAlert Then
temp=Min(255,256-Alpha)
Return Colors.RGB(temp,temp,temp)
Else
Return Colors.RGB( Min(Color.sR+Alpha,255), Min(Color.sG+Alpha,255), Min(Color.SB+Alpha,255))
End If
Else
Return Colors.RGB( Min(Color.nR+Alpha,255), Min(Color.nG+Alpha,255), Min(Color.nB+Alpha,255))
End If
Else If Alpha<255 Then
If State Then
Return Colors.ARGB(Alpha, Color.sR, Color.sG, Color.SB )
Else
Return Colors.ARGB(Alpha, Color.nR, Color.nG, Color.nB )
End If
Else
If State Then
Return Color.Selected
Else
Return Color.Normal
End If
End If
End Sub
Sub DrawText2(BG As Canvas,X As Int, Y As Int, Textsize As Int, Text As String, Color As Int, Align As Int) As Int
BG.DrawText(Text,X, Y + BG.MeasureStringHeight(Text,LCARfont,Textsize), LCARfont, Textsize,Color, API.IIFIndex(Align, Array As String("LEFT", "CENTER", "RIGHT")))
Return BG.MeasureStringwidth(Text,LCARfont, Textsize)
End Sub
Sub DrawText(BG As Canvas, X As Int, Y As Int, Text As String, ColorID As Int, Align As Int,State As Boolean, Alpha As Int, Off As Int )As Boolean
Dim Alignment As String ,temp As Int, tempstr() As String ,doBG As Boolean ,Width As Int
If Text=Null Then Return False
If Text.Length>0 Then
ColorID=GetColor(ColorID, State,Alpha)
doBG=Off<0
If doBG Then Width=BG.MeasureStringWidth(Text,LCARfont,Fontsize)+1
If Off <1 Then Off=BG.MeasureStringHeight("ABC123",LCARfont,Fontsize)' Text,LCARfont,Fontsize)'+1' TextHeight(BG, "ABC123")+1'bg.MeasureStringHeight(text,lcarfont,fontsize)'LCARfontheight+1'
Select Case Align
Case 0,1,4,7: Alignment = "LEFT"
If doBG Then BG.DrawRect(SetRect(X,Y, Width+1, Off+1), Colors.Black, True,0)
Case 2,5,8: Alignment = "CENTER"
If doBG Then BG.DrawRect(SetRect(X-Width*0.5,Y, Width+1, Off+1), Colors.Black, True,0)
Case 3,6,9: Alignment = "RIGHT"
If doBG Then BG.DrawRect(SetRect(X-Width,Y, Width+1, Off+1), Colors.Black, True,0)
Case Else
Return False'invalid alignment, prevent crashing
End Select
Text=Text.Replace("\n", CRLF)
If Text.Contains(CRLF) Then
tempstr= Regex.Split(CRLF, Text)
For temp = 0 To tempstr.Length -1
BG.DrawText(tempstr(temp).Trim,X,Y +Off, LCARfont, Fontsize,ColorID, Alignment)
Y=Y+Off+2
Next
Else
BG.DrawText(Text,X,Y +Off, LCARfont, Fontsize,ColorID, Alignment)
End If
End If
End Sub
Sub TextHeight(BG As Canvas, Text As String)As Int
Return API.TextHeightAtHeight(BG, LCARfont, Text,Fontsize)
End Sub
Sub TextWidth(BG As Canvas, Text As String) As Int
Return API.TextWidthAtHeight(BG,LCARfont, Text, Fontsize)
End Sub
Sub GetARGB(Color As Int) As Int()
Dim res(4) As Int
res(0) = Bit.UnsignedShiftRight(Bit.AND(Color, 0xff000000), 24)
res(1) = Bit.UnsignedShiftRight(Bit.AND(Color, 0xff0000), 16)
res(2) = Bit.UnsignedShiftRight(Bit.AND(Color, 0xff00), 8)
res(3) = Bit.AND(Color, 0xff)
Return res
End Sub
Sub LCAR_RandomColor As Int'5 6 11
'LCARcolors.Size-2
Return Rnd(1, 12)'doesnt include black (0) or redalert (LCARcolors.Size-1), or white (LCARcolors.Size-2)
End Sub
Sub LCAR_RandomUnusedColor(ListID As Int, ExcludeBlack As Boolean ) As Int
Dim TempList As LCARlist, TempItem As LCARlistitem, temp As Int, temp2 As Int, UsedColors As List
UsedColors.Initialize
For temp = 0 To LCARcolors.Size-1
UsedColors.Add(False)
Next
If ExcludeBlack Then UsedColors.Set(LCAR_Black,True)
UsedColors.Set(LCAR_RedAlert,True)
TempList= GetList(ListID)
For temp = 0 To TempList.ListItems.Size-1
TempItem = TempList.ListItems.Get(temp)
UsedColors.Set( TempItem.ColorID, True)
Next
For temp = 0 To LCARcolors.Size-1
If UsedColors.Get(temp) Then temp2 = temp2+1
Next
If temp2 = LCARcolors.Size Then
Return -1'all colors are used
Else
temp=Rnd(0, LCARcolors.Size)
Do While UsedColors.Get(temp)
temp=Rnd(0, LCARcolors.Size)
Loop
Return temp
End If
End Sub
Sub FindLCARcolor(Name As String) As Int
Dim temp As Int, tempColor As LCARColor
For temp = 0 To LCARcolors.Size-1
tempColor = LCARcolors.Get(temp)
If tempColor.Name.EqualsIgnoreCase(Name) Then Return temp
Next
Return -1
End Sub
Sub AddLCARcolor(Name As String, r As Int,G As Int, B As Int, Brightness As Int ) As Int
Dim temp As LCARColor ,temp2 As Int
temp2=FindLCARcolor(Name)
If temp2=-1 Then
temp.Initialize
temp.Name = Name
temp.Normal = Colors.ARGB(255,r,G,B)
temp.nR=r:temp.nG=G:temp.nB=B
If r=0 AND G=0 AND B=0 Then
temp.Selected = temp.Normal
temp.sR=r:temp.sG=G:temp.SB=B
Else If Name = "Red Alert" Then
temp.Selected = Colors.White
temp.sR=255:temp.sG=255:temp.SB=255
Else
temp.sR=Min(r+Brightness,255):temp.sG= Min(G+Brightness,255):temp.SB=Min(B+Brightness,255)
temp.Selected = Colors.RGB(temp.sR, temp.sG,temp.SB )
End If
LCARcolors.Add(temp)
Return LCARcolors.Size -1
Else
Return temp2
End If
End Sub
Sub SetupLCARcolors(Act As Activity)As Boolean
Dim temp As Int, Lists As LCARlist , Ret As Boolean ,ActIsNull As Boolean
If Act=Null Then
ActIsNull=True
Else If Not(Act.IsInitialized) Then
ActIsNull=True
End If
If ActIsNull AND Event_Down>0 Then Return False
Ret = SetupTheVariables
If Not(ActIsNull) Then
ScaleWidth = Act.Width
ScaleHeight = Act.Height
End If
LCARSeffects.CacheAngles( Min(ScaleWidth,ScaleHeight)*2,-1)
Landscape= ScaleWidth>ScaleHeight
For temp =0 To LCARlists.Size-1
Lists = LCARlists.Get(temp)
Lists.RedX=0
Lists.RedY=0
LCARlists.Set(temp,Lists)
Next
IsClean=False
HideToast
SetupColors
Return Ret
End Sub
Sub SetupColors As Boolean
Dim DB As Int
If Not(LCARcolors.IsInitialized) Then
DB=64
If Landscape Then BiggestHeight = ScaleWidth Else BiggestHeight=ScaleHeight
WasPlaying=-1
Looping=-1
LCARfont = Typeface.LoadFromAssets("lcars.ttf")
LCARcolors.Initialize
LCAR_Black = AddLCARcolor("Black",0,0,0, DB ) '0 checked manually
LCAR_DarkOrange = AddLCARcolor("Dark Orange", 215, 107, 0, DB) '1 checked
LCAR_Orange = AddLCARcolor("Orange", 253,153,0, DB) '2 checked
LCAR_LightOrange = AddLCARcolor("Light Orange", 255, 255, 0, DB*2) '3 checked
LCAR_Purple = AddLCARcolor("Purple", 255,0,255, DB*2) '4 checked
LCAR_LightPurple = AddLCARcolor("Light Purple", 204,153,204, DB) '5
LCAR_LightBlue = AddLCARcolor("Light Blue", 153,153,204, DB) '6
LCAR_Red = AddLCARcolor("Red", 204,102,102, DB) '7 checked
LCAR_Yellow = AddLCARcolor("Yellow", 255,255,0, DB*2)' 204,153, DB*2) '8 checked
LCAR_DarkBlue = AddLCARcolor("Dark Blue", 153,153,255, DB) '9 checked
LCAR_DarkYellow = AddLCARcolor("Dark Yellow", 255,153,102, DB) '10 checked
LCAR_DarkPurple = AddLCARcolor("Dark Purple", 204,102,153, DB) '11
LCAR_White = AddLCARcolor("White", 255,255,255, DB*2) '12 checked
LCAR_RedAlert = AddLCARcolor("Red Alert", 204,102,102, DB) '13 checked manually
Classic_Yellow = AddLCARcolor("Light Green", 152,255,102, DB) '14
Classic_Green = AddLCARcolor("Green", 6,138,3, DB) '15
Classic_LightBlue=AddLCARcolor("Lighter Blue",153,205,255,DB) '16
Classic_Blue = AddLCARcolor("Blue", 0,0,254, DB) '17
Classic_Turq = AddLCARcolor("Turq", 76,232,185, DB)'18
LCAR_Grey = AddLCARcolor("Grey", 128,128,128,128)'19
AddSound("KLAXON", "criticalstop.ogg", "")
NewTheme("TNG", Array As Int(LCAR_LightPurple,LCAR_DarkPurple,LCAR_Orange,LCAR_Red,LCAR_LightOrange))
ChangeTheme(0)
Return True
End If
End Sub
Sub FindTheme(Name As String) As Int
Dim temp As Int, Theme As ColorTheme
For temp = 0 To ThemeList.Size-1
Theme=ThemeList.Get(temp)
If Theme.Name.EqualsIgnoreCase(Name) Then Return temp
Next
Return -1
End Sub
Sub ProcessScale(X As Int, Width As Int) As Int
If X>MAXDIM Then' is above maximum X, so scale to width by percent
Return ((X-MAXDIM)*0.01)*Width
Else If X<MINDIM Then'is below minimum X so scale to width by percent
Return ((X+MINDIM)*0.01)*Width
End If
Return X
End Sub
Sub ProcessLocX(X As Int, Off As Int, Width As Int, IsWidth As Int )As Int
Dim temp As Int
temp=ProcessScale(X , Width)
If IsWidth>0 Then'is a width/height
If temp<=0 Then
temp = Width+temp -IsWidth
'Else If smallscreen Then
' temp=temp*0.5
End If
Else'is an x/y
If temp<0 Then
temp = Width+temp
'Else If smallscreen Then
' temp=temp*0.5
End If
End If
Return temp+Off
End Sub
Sub ProcessLoc(LOC As tween, Size As tween) As tween
Dim temp As tween
If LOC<> Null AND Size <> Null Then
temp.Initialize
temp.currX=ProcessLocX( LOC.currX , LOC.offX, ScaleWidth,0 )'X/left
temp.curry=ProcessLocX( LOC.curry , LOC.offy, ScaleHeight,0 )'Y/top
temp.offX = ProcessLocX( Size.currX , Size.offX, ScaleWidth,temp.currX)'-temp.currX'width
temp.offy=ProcessLocX( Size.curry , Size.offy, ScaleHeight,temp.curry)'-temp.curry'height
Return temp
End If
End Sub
Sub NeedsClearing As Boolean
Return ElementMoving OR Not(IsClean) OR ListIsMoving
End Sub
Sub BlankScreen(BG As Canvas)
If BGisInit AND Not(BG=Null) Then BG.Drawcolor(Colors.Black)'LCAR.DrawRect(BG,0,0,LCAR.ScaleWidth,LCAR.ScaleHeight,Colors.Black,0)
End Sub
Sub ClearScreen(BG As Canvas )
If Not(ClearLocked) Then
IsClean=False
'If BG<> Null Then BG.Drawcolor(Colors.Black)
IsAAon=False
CurrListID=-1
End If
End Sub
Sub SetSensorXY(LCARid As Int, Xpercent As Int, Ypercent As Int, ScaleToNeg As Boolean )
Dim Element As LCARelement
Element = LCARelements.Get(LCARid)
If Element.Visible Then
Element.IsClean=False
If ScaleToNeg Then
Xpercent= 50 + Xpercent*0.5
Ypercent=50 + Ypercent*0.5
End If
Element.align= Xpercent
Element.TextAlign=Ypercent
'debug("X: " & Xpercent & " Y: " & Ypercent)
LCARelements.Set(LCARid, Element)
End If
End Sub
Sub IncrementSensorX(LCARid As Int, RWidth As Int, Z As Int)
Dim Element As LCARelement
Element = LCARelements.Get(LCARid)
Element.RWidth = Increment(Element.RWidth, 5, RWidth)
Element.align = Increment(Element.align, 5, Z)
'debug(LCARid & " X: " & RWidth & " Z: " & Z)
LCARelements.Set(LCARid, Element)
End Sub
Sub SetGraphPercent(ListID As Int, ListItems As List)
Dim Lists As LCARlist , ListItem As LCARlistitem ,temp As Int ,Index As Int, Percent As Int
If LCARVisibleLists.Get(ListID) Then
Lists = LCARlists.Get(ListID)
'If lists.Visible Then
Lists.IsClean = False
For temp = 0 To ListItems.Size-1 Step 2
Index=ListItems.Get(temp)
Percent=ListItems.Get(temp+1)
'debug("I: " & index & " P: " & percent)
ListItem=Lists.ListItems.Get(Index)
ListItem.IsClean=False
ListItem.Number=Abs(Percent)
Lists.ListItems.Set(Index,ListItem)
Next
LCARlists.Set(ListID, Lists)
End If
End Sub
Sub IncrementElement(ElementID As Int, Element As LCARelement,Speed As Int, SpeedSlider As Int )
Dim Didit As Boolean , Didit2 As Boolean , Didit3 As Boolean ,Old As Int
If Element.Visible Then'AND group.Visible Then
'move on 1 axis at a time
If Element.LOC.offX <> 0 Then
Element.LOC.offX = Increment(Element.LOC.offX, Speed,0)
Didit = True
Else If Element.LOC.offy <> 0 Then
Element.LOC.offy = Increment(Element.LOC.offy, Speed,0)
Didit=True
End If
'resize
If (Element.Size.offX <> 0) OR (Element.Size.offy <> 0) Then
Element.Size.offX = Increment(Element.Size.offX, Speed,0)
Element.Size.offy = Increment(Element.Size.offy, Speed,0)
Didit=True
End If
'alpha
If Element.Opacity.Current <> Element.Opacity.Desired Then
If AlphaBlending Then
Element.Opacity.Current = Increment(Element.Opacity.Current, Alphaspeed,Element.Opacity.Desired)
Else
Element.Opacity.Current = Element.Opacity.Desired
End If
If Element.Opacity.Current = 0 Then Element.Visible = False
Didit=True
End If
Select Case Element.ElementType
Case LCAR_Meter, LCAR_Slider,LCAR_HorSlider, LCAR_Tactical', LCAR_Chart
Old=Element.LWidth
Element.LWidth=Increment(Element.LWidth, SpeedSlider, Element.RWidth)
If Old <> Element.LWidth Then
Didit3= True
If Element.RespondToAll AND ElementID>-1 Then PushEvent(Element.ElementType , ElementID, Element.LWidth- Old,0,0,0,0, Event_Scroll)
Else
If Element.TextAlign= LCAR_Random Then
Didit3=True
Element.RWidth = Rnd(0,101)
End If
End If
Case LCAR_Textbox
'element.IsClean = False
'didit3=True
If Element.SideText.Length>0 AND Element.Opacity.Current>0 Then
Element.Text = Element.Text & Element.SideText.SubString2(0,1)'typewriter effect
Element.SideText = Element.SideText.SubString(1)
Didit3=True
End If
Case LCAR_Alert
Element.rWidth=Element.rWidth+1
If Element.RWidth = LCARSeffects.OkudaStages Then Element.rWidth=0
Didit3=True
Case LCAR_Graph
'LCARSeffects2.IncrementGraph(Element.TextAlign, Element.Align)
If Not(LCARSeffects2.isGraphClean(Element.TextAlign)) Then Didit3=True
Case LCAR_ShieldStatus
Pulse(Element,LCARSeffects.MaxShieldStages)
Didit3=True
Case LCAR_Static
Pulse(Element,16)
Didit3=True
Case LCAR_RndNumbers, TOS_RndNumbers
If Not(didIncrementNumbers) Then
didIncrementNumbers=True
Didit3 = LCARSeffects2.IncrementNumbers
Else
Didit3=didIncrementNumbers
End If
Case LCAR_List
Didit2 = IncrementList( Element.LWidth, Speed,SpeedSlider)