- Timestamp:
- Jun 29, 2023, 11:23:03 PM (17 months ago)
- Location:
- Common
- Files:
-
- 13 added
- 1 deleted
- 5 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
Common/Common.lpk
r563 r566 11 11 <PathDelim Value="\"/> 12 12 <SearchPaths> 13 <OtherUnitFiles Value="Forms"/> 13 14 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 14 15 </SearchPaths> … … 41 42 Source: https://svn.zdechov.net/PascalClassLibrary/Common/"/> 42 43 <License Value="Copy left."/> 43 <Version Minor="1 1"/>44 <Files Count="3 3">44 <Version Minor="12"/> 45 <Files Count="36"> 45 46 <Item1> 46 47 <Filename Value="StopWatch.pas"/> … … 159 160 </Item26> 160 161 <Item27> 161 <Filename Value=" FormAbout.pas"/>162 <UnitName Value=" FormAbout"/>162 <Filename Value="PixelPointer.pas"/> 163 <UnitName Value="PixelPointer"/> 163 164 </Item27> 164 165 <Item28> 165 <Filename Value="AboutDialog.pas"/> 166 <HasRegisterProc Value="True"/> 167 <UnitName Value="AboutDialog"/> 166 <Filename Value="DataFile.pas"/> 167 <UnitName Value="DataFile"/> 168 168 </Item28> 169 169 <Item29> 170 <Filename Value=" PixelPointer.pas"/>171 <UnitName Value=" PixelPointer"/>170 <Filename Value="TestCase.pas"/> 171 <UnitName Value="TestCase"/> 172 172 </Item29> 173 173 <Item30> 174 <Filename Value=" DataFile.pas"/>175 <UnitName Value=" DataFile"/>174 <Filename Value="Generics.pas"/> 175 <UnitName Value="Generics"/> 176 176 </Item30> 177 177 <Item31> 178 <Filename Value="TestCase.pas"/>179 <UnitName Value="TestCase"/>180 </Item31>181 <Item32>182 <Filename Value="Generics.pas"/>183 <UnitName Value="Generics"/>184 </Item32>185 <Item33>186 178 <Filename Value="CommonPackage.pas"/> 187 179 <Type Value="Main Unit"/> 188 180 <UnitName Value="CommonPackage"/> 181 </Item31> 182 <Item32> 183 <Filename Value="Table.pas"/> 184 <UnitName Value="Table"/> 185 </Item32> 186 <Item33> 187 <Filename Value="FormEx.pas"/> 188 <HasRegisterProc Value="True"/> 189 <UnitName Value="FormEx"/> 189 190 </Item33> 191 <Item34> 192 <Filename Value="Forms\FormTests.pas"/> 193 <UnitName Value="FormTests"/> 194 </Item34> 195 <Item35> 196 <Filename Value="Forms\FormTest.pas"/> 197 <UnitName Value="FormTest"/> 198 </Item35> 199 <Item36> 200 <Filename Value="Forms\FormAbout.pas"/> 201 <UnitName Value="FormAbout"/> 202 </Item36> 190 203 </Files> 191 204 <CompatibilityMode Value="True"/> -
Common/Common.pas
r563 r566 66 66 function IntToBin(Data: Int64; Count: Byte): string; 67 67 function Implode(Separator: Char; List: TList<string>): string; 68 function Implode(Separator: Char; List: TStringList; Around: string = ''): string; 68 69 function LastPos(const SubStr: String; const S: String): Integer; 69 70 function LoadFileToStr(const FileName: TFileName): AnsiString; … … 206 207 end;*) 207 208 209 function Implode(Separator: Char; List: TStringList; Around: string = ''): string; 210 var 211 I: Integer; 212 begin 213 Result := ''; 214 for I := 0 to List.Count - 1 do begin 215 Result := Result + Around + List[I] + Around; 216 if I < List.Count - 1 then Result := Result + Separator; 217 end; 218 end; 219 208 220 function LastPos(const SubStr: String; const S: String): Integer; 209 221 begin -
Common/CommonPackage.pas
r563 r566 9 9 10 10 uses 11 StopWatch, Common, DebugLog, Common.Delay, PrefixMultiplier, URI, Threading, 11 StopWatch, Common, DebugLog, Common.Delay, PrefixMultiplier, URI, Threading, 12 12 Memory, ResetableThread, Pool, LastOpenedList, RegistryEx, JobProgressView, 13 13 XML, ApplicationInfo, SyncCounter, ListViewSort, PersistentForm, FindFile, 14 14 ScaleDPI, Theme, StringTable, MetaCanvas, Geometric, Translator, Languages, 15 FormAbout, AboutDialog, PixelPointer, DataFile, TestCase, Generics,16 LazarusPackageIntf;15 PixelPointer, DataFile, TestCase, Generics, Table, FormEx, FormTests, 16 FormTest, FormAbout, LazarusPackageIntf; 17 17 18 18 implementation … … 31 31 RegisterUnit('Theme', @Theme.Register); 32 32 RegisterUnit('Translator', @Translator.Register); 33 RegisterUnit(' AboutDialog', @AboutDialog.Register);33 RegisterUnit('FormEx', @FormEx.Register); 34 34 end; 35 35 -
Common/DataFile.pas
r563 r566 77 77 procedure TDataFile.Assign(Source: TPersistent); 78 78 begin 79 inherited;80 79 if Source is TDataFile then begin 81 80 FFileName := TDataFile(Source).FFileName; 82 81 FModified := TDataFile(Source).FModified; 83 end ;82 end else inherited; 84 83 end; 85 84 -
Common/Forms/FormAbout.lfm
r565 r566 1 1 object FormAbout: TFormAbout 2 Left = 10143 Height = 3494 Top = 5775 Width = 6092 Left = 624 3 Height = 402 4 Top = 622 5 Width = 702 6 6 Caption = 'About' 7 ClientHeight = 3498 ClientWidth = 6099 DesignTimePPI = 1 257 ClientHeight = 402 8 ClientWidth = 702 9 DesignTimePPI = 144 10 10 OnShow = FormShow 11 11 Position = poScreenCenter 12 LCLVersion = '2.2. 4.0'12 LCLVersion = '2.2.6.0' 13 13 object LabelDescription: TLabel 14 Left = 2615 Height = 2 216 Top = 1 1717 Width = 55714 Left = 30 15 Height = 26 16 Top = 135 17 Width = 642 18 18 Align = alTop 19 BorderSpacing.Left = 2620 BorderSpacing.Right = 2621 BorderSpacing.Bottom = 2619 BorderSpacing.Left = 30 20 BorderSpacing.Right = 30 21 BorderSpacing.Bottom = 30 22 22 Caption = 'Description' 23 23 ParentColor = False … … 26 26 end 27 27 object LabelContent: TLabel 28 Left = 2629 Height = 2 230 Top = 1 6531 Width = 55728 Left = 30 29 Height = 26 30 Top = 191 31 Width = 642 32 32 Align = alTop 33 BorderSpacing.Around = 2633 BorderSpacing.Around = 30 34 34 Caption = ' ' 35 35 ParentColor = False … … 38 38 object PanelTop: TPanel 39 39 Left = 0 40 Height = 1 1740 Height = 135 41 41 Top = 0 42 Width = 60942 Width = 702 43 43 Align = alTop 44 44 BevelOuter = bvNone 45 ClientHeight = 1 1746 ClientWidth = 60945 ClientHeight = 135 46 ClientWidth = 702 47 47 FullRepaint = False 48 48 ParentFont = False 49 49 TabOrder = 0 50 50 object LabelAppName: TLabel 51 Left = 9452 Height = 7353 Top = 1754 Width = 48951 Left = 108 52 Height = 84 53 Top = 20 54 Width = 564 55 55 Anchors = [akTop, akLeft, akRight] 56 56 AutoSize = False 57 BorderSpacing.Around = 2657 BorderSpacing.Around = 30 58 58 Caption = 'Title' 59 Font.Height = - 5259 Font.Height = -60 60 60 ParentColor = False 61 61 ParentFont = False … … 63 63 end 64 64 object ImageLogo: TImage 65 Left = 2 166 Height = 6467 Top = 2668 Width = 6265 Left = 24 66 Height = 74 67 Top = 30 68 Width = 71 69 69 Proportional = True 70 70 Stretch = True … … 73 73 object PanelButtons: TPanel 74 74 Left = 0 75 Height = 6576 Top = 28477 Width = 60975 Height = 75 76 Top = 327 77 Width = 702 78 78 Align = alBottom 79 79 BevelOuter = bvNone 80 ClientHeight = 6581 ClientWidth = 60980 ClientHeight = 75 81 ClientWidth = 702 82 82 TabOrder = 1 83 83 object ButtonHomePage: TButton 84 Left = 2 185 Height = 3 386 Top = 2 187 Width = 2 2984 Left = 24 85 Height = 38 86 Top = 24 87 Width = 264 88 88 Anchors = [akLeft, akBottom] 89 89 Caption = 'Home page' … … 93 93 end 94 94 object ButtonClose: TButton 95 Left = 46196 Height = 3 397 Top = 2 198 Width = 1 2295 Left = 531 96 Height = 38 97 Top = 24 98 Width = 141 99 99 Anchors = [akRight, akBottom] 100 100 Caption = 'Close' -
Common/Forms/FormAbout.pas
r565 r566 5 5 uses 6 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, 7 StdCtrls, ExtCtrls, ApplicationInfo, Common, Translator, Theme ;7 StdCtrls, ExtCtrls, ApplicationInfo, Common, Translator, Theme, FormEx; 8 8 9 9 type 10 10 { TFormAbout } 11 11 12 TFormAbout = class(TForm )12 TFormAbout = class(TFormEx) 13 13 ButtonClose: TButton; 14 14 ButtonHomePage: TButton; … … 21 21 procedure ButtonHomePageClick(Sender: TObject); 22 22 procedure FormShow(Sender: TObject); 23 private 24 FApplicationInfo: TApplicationInfo; 23 25 public 24 AboutDialog: TObject; //TAboutDialog25 26 procedure UpdateInterface; 27 property ApplicationInfo: TApplicationInfo read FApplicationInfo write 28 FApplicationInfo; 26 29 end; 27 30 … … 30 33 31 34 {$R *.lfm} 32 33 uses34 AboutDialog;35 35 36 36 resourcestring … … 43 43 procedure TFormAbout.FormShow(Sender: TObject); 44 44 begin 45 if Assigned(AboutDialog) then 46 with TAboutDialog(AboutDialog) do begin 47 if Assigned(Translator) then 48 Translator.TranslateComponentRecursive(Self); 49 if Assigned(ThemeManager) then 50 ThemeManager.UseTheme(Self); 51 52 if Assigned(ApplicationInfo) then 53 with ApplicationInfo do begin 54 LabelAppName.Caption := AppName; 55 LabelContent.Caption := SVersion + ': ' + Version + LineEnding + 56 SReleaseDate + ': ' + DateToStr(ReleaseDate) + LineEnding + 57 SLicense + ': ' + License; 58 LabelDescription.Caption := Description; 59 ImageLogo.Picture.Bitmap.Assign(Icon); 60 end; 45 if Assigned(ApplicationInfo) then 46 with ApplicationInfo do begin 47 LabelAppName.Caption := AppName; 48 LabelContent.Caption := SVersion + ': ' + Version + LineEnding + 49 SReleaseDate + ': ' + DateToStr(ReleaseDate) + LineEnding + 50 SLicense + ': ' + License; 51 LabelDescription.Caption := Description; 52 ImageLogo.Picture.Bitmap.Assign(Icon); 61 53 end; 62 54 UpdateInterface; … … 65 57 procedure TFormAbout.UpdateInterface; 66 58 begin 67 ButtonHomePage.Enabled := Assigned(AboutDialog) and 68 Assigned(TAboutDialog(AboutDialog).ApplicationInfo); 59 ButtonHomePage.Enabled := Assigned(ApplicationInfo); 69 60 end; 70 61 71 62 procedure TFormAbout.ButtonHomePageClick(Sender: TObject); 72 63 begin 73 OpenWebPage( TAboutDialog(AboutDialog).ApplicationInfo.HomePage);64 OpenWebPage(ApplicationInfo.HomePage); 74 65 end; 75 66 -
Common/Translator.pas
r563 r566 48 48 procedure TranslateProperty(Component: TPersistent; PropInfo: PPropInfo); 49 49 function IsExcluded(Component: TPersistent; PropertyName: string): Boolean; 50 function GetLangFileDir : string;50 function GetLangFileDirs: TStrings; 51 51 public 52 52 ComponentExcludes: TComponentExcludesList; … … 71 71 end; 72 72 73 const 74 PoExt = '.po'; 75 73 76 procedure Register; 74 77 75 78 76 79 implementation 80 81 uses 82 Common; 77 83 78 84 procedure Register; … … 161 167 FileList: TStringList; 162 168 I: Integer; 169 J: Integer; 163 170 LocaleShort: string; 164 171 SearchMask: string; 172 LangDirs: TStrings; 165 173 begin 166 174 FPoFiles.Clear; 167 if Assigned(FLanguage) then 168 try 175 if Assigned(FLanguage) then begin 169 176 LocaleShort := GetLocaleShort; 170 //ShowMessage(ExtractFileDir(Application.ExeName) +171 // DirectorySeparator + 'Languages' + ' ' + '*.' + LocaleShort + '.po');172 177 SearchMask := '*'; 173 178 if LocaleShort <> '' then SearchMask := SearchMask + '.' + LocaleShort; 174 SearchMask := SearchMask + '.po'; 175 FileList := FindAllFiles(GetLangFileDir, SearchMask); 176 for I := 0 to FileList.Count - 1 do begin 177 FileName := FileList[I]; 178 //FileName := FindLocaleFileName('.po'); 179 if FileExists(FileName) and ( 180 ((LocaleShort = '') and (Pos('.', FileName) = Pos('.po', FileName))) or 181 (LocaleShort <> '')) then FPoFiles.Add(TPOFile.Create(FileName)); 182 end; 183 finally 184 FileList.Free; 179 SearchMask := SearchMask + PoExt; 180 LangDirs := GetLangFileDirs; 181 for J := 0 to LangDirs.Count - 1 do begin 182 FileList := FindAllFiles(LangDirs[J], SearchMask); 183 try 184 for I := 0 to FileList.Count - 1 do begin 185 FileName := FileList[I]; 186 //FileName := FindLocaleFileName('.po'); 187 if FileExists(FileName) and ( 188 ((LocaleShort = '') and (Pos('.', FileName) = Pos(PoExt, FileName))) or 189 (LocaleShort <> '')) then FPoFiles.Add(TPOFile.Create(FileName)); 190 end; 191 finally 192 FileList.Free; 193 end; 194 end; 195 LangDirs.Free; 185 196 end; 186 197 end; … … 299 310 end; 300 311 301 function TTranslator.GetLangFileDir: string; 302 begin 303 Result := FPoFilesFolder; 304 if Copy(Result, 1, 1) <> DirectorySeparator then 305 Result := ExtractFileDir(Application.ExeName) + 306 DirectorySeparator + Result; 312 function TTranslator.GetLangFileDirs: TStrings; 313 var 314 I: Integer; 315 begin 316 Result := TStringList.Create; 317 Result.Delimiter := ';'; 318 Result.StrictDelimiter := True; 319 Result.DelimitedText := FPoFilesFolder; 320 321 for I := 0 to Result.Count - 1 do begin 322 Result[I] := StringReplace(Result[I], '/', DirectorySeparator, [rfReplaceAll]); 323 Result[I] := StringReplace(Result[I], '\', DirectorySeparator, [rfReplaceAll]); 324 if Copy(Result[I], 1, 1) <> DirectorySeparator then 325 Result[I] := ExtractFileDir(Application.ExeName) + 326 DirectorySeparator + Result[I]; 327 end; 307 328 end; 308 329 … … 371 392 var 372 393 I: Integer; 373 LangDir: string; 374 begin 375 LangDir := GetLangFileDir; 394 J: Integer; 395 LangDirs: TStrings; 396 begin 397 LangDirs := GetLangFileDirs; 376 398 Languages.SearchByCode('').Available := True; // Automatic 377 399 378 400 for I := 1 to Languages.Count - 1 do 379 401 with Languages[I] do begin 380 Available := FileExists(LangDir + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) + 381 '.' + Code + ExtensionSeparator + 'po') or (Code = 'en'); 382 end; 402 for J := 0 to LangDirs.Count - 1 do begin 403 if FileExists(LangDirs[J] + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) + 404 '.' + Code + PoExt) or (Code = 'en') then begin 405 Available := True; 406 Continue; 407 end; 408 end; 409 end; 410 LangDirs.Free; 383 411 end; 384 412
Note:
See TracChangeset
for help on using the changeset viewer.