-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathanimate.pas
767 lines (641 loc) · 19.8 KB
/
animate.pas
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
unit animate;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Buttons, ExtCtrls,
ComCtrls, Menus, StdCtrls, Arrow,AnimBase,animationexport,rmthumb,rwpng,
fileprops,rwspriteanim,rmcodegen,rmconfig,rmclipboard;
type
{ TAnimationForm }
TAnimationForm = class(TForm)
CurrentAnimationImageList: TImageList;
AnimThumbImageList: TImageList;
CopyMenu: TMenuItem;
AddFrameMenu: TMenuItem;
DeleteMenu: TMenuItem;
CopyFromThumbView: TMenuItem;
AnimDeleteMenu: TMenuItem;
Image1: TImage;
Image2: TImage;
MainMenu1: TMainMenu;
MenuItem1: TMenuItem;
MenuItem10: TMenuItem;
MenuItem11: TMenuItem;
MenuDeleteAll: TMenuItem;
AnimProperties: TMenuItem;
MenuItem12: TMenuItem;
MenuItem13: TMenuItem;
ExportCAnimArray: TMenuItem;
MenuItem15: TMenuItem;
ExportEmscriptenAnimArray: TMenuItem;
ExportPascalAnimArray: TMenuItem;
FileExportBasicData: TMenuItem;
ExportBasicAnimData: TMenuItem;
pascal: TMenuItem;
MenuItem17: TMenuItem;
ExportgccAnimArray: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
MenuItem5: TMenuItem;
MenuItem6: TMenuItem;
MenuItem7: TMenuItem;
MenuItem8: TMenuItem;
MenuItem9: TMenuItem;
NewAnimationMenu: TMenuItem;
OpenDialog1: TOpenDialog;
Panel1: TPanel;
PasteMenu: TMenuItem;
PopupMenu1: TPopupMenu;
PopupMenu2: TPopupMenu;
PopupMenu3: TPopupMenu;
SaveDialog1: TSaveDialog;
SelectDirectoryDialog1: TSelectDirectoryDialog;
SpriteListView: TListView;
CurrentAnimListView: TListView;
AllAnimListView: TListView;
LeftPanel: TPanel;
MiddlePanel: TPanel;
RightPanel: TPanel;
Timer1: TTimer;
TopSplitter: TSplitter;
LeftSplitter: TSplitter;
RightSplitter: TSplitter;
FPSTrackBar: TTrackBar;
procedure AddFrameMenuClick(Sender: TObject);
procedure AllAnimListViewClick(Sender: TObject);
procedure AllAnimListViewShowHint(Sender: TObject; HintInfo: PHintInfo);
procedure AnimDeleteMenuClick(Sender: TObject);
procedure AnimPropertiesClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure CopyFromThumbViewClick(Sender: TObject);
procedure CopyMenuClick(Sender: TObject);
procedure CurrentAnimListViewDragDrop(Sender, Source: TObject; X, Y: Integer
);
procedure CurrentAnimListViewDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
procedure DeleteMenuClick(Sender: TObject);
procedure ExportBasicAnimDataClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure AnimExportMenuClick(Sender: TObject);
procedure AnimCopyMenuClick(Sender: TObject);
procedure AnimPasteMenuClick(Sender: TObject);
procedure MenuDeleteAllClick(Sender: TObject);
procedure MenuItem10Click(Sender: TObject);
procedure MenuItem11Click(Sender: TObject);
procedure ExportEmscriptenAnimArrayClick(Sender: TObject);
procedure FileExportPascalArrayClick(Sender: TObject);
procedure MenuItem2Click(Sender: TObject);
procedure MenuItem3Click(Sender: TObject);
procedure MenuItem9Click(Sender: TObject);
procedure NewAnimationMenuClick(Sender: TObject);
procedure PasteMenuClick(Sender: TObject);
procedure PlayButtonClick(Sender: TObject);
procedure SpriteListViewDblClick(Sender: TObject);
procedure SpriteListViewDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure SpriteListViewDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure StopButtonClick(Sender: TObject);
procedure Timer1StartTimer(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FPSTrackBarChange(Sender: TObject);
private
public
AnimFrameCounter : integer;
FPSDelay : integer;
procedure LoadImageThumbList;
procedure LoadCurrentAnimList;
procedure LoadAnimThumbList;
procedure AddFrame(ImageIndex : integer);
procedure InsertFrame(FrameIndex,ImageIndex : integer);
procedure MoveFrame(FromFrameIndex,ToFrameIndex : integer);
procedure DeleteFrame(ImageIndex : integer);
procedure AddEmptyFrame;
procedure AddAnimation;
procedure DeleteAnimation(AnimationIndex : integer);
procedure DeleteAll;
procedure SelectAnimation(AnimationIndex : integer);
function ExportTextFileToClipboard(Sender: TObject) : boolean;
end;
var
AnimationForm: TAnimationForm;
implementation
uses rmmain;
{$R *.lfm}
{ TAnimationForm }
procedure TAnimationForm.FormCreate(Sender: TObject);
begin
FPSDelay:=1000 Div FPSTrackBar.Position;
end;
procedure TAnimationForm.AnimExportMenuClick(Sender: TObject);
var
PngRGBA : PngRGBASettingsRec;
FileName : String;
i : integer;
ImageIndex : integer;
count : integer;
begin
//ImageThumbBase.CopyCoreToIndexImage(ImageThumbBase.GetCurrent);
count:=0;
FilePropertiesDialog.GetProps(PngRGBA);
if SelectDirectoryDialog1.Execute then
begin
for i:=0 to AnimateBase.GetFrameCount-1 do
begin
ImageIndex:=AnimateBase.GetImageIndex(i);
inc(count);
FileName:=IncludeTrailingPathDelimiter(SelectDirectoryDialog1.filename)+'Animation'+IntToStr(count)+'.png';
SaveFromThumbAsPNG(ImageIndex,FileName,PngRGBA);
end;
end;
end;
procedure TAnimationForm.AnimCopyMenuClick(Sender: TObject);
var
index : integer;
begin
if SpriteListView.ItemIndex > -1 then
begin
index:=SpriteListView.ItemIndex;
if index > -1 then AnimateBase.CopyToClipBoard(index,ImageThumbBase.GetUID(index));
end
else if CurrentAnimListView.ItemIndex > -1 then
begin
index:=CurrentAnimListView.ItemIndex;
if index > -1 then AnimateBase.CopyToClipBoard(AnimateBase.GetImageIndex(index),AnimateBase.GetUID(index));
end
else if AllAnimListView.ItemIndex > -1 then
begin
end;
end;
procedure TAnimationForm.AnimPasteMenuClick(Sender: TObject);
var
index : integer;
ImageIndex : integer;
uid : TGUID;
begin
index:=CurrentAnimListView.ItemIndex;
if index > -1 then
begin
if AnimateBase.GetClipBoardStatus then
begin
AnimateBase.PasteFromClipBoard(ImageIndex,uid);
AnimateBase.ChangeFrame(index,ImageIndex,uid);
//add code to check if image still exists - it may have been deleted since it was copied to clipboard
CurrentAnimListView.Items[index].ImageIndex:=ImageIndex;
end;
end;
end;
procedure TAnimationForm.MenuDeleteAllClick(Sender: TObject);
begin
DeleteAll;
end;
procedure TAnimationForm.MenuItem10Click(Sender: TObject);
begin
AddEmptyFrame;
end;
procedure TAnimationForm.MenuItem2Click(Sender: TObject);
begin
OpenDialog1.Filter := 'RM Animation Files|*.rma|All Files|*.*';
if OpenDialog1.Execute then
begin
AnimateBase.Open(OpenDialog1.FileName);
LoadCurrentAnimList;
LoadAnimThumbList;
CurrentAnimListView.Repaint;
AllAnimListView.Repaint;
end;
end;
procedure TAnimationForm.MenuItem3Click(Sender: TObject);
begin
SaveDialog1.Filter := 'RM Animation Files|*.rma|All Files|*.*';
if SaveDialog1.Execute then
begin
AnimateBase.Save(SaveDialog1.FileName);
end;
end;
procedure TAnimationForm.MenuItem9Click(Sender: TObject);
begin
AddAnimation;
end;
procedure TAnimationForm.AddAnimation;
begin
AnimateBase.AddAnimation;
AnimateBase.SetCurrentAnimation(AnimateBase.GetAnimationCount-1); //animation will be added to end of list - switch to that
LoadCurrentAnimList;
LoadAnimThumbList;
CurrentAnimListView.Repaint;
AllAnimListView.Repaint;
end;
procedure TAnimationForm.DeleteAnimation(AnimationIndex : integer);
begin
AnimateBase.DeleteAnimation(AnimationIndex);
LoadCurrentAnimList;
LoadAnimThumbList;
CurrentAnimListView.Repaint;
AllAnimListView.Repaint;
end;
procedure TAnimationForm.MenuItem11Click(Sender: TObject);
var
index : integer;
begin
index:=CurrentAnimListView.ItemIndex;
if index > -1 then DeleteFrame(Index);
index:=AllAnimListView.ItemIndex;
if index > -1 then DeleteAnimation(Index);
end;
procedure TAnimationForm.ExportEmscriptenAnimArrayClick(Sender: TObject);
begin
if ExportTextFileToClipboard(Sender) then exit;
SaveDialog1.Filter := 'C Source Files|*.c|C Header Files|*.h|All Files|*.*';
if SaveDialog1.Execute then
begin
ExportAnimation(SaveDialog1.FileName,cLan);
end;
end;
procedure TAnimationForm.FileExportPascalArrayClick(Sender: TObject);
begin
if ExportTextFileToClipboard(Sender) then exit;
SaveDialog1.Filter := 'Pascal Source Files|*.pas|Pascal Include Files|*.inc|All Files|*.*';
if SaveDialog1.Execute then
begin
ExportAnimation(SaveDialog1.FileName,PascalLan);
end;
end;
procedure TAnimationForm.ExportBasicAnimDataClick(Sender: TObject);
begin
if ExportTextFileToClipboard(Sender) then exit;
SaveDialog1.Filter := 'Basic Source Files|*.bas|Basic Include Files|*.bi|All Files|*.*';
if SaveDialog1.Execute then
begin
ExportAnimation(SaveDialog1.FileName,PascalLan);
end;
end;
function TAnimationForm.ExportTextFileToClipboard(Sender: TObject) : boolean;
var
filename : string;
begin
if rmconfigbase.GetExportTextFileToClipStatus = false then
begin
result:=false;
exit;
end;
filename:=GetTemporaryPathAndFileName;
Case (Sender As TMenuItem).Name of 'ExportBasicAnimData':ExportAnimation(FileName,BasicLan);
'ExportBasicLNAnimData':ExportAnimation(FileName,BasicLNLan);
'ExportCAnimArray','ExportEmscriptenAnimArray','ExportgccAnimArray': ExportAnimation(FileName,CLan);
'ExportPascalAnimArray':ExportAnimation(FileName,PascalLan);
else
result:=false; //did not find a supported format return false
exit;
End;
result:=true; //found supported format - return true
ReadFileAndCopyToClipboard(filename);
EraseFile(filename);
ShowMessage('Exported to Clipboard!');
end;
procedure TAnimationForm.AnimDeleteMenuClick(Sender: TObject);
var
index : integer;
begin
index:=AllAnimListView.ItemIndex;
if index > -1 then DeleteAnimation(index);
end;
procedure TAnimationForm.DeleteAll;
begin
// AnimateBase.DeleteAll;
AnimateBase.InitAnimation;
LoadCurrentAnimList;
LoadAnimThumbList;
CurrentAnimListView.Repaint;
AllAnimListView.Repaint;
end;
procedure TAnimationForm.SelectAnimation(AnimationIndex : integer);
begin
AnimateBase.SetCurrentAnimation(AnimationIndex);
LoadCurrentAnimList;
LoadAnimThumbList;
CurrentAnimListView.Repaint;
AllAnimListView.Repaint;
end;
procedure TAnimationForm.NewAnimationMenuClick(Sender: TObject);
begin
AddAnimation;
end;
procedure TAnimationForm.PasteMenuClick(Sender: TObject);
var
index,ImageIndex : integer;
uid : TGUID;
begin
index:=CurrentAnimListView.ItemIndex;
if index > -1 then
begin
if AnimateBase.GetClipBoardStatus then
begin
AnimateBase.PasteFromClipBoard(ImageIndex,uid);
AnimateBase.ChangeFrame(index,ImageIndex,uid);
//add code to check if image still exists - it may have been deleted since it was copied to clipboard
CurrentAnimListView.Items[index].ImageIndex:=ImageIndex;
end;
end
else //if paste in area where there is no empty frame or other image
begin
if AnimateBase.GetClipBoardStatus then
begin
AnimateBase.PasteFromClipBoard(ImageIndex,uid);
AddFrame(ImageIndex);
end;
end;
end;
procedure TAnimationForm.PlayButtonClick(Sender: TObject);
begin
Timer1.Enabled:=true;
end;
procedure TAnimationForm.SpriteListViewDblClick(Sender: TObject);
begin
// ShowMessage(IntToStr((Sender as TListView).ItemIndex));
AddFrame((Sender as TListView).ItemIndex);
end;
procedure TAnimationForm.LoadCurrentAnimList;
var
ImageCount,i : integer;
MEBitMap : TBitMap; //missing extra bitmap
FoundImage : integer;
begin
CurrentAnimationImageList.Clear;
CurrentAnimationImageList.Width:=128;
CurrentAnimationImageList.Height:=128;
CurrentAnimationImageList.AddImages(RmMainForm.ImageList1);
MEBitMap:=TBitMap.Create;
MEBitMap.SetSize(128,128);
MEBitMap.Canvas.FillRect(0,0,127,127);
CurrentAnimationImageList.Add(MEBitMap,nil);
MEBitMap.Free;
ImageCount:=AnimateBase.GetFrameCount;
CurrentAnimListView.Clear;
for i:=0 to ImageCount-1 do
begin
CurrentAnimListView.AddItem('Frame '+IntToStr(i+1), self);
if IsEqualGUID(AnimateBase.GetUID(i),ImageThumbBase.GetUID(i)) then //verify that image still exist
begin
CurrentAnimListView.Items[i].ImageIndex:=AnimateBase.GetImageIndex(i);
end
else
begin
FoundImage:=ImageThumbBase.FindUID(AnimateBase.GetUID(i));
if FoundImage<>-1 then
begin
AnimateBase.ChangeFrame(i,FoundImage,AnimateBase.GetUID(i));
CurrentAnimListView.Items[i].ImageIndex:=AnimateBase.GetImageIndex(i);
end
else
begin
//CreateGUID(uid);
//AnimateBase.ChangeFrame(i,-1,uid);
CurrentAnimListView.Items[i].ImageIndex:=CurrentAnimationImageList.Count-1;
end;
end;
end;
end;
procedure TAnimationForm.LoadImageThumbList;
var
ImageCount,i : integer;
begin
SpriteListView.Items.Clear;
ImageCount:=ImageThumbBase.GetCount;
for i:=0 to ImageCount-1 do
begin
SpriteListView.AddItem('Image '+IntToStr(i+1), self);
SpriteListView.Items[i].ImageIndex:=i;
end;
CurrentAnimationImageList.Clear;
CurrentAnimationImageList.Width:=128;
CurrentAnimationImageList.Height:=128;
CurrentAnimationImageList.AddImages(RMMainForm.ImageList1);
end;
procedure TAnimationForm.LoadAnimThumbList;
var
AnimCount,i : integer;
begin
AnimThumbImageList.Clear;
AnimThumbImageList.Width:=128;
AnimThumbImageList.Height:=128;
AnimThumbImageList.AddImages(CurrentAnimationImageList);
AllAnimListView.Items.Clear;
AnimCount:=AnimateBase.GetAnimationCount;
for i:=0 to AnimCount-1 do
begin
AllAnimListView.AddItem('Animation '+IntToStr(i+1), self);
if AnimateBase.GetImageIndex(i,0) <> -1 then
AllAnimListView.Items[i].ImageIndex:=AnimateBase.GetImageIndex(i,0)
else
AllAnimListView.Items[i].ImageIndex:=AnimThumbImageList.Count-1; //empty frame icon
end;
end;
procedure TAnimationForm.SpriteListViewDragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
end;
procedure TAnimationForm.SpriteListViewDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
end;
procedure TAnimationForm.StopButtonClick(Sender: TObject);
begin
Timer1.Enabled:=false;
end;
procedure TAnimationForm.Timer1StartTimer(Sender: TObject);
begin
AnimFrameCounter:=0;
end;
procedure TAnimationForm.Timer1Timer(Sender: TObject);
var
ImageIndex : integer;
begin
inc(AnimFrameCounter);
if AnimFrameCounter > AnimateBase.GetFrameCount then
begin
AnimFrameCounter:=1;
end;
if AnimateBase.GetFrameCount > 0 then
begin
ImageIndex:=AnimateBase.GetImageIndex(AnimFrameCounter-1);
CurrentAnimationImageList.Draw(Panel1.Canvas,10,10,ImageIndex,true);
end;
end;
procedure TAnimationForm.FPSTrackBarChange(Sender: TObject);
begin
FPSDelay:=1000 div FPSTrackBar.Position;
Timer1.Interval:=FPSDelay;
end;
procedure TAnimationForm.FormActivate(Sender: TObject);
begin
LoadImageThumbList;
LoadCurrentAnimList;
LoadAnimThumbList;
SpriteListView.Repaint;
CurrentAnimListView.Repaint;
AllAnimListView.Repaint;
end;
procedure TAnimationForm.AddFrame(ImageIndex : integer);
var
uid : TGUID;
begin
uid:=ImageThumbBase.GetUID(ImageIndex);
AnimateBase.AddFrame(ImageIndex,uid);
LoadCurrentAnimList;
CurrentAnimListView.Repaint;
LoadAnimThumbList;
AllAnimListView.Repaint;
end;
procedure TAnimationForm.AddEmptyFrame;
var
uid : TGUID;
begin
AnimateBase.AddFrame(-1,uid);
LoadCurrentAnimList;
CurrentAnimListView.Repaint;
LoadAnimThumbList;
AllAnimListView.Repaint;
end;
procedure TAnimationForm.DeleteFrame(ImageIndex : integer);
begin
AnimateBase.DeleteFrame(ImageIndex);
LoadCurrentAnimList;
CurrentAnimListView.Repaint;
LoadAnimThumbList;
AllAnimListView.Repaint;
end;
procedure TAnimationForm.InsertFrame(FrameIndex,ImageIndex : integer);
var
uid : TGUID;
begin
uid:=ImageThumbBase.GetUID(ImageIndex);
AnimateBase.InsertFrame(FrameIndex, ImageIndex,uid);
LoadCurrentAnimList;
CurrentAnimListView.Repaint;
if FrameIndex = 0 then
begin
LoadAnimThumbList;
AllAnimListView.Repaint;
end;
end;
procedure TAnimationForm.MoveFrame(FromFrameIndex,ToFrameIndex : integer);
begin
if FromFrameIndex <> ToFrameIndex then
begin
AnimateBase.MoveFrame(FromFrameIndex, ToFrameIndex);
LoadCurrentAnimList;
CurrentAnimListView.Repaint;
if ToFrameIndex = 0 then
begin
LoadAnimThumbList;
AllAnimListView.Repaint;
end;
end;
end;
procedure TAnimationForm.CurrentAnimListViewDragDrop(Sender, Source: TObject;
X, Y: Integer);
var
index,destindex : integer;
item : TListItem;
begin
destindex:=-1;
index:=(Source as TListView).ItemIndex;
// showMessage(IntToStr(index));
item:=CurrentAnimListView.GetItemAt(x,y);
if assigned(item) then
begin
destindex:=item.Index;
end;
if Source = Sender then //Move Frame
begin
if destindex > -1 then
begin
MoveFrame(index,destindex);
//ShowMessage('Move: '+IntToStr(destindex)+' '+IntToStr(index));
end;
end
else
begin
if (destindex <> -1) and (AnimateBase.GetFrameCount > 0) then
begin
//ShowMessage('Dest:'+IntToStr(destindex)+' Image Index:'+IntTostr(index));
InsertFrame(destindex,index);
end
else AddFrame(index);
end;
end;
procedure TAnimationForm.CurrentAnimListViewDragOver(Sender, Source: TObject;
X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
end;
procedure TAnimationForm.AllAnimListViewShowHint(Sender: TObject;
HintInfo: PHintInfo);
begin
// (Sender As TListView).Hint:='New Hint';
end;
procedure TAnimationForm.AnimPropertiesClick(Sender: TObject);
var
EO : AnimExportFormatRec;
index : integer;
begin
index:=AllAnimListView.ItemIndex;
if index = -1 then exit;
AnimateBase.GetAnimExportProps(index,EO);
AnimationExportForm.InitComboBoxes;
AnimationExportForm.SetExportProps(EO);
if AnimationExportForm.ShowModal = mrOK then
begin
AnimationExportForm.GetExportProps(EO);
AnimateBase.SetAnimExportProps(index,EO);
end;
end;
procedure TAnimationForm.Button1Click(Sender: TObject);
begin
// Panel1.Canvas.Draw(10,10,AnimThumbImageList.
// CurrentAnimationImageList.bkColor:=RGBToColor(0,0,0);
CurrentAnimationImageList.BlendColor:=RGBToColor(0,0,0);
CurrentAnimationImageList.Draw(Panel1.Canvas,10,10,0,true);
end;
procedure TAnimationForm.AddFrameMenuClick(Sender: TObject);
begin
AddEmptyFrame;
end;
procedure TAnimationForm.AllAnimListViewClick(Sender: TObject);
var
index : integer;
begin
index:=(Sender As TListView).ItemIndex;
if (index > -1) and (index<>AnimateBase.GetCurrentAnimation) then SelectAnimation(index);
end;
procedure TAnimationForm.CopyFromThumbViewClick(Sender: TObject);
var
index : integer;
begin
index:=SpriteListView.ItemIndex;
if index > -1 then AnimateBase.CopyToClipBoard(index,ImageThumbBase.GetUID(index));
end;
procedure TAnimationForm.CopyMenuClick(Sender: TObject);
var
index : integer;
begin
index:=CurrentAnimListView.ItemIndex;
if index > -1 then
begin
if AnimateBase.GetImageIndex(index) > -1 then //prevent copying empty frame - just use add frame
begin
AnimateBase.CopyToClipBoard(AnimateBase.GetImageIndex(index),AnimateBase.GetUID(index));
end;
end;
// info.Caption:='Copy: '+IntToStr(index)+' '+IntToStr(AnimateBase.GetImageIndex(index));
end;
procedure TAnimationForm.DeleteMenuClick(Sender: TObject);
var
index : integer;
begin
index:=CurrentAnimListView.ItemIndex;
// info.Caption:='Delete: '+IntToStr(index)+' '+IntToStr(AnimateBase.GetImageIndex(index));
if index > -1 then DeleteFrame(Index);
end;
end.