Changeset 53
- Timestamp:
- Jan 4, 2022, 3:27:03 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r52 r53 5 5 Width = 770 6 6 Caption = 'Tunneler' 7 ClientHeight = 58 87 ClientHeight = 584 8 8 ClientWidth = 770 9 9 DesignTimePPI = 144 … … 19 19 object StatusBar1: TStatusBar 20 20 Left = 0 21 Height = 3622 Top = 55 221 Height = 27 22 Top = 557 23 23 Width = 770 24 24 Panels = < … … 49 49 object Image1: TImage 50 50 Left = 0 51 Height = 55 251 Height = 557 52 52 Top = 0 53 53 Width = 770 … … 135 135 end 136 136 object AboutDialog1: TAboutDialog 137 CoolTranslator = Core.Translator1137 Translator = Core.Translator1 138 138 ThemeManager = Core.ThemeManager1 139 139 ApplicationInfo = Core.ApplicationInfo -
trunk/Forms/UFormMain.pas
r52 r53 55 55 procedure TimerEngineTickTimer(Sender: TObject); 56 56 private 57 OriginalBounds: TRect;58 OriginalWindowState: TWindowState;59 ScreenBounds: TRect;60 57 StartTime: TDateTime; 61 58 Drawing: Boolean; … … 92 89 StartTime := NowPrecise; 93 90 //Engine.Draw; 94 Engine.Lock.Acquire; 95 try 96 //StatusBar1.Panels[1].Text := IntToStr(TPlayer(Engine.Players[0]).Position.X) + ', ' + 97 // IntToStr(TPlayer(Engine.Players[0]).Position.Y) + ' ' + 98 // IntToStr(TPlayer(Engine.Players[0]).Direction); 99 StatusBar1.Panels[2].Text := FloatToStr(RoundTo(Engine.DrawDuration / OneMillisecond, -2)); 100 StatusBar1.Panels[3].Text := Format(SRound, [IntToStr(Engine.CurrentRound), 101 IntToStr(Engine.MaxRound)]); 102 finally 103 Engine.Lock.Release; 91 if Assigned(Engine) then begin 92 Engine.Lock.Acquire; 93 try 94 //StatusBar1.Panels[1].Text := IntToStr(TPlayer(Engine.Players[0]).Position.X) + ', ' + 95 // IntToStr(TPlayer(Engine.Players[0]).Position.Y) + ' ' + 96 // IntToStr(TPlayer(Engine.Players[0]).Direction); 97 StatusBar1.Panels[2].Text := FloatToStr(RoundTo(Engine.DrawDuration / OneMillisecond, -2)); 98 StatusBar1.Panels[3].Text := Format(SRound, [IntToStr(Engine.CurrentRound), 99 IntToStr(Engine.MaxRound)]); 100 finally 101 Engine.Lock.Release; 102 end; 104 103 end; 105 104 finally -
trunk/Languages/Tunneler.cs.po
r52 r53 13 13 14 14 #: tformdebug.caption 15 #, fuzzy16 15 msgctxt "tformdebug.caption" 17 16 msgid "Debug" … … 19 18 20 19 #: tformgameresult.caption 21 #, fuzzy22 20 msgctxt "tformgameresult.caption" 23 21 msgid "Game result" … … 25 23 26 24 #: tformmain.aabout.caption 27 #, fuzzy28 25 msgctxt "tformmain.aabout.caption" 29 26 msgid "About" … … 31 28 32 29 #: tformmain.aexit.caption 33 #, fuzzy34 30 msgctxt "tformmain.aexit.caption" 35 31 msgid "Exit" … … 37 33 38 34 #: tformmain.afullscreen.caption 39 #, fuzzy40 35 msgctxt "tformmain.afullscreen.caption" 41 36 msgid "Fullscreen mode" 42 msgstr " ReÅŸim celé obrazovky"37 msgstr "Celá obrazovka" 43 38 44 39 #: tformmain.anewgame.caption 45 #, fuzzy46 40 msgctxt "tformmain.anewgame.caption" 47 41 msgid "New game" … … 49 43 50 44 #: tformmain.ashowmap.caption 51 #, fuzzy52 45 msgctxt "tformmain.ashowmap.caption" 53 46 msgid "Show map" … … 55 48 56 49 #: tformmain.ashowrawimagedesc.caption 57 #, fuzzy58 50 msgctxt "tformmain.ashowrawimagedesc.caption" 59 51 msgid "Show RawImage Description" … … 61 53 62 54 #: tformmain.caption 63 #, fuzzy64 55 msgctxt "tformmain.caption" 65 56 msgid "Tunneler" … … 67 58 68 59 #: tformmain.menuitem1.caption 69 #, fuzzy70 60 msgctxt "tformmain.menuitem1.caption" 71 61 msgid "Game" … … 73 63 74 64 #: tformmain.menuitem4.caption 75 #, fuzzy76 65 msgctxt "tformmain.menuitem4.caption" 77 66 msgid "View" … … 81 70 msgctxt "tformmain.menuitem7.caption" 82 71 msgid "Help" 83 msgstr " "72 msgstr "NápovÄda" 84 73 85 74 #: tformmap.caption 86 #, fuzzy87 75 msgctxt "tformmap.caption" 88 76 msgid "Map" … … 183 171 msgid "%0:s of %1:s" 184 172 msgstr "%0:s z %1:s" 185 -
trunk/Packages/Common/Common.lpk
r51 r53 41 41 Source: https://svn.zdechov.net/PascalClassLibrary/Common/"/> 42 42 <License Value="Copy left."/> 43 <Version Minor=" 8"/>43 <Version Minor="9"/> 44 44 <Files Count="29"> 45 45 <Item1> -
trunk/Packages/Common/UAboutDialog.pas
r51 r53 16 16 private 17 17 FApplicationInfo: TApplicationInfo; 18 F CoolTranslator: TTranslator;18 FTranslator: TTranslator; 19 19 FThemeManager: TThemeManager; 20 20 public … … 22 22 procedure Show; 23 23 published 24 property CoolTranslator: TTranslator read FCoolTranslator write FCoolTranslator;24 property Translator: TTranslator read FTranslator write FTranslator; 25 25 property ThemeManager: TThemeManager read FThemeManager write FThemeManager; 26 26 property ApplicationInfo: TApplicationInfo read FApplicationInfo write -
trunk/Packages/Common/UFormAbout.pas
r51 r53 50 50 if Assigned(AboutDialog) then 51 51 with TAboutDialog(AboutDialog) do begin 52 if Assigned( CoolTranslator) then53 CoolTranslator.TranslateComponentRecursive(Self);52 if Assigned(Translator) then 53 Translator.TranslateComponentRecursive(Self); 54 54 if Assigned(ThemeManager) then 55 55 ThemeManager.UseTheme(Self); -
trunk/Packages/Common/ULanguages.pas
r51 r53 1 1 unit ULanguages; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface 6 6 7 7 uses 8 Classes, SysUtils, Contnrs;8 Classes, SysUtils, fgl; 9 9 10 10 type … … 15 15 end; 16 16 17 { TLanguage List}18 19 TLanguage List = class(TObjectList)17 { TLanguages } 18 19 TLanguages = class(TFPGObjectList<TLanguage>) 20 20 function SearchByCode(ACode: string): TLanguage; 21 21 procedure AddNew(Code: string; Name: string); 22 constructor Create ;22 constructor Create(FreeObjects: Boolean = True); 23 23 end; 24 24 … … 223 223 224 224 225 { TLanguage List}226 227 function TLanguage List.SearchByCode(ACode: string): TLanguage;225 { TLanguages } 226 227 function TLanguages.SearchByCode(ACode: string): TLanguage; 228 228 var 229 229 I: Integer; … … 235 235 end; 236 236 237 procedure TLanguage List.AddNew(Code: string; Name: string);237 procedure TLanguages.AddNew(Code: string; Name: string); 238 238 var 239 239 NewItem: TLanguage; … … 245 245 end; 246 246 247 constructor TLanguage List.Create;247 constructor TLanguages.Create(FreeObjects: Boolean); 248 248 begin 249 inherited Create;249 inherited; 250 250 AddNew('', SLangAuto); 251 251 AddNew('aa', SLang_aa); -
trunk/Packages/Common/UTranslator.pas
r51 r53 1 1 unit UTranslator; 2 2 3 {$mode Delphi}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface 6 6 7 7 uses 8 Classes, SysUtils, Forms, ExtCtrls, Controls, Contnrs, LazFileUtils, LazUTF8,8 Classes, SysUtils, Forms, ExtCtrls, Controls, fgl, LazFileUtils, LazUTF8, 9 9 Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType, 10 10 LCLVersion; … … 12 12 type 13 13 THandleStringEvent = function (AValue: string): string of object; 14 15 TPoFiles = class(TFPGObjectList<TPOFile>) 16 end; 14 17 15 18 { TComponentExcludes } … … 24 27 { TComponentExcludesList } 25 28 26 TComponentExcludesList = class(T ObjectList)29 TComponentExcludesList = class(TFPGObjectList<TComponentExcludes>) 27 30 function FindByClassType(AClassType: TClass): TComponentExcludes; 28 31 procedure DumpToStrings(Strings: TStrings); … … 36 39 FOnAutomaticLanguage: THandleStringEvent; 37 40 FOnTranslate: TNotifyEvent; 38 FP OFilesFolder: string;39 FP OFiles: TObjectList; // TObjectList<TPOFile>;41 FPoFilesFolder: string; 42 FPoFiles: TPoFiles; 40 43 function GetLocale: string; 41 44 function GetLocaleShort: string; … … 50 53 public 51 54 ComponentExcludes: TComponentExcludesList; 52 Languages: TLanguage List;55 Languages: TLanguages; 53 56 procedure Translate; 54 procedure LanguageListToStrings(Strings: TStrings );57 procedure LanguageListToStrings(Strings: TStrings; WithCode: Boolean = True); 55 58 procedure TranslateResourceStrings(PoFileName: string); 56 59 procedure TranslateUnitResourceStrings(UnitName: string; PoFileName: string); … … 63 66 destructor Destroy; override; 64 67 published 65 property POFilesFolder: string read FP OFilesFolder write SetPOFilesFolder;68 property POFilesFolder: string read FPoFilesFolder write SetPOFilesFolder; 66 69 property Language: TLanguage read FLanguage write SetLanguage; 67 70 property OnTranslate: TNotifyEvent read FOnTranslate write FOnTranslate; … … 71 74 72 75 procedure Register; 76 73 77 74 78 implementation … … 117 121 destructor TComponentExcludes.Destroy; 118 122 begin 119 PropertyExcludes.Free;120 inherited Destroy;123 FreeAndNil(PropertyExcludes); 124 inherited; 121 125 end; 122 126 … … 128 132 I, J: Integer; 129 133 Po: TPoFile; 130 Item: TP OFileItem;134 Item: TPoFileItem; 131 135 begin 132 136 TranslateComponentRecursive(Application); … … 134 138 // Merge files to single translation file 135 139 try 136 Po := TP OFile.Create;137 for I := 0 to FP OFiles.Count - 1 do140 Po := TPoFile.Create; 141 for I := 0 to FPoFiles.Count - 1 do 138 142 with TPoFile(FPoFiles[I]) do 139 143 for J := 0 to Items.Count - 1 do … … 162 166 SearchMask: string; 163 167 begin 164 FP OFiles.Clear;168 FPoFiles.Clear; 165 169 if Assigned(FLanguage) then 166 170 try … … 177 181 if FileExists(FileName) and ( 178 182 ((LocaleShort = '') and (Pos('.', FileName) = Pos('.po', FileName))) or 179 (LocaleShort <> '')) then FP OFiles.Add(TPOFile.Create(FileName));183 (LocaleShort <> '')) then FPoFiles.Add(TPOFile.Create(FileName)); 180 184 end; 181 185 finally … … 281 285 var 282 286 Item: TClass; 283 284 287 Excludes: TComponentExcludes; 285 288 begin … … 301 304 function TTranslator.GetLangFileDir: string; 302 305 begin 303 Result := FP OFilesFolder;306 Result := FPoFilesFolder; 304 307 if Copy(Result, 1, 1) <> DirectorySeparator then 305 308 Result := ExtractFileDir(Application.ExeName) + … … 307 310 end; 308 311 309 procedure TTranslator.LanguageListToStrings(Strings: TStrings );312 procedure TTranslator.LanguageListToStrings(Strings: TStrings; WithCode: Boolean = True); 310 313 var 311 314 I: Integer; … … 313 316 begin 314 317 with Strings do begin 315 Clear; 316 for I := 0 to Languages.Count - 1 do 317 with TLanguage(Languages[I]) do 318 if Available then begin 319 ItemName := Name; 320 if Code <> '' then ItemName := ItemName + ' (' + Code + ')'; 321 AddObject(ItemName, Languages[I]); 322 end; 318 BeginUpdate; 319 try 320 Clear; 321 for I := 0 to Languages.Count - 1 do 322 with Languages[I] do 323 if Available then begin 324 ItemName := Name; 325 if WithCode and (Code <> '') then ItemName := ItemName + ' (' + Code + ')'; 326 AddObject(ItemName, Languages[I]); 327 end; 328 finally 329 EndUpdate; 330 end; 323 331 end; 324 332 end; … … 342 350 if Text <> '' then begin 343 351 for I := 0 to FPoFiles.Count - 1 do begin 344 Result := TPoFile(FP OFiles[I]).Translate(Identifier, Text);352 Result := TPoFile(FPoFiles[I]).Translate(Identifier, Text); 345 353 if Result <> Text then Break; 346 354 end; … … 369 377 begin 370 378 LangDir := GetLangFileDir; 371 TLanguage(Languages[0]).Available := True; // Automatic379 Languages.SearchByCode('').Available := True; // Automatic 372 380 373 381 for I := 1 to Languages.Count - 1 do 374 with TLanguage(Languages[I])do begin382 with Languages[I] do begin 375 383 Available := FileExists(LangDir + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) + 376 384 '.' + Code + ExtensionSeparator + 'po') or (Code = 'en'); … … 381 389 begin 382 390 inherited; 383 FP OFiles := TObjectList.Create;391 FPoFiles := TPoFiles.Create; 384 392 ComponentExcludes := TComponentExcludesList.Create; 385 Languages := TLanguage List.Create;393 Languages := TLanguages.Create; 386 394 POFilesFolder := 'Languages'; 387 395 CheckLanguageFiles; … … 395 403 destructor TTranslator.Destroy; 396 404 begin 397 F POFiles.Free;398 Languages.Free;399 ComponentExcludes.Free;400 inherited Destroy;405 FreeAndNil(FPoFiles); 406 FreeAndNil(Languages); 407 FreeAndNil(ComponentExcludes); 408 inherited; 401 409 end; 402 410 -
trunk/tunneler.lpi
r52 r53 65 65 </Item2> 66 66 <SharedMatrixOptions Count="2"> 67 <Item1 ID="486260008827" Targets="Common, CoolTranslator,TemplateGenerics,CoolAudio" Modes="Debug" Value="-g -gl -gh -CirotR -O1"/>68 <Item2 ID="478750724916" Targets="Common, CoolTranslator,TemplateGenerics,CoolAudio" Modes="Release" Value="-CX -XX -O3"/>67 <Item1 ID="486260008827" Targets="Common,TemplateGenerics,CoolAudio" Modes="Debug" Value="-g -gl -gh -CirotR -O1"/> 68 <Item2 ID="478750724916" Targets="Common,TemplateGenerics,CoolAudio" Modes="Release" Value="-CX -XX -O3"/> 69 69 </SharedMatrixOptions> 70 70 </BuildModes>
Note:
See TracChangeset
for help on using the changeset viewer.