Changeset 192
- Timestamp:
- May 1, 2018, 10:18:03 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 2 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r181 r192 180 180 Core.Init; 181 181 LoadConfig(Core.XMLConfig1, 'FormMain'); 182 Core.PersistentForm.Load(Self, wsMaximized);182 Core.PersistentForm.Load(Self, True); 183 183 ReloadView; 184 184 end; -
trunk/Packages/Common/Common.lpk
r177 r192 15 15 <Parsing> 16 16 <SyntaxOptions> 17 <SyntaxMode Value="Delphi"/> 17 18 <CStyleOperator Value="False"/> 18 19 <AllowLabel Value="False"/> … … 129 130 </Item20> 130 131 <Item21> 131 <Filename Value="UGeometry.pas"/> 132 <UnitName Value="UGeometry"/> 132 <Filename Value="UTheme.pas"/> 133 <HasRegisterProc Value="True"/> 134 <UnitName Value="UTheme"/> 133 135 </Item21> 134 136 <Item22> 135 <Filename Value="U GeometryClasses.pas"/>136 <UnitName Value="U GeometryClasses"/>137 <Filename Value="UStringTable.pas"/> 138 <UnitName Value="UStringTable"/> 137 139 </Item22> 138 140 </Files> … … 140 142 <EnableI18N Value="True"/> 141 143 <OutDir Value="Languages"/> 144 <EnableI18NForLFM Value="True"/> 142 145 </i18n> 143 <RequiredPkgs Count=" 2">146 <RequiredPkgs Count="3"> 144 147 <Item1> 145 <PackageName Value=" TemplateGenerics"/>148 <PackageName Value="LCL"/> 146 149 </Item1> 147 150 <Item2> 151 <PackageName Value="TemplateGenerics"/> 152 </Item2> 153 <Item3> 148 154 <PackageName Value="FCL"/> 149 155 <MinVersion Major="1" Valid="True"/> 150 </Item 2>156 </Item3> 151 157 </RequiredPkgs> 152 158 <UsageOptions> -
trunk/Packages/Common/Common.pas
r170 r192 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, U Geometry, UGeometryClasses,14 UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, 14 15 LazarusPackageIntf; 15 16 … … 26 27 RegisterUnit('UFindFile', @UFindFile.Register); 27 28 RegisterUnit('UScaleDPI', @UScaleDPI.Register); 29 RegisterUnit('UTheme', @UTheme.Register); 28 30 end; 29 31 -
trunk/Packages/Common/Languages/UJobProgressView.po
r116 r192 15 15 16 16 #: ujobprogressview.soperations 17 msgid "Operations "17 msgid "Operations:" 18 18 msgstr "" 19 19 -
trunk/Packages/Common/UApplicationInfo.pas
r43 r192 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
r116 r192 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; … … 70 71 function GetDirCount(Dir: string): Integer; 71 72 function MergeArray(A, B: array of string): TArrayOfString; 73 function LoadFileToStr(const FileName: TFileName): AnsiString; 74 procedure SearchFiles(AList: TStrings; Dir: string; 75 FilterMethod: TFilterMethodMethod); 76 function GetStringPart(var Text: string; Separator: string): string; 72 77 73 78 … … 111 116 Path := IncludeTrailingPathDelimiter(APath); 112 117 113 Find := FindFirst( UTF8Decode(Path + AFileSpec), faAnyFile xor faDirectory, SearchRec);118 Find := FindFirst(Path + AFileSpec, faAnyFile xor faDirectory, SearchRec); 114 119 while Find = 0 do begin 115 DeleteFile(Path + UTF8Encode(SearchRec.Name));120 DeleteFile(Path + SearchRec.Name); 116 121 117 122 Find := SysUtils.FindNext(SearchRec); … … 428 433 end; 429 434 430 procedure ExecuteProgram( CommandLine:string);435 procedure ExecuteProgram(Executable: string; Parameters: array of string); 431 436 var 432 437 Process: TProcess; 438 I: Integer; 433 439 begin 434 440 try 435 441 Process := TProcess.Create(nil); 436 Process.CommandLine := CommandLine; 442 Process.Executable := Executable; 443 for I := 0 to Length(Parameters) - 1 do 444 Process.Parameters.Add(Parameters[I]); 437 445 Process.Options := [poNoConsole]; 438 446 Process.Execute; … … 455 463 procedure OpenFileInShell(FileName: string); 456 464 begin 457 ExecuteProgram('cmd.exe /c start "' + FileName + '"');465 ExecuteProgram('cmd.exe', ['/c', 'start', FileName]); 458 466 end; 459 467 … … 492 500 end; 493 501 502 function LoadFileToStr(const FileName: TFileName): AnsiString; 503 var 504 FileStream: TFileStream; 505 Read: Integer; 506 begin 507 Result := ''; 508 FileStream := TFileStream.Create(FileName, fmOpenRead); 509 try 510 if FileStream.Size > 0 then begin 511 SetLength(Result, FileStream.Size); 512 Read := FileStream.Read(Pointer(Result)^, FileStream.Size); 513 SetLength(Result, Read); 514 end; 515 finally 516 FileStream.Free; 517 end; 518 end; 519 520 function DefaultSearchFilter(const FileName: string): Boolean; 521 begin 522 Result := True; 523 end; 524 525 procedure SearchFiles(AList: TStrings; Dir: string; 526 FilterMethod: TFilterMethodMethod); 527 var 528 SR: TSearchRec; 529 begin 530 Dir := IncludeTrailingPathDelimiter(Dir); 531 if FindFirst(Dir + '*', faAnyFile, SR) = 0 then 532 try 533 repeat 534 if (SR.Name = '.') or (SR.Name = '..') or not FilterMethod(SR.Name) or 535 not FilterMethod(Copy(Dir, 3, Length(Dir)) + SR.Name) then Continue; 536 AList.Add(Dir + SR.Name); 537 if (SR.Attr and faDirectory) <> 0 then 538 SearchFiles(AList, Dir + SR.Name, FilterMethod); 539 until FindNext(SR) <> 0; 540 finally 541 FindClose(SR); 542 end; 543 end; 544 545 function GetStringPart(var Text: string; Separator: string): string; 546 var 547 P: Integer; 548 begin 549 P := Pos(Separator, Text); 550 if P > 0 then begin 551 Result := Copy(Text, 1, P - 1); 552 Delete(Text, 1, P - 1 + Length(Separator)); 553 end else begin 554 Result := Text; 555 Text := ''; 556 end; 557 Result := Trim(Result); 558 Text := Trim(Text); 559 end; 560 494 561 495 562 -
trunk/Packages/Common/UDebugLog.pas
r116 r192 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
r109 r192 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
r116 r192 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
r116 r192 6 6 7 7 uses 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs,9 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, 8 LCLType, SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs, 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 function Scale96ToScreen(const ASize: Integer): Integer; 204 begin 205 Result := MulDiv(ASize, Screen.PixelsPerInch, 96); 206 end; 207 208 { TFormJobProgressView } 209 210 procedure TFormJobProgressView.UpdateHeight; 194 211 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); 212 H: Integer; 213 PanelOperationsVisible: Boolean; 214 PanelOperationsHeight: Integer; 215 PanelProgressVisible: Boolean; 216 PanelProgressTotalVisible: Boolean; 217 PanelLogVisible: Boolean; 218 MemoLogHeight: Integer = 200; 219 I: Integer; 220 ItemRect: TRect; 221 MaxH: Integer; 222 begin 223 H := PanelOperationsTitle.Height; 224 PanelOperationsVisible := JobProgressView.Jobs.Count > 0; 225 if PanelOperationsVisible <> PanelOperations.Visible then 226 PanelOperations.Visible := PanelOperationsVisible; 227 if ListViewJobs.Items.Count > 0 then begin 228 Maxh := 0; 229 for I := 0 to ListViewJobs.Items.Count - 1 do 230 begin 231 ItemRect := ListViewJobs.Items[i].DisplayRect(drBounds); 232 Maxh := Max(Maxh, ItemRect.Top + (ItemRect.Bottom - ItemRect.Top)); 233 end; 234 PanelOperationsHeight := Scale96ToScreen(12) + Maxh; 235 end else PanelOperationsHeight := Scale96ToScreen(8); 236 if PanelOperationsHeight <> PanelOperations.Height then 237 PanelOperations.Height := PanelOperationsHeight; 238 if PanelOperationsVisible then 239 H := H + PanelOperations.Height; 240 241 PanelProgressVisible := (JobProgressView.Jobs.Count > 0) and not JobProgressView.Finished; 242 if PanelProgressVisible <> PanelProgress.Visible then 243 PanelProgress.Visible := PanelProgressVisible; 244 if PanelProgressVisible then 245 H := H + PanelProgress.Height; 246 PanelProgressTotalVisible := (JobProgressView.Jobs.Count > 1) and not JobProgressView.Finished; 247 if PanelProgressTotalVisible <> PanelProgressTotal.Visible then 248 PanelProgressTotal.Visible := PanelProgressTotalVisible; 249 if PanelProgressTotalVisible then 250 H := H + PanelProgressTotal.Height; 251 Constraints.MinHeight := H; 252 PanelLogVisible := MemoLog.Lines.Count > 0; 253 if PanelLogVisible <> PanelLog.Visible then 254 PanelLog.Visible := PanelLogVisible; 255 if PanelLogVisible then 256 H := H + Scale96ToScreen(MemoLogHeight); 257 if PanelText.Visible then 258 H := H + PanelText.Height; 259 if Height <> H then begin 260 Height := H; 261 Top := (Screen.Height - H) div 2; 262 end; 263 end; 264 265 procedure TFormJobProgressView.TimerUpdateTimer(Sender: TObject); 266 var 267 ProgressBarPartVisible: Boolean; 268 ProgressBarTotalVisible: Boolean; 269 begin 270 JobProgressView.UpdateProgress; 271 if Visible and (not ProgressBarPart.Visible) and 272 Assigned(JobProgressView.CurrentJob) and 273 (JobProgressView.CurrentJob.Progress.Value > 0) then begin 274 ProgressBarPartVisible := True; 275 if ProgressBarPartVisible <> ProgressBarPart.Visible then 276 ProgressBarPart.Visible := ProgressBarPartVisible; 277 ProgressBarTotalVisible := True; 278 if ProgressBarTotalVisible <> ProgressBarTotal.Visible then 279 ProgressBarTotal.Visible := ProgressBarTotalVisible; 280 end; 281 if not Visible then begin 282 TimerUpdate.Interval := UpdateInterval; 283 if not JobProgressView.OwnerDraw then Show; 284 end; 285 if Assigned(JobProgressView.CurrentJob) then begin 286 LabelText.Caption := JobProgressView.CurrentJob.Progress.Text; 287 if LabelText.Caption <> '' then begin 288 PanelText.Visible := True; 289 UpdateHeight; 290 end; 291 end; 292 end; 293 294 procedure TFormJobProgressView.FormDestroy(Sender:TObject); 295 begin 296 end; 297 298 procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem); 299 begin 300 if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then 301 with TJob(JobProgressView.Jobs[Item.Index]) do begin 302 Item.Caption := Title; 303 if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1 304 else if Finished then Item.ImageIndex := 0 305 else Item.ImageIndex := 2; 306 Item.Data := JobProgressView.Jobs[Item.Index]; 307 end; 308 end; 309 310 procedure TFormJobProgressView.FormClose(Sender: TObject; 311 var CloseAction: TCloseAction); 312 begin 313 end; 314 315 procedure TFormJobProgressView.FormCreate(Sender: TObject); 316 begin 317 Caption := SPleaseWait; 318 try 319 //Animate1.FileName := ExtractFileDir(UTF8Encode(Application.ExeName)) + 320 // DirectorySeparator + 'horse.avi'; 321 //Animate1.Active := True; 322 except 323 324 end; 325 end; 326 327 procedure TFormJobProgressView.ReloadJobList; 328 begin 329 // Workaround for not showing first line 330 //Form.ListViewJobs.Items.Count := Jobs.Count + 1; 331 //Form.ListViewJobs.Refresh; 332 333 if ListViewJobs.Items.Count <> JobProgressView.Jobs.Count then 334 ListViewJobs.Items.Count := JobProgressView.Jobs.Count; 335 ListViewJobs.Refresh; 336 Application.ProcessMessages; 337 UpdateHeight; 338 end; 339 340 procedure TFormJobProgressView.FormShow(Sender: TObject); 341 begin 342 ReloadJobList; 343 end; 344 345 procedure TFormJobProgressView.FormHide(Sender: TObject); 346 begin 347 JobProgressView.Jobs.Clear; 348 ReloadJobList; 349 end; 350 351 procedure TFormJobProgressView.FormCloseQuery(Sender: TObject; var CanClose: Boolean); 352 begin 353 CanClose := JobProgressView.Finished; 354 JobProgressView.Terminate := True; 355 Caption := SPleaseWait + STerminate; 356 end; 357 358 359 { TJobProgressView } 360 361 function TJobProgressView.AddJob(Title: string; Method: TJobProgressViewMethod; 362 NoThreaded: Boolean = False; WaitFor: Boolean = False): TJob; 363 begin 364 Result := TJob.Create; 365 Result.ProgressView := Self; 366 Result.Title := Title; 367 Result.Method := Method; 368 Result.NoThreaded := NoThreaded; 369 Result.WaitFor := WaitFor; 370 Result.Progress.Max := 100; 371 Result.Progress.Reset; 372 Result.Progress.OnChange := JobProgressChange; 373 Jobs.Add(Result); 207 374 //ReloadJobList; 208 375 end; 209 376 210 procedure TJobProgressView.Start(AAutoClose: Boolean = True); 211 begin 212 AutoClose := AAutoClose; 213 StartJobs; 214 end; 215 216 procedure TJobProgressView.StartJobs; 377 procedure TJobProgressView.Start; 217 378 var 218 379 I: Integer; … … 229 390 Form.MemoLog.Clear; 230 391 392 Form.PanelText.Visible := False; 231 393 Form.LabelEstimatedTimePart.Visible := False; 232 394 Form.LabelEstimatedTimeTotal.Visible := False; … … 258 420 Form.ProgressBarPart.Visible := False; 259 421 //Show; 260 ReloadJobList;422 Form.ReloadJobList; 261 423 Application.ProcessMessages; 262 424 if NoThreaded then begin … … 296 458 //if Visible then Hide; 297 459 Form.MemoLog.Lines.Assign(Log); 298 if (Form.MemoLog.Lines.Count = 0) and AutoClose then begin460 if (Form.MemoLog.Lines.Count = 0) and FAutoClose then begin 299 461 Form.Hide; 300 462 end; 301 Clear;463 if not Form.Visible then Clear; 302 464 Form.Caption := SFinished; 303 465 //LabelEstimatedTimePart.Visible := False; 304 466 Finished := True; 305 467 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; 468 Form.ReloadJobList; 347 469 end; 348 470 end; … … 352 474 if Assigned(FOnOwnerDraw) then 353 475 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 476 end; 411 477 … … 426 492 Sleep(Quantum); 427 493 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 494 end; 436 495 … … 490 549 end; 491 550 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 551 constructor TJobProgressView.Create(TheOwner: TComponent); 506 552 begin 507 553 inherited; 508 554 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;555 FForm := TFormJobProgressView.Create(Self); 556 FForm.JobProgressView := Self; 557 end; 558 Jobs := TJobs.Create; 513 559 Log := TStringList.Create; 514 560 //PanelOperationsTitle.Height := 80; 515 ShowDelay := 0; //1000; // ms 561 AutoClose := True; 562 ShowDelay := 0; 516 563 end; 517 564 … … 519 566 begin 520 567 Jobs.Clear; 568 Log.Clear; 521 569 //ReloadJobList; 522 570 end; … … 528 576 inherited; 529 577 end; 578 579 { TProgress } 530 580 531 581 procedure TProgress.SetMax(const AValue: Integer); … … 536 586 if FMax < 1 then FMax := 1; 537 587 if FValue >= FMax then FValue := FMax; 588 finally 589 FLock.Release; 590 end; 591 end; 592 593 procedure TProgress.SetText(AValue: string); 594 begin 595 try 596 FLock.Acquire; 597 if FText = AValue then Exit; 598 FText := AValue; 538 599 finally 539 600 FLock.Release; … … 563 624 end; 564 625 565 { TProgress }566 567 626 procedure TProgress.Increment; 568 627 begin -
trunk/Packages/Common/ULastOpenedList.pas
r91 r192 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
r116 r192 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
r43 r192 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
r132 r192 26 26 FormWindowState: TWindowState; 27 27 Form: TForm; 28 DefaultFormWindowState: TWindowState;29 28 procedure LoadFromRegistry(RegistryContext: TRegistryContext); 30 29 procedure SaveToRegistry(RegistryContext: TRegistryContext); 31 30 function CheckEntireVisible(Rect: TRect): TRect; 32 31 function CheckPartVisible(Rect: TRect; Part: Integer): TRect; 33 procedure Load(Form: TForm; Default FormWindowState: TWindowState = wsNormal);32 procedure Load(Form: TForm; DefaultMaximized: Boolean = False); 34 33 procedure Save(Form: TForm); 35 34 constructor Create(AOwner: TComponent); override; … … 135 134 + FormRestoredSize.Top; 136 135 // Other state 137 FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer( DefaultFormWindowState)));136 FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(wsNormal))); 138 137 finally 139 138 Free; … … 216 215 end; 217 216 218 procedure TPersistentForm.Load(Form: TForm; Default FormWindowState: TWindowState = wsNormal);217 procedure TPersistentForm.Load(Form: TForm; DefaultMaximized: Boolean = False); 219 218 begin 220 219 Self.Form := Form; 221 Self.DefaultFormWindowState := DefaultFormWindowState;222 223 220 // Set default 224 221 FormNormalSize := Bounds((Screen.Width - Form.Width) div 2, … … 230 227 231 228 if not EqualRect(FormNormalSize, FormRestoredSize) or 232 (FormWindowState = wsMaximized)then begin229 DefaultMaximized then begin 233 230 // Restore to maximized state 234 231 Form.WindowState := wsNormal; -
trunk/Packages/Common/URegistry.pas
r43 r192 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
r43 r192 156 156 FThread.Name := 'ResetableThread'; 157 157 FThread.Parent := Self; 158 FThread. Resume;158 FThread.Start; 159 159 end; 160 160 -
trunk/Packages/Common/UThreading.pas
r43 r192 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
r43 r192 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
r109 r192 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/UCore.lfm
r181 r192 3 3 OnDestroy = DataModuleDestroy 4 4 OldCreateOrder = False 5 Height = 6766 HorizontalOffset = 3657 VerticalOffset = 2848 Width = 1 0489 PPI = 1 205 Height = 811 6 HorizontalOffset = 438 7 VerticalOffset = 341 8 Width = 1258 9 PPI = 144 10 10 object ActionList1: TActionList 11 11 Images = ImageListSmall 12 left = 1 1313 top = 5012 left = 136 13 top = 60 14 14 object AExit: TAction 15 15 Caption = 'Exit' … … 93 93 end 94 94 object ImageListSmall: TImageList 95 left = 65596 top = 35095 left = 786 96 top = 420 97 97 Bitmap = { 98 98 4C690C00000010000000100000000000000000000000E3AA4BD6E5B35EFFE3B1 … … 486 486 POFilesFolder = 'Languages' 487 487 OnTranslate = CoolTranslator1Translate 488 left = 1 14489 top = 363488 left = 137 489 top = 436 490 490 end 491 491 object ImageListLarge: TImageList 492 492 Height = 32 493 493 Width = 32 494 left = 655495 top = 2 38494 left = 786 495 top = 286 496 496 Bitmap = { 497 497 4C690C0000002000000020000000000000000000000000000000E2AA4B36E2A9 … … 2038 2038 RootName = 'CONFIG' 2039 2039 ReadOnly = False 2040 left = 1 142041 top = 4632040 left = 137 2041 top = 556 2042 2042 end 2043 2043 object OpenDialog1: TOpenDialog 2044 2044 DefaultExt = '.xtmap' 2045 left = 9382046 top = 2 432045 left = 1126 2046 top = 292 2047 2047 end 2048 2048 object SaveDialog1: TSaveDialog 2049 2049 DefaultExt = '.xtmap' 2050 left = 9382051 top = 1 382050 left = 1126 2051 top = 166 2052 2052 end 2053 2053 object ApplicationInfo: TApplicationInfo … … 2066 2066 RegistryRoot = rrKeyCurrentUser 2067 2067 License = 'CC0' 2068 left = 1 142069 top = 1 502068 left = 137 2069 top = 180 2070 2070 end 2071 2071 object PersistentForm: TPersistentForm 2072 2072 MinVisiblePart = 50 2073 2073 EntireVisible = False 2074 left = 6502075 top = 5002074 left = 780 2075 top = 600 2076 2076 end 2077 2077 object ScaleDPI1: TScaleDPI 2078 2078 AutoDetect = False 2079 left = 1 132080 top = 5632079 left = 136 2080 top = 676 2081 2081 end 2082 2082 object LastOpenedList1: TLastOpenedList 2083 2083 MaxCount = 10 2084 2084 OnChange = LastOpenedList1Change 2085 left = 1 142086 top = 2502085 left = 137 2086 top = 300 2087 2087 end 2088 2088 end -
trunk/xtactics.lpi
r190 r192 104 104 </Item7> 105 105 </RequiredPackages> 106 <Units Count="2 2">106 <Units Count="24"> 107 107 <Unit0> 108 108 <Filename Value="xtactics.lpr"/> … … 232 232 <IsPartOfProject Value="True"/> 233 233 </Unit21> 234 <Unit22> 235 <Filename Value="UGeometry.pas"/> 236 <IsPartOfProject Value="True"/> 237 </Unit22> 238 <Unit23> 239 <Filename Value="UGeometryClasses.pas"/> 240 <IsPartOfProject Value="True"/> 241 </Unit23> 234 242 </Units> 235 243 </ProjectOptions> -
trunk/xtactics.lpr
r185 r192 9 9 Interfaces, // this includes the LCL widgetset 10 10 Forms, tachartlazaruspkg, UGame, UCore, Common, 11 CoolTranslator, TemplateGenerics , UFormPlayer11 CoolTranslator, TemplateGenerics 12 12 { you can add units after this }, 13 SysUtils, UFormMain, UFormMove, UFormNew, UFormCharts, UFormUnitMoves, 14 UFormChat, UTCP, UServerList, UFormPlayersStats, UGameServer, UGameClient, 15 UGameProtocol, CoolStreaming; 13 SysUtils, UFormMain, CoolStreaming; 16 14 17 15 {$R *.res}
Note:
See TracChangeset
for help on using the changeset viewer.