Debian Codegraph @

components/gifanim/doublecmd.diff

raw
1 Index: gifanim.pas
2 ===================================================================
3 --- gifanim.pas (revision none)
4 +++ gifanim.pas (working copy)
5 @@ -26,7 +26,7 @@
6
7 uses
8 Classes, LCLProc, Lresources, SysUtils, Controls, Graphics, ExtCtrls,
9 - IntfGraphics, FPimage, Contnrs, GraphType, dialogs;
10 + IntfGraphics, FPimage, Contnrs, GraphType, dialogs, types;
11
12 const
13
14 @@ -193,7 +193,7 @@
15 procedure DoAutoSize; override;
16 procedure DoStartAnim;
17 procedure DoStopAnim;
18 - class function GetControlClassDefaultSize: TPoint; override;
19 + class function GetControlClassDefaultSize: TSize; override;
20 procedure GifChanged;
21 procedure LoadFromFile(const Filename: string); virtual;
22 procedure Paint; override;
23 @@ -203,6 +203,8 @@
24 { Public declarations }
25 constructor Create(AOwner: TComponent); override;
26 destructor Destroy; override;
27 + procedure NextFrame;
28 + procedure PriorFrame;
29 property Empty: boolean Read FEmpty;
30 property GifBitmaps: TGifList Read FGifBitmaps;
31 property GifIndex: integer Read FCurrentImage;
32 @@ -237,28 +239,9 @@
33
34 implementation
35
36 -uses LazIDEIntf, propedits;
37 -Type
38 - TGifFileNamePropertyEditor=class(TFileNamePropertyEditor)
39 - protected
40 - function GetFilter: String; override;
41 - function GetInitialDirectory: string; override;
42 - end;
43 -function TGifFileNamePropertyEditor.GetFilter: String;
44 -begin
45 - Result := 'GIF|*.gif';
46 -end;
47 -
48 -function TGifFileNamePropertyEditor.GetInitialDirectory: string;
49 -begin
50 - Result:= ExtractFilePath(LazarusIDE.ActiveProject.ProjectInfoFile);
51 -end;
52 -
53 procedure Register;
54 begin
55 RegisterComponents('Wile64', [TGifAnim]);
56 - RegisterPropertyEditor(TypeInfo(String),
57 - TGifAnim, 'FileName', TGifFileNamePropertyEditor);
58 end;
59
60 { TGifAnim }
61 @@ -268,7 +251,7 @@
62 inherited Create(AOwner);
63 ControlStyle := [csCaptureMouse, csClickEvents, csDoubleClicks];
64 AutoSize := True;
65 - SetInitialBounds(0, 0, GetControlClassDefaultSize.X, GetControlClassDefaultSize.Y);
66 + SetInitialBounds(0, 0, GetControlClassDefaultSize.CX, GetControlClassDefaultSize.CY);
67 FEmpty := True;
68 FCurrentImage := 0;
69 CurrentView := TBitmap.Create;
70 @@ -295,6 +278,59 @@
71 CurrentView.Free;
72 end;
73
74 +procedure TGifAnim.NextFrame;
75 +begin
76 + if (not FEmpty) and Visible and (not FAnimate) then
77 + begin
78 + if FCurrentImage >= GifBitmaps.Count - 1 then
79 + FCurrentImage := 0
80 + else
81 + Inc(FCurrentImage);
82 + if Assigned(FOnFrameChanged) then
83 + FOnFrameChanged(Self);
84 + Repaint;
85 + end;
86 +end;
87 +
88 +procedure TGifAnim.PriorFrame;
89 +var
90 + DesiredImage: Integer;
91 +begin
92 + if (not FEmpty) and Visible and (not FAnimate) then
93 + begin
94 + if FCurrentImage = 0 then
95 + DesiredImage:= GifBitmaps.Count - 1
96 + else
97 + DesiredImage:= FCurrentImage - 1;
98 + // For proper display repaint image from first frame to desired frame
99 + FCurrentImage:= 0;
100 + while FCurrentImage < DesiredImage do
101 + begin
102 + with GifBitmaps.Items[FCurrentImage] do
103 + begin
104 + BufferImg.Canvas.Brush.Color := (Self.Color);
105 + if FCurrentImage = 0 then
106 + BufferImg.Canvas.FillRect(Rect(0, 0, Width, Height));
107 + if Delay <> 0 then
108 + FWait.Interval := Delay * 10;
109 + BufferImg.Canvas.Draw(PosX, PosY, Bitmap);
110 + case Method of
111 + //0 : Not specified...
112 + //1 : No change Background
113 + 2: BufferImg.Canvas.FillRect(
114 + Rect(PosX, PosY, Bitmap.Width + PosX, Bitmap.Height + PosY));
115 +
116 + 3: BufferImg.Canvas.FillRect(Rect(0, 0, Width, Height));
117 + end;
118 + end;
119 + Inc(FCurrentImage);
120 + end;
121 + if Assigned(FOnFrameChanged) then
122 + FOnFrameChanged(Self);
123 + Repaint;
124 + end;
125 +end;
126 +
127 function TGifAnim.LoadFromLazarusResource(const ResName: String): boolean;
128 var
129 GifLoader: TGifLoader;
130 @@ -340,12 +376,13 @@
131 begin
132 if (not Empty) and Visible then
133 begin
134 - if FCurrentImage > GifBitmaps.Count - 1 then
135 - FCurrentImage := 0;
136 - if assigned(FOnFrameChanged) then
137 - FOnFrameChanged(self);
138 - Paint;
139 - Inc(FCurrentImage);
140 + if FCurrentImage >= GifBitmaps.Count - 1 then
141 + FCurrentImage := 0
142 + else
143 + Inc(FCurrentImage);
144 + if Assigned(FOnFrameChanged) then
145 + FOnFrameChanged(Self);
146 + Repaint;
147 end;
148 end;
149
150 @@ -365,27 +402,12 @@
151 end;
152
153 procedure TGifAnim.SetFileName(const AValue: string);
154 -var
155 - fn: string;
156 begin
157 -
158 - if (FFileName = AValue) then
159 - exit;
160 + if (FFileName = AValue) then Exit;
161 FFileName := AValue;
162 ResetImage;
163 - if (FFileName = '') then exit;
164 - if (csDesigning in ComponentState) then
165 - begin
166 - fn:= ExtractFileName(AValue);
167 - FFileName:= ExtractFilePath(AValue);
168 - FFileName:= ExtractRelativepath(ExtractFilePath(LazarusIDE.ActiveProject.ProjectInfoFile) ,FFileName);
169 - FFileName:=FFileName+fn;
170 - LoadFromFile(FFileName+fn);
171 - end
172 - else begin
173 - FFileName := AValue;
174 - LoadFromFile(FFileName);
175 - end;
176 + if (FFileName = '') then Exit;
177 + LoadFromFile(FFileName);
178 if not Empty then
179 GifChanged;
180 end;
181 @@ -441,10 +463,10 @@
182 end;
183 end;
184
185 -class function TGifAnim.GetControlClassDefaultSize: TPoint;
186 +class function TGifAnim.GetControlClassDefaultSize: TSize;
187 begin
188 - Result.X := 90;
189 - Result.Y := 90;
190 + Result.CX := 90;
191 + Result.CY := 90;
192 end;
193
194 procedure TGifAnim.GifChanged;
195 Index: gifanimdsgn.pas
196 ===================================================================
197 --- gifanimdsgn.pas (revision 0)
198 +++ gifanimdsgn.pas (revision 0)
199 @@ -0,0 +1,41 @@
200 +unit GifAnimDsgn;
201 +
202 +{$mode objfpc}{$H+}
203 +
204 +interface
205 +
206 +uses
207 + LazIDEIntf, PropEdits;
208 +
209 +Type
210 + TGifFileNamePropertyEditor = class(TFileNamePropertyEditor)
211 + protected
212 + function GetFilter: String; override;
213 + function GetInitialDirectory: string; override;
214 + end;
215 +
216 +procedure Register;
217 +
218 +implementation
219 +
220 +uses
221 + SysUtils, GifAnim;
222 +
223 +function TGifFileNamePropertyEditor.GetFilter: String;
224 +begin
225 + Result := 'GIF|*.gif';
226 +end;
227 +
228 +function TGifFileNamePropertyEditor.GetInitialDirectory: string;
229 +begin
230 + Result:= ExtractFilePath(LazarusIDE.ActiveProject.ProjectInfoFile);
231 +end;
232 +
233 +procedure Register;
234 +begin
235 + RegisterPropertyEditor(TypeInfo(String), TGifAnim,
236 + 'FileName', TGifFileNamePropertyEditor);
237 +end;
238 +
239 +end.
240 +
241 Index: pkg_gifanim.lpk
242 ===================================================================
243 --- pkg_gifanim.lpk (revision none)
244 +++ pkg_gifanim.lpk (working copy)
245 @@ -1,15 +1,21 @@
246 -<?xml version="1.0"?>
247 +<?xml version="1.0" encoding="UTF-8"?>
248 <CONFIG>
249 - <Package Version="3">
250 + <Package Version="4">
251 <PathDelim Value="\"/>
252 <Name Value="pkg_gifanim"/>
253 + <AddToProjectUsesSection Value="True"/>
254 <Author Value="Laurent Jacques"/>
255 <CompilerOptions>
256 - <Version Value="8"/>
257 + <Version Value="11"/>
258 <PathDelim Value="\"/>
259 <SearchPaths>
260 - <OtherUnitFiles Value="$(LazarusDir)\ide\"/>
261 + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
262 </SearchPaths>
263 + <Linking>
264 + <Debugging>
265 + <DebugInfoType Value="dsDwarf2Set"/>
266 + </Debugging>
267 + </Linking>
268 <Other>
269 <CompilerPath Value="$(CompPath)"/>
270 </Other>
271 @@ -33,15 +39,16 @@
272 <Type Value="RunAndDesignTime"/>
273 <RequiredPkgs Count="2">
274 <Item1>
275 - <PackageName Value="FCL"/>
276 + <PackageName Value="LCL"/>
277 <MinVersion Major="1" Valid="True"/>
278 </Item1>
279 <Item2>
280 - <PackageName Value="IDEIntf"/>
281 + <PackageName Value="FCL"/>
282 + <MinVersion Major="1" Valid="True"/>
283 </Item2>
284 </RequiredPkgs>
285 <UsageOptions>
286 - <UnitPath Value="$(PkgOutDir)\"/>
287 + <UnitPath Value="$(PkgOutDir)"/>
288 </UsageOptions>
289 <PublishOptions>
290 <Version Value="2"/>
291 Index: pkg_gifanim_dsgn.lpk
292 ===================================================================
293 --- pkg_gifanim_dsgn.lpk (revision 0)
294 +++ pkg_gifanim_dsgn.lpk (revision 0)
295 @@ -0,0 +1,49 @@
296 +<?xml version="1.0" encoding="UTF-8"?>
297 +<CONFIG>
298 + <Package Version="4">
299 + <PathDelim Value="\"/>
300 + <Name Value="pkg_gifanim_dsgn"/>
301 + <CompilerOptions>
302 + <Version Value="11"/>
303 + <PathDelim Value="\"/>
304 + <SearchPaths>
305 + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
306 + </SearchPaths>
307 + <Linking>
308 + <Debugging>
309 + <DebugInfoType Value="dsDwarf2Set"/>
310 + </Debugging>
311 + </Linking>
312 + <Other>
313 + <CompilerMessages>
314 + <MsgFileName Value=""/>
315 + </CompilerMessages>
316 + <CompilerPath Value="$(CompPath)"/>
317 + </Other>
318 + </CompilerOptions>
319 + <License Value="GPL"/>
320 + <Version Major="1" Minor="4"/>
321 + <Files Count="1">
322 + <Item1>
323 + <Filename Value="gifanimdsgn.pas"/>
324 + <HasRegisterProc Value="True"/>
325 + <UnitName Value="GifAnimDsgn"/>
326 + </Item1>
327 + </Files>
328 + <Type Value="DesignTime"/>
329 + <RequiredPkgs Count="2">
330 + <Item1>
331 + <PackageName Value="IDEIntf"/>
332 + </Item1>
333 + <Item2>
334 + <PackageName Value="pkg_gifanim"/>
335 + </Item2>
336 + </RequiredPkgs>
337 + <UsageOptions>
338 + <UnitPath Value="$(PkgOutDir)"/>
339 + </UsageOptions>
340 + <PublishOptions>
341 + <Version Value="2"/>
342 + </PublishOptions>
343 + </Package>
344 +</CONFIG>
345 Index: pkg_gifanim_dsgn.pas
346 ===================================================================
347 --- pkg_gifanim_dsgn.pas (revision 0)
348 +++ pkg_gifanim_dsgn.pas (revision 0)
349 @@ -0,0 +1,21 @@
350 +{ This file was automatically created by Lazarus. Do not edit!
351 + This source is only used to compile and install the package.
352 + }
353 +
354 +unit pkg_gifanim_dsgn;
355 +
356 +interface
357 +
358 +uses
359 + GifAnimDsgn, LazarusPackageIntf;
360 +
361 +implementation
362 +
363 +procedure Register;
364 +begin
365 + RegisterUnit('GifAnimDsgn', @GifAnimDsgn.Register);
366 +end;
367 +
368 +initialization
369 + RegisterPackage('pkg_gifanim_dsgn', @Register);
370 +end.