Changeset 507
- Timestamp:
- Mar 29, 2018, 10:11:06 AM (7 years ago)
- Location:
- ProjectTemplates/FileMenuProject
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
ProjectTemplates/FileMenuProject/Forms/UFormAbout.lfm
r497 r507 11 11 OnShow = FormShow 12 12 Position = poScreenCenter 13 LCLVersion = '1.8. 0.6'13 LCLVersion = '1.8.2.0' 14 14 object LabelDescription: TLabel 15 15 Left = 25 -
ProjectTemplates/FileMenuProject/Forms/UFormAbout.pas
r497 r507 49 49 procedure TFormAbout.FormShow(Sender: TObject); 50 50 begin 51 Core.ThemeManager1.UseTheme(Self); 51 52 if Assigned(ApplicationInfo) then begin 52 53 LabelAppName.Caption := ApplicationInfo.AppName; -
ProjectTemplates/FileMenuProject/Forms/UFormMain.lfm
r497 r507 13 13 OnCreate = FormCreate 14 14 OnShow = FormShow 15 LCLVersion = '1.8. 0.6'15 LCLVersion = '1.8.2.0' 16 16 object CoolBar1: TCoolBar 17 17 Left = 0 -
ProjectTemplates/FileMenuProject/Forms/UFormMain.pas
r499 r507 46 46 procedure MenuItemToolbarClick(Sender: TObject); 47 47 private 48 procedure SetToolbarHints; 48 49 procedure UpdateFormTitle; 49 50 public … … 70 71 begin 71 72 Core.PersistentForm1.Save(Self); 73 Core.Finalize; 72 74 end; 73 75 … … 78 80 end; 79 81 80 procedure TFormMain. FormCreate(Sender: TObject);82 procedure TFormMain.SetToolbarHints; 81 83 var 82 84 I: Integer; 85 J: Integer; 86 Control: TControl; 83 87 begin 84 for I := 0 to ToolBarFile.ButtonCount - 1 do 85 ToolBarFile.Buttons[I].Hint := ToolBarFile.Buttons[I].Caption; 88 for J := 0 to CoolBar1.ControlCount - 1 do begin 89 Control := CoolBar1.Controls[J]; 90 if Control is TToolBar then begin 91 for I := 0 to TToolBar(Control).ButtonCount - 1 do begin 92 TToolBar(Control).Buttons[I].ShowHint := True; 93 TToolBar(Control).Buttons[I].Hint := TToolBar(Control).Buttons[I].Caption; 94 end; 95 end; 96 end; 97 end; 98 99 procedure TFormMain.FormCreate(Sender: TObject); 100 begin 86 101 end; 87 102 88 103 procedure TFormMain.FormShow(Sender: TObject); 89 104 begin 105 Core.Initialize; 90 106 Core.PersistentForm1.Load(Self); 91 Core.Initialize; 107 Core.ThemeManager1.UseTheme(Self); 108 SetToolbarHints; 92 109 end; 93 110 -
ProjectTemplates/FileMenuProject/Forms/UFormSettings.lfm
r497 r507 1 1 object FormSettings: TFormSettings 2 Left = 7983 Height = 3 004 Top = 3675 Width = 4812 Left = 429 3 Height = 336 4 Top = 289 5 Width = 530 6 6 Caption = 'Settings' 7 ClientHeight = 3 008 ClientWidth = 4817 ClientHeight = 336 8 ClientWidth = 530 9 9 Constraints.MinHeight = 300 10 10 Constraints.MinWidth = 400 11 11 DesignTimePPI = 120 12 OnClose = FormClose 12 13 OnCreate = FormCreate 13 14 OnShow = FormShow 14 15 Position = poScreenCenter 15 LCLVersion = '1.8.0.6' 16 object ComboBoxLanguage: TComboBox 17 Left = 160 18 Height = 28 19 Top = 30 20 Width = 260 21 ItemHeight = 20 22 Style = csDropDownList 23 TabOrder = 0 24 end 25 object Label1: TLabel 26 Left = 20 27 Height = 20 28 Top = 30 29 Width = 68 30 Caption = 'Language:' 31 ParentColor = False 32 end 16 LCLVersion = '1.8.2.0' 33 17 object ButtonOk: TButton 34 Left = 37618 Left = 425 35 19 Height = 31 36 Top = 2 5620 Top = 292 37 21 Width = 94 38 22 Anchors = [akRight, akBottom] … … 40 24 ModalResult = 1 41 25 OnClick = ButtonOkClick 42 TabOrder = 226 TabOrder = 1 43 27 end 44 28 object ButtonCancel: TButton 45 Left = 25629 Left = 305 46 30 Height = 31 47 Top = 2 5631 Top = 292 48 32 Width = 94 49 33 Anchors = [akRight, akBottom] 50 34 Caption = 'Cancel' 51 35 ModalResult = 2 52 TabOrder = 136 TabOrder = 0 53 37 end 54 object CheckBoxAutomaticDPI: TCheckBox 55 Left = 16 56 Height = 24 57 Top = 104 58 Width = 120 59 Caption = 'Automatic DPI' 60 OnChange = CheckBoxAutomaticDPIChange 61 TabOrder = 3 62 Visible = False 63 end 64 object SpinEditDPI: TSpinEdit 65 Left = 152 66 Height = 28 67 Top = 144 68 Width = 121 69 MaxValue = 300 70 MinValue = 96 71 TabOrder = 4 72 Value = 96 73 Visible = False 74 end 75 object LabelDPI: TLabel 76 Left = 80 77 Height = 20 78 Top = 152 79 Width = 26 80 Caption = 'DPI:' 81 ParentColor = False 82 Visible = False 83 end 84 object CheckBoxReopenLastFileOnStart: TCheckBox 85 Left = 16 86 Height = 24 87 Top = 72 88 Width = 181 89 Caption = 'Reopen last file on start' 90 TabOrder = 5 91 end 92 object Bevel1: TBevel 93 Left = 10 94 Height = 2 95 Top = 240 96 Width = 456 97 Anchors = [akLeft, akRight, akBottom] 38 object PageControl1: TPageControl 39 Left = 8 40 Height = 278 41 Top = 8 42 Width = 513 43 ActivePage = TabSheetGeneral 44 Anchors = [akTop, akLeft, akRight, akBottom] 45 TabIndex = 0 46 TabOrder = 2 47 object TabSheetGeneral: TTabSheet 48 Caption = 'General' 49 ClientHeight = 245 50 ClientWidth = 505 51 object ComboBoxLanguage: TComboBox 52 Left = 160 53 Height = 28 54 Top = 30 55 Width = 260 56 ItemHeight = 20 57 Style = csDropDownList 58 TabOrder = 0 59 end 60 object Label1: TLabel 61 Left = 20 62 Height = 20 63 Top = 30 64 Width = 68 65 Caption = 'Language:' 66 ParentColor = False 67 end 68 object CheckBoxAutomaticDPI: TCheckBox 69 Left = 16 70 Height = 24 71 Top = 104 72 Width = 120 73 Caption = 'Automatic DPI' 74 OnChange = CheckBoxAutomaticDPIChange 75 TabOrder = 1 76 Visible = False 77 end 78 object SpinEditDPI: TSpinEdit 79 Left = 152 80 Height = 28 81 Top = 144 82 Width = 121 83 MaxValue = 300 84 MinValue = 96 85 TabOrder = 2 86 Value = 96 87 Visible = False 88 end 89 object LabelDPI: TLabel 90 Left = 80 91 Height = 20 92 Top = 146 93 Width = 26 94 Caption = 'DPI:' 95 ParentColor = False 96 Visible = False 97 end 98 object CheckBoxReopenLastFileOnStart: TCheckBox 99 Left = 16 100 Height = 24 101 Top = 72 102 Width = 181 103 Caption = 'Reopen last file on start' 104 TabOrder = 3 105 end 106 object Label2: TLabel 107 Left = 20 108 Height = 20 109 Top = 184 110 Width = 48 111 Caption = 'Theme:' 112 ParentColor = False 113 end 114 object ComboBoxTheme: TComboBox 115 Left = 160 116 Height = 28 117 Top = 184 118 Width = 260 119 ItemHeight = 20 120 Style = csDropDownList 121 TabOrder = 4 122 end 123 end 98 124 end 99 125 end -
ProjectTemplates/FileMenuProject/Forms/UFormSettings.pas
r497 r507 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Menus, Spin, ExtCtrls, ULanguages;9 Menus, Spin, ExtCtrls, ComCtrls, ULanguages; 10 10 11 11 type … … 14 14 15 15 TFormSettings = class(TForm) 16 Bevel1: TBevel;17 16 ButtonOk: TButton; 18 17 ButtonCancel: TButton; 18 CheckBoxAutomaticDPI: TCheckBox; 19 19 CheckBoxReopenLastFileOnStart: TCheckBox; 20 CheckBoxAutomaticDPI: TCheckBox;21 20 ComboBoxLanguage: TComboBox; 21 ComboBoxTheme: TComboBox; 22 22 Label1: TLabel; 23 Label2: TLabel; 23 24 LabelDPI: TLabel; 25 PageControl1: TPageControl; 24 26 SpinEditDPI: TSpinEdit; 27 TabSheetGeneral: TTabSheet; 25 28 procedure ButtonOkClick(Sender: TObject); 26 29 procedure CheckBoxAutomaticDPIChange(Sender: TObject); 27 30 procedure CheckBoxStartOnLogonChange(Sender: TObject); 31 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 28 32 procedure FormCreate(Sender: TObject); 29 33 procedure FormShow(Sender: TObject); … … 44 48 45 49 uses 46 UCore ;50 UCore, UTheme; 47 51 48 52 { TFormSettings } … … 50 54 procedure TFormSettings.FormShow(Sender: TObject); 51 55 begin 52 Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items); 53 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language); 54 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 56 Core.PersistentForm1.Load(Self); 57 Core.ThemeManager1.UseTheme(Self); 55 58 end; 56 59 57 60 procedure TFormSettings.ButtonOkClick(Sender: TObject); 58 61 begin 59 if ComboBoxLanguage.ItemIndex <> -1 then60 Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);61 62 end; 62 63 … … 71 72 end; 72 73 74 procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction 75 ); 76 begin 77 Core.PersistentForm1.Save(Self); 78 end; 79 73 80 procedure TFormSettings.FormCreate(Sender: TObject); 74 81 begin … … 81 88 SpinEditDPI.Value := Core.ScaleDPI1.DPI.X; 82 89 CheckBoxReopenLastFileOnStart.Checked := Core.ReopenLastFileOnStart; 90 91 Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items); 92 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language); 93 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 94 95 Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items); 96 ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager1.Theme); 97 if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0; 98 83 99 UpdateInterface; 84 100 end; … … 89 105 Core.ScaleDPI1.DPI := Point(SpinEditDPI.Value, SpinEditDPI.Value); 90 106 Core.ReopenLastFileOnStart := CheckBoxReopenLastFileOnStart.Checked; 107 if ComboBoxLanguage.ItemIndex <> -1 then 108 Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]); 109 if ComboBoxTheme.ItemIndex <> -1 then 110 Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]); 91 111 end; 92 112 -
ProjectTemplates/FileMenuProject/Languages/FileMenuProject.cs.po
r498 r507 131 131 msgstr "Jazyk:" 132 132 133 #: tformsettings.label2.caption 134 msgid "Theme:" 135 msgstr "Téma:" 136 133 137 #: tformsettings.labeldpi.caption 134 138 msgid "DPI:" 135 139 msgstr "DPI:" 140 141 #: tformsettings.tabsheetgeneral.caption 142 msgid "General" 143 msgstr "Obecné" 136 144 137 145 #: ucore.sappexit … … 143 151 msgstr "Soubor byl upraven. Chcete jej uložit před ukončením?" 144 152 153 #: udatafile.sallfiles 154 msgid "All files" 155 msgstr "Všechny soubory" 156 145 157 #: udatafile.sdatafilename 146 158 msgctxt "udatafile.sdatafilename" 147 159 msgid "File" 148 160 msgstr "Soubor" 161 162 #: udatafile.sdatafiles 163 msgid "Data files" 164 msgstr "Datové soubory" 149 165 150 166 #: uformabout.slicense … … 163 179 msgid "Modified" 164 180 msgstr "Upraveno" 181 182 #: uproject.sprojectfiles 183 msgid "Project files" 184 msgstr "Projektové soubory" 185 186 #: uproject.sprojectname 187 msgid "New project" 188 msgstr "Nový projekt" -
ProjectTemplates/FileMenuProject/Languages/FileMenuProject.po
r497 r507 121 121 msgstr "" 122 122 123 #: tformsettings.label2.caption 124 msgid "Theme:" 125 msgstr "" 126 123 127 #: tformsettings.labeldpi.caption 124 128 msgid "DPI:" 129 msgstr "" 130 131 #: tformsettings.tabsheetgeneral.caption 132 msgid "General" 125 133 msgstr "" 126 134 … … 133 141 msgstr "" 134 142 143 #: udatafile.sallfiles 144 msgid "All files" 145 msgstr "" 146 135 147 #: udatafile.sdatafilename 136 148 msgctxt "udatafile.sdatafilename" 137 149 msgid "File" 150 msgstr "" 151 152 #: udatafile.sdatafiles 153 msgid "Data files" 138 154 msgstr "" 139 155 … … 154 170 msgstr "" 155 171 172 #: uproject.sprojectfiles 173 msgid "Project files" 174 msgstr "" 175 176 #: uproject.sprojectname 177 msgid "New project" 178 msgstr "" 179 -
ProjectTemplates/FileMenuProject/Packages/Common/Common.lpk
r498 r507 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="21"> 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> 108 136 </Files> 109 137 <i18n> -
ProjectTemplates/FileMenuProject/Packages/Common/Common.pas
r498 r507 8 8 9 9 uses 10 StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI, UThreading, 11 UMemory, UResetableThread, UPool, ULastOpenedList, URegistry, 12 UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort, 13 UPersistentForm, UFindFile, UScaleDPI, LazarusPackageIntf;10 StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI, UThreading, 11 UMemory, UResetableThread, UPool, ULastOpenedList, URegistry, 12 UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort, 13 UPersistentForm, UFindFile, UScaleDPI, UTheme, LazarusPackageIntf; 14 14 15 15 implementation … … 25 25 RegisterUnit('UFindFile', @UFindFile.Register); 26 26 RegisterUnit('UScaleDPI', @UScaleDPI.Register); 27 RegisterUnit('UTheme', @UTheme.Register); 27 28 end; 28 29 -
ProjectTemplates/FileMenuProject/Packages/Common/UCommon.pas
r498 r507 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); 72 76 73 77 … … 111 115 Path := IncludeTrailingPathDelimiter(APath); 112 116 113 Find := FindFirst( UTF8Decode(Path + AFileSpec), faAnyFile xor faDirectory, SearchRec);117 Find := FindFirst(Path + AFileSpec, faAnyFile xor faDirectory, SearchRec); 114 118 while Find = 0 do begin 115 DeleteFile(Path + UTF8Encode(SearchRec.Name));119 DeleteFile(Path + SearchRec.Name); 116 120 117 121 Find := SysUtils.FindNext(SearchRec); … … 428 432 end; 429 433 430 procedure ExecuteProgram( CommandLine:string);434 procedure ExecuteProgram(Executable: string; Parameters: array of string); 431 435 var 432 436 Process: TProcess; 437 I: Integer; 433 438 begin 434 439 try 435 440 Process := TProcess.Create(nil); 436 Process.CommandLine := CommandLine; 441 Process.Executable := Executable; 442 for I := 0 to Length(Parameters) - 1 do 443 Process.Parameters.Add(Parameters[I]); 437 444 Process.Options := [poNoConsole]; 438 445 Process.Execute; … … 455 462 procedure OpenFileInShell(FileName: string); 456 463 begin 457 ExecuteProgram('cmd.exe /c start "' + FileName + '"');464 ExecuteProgram('cmd.exe', ['/c', 'start', FileName]); 458 465 end; 459 466 … … 492 499 end; 493 500 501 function LoadFileToStr(const FileName: TFileName): AnsiString; 502 var 503 FileStream: TFileStream; 504 Read: Integer; 505 begin 506 Result := ''; 507 FileStream := TFileStream.Create(FileName, fmOpenRead); 508 try 509 if FileStream.Size > 0 then begin 510 SetLength(Result, FileStream.Size); 511 Read := FileStream.Read(Pointer(Result)^, FileStream.Size); 512 SetLength(Result, Read); 513 end; 514 finally 515 FileStream.Free; 516 end; 517 end; 518 519 function DefaultSearchFilter(const FileName: string): Boolean; 520 begin 521 Result := True; 522 end; 523 524 procedure SearchFiles(AList: TStrings; Dir: string; 525 FilterMethod: TFilterMethodMethod); 526 var 527 SR: TSearchRec; 528 begin 529 Dir := IncludeTrailingPathDelimiter(Dir); 530 if FindFirst(Dir + '*', faAnyFile, SR) = 0 then 531 try 532 repeat 533 if (SR.Name = '.') or (SR.Name = '..') or not FilterMethod(SR.Name) then Continue; 534 AList.Add(Dir + SR.Name); 535 if (SR.Attr and faDirectory) <> 0 then 536 SearchFiles(AList, Dir + SR.Name, FilterMethod); 537 until FindNext(SR) <> 0; 538 finally 539 FindClose(SR); 540 end; 541 end; 494 542 495 543 -
ProjectTemplates/FileMenuProject/Packages/Common/UJobProgressView.lfm
r498 r507 1 1 object FormJobProgressView: TFormJobProgressView 2 Left = 6562 Left = 467 3 3 Height = 246 4 Top = 3544 Top = 252 5 5 Width = 328 6 6 BorderIcons = [biSystemMenu] -
ProjectTemplates/FileMenuProject/Packages/Common/UListViewSort.pas
r498 r507 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 … … 144 144 begin 145 145 with FStringGrid1 do begin 146 Options := Options - [goEditing, goAlwaysShowEditor]; 146 147 //Columns.Clear; 147 148 while Columns.Count > ListView.Columns.Count do Columns.Delete(Columns.Count - 1); … … 150 151 Columns[I].Width := ListView.Columns[I].Width; 151 152 end; 153 Options := Options + [goEditing, goAlwaysShowEditor]; 152 154 end; 153 155 end; … … 197 199 if AMsg.Msg = WM_NOTIFY then 198 200 begin 199 Code := PHDNotify(vMsgNotify.NMHdr)^.Hdr.Code;201 Code := NMHDR(PHDNotify(vMsgNotify.NMHdr)^.Hdr).Code; 200 202 case Code of 201 203 HDN_ENDTRACKA, HDN_ENDTRACKW: … … 353 355 TP1: TPoint; 354 356 XBias, YBias: Integer; 355 OldColor: TColor; 357 PenColor: TColor; 358 BrushColor: TColor; 356 359 BiasTop, BiasLeft: Integer; 357 360 Rect1: TRect; … … 365 368 Item.Left := 0; 366 369 GetCheckBias(XBias, YBias, BiasTop, BiasLeft, ListView); 367 OldColor := ListView.Canvas.Pen.Color; 370 PenColor := ListView.Canvas.Pen.Color; 371 BrushColor := ListView.Canvas.Brush.Color; 368 372 //TP1 := Item.GetPosition; 369 373 lRect := Item.DisplayRect(drBounds); // Windows 7 workaround … … 408 412 end; 409 413 //ListView.Canvas.Brush.Color := ListView.Color; 410 ListView.Canvas.Brush.Color := clWindow;411 ListView.Canvas.Pen.Color := OldColor;414 ListView.Canvas.Brush.Color := BrushColor; 415 ListView.Canvas.Pen.Color := PenColor; 412 416 end; 413 417 -
ProjectTemplates/FileMenuProject/UCore.lfm
r497 r507 9 9 PPI = 120 10 10 object ImageList1: TImageList 11 left = 16012 top = 23111 left = 280 12 top = 120 13 13 Bitmap = { 14 14 4C69090000001000000010000000000000000000000000000000000000000000 … … 305 305 object ActionList1: TActionList 306 306 Images = ImageList1 307 left = 340308 top = 233307 left = 280 308 top = 56 309 309 object AExit: TAction 310 310 Caption = 'Exit' … … 369 369 MaxCount = 10 370 370 OnChange = LastOpenedList1Change 371 left = 509372 top = 231371 left = 88 372 top = 312 373 373 end 374 374 object OpenDialog1: TOpenDialog 375 left = 520376 top = 322375 left = 280 376 top = 184 377 377 end 378 378 object SaveDialog1: TSaveDialog 379 left = 375380 top = 329379 left = 280 380 top = 248 381 381 end 382 382 object ApplicationInfo1: TApplicationInfo … … 394 394 RegistryRoot = rrKeyCurrentUser 395 395 License = 'CC0' 396 left = 191397 top = 329396 left = 88 397 top = 184 398 398 end 399 399 object PersistentForm1: TPersistentForm 400 400 MinVisiblePart = 50 401 401 EntireVisible = False 402 left = 520403 top = 72402 left = 88 403 top = 248 404 404 end 405 405 object CoolTranslator1: TCoolTranslator 406 406 POFilesFolder = 'Languages' 407 left = 239408 top = 72407 left = 88 408 top = 56 409 409 end 410 410 object ScaleDPI1: TScaleDPI 411 411 AutoDetect = False 412 left = 376 413 top = 72 412 left = 88 413 top = 128 414 end 415 object ThemeManager1: TThemeManager 416 left = 280 417 top = 312 414 418 end 415 419 end -
ProjectTemplates/FileMenuProject/UCore.pas
r499 r507 8 8 Classes, SysUtils, FileUtil, Controls, ActnList, Forms, Dialogs, 9 9 ULastOpenedList, UApplicationInfo, UPersistentForm, UScaleDPI, UCommon, 10 UCoolTranslator, UDataFile, Menus, URegistry, Registry;10 UCoolTranslator, UDataFile, Menus, URegistry, UTheme, Registry; 11 11 12 12 type … … 34 34 SaveDialog1: TSaveDialog; 35 35 ScaleDPI1: TScaleDPI; 36 ThemeManager1: TThemeManager; 36 37 procedure AAboutExecute(Sender: TObject); 37 38 procedure AExitExecute(Sender: TObject); … … 57 58 public 58 59 DataFile: TDataFile; 60 DataFileClass: TDataFileClass; 61 59 62 FileClosed: Boolean; 60 63 ReopenLastFileOnStart: Boolean; … … 64 67 procedure FileClose; 65 68 procedure Initialize; 69 procedure Finalize; 66 70 procedure UpdateInterface; 67 71 end; … … 130 134 131 135 procedure TCore.AFileOpenExecute(Sender: TObject); 136 var 137 TempFile: TDataFile; 132 138 begin 133 139 OpenDialog1.DefaultExt := ''; 140 TempFile := DataFileClass.Create; 141 try 142 OpenDialog1.Filter := TempFile.GetFileDialogFilter; 143 OpenDialog1.DefaultExt := TempFile.GetFileExt; 144 finally 145 TempFile.Free; 146 end; 134 147 if Assigned(DataFile) then begin 135 148 OpenDialog1.InitialDir := ExtractFileDir(DataFile.FileName); … … 153 166 SaveDialog1.InitialDir := ExtractFileDir(DataFile.FileName); 154 167 SaveDialog1.FileName := ExtractFileName(DataFile.FileName); 168 SaveDialog1.Filter := DataFile.GetFileDialogFilter; 155 169 if SaveDialog1.Execute then begin 156 170 DataFile.SaveToFile(SaveDialog1.FileName); … … 173 187 DataFile := nil; 174 188 FileClosed := True; 189 DataFileClass := TDataFile; 175 190 end; 176 191 177 192 procedure TCore.DataModuleDestroy(Sender: TObject); 178 193 begin 179 SaveConfig;180 194 end; 181 195 … … 255 269 FormMain.MenuItemToolbar.Checked := ReadBoolWithDefault('ToolBarVisible', True); 256 270 ReopenLastFileOnStart := ReadBoolWithDefault('ReopenLastFileOnStart', True); 271 ThemeManager1.Theme := ThemeManager1.Themes.FindByName(ReadStringWithDefault('Theme', 'System')); 257 272 finally 258 273 Free; … … 273 288 WriteBool('ToolBarVisible', FormMain.MenuItemToolbar.Checked); 274 289 WriteBool('ReopenLastFileOnStart', ReopenLastFileOnStart); 290 WriteString('Theme', ThemeManager1.Theme.Name); 275 291 finally 276 292 Free; … … 311 327 end; 312 328 329 procedure TCore.Finalize; 330 begin 331 SaveConfig; 332 end; 333 313 334 function TCore.FindFirstNonOption: string; 314 335 var -
ProjectTemplates/FileMenuProject/UDataFile.pas
r497 r507 20 20 public 21 21 function GetFileExt: string; virtual; 22 function GetFileDialogFilter: string; virtual; 22 23 procedure LoadFromFile(FileName: string); virtual; 23 24 procedure SaveToFile(FileName: string); virtual; … … 28 29 end; 29 30 31 TDataFileClass = class of TDataFile; 32 30 33 TDataFiles = class(TObjectList) 31 34 end; 32 35 36 37 resourcestring 38 SAllFiles = 'All files'; 33 39 34 40 implementation … … 36 42 resourcestring 37 43 SDataFileName = 'File'; 44 SDataFiles = 'Data files'; 45 38 46 39 47 { TDataFile } … … 48 56 begin 49 57 Result := '.dat'; 58 end; 59 60 function TDataFile.GetFileDialogFilter: string; 61 begin 62 Result := SDataFiles + ' (' + GetFileExt + ')|*' + GetFileExt + '|' + 63 SAllFiles + '|*.*'; 50 64 end; 51 65 -
ProjectTemplates/FileMenuProject/UProject.pas
r497 r507 17 17 constructor Create; override; 18 18 function GetFileExt: string; override; 19 function GetFileDialogFilter: string; override; 19 20 end; 20 21 21 22 22 23 implementation 24 25 resourcestring 26 SProjectName = 'New project'; 27 SProjectFiles = 'Project files'; 23 28 24 29 … … 28 33 begin 29 34 inherited Create; 35 FileName := SProjectName + GetFileExt; 30 36 end; 31 37 … … 35 41 end; 36 42 43 function TProject.GetFileDialogFilter: string; 44 begin 45 Result := SProjectFiles + ' (' + GetFileExt + ')|*' + GetFileExt + '|' + 46 SAllFiles + '|*.*'; 47 end; 48 37 49 end. 38 50
Note:
See TracChangeset
for help on using the changeset viewer.