Changeset 8 for trunk


Ignore:
Timestamp:
Sep 26, 2019, 10:08:16 PM (5 years ago)
Author:
chronos
Message:
  • Added: About application dialog.
Location:
trunk
Files:
20 added
5 edited
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r7 r8  
    1919    object MenuItemGame: TMenuItem
    2020      Caption = 'Game'
    21       object MenuItem1: TMenuItem
     21      object MenuItemNew: TMenuItem
    2222        Action = AGameNew
    2323      end
    24       object MenuItem2: TMenuItem
     24      object MenuItemExit: TMenuItem
    2525        Action = AExit
     26      end
     27    end
     28    object MenuItemHelp: TMenuItem
     29      Caption = 'Help'
     30      object MenuItemAbout: TMenuItem
     31        Action = AAbout
    2632      end
    2733    end
     
    2935  object ActionList1: TActionList
    3036    left = 144
    31     top = 155
     37    top = 152
    3238    object AGameNew: TAction
    3339      Caption = 'New...'
     
    3844      OnExecute = AExitExecute
    3945    end
    40   end
    41   object PersistentForm1: TPersistentForm
    42     MinVisiblePart = 50
    43     EntireVisible = False
    44     left = 161
    45     top = 258
    46   end
    47   object ApplicationInfo1: TApplicationInfo
    48     Identification = 1
    49     VersionMajor = 1
    50     VersionMinor = 0
    51     VersionBugFix = 0
    52     HomePage = 'https://app.zdechov.net/2048'
    53     AuthorsName = 'Chronos'
    54     EmailContact = 'robie@centrum.cz'
    55     AppName = '2048'
    56     Description = 'Classic 2048 game.'
    57     ReleaseDate = 43733
    58     RegistryKey = '\Software\Chronosoft\2048'
    59     RegistryRoot = rrKeyCurrentUser
    60     License = 'CC0'
    61     left = 320
    62     top = 258
     46    object AAbout: TAction
     47      Caption = 'About'
     48      OnExecute = AAboutExecute
     49    end
    6350  end
    6451end
  • trunk/Forms/UFormMain.pas

    r7 r8  
    1414
    1515  TFormMain = class(TForm)
     16    AAbout: TAction;
    1617    AExit: TAction;
    1718    AGameNew: TAction;
    1819    ActionList1: TActionList;
    19     ApplicationInfo1: TApplicationInfo;
    2020    MainMenu1: TMainMenu;
    21     MenuItem1: TMenuItem;
    22     MenuItem2: TMenuItem;
     21    MenuItemNew: TMenuItem;
     22    MenuItemExit: TMenuItem;
     23    MenuItemHelp: TMenuItem;
     24    MenuItemAbout: TMenuItem;
    2325    MenuItemGame: TMenuItem;
    24     PersistentForm1: TPersistentForm;
     26    procedure AAboutExecute(Sender: TObject);
    2527    procedure AExitExecute(Sender: TObject);
    2628    procedure AGameNewExecute(Sender: TObject);
     
    3234    procedure FormShow(Sender: TObject);
    3335  private
    34 
    3536  public
    3637    Game: TGame;
     
    4647
    4748uses
    48   UFormNew;
     49  UCore, UFormNew, UFormAbout;
    4950
    5051{ TFormMain }
     
    7576procedure TFormMain.AGameNewExecute(Sender: TObject);
    7677begin
    77   FormNew.Load(Game);
    78   if FormNew.ShowModal = mrOk then begin
    79     FormNew.Save(Game);
    80     Game.New;
     78  FormNew := TFormNew.Create(nil);
     79  try
     80    FormNew.Load(Game);
     81    if FormNew.ShowModal = mrOk then begin
     82      FormNew.Save(Game);
     83      Game.New;
     84    end;
     85  finally
     86    FreeAndNil(FormNew);
    8187  end;
    8288end;
     
    8490procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    8591begin
    86   PersistentForm1.Save(Self);
     92  Core.PersistentForm1.Save(Self);
    8793end;
    8894
     
    9096begin
    9197  Close;
     98end;
     99
     100procedure TFormMain.AAboutExecute(Sender: TObject);
     101begin
     102  FormAbout := TFormAbout.Create(nil);
     103  try
     104    FormAbout.ApplicationInfo := Core.ApplicationInfo1;
     105    FormAbout.ShowModal;
     106  finally
     107    FreeAndNil(FormAbout);
     108  end;
    92109end;
    93110
     
    107124procedure TFormMain.FormShow(Sender: TObject);
    108125begin
    109   PersistentForm1.RegistryContext := ApplicationInfo1.GetRegistryContext;
    110   PersistentForm1.Load(Self);
     126  Core.PersistentForm1.RegistryContext := Core.ApplicationInfo1.GetRegistryContext;
     127  Core.PersistentForm1.Load(Self);
    111128  Game.New;
    112129  {
  • trunk/Forms/UFormNew.lfm

    r7 r8  
    11object FormNew: TFormNew
    22  Left = 759
    3   Height = 360
    4   Top = 674
    5   Width = 480
     3  Height = 212
     4  Top = 822
     5  Width = 487
    66  Caption = 'New game'
    7   ClientHeight = 360
    8   ClientWidth = 480
     7  ClientHeight = 212
     8  ClientWidth = 487
    99  DesignTimePPI = 144
    10   LCLVersion = '1.8.4.0'
     10  LCLVersion = '2.0.2.0'
    1111  object Label1: TLabel
    1212    Left = 16
     
    1919  object ComboBoxSize: TComboBox
    2020    Left = 173
    21     Height = 40
     21    Height = 38
    2222    Top = 11
    2323    Width = 262
     
    3737  end
    3838  object ButtonCancel: TButton
    39     Left = 112
     39    Left = 120
    4040    Height = 38
    41     Top = 272
     41    Top = 158
    4242    Width = 113
     43    Anchors = [akLeft, akBottom]
    4344    Caption = 'Cancel'
    4445    ModalResult = 2
     
    4849    Left = 280
    4950    Height = 38
    50     Top = 272
     51    Top = 158
    5152    Width = 113
     53    Anchors = [akLeft, akBottom]
    5254    Caption = 'OK'
    5355    ModalResult = 1
  • trunk/Game2048.lpi

    r7 r8  
    1515      <Icon Value="0"/>
    1616    </General>
     17    <i18n>
     18      <EnableI18N Value="True"/>
     19      <OutDir Value="Languages"/>
     20    </i18n>
    1721    <BuildModes Count="2">
    1822      <Item1 Name="Debug" Default="True"/>
     
    2529          <SearchPaths>
    2630            <IncludeFiles Value="$(ProjOutDir)"/>
     31            <OtherUnitFiles Value="Forms"/>
    2732            <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/>
    2833          </SearchPaths>
     
    7782      </Item2>
    7883    </RequiredPackages>
    79     <Units Count="4">
     84    <Units Count="7">
    8085      <Unit0>
    8186        <Filename Value="Game2048.lpr"/>
     
    8388      </Unit0>
    8489      <Unit1>
    85         <Filename Value="UFormMain.pas"/>
     90        <Filename Value="UGame.pas"/>
     91        <IsPartOfProject Value="True"/>
     92      </Unit1>
     93      <Unit2>
     94        <Filename Value="Forms/UFormAbout.pas"/>
     95        <IsPartOfProject Value="True"/>
     96        <ComponentName Value="FormAbout"/>
     97        <HasResources Value="True"/>
     98        <ResourceBaseClass Value="Form"/>
     99      </Unit2>
     100      <Unit3>
     101        <Filename Value="Forms/UFormMain.pas"/>
    86102        <IsPartOfProject Value="True"/>
    87103        <ComponentName Value="FormMain"/>
    88104        <HasResources Value="True"/>
    89105        <ResourceBaseClass Value="Form"/>
    90       </Unit1>
    91       <Unit2>
    92         <Filename Value="UGame.pas"/>
    93         <IsPartOfProject Value="True"/>
    94       </Unit2>
    95       <Unit3>
    96         <Filename Value="UFormNew.pas"/>
     106      </Unit3>
     107      <Unit4>
     108        <Filename Value="Forms/UFormNew.pas"/>
    97109        <IsPartOfProject Value="True"/>
    98110        <ComponentName Value="FormNew"/>
    99111        <HasResources Value="True"/>
    100112        <ResourceBaseClass Value="Form"/>
    101       </Unit3>
     113      </Unit4>
     114      <Unit5>
     115        <Filename Value="Forms/UFormSettings.pas"/>
     116        <IsPartOfProject Value="True"/>
     117        <ComponentName Value="FormSettings"/>
     118        <HasResources Value="True"/>
     119        <ResourceBaseClass Value="Form"/>
     120      </Unit5>
     121      <Unit6>
     122        <Filename Value="UCore.pas"/>
     123        <IsPartOfProject Value="True"/>
     124        <ComponentName Value="Core"/>
     125        <HasResources Value="True"/>
     126        <ResourceBaseClass Value="DataModule"/>
     127      </Unit6>
    102128    </Units>
    103129  </ProjectOptions>
     
    109135    <SearchPaths>
    110136      <IncludeFiles Value="$(ProjOutDir)"/>
     137      <OtherUnitFiles Value="Forms"/>
    111138      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/>
    112139    </SearchPaths>
  • trunk/Game2048.lpr

    r7 r8  
    44
    55uses
    6   {$IFDEF UNIX}{$IFDEF UseCThreads}
    7   cthreads,
    8   {$ENDIF}{$ENDIF}
     6  {$IFDEF UNIX}
     7  cthreads, clocale,
     8  {$ENDIF}
    99  Interfaces, SysUtils,// this includes the LCL widgetset
    10   Forms, UFormMain, UGame, UFormNew, Common
     10  Forms, UGame, Common, UFormSettings, UFormMain, UCore
    1111  { you can add units after this };
    1212
     
    2828  Application.Initialize;
    2929  Application.CreateForm(TFormMain, FormMain);
    30   Application.CreateForm(TFormNew, FormNew);
     30  Application.CreateForm(TCore, Core);
    3131  Application.Run;
    3232end.
  • trunk/Packages/Common

    • Property svn:ignore set to
      lib
  • trunk/Packages/Common/Common.lpk

    r7 r8  
    4040    <License Value="GNU/GPL"/>
    4141    <Version Minor="7"/>
    42     <Files Count="22">
     42    <Files Count="24">
    4343      <Item1>
    4444        <Filename Value="StopWatch.pas"/>
     
    139139        <UnitName Value="UStringTable"/>
    140140      </Item22>
     141      <Item23>
     142        <Filename Value="ULanguages.pas"/>
     143        <UnitName Value="ULanguages"/>
     144      </Item23>
     145      <Item24>
     146        <Filename Value="UTranslator.pas"/>
     147        <HasRegisterProc Value="True"/>
     148        <UnitName Value="UTranslator"/>
     149      </Item24>
    141150    </Files>
    142151    <i18n>
  • trunk/Packages/Common/Common.pas

    r7 r8  
    1212  UMemory, UResetableThread, UPool, ULastOpenedList, URegistry,
    1313  UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort,
    14   UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable,
    15   LazarusPackageIntf;
     14  UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, ULanguages,
     15  UTranslator, LazarusPackageIntf;
    1616
    1717implementation
     
    2929  RegisterUnit('UScaleDPI', @UScaleDPI.Register);
    3030  RegisterUnit('UTheme', @UTheme.Register);
     31  RegisterUnit('UTranslator', @UTranslator.Register);
    3132end;
    3233
Note: See TracChangeset for help on using the changeset viewer.