File: doublecmd.diff

package info (click to toggle)
doublecmd 1.1.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 43,968 kB
  • sloc: pascal: 374,335; sh: 1,180; ansic: 724; makefile: 132; python: 52; xml: 16
file content (370 lines) | stat: -rw-r--r-- 10,306 bytes parent folder | download | duplicates (7)
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
Index: gifanim.pas
===================================================================
--- gifanim.pas	(revision none)
+++ gifanim.pas	(working copy)
@@ -26,7 +26,7 @@
 
 uses
   Classes, LCLProc, Lresources, SysUtils, Controls, Graphics, ExtCtrls,
-  IntfGraphics, FPimage, Contnrs, GraphType, dialogs;
+  IntfGraphics, FPimage, Contnrs, GraphType, dialogs, types;
 
 const
 
@@ -193,7 +193,7 @@
     procedure DoAutoSize; override;
     procedure DoStartAnim;
     procedure DoStopAnim;
-    class function GetControlClassDefaultSize: TPoint; override;
+    class function GetControlClassDefaultSize: TSize; override;
     procedure GifChanged;
     procedure LoadFromFile(const Filename: string); virtual;
     procedure Paint; override;
@@ -203,6 +203,8 @@
     { Public declarations }
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
+    procedure NextFrame;
+    procedure PriorFrame;
     property Empty: boolean Read FEmpty;
     property GifBitmaps: TGifList Read FGifBitmaps;
     property GifIndex: integer Read FCurrentImage;
@@ -237,28 +239,9 @@
 
 implementation
 
-uses LazIDEIntf, propedits;
-Type
-  TGifFileNamePropertyEditor=class(TFileNamePropertyEditor)
-  protected
-    function GetFilter: String; override;
-    function GetInitialDirectory: string; override;
-  end;
-function TGifFileNamePropertyEditor.GetFilter: String;
-begin
-  Result := 'GIF|*.gif';
-end;
-
-function TGifFileNamePropertyEditor.GetInitialDirectory: string;
-begin
-  Result:= ExtractFilePath(LazarusIDE.ActiveProject.ProjectInfoFile);
-end;
-
 procedure Register;
 begin
   RegisterComponents('Wile64', [TGifAnim]);
-  RegisterPropertyEditor(TypeInfo(String),
-    TGifAnim, 'FileName', TGifFileNamePropertyEditor);
 end;
 
 { TGifAnim }
@@ -268,7 +251,7 @@
   inherited Create(AOwner);
   ControlStyle := [csCaptureMouse, csClickEvents, csDoubleClicks];
   AutoSize     := True;
-  SetInitialBounds(0, 0, GetControlClassDefaultSize.X, GetControlClassDefaultSize.Y);
+  SetInitialBounds(0, 0, GetControlClassDefaultSize.CX, GetControlClassDefaultSize.CY);
   FEmpty      := True;
   FCurrentImage := 0;
   CurrentView := TBitmap.Create;
@@ -295,6 +278,59 @@
   CurrentView.Free;
 end;
 
+procedure TGifAnim.NextFrame;
+begin
+  if (not FEmpty) and Visible and (not FAnimate) then
+  begin
+    if FCurrentImage >= GifBitmaps.Count - 1 then
+      FCurrentImage := 0
+    else
+      Inc(FCurrentImage);
+    if Assigned(FOnFrameChanged) then
+      FOnFrameChanged(Self);
+    Repaint;
+  end;
+end;
+
+procedure TGifAnim.PriorFrame;
+var
+  DesiredImage: Integer;
+begin
+  if (not FEmpty) and Visible and (not FAnimate) then
+  begin
+    if FCurrentImage = 0 then
+      DesiredImage:= GifBitmaps.Count - 1
+    else
+      DesiredImage:= FCurrentImage - 1;
+    // For proper display repaint image from first frame to desired frame
+    FCurrentImage:= 0;
+    while FCurrentImage < DesiredImage do
+    begin
+      with GifBitmaps.Items[FCurrentImage] do
+        begin
+          BufferImg.Canvas.Brush.Color := (Self.Color);
+          if FCurrentImage = 0 then
+            BufferImg.Canvas.FillRect(Rect(0, 0, Width, Height));
+          if Delay <> 0 then
+            FWait.Interval := Delay * 10;
+          BufferImg.Canvas.Draw(PosX, PosY, Bitmap);
+          case Method of
+            //0 : Not specified...
+            //1 : No change Background
+            2: BufferImg.Canvas.FillRect(
+                Rect(PosX, PosY, Bitmap.Width + PosX, Bitmap.Height + PosY));
+
+            3: BufferImg.Canvas.FillRect(Rect(0, 0, Width, Height));
+          end;
+        end;
+      Inc(FCurrentImage);
+    end;
+    if Assigned(FOnFrameChanged) then
+      FOnFrameChanged(Self);
+    Repaint;
+  end;
+end;
+
 function TGifAnim.LoadFromLazarusResource(const ResName: String): boolean;
 var
   GifLoader: TGifLoader;
@@ -340,12 +376,13 @@
 begin
   if (not Empty) and Visible then
   begin
-    if FCurrentImage > GifBitmaps.Count - 1 then
-      FCurrentImage := 0;
-    if assigned(FOnFrameChanged) then
-      FOnFrameChanged(self);
-    Paint;
-    Inc(FCurrentImage);
+    if FCurrentImage >= GifBitmaps.Count - 1 then
+      FCurrentImage := 0
+    else
+      Inc(FCurrentImage);
+    if Assigned(FOnFrameChanged) then
+      FOnFrameChanged(Self);
+    Repaint;
   end;
 end;
 
@@ -365,27 +402,12 @@
 end;
 
 procedure TGifAnim.SetFileName(const AValue: string);
-var
-  fn: string;
 begin
-
-  if (FFileName = AValue) then
-    exit;
+  if (FFileName = AValue) then Exit;
   FFileName := AValue;
   ResetImage;
-  if (FFileName = '') then exit;
-  if (csDesigning in ComponentState) then
-  begin
-     fn:= ExtractFileName(AValue);
-     FFileName:= ExtractFilePath(AValue);
-     FFileName:= ExtractRelativepath(ExtractFilePath(LazarusIDE.ActiveProject.ProjectInfoFile) ,FFileName);
-     FFileName:=FFileName+fn;
-     LoadFromFile(FFileName+fn);
-  end
-  else begin
-     FFileName := AValue;
-     LoadFromFile(FFileName);
-  end;
+  if (FFileName = '') then Exit;
+  LoadFromFile(FFileName);
   if not Empty then
     GifChanged;
 end;
@@ -441,10 +463,10 @@
   end;
 end;
 
-class function TGifAnim.GetControlClassDefaultSize: TPoint;
+class function TGifAnim.GetControlClassDefaultSize: TSize;
 begin
-  Result.X := 90;
-  Result.Y := 90;
+  Result.CX := 90;
+  Result.CY := 90;
 end;
 
 procedure TGifAnim.GifChanged;
Index: gifanimdsgn.pas
===================================================================
--- gifanimdsgn.pas	(revision 0)
+++ gifanimdsgn.pas	(revision 0)
@@ -0,0 +1,41 @@
+unit GifAnimDsgn;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  LazIDEIntf, PropEdits;
+
+Type
+  TGifFileNamePropertyEditor = class(TFileNamePropertyEditor)
+  protected
+    function GetFilter: String; override;
+    function GetInitialDirectory: string; override;
+  end;
+
+procedure Register;
+
+implementation
+
+uses
+  SysUtils, GifAnim;
+
+function TGifFileNamePropertyEditor.GetFilter: String;
+begin
+  Result := 'GIF|*.gif';
+end;
+
+function TGifFileNamePropertyEditor.GetInitialDirectory: string;
+begin
+  Result:= ExtractFilePath(LazarusIDE.ActiveProject.ProjectInfoFile);
+end;
+
+procedure Register;
+begin
+  RegisterPropertyEditor(TypeInfo(String), TGifAnim,
+                         'FileName', TGifFileNamePropertyEditor);
+end;
+
+end.
+
Index: pkg_gifanim.lpk
===================================================================
--- pkg_gifanim.lpk	(revision none)
+++ pkg_gifanim.lpk	(working copy)
@@ -1,15 +1,21 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
-  <Package Version="3">
+  <Package Version="4">
     <PathDelim Value="\"/>
     <Name Value="pkg_gifanim"/>
+    <AddToProjectUsesSection Value="True"/>
     <Author Value="Laurent Jacques"/>
     <CompilerOptions>
-      <Version Value="8"/>
+      <Version Value="11"/>
       <PathDelim Value="\"/>
       <SearchPaths>
-        <OtherUnitFiles Value="$(LazarusDir)\ide\"/>
+        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
       </SearchPaths>
+      <Linking>
+        <Debugging>
+          <DebugInfoType Value="dsDwarf2Set"/>
+        </Debugging>
+      </Linking>
       <Other>
         <CompilerPath Value="$(CompPath)"/>
       </Other>
@@ -33,15 +39,16 @@
     <Type Value="RunAndDesignTime"/>
     <RequiredPkgs Count="2">
       <Item1>
-        <PackageName Value="FCL"/>
+        <PackageName Value="LCL"/>
         <MinVersion Major="1" Valid="True"/>
       </Item1>
       <Item2>
-        <PackageName Value="IDEIntf"/>
+        <PackageName Value="FCL"/>
+        <MinVersion Major="1" Valid="True"/>
       </Item2>
     </RequiredPkgs>
     <UsageOptions>
-      <UnitPath Value="$(PkgOutDir)\"/>
+      <UnitPath Value="$(PkgOutDir)"/>
     </UsageOptions>
     <PublishOptions>
       <Version Value="2"/>
Index: pkg_gifanim_dsgn.lpk
===================================================================
--- pkg_gifanim_dsgn.lpk	(revision 0)
+++ pkg_gifanim_dsgn.lpk	(revision 0)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+  <Package Version="4">
+    <PathDelim Value="\"/>
+    <Name Value="pkg_gifanim_dsgn"/>
+    <CompilerOptions>
+      <Version Value="11"/>
+      <PathDelim Value="\"/>
+      <SearchPaths>
+        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+      </SearchPaths>
+      <Linking>
+        <Debugging>
+          <DebugInfoType Value="dsDwarf2Set"/>
+        </Debugging>
+      </Linking>
+      <Other>
+        <CompilerMessages>
+          <MsgFileName Value=""/>
+        </CompilerMessages>
+        <CompilerPath Value="$(CompPath)"/>
+      </Other>
+    </CompilerOptions>
+    <License Value="GPL"/>
+    <Version Major="1" Minor="4"/>
+    <Files Count="1">
+      <Item1>
+        <Filename Value="gifanimdsgn.pas"/>
+        <HasRegisterProc Value="True"/>
+        <UnitName Value="GifAnimDsgn"/>
+      </Item1>
+    </Files>
+    <Type Value="DesignTime"/>
+    <RequiredPkgs Count="2">
+      <Item1>
+        <PackageName Value="IDEIntf"/>
+      </Item1>
+      <Item2>
+        <PackageName Value="pkg_gifanim"/>
+      </Item2>
+    </RequiredPkgs>
+    <UsageOptions>
+      <UnitPath Value="$(PkgOutDir)"/>
+    </UsageOptions>
+    <PublishOptions>
+      <Version Value="2"/>
+    </PublishOptions>
+  </Package>
+</CONFIG>
Index: pkg_gifanim_dsgn.pas
===================================================================
--- pkg_gifanim_dsgn.pas	(revision 0)
+++ pkg_gifanim_dsgn.pas	(revision 0)
@@ -0,0 +1,21 @@
+{ This file was automatically created by Lazarus. Do not edit!
+  This source is only used to compile and install the package.
+ }
+
+unit pkg_gifanim_dsgn;
+
+interface
+
+uses
+  GifAnimDsgn, LazarusPackageIntf;
+
+implementation
+
+procedure Register;
+begin
+  RegisterUnit('GifAnimDsgn', @GifAnimDsgn.Register);
+end;
+
+initialization
+  RegisterPackage('pkg_gifanim_dsgn', @Register);
+end.