Changeset 93
- Timestamp:
- Jul 20, 2018, 10:25:06 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 5 deleted
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 6 6 compiled 7 7 heaptrclog.trc 8 LazFuck.dbg
-
- Property svn:ignore
-
trunk/Forms/UFormMain.pas
r92 r93 152 152 procedure TargetLogExecute(Lines: TStrings); 153 153 procedure TargetStateChanged(Sender: TObject); 154 procedure LoadFromRegistry( Root: HKEY; Key: string);155 procedure SaveToRegistry( Root: HKEY; Key: string);154 procedure LoadFromRegistry(Context: TRegistryContext); 155 procedure SaveToRegistry(Context: TRegistryContext); 156 156 procedure UpdateInterface; 157 157 procedure UpdateStatusBar; … … 189 189 begin 190 190 Core.Init; 191 LoadFromRegistry( HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);191 LoadFromRegistry(Core.ApplicationInfo.GetRegistryContext); 192 192 PageControlMain.TabIndex := 0; 193 if Core.OpenProjectOnStart and (Core.LastOpenedList.Items.Count > 0) then 194 ProjectOpen(Core.LastOpenedList.Items[0]) 195 else AProjectNew.Execute; 196 UpdateInterface; 197 UpdateToolBarHints; 198 UpdateTargetList; 199 DockInit; 200 Core.PersistentForm1.Load(Self, wsMaximized); 193 try 194 if Core.OpenProjectOnStart and (Core.LastOpenedList.Items.Count > 0) then 195 ProjectOpen(Core.LastOpenedList.Items[0]) 196 else AProjectNew.Execute; 197 finally 198 LastOpenedListChange(nil); 199 UpdateInterface; 200 UpdateToolBarHints; 201 UpdateTargetList; 202 DockInit; 203 Core.PersistentForm1.Load(Self, True); 204 end; 201 205 end; 202 206 … … 293 297 end; 294 298 295 procedure TFormMain.LoadFromRegistry( Root: HKEY; Key: string);299 procedure TFormMain.LoadFromRegistry(Context: TRegistryContext); 296 300 var 297 301 TargetName: string; … … 299 303 with TRegistryEx.Create do 300 304 try 301 RootKey := Root; 302 OpenKey(Key, True); 305 CurrentContext := Context; 303 306 TargetName := ReadStringWithDefault('TargetName', 'Interpretter'); 304 307 Core.CurrentTarget := Core.Targets.FindByName(TargetName); … … 314 317 end; 315 318 316 procedure TFormMain.SaveToRegistry( Root: HKEY; Key: string);319 procedure TFormMain.SaveToRegistry(Context: TRegistryContext); 317 320 begin 318 321 with TRegistryEx.Create do 319 322 try 320 RootKey := Root; 321 OpenKey(Key, True); 323 CurrentContext := Context; 322 324 WriteString('TargetName', Core.CurrentTarget.Name); 323 325 WriteBool('OptimizationAddSubEnabled', Core.Optimizations.AddSub); … … 397 399 procedure TFormMain.FormDestroy(Sender: TObject); 398 400 begin 399 SaveToRegistry( HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);401 SaveToRegistry(Core.ApplicationInfo.GetRegistryContext); 400 402 end; 401 403 -
trunk/LazFuck.lpi
r92 r93 19 19 <OutDir Value="Languages"/> 20 20 </i18n> 21 <MacroValues Count="1"/> 22 <BuildModes Count="4"> 21 <BuildModes Count="2"> 23 22 <Item1 Name="Debug" Default="True"/> 24 23 <Item2 Name="Release"> … … 32 31 <IncludeFiles Value="$(ProjOutDir)"/> 33 32 <OtherUnitFiles Value="Forms;Target"/> 34 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) "/>33 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 35 34 </SearchPaths> 36 35 <Parsing> … … 52 51 <GenerateDebugInfo Value="False"/> 53 52 </Debugging> 53 <LinkSmart Value="True"/> 54 54 <Options> 55 55 <Win32> … … 60 60 </CompilerOptions> 61 61 </Item2> 62 <Item3 Name="Windows 32-bit">63 <CompilerOptions>64 <Version Value="11"/>65 <PathDelim Value="\"/>66 <Target>67 <Filename Value="lib\$(TargetCPU)-$(TargetOS)\LazFuck"/>68 </Target>69 <SearchPaths>70 <IncludeFiles Value="$(ProjOutDir)"/>71 <OtherUnitFiles Value="Forms;Target"/>72 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>73 </SearchPaths>74 <Parsing>75 <SyntaxOptions>76 <SyntaxMode Value="Delphi"/>77 <CStyleOperator Value="False"/>78 <AllowLabel Value="False"/>79 <CPPInline Value="False"/>80 </SyntaxOptions>81 </Parsing>82 <CodeGeneration>83 <SmartLinkUnit Value="True"/>84 <TargetCPU Value="i386"/>85 <TargetOS Value="win32"/>86 <Optimizations>87 <OptimizationLevel Value="3"/>88 </Optimizations>89 </CodeGeneration>90 <Linking>91 <Debugging>92 <GenerateDebugInfo Value="False"/>93 </Debugging>94 <Options>95 <Win32>96 <GraphicApplication Value="True"/>97 </Win32>98 </Options>99 </Linking>100 </CompilerOptions>101 </Item3>102 <Item4 Name="Windows 64-bit">103 <CompilerOptions>104 <Version Value="11"/>105 <PathDelim Value="\"/>106 <Target>107 <Filename Value="lib\$(TargetCPU)-$(TargetOS)\LazFuck"/>108 </Target>109 <SearchPaths>110 <IncludeFiles Value="$(ProjOutDir)"/>111 <OtherUnitFiles Value="Forms;Target"/>112 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>113 </SearchPaths>114 <Parsing>115 <SyntaxOptions>116 <SyntaxMode Value="Delphi"/>117 <CStyleOperator Value="False"/>118 <AllowLabel Value="False"/>119 <CPPInline Value="False"/>120 </SyntaxOptions>121 </Parsing>122 <CodeGeneration>123 <SmartLinkUnit Value="True"/>124 <TargetCPU Value="x86_64"/>125 <TargetOS Value="win64"/>126 <Optimizations>127 <OptimizationLevel Value="3"/>128 </Optimizations>129 </CodeGeneration>130 <Linking>131 <Debugging>132 <GenerateDebugInfo Value="False"/>133 </Debugging>134 <Options>135 <Win32>136 <GraphicApplication Value="True"/>137 </Win32>138 </Options>139 </Linking>140 </CompilerOptions>141 </Item4>142 <SharedMatrixOptions Count="1">143 <Item1 ID="509373414797" Modes="Debug" Type="IDEMacro"/>144 </SharedMatrixOptions>145 62 </BuildModes> 146 63 <PublishOptions> … … 335 252 <IncludeFiles Value="$(ProjOutDir)"/> 336 253 <OtherUnitFiles Value="Forms;Target"/> 337 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) "/>254 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 338 255 </SearchPaths> 339 256 <Parsing> … … 358 275 <Debugging> 359 276 <UseHeaptrc Value="True"/> 277 <UseExternalDbgSyms Value="True"/> 360 278 </Debugging> 361 279 <Options> -
trunk/Packages/Common/Common.lpk
r73 r93 11 11 <PathDelim Value="\"/> 12 12 <SearchPaths> 13 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) "/>13 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 14 14 </SearchPaths> 15 <Parsing> 16 <SyntaxOptions> 17 <SyntaxMode Value="Delphi"/> 18 <CStyleOperator Value="False"/> 19 <AllowLabel Value="False"/> 20 <CPPInline Value="False"/> 21 </SyntaxOptions> 22 </Parsing> 23 <CodeGeneration> 24 <Optimizations> 25 <OptimizationLevel Value="0"/> 26 </Optimizations> 27 </CodeGeneration> 28 <Linking> 29 <Debugging> 30 <GenerateDebugInfo Value="False"/> 31 </Debugging> 32 </Linking> 33 <Other> 34 <CompilerMessages> 35 <IgnoredMessages idx5024="True"/> 36 </CompilerMessages> 37 </Other> 15 38 </CompilerOptions> 16 39 <Description Value="Various libraries"/> 17 40 <License Value="GNU/GPL"/> 18 41 <Version Minor="7"/> 19 <Files Count="2 0">42 <Files Count="22"> 20 43 <Item1> 21 44 <Filename Value="StopWatch.pas"/> … … 106 129 <UnitName Value="UScaleDPI"/> 107 130 </Item20> 131 <Item21> 132 <Filename Value="UTheme.pas"/> 133 <HasRegisterProc Value="True"/> 134 <UnitName Value="UTheme"/> 135 </Item21> 136 <Item22> 137 <Filename Value="UStringTable.pas"/> 138 <UnitName Value="UStringTable"/> 139 </Item22> 108 140 </Files> 109 141 <i18n> -
trunk/Packages/Common/Common.pas
r73 r93 5 5 unit Common; 6 6 7 {$warn 5023 off : no warning about unused units} 7 8 interface 8 9 … … 11 12 UMemory, UResetableThread, UPool, ULastOpenedList, URegistry, 12 13 UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort, 13 UPersistentForm, UFindFile, UScaleDPI, LazarusPackageIntf; 14 UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, 15 LazarusPackageIntf; 14 16 15 17 implementation … … 25 27 RegisterUnit('UFindFile', @UFindFile.Register); 26 28 RegisterUnit('UScaleDPI', @UScaleDPI.Register); 29 RegisterUnit('UTheme', @UTheme.Register); 27 30 end; 28 31 -
trunk/Packages/Common/Languages
-
Property svn:ignore
set to
*.mo
-
Property svn:ignore
set to
-
trunk/Packages/Common/Languages/UJobProgressView.po
r73 r93 15 15 16 16 #: ujobprogressview.soperations 17 msgid "Operations "17 msgid "Operations:" 18 18 msgstr "" 19 19 -
trunk/Packages/Common/UApplicationInfo.pas
r73 r93 6 6 7 7 uses 8 SysUtils, Registry, Classes, Forms, URegistry;8 SysUtils, Classes, Forms, URegistry, Controls; 9 9 10 10 type … … 14 14 TApplicationInfo = class(TComponent) 15 15 private 16 FDescription: TCaption; 16 17 FIdentification: Byte; 17 18 FLicense: string; … … 33 34 constructor Create(AOwner: TComponent); override; 34 35 property Version: string read GetVersion; 36 function GetRegistryContext: TRegistryContext; 35 37 published 36 38 property Identification: Byte read FIdentification write FIdentification; … … 45 47 property EmailContact: string read FEmailContact write FEmailContact; 46 48 property AppName: string read FAppName write FAppName; 49 property Description: string read FDescription write FDescription; 47 50 property ReleaseDate: TDateTime read FReleaseDate write FReleaseDate; 48 51 property RegistryKey: string read FRegistryKey write FRegistryKey; … … 54 57 55 58 implementation 56 59 57 60 procedure Register; 58 61 begin … … 79 82 end; 80 83 84 function TApplicationInfo.GetRegistryContext: TRegistryContext; 85 begin 86 Result := TRegistryContext.Create(RegistryRoot, RegistryKey); 87 end; 88 81 89 end. -
trunk/Packages/Common/UCommon.pas
r74 r93 28 28 unfDNSDomainName = 11); 29 29 30 TFilterMethodMethod = function (FileName: string): Boolean of object; 30 31 var 31 32 ExceptionHandler: TExceptionEvent; … … 63 64 procedure OpenWebPage(URL: string); 64 65 procedure OpenFileInShell(FileName: string); 65 procedure ExecuteProgram( CommandLine:string);66 procedure ExecuteProgram(Executable: string; Parameters: array of string); 66 67 procedure FreeThenNil(var Obj); 67 68 function RemoveQuotes(Text: string): string; … … 71 72 function MergeArray(A, B: array of string): TArrayOfString; 72 73 function LoadFileToStr(const FileName: TFileName): AnsiString; 74 procedure SearchFiles(AList: TStrings; Dir: string; 75 FilterMethod: TFilterMethodMethod = nil); 76 function GetStringPart(var Text: string; Separator: string): string; 77 function PosFromIndex(SubStr: string; Text: string; 78 StartIndex: Integer): Integer; 79 function PosFromIndexReverse(SubStr: string; Text: string; 80 StartIndex: Integer): Integer; 73 81 74 82 … … 112 120 Path := IncludeTrailingPathDelimiter(APath); 113 121 114 Find := FindFirst( UTF8Decode(Path + AFileSpec), faAnyFile xor faDirectory, SearchRec);122 Find := FindFirst(Path + AFileSpec, faAnyFile xor faDirectory, SearchRec); 115 123 while Find = 0 do begin 116 DeleteFile(Path + UTF8Encode(SearchRec.Name));124 DeleteFile(Path + SearchRec.Name); 117 125 118 126 Find := SysUtils.FindNext(SearchRec); … … 429 437 end; 430 438 431 procedure ExecuteProgram( CommandLine:string);439 procedure ExecuteProgram(Executable: string; Parameters: array of string); 432 440 var 433 441 Process: TProcess; 442 I: Integer; 434 443 begin 435 444 try 436 445 Process := TProcess.Create(nil); 437 Process.CommandLine := CommandLine; 446 Process.Executable := Executable; 447 for I := 0 to Length(Parameters) - 1 do 448 Process.Parameters.Add(Parameters[I]); 438 449 Process.Options := [poNoConsole]; 439 450 Process.Execute; … … 456 467 procedure OpenFileInShell(FileName: string); 457 468 begin 458 ExecuteProgram('cmd.exe /c start "' + FileName + '"');469 ExecuteProgram('cmd.exe', ['/c', 'start', FileName]); 459 470 end; 460 471 … … 511 522 end; 512 523 513 524 function DefaultSearchFilter(const FileName: string): Boolean; 525 begin 526 Result := True; 527 end; 528 529 procedure SearchFiles(AList: TStrings; Dir: string; 530 FilterMethod: TFilterMethodMethod = nil); 531 var 532 SR: TSearchRec; 533 begin 534 Dir := IncludeTrailingPathDelimiter(Dir); 535 if FindFirst(Dir + '*', faAnyFile, SR) = 0 then 536 try 537 repeat 538 if (SR.Name = '.') or (SR.Name = '..') or (Assigned(FilterMethod) and (not FilterMethod(SR.Name) or 539 not FilterMethod(Copy(Dir, 3, Length(Dir)) + SR.Name))) then Continue; 540 AList.Add(Dir + SR.Name); 541 if (SR.Attr and faDirectory) <> 0 then 542 SearchFiles(AList, Dir + SR.Name, FilterMethod); 543 until FindNext(SR) <> 0; 544 finally 545 FindClose(SR); 546 end; 547 end; 548 549 function GetStringPart(var Text: string; Separator: string): string; 550 var 551 P: Integer; 552 begin 553 P := Pos(Separator, Text); 554 if P > 0 then begin 555 Result := Copy(Text, 1, P - 1); 556 Delete(Text, 1, P - 1 + Length(Separator)); 557 end else begin 558 Result := Text; 559 Text := ''; 560 end; 561 Result := Trim(Result); 562 Text := Trim(Text); 563 end; 564 565 function PosFromIndex(SubStr: string; Text: string; 566 StartIndex: Integer): Integer; 567 var 568 I, MaxLen: SizeInt; 569 Ptr: PAnsiChar; 570 begin 571 Result := 0; 572 if (StartIndex < 1) or (StartIndex > Length(Text) - Length(SubStr)) then Exit; 573 if Length(SubStr) > 0 then begin 574 MaxLen := Length(Text) - Length(SubStr) + 1; 575 I := StartIndex; 576 Ptr := @Text[StartIndex]; 577 while (I <= MaxLen) do begin 578 if (SubStr[1] = Ptr^) and (CompareByte(Substr[1], Ptr^, Length(SubStr)) = 0) then begin 579 Result := I; 580 Exit; 581 end; 582 Inc(I); 583 Inc(Ptr); 584 end; 585 end; 586 end; 587 588 function PosFromIndexReverse(SubStr: string; Text: string; 589 StartIndex: Integer): Integer; 590 var 591 I: SizeInt; 592 Ptr: PAnsiChar; 593 begin 594 Result := 0; 595 if (StartIndex < 1) or (StartIndex > Length(Text)) then Exit; 596 if Length(SubStr) > 0 then begin 597 I := StartIndex; 598 Ptr := @Text[StartIndex]; 599 while (I > 0) do begin 600 if (SubStr[1] = Ptr^) and (CompareByte(Substr[1], Ptr^, Length(SubStr)) = 0) then begin 601 Result := I; 602 Exit; 603 end; 604 Dec(I); 605 Dec(Ptr); 606 end; 607 end; 608 end; 514 609 515 610 initialization -
trunk/Packages/Common/UDebugLog.pas
r73 r93 104 104 if ExtractFileDir(FileName) <> '' then 105 105 ForceDirectories(ExtractFileDir(FileName)); 106 if FileExists(FileName) then LogFile := TFileStream.Create( UTF8Decode(FileName), fmOpenWrite)107 else LogFile := TFileStream.Create( UTF8Decode(FileName), fmCreate);106 if FileExists(FileName) then LogFile := TFileStream.Create(FileName, fmOpenWrite) 107 else LogFile := TFileStream.Create(FileName, fmCreate); 108 108 LogFile.Seek(0, soFromEnd); 109 109 Text := FormatDateTime('hh:nn:ss.zzz', Now) + ': ' + Text + LineEnding; -
trunk/Packages/Common/UFindFile.pas
r73 r93 24 24 25 25 uses 26 SysUtils, Classes, Graphics, Controls, Forms, Dialogs , FileCtrl;26 SysUtils, Classes, Graphics, Controls, Forms, Dialogs; 27 27 28 28 type … … 117 117 Attr := 0; 118 118 if ffaReadOnly in FileAttr then Attr := Attr + faReadOnly; 119 if ffaHidden in FileAttr then Attr := Attr + faHidden;120 if ffaSysFile in FileAttr then Attr := Attr + faSysFile;121 if ffaVolumeID in FileAttr then Attr := Attr + faVolumeID;119 if ffaHidden in FileAttr then Attr := Attr + 2; //faHidden; use constant to avoid platform warning 120 if ffaSysFile in FileAttr then Attr := Attr + 4; //faSysFile; use constant to avoid platform warning 121 // Deprecated: if ffaVolumeID in FileAttr then Attr := Attr + faVolumeID; 122 122 if ffaDirectory in FileAttr then Attr := Attr + faDirectory; 123 123 if ffaArchive in FileAttr then Attr := Attr + faArchive; 124 124 if ffaAnyFile in FileAttr then Attr := Attr + faAnyFile; 125 125 126 if SysUtils.FindFirst( UTF8Decode(inPath + FileMask), Attr, Rec) = 0 then126 if SysUtils.FindFirst(inPath + FileMask, Attr, Rec) = 0 then 127 127 try 128 128 repeat 129 s.Add(inPath + UTF8Encode(Rec.Name));129 s.Add(inPath + Rec.Name); 130 130 until SysUtils.FindNext(Rec) <> 0; 131 131 finally … … 135 135 If not InSubFolders then Exit; 136 136 137 if SysUtils.FindFirst( UTF8Decode(inPath + FilterAll), faDirectory, Rec) = 0 then137 if SysUtils.FindFirst(inPath + FilterAll, faDirectory, Rec) = 0 then 138 138 try 139 139 repeat 140 140 if ((Rec.Attr and faDirectory) > 0) and (Rec.Name <> '.') 141 141 and (Rec.Name <> '..') then 142 FileSearch(IncludeTrailingBackslash(inPath + UTF8Encode(Rec.Name)));142 FileSearch(IncludeTrailingBackslash(inPath + Rec.Name)); 143 143 until SysUtils.FindNext(Rec) <> 0; 144 144 finally -
trunk/Packages/Common/UJobProgressView.lfm
r73 r93 1 1 object FormJobProgressView: TFormJobProgressView 2 2 Left = 467 3 Height = 2463 Height = 345 4 4 Top = 252 5 Width = 3285 Width = 539 6 6 BorderIcons = [biSystemMenu] 7 ClientHeight = 246 8 ClientWidth = 328 9 Font.Height = -11 10 Font.Name = 'MS Sans Serif' 7 ClientHeight = 345 8 ClientWidth = 539 9 DesignTimePPI = 120 11 10 OnClose = FormClose 12 11 OnCloseQuery = FormCloseQuery 13 12 OnCreate = FormCreate 14 13 OnDestroy = FormDestroy 14 OnHide = FormHide 15 OnShow = FormShow 15 16 Position = poScreenCenter 16 LCLVersion = '1. 6.0.4'17 LCLVersion = '1.8.2.0' 17 18 object PanelOperationsTitle: TPanel 18 19 Left = 0 19 Height = 2420 Height = 32 20 21 Top = 0 21 Width = 32822 Align = alTop 23 BevelOuter = bvNone 24 ClientHeight = 2425 ClientWidth = 32822 Width = 539 23 Align = alTop 24 BevelOuter = bvNone 25 ClientHeight = 32 26 ClientWidth = 539 26 27 FullRepaint = False 27 28 TabOrder = 0 28 29 object LabelOperation: TLabel 29 30 Left = 8 30 Height = 1331 Height = 20 31 32 Top = 8 32 Width = 6633 Width = 76 33 34 Caption = 'Operations:' 34 Font.Height = -1135 Font.Name = 'MS Sans Serif'36 Font.Style = [fsBold]37 35 ParentColor = False 38 36 ParentFont = False … … 41 39 object PanelLog: TPanel 42 40 Left = 0 43 Height = 1 2244 Top = 12445 Width = 32841 Height = 133 42 Top = 212 43 Width = 539 46 44 Align = alClient 47 45 BevelOuter = bvSpace 48 ClientHeight = 1 2249 ClientWidth = 32846 ClientHeight = 133 47 ClientWidth = 539 50 48 TabOrder = 1 51 49 object MemoLog: TMemo 52 50 Left = 8 53 Height = 1 0651 Height = 117 54 52 Top = 8 55 Width = 31253 Width = 523 56 54 Anchors = [akTop, akLeft, akRight, akBottom] 57 55 ReadOnly = True … … 62 60 object PanelProgress: TPanel 63 61 Left = 0 64 Height = 3865 Top = 5066 Width = 32867 Align = alTop 68 BevelOuter = bvNone 69 ClientHeight = 3870 ClientWidth = 32862 Height = 54 63 Top = 106 64 Width = 539 65 Align = alTop 66 BevelOuter = bvNone 67 ClientHeight = 54 68 ClientWidth = 539 71 69 TabOrder = 2 72 70 object ProgressBarPart: TProgressBar 73 Left = 874 Height = 1775 Top = 1676 Width = 31271 Left = 10 72 Height = 24 73 Top = 24 74 Width = 523 77 75 Anchors = [akTop, akLeft, akRight] 78 76 TabOrder = 0 … … 80 78 object LabelEstimatedTimePart: TLabel 81 79 Left = 8 82 Height = 1380 Height = 20 83 81 Top = -2 84 Width = 7182 Width = 103 85 83 Caption = 'Estimated time:' 86 84 ParentColor = False … … 89 87 object PanelOperations: TPanel 90 88 Left = 0 91 Height = 2692 Top = 2493 Width = 32894 Align = alTop 95 BevelOuter = bvNone 96 ClientHeight = 2697 ClientWidth = 32889 Height = 42 90 Top = 64 91 Width = 539 92 Align = alTop 93 BevelOuter = bvNone 94 ClientHeight = 42 95 ClientWidth = 539 98 96 FullRepaint = False 99 97 TabOrder = 3 100 98 object ListViewJobs: TListView 101 99 Left = 8 102 Height = 16100 Height = 32 103 101 Top = 5 104 Width = 312102 Width = 523 105 103 Anchors = [akTop, akLeft, akRight, akBottom] 106 104 AutoWidthLastColumn = True … … 109 107 Columns = < 110 108 item 111 Width = 312109 Width = 523 112 110 end> 113 111 OwnerData = True … … 122 120 object PanelProgressTotal: TPanel 123 121 Left = 0 124 Height = 36125 Top = 88126 Width = 328127 Align = alTop 128 BevelOuter = bvNone 129 ClientHeight = 36130 ClientWidth = 328122 Height = 52 123 Top = 160 124 Width = 539 125 Align = alTop 126 BevelOuter = bvNone 127 ClientHeight = 52 128 ClientWidth = 539 131 129 TabOrder = 4 132 130 object LabelEstimatedTimeTotal: TLabel 133 131 Left = 8 134 Height = 13132 Height = 20 135 133 Top = 0 136 Width = 97134 Width = 141 137 135 Caption = 'Total estimated time:' 138 136 ParentColor = False … … 140 138 object ProgressBarTotal: TProgressBar 141 139 Left = 8 142 Height = 16143 Top = 16144 Width = 312140 Height = 24 141 Top = 24 142 Width = 523 145 143 Anchors = [akTop, akLeft, akRight] 146 144 TabOrder = 0 145 end 146 end 147 object PanelText: TPanel 148 Left = 0 149 Height = 32 150 Top = 32 151 Width = 539 152 Align = alTop 153 BevelOuter = bvNone 154 ClientHeight = 32 155 ClientWidth = 539 156 TabOrder = 5 157 object LabelText: TLabel 158 Left = 8 159 Height = 24 160 Top = 8 161 Width = 525 162 Anchors = [akTop, akLeft, akRight] 163 AutoSize = False 164 ParentColor = False 147 165 end 148 166 end -
trunk/Packages/Common/UJobProgressView.pas
r73 r93 7 7 uses 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs, 9 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, 9 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, Math, 10 10 DateUtils; 11 11 … … 13 13 EstimatedTimeShowTreshold = 4; 14 14 EstimatedTimeShowTresholdTotal = 1; 15 MemoLogHeight = 200;16 15 UpdateInterval = 100; // ms 17 16 … … 24 23 FLock: TCriticalSection; 25 24 FOnChange: TNotifyEvent; 25 FText: string; 26 26 FValue: Integer; 27 27 FMax: Integer; 28 28 procedure SetMax(const AValue: Integer); 29 procedure SetText(AValue: string); 29 30 procedure SetValue(const AValue: Integer); 30 31 public … … 35 36 property Value: Integer read FValue write SetValue; 36 37 property Max: Integer read FMax write SetMax; 38 property Text: string read FText write SetText; 37 39 property OnChange: TNotifyEvent read FOnChange write FOnChange; 38 40 end; … … 69 71 end; 70 72 73 TJobs = class(TObjectList) 74 end; 75 71 76 TJobThread = class(TListedThread) 72 77 procedure Execute; override; … … 80 85 TFormJobProgressView = class(TForm) 81 86 ImageList1: TImageList; 87 LabelText: TLabel; 82 88 Label2: TLabel; 83 89 LabelOperation: TLabel; … … 86 92 ListViewJobs: TListView; 87 93 MemoLog: TMemo; 94 PanelText: TPanel; 88 95 PanelProgressTotal: TPanel; 89 96 PanelOperationsTitle: TPanel; … … 94 101 ProgressBarTotal: TProgressBar; 95 102 TimerUpdate: TTimer; 103 procedure FormHide(Sender: TObject); 104 procedure FormShow(Sender: TObject); 105 procedure ReloadJobList; 96 106 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 97 107 procedure FormDestroy(Sender: TObject); … … 100 110 procedure FormCreate(Sender: TObject); 101 111 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); 112 procedure UpdateHeight; 102 113 public 103 114 JobProgressView: TJobProgressView; … … 118 129 TotalStartTime: TDateTime; 119 130 Log: TStringList; 131 FForm: TFormJobProgressView; 120 132 procedure SetTerminate(const AValue: Boolean); 121 133 procedure UpdateProgress; 122 procedure ReloadJobList;123 procedure StartJobs;124 procedure UpdateHeight;125 134 procedure JobProgressChange(Sender: TObject); 126 135 public 127 Form: TFormJobProgressView; 128 Jobs: TObjectList; // TListObject<TJob> 136 Jobs: TJobs; 129 137 CurrentJob: TJob; 130 138 CurrentJobIndex: Integer; … … 132 140 destructor Destroy; override; 133 141 procedure Clear; 134 procedureAddJob(Title: string; Method: TJobProgressViewMethod;135 NoThreaded: Boolean = False; WaitFor: Boolean = False) ;136 procedure Start (AAutoClose: Boolean = True);142 function AddJob(Title: string; Method: TJobProgressViewMethod; 143 NoThreaded: Boolean = False; WaitFor: Boolean = False): TJob; 144 procedure Start; 137 145 procedure Stop; 138 146 procedure TermSleep(Delay: Integer); 147 property Form: TFormJobProgressView read FForm; 139 148 property Terminate: Boolean read FTerminate write SetTerminate; 140 149 published … … 166 175 STotalEstimatedTime = 'Total estimated time: %s'; 167 176 SFinished = 'Finished'; 168 SOperations = 'Operations ';177 SOperations = 'Operations:'; 169 178 170 179 procedure Register; … … 172 181 RegisterComponents('Common', [TJobProgressView]); 173 182 end; 183 184 { TJobThread } 174 185 175 186 procedure TJobThread.Execute; … … 190 201 end; 191 202 192 procedure TJobProgressView.AddJob(Title: string; Method: TJobProgressViewMethod; 193 NoThreaded: Boolean = False; WaitFor: Boolean = False); 203 { TFormJobProgressView } 204 205 procedure TFormJobProgressView.UpdateHeight; 194 206 var 195 NewJob: TJob; 196 begin 197 NewJob := TJob.Create; 198 NewJob.ProgressView := Self; 199 NewJob.Title := Title; 200 NewJob.Method := Method; 201 NewJob.NoThreaded := NoThreaded; 202 NewJob.WaitFor := WaitFor; 203 NewJob.Progress.Max := 100; 204 NewJob.Progress.Reset; 205 NewJob.Progress.OnChange := JobProgressChange; 206 Jobs.Add(NewJob); 207 H: Integer; 208 PanelOperationsVisible: Boolean; 209 PanelOperationsHeight: Integer; 210 PanelProgressVisible: Boolean; 211 PanelProgressTotalVisible: Boolean; 212 PanelLogVisible: Boolean; 213 MemoLogHeight: Integer = 200; 214 I: Integer; 215 ItemRect: TRect; 216 MaxH: Integer; 217 begin 218 H := PanelOperationsTitle.Height; 219 PanelOperationsVisible := JobProgressView.Jobs.Count > 0; 220 if PanelOperationsVisible <> PanelOperations.Visible then 221 PanelOperations.Visible := PanelOperationsVisible; 222 if ListViewJobs.Items.Count > 0 then begin 223 Maxh := 0; 224 for I := 0 to ListViewJobs.Items.Count - 1 do 225 begin 226 ItemRect := ListViewJobs.Items[i].DisplayRect(drBounds); 227 Maxh := Max(Maxh, ItemRect.Top + (ItemRect.Bottom - ItemRect.Top)); 228 end; 229 PanelOperationsHeight := Scale96ToScreen(12) + Maxh; 230 end else PanelOperationsHeight := Scale96ToScreen(8); 231 if PanelOperationsHeight <> PanelOperations.Height then 232 PanelOperations.Height := PanelOperationsHeight; 233 if PanelOperationsVisible then 234 H := H + PanelOperations.Height; 235 236 PanelProgressVisible := (JobProgressView.Jobs.Count > 0) and not JobProgressView.Finished; 237 if PanelProgressVisible <> PanelProgress.Visible then 238 PanelProgress.Visible := PanelProgressVisible; 239 if PanelProgressVisible then 240 H := H + PanelProgress.Height; 241 PanelProgressTotalVisible := (JobProgressView.Jobs.Count > 1) and not JobProgressView.Finished; 242 if PanelProgressTotalVisible <> PanelProgressTotal.Visible then 243 PanelProgressTotal.Visible := PanelProgressTotalVisible; 244 if PanelProgressTotalVisible then 245 H := H + PanelProgressTotal.Height; 246 Constraints.MinHeight := H; 247 PanelLogVisible := MemoLog.Lines.Count > 0; 248 if PanelLogVisible <> PanelLog.Visible then 249 PanelLog.Visible := PanelLogVisible; 250 if PanelLogVisible then 251 H := H + Scale96ToScreen(MemoLogHeight); 252 if PanelText.Visible then 253 H := H + PanelText.Height; 254 if Height <> H then begin 255 Height := H; 256 Top := (Screen.Height - H) div 2; 257 end; 258 end; 259 260 procedure TFormJobProgressView.TimerUpdateTimer(Sender: TObject); 261 var 262 ProgressBarPartVisible: Boolean; 263 ProgressBarTotalVisible: Boolean; 264 begin 265 JobProgressView.UpdateProgress; 266 if Visible and (not ProgressBarPart.Visible) and 267 Assigned(JobProgressView.CurrentJob) and 268 (JobProgressView.CurrentJob.Progress.Value > 0) then begin 269 ProgressBarPartVisible := True; 270 if ProgressBarPartVisible <> ProgressBarPart.Visible then 271 ProgressBarPart.Visible := ProgressBarPartVisible; 272 ProgressBarTotalVisible := True; 273 if ProgressBarTotalVisible <> ProgressBarTotal.Visible then 274 ProgressBarTotal.Visible := ProgressBarTotalVisible; 275 end; 276 if not Visible then begin 277 TimerUpdate.Interval := UpdateInterval; 278 if not JobProgressView.OwnerDraw then Show; 279 end; 280 if Assigned(JobProgressView.CurrentJob) then begin 281 LabelText.Caption := JobProgressView.CurrentJob.Progress.Text; 282 if LabelText.Caption <> '' then begin 283 PanelText.Visible := True; 284 UpdateHeight; 285 end; 286 end; 287 end; 288 289 procedure TFormJobProgressView.FormDestroy(Sender:TObject); 290 begin 291 end; 292 293 procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem); 294 begin 295 if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then 296 with TJob(JobProgressView.Jobs[Item.Index]) do begin 297 Item.Caption := Title; 298 if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1 299 else if Finished then Item.ImageIndex := 0 300 else Item.ImageIndex := 2; 301 Item.Data := JobProgressView.Jobs[Item.Index]; 302 end; 303 end; 304 305 procedure TFormJobProgressView.FormClose(Sender: TObject; 306 var CloseAction: TCloseAction); 307 begin 308 end; 309 310 procedure TFormJobProgressView.FormCreate(Sender: TObject); 311 begin 312 Caption := SPleaseWait; 313 try 314 //Animate1.FileName := ExtractFileDir(UTF8Encode(Application.ExeName)) + 315 // DirectorySeparator + 'horse.avi'; 316 //Animate1.Active := True; 317 except 318 319 end; 320 end; 321 322 procedure TFormJobProgressView.ReloadJobList; 323 begin 324 // Workaround for not showing first line 325 //Form.ListViewJobs.Items.Count := Jobs.Count + 1; 326 //Form.ListViewJobs.Refresh; 327 328 if ListViewJobs.Items.Count <> JobProgressView.Jobs.Count then 329 ListViewJobs.Items.Count := JobProgressView.Jobs.Count; 330 ListViewJobs.Refresh; 331 Application.ProcessMessages; 332 UpdateHeight; 333 end; 334 335 procedure TFormJobProgressView.FormShow(Sender: TObject); 336 begin 337 ReloadJobList; 338 end; 339 340 procedure TFormJobProgressView.FormHide(Sender: TObject); 341 begin 342 JobProgressView.Jobs.Clear; 343 ReloadJobList; 344 end; 345 346 procedure TFormJobProgressView.FormCloseQuery(Sender: TObject; var CanClose: Boolean); 347 begin 348 CanClose := JobProgressView.Finished; 349 JobProgressView.Terminate := True; 350 Caption := SPleaseWait + STerminate; 351 end; 352 353 354 { TJobProgressView } 355 356 function TJobProgressView.AddJob(Title: string; Method: TJobProgressViewMethod; 357 NoThreaded: Boolean = False; WaitFor: Boolean = False): TJob; 358 begin 359 Result := TJob.Create; 360 Result.ProgressView := Self; 361 Result.Title := Title; 362 Result.Method := Method; 363 Result.NoThreaded := NoThreaded; 364 Result.WaitFor := WaitFor; 365 Result.Progress.Max := 100; 366 Result.Progress.Reset; 367 Result.Progress.OnChange := JobProgressChange; 368 Jobs.Add(Result); 207 369 //ReloadJobList; 208 370 end; 209 371 210 procedure TJobProgressView.Start(AAutoClose: Boolean = True); 211 begin 212 AutoClose := AAutoClose; 213 StartJobs; 214 end; 215 216 procedure TJobProgressView.StartJobs; 372 procedure TJobProgressView.Start; 217 373 var 218 374 I: Integer; … … 229 385 Form.MemoLog.Clear; 230 386 387 Form.PanelText.Visible := False; 231 388 Form.LabelEstimatedTimePart.Visible := False; 232 389 Form.LabelEstimatedTimeTotal.Visible := False; … … 258 415 Form.ProgressBarPart.Visible := False; 259 416 //Show; 260 ReloadJobList;417 Form.ReloadJobList; 261 418 Application.ProcessMessages; 262 419 if NoThreaded then begin … … 296 453 //if Visible then Hide; 297 454 Form.MemoLog.Lines.Assign(Log); 298 if (Form.MemoLog.Lines.Count = 0) and AutoClose then begin455 if (Form.MemoLog.Lines.Count = 0) and FAutoClose then begin 299 456 Form.Hide; 300 457 end; 301 Clear;458 if not Form.Visible then Clear; 302 459 Form.Caption := SFinished; 303 460 //LabelEstimatedTimePart.Visible := False; 304 461 Finished := True; 305 462 CurrentJobIndex := -1; 306 ReloadJobList; 307 end; 308 end; 309 310 procedure TJobProgressView.UpdateHeight; 311 var 312 H: Integer; 313 PanelOperationsVisible: Boolean; 314 PanelOperationsHeight: Integer; 315 PanelProgressVisible: Boolean; 316 PanelProgressTotalVisible: Boolean; 317 PanelLogVisible: Boolean; 318 begin 319 with Form do begin 320 H := PanelOperationsTitle.Height; 321 PanelOperationsVisible := Jobs.Count > 0; 322 if PanelOperationsVisible <> PanelOperations.Visible then 323 PanelOperations.Visible := PanelOperationsVisible; 324 PanelOperationsHeight := 8 + 18 * Jobs.Count; 325 if PanelOperationsHeight <> PanelOperations.Height then 326 PanelOperations.Height := PanelOperationsHeight; 327 if PanelOperationsVisible then 328 H := H + PanelOperations.Height; 329 330 PanelProgressVisible := (Jobs.Count > 0) and not Finished; 331 if PanelProgressVisible <> PanelProgress.Visible then 332 PanelProgress.Visible := PanelProgressVisible; 333 if PanelProgressVisible then 334 H := H + PanelProgress.Height; 335 PanelProgressTotalVisible := (Jobs.Count > 1) and not Finished; 336 if PanelProgressTotalVisible <> PanelProgressTotal.Visible then 337 PanelProgressTotal.Visible := PanelProgressTotalVisible; 338 if PanelProgressTotalVisible then 339 H := H + PanelProgressTotal.Height; 340 Constraints.MinHeight := H; 341 PanelLogVisible := MemoLog.Lines.Count > 0; 342 if PanelLogVisible <> PanelLog.Visible then 343 PanelLog.Visible := PanelLogVisible; 344 if PanelLogVisible then 345 H := H + MemoLogHeight; 346 if Height <> H then Height := H; 463 Form.ReloadJobList; 347 464 end; 348 465 end; … … 352 469 if Assigned(FOnOwnerDraw) then 353 470 FOnOwnerDraw(Self); 354 end;355 356 procedure TFormJobProgressView.TimerUpdateTimer(Sender: TObject);357 var358 ProgressBarPartVisible: Boolean;359 ProgressBarTotalVisible: Boolean;360 begin361 JobProgressView.UpdateProgress;362 if Visible and (not ProgressBarPart.Visible) and363 Assigned(JobProgressView.CurrentJob) and364 (JobProgressView.CurrentJob.Progress.Value > 0) then begin365 ProgressBarPartVisible := True;366 if ProgressBarPartVisible <> ProgressBarPart.Visible then367 ProgressBarPart.Visible := ProgressBarPartVisible;368 ProgressBarTotalVisible := True;369 if ProgressBarTotalVisible <> ProgressBarTotal.Visible then370 ProgressBarTotal.Visible := ProgressBarTotalVisible;371 end;372 if not Visible then begin373 TimerUpdate.Interval := UpdateInterval;374 if not JobProgressView.OwnerDraw then Show;375 end;376 end;377 378 procedure TFormJobProgressView.FormDestroy(Sender:TObject);379 begin380 end;381 382 procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem);383 begin384 if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then385 with TJob(JobProgressView.Jobs[Item.Index]) do begin386 Item.Caption := Title;387 if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1388 else if Finished then Item.ImageIndex := 0389 else Item.ImageIndex := 2;390 Item.Data := JobProgressView.Jobs[Item.Index];391 end;392 end;393 394 procedure TFormJobProgressView.FormClose(Sender: TObject;395 var CloseAction: TCloseAction);396 begin397 ListViewJobs.Clear;398 end;399 400 procedure TFormJobProgressView.FormCreate(Sender: TObject);401 begin402 Caption := SPleaseWait;403 try404 //Animate1.FileName := ExtractFileDir(UTF8Encode(Application.ExeName)) +405 // DirectorySeparator + 'horse.avi';406 //Animate1.Active := True;407 except408 409 end;410 471 end; 411 472 … … 426 487 Sleep(Quantum); 427 488 end; 428 end;429 430 procedure TFormJobProgressView.FormCloseQuery(Sender: TObject; var CanClose: Boolean);431 begin432 CanClose := JobProgressView.Finished;433 JobProgressView.Terminate := True;434 Caption := SPleaseWait + STerminate;435 489 end; 436 490 … … 490 544 end; 491 545 492 procedure TJobProgressView.ReloadJobList;493 begin494 UpdateHeight;495 // Workaround for not showing first line496 Form.ListViewJobs.Items.Count := Jobs.Count + 1;497 Form.ListViewJobs.Refresh;498 499 if Form.ListViewJobs.Items.Count <> Jobs.Count then500 Form.ListViewJobs.Items.Count := Jobs.Count;501 Form.ListViewJobs.Refresh;502 //Application.ProcessMessages;503 end;504 505 546 constructor TJobProgressView.Create(TheOwner: TComponent); 506 547 begin 507 548 inherited; 508 549 if not (csDesigning in ComponentState) then begin 509 F orm := TFormJobProgressView.Create(Self);510 F orm.JobProgressView := Self;511 end; 512 Jobs := T ObjectList.Create;550 FForm := TFormJobProgressView.Create(Self); 551 FForm.JobProgressView := Self; 552 end; 553 Jobs := TJobs.Create; 513 554 Log := TStringList.Create; 514 555 //PanelOperationsTitle.Height := 80; 515 ShowDelay := 0; //1000; // ms 556 AutoClose := True; 557 ShowDelay := 0; 516 558 end; 517 559 … … 519 561 begin 520 562 Jobs.Clear; 563 Log.Clear; 521 564 //ReloadJobList; 522 565 end; … … 528 571 inherited; 529 572 end; 573 574 { TProgress } 530 575 531 576 procedure TProgress.SetMax(const AValue: Integer); … … 536 581 if FMax < 1 then FMax := 1; 537 582 if FValue >= FMax then FValue := FMax; 583 finally 584 FLock.Release; 585 end; 586 end; 587 588 procedure TProgress.SetText(AValue: string); 589 begin 590 try 591 FLock.Acquire; 592 if FText = AValue then Exit; 593 FText := AValue; 538 594 finally 539 595 FLock.Release; … … 563 619 end; 564 620 565 { TProgress }566 567 621 procedure TProgress.Increment; 568 622 begin -
trunk/Packages/Common/ULastOpenedList.pas
r73 r93 6 6 7 7 uses 8 Classes, SysUtils, Registry, URegistry, Menus, XMLConf ;8 Classes, SysUtils, Registry, URegistry, Menus, XMLConf, DOM; 9 9 10 10 type … … 139 139 OpenKey(Context.Key, True); 140 140 for I := 0 to Items.Count - 1 do 141 WriteString('File' + IntToStr(I), UTF8Decode(Items[I]));141 WriteString('File' + IntToStr(I), Items[I]); 142 142 finally 143 143 Free; … … 153 153 begin 154 154 with XMLConfig do begin 155 Count := GetValue( Path + '/Count', 0);155 Count := GetValue(DOMString(Path + '/Count'), 0); 156 156 if Count > MaxCount then Count := MaxCount; 157 157 Items.Clear; 158 158 for I := 0 to Count - 1 do begin 159 Value := GetValue(Path + '/File' + IntToStr(I), '');159 Value := string(GetValue(DOMString(Path + '/File' + IntToStr(I)), '')); 160 160 if Trim(Value) <> '' then Items.Add(Value); 161 161 end; … … 170 170 begin 171 171 with XMLConfig do begin 172 SetValue( Path + '/Count', Items.Count);172 SetValue(DOMString(Path + '/Count'), Items.Count); 173 173 for I := 0 to Items.Count - 1 do 174 SetValue( Path + '/File' + IntToStr(I), Items[I]);174 SetValue(DOMString(Path + '/File' + IntToStr(I)), DOMString(Items[I])); 175 175 Flush; 176 176 end; -
trunk/Packages/Common/UListViewSort.pas
r73 r93 81 81 FOnChange: TNotifyEvent; 82 82 FStringGrid1: TStringGrid; 83 procedure DoOnKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);84 procedure DoOnResize(Sender: TObject);83 procedure GridDoOnKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 84 procedure GridDoOnResize(Sender: TObject); 85 85 public 86 86 constructor Create(AOwner: TComponent); override; … … 110 110 { TListViewFilter } 111 111 112 procedure TListViewFilter. DoOnKeyUp(Sender: TObject; var Key: Word;112 procedure TListViewFilter.GridDoOnKeyUp(Sender: TObject; var Key: Word; 113 113 Shift: TShiftState); 114 114 begin … … 117 117 end; 118 118 119 procedure TListViewFilter. DoOnResize(Sender: TObject);119 procedure TListViewFilter.GridDoOnResize(Sender: TObject); 120 120 begin 121 121 FStringGrid1.DefaultRowHeight := FStringGrid1.Height; … … 135 135 FStringGrid1.Options := [goFixedHorzLine, goFixedVertLine, goVertLine, 136 136 goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll]; 137 FStringGrid1.OnKeyUp := DoOnKeyUp;138 FStringGrid1.OnResize := DoOnResize;137 FStringGrid1.OnKeyUp := GridDoOnKeyUp; 138 FStringGrid1.OnResize := GridDoOnResize; 139 139 end; 140 140 … … 142 142 var 143 143 I: Integer; 144 R: TRect; 144 145 begin 145 146 with FStringGrid1 do begin 146 //Columns.Clear;147 147 while Columns.Count > ListView.Columns.Count do Columns.Delete(Columns.Count - 1); 148 148 while Columns.Count < ListView.Columns.Count do Columns.Add; 149 149 for I := 0 to ListView.Columns.Count - 1 do begin 150 150 Columns[I].Width := ListView.Columns[I].Width; 151 if Selection.Left = I then begin 152 R := CellRect(I, 0); 153 Editor.Left := R.Left + 2; 154 Editor.Width := R.Width - 4; 155 end; 151 156 end; 152 157 end; … … 197 202 if AMsg.Msg = WM_NOTIFY then 198 203 begin 199 Code := PHDNotify(vMsgNotify.NMHdr)^.Hdr.Code;204 Code := NMHDR(PHDNotify(vMsgNotify.NMHdr)^.Hdr).Code; 200 205 case Code of 201 206 HDN_ENDTRACKA, HDN_ENDTRACKW: … … 353 358 TP1: TPoint; 354 359 XBias, YBias: Integer; 355 OldColor: TColor; 360 PenColor: TColor; 361 BrushColor: TColor; 356 362 BiasTop, BiasLeft: Integer; 357 363 Rect1: TRect; … … 365 371 Item.Left := 0; 366 372 GetCheckBias(XBias, YBias, BiasTop, BiasLeft, ListView); 367 OldColor := ListView.Canvas.Pen.Color; 373 PenColor := ListView.Canvas.Pen.Color; 374 BrushColor := ListView.Canvas.Brush.Color; 368 375 //TP1 := Item.GetPosition; 369 376 lRect := Item.DisplayRect(drBounds); // Windows 7 workaround … … 377 384 ItemLeft := Item.Left; 378 385 ItemLeft := 23; // Windows 7 workaround 379 386 380 387 Rect1.Left := ItemLeft - CheckWidth - BiasLeft + 1 + XBias; 381 388 //ShowMessage(IntToStr(Tp1.Y) + ', ' + IntToStr(BiasTop) + ', ' + IntToStr(XBias)); … … 408 415 end; 409 416 //ListView.Canvas.Brush.Color := ListView.Color; 410 ListView.Canvas.Brush.Color := clWindow;411 ListView.Canvas.Pen.Color := OldColor;417 ListView.Canvas.Brush.Color := BrushColor; 418 ListView.Canvas.Pen.Color := PenColor; 412 419 end; 413 420 … … 476 483 FHeaderHandle := ListView_GetHeader(FListView.Handle); 477 484 for I := 0 to FListView.Columns.Count - 1 do begin 485 {$push}{$warn 5057 off} 478 486 FillChar(Item, SizeOf(THDItem), 0); 487 {$pop} 479 488 Item.Mask := HDI_FORMAT; 480 489 Header_GetItem(FHeaderHandle, I, Item); -
trunk/Packages/Common/UMemory.pas
r59 r93 24 24 constructor Create; 25 25 destructor Destroy; override; 26 procedure WriteMemory(Position: Integer; Memory: TMemory); 27 procedure ReadMemory(Position: Integer; Memory: TMemory); 26 28 property Data: PByte read FData; 27 29 property Size: Integer read FSize write SetSize; … … 108 110 end; 109 111 112 procedure TMemory.WriteMemory(Position: Integer; Memory: TMemory); 113 begin 114 Move(Memory.FData, PByte(@FData + Position)^, Memory.Size); 115 end; 116 117 procedure TMemory.ReadMemory(Position: Integer; Memory: TMemory); 118 begin 119 Move(PByte(@FData + Position)^, Memory.FData, Memory.Size); 120 end; 121 110 122 end. 111 123 -
trunk/Packages/Common/UPersistentForm.pas
r81 r93 8 8 9 9 uses 10 Classes, SysUtils, Forms, URegistry, LCLIntf, Registry, Controls, ComCtrls; 10 Classes, SysUtils, Forms, URegistry, LCLIntf, Registry, Controls, ComCtrls, 11 ExtCtrls; 11 12 12 13 type … … 26 27 FormWindowState: TWindowState; 27 28 Form: TForm; 28 DefaultFormWindowState: TWindowState;29 29 procedure LoadFromRegistry(RegistryContext: TRegistryContext); 30 30 procedure SaveToRegistry(RegistryContext: TRegistryContext); 31 31 function CheckEntireVisible(Rect: TRect): TRect; 32 32 function CheckPartVisible(Rect: TRect; Part: Integer): TRect; 33 procedure Load(Form: TForm; Default FormWindowState: TWindowState = wsNormal);33 procedure Load(Form: TForm; DefaultMaximized: Boolean = False); 34 34 procedure Save(Form: TForm); 35 35 constructor Create(AOwner: TComponent); override; … … 72 72 end; 73 73 74 if (Control is TPanel) then begin 75 with Form, TRegistryEx.Create do 76 try 77 RootKey := RegistryContext.RootKey; 78 OpenKey(RegistryContext.Key + '\Forms\' + Form.Name + '\' + Control.Name, True); 79 if (TPanel(Control).Align = alRight) or (TPanel(Control).Align = alLeft) then begin 80 if ValueExists('Width') then 81 TPanel(Control).Width := ReadInteger('Width'); 82 end; 83 if (TPanel(Control).Align = alTop) or (TPanel(Control).Align = alBottom) then begin 84 if ValueExists('Height') then 85 TPanel(Control).Height := ReadInteger('Height'); 86 end; 87 finally 88 Free; 89 end; 90 end; 91 74 92 if Control is TWinControl then begin 75 93 WinControl := TWinControl(Control); … … 96 114 for I := 0 to TListView(Control).Columns.Count - 1 do begin 97 115 WriteInteger('ColWidth' + IntToStr(I), TListView(Control).Columns[I].Width); 116 end; 117 finally 118 Free; 119 end; 120 end; 121 122 if (Control is TPanel) then begin 123 with Form, TRegistryEx.Create do 124 try 125 RootKey := RegistryContext.RootKey; 126 OpenKey(RegistryContext.Key + '\Forms\' + Form.Name + '\' + Control.Name, True); 127 if (TPanel(Control).Align = alRight) or (TPanel(Control).Align = alLeft) then begin 128 WriteInteger('Width', TPanel(Control).Width); 129 end; 130 if (TPanel(Control).Align = alTop) or (TPanel(Control).Align = alBottom) then begin 131 WriteInteger('Height', TPanel(Control).Height); 98 132 end; 99 133 finally … … 135 169 + FormRestoredSize.Top; 136 170 // Other state 137 FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer( DefaultFormWindowState)));171 FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(wsNormal))); 138 172 finally 139 173 Free; … … 216 250 end; 217 251 218 procedure TPersistentForm.Load(Form: TForm; Default FormWindowState: TWindowState = wsNormal);252 procedure TPersistentForm.Load(Form: TForm; DefaultMaximized: Boolean = False); 219 253 begin 220 254 Self.Form := Form; 221 Self.DefaultFormWindowState := DefaultFormWindowState;222 223 255 // Set default 224 256 FormNormalSize := Bounds((Screen.Width - Form.Width) div 2, … … 230 262 231 263 if not EqualRect(FormNormalSize, FormRestoredSize) or 232 (FormWindowState = wsMaximized)then begin264 DefaultMaximized then begin 233 265 // Restore to maximized state 234 266 Form.WindowState := wsNormal; -
trunk/Packages/Common/URegistry.pas
r59 r93 9 9 10 10 type 11 TRegistryRoot = (rrKeyClassesRoot = HKEY($80000000), 12 rrKeyCurrentUser = HKEY($80000001), 13 rrKeyLocalMachine = HKEY($80000002), 14 rrKeyUsers = HKEY($80000003), 15 rrKeyPerformanceData = HKEY($80000004), 16 rrKeyCurrentConfig = HKEY($80000005), 17 rrKeyDynData = HKEY($80000006)); 11 TRegistryRoot = (rrKeyClassesRoot, rrKeyCurrentUser, rrKeyLocalMachine, 12 rrKeyUsers, rrKeyPerformanceData, rrKeyCurrentConfig, rrKeyDynData); 18 13 19 14 { TRegistryContext } … … 23 18 Key: string; 24 19 class operator Equal(A, B: TRegistryContext): Boolean; 20 function Create(RootKey: TRegistryRoot; Key: string): TRegistryContext; overload; 21 function Create(RootKey: HKEY; Key: string): TRegistryContext; overload; 25 22 end; 26 23 … … 43 40 end; 44 41 45 function RegContext(RootKey: HKEY; Key: string): TRegistryContext; 46 42 const 43 RegistryRootHKEY: array[TRegistryRoot] of HKEY = (HKEY_CLASSES_ROOT, 44 HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_PERFORMANCE_DATA, 45 HKEY_CURRENT_CONFIG, HKEY_DYN_DATA); 47 46 48 47 implementation 49 48 50 function RegContext(RootKey: HKEY; Key: string): TRegistryContext;51 begin52 Result.RootKey := RootKey;53 Result.Key := Key;54 end;55 49 56 50 { TRegistryContext } … … 59 53 begin 60 54 Result := (A.Key = B.Key) and (A.RootKey = B.RootKey); 55 end; 56 57 function TRegistryContext.Create(RootKey: TRegistryRoot; Key: string): TRegistryContext; 58 begin 59 Result.RootKey := RegistryRootHKEY[RootKey]; 60 Result.Key := Key; 61 end; 62 63 function TRegistryContext.Create(RootKey: HKEY; Key: string): TRegistryContext; 64 begin 65 Result.RootKey := RootKey; 66 Result.Key := Key; 61 67 end; 62 68 -
trunk/Packages/Common/UResetableThread.pas
r59 r93 156 156 FThread.Name := 'ResetableThread'; 157 157 FThread.Parent := Self; 158 FThread. Resume;158 FThread.Start; 159 159 end; 160 160 -
trunk/Packages/Common/UScaleDPI.pas
r88 r93 215 215 I: Integer; 216 216 begin 217 ImgList.BeginUpdate; 217 218 NewWidth := ScaleX(ImgList.Width, FromDPI.X); 218 219 NewHeight := ScaleY(ImgList.Height, FromDPI.Y); … … 226 227 Temp[I] := TBitmap.Create; 227 228 Temp[I].SetSize(NewWidth, NewHeight); 228 {$ifdef linux}229 Temp[I].PixelFormat := pf24bit;230 {$else}231 229 Temp[I].PixelFormat := pf32bit; 232 {$endif}233 230 Temp[I].TransparentColor := TempBmp.TransparentColor; 234 231 //Temp[I].TransparentMode := TempBmp.TransparentMode; … … 252 249 Temp[i].Free; 253 250 end; 251 ImgList.EndUpdate; 254 252 end; 255 253 … … 288 286 WinControl: TWinControl; 289 287 ToolBarControl: TToolBar; 290 OldAnchors: TAnchors;291 OldAutoSize: Boolean;288 //OldAnchors: TAnchors; 289 //OldAutoSize: Boolean; 292 290 begin 293 291 //if Control is TMemo then Exit; … … 320 318 MinWidth := ScaleX(MinWidth, FromDPI.X); 321 319 MinHeight := ScaleY(MinHeight, FromDPI.Y); 322 Width := ScaleX(Width, FromDPI.X); 320 // Workaround to bad band width auto sizing 321 //Width := ScaleX(Width, FromDPI.X); 322 Width := ScaleX(Control.Width + 28, FromDPI.X); 323 323 //Control.Invalidate; 324 324 end; 325 // Workaround for bad autosizing of coolbar 326 if AutoSize then begin 327 AutoSize := False; 328 Height := ScaleY(Height, FromDPI.Y); 329 AutoSize := True; 330 end; 325 331 EndUpdate; 326 332 end; -
trunk/Packages/Common/UThreading.pas
r54 r93 30 30 Name: string; 31 31 procedure Execute; virtual; abstract; 32 procedure Resume; virtual; abstract;33 procedure Suspend; virtual; abstract;34 32 procedure Start; virtual; abstract; 35 33 procedure Terminate; virtual; abstract; … … 81 79 procedure Sleep(Delay: Integer); override; 82 80 procedure Execute; override; 83 procedure Resume; override;84 procedure Suspend; override;85 81 procedure Start; override; 86 82 procedure Terminate; override; … … 134 130 Thread.FreeOnTerminate := False; 135 131 Thread.Method := Method; 136 Thread. Resume;132 Thread.Start; 137 133 while (Thread.State = ttsRunning) or (Thread.State = ttsReady) do begin 138 134 if MainThreadID = ThreadID then Application.ProcessMessages; … … 155 151 Thread.Method := Method; 156 152 Thread.OnFinished := CallBack; 157 Thread. Resume;153 Thread.Start; 158 154 //if Thread.State = ttsExceptionOccured then 159 155 // raise Exception.Create(Thread.ExceptionMessage); … … 313 309 procedure TListedThread.Execute; 314 310 begin 315 end;316 317 procedure TListedThread.Resume;318 begin319 FThread.Resume;320 end;321 322 procedure TListedThread.Suspend;323 begin324 FThread.Suspend;325 311 end; 326 312 -
trunk/Packages/Common/UURI.pas
r73 r93 89 89 function LeftCutString(var Source: string; out Output: string; Delimiter: string; Allowed: string = ''): Boolean; 90 90 var 91 I , J: Integer;91 I: Integer; 92 92 Matched: Boolean; 93 93 begin … … 113 113 function RightCutString(var Source: string; out Output: string; Delimiter: string; Allowed: string = ''): Boolean; 114 114 var 115 I , J: Integer;115 I: Integer; 116 116 Matched: Boolean; 117 117 begin … … 202 202 203 203 procedure TURI.SetAsString(Value: string); 204 var205 HostAddr: string;206 HostPort: string;207 204 begin 208 205 LeftCutString(Value, Scheme, ':'); -
trunk/Packages/Common/UXMLUtils.pas
r73 r93 7 7 uses 8 8 {$IFDEF WINDOWS}Windows,{$ENDIF} 9 Classes, SysUtils, DateUtils, XMLRead, XMLWrite,DOM;9 Classes, SysUtils, DateUtils, DOM; 10 10 11 11 function XMLTimeToDateTime(XMLDateTime: string): TDateTime; 12 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): WideString;12 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): string; 13 13 procedure WriteInteger(Node: TDOMNode; Name: string; Value: Integer); 14 14 procedure WriteInt64(Node: TDOMNode; Name: string; Value: Int64); … … 30 30 TimeZoneInfo: TTimeZoneInformation; 31 31 begin 32 {$push}{$warn 5057 off} 32 33 case GetTimeZoneInformation(TimeZoneInfo) of 33 TIME_ZONE_ID_STANDARD: Result := TimeZoneInfo.Bias + TimeZoneInfo.StandardBias;34 TIME_ZONE_ID_DAYLIGHT: Result := TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias;34 TIME_ZONE_ID_STANDARD: Result := TimeZoneInfo.Bias + TimeZoneInfo.StandardBias; 35 TIME_ZONE_ID_DAYLIGHT: Result := TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias; 35 36 else 36 37 Result := 0; 37 38 end; 39 {$pop} 38 40 end; 39 41 {$ELSE} … … 45 47 function LeftCutString(var Source: string; out Output: string; Delimiter: string; Allowed: string = ''): Boolean; 46 48 var 47 I , J: Integer;49 I: Integer; 48 50 Matched: Boolean; 49 51 begin … … 99 101 if Pos('Z', XMLDateTime) > 0 then 100 102 LeftCutString(XMLDateTime, Part, 'Z'); 101 SecondFraction := StrToFloat('0' + De cimalSeparator + Part);103 SecondFraction := StrToFloat('0' + DefaultFormatSettings.DecimalSeparator + Part); 102 104 Millisecond := Trunc(SecondFraction * 1000); 103 105 end else begin … … 118 120 end; 119 121 120 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): WideString;122 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): string; 121 123 const 122 124 Neg: array[Boolean] of string = ('+', '-'); … … 139 141 NewNode: TDOMNode; 140 142 begin 141 NewNode := Node.OwnerDocument.CreateElement( Name);142 NewNode.TextContent := IntToStr(Value);143 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 144 NewNode.TextContent := DOMString(IntToStr(Value)); 143 145 Node.AppendChild(NewNode); 144 146 end; … … 148 150 NewNode: TDOMNode; 149 151 begin 150 NewNode := Node.OwnerDocument.CreateElement( Name);151 NewNode.TextContent := IntToStr(Value);152 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 153 NewNode.TextContent := DOMString(IntToStr(Value)); 152 154 Node.AppendChild(NewNode); 153 155 end; … … 157 159 NewNode: TDOMNode; 158 160 begin 159 NewNode := Node.OwnerDocument.CreateElement( Name);160 NewNode.TextContent := BoolToStr(Value);161 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 162 NewNode.TextContent := DOMString(BoolToStr(Value)); 161 163 Node.AppendChild(NewNode); 162 164 end; … … 166 168 NewNode: TDOMNode; 167 169 begin 168 NewNode := Node.OwnerDocument.CreateElement( Name);169 NewNode.TextContent := Value;170 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 171 NewNode.TextContent := DOMString(Value); 170 172 Node.AppendChild(NewNode); 171 173 end; … … 175 177 NewNode: TDOMNode; 176 178 begin 177 NewNode := Node.OwnerDocument.CreateElement( Name);178 NewNode.TextContent := D ateTimeToXMLTime(Value);179 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 180 NewNode.TextContent := DOMString(DateTimeToXMLTime(Value)); 179 181 Node.AppendChild(NewNode); 180 182 end; … … 185 187 begin 186 188 Result := DefaultValue; 187 NewNode := Node.FindNode( Name);188 if Assigned(NewNode) then 189 Result := StrToInt( NewNode.TextContent);189 NewNode := Node.FindNode(DOMString(Name)); 190 if Assigned(NewNode) then 191 Result := StrToInt(string(NewNode.TextContent)); 190 192 end; 191 193 … … 195 197 begin 196 198 Result := DefaultValue; 197 NewNode := Node.FindNode( Name);198 if Assigned(NewNode) then 199 Result := StrToInt64( NewNode.TextContent);199 NewNode := Node.FindNode(DOMString(Name)); 200 if Assigned(NewNode) then 201 Result := StrToInt64(string(NewNode.TextContent)); 200 202 end; 201 203 … … 205 207 begin 206 208 Result := DefaultValue; 207 NewNode := Node.FindNode( Name);208 if Assigned(NewNode) then 209 Result := StrToBool( NewNode.TextContent);209 NewNode := Node.FindNode(DOMString(Name)); 210 if Assigned(NewNode) then 211 Result := StrToBool(string(NewNode.TextContent)); 210 212 end; 211 213 … … 215 217 begin 216 218 Result := DefaultValue; 217 NewNode := Node.FindNode( Name);218 if Assigned(NewNode) then 219 Result := NewNode.TextContent;219 NewNode := Node.FindNode(DOMString(Name)); 220 if Assigned(NewNode) then 221 Result := string(NewNode.TextContent); 220 222 end; 221 223 … … 226 228 begin 227 229 Result := DefaultValue; 228 NewNode := Node.FindNode( Name);229 if Assigned(NewNode) then 230 Result := XMLTimeToDateTime( NewNode.TextContent);230 NewNode := Node.FindNode(DOMString(Name)); 231 if Assigned(NewNode) then 232 Result := XMLTimeToDateTime(string(NewNode.TextContent)); 231 233 end; 232 234 -
trunk/Packages/CoolTranslator/CoolTranslator.pas
r73 r93 3 3 } 4 4 5 unit CoolTranslator; 5 unit CoolTranslator; 6 6 7 7 interface … … 12 12 implementation 13 13 14 procedure Register; 14 procedure Register; 15 15 begin 16 RegisterUnit('UCoolTranslator', @UCoolTranslator.Register); 17 end; 16 RegisterUnit('UCoolTranslator', @UCoolTranslator.Register); 17 end; 18 18 19 19 initialization 20 RegisterPackage('CoolTranslator', @Register); 20 RegisterPackage('CoolTranslator', @Register); 21 21 end. -
trunk/Packages/CoolTranslator/Demo/Languages/TranslatorDemo.cs.po
r54 r93 10 10 "Content-Transfer-Encoding: 8bit\n" 11 11 12 #: TFORM1.FORM1.CAPTION12 #: tform1.form1.caption 13 13 msgctxt "TFORM1.FORM1.CAPTION" 14 14 msgid "Translator Demo" 15 15 msgstr "Ukázka Translatoru" 16 16 17 #: TMAINFORM.BUTTON1.CAPTION17 #: tmainform.button1.caption 18 18 msgid "Show MainForm.Name" 19 19 msgstr "Ukázat MainForm.Name" 20 20 21 #: TMAINFORM.CAPTION21 #: tmainform.caption 22 22 msgctxt "TMAINFORM.CAPTION" 23 23 msgid "Translator Demo" 24 24 msgstr "Ukázka Translatoru" 25 25 26 #: TMAINFORM.LABEL1.CAPTION26 #: tmainform.label1.caption 27 27 msgid "MainForm" 28 28 msgstr "HlavnÃFormuláÅ" 29 29 30 #: TMAINFORM.LABEL2.CAPTION30 #: tmainform.label2.caption 31 31 msgid "Form name as label caption:" 32 32 msgstr "Jméno formuláÅe jako titulek textu:" 33 33 34 #: TMAINFORM.LABEL3.CAPTION34 #: tmainform.label3.caption 35 35 msgid "Language list:" 36 36 msgstr "" 37 37 38 #: TMAINFORM.LABEL4.CAPTION38 #: tmainform.label4.caption 39 39 msgid "Excludes:" 40 40 msgstr "" -
trunk/Packages/CoolTranslator/Demo/Languages/TranslatorDemo.de.po
r54 r93 2 2 msgstr "Content-Type: text/plain; charset=UTF-8" 3 3 4 #: TFORM1.FORM1.CAPTION4 #: tform1.form1.caption 5 5 msgctxt "TFORM1.FORM1.CAPTION" 6 6 msgid "Translator Demo" 7 7 msgstr "" 8 8 9 #: TMAINFORM.BUTTON1.CAPTION9 #: tmainform.button1.caption 10 10 msgid "Show MainForm.Name" 11 11 msgstr "" 12 12 13 #: TMAINFORM.CAPTION13 #: tmainform.caption 14 14 msgctxt "TMAINFORM.CAPTION" 15 15 msgid "Translator Demo" 16 16 msgstr "" 17 17 18 #: TMAINFORM.LABEL1.CAPTION18 #: tmainform.label1.caption 19 19 msgid "MainForm" 20 20 msgstr "" 21 21 22 #: TMAINFORM.LABEL2.CAPTION22 #: tmainform.label2.caption 23 23 msgid "Form name as label caption:" 24 24 msgstr "" 25 25 26 #: TMAINFORM.LABEL3.CAPTION26 #: tmainform.label3.caption 27 27 msgid "Language list:" 28 28 msgstr "" 29 29 30 #: TMAINFORM.LABEL4.CAPTION30 #: tmainform.label4.caption 31 31 msgid "Excludes:" 32 32 msgstr "" -
trunk/Packages/CoolTranslator/Demo/Languages/TranslatorDemo.po
r54 r93 2 2 msgstr "Content-Type: text/plain; charset=UTF-8" 3 3 4 #: TFORM1.FORM1.CAPTION4 #: tform1.form1.caption 5 5 msgctxt "TFORM1.FORM1.CAPTION" 6 6 msgid "Translator Demo" 7 7 msgstr "" 8 8 9 #: TMAINFORM.BUTTON1.CAPTION9 #: tmainform.button1.caption 10 10 msgid "Show MainForm.Name" 11 11 msgstr "" 12 12 13 #: TMAINFORM.CAPTION13 #: tmainform.caption 14 14 msgctxt "TMAINFORM.CAPTION" 15 15 msgid "Translator Demo" 16 16 msgstr "" 17 17 18 #: TMAINFORM.LABEL1.CAPTION18 #: tmainform.label1.caption 19 19 msgid "MainForm" 20 20 msgstr "" 21 21 22 #: TMAINFORM.LABEL2.CAPTION22 #: tmainform.label2.caption 23 23 msgid "Form name as label caption:" 24 24 msgstr "" 25 25 26 #: TMAINFORM.LABEL3.CAPTION26 #: tmainform.label3.caption 27 27 msgid "Language list:" 28 28 msgstr "" 29 29 30 #: TMAINFORM.LABEL4.CAPTION30 #: tmainform.label4.caption 31 31 msgid "Excludes:" 32 32 msgstr "" -
trunk/Packages/CoolTranslator/Demo/TranslatorDemo.lpi
r54 r93 51 51 <IsPartOfProject Value="True"/> 52 52 <ComponentName Value="MainForm"/> 53 <HasResources Value="True"/> 53 54 <ResourceBaseClass Value="Form"/> 54 55 <UnitName Value="UMainForm"/> 56 <IsVisibleTab Value="True"/> 55 57 <EditorIndex Value="0"/> 56 58 <WindowIndex Value="0"/> … … 79 81 <Filename Value="..\UCoolTranslator.pas"/> 80 82 <UnitName Value="UCoolTranslator"/> 81 <IsVisibleTab Value="True"/>82 83 <EditorIndex Value="1"/> 83 84 <WindowIndex Value="0"/> 84 85 <TopLine Value="274"/> 85 <CursorPos X=" 1" Y="286"/>86 <CursorPos X="33" Y="288"/> 86 87 <UsageCount Value="11"/> 87 88 <Loaded Value="True"/> … … 265 266 </ProjectOptions> 266 267 <CompilerOptions> 267 <Version Value="1 0"/>268 <Version Value="11"/> 268 269 <PathDelim Value="\"/> 269 270 <Target> … … 275 276 </SearchPaths> 276 277 <Linking> 277 <Debugging>278 <GenerateDebugInfo Value="True"/>279 <DebugInfoType Value="dsAuto"/>280 </Debugging>281 278 <Options> 282 279 <Win32> … … 305 302 </Exceptions> 306 303 </Debugging> 304 <EditorMacros Count="0"/> 307 305 </CONFIG> -
trunk/Packages/CoolTranslator/Demo/UMainForm.lfm
r54 r93 8 8 ClientWidth = 466 9 9 OnCreate = FormCreate 10 LCLVersion = ' 0.9.31'10 LCLVersion = '1.1' 11 11 object ListBox1: TListBox 12 12 Left = 171 … … 29 29 object Label1: TLabel 30 30 Left = 10 31 Height = 1 431 Height = 13 32 32 Top = 24 33 Width = 4 733 Width = 46 34 34 Caption = 'MainForm' 35 35 ParentColor = False … … 37 37 object Label2: TLabel 38 38 Left = 10 39 Height = 1 439 Height = 13 40 40 Top = 6 41 Width = 13 541 Width = 134 42 42 Caption = 'Form name as label caption:' 43 43 ParentColor = False … … 45 45 object Label3: TLabel 46 46 Left = 171 47 Height = 1 447 Height = 13 48 48 Top = 8 49 Width = 6 849 Width = 67 50 50 Caption = 'Language list:' 51 51 ParentColor = False … … 61 61 object Label4: TLabel 62 62 Left = 321 63 Height = 1 463 Height = 13 64 64 Top = 10 65 Width = 4 765 Width = 46 66 66 Caption = 'Excludes:' 67 67 ParentColor = False … … 69 69 object CoolTranslator1: TCoolTranslator 70 70 POFilesFolder = 'Languages' 71 left = 6472 top = 4071 left = 72 72 top = 72 73 73 end 74 74 end -
trunk/Packages/TemplateGenerics/Additional/UBinarySerializer.pas
r72 r93 1 1 unit UBinarySerializer; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface … … 15 15 TBinarySerializer = class 16 16 private 17 FStream: TStreamByte; 17 FGrow: Boolean; 18 FList: TListByte; 18 19 FEndianness: TEndianness; 19 20 SwapData: Boolean; 21 procedure SetList(const AValue: TListByte); 20 22 procedure SetEndianness(const AValue: TEndianness); 21 23 procedure ReverseByteOrder(var Buffer; Count: Integer); 22 24 public 25 Position: Integer; 26 OwnsList: Boolean; 27 procedure Write(var Buffer; Count: Integer); //inline; 28 procedure Read(var Buffer; Count: Integer); //inline; 29 23 30 procedure Assign(Source: TBinarySerializer); 24 31 procedure WriteByte(Data: Byte); … … 48 55 procedure ReadStream(AStream: TStream; Count: Integer); 49 56 procedure ReadStreamPart(AStream: TStream; Count: Integer); 57 procedure ReadList(List: TListByte; StartIndex, Count: Integer); 50 58 constructor Create; overload; 51 constructor Create(AStream: TStreamByte); overload;52 59 procedure Clear; 53 60 destructor Destroy; override; 54 61 property Endianness: TEndianness read FEndianness write SetEndianness; 55 property Stream: TStreamByte read FStream write FStream; 62 property List: TListByte read FList write SetList; 63 property Grow: Boolean read FGrow write FGrow; 56 64 end; 57 65 … … 65 73 StringLength: Longint; 66 74 begin 67 StringLength 68 FStream.ReadBuffer(StringLength, SizeOf(StringLength));75 StringLength := 0; 76 Read(StringLength, SizeOf(StringLength)); 69 77 Result := ReadString(StringLength); 70 78 end; … … 76 84 OldPosition: Integer; 77 85 begin 78 OldPosition := FStream.Position;86 OldPosition := Position; 79 87 Result := ''; 80 88 I := 1; 81 89 repeat 82 if FStream.Position >= FStream.Sizethen Break;90 if Position >= FList.Count then Break; 83 91 Data := Chr(ReadByte); 84 92 if Data <> Terminator[I] then begin … … 89 97 if not (I > Length(Terminator)) then begin 90 98 Result := ''; 91 FStream.Position := OldPosition;99 Position := OldPosition; 92 100 end; 93 101 end; … … 96 104 begin 97 105 Result := 0; 98 FStream.ReadBuffer(Result, SizeOf(Byte));106 Read(Result, SizeOf(Byte)); 99 107 end; 100 108 … … 102 110 begin 103 111 Result := 0; 104 FStream.ReadBuffer(Result, SizeOf(Cardinal));112 Read(Result, SizeOf(Cardinal)); 105 113 if SwapData then Result := SwapEndian(Result); 106 114 end; … … 109 117 begin 110 118 Result := 0; 111 FStream.ReadBuffer(Result, SizeOf(Int64));119 Read(Result, SizeOf(Int64)); 112 120 if SwapData then Result := SwapEndian(Result); 113 121 end; … … 117 125 if Length > 0 then begin 118 126 SetLength(Result, Length); 119 FStream.ReadBuffer(Result[1], Length);127 Read(Result[1], Length); 120 128 end else Result := ''; 121 129 end; … … 126 134 begin 127 135 Count := 0; 128 FStream.ReadBuffer(Count, 1);136 Read(Count, 1); 129 137 Result := ReadString(Count); 130 138 end; … … 136 144 if Count > 0 then begin 137 145 SetLength(Buffer, Count); 138 FStream.ReadBuffer(Buffer[0], Count);146 Read(Buffer[0], Count); 139 147 AStream.Size := Count; 140 148 AStream.Position := 0; … … 149 157 if Count > 0 then begin 150 158 SetLength(Buffer, Count); 151 FStream.ReadBuffer(Buffer[0], Count);159 Read(Buffer[0], Count); 152 160 if AStream.Size < (AStream.Position + Count) then 153 161 AStream.Size := AStream.Position + Count; 154 AStream.Write(Buffer[0], Count); 162 Write(Buffer[0], Count); 163 end; 164 end; 165 166 procedure TBinarySerializer.ReadList(List: TListByte; StartIndex, Count: Integer 167 ); 168 var 169 Buffer: array of Byte; 170 begin 171 if Count > (List.Count - StartIndex) then Count := (List.Count - StartIndex); // Limit max. stream size 172 if Count > 0 then begin 173 SetLength(Buffer, Count); 174 Read(Pointer(Buffer)^, Count); 175 List.ReplaceBuffer(StartIndex, Pointer(Buffer)^, Count); 155 176 end; 156 177 end; … … 164 185 SetLength(Buffer, Count); 165 186 AStream.ReadBuffer(Pointer(Buffer)^, Count); 166 FStream.WriteBuffer(Pointer(Buffer)^, Count);187 Write(Pointer(Buffer)^, Count); 167 188 end; 168 189 end; … … 172 193 Buffer: array of Byte; 173 194 begin 174 if Count > (List.Count - StartIndex) then Count := (List.Count - StartIndex); // Limit max. stream size175 if Count > 0 then begin 176 SetLength(Buffer, Count); 177 List. ReadBuffer(Pointer(Buffer)^, Count);178 FStream.WriteBuffer(Pointer(Buffer)^, Count);195 // if Count > (List.Count - StartIndex) then Count := (List.Count - StartIndex); // Limit max. stream size 196 if Count > 0 then begin 197 SetLength(Buffer, Count); 198 List.GetBuffer(StartIndex, PByte(Buffer)^, Count); 199 Write(Pointer(Buffer)^, Count); 179 200 end; 180 201 end; … … 184 205 inherited; 185 206 Endianness := enLittle; 186 FStream := nil; 187 end; 188 189 constructor TBinarySerializer.Create(AStream: TStreamByte); 190 begin 191 inherited Create; 192 Endianness := enLittle; 193 FStream := AStream; 207 FList := nil; 208 FGrow := True; 194 209 end; 195 210 196 211 procedure TBinarySerializer.Clear; 197 212 begin 198 Stream.Size := 0; 213 FList.Count := 0; 214 Position := 0; 199 215 end; 200 216 201 217 destructor TBinarySerializer.Destroy; 202 218 begin 219 if OwnsList then FList.Free; 203 220 inherited Destroy; 204 221 end; … … 212 229 begin 213 230 Result := 0; 214 FStream.ReadBuffer(Result, SizeOf(Double));231 Read(Result, SizeOf(Double)); 215 232 end; 216 233 … … 218 235 begin 219 236 Result := 0; 220 FStream.ReadBuffer(Result, SizeOf(Single));237 Read(Result, SizeOf(Single)); 221 238 end; 222 239 … … 224 241 begin 225 242 Result := 0; 226 FStream.ReadBuffer(Result, SizeOf(Word));243 Read(Result, SizeOf(Word)); 227 244 if SwapData then Result := SwapEndian(Result); 245 end; 246 247 procedure TBinarySerializer.SetList(const AValue: TListByte); 248 begin 249 if OwnsList then FList.Free; 250 FList := AValue; 228 251 end; 229 252 … … 254 277 end; 255 278 279 procedure TBinarySerializer.Write(var Buffer; Count: Integer); 280 var 281 NewCount: Integer; 282 begin 283 if FGrow then begin 284 NewCount := Position + Count; 285 if FList.Count < NewCount then 286 FList.Count := NewCount; 287 end; 288 FList.ReplaceBuffer(Position, Buffer, Count); 289 Inc(Position, Count); 290 end; 291 292 procedure TBinarySerializer.Read(var Buffer; Count: Integer); 293 begin 294 FList.GetBuffer(Position, Buffer, Count); 295 Inc(Position, Count); 296 end; 297 256 298 procedure TBinarySerializer.Assign(Source: TBinarySerializer); 257 299 begin 258 F Stream := Source.FStream;300 FList := Source.FList; 259 301 end; 260 302 … … 270 312 procedure TBinarySerializer.WriteByte(Data: Byte); 271 313 begin 272 Data := 0; 273 FStream.WriteBuffer(Data, SizeOf(Byte)); 314 Write(Data, SizeOf(Byte)); 274 315 end; 275 316 … … 307 348 SetLength(Buffer, Count); 308 349 AStream.ReadBuffer(Pointer(Buffer)^, Count); 309 FStream.WriteBuffer(Pointer(Buffer)^, Count);350 Write(Pointer(Buffer)^, Count); 310 351 end; 311 352 end; -
trunk/Packages/TemplateGenerics/Generic/GenericBitmap.inc
r54 r93 8 8 {$DEFINE TGMatrixRow := TGBitmapRow} 9 9 {$DEFINE TGMatrix := TGBitmapMatrix} 10 {$DEFINE TGMatrixSortCompare := TGBitmapSortCompare}11 {$DEFINE TGMatrixToStringConverter := TGBitmapToStringConverter}12 {$DEFINE TGMatrixFromStringConverter := TGBitmapFromStringConverter}13 {$DEFINE TGMatrixMerge := TGBitmapMerge}14 10 {$DEFINE INTERFACE} 15 11 {$I 'GenericMatrix.inc'} … … 49 45 {$DEFINE TGMatrixRow := TGBitmapRow} 50 46 {$DEFINE TGMatrix := TGBitmapMatrix} 51 {$DEFINE TGMatrixSortCompare := TGBitmapSortCompare}52 {$DEFINE TGMatrixToStringConverter := TGBitmapToStringConverter}53 {$DEFINE TGMatrixFromStringConverter := TGBitmapFromStringConverter}54 {$DEFINE TGMatrixMerge := TGBitmapMerge}55 47 {$DEFINE IMPLEMENTATION} 56 48 {$I 'GenericMatrix.inc'} -
trunk/Packages/TemplateGenerics/Generic/GenericDictionary.inc
r54 r93 11 11 {$DEFINE TGListItem := TGPair} 12 12 {$DEFINE TGList := TGDictionaryList} 13 {$DEFINE TGListSortCompare := TGDictionarySortCompare}14 {$DEFINE TGListToStringConverter := TGDictionaryToStringConverter}15 {$DEFINE TGListFromStringConverter := TGDictionaryFromStringConverter}16 {$DEFINE TGListItemArray := TGDictionaryItemArray}17 13 {$DEFINE INTERFACE} 18 14 {$I 'GenericList.inc'} … … 49 45 {$DEFINE TGListItem := TGPair} 50 46 {$DEFINE TGList := TGDictionaryList} 51 {$DEFINE TGListSortCompare := TGDictionarySortCompare}52 {$DEFINE TGListToStringConverter := TGDictionaryToStringConverter}53 {$DEFINE TGListFromStringConverter := TGDictionaryFromStringConverter}54 {$DEFINE TGListItemArray := TGDictionaryItemArray}55 47 {$DEFINE IMPLEMENTATION} 56 48 {$I 'GenericList.inc'} -
trunk/Packages/TemplateGenerics/Generic/GenericList.inc
r54 r93 12 12 // - all items operations (Clear, Reverse, Sort) 13 13 14 TGList = class; 15 16 TGListSortCompare = function(Item1, Item2: TGListItem): Integer of object; 17 TGListToStringConverter = function(Item: TGListItem): string; 18 TGListFromStringConverter = function(Text: string): TGListItem; 19 TGListItemArray = array of TGListItem; 14 //TGAbstractList = class 15 16 //end; 20 17 21 18 // TGList<TGListIndex, TGListItem> = class 22 TGList = class 19 TGList = class//(TGAbstractList) 20 public 21 type 22 PItem = ^TGListItem; 23 TSortCompare = function(Item1, Item2: TGListItem): Integer of object; 24 TToStringConverter = function(Item: TGListItem): string; 25 TFromStringConverter = function(Text: string): TGListItem; 26 TItemArray = array of TGListItem; 23 27 private 24 28 FItems: array of TGListItem; … … 34 38 procedure SetLast(AValue: TGListItem); 35 39 procedure SetFirst(AValue: TGListItem); 36 procedure QuickSort(L, R : TGListIndex; Compare: TGListSortCompare); 40 procedure QuickSort(L, R : TGListIndex; Compare: TSortCompare); 41 procedure DoUpdate; 37 42 protected 38 43 procedure Put(Index: TGListIndex; const AValue: TGListItem); virtual; … … 51 56 function EqualTo(List: TGList): Boolean; 52 57 procedure Exchange(Index1, Index2: TGListIndex); 53 procedure Explode(Text, Separator: string; Converter: T GListFromStringConverter; SlicesCount: Integer = -1);58 procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 54 59 function Extract(Item: TGListItem): TGListItem; 55 60 property First: TGListItem read GetFirst write SetFirst; 56 61 procedure Fill(Start, Count: TGListIndex; Value: TGListItem); 57 function GetArray(Index, ACount: TGListIndex): T GListItemArray;62 function GetArray(Index, ACount: TGListIndex): TItemArray; 58 63 procedure GetList(List: TGList; Index, ACount: TGListIndex); 59 function Implode(Separator: string; Converter: TGListToStringConverter): string; 64 procedure GetBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 65 function Implode(Separator: string; Converter: TToStringConverter): string; 60 66 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; virtual; 61 67 function IndexOfList(List: TGList; Start: TGListIndex = 0): TGListIndex; … … 73 79 procedure ReplaceListPart(Index: TGListIndex; Source: TGList; 74 80 SourceIndex, SourceCount: TGListIndex); 75 procedure Sort(Compare: TGListSortCompare); 81 procedure ReplaceBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 82 procedure Sort(Compare: TSortCompare); 76 83 procedure SetArray(Values: array of TGListItem); 77 84 procedure BeginUpdate; … … 82 89 property Items[Index: TGListIndex]: TGListItem read Get write Put; default; 83 90 property Last: TGListItem read GetLast write SetLast; 84 end; 85 91 property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate; 92 end; 93 86 94 {$UNDEF INTERFACE} 87 95 {$ENDIF} … … 102 110 begin 103 111 FCount := 0; 112 FUpdateCount := 0; 113 end; 114 115 procedure TGList.GetBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 116 var 117 P: PItem; 118 I: TGListIndex; 119 begin 120 if (Index + Count) > FCount then 121 raise EListError.CreateFmt(SListIndexError, [Index + Count]); 122 P := PItem(@Buffer); 123 I := 0; 124 while I < Count do begin 125 P^ := Items[Index + I]; 126 Inc(P, 1); 127 I := I + 1; 128 end; 129 end; 130 131 procedure TGList.ReplaceBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 132 var 133 P: PItem; 134 I: TGListIndex; 135 begin 136 if (Index + Count) > FCount then 137 raise EListError.CreateFmt(SListIndexError, [Index + Count]); 138 P := PItem(@Buffer); 139 I := 0; 140 while I < Count do begin 141 Items[Index + I] := P^; 142 Inc(P, 1); 143 I := I + 1; 144 end; 104 145 end; 105 146 … … 200 241 end; 201 242 202 function TGList.GetArray(Index, ACount: TGListIndex): T GListItemArray;243 function TGList.GetArray(Index, ACount: TGListIndex): TItemArray; 203 244 var 204 245 I: Integer; … … 218 259 end; 219 260 220 procedure TGList.QuickSort(L, R: TGListIndex; Compare: T GListSortCompare);261 procedure TGList.QuickSort(L, R: TGListIndex; Compare: TSortCompare); 221 262 var 222 263 I, J: TGListIndex; … … 302 343 if (Index < 0) or (Index > FCount) then 303 344 raise EListError.CreateFmt(SListIndexError, [Index]); 304 InsertCount(Index, 1); 305 FItems[Index] := Item; 306 Update; 345 try 346 BeginUpdate; 347 InsertCount(Index, 1); 348 FItems[Index] := Item; 349 finally 350 EndUpdate; 351 end; 307 352 end; 308 353 … … 487 532 end; 488 533 489 procedure TGList.Sort(Compare: T GListSortCompare);534 procedure TGList.Sort(Compare: TSortCompare); 490 535 begin 491 536 if FCount > 1 then … … 525 570 procedure TGList.EndUpdate; 526 571 begin 527 Dec(FUpdateCount); 528 Update; 572 if FUpdateCount > 0 then Dec(FUpdateCount); 573 if FUpdateCount = 0 then DoUpdate; 574 end; 575 576 procedure TGList.DoUpdate; 577 begin 578 if Assigned(FOnUpdate) then FOnUpdate(Self); 529 579 end; 530 580 531 581 procedure TGList.Update; 532 582 begin 533 if Assigned(FOnUpdate) and (FUpdateCount = 0) then FOnUpdate(Self);534 end; 535 536 function TGList.Implode(Separator: string; Converter: T GListToStringConverter): string;583 if FUpdateCount = 0 then DoUpdate; 584 end; 585 586 function TGList.Implode(Separator: string; Converter: TToStringConverter): string; 537 587 var 538 588 I: TGListIndex; … … 548 598 end; 549 599 550 procedure TGList.Explode(Text, Separator: string; Converter: T GListFromStringConverter; SlicesCount: Integer = -1);600 procedure TGList.Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 551 601 begin 552 602 Clear; -
trunk/Packages/TemplateGenerics/Generic/GenericListObject.inc
r54 r93 4 4 {$DEFINE TGListItem := TGListObjectItem} 5 5 {$DEFINE TGList := TGListObjectList} 6 {$DEFINE TGListSortCompare := TGListObjectSortCompare}7 {$DEFINE TGListToStringConverter := TGListObjectToStringConverter}8 {$DEFINE TGListFromStringConverter := TGListObjectFromStringConverter}9 {$DEFINE TGListItemArray := TGListObjectItemArray}10 6 {$DEFINE INTERFACE} 11 7 {$I 'GenericList.inc'} … … 42 38 {$DEFINE TGListItem := TGListObjectItem} 43 39 {$DEFINE TGList := TGListObjectList} 44 {$DEFINE TGListSortCompare := TGListObjectSortCompare}45 {$DEFINE TGListToStringConverter := TGListObjectToStringConverter}46 {$DEFINE TGListFromStringConverter := TGListObjectFromStringConverter}47 {$DEFINE TGListItemArray := TGListObjectItemArray}48 40 {$DEFINE IMPLEMENTATION} 49 41 {$I 'GenericList.inc'} … … 96 88 end; 97 89 end; 90 I := FCount; 98 91 inherited; 92 // Nil newly allocated items 93 while I < AValue do begin 94 FItems[I] := nil; 95 I := I + 1; 96 end; 99 97 end; 100 98 … … 108 106 begin 109 107 Clear; 110 inherited Destroy;108 inherited; 111 109 end; 112 110 -
trunk/Packages/TemplateGenerics/Generic/GenericListString.inc
r54 r93 4 4 {$DEFINE TGListItem := TGListStringItem} 5 5 {$DEFINE TGList := TGListStringList} 6 {$DEFINE TGListSortCompare := TGListStringSortCompare}7 {$DEFINE TGListToStringConverter := TGListStringToStringConverter}8 {$DEFINE TGListFromStringConverter := TGListStringFromStringConverter}9 {$DEFINE TGListItemArray := TGListStringItemArray}10 6 {$DEFINE INTERFACE} 11 7 {$I 'GenericList.inc'} … … 39 35 {$DEFINE TGListItem := TGListStringItem} 40 36 {$DEFINE TGList := TGListStringList} 41 {$DEFINE TGListSortCompare := TGListStringSortCompare}42 {$DEFINE TGListToStringConverter := TGListStringToStringConverter}43 {$DEFINE TGListFromStringConverter := TGListStringFromStringConverter}44 {$DEFINE TGListItemArray := TGListStringItemArray}45 37 {$DEFINE IMPLEMENTATION} 46 38 {$I 'GenericList.inc'} -
trunk/Packages/TemplateGenerics/Generic/GenericMatrix.inc
r72 r93 1 // Work in progress... 2 1 3 {$IFDEF INTERFACE} 2 3 TGMatrix = class;4 5 TGMatrixSortCompare = function(const Item1, Item2: TGMatrixItem): Integer of object;6 TGMatrixToStringConverter = function(Item: TGMatrixItem): string;7 TGMatrixFromStringConverter = function(Text: string): TGMatrixItem;8 TGMatrixRow = array of TGMatrixItem;9 TGMatrixMerge = function(Item1, Item2: TGMatrixItem): TGMatrixItem of object;10 11 TGMatrixIndex = record12 X: TGMatrixIndexX;13 Y: TGMatrixIndexY;14 end;15 4 16 5 // TGMatrix<TGMatrixIndex, TGMatrixIndex, TGMatrixItem> = class 17 6 TGMatrix = class 7 public 8 type 9 TSortCompare = function(const Item1, Item2: TGMatrixItem): Integer of object; 10 TToStringConverter = function(Item: TGMatrixItem): string; 11 TFromStringConverter = function(Text: string): TGMatrixItem; 12 TRow = array of TGMatrixItem; 13 TMerge = function(Item1, Item2: TGMatrixItem): TGMatrixItem of object; 14 15 TIndex = record 16 X: TGMatrixIndexX; 17 Y: TGMatrixIndexY; 18 end; 18 19 private 19 20 FItems: array of array of TGMatrixItem; 20 FCount: T GMatrixIndex;21 FCount: TIndex; 21 22 function GetItemXY(X: TGMatrixIndexX; Y: TGMatrixIndexY): TGMatrixItem; 22 function GetItem(Index: T GMatrixIndex): TGMatrixItem;23 function GetCapacity: T GMatrixIndex;23 function GetItem(Index: TIndex): TGMatrixItem; 24 function GetCapacity: TIndex; 24 25 function GetLast: TGMatrixItem; 25 26 function GetFirst: TGMatrixItem; 26 procedure SetCapacity(const AValue: T GMatrixIndex);27 procedure SetCapacity(const AValue: TIndex); 27 28 procedure SetLast(AValue: TGMatrixItem); 28 29 procedure SetFirst(AValue: TGMatrixItem); 29 30 procedure PutItemXY(X: TGMatrixIndexX; Y: TGMatrixIndexY; const AValue: TGMatrixItem); virtual; 30 procedure PutItem(Index: T GMatrixIndex; const AValue: TGMatrixItem); virtual;31 procedure SetCount(const AValue: T GMatrixIndex);31 procedure PutItem(Index: TIndex; const AValue: TGMatrixItem); virtual; 32 procedure SetCount(const AValue: TIndex); 32 33 public 33 function Add(Item: TGMatrixItem): T GMatrixIndex;34 procedure AddMatrix(Values: array of T GMatrixRow);34 function Add(Item: TGMatrixItem): TIndex; 35 procedure AddMatrix(Values: array of TRow); 35 36 procedure AddList(List: TGMatrix); 36 37 procedure Assign(Source: TGMatrix); 37 38 procedure Clear; virtual; 38 39 procedure Contract; 39 function CreateIndex(X: TGMatrixIndexY; Y: TGMatrixIndexX): T GMatrixIndex;40 procedure Delete(Index: T GMatrixIndex); virtual;41 procedure DeleteItems(Index, Count: T GMatrixIndex);40 function CreateIndex(X: TGMatrixIndexY; Y: TGMatrixIndexX): TIndex; 41 procedure Delete(Index: TIndex); virtual; 42 procedure DeleteItems(Index, Count: TIndex); 42 43 function EqualTo(List: TGMatrix): Boolean; 43 44 procedure Expand; 44 45 function Extract(Item: TGMatrixItem): TGMatrixItem; 45 procedure Exchange(Index1, Index2: T GMatrixIndex);46 procedure Exchange(Index1, Index2: TIndex); 46 47 property First: TGMatrixItem read GetFirst write SetFirst; 47 48 procedure FillAll(Value: TGMatrixItem); 48 procedure Fill(Start, Count: T GMatrixIndex; Value: TGMatrixItem);49 function Implode(RowSeparator, ColSeparator: string; Converter: T GMatrixToStringConverter): string;50 procedure Explode(Text, Separator: string; Converter: T GMatrixFromStringConverter; SlicesCount: Integer = -1);51 function IndexOf(Item: TGMatrixItem; Start: T GMatrixIndex): TGMatrixIndex;52 function IndexOfList(List: TGMatrix; Start: T GMatrixIndex): TGMatrixIndex;53 procedure Insert(Index: T GMatrixIndex; Item: TGMatrixItem);54 procedure InsertList(Index: T GMatrixIndex; List: TGMatrix);55 procedure InsertArray(Index: T GMatrixIndex; Values: array of TGMatrixItem);56 procedure Move(CurIndex, NewIndex: T GMatrixIndex);57 procedure MoveItems(CurIndex, NewIndex, Count: T GMatrixIndex);58 procedure Merge(Index: T GMatrixIndex; Source: TGMatrix; Proc: TGMatrixMerge);59 procedure Replace(Index: T GMatrixIndex; Source: TGMatrix);60 function Remove(Item: TGMatrixItem): T GMatrixIndex;49 procedure Fill(Start, Count: TIndex; Value: TGMatrixItem); 50 function Implode(RowSeparator, ColSeparator: string; Converter: TToStringConverter): string; 51 procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 52 function IndexOf(Item: TGMatrixItem; Start: TIndex): TIndex; 53 function IndexOfList(List: TGMatrix; Start: TIndex): TIndex; 54 procedure Insert(Index: TIndex; Item: TGMatrixItem); 55 procedure InsertList(Index: TIndex; List: TGMatrix); 56 procedure InsertArray(Index: TIndex; Values: array of TGMatrixItem); 57 procedure Move(CurIndex, NewIndex: TIndex); 58 procedure MoveItems(CurIndex, NewIndex, Count: TIndex); 59 procedure Merge(Index: TIndex; Source: TGMatrix; Proc: TMerge); 60 procedure Replace(Index: TIndex; Source: TGMatrix); 61 function Remove(Item: TGMatrixItem): TIndex; 61 62 procedure Reverse; 62 63 procedure ReverseHorizontal; 63 64 procedure ReverseVertical; 64 procedure Sort(Compare: T GMatrixSortCompare);65 procedure Sort(Compare: TSortCompare); 65 66 procedure SetArray(Values: array of TGMatrixItem); 66 property Count: T GMatrixIndex read FCount write SetCount;67 property Capacity: T GMatrixIndex read GetCapacity write SetCapacity;67 property Count: TIndex read FCount write SetCount; 68 property Capacity: TIndex read GetCapacity write SetCapacity; 68 69 property ItemsXY[X: TGMatrixIndexX; Y: TGMatrixIndexY]: TGMatrixItem 69 70 read GetItemXY write PutItemXY; default; 70 property Items[Index: T GMatrixIndex]: TGMatrixItem71 property Items[Index: TIndex]: TGMatrixItem 71 72 read GetItem write PutItem; 72 73 property Last: TGMatrixItem read GetLast write SetLast; … … 91 92 { TGMatrix } 92 93 93 procedure TGMatrix.Replace(Index: T GMatrixIndex; Source: TGMatrix);94 procedure TGMatrix.Replace(Index: TIndex; Source: TGMatrix); 94 95 var 95 96 X: TGMatrixIndexX; … … 107 108 end; 108 109 109 procedure TGMatrix.Merge(Index: T GMatrixIndex; Source: TGMatrix; Proc: TGMatrixMerge);110 procedure TGMatrix.Merge(Index: TIndex; Source: TGMatrix; Proc: TMerge); 110 111 var 111 112 X: TGMatrixIndexX; … … 123 124 end; 124 125 125 function TGMatrix.CreateIndex(X: TGMatrixIndexY; Y: TGMatrixIndexX): T GMatrixIndex;126 function TGMatrix.CreateIndex(X: TGMatrixIndexY; Y: TGMatrixIndexX): TIndex; 126 127 begin 127 128 Result.X := X; … … 129 130 end; 130 131 131 function TGMatrix.GetCapacity: T GMatrixIndex;132 function TGMatrix.GetCapacity: TIndex; 132 133 begin 133 134 Result.Y := Length(FItems); … … 135 136 end; 136 137 137 procedure TGMatrix.SetCapacity(const AValue: T GMatrixIndex);138 procedure TGMatrix.SetCapacity(const AValue: TIndex); 138 139 var 139 140 Y: TGMatrixIndexY; … … 160 161 end; 161 162 162 function TGMatrix.GetItem(Index: T GMatrixIndex): TGMatrixItem;163 function TGMatrix.GetItem(Index: TIndex): TGMatrixItem; 163 164 begin 164 165 if (Index.X < 0) or (Index.X >= Count.X) or … … 176 177 end; 177 178 178 procedure TGMatrix.PutItem(Index: T GMatrixIndex; const AValue: TGMatrixItem);179 procedure TGMatrix.PutItem(Index: TIndex; const AValue: TGMatrixItem); 179 180 begin 180 181 if (Index.X < 0) or (Index.X >= Count.X) or … … 184 185 end; 185 186 186 procedure TGMatrix.SetCount(const AValue: T GMatrixIndex);187 procedure TGMatrix.SetCount(const AValue: TIndex); 187 188 begin 188 189 Capacity := AValue; … … 192 193 procedure TGMatrix.Assign(Source: TGMatrix); 193 194 var 194 Index: T GMatrixIndex;195 Index: TIndex; 195 196 begin 196 197 Count := Source.Count; … … 208 209 procedure TGMatrix.Expand; 209 210 var 210 IncSize: T GMatrixIndex;211 NewCapacity: T GMatrixIndex;211 IncSize: TIndex; 212 NewCapacity: TIndex; 212 213 begin 213 214 if (FCount.X = Capacity.X) then begin … … 230 231 procedure TGMatrix.Contract; 231 232 var 232 NewCapacity: T GMatrixIndex;233 NewCapacity: TIndex; 233 234 begin 234 235 if (Capacity.X > 256) and (FCount.X < Capacity.X shr 2) then … … 245 246 function TGMatrix.Extract(Item: TGMatrixItem): TGMatrixItem; 246 247 var 247 I: T GMatrixIndex;248 I: TIndex; 248 249 begin 249 250 (* I := IndexOf(Item); … … 256 257 end; 257 258 258 function TGMatrix.IndexOf(Item: TGMatrixItem; Start: T GMatrixIndex): TGMatrixIndex;259 function TGMatrix.IndexOf(Item: TGMatrixItem; Start: TIndex): TIndex; 259 260 begin 260 261 (* Result := Start; … … 266 267 end; 267 268 268 procedure TGMatrix.Insert(Index: T GMatrixIndex; Item: TGMatrixItem);269 procedure TGMatrix.Insert(Index: TIndex; Item: TGMatrixItem); 269 270 begin 270 271 (* if (Index < 0) or (Index > FCount ) then … … 278 279 end; 279 280 280 procedure TGMatrix.InsertList(Index: T GMatrixIndex; List: TGMatrix);281 var 282 I: T GMatrixIndex;281 procedure TGMatrix.InsertList(Index: TIndex; List: TGMatrix); 282 var 283 I: TIndex; 283 284 begin 284 285 (* I := 0; … … 290 291 end; 291 292 292 function TGMatrix.IndexOfList(List: TGMatrix; Start: T GMatrixIndex): TGMatrixIndex;293 var 294 I: T GMatrixIndex;293 function TGMatrix.IndexOfList(List: TGMatrix; Start: TIndex): TIndex; 294 var 295 I: TIndex; 295 296 begin 296 297 (* if List.Count > 0 then begin … … 346 347 end; 347 348 348 procedure TGMatrix.Move(CurIndex, NewIndex: T GMatrixIndex);349 procedure TGMatrix.Move(CurIndex, NewIndex: TIndex); 349 350 var 350 351 Temp: TGMatrixItem; … … 366 367 end; 367 368 368 procedure TGMatrix.MoveItems(CurIndex, NewIndex, Count: T GMatrixIndex);369 procedure TGMatrix.MoveItems(CurIndex, NewIndex, Count: TIndex); 369 370 var 370 371 S: Integer; … … 391 392 end; 392 393 393 function TGMatrix.Remove(Item: TGMatrixItem): T GMatrixIndex;394 function TGMatrix.Remove(Item: TGMatrixItem): TIndex; 394 395 begin 395 396 (* Result := IndexOf(Item); … … 400 401 function TGMatrix.EqualTo(List: TGMatrix): Boolean; 401 402 var 402 I: T GMatrixIndex;403 I: TIndex; 403 404 begin 404 405 (* Result := Count = List.Count; … … 463 464 end; 464 465 465 procedure TGMatrix.Sort(Compare: T GMatrixSortCompare);466 procedure TGMatrix.Sort(Compare: TSortCompare); 466 467 begin 467 468 (* if FCount > 1 then … … 469 470 end; 470 471 471 procedure TGMatrix.AddMatrix(Values: array of T GMatrixRow);472 var 473 I: T GMatrixIndex;472 procedure TGMatrix.AddMatrix(Values: array of TRow); 473 var 474 I: TIndex; 474 475 begin 475 476 (* I := 0; … … 482 483 procedure TGMatrix.SetArray(Values: array of TGMatrixItem); 483 484 var 484 I: T GMatrixIndex;485 I: TIndex; 485 486 begin 486 487 (* Clear; … … 492 493 end; 493 494 494 procedure TGMatrix.InsertArray(Index: T GMatrixIndex; Values: array of TGMatrixItem);495 var 496 I: T GMatrixIndex;495 procedure TGMatrix.InsertArray(Index: TIndex; Values: array of TGMatrixItem); 496 var 497 I: TIndex; 497 498 begin 498 499 (* I := 0; … … 503 504 end; 504 505 505 function TGMatrix.Implode(RowSeparator, ColSeparator: string; Converter: T GMatrixToStringConverter): string;506 function TGMatrix.Implode(RowSeparator, ColSeparator: string; Converter: TToStringConverter): string; 506 507 var 507 508 Y: TGMatrixIndexY; … … 524 525 end; 525 526 526 procedure TGMatrix.Explode(Text, Separator: string; Converter: T GMatrixFromStringConverter; SlicesCount: Integer = -1);527 procedure TGMatrix.Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 527 528 begin 528 529 (* Clear; … … 535 536 end; 536 537 537 function TGMatrix.Add(Item: TGMatrixItem): T GMatrixIndex;538 function TGMatrix.Add(Item: TGMatrixItem): TIndex; 538 539 begin 539 540 (* if FCount = Capacity then … … 546 547 procedure TGMatrix.AddList(List: TGMatrix); 547 548 var 548 I: T GMatrixIndex;549 I: TIndex; 549 550 begin 550 551 (* I := 0; … … 561 562 end; 562 563 563 procedure TGMatrix.Delete(Index: T GMatrixIndex);564 procedure TGMatrix.Delete(Index: TIndex); 564 565 begin 565 566 (* if (Index < 0) or (Index >= FCount) then … … 571 572 end; 572 573 573 procedure TGMatrix.DeleteItems(Index, Count: T GMatrixIndex);574 var 575 I: T GMatrixIndex;574 procedure TGMatrix.DeleteItems(Index, Count: TIndex); 575 var 576 I: TIndex; 576 577 begin 577 578 (* I := Index; … … 583 584 end; 584 585 585 procedure TGMatrix.Fill(Start, Count: T GMatrixIndex; Value: TGMatrixItem);586 procedure TGMatrix.Fill(Start, Count: TIndex; Value: TGMatrixItem); 586 587 var 587 588 X: TGMatrixIndexX; … … 604 605 end; 605 606 606 procedure TGMatrix.Exchange(Index1, Index2: T GMatrixIndex);607 procedure TGMatrix.Exchange(Index1, Index2: TIndex); 607 608 var 608 609 Temp: TGMatrixItem; -
trunk/Packages/TemplateGenerics/Generic/GenericQueue.inc
r54 r93 4 4 {$DEFINE TGListItem := TGQueueItem} 5 5 {$DEFINE TGList := TGQueueList} 6 {$DEFINE TGListSortCompare := TGQueueSortCompare}7 {$DEFINE TGListToStringConverter := TGQueueToStringConverter}8 {$DEFINE TGListFromStringConverter := TGQueueFromStringConverter}9 {$DEFINE TGListItemArray := TGQueueItemArray}10 6 {$DEFINE INTERFACE} 11 7 {$I 'GenericList.inc'} … … 44 40 {$DEFINE TGListItem := TGQueueItem} 45 41 {$DEFINE TGList := TGQueueList} 46 {$DEFINE TGListSortCompare := TGQueueSortCompare}47 {$DEFINE TGListToStringConverter := TGQueueToStringConverter}48 {$DEFINE TGListFromStringConverter := TGQueueFromStringConverter}49 {$DEFINE TGListItemArray := TGQueueItemArray}50 42 {$DEFINE IMPLEMENTATION} 51 43 {$I 'GenericList.inc'} -
trunk/Packages/TemplateGenerics/Generic/GenericSet.inc
r54 r93 4 4 {$DEFINE TGListItem := TGSetItem} 5 5 {$DEFINE TGList := TGSetList} 6 {$DEFINE TGListSortCompare := TGSetSortCompare}7 {$DEFINE TGListToStringConverter := TGSetToStringConverter}8 {$DEFINE TGListFromStringConverter := TGSetFromStringConverter}9 {$DEFINE TGListItemArray := TGSetItemArray}10 6 {$DEFINE INTERFACE} 11 7 {$I 'GenericList.inc'} … … 38 34 {$DEFINE TGListItem := TGSetItem} 39 35 {$DEFINE TGList := TGSetList} 40 {$DEFINE TGListSortCompare := TGSetSortCompare}41 {$DEFINE TGListToStringConverter := TGSetToStringConverter}42 {$DEFINE TGListFromStringConverter := TGSetFromStringConverter}43 {$DEFINE TGListItemArray := TGSetItemArray}44 36 {$DEFINE IMPLEMENTATION} 45 37 {$I 'GenericList.inc'} -
trunk/Packages/TemplateGenerics/Generic/GenericStack.inc
r54 r93 4 4 {$DEFINE TGListItem := TGStackItem} 5 5 {$DEFINE TGList := TGStackList} 6 {$DEFINE TGListSortCompare := TGStackSortCompare}7 {$DEFINE TGListToStringConverter := TGStackToStringConverter}8 {$DEFINE TGListFromStringConverter := TGStackFromStringConverter}9 {$DEFINE TGListItemArray := TGStackItemArray}10 6 {$DEFINE INTERFACE} 11 7 {$I 'GenericList.inc'} … … 39 35 {$DEFINE TGListItem := TGStackItem} 40 36 {$DEFINE TGList := TGStackList} 41 {$DEFINE TGListSortCompare := TGStackSortCompare}42 {$DEFINE TGListToStringConverter := TGStackToStringConverter}43 {$DEFINE TGListFromStringConverter := TGStackFromStringConverter}44 {$DEFINE TGListItemArray := TGStackItemArray}45 37 {$DEFINE IMPLEMENTATION} 46 38 {$I 'GenericList.inc'} -
trunk/Packages/TemplateGenerics/Generic/GenericStream.inc
r54 r93 1 1 {$IFDEF INTERFACE} 2 2 3 TGStreamItemArray = array of TGStreamItem;4 3 5 4 // TGStream<TGStreamIndex, TGStreamItem> = class 6 5 TGStream = class 7 procedure SetSize(AValue: TGStreamIndex); 6 public 7 type 8 TItemArray = array of TGStreamItem; 9 private 10 procedure SetSize(AValue: TGStreamIndex); 8 11 function GetSize: TGStreamIndex; 9 12 procedure SetPosition(AValue: TGStreamIndex); … … 15 18 procedure WriteStream(Stream: TGStream; Count: TGStreamIndex); virtual; abstract; 16 19 function Read: TGStreamItem; virtual; abstract; 17 function ReadArray(Count: TGStreamIndex): T GStreamItemArray; virtual; abstract;20 function ReadArray(Count: TGStreamIndex): TItemArray; virtual; abstract; 18 21 function ReadStream(Stream: TGStream; Count: TGStreamIndex): TGStreamIndex; virtual; abstract; 19 22 function Insert(Count: TGStreamIndex): TGStreamIndex; virtual; abstract; -
trunk/Packages/TemplateGenerics/Generic/GenericTree.inc
r54 r93 6 6 {$DEFINE TGListItem := TGTreeNode} 7 7 {$DEFINE TGList := TGTreeNodeList} 8 {$DEFINE TGListSortCompare := TGTreeSortCompare}9 {$DEFINE TGListToStringConverter := TGTreeToStringConverter}10 {$DEFINE TGListFromStringConverter := TGTreeFromStringConverter}11 {$DEFINE TGListItemArray := TGTreeItemArray}12 8 {$DEFINE INTERFACE} 13 9 {$I 'GenericList.inc'} … … 44 40 {$DEFINE TGListItem := TGTreeNode} 45 41 {$DEFINE TGList := TGTreeNodeList} 46 {$DEFINE TGListSortCompare := TGTreeSortCompare}47 {$DEFINE TGListToStringConverter := TGTreeToStringConverter}48 {$DEFINE TGListFromStringConverter := TGTreeFromStringConverter}49 {$DEFINE TGListItemArray := TGTreeItemArray}50 42 {$DEFINE IMPLEMENTATION} 51 43 {$I 'GenericList.inc'} -
trunk/Packages/TemplateGenerics/Specialized/SpecializedDictionary.pas
r54 r93 18 18 {$DEFINE TGDictionary := TDictionaryStringString} 19 19 {$DEFINE TGDictionaryList := TDictionaryStringStringList} 20 {$DEFINE TGDictionarySortCompare := TDictionaryStringStringSortCompare}21 {$DEFINE TGDictionaryToStringConverter := TDictionaryStringStringToStringConverter}22 {$DEFINE TGDictionaryFromStringConverter := TDictionaryStringStringFromStringConverter}23 {$DEFINE TGDictionaryItemArray := TDictionaryStringStringItemArray}24 20 {$DEFINE INTERFACE} 25 21 {$I 'GenericDictionary.inc'} … … 32 28 {$DEFINE TGDictionary := TDictionaryIntegerString} 33 29 {$DEFINE TGDictionaryList := TDictionaryIntegerStringList} 34 {$DEFINE TGDictionarySortCompare := TDictionaryIntegerStringSortCompare}35 {$DEFINE TGDictionaryToStringConverter := TDictionaryIntegerStringToStringConverter}36 {$DEFINE TGDictionaryFromStringConverter := TDictionaryIntegerStringFromStringConverter}37 {$DEFINE TGDictionaryItemArray := TDictionaryIntegerStringItemArray}38 30 {$DEFINE INTERFACE} 39 31 {$I 'GenericDictionary.inc'} … … 53 45 {$DEFINE TGDictionary := TDictionaryStringString} 54 46 {$DEFINE TGDictionaryList := TDictionaryStringStringList} 55 {$DEFINE TGDictionarySortCompare := TDictionaryStringStringSortCompare}56 {$DEFINE TGDictionaryToStringConverter := TDictionaryStringStringToStringConverter}57 {$DEFINE TGDictionaryFromStringConverter := TDictionaryStringStringFromStringConverter}58 {$DEFINE TGDictionaryItemArray := TDictionaryStringStringItemArray}59 47 {$DEFINE IMPLEMENTATION} 60 48 {$I 'GenericDictionary.inc'} … … 67 55 {$DEFINE TGDictionary := TDictionaryIntegerString} 68 56 {$DEFINE TGDictionaryList := TDictionaryIntegerStringList} 69 {$DEFINE TGDictionarySortCompare := TDictionaryIntegerStringSortCompare}70 {$DEFINE TGDictionaryToStringConverter := TDictionaryIntegerStringToStringConverter}71 {$DEFINE TGDictionaryFromStringConverter := TDictionaryIntegerStringFromStringConverter}72 {$DEFINE TGDictionaryItemArray := TDictionaryIntegerStringItemArray}73 57 {$DEFINE IMPLEMENTATION} 74 58 {$I 'GenericDictionary.inc'} -
trunk/Packages/TemplateGenerics/Specialized/SpecializedList.pas
r54 r93 15 15 {$DEFINE TGListItem := Integer} 16 16 {$DEFINE TGList := TListInteger} 17 {$DEFINE TGListSortCompare := TListIntegerSortCompare}18 {$DEFINE TGListToStringConverter := TListIntegerToStringConverter}19 {$DEFINE TGListFromStringConverter := TListIntegerFromStringConverter}20 {$DEFINE TGListItemArray := TListIntegerItemArray}21 17 {$DEFINE INTERFACE} 22 18 {$I 'GenericList.inc'} … … 26 22 {$DEFINE TGListItem := Boolean} 27 23 {$DEFINE TGList := TListBoolean} 28 {$DEFINE TGListSortCompare := TListBooleanSortCompare}29 {$DEFINE TGListToStringConverter := TListBooleanToStringConverter}30 {$DEFINE TGListFromStringConverter := TListBooleanFromStringConverter}31 {$DEFINE TGListItemArray := TListBooleanItemArray}32 24 {$DEFINE INTERFACE} 33 25 {$I 'GenericList.inc'} … … 37 29 {$DEFINE TGListItem := SmallInt} 38 30 {$DEFINE TGList := TListSmallInt} 39 {$DEFINE TGListSortCompare := TListSmallIntSortCompare}40 {$DEFINE TGListToStringConverter := TListSmallIntToStringConverter}41 {$DEFINE TGListFromStringConverter := TListSmallIntFromStringConverter}42 {$DEFINE TGListItemArray := TListSmallIntItemArray}43 31 {$DEFINE INTERFACE} 44 32 {$I 'GenericList.inc'} … … 48 36 {$DEFINE TGListItem := Double} 49 37 {$DEFINE TGList := TListDouble} 50 {$DEFINE TGListSortCompare := TListDoubleSortCompare}51 {$DEFINE TGListToStringConverter := TListDoubleToStringConverter}52 {$DEFINE TGListFromStringConverter := TListDoubleFromStringConverter}53 {$DEFINE TGListItemArray := TListDoubleItemArray}54 38 {$DEFINE INTERFACE} 55 39 {$INCLUDE '..\Generic\GenericList.inc'} … … 59 43 {$DEFINE TGListItem := Pointer} 60 44 {$DEFINE TGList := TListPointer} 61 {$DEFINE TGListSortCompare := TListPointerSortCompare}62 {$DEFINE TGListToStringConverter := TListPointerToStringConverter}63 {$DEFINE TGListFromStringConverter := TListPointerFromStringConverter}64 {$DEFINE TGListItemArray := TListPointerItemArray}65 45 {$DEFINE INTERFACE} 66 46 {$I 'GenericList.inc'} … … 70 50 {$DEFINE TGListStringItem := string} 71 51 {$DEFINE TGListString := TListString} 72 {$DEFINE TGListStringSortCompare := TListStringSortCompare}73 {$DEFINE TGListStringToStringConverter := TListStringToStringConverter}74 {$DEFINE TGListStringFromStringConverter := TListStringFromStringConverter}75 {$DEFINE TGListItemArray := TListStringItemArray}76 52 {$DEFINE INTERFACE} 77 53 {$I 'GenericListString.inc'} … … 81 57 {$DEFINE TGListItem := Byte} 82 58 {$DEFINE TGList := TListByteBase} 83 {$DEFINE TGListSortCompare := TListByteSortCompare}84 {$DEFINE TGListToStringConverter := TListByteToStringConverter}85 {$DEFINE TGListFromStringConverter := TListByteFromStringConverter}86 {$DEFINE TGListItemArray := TListByteItemArray}87 59 {$DEFINE INTERFACE} 88 60 {$I 'GenericList.inc'} … … 95 67 procedure AddStream(Stream: TStream); 96 68 procedure AddStreamPart(Stream: TStream; ItemCount: TGListIndex); 97 procedure WriteBuffer(var Buffer; Count: Integer);98 procedure ReadBuffer(var Buffer; Count: Integer);99 69 end; 100 70 … … 103 73 {$DEFINE TGListItem := Char} 104 74 {$DEFINE TGList := TListCharBase} 105 {$DEFINE TGListSortCompare := TListSortCompareChar}106 {$DEFINE TGListToStringConverter := TListToStringConverterChar}107 {$DEFINE TGListFromStringConverter := TListFromStringConverterChar}108 {$DEFINE TGListItemArray := TListStringItemArray}109 75 {$DEFINE INTERFACE} 110 76 {$I 'GenericList.inc'} … … 115 81 {$DEFINE TGListObjectList := TListObjectList} 116 82 {$DEFINE TGListObject := TListObject} 117 {$DEFINE TGListObjectSortCompare := TListObjectSortCompare}118 {$DEFINE TGListObjectToStringConverter := TListObjectToStringConverter}119 {$DEFINE TGListObjectFromStringConverter := TListObjectFromStringConverter}120 {$DEFINE TGListItemArray := TListObjectItemArray}121 83 {$DEFINE INTERFACE} 122 84 {$I 'GenericListObject.inc'} … … 138 100 {$DEFINE TGListItem := TMethod} 139 101 {$DEFINE TGList := TListMethodBase} 140 {$DEFINE TGListSortCompare := TListMethodSortCompare}141 {$DEFINE TGListToStringConverter := TListMethodToStringConverter}142 {$DEFINE TGListFromStringConverter := TListMethodFromStringConverter}143 {$DEFINE TGListItemArray := TListMethodItemArray}144 102 {$DEFINE INTERFACE} 145 103 {$I 'GenericList.inc'} … … 154 112 {$DEFINE TGListItem := TNotifyEvent} 155 113 {$DEFINE TGList := TListNotifyEventBase} 156 {$DEFINE TGListSortCompare := TListNotifyEventSortCompare}157 {$DEFINE TGListToStringConverter := TListNotifyEventToStringConverter}158 {$DEFINE TGListFromStringConverter := TListNotifyEventFromStringConverter}159 {$DEFINE TGListItemArray := TListNotifyEventItemArray}160 114 {$DEFINE INTERFACE} 161 115 {$I 'GenericList.inc'} … … 166 120 end; 167 121 122 123 TBaseEvent = procedure of object; 124 125 // TListSimpleEventBase<Integer, TBaseEvent> 126 {$DEFINE TGListIndex := Integer} 127 {$DEFINE TGListItem := TBaseEvent} 128 {$DEFINE TGList := TListSimpleEventBase} 129 {$DEFINE INTERFACE} 130 {$I 'GenericList.inc'} 131 132 // TListSimpleEvent<Integer, TSimpleEvent> 133 TListSimpleEvent = class(TListSimpleEventBase) 134 procedure CallAll; 135 end; 136 137 138 // TFileListByte<Integer, Byte> 139 {$DEFINE TGFileListIndex := Integer} 140 {$DEFINE TGFileListItem := Byte} 141 {$DEFINE TGFileListList := TFileListListByte} 142 {$DEFINE TGFileList := TFileListByte} 143 {$DEFINE INTERFACE} 144 {$I 'GenericFileList.inc'} 145 168 146 function StrToStr(Value: string): string; 147 148 149 150 169 151 170 152 implementation … … 177 159 {$DEFINE TGListItem := Integer} 178 160 {$DEFINE TGList := TListInteger} 179 {$DEFINE TGListSortCompare := TListIntegerSortCompare}180 {$DEFINE TGListToStringConverter := TListIntegerToStringConverter}181 {$DEFINE TGListFromStringConverter := TListIntegerFromStringConverter}182 {$DEFINE TGListItemArray := TListIntegerItemArray}183 161 {$DEFINE IMPLEMENTATION} 184 162 {$I 'GenericList.inc'} … … 188 166 {$DEFINE TGListItem := SmallInt} 189 167 {$DEFINE TGList := TListSmallInt} 190 {$DEFINE TGListSortCompare := TListSmallIntSortCompare}191 {$DEFINE TGListToStringConverter := TListSmallIntToStringConverter}192 {$DEFINE TGListFromStringConverter := TListSmallIntFromStringConverter}193 {$DEFINE TGListItemArray := TListSmallIntItemArray}194 168 {$DEFINE IMPLEMENTATION} 195 169 {$I 'GenericList.inc'} … … 199 173 {$DEFINE TGListItem := Boolean} 200 174 {$DEFINE TGList := TListBoolean} 201 {$DEFINE TGListSortCompare := TListBooleanSortCompare}202 {$DEFINE TGListToStringConverter := TListBooleanToStringConverter}203 {$DEFINE TGListFromStringConverter := TListBooleanFromStringConverter}204 {$DEFINE TGListItemArray := TListBooleanItemArray}205 175 {$DEFINE IMPLEMENTATION} 206 176 {$I 'GenericList.inc'} … … 210 180 {$DEFINE TGListItem := Double} 211 181 {$DEFINE TGList := TListDouble} 212 {$DEFINE TGListSortCompare := TListDoubleSortCompare}213 {$DEFINE TGListToStringConverter := TListDoubleToStringConverter}214 {$DEFINE TGListFromStringConverter := TListDoubleFromStringConverter}215 {$DEFINE TGListItemArray := TListDoubleItemArray}216 182 {$DEFINE IMPLEMENTATION} 217 183 {$I 'GenericList.inc'} … … 221 187 {$DEFINE TGListItem := Pointer} 222 188 {$DEFINE TGList := TListPointer} 223 {$DEFINE TGListSortCompare := TListPointerSortCompare}224 {$DEFINE TGListToStringConverter := TListPointerToStringConverter}225 {$DEFINE TGListFromStringConverter := TListPointerFromStringConverter}226 {$DEFINE TGListItemArray := TListPointerItemArray}227 189 {$DEFINE IMPLEMENTATION} 228 190 {$I 'GenericList.inc'} … … 232 194 {$DEFINE TGListStringItem := string} 233 195 {$DEFINE TGListString := TListString} 234 {$DEFINE TGListStringSortCompare := TListStringSortCompare}235 {$DEFINE TGListStringToStringConverter := TListStringToStringConverter}236 {$DEFINE TGListStringFromStringConverter := TListStringFromStringConverter}237 {$DEFINE TGListItemArray := TListStringItemArray}238 196 {$DEFINE IMPLEMENTATION} 239 197 {$I 'GenericListString.inc'} … … 243 201 {$DEFINE TGListItem := Byte} 244 202 {$DEFINE TGList := TListByteBase} 245 {$DEFINE TGListSortCompare := TListByteSortCompare}246 {$DEFINE TGListToStringConverter := TListByteToStringConverter}247 {$DEFINE TGListFromStringConverter := TListByteFromStringConverter}248 {$DEFINE TGListItemArray := TListByteItemArray}249 203 {$DEFINE IMPLEMENTATION} 250 204 {$I 'GenericList.inc'} … … 254 208 {$DEFINE TGListItem := Char} 255 209 {$DEFINE TGList := TListCharBase} 256 {$DEFINE TGListSortCompare := TListSortCompareChar}257 {$DEFINE TGListToStringConverter := TListToStringConverterChar}258 {$DEFINE TGListFromStringConverter := TListFromStringConverterChar}259 {$DEFINE TGListItemArray := TListStringItemArray}260 210 {$DEFINE IMPLEMENTATION} 261 211 {$I 'GenericList.inc'} … … 266 216 {$DEFINE TGListObjectList := TListObjectList} 267 217 {$DEFINE TGListObject := TListObject} 268 {$DEFINE TGListObjectSortCompare := TListObjectSortCompare}269 {$DEFINE TGListObjectToStringConverter := TListObjectToStringConverter}270 {$DEFINE TGListObjectFromStringConverter := TListObjectFromStringConverter}271 {$DEFINE TGListItemArray := TListObjectItemArray}272 218 {$DEFINE IMPLEMENTATION} 273 219 {$I 'GenericListObject.inc'} … … 277 223 {$DEFINE TGListItem := TMethod} 278 224 {$DEFINE TGList := TListMethodBase} 279 {$DEFINE TGListSortCompare := TListMethodSortCompare}280 {$DEFINE TGListToStringConverter := TListMethodToStringConverter}281 {$DEFINE TGListFromStringConverter := TListMethodFromStringConverter}282 {$DEFINE TGListItemArray := TListMethodItemArray}283 225 {$DEFINE IMPLEMENTATION} 284 226 {$I 'GenericList.inc'} … … 288 230 {$DEFINE TGListItem := TNotifyEvent} 289 231 {$DEFINE TGList := TListNotifyEventBase} 290 {$DEFINE TGListSortCompare := TListNotifyEventSortCompare} 291 {$DEFINE TGListToStringConverter := TListNotifyEventToStringConverter} 292 {$DEFINE TGListFromStringConverter := TListNotifyEventFromStringConverter} 293 {$DEFINE TGListItemArray := TListNotifyEventItemArray} 294 {$DEFINE IMPLEMENTATION} 295 {$I 'GenericList.inc'} 232 {$DEFINE IMPLEMENTATION} 233 {$I 'GenericList.inc'} 234 235 // TListSimpleEventBase<Integer, TBaseEvent> 236 {$DEFINE TGListIndex := Integer} 237 {$DEFINE TGListItem := TBaseEvent} 238 {$DEFINE TGList := TListSimpleEventBase} 239 {$DEFINE IMPLEMENTATION} 240 {$I 'GenericList.inc'} 241 242 // TFileListByte<Integer, Byte> 243 {$DEFINE TGFileListIndex := Integer} 244 {$DEFINE TGFileListItem := Byte} 245 {$DEFINE TGFileListList := TFileListListByte} 246 {$DEFINE TGFileList := TFileListByte} 247 {$DEFINE IMPLEMENTATION} 248 {$I 'GenericFileList.inc'} 296 249 297 250 … … 300 253 Result := Value; 301 254 end; 255 256 { TListSimpleEvent } 257 258 procedure TListSimpleEvent.CallAll; 259 var 260 I: TGListIndex; 261 begin 262 I := 0; 263 while (I < Count) do begin 264 TBaseEvent(Items[I])(); 265 I := I + 1; 266 end; 267 end; 268 302 269 303 270 { TListChar } … … 364 331 I: TGListIndex; 365 332 begin 366 I := 0;367 while (I < Count) do begin333 I := Count - 1; 334 while (I >= 0) do begin 368 335 TNotifyEvent(Items[I])(Sender); 369 I := I +1;336 I := I - 1; 370 337 end; 371 338 end; … … 445 412 end; 446 413 447 procedure TListByte.WriteBuffer(var Buffer; Count: Integer);448 begin449 450 end;451 452 procedure TListByte.ReadBuffer(var Buffer; Count: Integer);453 begin454 455 end;456 414 457 415 end. -
trunk/Packages/TemplateGenerics/Specialized/SpecializedMatrix.pas
r54 r93 18 18 {$DEFINE TGMatrixRow := TMatrixIntegerRow} 19 19 {$DEFINE TGMatrix := TMatrixInteger} 20 {$DEFINE TGMatrixSortCompare := TMatrixIntegerSortCompare}21 {$DEFINE TGMatrixToStringConverter := TMatrixIntegerToStringConverter}22 {$DEFINE TGMatrixFromStringConverter := TMatrixIntegerFromStringConverter}23 {$DEFINE TGMatrixMerge := TMatrixIntegerMerge}24 20 {$DEFINE INTERFACE} 25 21 {$I 'GenericMatrix.inc'} … … 32 28 {$DEFINE TGMatrixRow := TMatrixByteRow} 33 29 {$DEFINE TGMatrix := TMatrixByte} 34 {$DEFINE TGMatrixSortCompare := TMatrixByteSortCompare}35 {$DEFINE TGMatrixToStringConverter := TMatrixByteToStringConverter}36 {$DEFINE TGMatrixFromStringConverter := TMatrixByteFromStringConverter}37 {$DEFINE TGMatrixMerge := TMatrixByteMerge}38 30 {$DEFINE INTERFACE} 39 31 {$I 'GenericMatrix.inc'} … … 46 38 {$DEFINE TGMatrixRow := TMatrixObjectRow} 47 39 {$DEFINE TGMatrix := TMatrixObject} 48 {$DEFINE TGMatrixSortCompare := TMatrixObjectSortCompare}49 {$DEFINE TGMatrixToStringConverter := TMatrixObjectToStringConverter}50 {$DEFINE TGMatrixFromStringConverter := TMatrixObjectFromStringConverter}51 {$DEFINE TGMatrixMerge := TMatrixStringMerge}52 40 {$DEFINE INTERFACE} 53 41 {$I 'GenericMatrix.inc'} … … 65 53 {$DEFINE TGMatrixRow := TMatrixIntegerRow} 66 54 {$DEFINE TGMatrix := TMatrixInteger} 67 {$DEFINE TGMatrixSortCompare := TMatrixIntegerSortCompare}68 {$DEFINE TGMatrixToStringConverter := TMatrixIntegerToStringConverter}69 {$DEFINE TGMatrixFromStringConverter := TMatrixIntegerFromStringConverter}70 {$DEFINE TGMatrixMerge := TMatrixIntegerMerge}71 55 {$DEFINE IMPLEMENTATION} 72 56 {$I 'GenericMatrix.inc'} … … 79 63 {$DEFINE TGMatrixRow := TMatrixByteRow} 80 64 {$DEFINE TGMatrix := TMatrixByte} 81 {$DEFINE TGMatrixSortCompare := TMatrixByteSortCompare}82 {$DEFINE TGMatrixToStringConverter := TMatrixByteToStringConverter}83 {$DEFINE TGMatrixFromStringConverter := TMatrixByteFromStringConverter}84 {$DEFINE TGMatrixMerge := TMatrixByteMerge}85 65 {$DEFINE IMPLEMENTATION} 86 66 {$I 'GenericMatrix.inc'} … … 93 73 {$DEFINE TGMatrixRow := TMatrixObjectRow} 94 74 {$DEFINE TGMatrix := TMatrixObject} 95 {$DEFINE TGMatrixSortCompare := TMatrixObjectSortCompare}96 {$DEFINE TGMatrixToStringConverter := TMatrixObjectToStringConverter}97 {$DEFINE TGMatrixFromStringConverter := TMatrixObjectFromStringConverter}98 {$DEFINE TGMatrixMerge := TMatrixStringMerge}99 75 {$DEFINE IMPLEMENTATION} 100 76 {$I 'GenericMatrix.inc'} -
trunk/Packages/TemplateGenerics/Specialized/SpecializedPoint.pas
r54 r93 1 1 unit SpecializedPoint; 2 2 3 {$mode objfpc}{$H+}3 {$mode Delphi}{$H+} 4 4 5 5 interface -
trunk/Packages/TemplateGenerics/Specialized/SpecializedQueue.pas
r54 r93 16 16 {$DEFINE TGQueue := TQueueInteger} 17 17 {$DEFINE TGQueueList := TQueueListInteger} 18 {$DEFINE TGQueueSortCompare := TQueueSortCompareInteger}19 {$DEFINE TGQueueToStringConverter := TQueueToStringConverterInteger}20 {$DEFINE TGQueueFromStringConverter := TQueueFromStringConverterInteger}21 {$DEFINE TGQueueItemArray := TQueueIntegerItemArray}22 18 {$DEFINE INTERFACE} 23 19 {$I 'GenericQueue.inc'} … … 28 24 {$DEFINE TGQueue := TQueuePointer} 29 25 {$DEFINE TGQueueList := TQueueListPointer} 30 {$DEFINE TGQueueSortCompare := TQueueSortComparePointer}31 {$DEFINE TGQueueToStringConverter := TQueueToStringConverterPointer}32 {$DEFINE TGQueueFromStringConverter := TQueueFromStringConverterPointer}33 {$DEFINE TGQueueItemArray := TQueuePointerItemArray}34 26 {$DEFINE INTERFACE} 35 27 {$I 'GenericQueue.inc'} … … 40 32 {$DEFINE TGQueue := TQueueByte} 41 33 {$DEFINE TGQueueList := TQueueListByte} 42 {$DEFINE TGQueueSortCompare := TQueueSortCompareByte}43 {$DEFINE TGQueueToStringConverter := TQueueToStringConverterByte}44 {$DEFINE TGQueueFromStringConverter := TQueueFromStringConverterByte}45 {$DEFINE TGQueueItemArray := TQueueByteItemArray}46 34 {$DEFINE INTERFACE} 47 35 {$I 'GenericQueue.inc'} … … 57 45 {$DEFINE TGQueue := TQueueInteger} 58 46 {$DEFINE TGQueueList := TQueueListInteger} 59 {$DEFINE TGQueueSortCompare := TQueueSortCompareInteger}60 {$DEFINE TGQueueToStringConverter := TQueueToStringConverterInteger}61 {$DEFINE TGQueueFromStringConverter := TQueueFromStringConverterInteger}62 {$DEFINE TGQueueItemArray := TQueueIntegerItemArray}63 47 {$DEFINE IMPLEMENTATION} 64 48 {$I '..\Generic\GenericQueue.inc'} … … 69 53 {$DEFINE TGQueue := TQueuePointer} 70 54 {$DEFINE TGQueueList := TQueueListPointer} 71 {$DEFINE TGQueueSortCompare := TQueueSortComparePointer}72 {$DEFINE TGQueueToStringConverter := TQueueToStringConverterPointer}73 {$DEFINE TGQueueFromStringConverter := TQueueFromStringConverterPointer}74 {$DEFINE TGQueueItemArray := TQueuePointerItemArray}75 55 {$DEFINE IMPLEMENTATION} 76 56 {$I 'GenericQueue.inc'} … … 81 61 {$DEFINE TGQueue := TQueueByte} 82 62 {$DEFINE TGQueueList := TQueueListByte} 83 {$DEFINE TGQueueSortCompare := TQueueSortCompareByte}84 {$DEFINE TGQueueToStringConverter := TQueueToStringConverterByte}85 {$DEFINE TGQueueFromStringConverter := TQueueFromStringConverterByte}86 {$DEFINE TGQueueItemArray := TQueueByteItemArray}87 63 {$DEFINE IMPLEMENTATION} 88 64 {$I 'GenericQueue.inc'} -
trunk/Packages/TemplateGenerics/Specialized/SpecializedSet.pas
r54 r93 16 16 {$DEFINE TGSetList := TSetListInteger} 17 17 {$DEFINE TGSet := TSetInteger} 18 {$DEFINE TGSetSortCompare := TSetSortCompareInteger}19 {$DEFINE TGSetToStringConverter := TSetToStringConverterInteger}20 {$DEFINE TGSetFromStringConverter := TSetFromStringConverterInteger}21 {$DEFINE TGSetItemArray := TSetIntegerItemArray}22 18 {$DEFINE INTERFACE} 23 19 {$I 'GenericSet.inc'} … … 28 24 {$DEFINE TGSetList := TSetListPointer} 29 25 {$DEFINE TGSet := TSetPointer} 30 {$DEFINE TGSetSortCompare := TSetSortComparePointer}31 {$DEFINE TGSetToStringConverter := TSetToStringConverterPointer}32 {$DEFINE TGSetFromStringConverter := TSetFromStringConverterPointer}33 {$DEFINE TGSetItemArray := TSetPointerItemArray}34 26 {$DEFINE INTERFACE} 35 27 {$I 'GenericSet.inc'} … … 45 37 {$DEFINE TGSetList := TSetListInteger} 46 38 {$DEFINE TGSet := TSetInteger} 47 {$DEFINE TGSetSortCompare := TSetSortCompareInteger}48 {$DEFINE TGSetToStringConverter := TSetToStringConverterInteger}49 {$DEFINE TGSetFromStringConverter := TSetFromStringConverterInteger}50 {$DEFINE TGSetItemArray := TSetIntegerItemArray}51 39 {$DEFINE IMPLEMENTATION} 52 40 {$I 'GenericSet.inc'} … … 57 45 {$DEFINE TGSetList := TSetListPointer} 58 46 {$DEFINE TGSet := TSetPointer} 59 {$DEFINE TGSetSortCompare := TSetSortComparePointer}60 {$DEFINE TGSetToStringConverter := TSetToStringConverterPointer}61 {$DEFINE TGSetFromStringConverter := TSetFromStringConverterPointer}62 {$DEFINE TGSetItemArray := TSetPointerItemArray}63 47 {$DEFINE IMPLEMENTATION} 64 48 {$I 'GenericSet.inc'} -
trunk/Packages/TemplateGenerics/Specialized/SpecializedStack.pas
r54 r93 16 16 {$DEFINE TGStackList := TListStackInteger} 17 17 {$DEFINE TGStack := TStackInteger} 18 {$DEFINE TGStackSortCompare := TStackSortCompareInteger}19 {$DEFINE TGStackToStringConverter := TStackToStringConverterInteger}20 {$DEFINE TGStackFromStringConverter := TStackFromStringConverterInteger}21 {$DEFINE TGStackItemArray := TStackIntegerItemArray}22 18 {$DEFINE INTERFACE} 23 19 {$I 'GenericStack.inc'} … … 28 24 {$DEFINE TGStackList := TListStackPointer} 29 25 {$DEFINE TGStack := TStackPointer} 30 {$DEFINE TGStackSortCompare := TStackSortComparePointer}31 {$DEFINE TGStackToStringConverter := TStackToStringConverterPointer}32 {$DEFINE TGStackFromStringConverter := TStackFromStringConverterPointer}33 {$DEFINE TGStackItemArray := TStackStringItemArray}34 26 {$DEFINE INTERFACE} 35 27 {$I 'GenericStack.inc'} … … 46 38 {$DEFINE TGStackList := TListStackInteger} 47 39 {$DEFINE TGStack := TStackInteger} 48 {$DEFINE TGStackSortCompare := TStackSortCompareInteger}49 {$DEFINE TGStackToStringConverter := TStackToStringConverterInteger}50 {$DEFINE TGStackFromStringConverter := TStackFromStringConverterInteger}51 {$DEFINE TGStackItemArray := TStackIntegerItemArray}52 40 {$DEFINE IMPLEMENTATION} 53 41 {$I 'GenericStack.inc'} … … 58 46 {$DEFINE TGStackList := TListStackPointer} 59 47 {$DEFINE TGStack := TStackPointer} 60 {$DEFINE TGStackSortCompare := TStackSortComparePointer}61 {$DEFINE TGStackToStringConverter := TStackToStringConverterPointer}62 {$DEFINE TGStackFromStringConverter := TStackFromStringConverterPointer}63 {$DEFINE TGStackItemArray := TStackStringItemArray}64 48 {$DEFINE IMPLEMENTATION} 65 49 {$I 'GenericStack.inc'} -
trunk/Packages/TemplateGenerics/Specialized/SpecializedStream.pas
r54 r93 18 18 {$DEFINE TGStreamList := TListStreamInteger} 19 19 {$DEFINE TGStream := TStreamInteger} 20 {$DEFINE TGStreamSortCompare := TStreamIntegerSortCompare}21 {$DEFINE TGStreamToStringConverter := TStreamIntegerToStringConverter}22 {$DEFINE TGStreamFromStringConverter := TStreamIntegerFromStringConverter}23 {$DEFINE TGStreamItemArray := TStreamIntegerItemArray}24 20 {$DEFINE INTERFACE} 25 21 {$I 'GenericStream.inc'} … … 30 26 {$DEFINE TGStreamList := TListStreamByte} 31 27 {$DEFINE TGStream := TBaseStreamByte} 32 {$DEFINE TGStreamSortCompare := TStreamByteSortCompare}33 {$DEFINE TGStreamToStringConverter := TStreamByteToStringConverter}34 {$DEFINE TGStreamFromStringConverter := TStreamByteFromStringConverter}35 {$DEFINE TGStreamItemArray := TStreamByteItemArray}36 28 {$DEFINE INTERFACE} 37 29 {$I 'GenericStream.inc'} … … 42 34 {$DEFINE TGStreamList := TListStreamPointer} 43 35 {$DEFINE TGStream := TStreamPointer} 44 {$DEFINE TGStreamSortCompare := TStreamPointerSortCompare}45 {$DEFINE TGStreamToStringConverter := TStreamPointerToStringConverter}46 {$DEFINE TGStreamFromStringConverter := TStreamPointerFromStringConverter}47 {$DEFINE TGStreamItemArray := TStreamPointerItemArray}48 36 {$DEFINE INTERFACE} 49 37 {$I 'GenericStream.inc'} … … 69 57 procedure WriteStream(Stream: TBaseStreamByte; Count: Integer); override; 70 58 function Read: Byte; override; 71 function ReadArray(Count: Integer): T StreamByteItemArray; override;59 function ReadArray(Count: Integer): TItemArray; override; 72 60 function ReadList(List: TListByte; Count: Integer): Integer; 73 61 function ReadBuffer(var Buffer; Count: Integer): Integer; override; … … 134 122 end; 135 123 136 function TMemoryStreamByte.ReadArray(Count: Integer): T StreamByteItemArray;124 function TMemoryStreamByte.ReadArray(Count: Integer): TItemArray; 137 125 begin 138 126 Result := FList.GetArray(FPosition, Count); … … 211 199 {$DEFINE TGStreamList := TListStreamInteger} 212 200 {$DEFINE TGStream := TStreamInteger} 213 {$DEFINE TGStreamSortCompare := TStreamIntegerSortCompare}214 {$DEFINE TGStreamToStringConverter := TStreamIntegerToStringConverter}215 {$DEFINE TGStreamFromStringConverter := TStreamIntegerFromStringConverter}216 {$DEFINE TGStreamItemArray := TStreamIntegerItemArray}217 201 {$DEFINE IMPLEMENTATION} 218 202 {$I 'GenericStream.inc'} … … 223 207 {$DEFINE TGStreamList := TListStreamByte} 224 208 {$DEFINE TGStream := TBaseStreamByte} 225 {$DEFINE TGStreamSortCompare := TStreamByteSortCompare}226 {$DEFINE TGStreamToStringConverter := TStreamByteToStringConverter}227 {$DEFINE TGStreamFromStringConverter := TStreamByteFromStringConverter}228 {$DEFINE TGStreamItemArray := TStreamByteItemArray}229 209 {$DEFINE IMPLEMENTATION} 230 210 {$I 'GenericStream.inc'} … … 235 215 {$DEFINE TGStreamList := TListStreamPointer} 236 216 {$DEFINE TGStream := TStreamPointer} 237 {$DEFINE TGStreamSortCompare := TStreamPointerSortCompare}238 {$DEFINE TGStreamToStringConverter := TStreamPointerToStringConverter}239 {$DEFINE TGStreamFromStringConverter := TStreamPointerFromStringConverter}240 {$DEFINE TGStreamItemArray := TStreamPointerItemArray}241 217 {$DEFINE IMPLEMENTATION} 242 218 {$I 'GenericStream.inc'} -
trunk/Packages/TemplateGenerics/Specialized/SpecializedTree.pas
r54 r93 16 16 {$DEFINE TGTreeNode := TTreeNodeInteger} 17 17 {$DEFINE TGTreeNodeList := TTreeNodeListInteger} 18 {$DEFINE TGTreeSortCompare := TTreeSortCompareInteger}19 {$DEFINE TGTreeToStringConverter := TTreeToStringConverterInteger}20 {$DEFINE TGTreeFromStringConverter := TTreeFromStringConverterInteger}21 {$DEFINE TGTreeItemArray := TTreeIntegerItemArray}22 18 {$DEFINE INTERFACE} 23 19 {$I 'GenericTree.inc'} … … 29 25 {$DEFINE TGTreeNode := TTreeNodeString} 30 26 {$DEFINE TGTreeNodeList := TTreeNodeListString} 31 {$DEFINE TGTreeSortCompare := TTreeSortCompareString}32 {$DEFINE TGTreeToStringConverter := TTreeToStringConverterString}33 {$DEFINE TGTreeFromStringConverter := TTreeFromStringConverterString}34 {$DEFINE TGTreeItemArray := TTreeStringItemArray}35 27 {$DEFINE INTERFACE} 36 28 {$I 'GenericTree.inc'} … … 42 34 {$DEFINE TGTreeNode := TTreeNodePointer} 43 35 {$DEFINE TGTreeNodeList := TTreeNodeListPointer} 44 {$DEFINE TGTreeSortCompare := TTreeSortComparePointer}45 {$DEFINE TGTreeToStringConverter := TTreeToStringConverterPointer}46 {$DEFINE TGTreeFromStringConverter := TTreeFromStringConverterPointer}47 {$DEFINE TGTreeItemArray := TTreePointerItemArray}48 36 {$DEFINE INTERFACE} 49 37 {$I 'GenericTree.inc'} … … 60 48 {$DEFINE TGTreeNode := TTreeNodeInteger} 61 49 {$DEFINE TGTreeNodeList := TTreeNodeListInteger} 62 {$DEFINE TGTreeSortCompare := TTreeSortCompareInteger}63 {$DEFINE TGTreeToStringConverter := TTreeToStringConverterInteger}64 {$DEFINE TGTreeFromStringConverter := TTreeFromStringConverterInteger}65 {$DEFINE TGTreeItemArray := TTreeIntegerItemArray}66 50 {$DEFINE IMPLEMENTATION} 67 51 {$I 'GenericTree.inc'} … … 73 57 {$DEFINE TGTreeNode := TTreeNodeString} 74 58 {$DEFINE TGTreeNodeList := TTreeNodeListString} 75 {$DEFINE TGTreeSortCompare := TTreeSortCompareString}76 {$DEFINE TGTreeToStringConverter := TTreeToStringConverterString}77 {$DEFINE TGTreeFromStringConverter := TTreeFromStringConverterString}78 {$DEFINE TGTreeItemArray := TTreeStringItemArray}79 59 {$DEFINE IMPLEMENTATION} 80 60 {$I 'GenericTree.inc'} … … 86 66 {$DEFINE TGTreeNode := TTreeNodePointer} 87 67 {$DEFINE TGTreeNodeList := TTreeNodeListPointer} 88 {$DEFINE TGTreeSortCompare := TTreeSortComparePointer}89 {$DEFINE TGTreeToStringConverter := TTreeToStringConverterPointer}90 {$DEFINE TGTreeFromStringConverter := TTreeFromStringConverterPointer}91 {$DEFINE TGTreeItemArray := TTreePointerItemArray}92 68 {$DEFINE IMPLEMENTATION} 93 69 {$I 'GenericTree.inc'} -
trunk/Packages/TemplateGenerics/TemplateGenerics.lpk
r82 r93 1 <?xml version="1.0" encoding="UTF-8"?>1 <?xml version="1.0"?> 2 2 <CONFIG> 3 3 <Package Version="4"> 4 4 <PathDelim Value="\"/> 5 5 <Name Value="TemplateGenerics"/> 6 <Type Value="RunAndDesignTime"/>7 6 <AddToProjectUsesSection Value="True"/> 8 7 <Author Value="Chronos (robie@centrum.cz)"/> … … 17 16 <CodeGeneration> 18 17 <Optimizations> 18 <VariablesInRegisters Value="True"/> 19 19 <OptimizationLevel Value="3"/> 20 <VariablesInRegisters Value="True"/>21 20 </Optimizations> 22 21 </CodeGeneration> 23 22 <Other> 24 23 <CompilerMessages> 25 < IgnoredMessages idx5024="True"/>24 <UseMsgFile Value="True"/> 26 25 </CompilerMessages> 26 <CompilerPath Value="$(CompPath)"/> 27 27 </Other> 28 28 </CompilerOptions> 29 29 <Description Value="Generic classes implemented as templates."/> 30 30 <Version Minor="4"/> 31 <Files Count="2 7">31 <Files Count="28"> 32 32 <Item1> 33 33 <Filename Value="ReadMe.txt"/> … … 47 47 </Item4> 48 48 <Item5> 49 <Filename Value="Generic\GenericQueue.inc"/> 50 <Type Value="Include"/> 49 <Filename Value="Generic\GenericFileList.inc"/> 51 50 </Item5> 52 51 <Item6> 53 <Filename Value="Generic\Generic Range.inc"/>52 <Filename Value="Generic\GenericQueue.inc"/> 54 53 <Type Value="Include"/> 55 54 </Item6> 56 55 <Item7> 57 <Filename Value="Generic\Generic Set.inc"/>56 <Filename Value="Generic\GenericRange.inc"/> 58 57 <Type Value="Include"/> 59 58 </Item7> 60 59 <Item8> 61 <Filename Value="Generic\GenericS tack.inc"/>60 <Filename Value="Generic\GenericSet.inc"/> 62 61 <Type Value="Include"/> 63 62 </Item8> 64 63 <Item9> 65 <Filename Value="Generic\Generic Tree.inc"/>64 <Filename Value="Generic\GenericStack.inc"/> 66 65 <Type Value="Include"/> 67 66 </Item9> 68 67 <Item10> 68 <Filename Value="Generic\GenericTree.inc"/> 69 <Type Value="Include"/> 70 </Item10> 71 <Item11> 69 72 <Filename Value="Generic\GenericMatrix.inc"/> 70 73 <UnitName Value="GenericMatrix"/> 71 </Item1 0>72 <Item1 1>74 </Item11> 75 <Item12> 73 76 <Filename Value="Generic\GenericListString.inc"/> 74 77 <UnitName Value="GenericListString"/> 75 </Item1 1>76 <Item1 2>78 </Item12> 79 <Item13> 77 80 <Filename Value="Generic\GenericBitmap.inc"/> 78 81 <UnitName Value="GenericBitmap"/> 79 </Item1 2>80 <Item1 3>82 </Item13> 83 <Item14> 81 84 <Filename Value="Generic\GenericPoint.inc"/> 82 85 <Type Value="Include"/> 83 </Item1 3>84 <Item1 4>86 </Item14> 87 <Item15> 85 88 <Filename Value="Generic\GenericStream.inc"/> 86 89 <UnitName Value="GenericStream"/> 87 </Item1 4>88 <Item1 5>90 </Item15> 91 <Item16> 89 92 <Filename Value="Generic\GenericRectangle.inc"/> 90 93 <UnitName Value="GenericRectangle"/> 91 </Item1 5>92 <Item1 6>94 </Item16> 95 <Item17> 93 96 <Filename Value="Specialized\SpecializedList.pas"/> 94 97 <UnitName Value="SpecializedList"/> 95 </Item1 6>96 <Item1 7>98 </Item17> 99 <Item18> 97 100 <Filename Value="Specialized\SpecializedDictionary.pas"/> 98 101 <UnitName Value="SpecializedDictionary"/> 99 </Item1 7>100 <Item1 8>102 </Item18> 103 <Item19> 101 104 <Filename Value="Specialized\SpecializedStack.pas"/> 102 105 <UnitName Value="SpecializedStack"/> 103 </Item1 8>104 <Item 19>106 </Item19> 107 <Item20> 105 108 <Filename Value="Specialized\SpecializedTree.pas"/> 106 109 <UnitName Value="SpecializedTree"/> 107 </Item 19>108 <Item2 0>110 </Item20> 111 <Item21> 109 112 <Filename Value="Specialized\SpecializedQueue.pas"/> 110 113 <UnitName Value="SpecializedQueue"/> 111 </Item2 0>112 <Item2 1>114 </Item21> 115 <Item22> 113 116 <Filename Value="Specialized\SpecializedSet.pas"/> 114 117 <UnitName Value="SpecializedSet"/> 115 </Item2 1>116 <Item2 2>118 </Item22> 119 <Item23> 117 120 <Filename Value="Specialized\SpecializedPoint.pas"/> 118 121 <UnitName Value="SpecializedPoint"/> 119 </Item2 2>120 <Item2 3>122 </Item23> 123 <Item24> 121 124 <Filename Value="Specialized\SpecializedMatrix.pas"/> 122 125 <UnitName Value="SpecializedMatrix"/> 123 </Item2 3>124 <Item2 4>126 </Item24> 127 <Item25> 125 128 <Filename Value="Specialized\SpecializedBitmap.pas"/> 126 129 <UnitName Value="SpecializedBitmap"/> 127 </Item2 4>128 <Item2 5>130 </Item25> 131 <Item26> 129 132 <Filename Value="Specialized\SpecializedStream.pas"/> 130 133 <UnitName Value="SpecializedStream"/> 131 </Item2 5>132 <Item2 6>134 </Item26> 135 <Item27> 133 136 <Filename Value="Specialized\SpecializedRectangle.pas"/> 134 137 <UnitName Value="SpecializedRectangle"/> 135 </Item2 6>136 <Item2 7>138 </Item27> 139 <Item28> 137 140 <Filename Value="Additional\UBinarySerializer.pas"/> 138 141 <UnitName Value="UBinarySerializer"/> 139 </Item2 7>142 </Item28> 140 143 </Files> 144 <Type Value="RunAndDesignTime"/> 141 145 <RequiredPkgs Count="2"> 142 146 <Item1> -
trunk/UCore.lfm
r91 r93 20 20 EmailContact = 'robie@centrum.cz' 21 21 AppName = 'LazFuck' 22 ReleaseDate = 4 297522 ReleaseDate = 43301 23 23 RegistryKey = '\Software\Chronosoft\LazFuck' 24 24 RegistryRoot = rrKeyCurrentUser -
trunk/UCore.pas
r91 r93 37 37 Optimizations: TOptimizations; 38 38 procedure Init; 39 procedure LoadFromRegistry( Root: HKEY; Key: string);40 procedure SaveToRegistry( Root: HKEY; Key: string);39 procedure LoadFromRegistry(Context: TRegistryContext); 40 procedure SaveToRegistry(Context: TRegistryContext); 41 41 property CurrentTarget: TTarget read FCurrentTarget write SetCurrentTarget; 42 42 end; … … 83 83 {$ENDIF} 84 84 85 LoadFromRegistry( HKEY(ApplicationInfo.RegistryRoot), ApplicationInfo.RegistryKey);85 LoadFromRegistry(Core.ApplicationInfo.GetRegistryContext); 86 86 end; 87 87 88 88 procedure TCore.DataModuleDestroy(Sender: TObject); 89 89 begin 90 SaveToRegistry( HKEY(ApplicationInfo.RegistryRoot), ApplicationInfo.RegistryKey);90 SaveToRegistry(Core.ApplicationInfo.GetRegistryContext); 91 91 FreeAndNil(Targets); 92 92 FreeAndNil(Project); … … 94 94 end; 95 95 96 procedure TCore.LoadFromRegistry( Root: HKEY; Key: string);96 procedure TCore.LoadFromRegistry(Context: TRegistryContext); 97 97 begin 98 98 with TRegistryEx.Create do 99 99 try 100 RootKey := Root; 101 OpenKey(Key, True); 100 CurrentContext := Context; 102 101 OpenProjectOnStart := ReadBoolWithDefault('OpenProjectOnStart', True); 103 102 if ValueExists('LanguageCode') then … … 113 112 Free; 114 113 end; 115 LastOpenedList.LoadFromRegistry( RegContext(Root,Key + '\' + RecentFilesRegKey));116 Targets.LoadFromRegistry( Root, Key);117 PersistentForm1.RegistryContext := RegContext(Root, Key);114 LastOpenedList.LoadFromRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\' + RecentFilesRegKey)); 115 Targets.LoadFromRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\Compiler')); 116 PersistentForm1.RegistryContext := Context; 118 117 end; 119 118 120 procedure TCore.SaveToRegistry( Root: HKEY; Key: string);119 procedure TCore.SaveToRegistry(Context: TRegistryContext); 121 120 begin 122 Targets.SaveToRegistry( Root, Key);123 LastOpenedList.SaveToRegistry( RegContext(Root,Key + '\' + RecentFilesRegKey));121 Targets.SaveToRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\Compiler')); 122 LastOpenedList.SaveToRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\' + RecentFilesRegKey)); 124 123 with TRegistryEx.Create do 125 124 try 126 RootKey := Root; 127 OpenKey(Key, True); 125 CurrentContext := Context; 128 126 WriteBool('OpenProjectOnStart', OpenProjectOnStart); 129 127 WriteBool('DPIAuto', ScaleDPI1.AutoDetect); -
trunk/UTarget.pas
r88 r93 120 120 procedure StepOut; virtual; 121 121 procedure RunToCursor(Pos: Integer); virtual; 122 procedure LoadFromRegistry( Root: HKEY; Key: string); virtual;123 procedure SaveToRegistry( Root: HKEY; Key: string); virtual;122 procedure LoadFromRegistry(Context: TRegistryContext); virtual; 123 procedure SaveToRegistry(Context: TRegistryContext); virtual; 124 124 property State: TRunState read FState write SetState; 125 125 property SourceCode: string write SetSourceCode; … … 134 134 135 135 TTargetList = class(TListObject) 136 procedure LoadFromRegistry( Root: HKEY; Key: string);137 procedure SaveToRegistry( Root: HKEY; Key: string);136 procedure LoadFromRegistry(Context: TRegistryContext); 137 procedure SaveToRegistry(Context: TRegistryContext); 138 138 function FindByName(Name: string): TTarget; 139 139 procedure LoadToMenuItem(MenuItem: TMenuItem; Action: TNotifyEvent; … … 271 271 { TTargetList } 272 272 273 procedure TTargetList.LoadFromRegistry( Root: HKEY; Key: string);273 procedure TTargetList.LoadFromRegistry(Context: TRegistryContext); 274 274 var 275 275 I: Integer; … … 277 277 with TRegistryEx.Create do 278 278 try 279 RootKey := Root; 280 OpenKey(Key + '\Compiler', True); 279 CurrentContext := Context; 281 280 for I := 0 to Count - 1 do 282 TTarget(Items[I]).LoadFromRegistry( Root, Key + '\Compiler');281 TTarget(Items[I]).LoadFromRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\' + TTarget(Items[I]).Name)); 283 282 finally 284 283 Free; … … 286 285 end; 287 286 288 procedure TTargetList.SaveToRegistry( Root: HKEY; Key: string);287 procedure TTargetList.SaveToRegistry(Context: TRegistryContext); 289 288 var 290 289 I: Integer; … … 292 291 with TRegistryEx.Create do 293 292 try 294 RootKey := Root; 295 OpenKey(Key + '\Compiler', True); 293 CurrentContext := Context; 296 294 for I := 0 to Count - 1 do 297 295 with TTarget(Items[I]) do 298 TTarget(Items[I]).SaveToRegistry( Root, Key + '\Compiler');296 TTarget(Items[I]).SaveToRegistry(TRegistryContext.Create(Context.RootKey, Context.Key + '\' + TTarget(Items[I]).Name)); 299 297 finally 300 298 Free; … … 507 505 end; 508 506 509 procedure TTarget.LoadFromRegistry( Root: HKEY; Key: string);507 procedure TTarget.LoadFromRegistry(Context: TRegistryContext); 510 508 begin 511 509 with TRegistryEx.Create do 512 510 try 513 RootKey := Root; 514 OpenKey(Key + '\' + Name, True); 511 CurrentContext := Context; 515 512 CompilerPath := ReadStringWithDefault('CompilerPath', CompilerPath); 516 513 ExecutorPath := ReadStringWithDefault('ExecutorPath', ExecutorPath); … … 520 517 end; 521 518 522 procedure TTarget.SaveToRegistry( Root: HKEY; Key: string);519 procedure TTarget.SaveToRegistry(Context: TRegistryContext); 523 520 begin 524 521 with TRegistryEx.Create do 525 522 try 526 RootKey := Root; 527 OpenKey(Key + '\' + Name, True); 523 CurrentContext := Context; 528 524 if CompilerPath <> '' then WriteString('CompilerPath', CompilerPath) 529 525 else DeleteValue('CompilerPath');
Note:
See TracChangeset
for help on using the changeset viewer.