Changeset 548


Ignore:
Timestamp:
Feb 12, 2021, 12:03:11 AM (4 years ago)
Author:
chronos
Message:
Location:
Common
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • Common/Common.lpk

    r542 r548  
    3939    <Description Value="Various libraries"/>
    4040    <License Value="GNU/GPL"/>
    41     <Version Minor="7"/>
    42     <Files Count="26">
     41    <Version Minor="8"/>
     42    <Files Count="28">
    4343      <Item1>
    4444        <Filename Value="StopWatch.pas"/>
     
    156156        <UnitName Value="ULanguages"/>
    157157      </Item26>
     158      <Item27>
     159        <Filename Value="UFormAbout.pas"/>
     160        <UnitName Value="UFormAbout"/>
     161      </Item27>
     162      <Item28>
     163        <Filename Value="UAboutDialog.pas"/>
     164        <HasRegisterProc Value="True"/>
     165        <UnitName Value="UAboutDialog"/>
     166      </Item28>
    158167    </Files>
    159168    <i18n>
  • Common/Common.pas

    r545 r548  
    1212  UMemory, UResetableThread, UPool, ULastOpenedList, URegistry,
    1313  UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort,
    14   UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, UAboutDialog,
    15   UTranslator, ULanguages, UFormAbout, LazarusPackageIntf;
     14  UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, UMetaCanvas,
     15  UGeometric, UTranslator, ULanguages, UFormAbout, UAboutDialog,
     16  LazarusPackageIntf;
    1617
    1718implementation
     
    2930  RegisterUnit('UScaleDPI', @UScaleDPI.Register);
    3031  RegisterUnit('UTheme', @UTheme.Register);
     32  RegisterUnit('UTranslator', @UTranslator.Register);
    3133  RegisterUnit('UAboutDialog', @UAboutDialog.Register);
    32   RegisterUnit('UTranslator', @UTranslator.Register);
    3334end;
    3435
  • Common/UApplicationInfo.pas

    r545 r548  
    66
    77uses
    8   SysUtils, Classes, Forms, URegistry, Controls, Graphics;
     8  SysUtils, Classes, Forms, URegistry, Controls, Graphics, LCLType;
    99
    1010type
     
    1414  TApplicationInfo = class(TComponent)
    1515  private
    16     FDescription: TCaption;
     16    FDescription: TTranslateString;
    1717    FIcon: TBitmap;
    1818    FIdentification: Byte;
     
    4949    property EmailContact: string read FEmailContact write FEmailContact;
    5050    property AppName: string read FAppName write FAppName;
    51     property Description: string read FDescription write FDescription;
     51    property Description: TTranslateString read FDescription write FDescription;
    5252    property ReleaseDate: TDateTime read FReleaseDate write FReleaseDate;
    5353    property RegistryKey: string read FRegistryKey write FRegistryKey;
  • Common/UFormAbout.lfm

    r545 r548  
    1111  OnShow = FormShow
    1212  Position = poScreenCenter
    13   LCLVersion = '2.0.2.0'
     13  LCLVersion = '2.0.10.0'
    1414  object LabelDescription: TLabel
    1515    Left = 30
    16     Height = 26
     16    Height = 24
    1717    Top = 135
    1818    Width = 642
     
    2828  object LabelContent: TLabel
    2929    Left = 30
    30     Height = 26
    31     Top = 191
     30    Height = 24
     31    Top = 189
    3232    Width = 642
    3333    Align = alTop
     
    5050    TabOrder = 0
    5151    object LabelAppName: TLabel
    52       Left = 96
    53       Height = 100
     52      Left = 108
     53      Height = 84
    5454      Top = 20
    55       Width = 572
     55      Width = 564
    5656      Anchors = [akTop, akLeft, akRight]
    5757      AutoSize = False
     
    6868      Top = 30
    6969      Width = 72
     70      Proportional = True
     71      Stretch = True
    7072    end
    7173  end
  • Common/UMetaCanvas.pas

    r542 r548  
    66
    77uses
    8   Classes, SysUtils, Graphics, Contnrs, Types;
     8  Classes, SysUtils, Graphics, Contnrs, Types, fgl;
    99
    1010type
     
    1717    procedure Zoom(Factor: Double); virtual;
    1818    procedure Move(Delta: TPoint); virtual;
     19  end;
     20
     21  TCanvasObjects = class(TFPGObjectList<TCanvasObject>)
    1922  end;
    2023
     
    133136    procedure DoLineTo(X, Y: Integer); override;
    134137  public
    135     Objects: TObjectList;
     138    Objects: TCanvasObjects;
    136139    procedure FillRect(const ARect: TRect); overload; override;
    137140    procedure FillRect(X1,Y1,X2,Y2: Integer); overload;
     
    145148    procedure Pie(EllipseX1, EllipseY1, EllipseX2, EllipseY2,
    146149      StartX, StartY, EndX, EndY: Integer); override;
    147     procedure SetSize(Size: TPoint);
    148150    procedure Reset;
    149151    procedure DrawTo(Canvas: TCanvas);
     
    152154    constructor Create;
    153155    destructor Destroy; override;
    154   end;
     156    property Size: TPoint read FSize write FSize;
     157  end;
     158
    155159
    156160implementation
     
    198202  Pen.Free;
    199203  Brush.Free;
    200   inherited Destroy;
     204  inherited;
    201205end;
    202206
     
    228232destructor TCanvasStretchDraw.Destroy;
    229233begin
    230   inherited Destroy;
     234  inherited;
    231235end;
    232236
     
    264268  Pen.Free;
    265269  Brush.Free;
    266   inherited Destroy;
     270  inherited;
    267271end;
    268272
     
    304308  Brush.Free;
    305309  Pen.Free;
    306   inherited Destroy;
     310  inherited;
    307311end;
    308312
     
    336340begin
    337341  Pen.Free;
    338   inherited Destroy;
     342  inherited;
    339343end;
    340344
     
    375379  Pen.Free;
    376380  Brush.Free;
    377   inherited Destroy;
     381  inherited;
    378382end;
    379383
     
    408412  Brush.Free;
    409413  Font.Free;
    410   inherited Destroy;
     414  inherited;
    411415end;
    412416
     
    618622end;
    619623
    620 procedure TMetaCanvas.SetSize(Size: TPoint);
    621 begin
    622   FSize := Size;
    623 end;
    624 
    625624procedure TMetaCanvas.Reset;
    626625begin
     
    633632begin
    634633  for I := 0 to Objects.Count - 1 do
    635     TCanvasObject(Objects[I]).Paint(Canvas);
     634    Objects[I].Paint(Canvas);
    636635end;
    637636
     
    641640begin
    642641  for I := 0 to Objects.Count - 1 do
    643     TCanvasObject(Objects[I]).Zoom(Factor);
     642    Objects[I].Zoom(Factor);
    644643end;
    645644
     
    649648begin
    650649  for I := 0 to Objects.Count - 1 do
    651     TCanvasObject(Objects[I]).Move(Delta);
     650    Objects[I].Move(Delta);
    652651end;
    653652
     
    656655  inherited;
    657656  FPenPos := Point(0, 0);
    658   Objects := TObjectList.Create;
     657  Objects := TCanvasObjects.Create;
    659658end;
    660659
     
    662661begin
    663662  Objects.Free;
    664   inherited Destroy;
     663  inherited;
    665664end;
    666665
  • Common/UPersistentForm.pas

    r515 r548  
    33{$mode delphi}
    44
    5 // Date: 2015-04-18
     5// Date: 2020-11-26
    66
    77interface
     
    99uses
    1010  Classes, SysUtils, Forms, URegistry, LCLIntf, Registry, Controls, ComCtrls,
    11   ExtCtrls;
     11  ExtCtrls, LCLType;
    1212
    1313type
     
    2626    FormRestoredSize: TRect;
    2727    FormWindowState: TWindowState;
     28    FormFullScreen: Boolean;
    2829    Form: TForm;
    2930    procedure LoadFromRegistry(RegistryContext: TRegistryContext);
     
    3132    function CheckEntireVisible(Rect: TRect): TRect;
    3233    function CheckPartVisible(Rect: TRect; Part: Integer): TRect;
    33     procedure Load(Form: TForm; DefaultMaximized: Boolean = False);
     34    procedure Load(Form: TForm; DefaultMaximized: Boolean = False;
     35      DefaultFullScreen: Boolean = False);
    3436    procedure Save(Form: TForm);
    3537    constructor Create(AOwner: TComponent); override;
     38    procedure SetFullScreen(State: Boolean);
    3639    property RegistryContext: TRegistryContext read FRegistryContext
    3740      write FRegistryContext;
     
    4346procedure Register;
    4447
     48
    4549implementation
    46 
    4750
    4851procedure Register;
     
    169172      + FormRestoredSize.Top;
    170173    // Other state
    171     FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(wsNormal)));
     174    FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(FormWindowState)));
     175    FormFullScreen := ReadBoolWithDefault('FullScreen', FormFullScreen);
    172176  finally
    173177    Free;
     
    193197    // Other state
    194198    WriteInteger('WindowState', Integer(FormWindowState));
     199    WriteBool('FullScreen', FormFullScreen);
    195200  finally
    196201    Free;
     
    250255end;
    251256
    252 procedure TPersistentForm.Load(Form: TForm; DefaultMaximized: Boolean = False);
     257procedure TPersistentForm.Load(Form: TForm; DefaultMaximized: Boolean = False;
     258  DefaultFullScreen: Boolean = False);
    253259begin
    254260  Self.Form := Form;
     
    258264  FormRestoredSize := Bounds((Screen.Width - Form.Width) div 2,
    259265    (Screen.Height - Form.Height) div 2, Form.Width, Form.Height);
     266  FormWindowState := Form.WindowState;
     267  FormFullScreen := DefaultFullScreen;
    260268
    261269  LoadFromRegistry(RegistryContext);
     
    277285      Form.BoundsRect := FormNormalSize;
    278286  end;
     287  if FormFullScreen then SetFullScreen(True);
    279288  LoadControl(Form);
    280289end;
     
    284293  Self.Form := Form;
    285294  FormNormalSize := Bounds(Form.Left, Form.Top, Form.Width, Form.Height);
    286   FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth,
    287     Form.RestoredHeight);
     295  if not FormFullScreen then
     296    FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth,
     297      Form.RestoredHeight);
    288298  FormWindowState := Form.WindowState;
    289299  SaveToRegistry(RegistryContext);
     
    300310end;
    301311
     312procedure TPersistentForm.SetFullScreen(State: Boolean);
     313begin
     314  if State then begin
     315    FormFullScreen := True;
     316    FormNormalSize := Form.BoundsRect;
     317    FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth,
     318      Form.RestoredHeight);
     319    FormWindowState := Form.WindowState;
     320    ShowWindow(Form.Handle, SW_SHOWFULLSCREEN);
     321    {$IFDEF WINDOWS}
     322    Form.BorderStyle := bsNone;
     323    {$ENDIF}
     324  end else begin
     325    FormFullScreen := False;
     326    {$IFDEF WINDOWS}
     327    Form.BorderStyle := bsSizeable;
     328    {$ENDIF}
     329    ShowWindow(Form.Handle, SW_SHOWNORMAL);
     330    if FormWindowState = wsNormal then begin
     331      Form.BoundsRect := FormNormalSize;
     332    end else
     333    if FormWindowState = wsMaximized then begin
     334      Form.BoundsRect := FormRestoredSize;
     335      Form.WindowState := wsMaximized;
     336    end;
     337  end;
     338end;
     339
    302340end.
    303341
Note: See TracChangeset for help on using the changeset viewer.