Changeset 60 for trunk/Packages/Common
- Timestamp:
- Nov 25, 2020, 12:14:18 PM (4 years ago)
- Location:
- trunk/Packages/Common
- Files:
-
- 6 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Common.lpk
r55 r60 40 40 <License Value="GNU/GPL"/> 41 41 <Version Minor="7"/> 42 <Files Count="2 4">42 <Files Count="26"> 43 43 <Item1> 44 44 <Filename Value="StopWatch.pas"/> … … 147 147 <UnitName Value="UGeometric"/> 148 148 </Item24> 149 <Item25> 150 <Filename Value="UTranslator.pas"/> 151 <HasRegisterProc Value="True"/> 152 <UnitName Value="UTranslator"/> 153 </Item25> 154 <Item26> 155 <Filename Value="ULanguages.pas"/> 156 <UnitName Value="ULanguages"/> 157 </Item26> 149 158 </Files> 150 159 <i18n> -
trunk/Packages/Common/Common.pas
r55 r60 13 13 UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort, 14 14 UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, UMetaCanvas, 15 UGeometric, LazarusPackageIntf;15 UGeometric, UTranslator, ULanguages, LazarusPackageIntf; 16 16 17 17 implementation … … 29 29 RegisterUnit('UScaleDPI', @UScaleDPI.Register); 30 30 RegisterUnit('UTheme', @UTheme.Register); 31 RegisterUnit('UTranslator', @UTranslator.Register); 31 32 end; 32 33 -
trunk/Packages/Common/UApplicationInfo.pas
r55 r60 6 6 7 7 uses 8 SysUtils, Classes, Forms, URegistry, Controls ;8 SysUtils, Classes, Forms, URegistry, Controls, Graphics; 9 9 10 10 type … … 15 15 private 16 16 FDescription: TCaption; 17 FIcon: TBitmap; 17 18 FIdentification: Byte; 18 19 FLicense: string; … … 33 34 public 34 35 constructor Create(AOwner: TComponent); override; 36 destructor Destroy; override; 35 37 property Version: string read GetVersion; 36 38 function GetRegistryContext: TRegistryContext; … … 52 54 property RegistryRoot: TRegistryRoot read FRegistryRoot write FRegistryRoot; 53 55 property License: string read FLicense write FLicense; 56 property Icon: TBitmap read FIcon write FIcon; 54 57 end; 55 58 … … 74 77 constructor TApplicationInfo.Create(AOwner: TComponent); 75 78 begin 76 inherited Create(AOwner);79 inherited; 77 80 FVersionMajor := 1; 78 81 FIdentification := 1; … … 80 83 FRegistryKey := '\Software\' + FAppName; 81 84 FRegistryRoot := rrKeyCurrentUser; 85 FIcon := TBitmap.Create; 86 end; 87 88 destructor TApplicationInfo.Destroy; 89 begin 90 FreeAndNil(FIcon); 91 inherited; 82 92 end; 83 93 -
trunk/Packages/Common/UMetaCanvas.pas
r55 r60 39 39 Brush: TBrush; 40 40 BoundingRect: TRect; 41 Rounded: TPoint; 41 42 procedure Paint(Canvas: TCanvas); override; 42 43 procedure Zoom(Factor: Double); override; … … 133 134 public 134 135 Objects: TObjectList; 136 procedure FillRect(const ARect: TRect); overload; override; 137 procedure FillRect(X1,Y1,X2,Y2: Integer); overload; 138 procedure RoundRect(X1, Y1, X2, Y2: Integer; RX,RY: Integer); overload; override; 139 procedure RoundRect(const Rect: TRect; RX,RY: Integer); overload; 135 140 procedure TextOut(X,Y: Integer; const Text: String); override; 136 141 procedure Polygon(Points: PPoint; NumPts: Integer; Winding: boolean = False); override; … … 152 157 153 158 uses 154 UGeometric ;159 UGeometric, LCLIntf; 155 160 156 161 { TCanvasPie } … … 340 345 Canvas.Pen.Assign(Pen); 341 346 Canvas.Brush.Assign(Brush); 342 Canvas.Rectangle(BoundingRect); 347 348 if Rounded <> Point(0, 0) then Canvas.RoundRect(BoundingRect, Rounded.X, Rounded.Y) 349 else Canvas.Rectangle(BoundingRect); 343 350 end; 344 351 … … 354 361 procedure TCanvasRectangle.Move(Delta: TPoint); 355 362 begin 356 ShiftRect(BoundingRect, Delta);363 BoundingRect := ShiftRect(BoundingRect, Delta); 357 364 end; 358 365 … … 361 368 Pen := TPen.Create; 362 369 Brush := TBrush.Create; 370 Rounded := Point(0, 0); 363 371 end; 364 372 … … 547 555 548 556 function TMetaCanvas.TextExtent(const Text: string): TSize; 549 begin 550 Result := Size(0, 0); 557 var 558 Canvas: TCanvas; 559 begin 560 Canvas := TCanvas.Create; 561 Canvas.Handle := CreateCompatibleDC(0); 562 Canvas.Font.Assign(Font); 563 Result := Canvas.TextExtent(Text); 564 DeleteDC(Canvas.Handle); 565 Canvas.Free; 551 566 end; 552 567 … … 560 575 DoLine(FPenPos.X, FPenPos.Y, X, Y); 561 576 DoMoveTo(X, Y); 577 end; 578 579 procedure TMetaCanvas.FillRect(const ARect: TRect); 580 begin 581 DoRectangleFill(ARect); 582 end; 583 584 procedure TMetaCanvas.FillRect(X1, Y1, X2, Y2: Integer); 585 begin 586 FillRect(Rect(X1, Y1, X2, Y2)); 587 end; 588 589 procedure TMetaCanvas.RoundRect(X1, Y1, X2, Y2: Integer; RX, RY: Integer); 590 begin 591 RoundRect(Rect(X1, Y1, X2, Y2), RX, RY); 592 end; 593 594 procedure TMetaCanvas.RoundRect(const Rect: TRect; RX, RY: Integer); 595 var 596 NewObj: TCanvasRectangle; 597 begin 598 NewObj := TCanvasRectangle.Create; 599 NewObj.Brush.Assign(Brush); 600 NewObj.Pen.Assign(Pen); 601 NewObj.BoundingRect := Rect; 602 NewObj.Rounded := Point(RX, RY); 603 Objects.Add(NewObj); 562 604 end; 563 605
Note:
See TracChangeset
for help on using the changeset viewer.