Changeset 33


Ignore:
Timestamp:
Mar 5, 2014, 12:01:04 AM (11 years ago)
Author:
chronos
Message:
  • Added: Main application settings form.
  • Added: CoolTranslator component for interface localization.
Location:
trunk
Files:
26 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Languages/xtactics.cs.po

    r31 r33  
    3636msgstr "Restartovat"
    3737
     38#: tcore.asettings.caption
     39msgctxt "tcore.asettings.caption"
     40msgid "Settings"
     41msgstr "Nastavení"
     42
    3843#: tformmain.caption
    3944msgid "xTactics"
     
    4651#: tformmain.menuitem5.caption
    4752msgid "-"
    48 msgstr "."
    49 
    50 #: tformmain.toolbar1.caption
    51 msgid "ToolBar1"
    52 msgstr ""
     53msgstr "-"
     54
     55#: tformmain.menuitem8.caption
     56#| msgid "Settings"
     57msgctxt "tformmain.menuitem8.caption"
     58msgid "Tools"
     59msgstr "Nástroje"
    5360
    5461#: tformmove.buttoncancel.caption
     
    114121#: tformnew.label3.caption
    115122msgid "%"
    116 msgstr ""
     123msgstr "%"
    117124
    118125#: tformnew.listview1.columns[0].caption
     
    147154
    148155#: tformplayer.combobox1.text
     156msgctxt "tformplayer.combobox1.text"
    149157msgid "Human"
    150158msgstr "Člověk"
     
    161169msgid "Color:"
    162170msgstr "Barva:"
     171
     172#: tformsettings.buttoncancel.caption
     173msgctxt "tformsettings.buttoncancel.caption"
     174msgid "Cancel"
     175msgstr "Zrušit"
     176
     177#: tformsettings.buttonok.caption
     178msgctxt "tformsettings.buttonok.caption"
     179msgid "Ok"
     180msgstr "Ok"
     181
     182#: tformsettings.caption
     183msgctxt "tformsettings.caption"
     184msgid "Settings"
     185msgstr "Nastavení"
     186
     187#: tformsettings.label1.caption
     188msgid "Language:"
     189msgstr "Jazyk:"
    163190
    164191#: ucore.splayerwins
     
    171198msgstr "tah"
    172199
     200#: ugame.scomputer
     201msgid "Computer"
     202msgstr "Počítač"
     203
     204#: ugame.shuman
     205msgctxt "ugame.shuman"
     206msgid "Human"
     207msgstr "Člověk"
     208
    173209#: ugame.sminimumplayers
    174210msgid "You need at least two players"
    175211msgstr "Potřebujete alespoň dva hráče"
    176 
  • trunk/Languages/xtactics.po

    r31 r33  
    2727msgstr ""
    2828
     29#: tcore.asettings.caption
     30msgctxt "tcore.asettings.caption"
     31msgid "Settings"
     32msgstr ""
     33
    2934#: tformmain.caption
    3035msgid "xTactics"
     
    3944msgstr ""
    4045
    41 #: tformmain.toolbar1.caption
    42 msgid "ToolBar1"
     46#: tformmain.menuitem8.caption
     47msgctxt "tformmain.menuitem8.caption"
     48msgid "Tools"
    4349msgstr ""
    4450
     
    138144
    139145#: tformplayer.combobox1.text
     146msgctxt "tformplayer.combobox1.text"
    140147msgid "Human"
    141148msgstr ""
     
    151158#: tformplayer.label3.caption
    152159msgid "Color:"
     160msgstr ""
     161
     162#: tformsettings.buttoncancel.caption
     163msgctxt "TFORMSETTINGS.BUTTONCANCEL.CAPTION"
     164msgid "Cancel"
     165msgstr ""
     166
     167#: tformsettings.buttonok.caption
     168msgctxt "TFORMSETTINGS.BUTTONOK.CAPTION"
     169msgid "Ok"
     170msgstr ""
     171
     172#: tformsettings.caption
     173msgctxt "tformsettings.caption"
     174msgid "Settings"
     175msgstr ""
     176
     177#: tformsettings.label1.caption
     178msgid "Language:"
    153179msgstr ""
    154180
     
    162188msgstr ""
    163189
     190#: ugame.scomputer
     191msgid "Computer"
     192msgstr ""
     193
     194#: ugame.shuman
     195msgctxt "ugame.shuman"
     196msgid "Human"
     197msgstr ""
     198
    164199#: ugame.sminimumplayers
    165200msgid "You need at least two players"
  • trunk/UCore.lfm

    r30 r33  
    3636      ShortCut = 16466
    3737    end
     38    object ASettings: TAction
     39      Caption = 'Settings'
     40      OnExecute = ASettingsExecute
     41    end
    3842  end
    3943  object ImageList1: TImageList
     
    4145    top = 152
    4246  end
     47  object CoolTranslator1: TCoolTranslator
     48    POFilesFolder = 'Languages'
     49    OnTranslate = CoolTranslator1Translate
     50    left = 214
     51    top = 252
     52  end
    4353end
  • trunk/UCore.lrt

    r22 r33  
    44TCORE.AGAMEENDTURN.CAPTION=End turn
    55TCORE.AGAMERESTART.CAPTION=Restart
     6TCORE.ASETTINGS.CAPTION=Settings
  • trunk/UCore.pas

    r32 r33  
    66
    77uses
    8   Classes, SysUtils, FileUtil, ActnList, Controls, Dialogs, Forms, UGame;
     8  Classes, SysUtils, FileUtil, ActnList, Controls, Dialogs, Forms, UGame,
     9  UCoolTranslator;
    910
    1011type
     
    1314
    1415  TCore = class(TDataModule)
     16    ASettings: TAction;
    1517    ActionList1: TActionList;
    1618    AExit: TAction;
     
    1921    AGameNew: TAction;
    2022    AGameRestart: TAction;
     23    CoolTranslator1: TCoolTranslator;
    2124    ImageList1: TImageList;
    2225    procedure AExitExecute(Sender: TObject);
     
    2528    procedure AGameNewExecute(Sender: TObject);
    2629    procedure AGameRestartExecute(Sender: TObject);
     30    procedure ASettingsExecute(Sender: TObject);
     31    procedure CoolTranslator1Translate(Sender: TObject);
    2732    procedure DataModuleCreate(Sender: TObject);
    2833    procedure DataModuleDestroy(Sender: TObject);
     
    4954
    5055uses
    51   UFormMove, UFormMain, UFormNew;
     56  UFormMove, UFormMain, UFormNew, UFormSettings;
    5257
    5358resourcestring
     
    125130end;
    126131
     132procedure TCore.ASettingsExecute(Sender: TObject);
     133begin
     134  FormSettings.Load;
     135  if FormSettings.ShowModal = mrOk then
     136    FormSettings.Save;
     137end;
     138
     139procedure TCore.CoolTranslator1Translate(Sender: TObject);
     140begin
     141  UGame.InitStrings;
     142end;
     143
    127144procedure TCore.DataModuleCreate(Sender: TObject);
    128145begin
  • trunk/UFormMain.lfm

    r30 r33  
    5353    ButtonHeight = 32
    5454    ButtonWidth = 32
    55     Caption = 'ToolBar1'
    5655    Images = Core.ImageList1
    5756    ParentShowHint = False
     
    7877      Top = 2
    7978      Action = Core.AGameRestart
     79    end
     80    object ToolButton5: TToolButton
     81      Left = 221
     82      Top = 2
     83      Action = Core.ASettings
    8084    end
    8185  end
     
    105109      end
    106110    end
     111    object MenuItem8: TMenuItem
     112      Caption = 'Tools'
     113      object MenuItem9: TMenuItem
     114        Action = Core.ASettings
     115      end
     116    end
    107117  end
    108118  object Timer1: TTimer
  • trunk/UFormMain.lrt

    r28 r33  
    11TFORMMAIN.CAPTION=xTactics
    2 TFORMMAIN.TOOLBAR1.CAPTION=ToolBar1
    32TFORMMAIN.MENUITEM1.CAPTION=Game
    43TFORMMAIN.MENUITEM5.CAPTION=-
     4TFORMMAIN.MENUITEM8.CAPTION=Tools
  • trunk/UFormMain.pas

    r32 r33  
    2525    MenuItem6: TMenuItem;
    2626    MenuItem7: TMenuItem;
     27    MenuItem8: TMenuItem;
     28    MenuItem9: TMenuItem;
    2729    PaintBox1: TPaintBox;
    2830    StatusBar1: TStatusBar;
     
    3335    ToolButton3: TToolButton;
    3436    ToolButton4: TToolButton;
     37    ToolButton5: TToolButton;
    3538    procedure FormActivate(Sender: TObject);
    3639    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
  • trunk/UGame.pas

    r32 r33  
    186186  end;
    187187
     188var
     189  PlayerModeText: array[TPlayerMode] of string;
     190
    188191const
    189   PlayerModeText: array[TPlayerMode] of string = ('Human', 'Computer');
    190192  clOrange = $009Aff;
    191193  PlayerColors: array[0..7] of TColor = (clBlue, clRed, clGreen, clOrange,
    192194    clPurple, clMaroon, clAqua, clFuchsia);
    193195
     196procedure InitStrings;
     197
    194198
    195199implementation
     
    197201resourcestring
    198202  SMinimumPlayers = 'You need at least two players';
     203  SHuman = 'Human';
     204  SComputer = 'Computer';
     205
     206procedure InitStrings;
     207begin
     208  PlayerModeText[pmHuman] := SHuman;
     209  PlayerModeText[pmComputer] := SComputer;
     210end;
    199211
    200212function FloatPoint(AX, AY: Double): TFloatPoint;
  • trunk/xtactics.lpi

    r32 r33  
    7272      </local>
    7373    </RunParams>
    74     <RequiredPackages Count="1">
     74    <RequiredPackages Count="2">
    7575      <Item1>
     76        <PackageName Value="CoolTranslator"/>
     77        <DefaultFilename Value="Packages/CoolTranslator/CoolTranslator.lpk" Prefer="True"/>
     78      </Item1>
     79      <Item2>
    7680        <PackageName Value="LCL"/>
    77       </Item1>
     81      </Item2>
    7882    </RequiredPackages>
    79     <Units Count="7">
     83    <Units Count="8">
    8084      <Unit0>
    8185        <Filename Value="xtactics.lpr"/>
     
    124128        <IsPartOfProject Value="True"/>
    125129        <ComponentName Value="FormPlayer"/>
     130        <HasResources Value="True"/>
    126131        <ResourceBaseClass Value="Form"/>
    127132        <UnitName Value="UFormPlayer"/>
    128133      </Unit6>
     134      <Unit7>
     135        <Filename Value="Forms/UFormSettings.pas"/>
     136        <IsPartOfProject Value="True"/>
     137        <ComponentName Value="FormSettings"/>
     138        <HasResources Value="True"/>
     139        <ResourceBaseClass Value="Form"/>
     140        <UnitName Value="UFormSettings"/>
     141      </Unit7>
    129142    </Units>
    130143  </ProjectOptions>
  • trunk/xtactics.lpr

    r32 r33  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UFormMain, UGame, UFormNew, UFormMove, UCore, UFormPlayer
     10  Forms, UFormMain, UGame, UFormNew, UFormMove, UCore, CoolTranslator,
     11  UFormPlayer
    1112  { you can add units after this },
    12   SysUtils;
     13  SysUtils, UFormSettings;
    1314
    1415{$R *.res}
     
    3435  Application.CreateForm(TFormMove, FormMove);
    3536  Application.CreateForm(TFormPlayer, FormPlayer);
     37  Application.CreateForm(TFormSettings, FormSettings);
    3638  Application.Run;
    3739end.
Note: See TracChangeset for help on using the changeset viewer.