-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSample.Form.Main.pas
More file actions
1248 lines (1146 loc) · 40.4 KB
/
Sample.Form.Main.pas
File metadata and controls
1248 lines (1146 loc) · 40.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
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
{*******************************************************************************
Sample.Form.Main
********************************************************************************
Main Application Form demonstrating the usage of TSkFlowmotion.
Features Demonstrated:
- Initialization and configuration of the FlowMotion Gallery.
- Loading images.
- Dynamic layout changes and styling (Colors, Fonts, Borders).
- Inter-Process Communication (WM_COPYDATA) for external control.
- Parameter-based loading for standalone/slave execution modes.
part of skFlowmotion
written by: Lara Miriam Tamy Reschke
*******************************************************************************}
unit Sample.Form.Main;
interface
uses
{ Delphi RTL }
System.SysUtils, System.Types, System.UITypes, System.Classes, FMX.Types,
System.IOUtils, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Ani,
FMX.Objects, ShellAPI, FMX.Layouts, FMX.StdCtrls, System.Skia, FMX.Skia,
FMX.ImgList, FMX.ListBox, FMX.Colors, FMX.EditBox, FMX.SpinBox, Windows,
Messages, System.ImageList, FMX.Edit,
FMX.Controls.Presentation,
{ SkFlow Components }
uSkFlowmotion, uSkFlowEffects, uSkFlowButtons;
type
{ TfrmMain }
TfrmMain = class(TForm)
{ --- Visual Components --- }
saiAnimatedLogo: TSkAnimatedImage;
fanFadeOutTransition: TFloatAnimation;
lytContent: TLayout;
lytcontrols: TLayout;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
OpenDialog1: TOpenDialog;
ImageList1: TImageList;
CheckBox1: TCheckBox;
Rectangle1: TRectangle;
Button9: TButton;
Button10: TButton;
Panel1: TPanel;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
Button8: TButton;
CheckBox6: TCheckBox;
CheckBox7: TCheckBox;
CheckBox8: TCheckBox;
Timer1: TTimer;
ColorPicker1: TColorPicker;
rbselfontcol: TRadioButton;
rbfontcol: TRadioButton;
rbselcapback: TRadioButton;
rbcapback: TRadioButton;
rbglowcol: TRadioButton;
rbhotcol: TRadioButton;
rbrotatedot: TRadioButton;
CheckBox9: TCheckBox;
SpinBox1: TSpinBox;
rbAnimspeed: TRadioButton;
rbGlowwidth: TRadioButton;
rbHotwidth: TRadioButton;
rbFontsize: TRadioButton;
rbCaptionAlpha: TRadioButton;
rbCaptionYOffset: TRadioButton;
rbPagesize: TRadioButton;
rbstartingAngle: TRadioButton;
rbRoundEdges: TRadioButton;
Panel2: TPanel;
rbrotatedothot: TRadioButton;
rbrotatedotdown: TRadioButton;
CheckBox12: TCheckBox;
rbrotateall: TRadioButton;
CheckBox13: TCheckBox;
rbtechbracketwidth: TRadioButton;
Button11: TButton;
rbRotateAllBy: TRadioButton;
rbparticle: TRadioButton;
Rectangle2: TRectangle;
Button12: TButton;
rbmaxinternal: TRadioButton;
rbhotalpha: TRadioButton;
rbalpha: TRadioButton;
rbselectedalpha: TRadioButton;
Button13: TButton;
rbrotatesize: TRadioButton;
rbsmlpcmrg: TRadioButton;
rbmaxzoom: TRadioButton;
Layout1: TLayout;
Label2: TLabel;
ComboBox2: TComboBox;
Label3: TLabel;
ComboBox3: TComboBox;
ComboBox1: TComboBox;
Label1: TLabel;
Label4: TLabel;
ComboBox4: TComboBox;
rbhotzoom: TRadioButton;
Label5: TLabel;
ComboBox5: TComboBox;
CheckBox16: TCheckBox;
ComboBox6: TComboBox;
CheckBox2: TCheckBox;
rbifoarrow: TRadioButton;
Panel3: TPanel;
rbinfhot: TRadioButton;
Button1: TButton;
Button2: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Button18: TButton;
Label6: TLabel;
CheckBox19: TCheckBox;
CheckBox18: TCheckBox;
rbborder: TRadioButton;
Button19: TButton;
CheckBox20: TCheckBox;
CheckBox21: TCheckBox;
Button20: TButton;
Timer2: TTimer;
CheckBox22: TCheckBox;
CheckBox23: TCheckBox;
CheckBox10: TCheckBox;
CheckBox11: TCheckBox;
CheckBox14: TCheckBox;
CheckBox15: TCheckBox;
CheckBox17: TCheckBox;
CheckBox5: TCheckBox;
rbfps: TRadioButton;
Button14: TButton;
Timer3: TTimer;
Button21: TButton;
Button22: TButton;
Button23: TButton;
Button24: TButton;
CheckBox24: TCheckBox;
Button25: TButton;
procedure FormDestroy(Sender: TObject);
{ --- Event Handlers --- }
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
procedure Button18Click(Sender: TObject);
procedure Button19Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button20Click(Sender: TObject);
procedure Button21Click(Sender: TObject);
procedure Button22Click(Sender: TObject);
procedure Button23Click(Sender: TObject);
procedure Button24Click(Sender: TObject);
procedure Button25Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure CheckBox10Change(Sender: TObject);
procedure CheckBox11Change(Sender: TObject);
procedure CheckBox12Change(Sender: TObject);
procedure CheckBox13Change(Sender: TObject);
procedure CheckBox14Change(Sender: TObject);
procedure CheckBox15Change(Sender: TObject);
procedure CheckBox16Change(Sender: TObject);
procedure CheckBox17Change(Sender: TObject);
procedure CheckBox18Change(Sender: TObject);
procedure CheckBox19Change(Sender: TObject);
procedure CheckBox1Change(Sender: TObject);
procedure CheckBox20Change(Sender: TObject);
procedure CheckBox21Change(Sender: TObject);
procedure CheckBox22Change(Sender: TObject);
procedure CheckBox23Change(Sender: TObject);
procedure CheckBox24Change(Sender: TObject);
procedure CheckBox2Change(Sender: TObject);
procedure CheckBox3Change(Sender: TObject);
procedure CheckBox4Change(Sender: TObject);
procedure CheckBox5Change(Sender: TObject);
procedure CheckBox6Change(Sender: TObject);
procedure CheckBox7Change(Sender: TObject);
procedure CheckBox8Change(Sender: TObject);
procedure CheckBox9Change(Sender: TObject);
procedure ColorPicker1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure ComboBox3Change(Sender: TObject);
procedure ComboBox4Change(Sender: TObject);
procedure ComboBox5Change(Sender: TObject);
procedure ComboBox6Change(Sender: TObject);
procedure fanFadeOutTransitionFinish(Sender: TObject);
procedure saiAnimatedLogoAnimationFinished(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure lytcontrolsResize(Sender: TObject);
procedure rbPagesizeMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
procedure Rectangle1DblClick(Sender: TObject);
procedure SpinBox1Change(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
private
{ Private declarations }
Loadedwithparams: Boolean;
ParamsTxtFile: string;
FStreamFiles: TStringList;
FStreamindex: Integer;
{ Components }
FTestPanel: TFlowButtonPanel;
skfmFlowGallery: TSkFlowmotion;
{ Initialization & Setup }
procedure InitGallery;
{ TFlowButtonPanel Events }
procedure OnTestButtonClick(Sender: TObject; Button: TFlowButton);
{ TSkFlowmotion Events }
procedure Flowmotion1SelectedImageDblClick(Sender: TObject; ImageItem: TImageItem; Index: Integer);
procedure Flowmotion1SelectedImageEnterZone(Sender: TObject; ImageItem: TImageItem; const ZoneName: string);
procedure skfmFlowGalleryMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
{ IPC (Inter-Process Communication) }
procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
procedure SendSignalToPlayer(const FilePath: string);
procedure SendNextToPlayer(const FilePath: string);
{ Utility }
procedure LoadFromTxtFile(const TxtFilePath: string);
function GetFirstImageInFolder(const Folder: string): string;
procedure Onfullscreen(Sender: TObject; ImageItem: TImageItem; Index: Integer);
procedure MouseWheel(Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean); override;
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
{$R *.fmx}
procedure TfrmMain.FormDestroy(Sender: TObject);
begin
FStreamFiles.Free;
end;
{ *******************************************************************************
EVENT HANDLERS: BUTTON CLICKS
******************************************************************************* }
procedure TfrmMain.Button10Click(Sender: TObject);
begin
{ Clear gallery with specific animation targeting Panel1 }
skfmFlowGallery.Clear(true, true, Panel1.BoundsRect.Round, Panel1.BoundsRect.Round, iesFromPoint);
end;
procedure TfrmMain.Button11Click(Sender: TObject);
begin
{ Set window to transparent overlay mode }
skfmFlowGallery.SetBackgroundpicture('');
Transparency := true;
Borderstyle := TFmxFormBorderStyle.None;
Canvas.Clear($00000000);
skfmFlowGallery.BackgroundColor := TAlphaColors.Null;
end;
procedure TfrmMain.Button12Click(Sender: TObject);
begin
{ Trigger Zoom animation for the currently selected image }
skfmFlowGallery.ZoomSelectedToFull;
end;
procedure TfrmMain.Button13Click(Sender: TObject);
begin
{ Show the Info Panel (Side panel with text) for selected image }
if skfmFlowGallery.SelectedImage <> nil then
skfmFlowGallery.ShowInfoPanel(skfmFlowGallery.SelectedImage);
end;
procedure TfrmMain.Button14Click(Sender: TObject);
begin
if Timer3.Enabled then
begin
Timer3.Enabled := False;
skfmFlowGallery.ExternalStreamImage := nil;
end
else
{ 1. Select the files }
if OpenDialog1.Execute then
begin
if (skfmFlowGallery.SelectedImage = nil) then
skfmFlowGallery.SelectNextImage;
{ 2. Fill our list }
FStreamFiles.Clear;
FStreamFiles.AddStrings(OpenDialog1.Files);
{ 3. Reset counter }
FStreamindex := 0;
{ 4. Start Timer3 }
Timer3.Enabled := True;
end;
end;
procedure TfrmMain.Button15Click(Sender: TObject);
begin
{ Spatial Navigation: West }
skfmFlowGallery.SelectWest;
end;
procedure TfrmMain.Button16Click(Sender: TObject);
begin
{ Spatial Navigation: East }
skfmFlowGallery.SelectEast;
end;
procedure TfrmMain.Button17Click(Sender: TObject);
begin
{ Spatial Navigation: North }
skfmFlowGallery.SelectNorth;
end;
procedure TfrmMain.Button18Click(Sender: TObject);
begin
{ Spatial Navigation: South }
skfmFlowGallery.SelectSouth;
end;
procedure TfrmMain.Button19Click(Sender: TObject);
begin
{ Creates and displays a Radial Button Panel demonstration }
// 1. Create Panel
FTestPanel := TFlowButtonPanel.Create(Self);
FTestPanel.Parent := Self; // IMPORTANT: Must be parented to Form!
FTestPanel.SetBounds(0, 0, 400, 400);
FTestPanel.Visible := False;
// 2. Style Configuration
FTestPanel.Layout := plRadial; // Circle Layout
FTestPanel.PanelStyle := psGlass; // Glass background
FTestPanel.PanelRotation := 0;
FTestPanel.ButtonSize := 60;
FTestPanel.Gap := 10;
FTestPanel.Radius := 100; // Distance from center
// 3. Hook up Event
FTestPanel.OnButtonClick := OnTestButtonClick;
// 4. Add Buttons (Note: Replace paths with actual images for full effect)
// For demonstration, we try to load 'btntest.png' from app directory
FTestPanel.AddButton('Play', 'Start Playing', 'CMD_PLAY', TSkImage.MakeFromEncodedFile(ExtractFilePath(ParamStr(0)) + 'btntest.png'));
FTestPanel.AddButton('Stop', 'Stop Playing', 'CMD_STOP', TSkImage.MakeFromEncodedFile(ExtractFilePath(ParamStr(0)) + 'btntest.png'));
FTestPanel.AddButton('Exit', 'Close App', 'CMD_EXIT', TSkImage.MakeFromEncodedFile(ExtractFilePath(ParamStr(0)) + 'btntest.png'));
FTestPanel.ShowAt(500, 500);
end;
{ *******************************************************************************
EVENT HANDLERS: UI CONTROLS (CHECKBOXES, COMBOBOXES, SPINBOX)
******************************************************************************* }
procedure TfrmMain.CheckBox10Change(Sender: TObject);
begin
skfmFlowGallery.HotTrackZoom := CheckBox10.isChecked;
end;
procedure TfrmMain.CheckBox11Change(Sender: TObject);
begin
skfmFlowGallery.BreathingEnabled := CheckBox11.isChecked;
end;
procedure TfrmMain.CheckBox12Change(Sender: TObject);
begin
skfmFlowGallery.ZoomSelectedtoCenter := Checkbox12.IsChecked;
end;
procedure TfrmMain.CheckBox13Change(Sender: TObject);
begin
skfmFlowGallery.KeepSpaceforZoomed := CheckBox13.IsChecked;
end;
procedure TfrmMain.CheckBox14Change(Sender: TObject);
begin
skfmFlowGallery.BreathRotationEnabled := CheckBox14.isChecked;
end;
procedure TfrmMain.CheckBox15Change(Sender: TObject);
begin
skfmFlowGallery.HoverAlive := Checkbox15.IsChecked;
end;
procedure TfrmMain.CheckBox16Change(Sender: TObject);
begin
skfmFlowGallery.ShowInfoIndicator := Checkbox16.IsChecked;
end;
procedure TfrmMain.CheckBox17Change(Sender: TObject);
begin
skfmFlowGallery.HoverAliveOnFullscreen := Checkbox17.IsChecked;
end;
procedure TfrmMain.CheckBox18Change(Sender: TObject);
begin
skfmFlowGallery.AlwaysShowInfo := CheckBox18.isChecked;
end;
procedure TfrmMain.CheckBox19Change(Sender: TObject);
begin
skfmFlowGallery.DeleteClicked := CheckBox19.isChecked;
end;
procedure TfrmMain.CheckBox1Change(Sender: TObject);
begin
{ Toggle Picture Border Style }
if not Checkbox1.IsChecked then
skfmFlowGallery.PictureBorderType := btFull
else
skfmFlowGallery.PictureBorderType := btTech;
end;
procedure TfrmMain.CheckBox2Change(Sender: TObject);
begin
skfmFlowGallery.AnimatedBackground := Checkbox2.IsChecked;
end;
procedure TfrmMain.CheckBox3Change(Sender: TObject);
begin
skfmFlowGallery.SelectedMovable := CheckBox3.IsChecked;
end;
procedure TfrmMain.CheckBox4Change(Sender: TObject);
begin
{ Toggle Random Rotation vs Zero Rotation }
if CheckBox4.IsChecked then
skfmFlowGallery.StartingAngle := -1
else
skfmFlowGallery.StartingAngle := 0;
end;
procedure TfrmMain.CheckBox5Change(Sender: TObject);
begin
skfmFlowGallery.RotationAllowed := CheckBox5.IsChecked;
end;
procedure TfrmMain.CheckBox6Change(Sender: TObject);
begin
skfmFlowGallery.SmallPicVisible := CheckBox6.IsChecked;
end;
procedure TfrmMain.CheckBox7Change(Sender: TObject);
begin
skfmFlowGallery.ShowCaptions := CheckBox7.IsChecked;
end;
procedure TfrmMain.CheckBox8Change(Sender: TObject);
begin
skfmFlowGallery.CaptionOnHoverOnly := CheckBox8.IsChecked;
end;
procedure TfrmMain.CheckBox9Change(Sender: TObject);
begin
skfmFlowGallery.ShowSmallPicOnlyOnHover := CheckBox9.IsChecked;
end;
procedure TfrmMain.ComboBox1Change(Sender: TObject);
begin
{ Change Layout Strategy }
case Combobox1.ItemIndex of
0:
skfmFlowGallery.SetFlowLayout(flSorted);
1:
skfmFlowGallery.SetFlowLayout(flPlaceholder);
end;
end;
procedure TfrmMain.ComboBox2Change(Sender: TObject);
begin
{ Change Info Panel Animation Style }
case Combobox2.ItemIndex of
0:
skfmFlowGallery.InfoPanelAnimationStyle := iasBlurEdge;
1:
skfmFlowGallery.InfoPanelAnimationStyle := iasStatic;
2:
skfmFlowGallery.InfoPanelAnimationStyle := iasTransparent;
end;
end;
procedure TfrmMain.ComboBox3Change(Sender: TObject);
begin
{ Change Fullscreen Rotation Mode }
case Combobox3.ItemIndex of
0:
skfmFlowGallery.FullscreenAngle := fsa0;
1:
skfmFlowGallery.FullscreenAngle := fsa90;
2:
skfmFlowGallery.FullscreenAngle := fsa180;
3:
skfmFlowGallery.FullscreenAngle := fsa270;
end;
end;
procedure TfrmMain.ComboBox4Change(Sender: TObject);
begin
{ Change Info Panel Position }
case Combobox4.ItemIndex of
0:
skfmFlowGallery.InfoPanelDirection := ipdAuto;
1:
skfmFlowGallery.InfoPanelDirection := ipdTop;
2:
skfmFlowGallery.InfoPanelDirection := ipdBottom;
3:
skfmFlowGallery.InfoPanelDirection := ipdLeft;
4:
skfmFlowGallery.InfoPanelDirection := ipdRight;
end;
end;
procedure TfrmMain.ComboBox5Change(Sender: TObject);
begin
{ Change Info Panel Width Percentage }
case ComboBox5.ItemIndex of
0:
skfmFlowGallery.InfoPanelWidthPercent := 30 / 100;
1:
skfmFlowGallery.InfoPanelWidthPercent := 50 / 100;
2:
skfmFlowGallery.InfoPanelWidthPercent := 75 / 100;
end;
end;
procedure TfrmMain.ComboBox6Change(Sender: TObject);
begin
{ Change Background Effect }
case Combobox6.ItemIndex of
0:
skfmFlowGallery.BackgroundEffect := beRealMatrix;
1:
skfmFlowGallery.BackgroundEffect := beHolographic;
2:
skfmFlowGallery.BackgroundEffect := beFade;
3:
skfmFlowGallery.BackgroundEffect := beNeuralLinks;
end;
end;
procedure TfrmMain.SpinBox1Change(Sender: TObject);
begin
{ Generic handler for multiple settings using Radio Buttons to select target }
if not Assigned(skfmFlowGallery) then
Exit;
if rbAnimspeed.IsChecked then
skfmFlowGallery.AnimationSpeed := Round(SpinBox1.Value)
else if rbGlowwidth.IsChecked then
skfmFlowGallery.GlowWidth := Round(SpinBox1.Value)
else if rbHotwidth.IsChecked then
skfmFlowGallery.HotTrackWidth := Round(SpinBox1.Value)
else if rbFontsize.IsChecked then
skfmFlowGallery.CaptionFont.Size := SpinBox1.Value
else if rbCaptionAlpha.IsChecked then
skfmFlowGallery.CaptionAlpha := Round(SpinBox1.Value)
else if rbCaptionYOffset.IsChecked then
skfmFlowGallery.CaptionOffsetY := Round(SpinBox1.Value)
else if rbPagesize.IsChecked then
skfmFlowGallery.PageSize := Round(SpinBox1.Value)
else if rbstartingAngle.IsChecked then
skfmFlowGallery.StartingAngle := Round(SpinBox1.Value)
else if rbRoundEdges.IsChecked then
skfmFlowGallery.RoundEdges := Round(SpinBox1.Value)
else if rbRotateall.IsChecked then
skfmFlowGallery.PutAllToAngle(SpinBox1.Value)
else if rbtechbracketwidth.IsChecked then
skfmFlowGallery.TechBracketWidth := trunc(SpinBox1.Value)
else if rbRotateAllBy.IsChecked then
skfmFlowGallery.RotateAllBy(SpinBox1.Value)
else if rbmaxinternal.IsChecked then
skfmFlowGallery.MaxInternalPicSize := Trunc(SpinBox1.Value)
else if rbselectedalpha.IsChecked then
skfmFlowGallery.AlphaHotSelected := Trunc(SpinBox1.Value)
else if rbhotalpha.IsChecked then
skfmFlowGallery.AlphaHotPhase := Trunc(SpinBox1.Value)
else if rbalpha.IsChecked then
skfmFlowGallery.AlphaStatic := Trunc(SpinBox1.Value)
else if rbrotatesize.IsChecked then
skfmFlowGallery.RotateHandleSize := Trunc(SpinBox1.Value)
else if rbsmlpcmrg.IsChecked then
skfmFlowGallery.SmallpicMargin := Trunc(SpinBox1.Value)
else if rbmaxzoom.IsChecked then
skfmFlowGallery.MaxZoomSize := Trunc(SpinBox1.Value)
else if rbhotzoom.IsChecked then
skfmFlowGallery.HotZoomMaxFactor := Trunc(SpinBox1.Value)
else if rbfps.IsChecked then
skfmFlowGallery.TargetFPS := Trunc(SpinBox1.Value);
end;
procedure TfrmMain.ColorPicker1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
{ Applies the selected color to the property determined by the checked Radio Button }
if not Assigned(skfmFlowGallery) then
Exit;
if rbselfontcol.IsChecked then
skfmFlowGallery.SelectedCaptionColor := ColorPicker1.Color
else if rbfontcol.IsChecked then
skfmFlowGallery.CaptionColor := ColorPicker1.Color
else if rbselcapback.IsChecked then
skfmFlowGallery.SelectedCaptionBackground := ColorPicker1.Color
else if rbcapback.IsChecked then
skfmFlowGallery.CaptionBackground := ColorPicker1.Color
else if rbglowcol.IsChecked then
skfmFlowGallery.GlowColor := ColorPicker1.Color
else if rbhotcol.IsChecked then
skfmFlowGallery.HotTrackColor := ColorPicker1.Color
else if rbrotatedot.IsChecked then
skfmFlowGallery.RotateDotColor := ColorPicker1.Color
else if rbrotatedothot.IsChecked then
skfmFlowGallery.RotateDotHotColor := ColorPicker1.Color
else if rbrotatedotDown.IsChecked then
skfmFlowGallery.RotateDotDownColor := ColorPicker1.Color
else if rbparticle.IsChecked then
skfmFlowGallery.ParticleColor := ColorPicker1.Color
else if rbifoarrow.IsChecked then
skfmFlowGallery.InfoIndicatorColor := ColorPicker1.Color
else if rbinfhot.IsChecked then
skfmFlowGallery.InfoIndicatorHotColor := ColorPicker1.Color
else if rbborder.IsChecked then
skfmFlowGallery.ItemBorderColor := ColorPicker1.Color;
end;
{ *******************************************************************************
EVENT HANDLERS: FORM LIFECYCLE
******************************************************************************* }
procedure TfrmMain.FormCreate(Sender: TObject);
begin
{ Initial state setup }
lytcontrols.Visible := False;
Layout1.Visible := False;
LoadedWithParams := False;
FStreamFiles := TStringList.Create;
FStreamindex := 0;
{ Check if started with parameters (Slave Mode) }
if ParamCount >= 1 then
begin
borderstyle := TFmxFormBorderStyle.None;
ParamsTxtFile := ParamStr(1);
LoadedWithParams := True;
saiAnimatedLogo.Visible := False;
lytContent.Visible := True;
end
else
begin
{ Normal Mode (Show Intro) }
saiAnimatedLogo.Visible := True;
saiAnimatedLogo.BringToFront;
lytContent.Visible := False;
end;
end;
procedure TfrmMain.FormShow(Sender: TObject);
begin
{ Start Timer to initialize gallery after form is fully shown }
if Loadedwithparams then
Timer1.Enabled := True;
end;
procedure TfrmMain.saiAnimatedLogoAnimationFinished(Sender: TObject);
begin
{ Called when intro animation ends }
saiAnimatedLogo.Visible := False;
;
lytcontrols.Visible := not Loadedwithparams;
Layout1.Visible := not Loadedwithparams;
lytContent.Visible := True;
Fill.Color := TAlphaColors.Black;
fanFadeOutTransition.Enabled := True;
Timer1.Enabled := True;
end;
procedure TfrmMain.fanFadeOutTransitionFinish(Sender: TObject);
begin
saiAnimatedLogo.Visible := False;
end;
procedure TfrmMain.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
{ Initialize with either list file or default demo data }
if LoadedWithParams then
LoadFromTxtFile(ParamsTxtFile)
else
InitGallery;
end;
procedure TfrmMain.lytcontrolsResize(Sender: TObject);
begin
{ Adjust Max Zoom Size when control panel resizes }
if visible and assigned(skfmFlowGallery) then
skfmFlowGallery.MaxZoomSize := trunc(ClientHeight / 3);
end;
procedure TfrmMain.rbPagesizeMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
{ Enforce minimum page size to prevent errors }
if SpinBox1.Value < 10 then
SpinBox1.Value := 10;
end;
procedure TfrmMain.Rectangle1DblClick(Sender: TObject);
begin
{ Debug output }
ShowMessage(inttostr(skfmFlowGallery.ImageCount));
end;
{ *******************************************************************************
EVENT HANDLERS: CUSTOM CALLBACKS
******************************************************************************* }
procedure TfrmMain.OnTestButtonClick(Sender: TObject; Button: TFlowButton);
begin
{ Demonstrates TFlowButtonPanel event firing }
ShowMessage('You clicked button with ID: ' + Button.TagString);
FTestPanel.PanelHide;
end;
procedure TfrmMain.Flowmotion1SelectedImageEnterZone(Sender: TObject; ImageItem: TImageItem; const ZoneName: string);
begin
{ Demonstrates Activation Zones }
if ZoneName = 'ActivationZone 1' then
ShowMessage('Image entered ActivationZone 1! ');
end;
procedure TfrmMain.Onfullscreen(Sender: TObject; ImageItem: TImageItem; Index: Integer);
begin
ShowMessage('Fullscreen arrived');
end;
procedure TfrmMain.MouseWheel(Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean);
begin
inherited;
if not assigned(skfmFlowGallery) then Exit;
{ Map Mouse Wheel to Image Selection }
if WheelDelta > 0 then
skfmFlowGallery.SelectPreviousImage
else if WheelDelta < 0 then
skfmFlowGallery.SelectNextImage;
Handled := True;
end;
procedure TfrmMain.Flowmotion1SelectedImageDblClick(Sender: TObject; ImageItem: TImageItem; Index: Integer);
var
FolderPath: string;
begin
if (ImageItem = nil) or (ImageItem.Path = '') then
Exit;
FolderPath := ImageItem.Path;
{ If launched as a slave, send signal back to Master }
if Loadedwithparams then
begin
SendSignaltoPlayer(FolderPath);
Exit;
end;
{ Demo Logic: If path is dummy, just Zoom }
if (FolderPath = '') or (FolderPath = 'Folder or whatever') then
begin
skfmFlowGallery.ZoomSelectedToFull;
Exit;
end;
{ If valid folder, open Explorer }
if not DirectoryExists(FolderPath) then
FolderPath := ExtractFilePath(FolderPath);
if DirectoryExists(FolderPath) then
begin
ShellExecute(0, 'open', 'explorer.exe', PChar('/select,' + FolderPath), nil, 1);
skfmFlowGallery.DeselectZoomedImage;
end
else
ShowMessage('folder not found: ' + FolderPath);
end;
{ *******************************************************************************
NAVIGATION & CONTROL
******************************************************************************* }
procedure TfrmMain.Button1Click(Sender: TObject);
begin
skfmFlowGallery.SelectPreviousImage;
end;
procedure TfrmMain.Button20Click(Sender: TObject);
begin
Timer2.Enabled := not Timer2.Enabled;
if TImer2.Enabled then
begin
Button20.text := 'Show Mode on';
skfmFlowGallery.SelectNextImage;
end
else
Button20.text := 'Show Mode off';
end;
procedure TfrmMain.Button21Click(Sender: TObject);
begin
skfmFlowGallery.SendAliveHighlighterToImage(Random(skfmFlowGallery.ImageCount-1));
end;
procedure TfrmMain.Button22Click(Sender: TObject);
begin
skfmFlowGallery.ExitAliveHighlighter;
end;
procedure TfrmMain.Button23Click(Sender: TObject);
begin
{ Adds a single random image from AppDir using 'iesReplicatorLaser' entry animation }
skfmFlowGallery.ImageEntryStyle := iesReplicatorLaser;
skfmFlowGallery.AddImageAsync(ExtractFilePath(ParamStr(0)) + inttostr(random(13) + 1) + '.jpg');
end;
procedure TfrmMain.Button24Click(Sender: TObject);
begin
skfmFlowGallery.TriggerHotZoomWave(skfmFlowGallery.Width / 2, skfmFlowGallery.Height / 2, 400, 100);
end;
procedure TfrmMain.Button25Click(Sender: TObject);
begin
skfmFlowGallery.TriggerHotZoomItem(1);
end;
procedure TfrmMain.Button2Click(Sender: TObject);
begin
skfmFlowGallery.SelectNextImage;
end;
procedure TfrmMain.Button3Click(Sender: TObject);
begin
skfmFlowGallery.DeselectZoomedImage;
end;
procedure TfrmMain.Button4Click(Sender: TObject);
begin
{ Adds a single random image from AppDir using 'Point' entry animation }
skfmFlowGallery.ImageEntryStyle := iesFromPoint;
skfmFlowGallery.EntryPoint := Point(Round(Panel3.Position.X), Round(Panel3.Position.Y));
skfmFlowGallery.AddImageAsync(ExtractFilePath(ParamStr(0)) + inttostr(random(13) + 1) + '.jpg');
end; //AddImage AddImageAsync
procedure TfrmMain.Button5Click(Sender: TObject);
begin
skfmFlowGallery.Clear(true);
end;
procedure TfrmMain.Button6Click(Sender: TObject);
var
AppDir: string;
i: Integer;
IMList, Pathlist, Captionlist, Hintlist, InfosList: TStringList;
begin
{ Adds a batch of demo images with metadata }
AppDir := ExtractFilePath(ParamStr(0));
IMList := TStringList.create;
Pathlist := TStringList.create;
Captionlist := TStringList.create;
Hintlist := TStringList.create;
InfosList := TStringList.create;
skfmFlowGallery.MaxZoomSize := trunc(ClientHeight / 3);
try
{ Create two loops of demo data }
for i := 14 downto 0 do
begin
IMList.add(AppDir + inttostr(i) + '.jpg');
Pathlist.add('Folder or whatever');
Captionlist.add('Caption');
Hintlist.Add('Hint');
InfosList.Add('Movie infos or whatever you want to show here |.......... ......... ........... bit more to see if it works right... ...');
end;
for i := 0 to 14 do
begin
IMList.add(AppDir + inttostr(i) + '.jpg');
Pathlist.add('Folder or whatever');
Captionlist.add('Caption');
Hintlist.Add('Hint');
InfosList.Add('Movie infos or whatever you want to show here | ........... ......... ........... bit more to see if it works right.... ....');
end;
skfmFlowGallery.AddImagesAsync(IMList, Captionlist, Pathlist, Hintlist, InfosList);
finally //AddImages AddImagesAsync
InfosList.Free;
IMList.Free;
Pathlist.Free;
Captionlist.Free;
Hintlist.Free;
end;
end;
procedure TfrmMain.Button7Click(Sender: TObject);
begin
{ Set background image }
if Opendialog1.Execute then
skfmFlowGallery.SetBackgroundpicture(Opendialog1.FileName);
end;
procedure TfrmMain.Button8Click(Sender: TObject);
begin
{ Reset all image rotations to 0 }
skfmFlowGallery.ResetAllRotations;
end;
procedure TfrmMain.Button9Click(Sender: TObject);
var
i: Integer;
begin
{ 1. SET ENTRY POINT (Where images fly from) }
skfmFlowGallery.EntryPoint := Point(Round(Panel3.Position.X), Round(Panel3.Position.Y));
skfmFlowGallery.ImageEntryStyle := iesFromPoint;
{ 2. SHOW DIALOG (Ensure TOpenDialog1 has Options: [ofAllowMultiSelect]) }
if OpenDialog1.Execute then
begin
{ 3. ITERATE AND ADD IMAGES }
if OpenDialog1.Files.Count > 0 then
begin
for i := 0 to OpenDialog1.Files.Count - 1 do
begin
skfmFlowGallery.AddImageAsync(OpenDialog1.Files[i]);
end;
end;
end;
end;
procedure TfrmMain.CheckBox20Change(Sender: TObject);
begin
skfmFlowGallery.ShowInfoIndicatoralways := CheckBox20.IsChecked;
end;
procedure TfrmMain.CheckBox21Change(Sender: TObject);
begin
skfmFlowGallery.FreeFloat := CheckBox21.IsChecked;
end;
procedure TfrmMain.CheckBox22Change(Sender: TObject);
begin
skfmFlowGallery.InfoIndicatorOnlyOnHover := CheckBox22.IsChecked;
end;
procedure TfrmMain.CheckBox23Change(Sender: TObject);
begin
skfmFlowGallery.MitchellQuality := CheckBox23.IsChecked;
end;
procedure TfrmMain.CheckBox24Change(Sender: TObject);
begin
skfmFlowGallery.HighlighterAllowMoodSwings := CheckBox24.isChecked;
end;
procedure TfrmMain.FormResize(Sender: TObject);
begin
if visible and assigned(skfmFlowGallery) then
skfmFlowGallery.MaxZoomSize := trunc(ClientHeight / 3);
end;
procedure TfrmMain.skfmFlowGalleryMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
var
Item: TImageItem;
begin
{ Middle Click sends file to external player }
if Button = TMouseButton.mbMiddle then
begin
Item := skfmFlowGallery.GetImageAtPoint(X, Y);
if (Item <> nil) and (Item.Path <> '') then
begin
SendNextToPlayer(Item.Path);
skfmFlowGallery.DeselectZoomedImage;
end;
end;
end;
{ *******************************************************************************
INITIALIZATION
******************************************************************************* }
procedure TfrmMain.InitGallery;
var
AppDir: string;
FileName: string;
i, rndX: Integer;
IMList, Pathlist, Captionlist, Hintlist, Infoslist: TStringList;
smallimgindex: TList;
begin
AppDir := ExtractFilePath(ParamStr(0));
{ Ensure Gallery is created }
if skfmFlowGallery = nil then
begin
skfmFlowGallery := TSkFlowmotion.Create(Self);
skfmFlowGallery.Parent := lytContent;