From: <tw...@us...> - 2024-08-24 14:17:49
|
Revision: 4301 http://sourceforge.net/p/gexperts/code/4301 Author: twm Date: 2024-08-24 14:17:47 +0000 (Sat, 24 Aug 2024) Log Message: ----------- moved code from TfmCodeLib.OptionsExecute to TfmCodeOptions.Execute, .SetData and .GetData Modified Paths: -------------- trunk/Source/CodeLibrarian/GX_CodeLib.pas trunk/Source/CodeLibrarian/GX_CodeOpt.pas Modified: trunk/Source/CodeLibrarian/GX_CodeLib.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeLib.pas 2024-08-24 13:15:24 UTC (rev 4300) +++ trunk/Source/CodeLibrarian/GX_CodeLib.pas 2024-08-24 14:17:47 UTC (rev 4301) @@ -7,12 +7,13 @@ interface uses - Windows, SysUtils, + Windows, SysUtils, Forms, Controls, StdActns, Classes, ActnList, Actions, UITypes, Dialogs, Menus, ComCtrls, ToolWin, ExtCtrls, GpStructuredStorage, GX_Experts, GX_EnhancedEditor, - GX_GenericUtils, GX_StringList, GX_SharedImages, GX_BaseForm; + GX_GenericUtils, GX_StringList, GX_SharedImages, GX_BaseForm, + GX_CodeOpt; type TSearchRecord = record @@ -21,8 +22,6 @@ WholeWord: Boolean; end; - TCodeLayout = (clSide, clTop); - TGXStorageFile = class(TObject) private FStorage: IGpStructuredStorage; @@ -287,7 +286,7 @@ Clipbrd, u_dzVclUtils, u_dzStringUtils, {$IFOPT D+} GX_DbugIntf, {$ENDIF} - GX_CodeSrch, GX_CodeOpt, GX_GxUtils, + GX_CodeSrch, GX_GxUtils, GX_OtaUtils, GX_IdeUtils, GX_GExperts, GX_ConfigurationInfo, GX_MessageBox; @@ -953,59 +952,27 @@ procedure TfmCodeLib.OptionsExecute(Sender: TObject); var - frm: TfmCodeOptions; + lStoragePath: string; + lLayout: TCodeLayout; begin - frm := TfmCodeOptions.Create(nil); - try - frm.edPath.Text := StoragePath; - if Layout = clSide then - frm.rbSide.Checked := True - else - frm.rbTop.Checked := True; -{$IFOPT D+}SendDebug('Setting fcTreeView.Text to ' + tvTopics.Font.Name); {$ENDIF} - frm.fcTreeView.ItemIndex := frm.fcTreeView.Items.IndexOf(tvTopics.Font.Name); -{$IFOPT D+}SendDebug('fcTreeView.Text is ' + frm.fcTreeView.Text);{$ENDIF} - frm.udTreeView.Position := tvTopics.Font.Size; - frm.fcEditor.ItemIndex := frm.fcEditor.Items.IndexOf(FCodeText.Font.Name); - frm.udEditor.Position := FCodeText.Font.Size; - - if frm.ShowModal = mrOk then - begin - if (StoragePath <> frm.edPath.Text) then - begin - if CodeDB <> nil then - CloseDB(True); - - FreeAndNil(CodeDB); - tvTopics.Items.Clear; - FCodeText.Clear; - StoragePath := AddSlash(frm.edPath.Text); - CodeDB := OpenStorage(StoragePath + DefaultFileName); - if CodeDB = nil then - begin - MessageDlg(SCouldNotCreateStorage, mtError, [mbOK], 0); - Exit; - end; - InitializeTreeView; + lStoragePath := StoragePath; + lLayout := Layout; + if TfmCodeOptions.Execute(Self, lStoragePath, lLayout, tvTopics.Font, FCodeText.Font) then begin + if StoragePath <> lStoragePath then begin + if CodeDB <> nil then + CloseDB(True); + FreeAndNil(CodeDB); + tvTopics.Items.Clear; + FCodeText.Clear; + StoragePath := AddSlash(lStoragePath); + CodeDB := OpenStorage(StoragePath + DefaultFileName); + if CodeDB = nil then begin + MessageDlg(SCouldNotCreateStorage, mtError, [mbOK], 0); + Exit; end; - if frm.rbSide.Checked then - Layout := clSide - else - Layout := clTop; - - with tvTopics.Font do - begin - Name := frm.fcTreeView.Text; - Size := Trunc(StrToInt(frm.eTreeView.Text)); - end; - with FCodeText.Font do - begin - Name := frm.fcEditor.Text; - Size := Trunc(StrToInt(frm.eEditor.Text)); - end; + InitializeTreeView; end; - finally - FreeAndNil(frm); + Layout := lLayout; end; end; Modified: trunk/Source/CodeLibrarian/GX_CodeOpt.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeOpt.pas 2024-08-24 13:15:24 UTC (rev 4300) +++ trunk/Source/CodeLibrarian/GX_CodeOpt.pas 2024-08-24 14:17:47 UTC (rev 4301) @@ -3,9 +3,12 @@ interface uses - Classes, Controls, Forms, StdCtrls, ExtCtrls, ComCtrls, GX_BaseForm; + Classes, Controls, Forms, StdCtrls, ExtCtrls, ComCtrls, Graphics, GX_BaseForm; type + TCodeLayout = (clSide, clTop); + +type TfmCodeOptions = class(TfmBaseForm) btnOK: TButton; btnCancel: TButton; @@ -38,7 +41,13 @@ private procedure InitializeForm; procedure edPathOnFilesDropped(_Sender: TObject; _Files: TStrings); + procedure SetData(const _StoragePath: string; _Layout: TCodeLayout; + _TreeFont, _EditFont: TFont); + procedure GetData(out _StoragePath: string; out _Layout: TCodeLayout; + _TreeFont, _EditFont: TFont); public + class function Execute(_Owner: TWinControl; var _StoragePath: string; var _Layout: TCodeLayout; + _TreeFont, _EditFont: TFont): Boolean; constructor Create(_Owner: TComponent); override; end; @@ -49,6 +58,55 @@ uses SysUtils, GX_GenericUtils, u_dzVclUtils; +class function TfmCodeOptions.Execute(_Owner: TWinControl; var _StoragePath: string; + var _Layout: TCodeLayout; _TreeFont, _EditFont: TFont): Boolean; +var + frm: TfmCodeOptions; +begin + frm := TfmCodeOptions.Create(nil); + try + TForm_CenterOn(frm, _Owner); + frm.SetData(_StoragePath, _Layout, _TreeFont, _EditFont); + Result :=( frm.ShowModal = mrOk); + if Result then + frm.GetData(_StoragePath, _Layout, _TreeFont, _EditFont); + finally + FreeAndNil(frm); + end; +end; + +procedure TfmCodeOptions.SetData(const _StoragePath: string; _Layout: TCodeLayout; + _TreeFont, _EditFont: TFont); +begin + edPath.Text := _StoragePath; + + if _Layout = clSide then + rbSide.Checked := True + else + rbTop.Checked := True; + + fcTreeview.ItemIndex := fcTreeview.Items.IndexOf(_TreeFont.Name); + udTreeview.Position := _TreeFont.Size; + + fcEditor.ItemIndex := fcEditor.Items.IndexOf(_EditFont.Name); + udEditor.Position := _EditFont.Size; +end; + +procedure TfmCodeOptions.GetData(out _StoragePath: string; out _Layout: TCodeLayout; + _TreeFont, _EditFont: TFont); +begin + _StoragePath := edPath.Text; + if rbSide.Checked then + _Layout := clSide + else + _Layout := clTop; + + _TreeFont.Name := fcTreeview.Text; + _TreeFont.Size := Trunc(StrToInt(eTreeview.Text)); + _EditFont.Name := fcEditor.Text; + _EditFont.Size := Trunc(StrToInt(eEditor.Text)); +end; + procedure TfmCodeOptions.sbBrowseClick(Sender: TObject); var Temp: string; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tw...@us...> - 2024-09-16 10:29:13
|
Revision: 4318 http://sourceforge.net/p/gexperts/code/4318 Author: twm Date: 2024-09-16 10:29:11 +0000 (Mon, 16 Sep 2024) Log Message: ----------- * new overlaoded version of TGXStorageFile.GetObjectAttribute that combines .GetObjectAttribute and .MakeFileName * added todos Modified Paths: -------------- trunk/Source/CodeLibrarian/GX_CodeLib.pas trunk/Source/CodeLibrarian/GX_CodeLibFile.pas Modified: trunk/Source/CodeLibrarian/GX_CodeLib.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeLib.pas 2024-09-16 10:10:21 UTC (rev 4317) +++ trunk/Source/CodeLibrarian/GX_CodeLib.pas 2024-09-16 10:29:11 UTC (rev 4318) @@ -294,7 +294,7 @@ CodeDB.ListFolders(RootPath, Folders); for i := 0 to Folders.Count - 1 do begin - RNode := tvTopics.Items.AddChild(Node, CodeDB.GetObjectAttribute(CodeDb.MakeFileName(RootPath, Folders[i]), AttrTopic)); + RNode := tvTopics.Items.AddChild(Node, CodeDB.GetObjectAttribute(RootPath, Folders[i], AttrTopic)); RNode.ImageIndex := ImageIndexClosedFolder; RNode.SelectedIndex := ImageIndexOpenFolder; LoadTreeView(RNode); @@ -302,7 +302,7 @@ CodeDB.ListFiles(RootPath, Files); for i := 0 to Files.Count - 1 do begin - RNode := tvTopics.Items.AddChild(Node, CodeDB.GetObjectAttribute(CodeDb.MakeFileName(RootPath, Files[i]), AttrTopic)); + RNode := tvTopics.Items.AddChild(Node, CodeDB.GetObjectAttribute(RootPath, Files[i], AttrTopic)); RNode.ImageIndex := ImageIndexDocument; RNode.SelectedIndex := ImageIndexDocument; end; Modified: trunk/Source/CodeLibrarian/GX_CodeLibFile.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeLibFile.pas 2024-09-16 10:10:21 UTC (rev 4317) +++ trunk/Source/CodeLibrarian/GX_CodeLibFile.pas 2024-09-16 10:29:11 UTC (rev 4318) @@ -8,6 +8,9 @@ GpStructuredStorage, GX_StringList; +//TODO 3 -cIssue -oAnyone: Handle invalid filenames with \/, or use Topic attribute as the display text? +// (See AssertValidFilename method calls.) + const CodeLibPathSep = '\'; @@ -50,7 +53,8 @@ procedure SetAttribute(const AttrName: TGXUnicodeString; const Value: TGXUnicodeString); overload; procedure SetAttribute(const AttrName: TGXUnicodeString; const Value: Integer); overload; procedure SetObjectAttribute(const ObjectName, AttrName, AttrValue: TGXUnicodeString); - function GetObjectAttribute(const ObjectName, AttrName: TGXUnicodeString): TGXUnicodeString; + function GetObjectAttribute(const ObjectName, AttrName: TGXUnicodeString): TGXUnicodeString; overload; + function GetObjectAttribute(const FolderName, FileName, AttrName: TGXUnicodeString): TGXUnicodeString; overload; function MakeFileName(const FolderName, FileName: TGXUnicodeString): TGXUnicodeString; end; @@ -63,6 +67,7 @@ function TGXStorageFile.MakeFileName(const FolderName, FileName: TGXUnicodeString): TGXUnicodeString; begin + // todo: This is not consistent: Either use CodeLibPathSep or use AddSlash, but not both Result := FolderName; if Result = '' then Result := CodeLibPathSep @@ -280,6 +285,12 @@ Result := FileInfo.Attribute[AttrName]; end; +function TGXStorageFile.GetObjectAttribute(const FolderName, FileName, + AttrName: TGXUnicodeString): TGXUnicodeString; +begin + Result := GetObjectAttribute(MakeFileName(FolderName, FileName), AttrName); +end; + procedure TGXStorageFile.AssertExistingObjectName(const ObjectName: TGXUnicodeString); begin Assert(ObjectExists(ObjectName), ObjectName + ' does not exist'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tw...@us...> - 2024-09-16 11:44:18
|
Revision: 4319 http://sourceforge.net/p/gexperts/code/4319 Author: twm Date: 2024-09-16 11:44:13 +0000 (Mon, 16 Sep 2024) Log Message: ----------- new method TGXStorageFile.AddSlash as a replacement for GX_GenericUtils.AddSlash wich explicitly uses CodeLibPathSep. Modified Paths: -------------- trunk/Source/CodeLibrarian/GX_CodeLib.pas trunk/Source/CodeLibrarian/GX_CodeLibFile.pas Modified: trunk/Source/CodeLibrarian/GX_CodeLib.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeLib.pas 2024-09-16 10:29:11 UTC (rev 4318) +++ trunk/Source/CodeLibrarian/GX_CodeLib.pas 2024-09-16 11:44:13 UTC (rev 4319) @@ -366,7 +366,7 @@ ParentNode := ParentNode.Parent; NewTopic := GetUniqueTopicName(ParentNode, True); - NewFolder := AddSlash(GetNodePath(ParentNode)) + NewTopic; + NewFolder := CodeDB.AddSlash(GetNodePath(ParentNode)) + NewTopic; CodeDB.AssertValidFolderName(NewFolder); CodeDB.CreateFolder(NewFolder); Assert(CodeDB.FolderExists(NewFolder)); @@ -405,7 +405,7 @@ SelectedNode := SelectedNode.Parent; TopicName := GetUniqueTopicName(SelectedNode, False); - NewFileName := AddSlash(GetNodePath(SelectedNode)) + TopicName; + NewFileName := CodeDB.AddSlash(GetNodePath(SelectedNode)) + TopicName; CodeDB.OpenFile(NewFileName); Assert(CodeDB.FileExists(NewFileName)); CodeDB.SetAttribute(AttrTopic, TopicName); @@ -474,7 +474,7 @@ begin Modified := True; AssertValidFileName(S); - NewFileName := AddSlash(GetNodeParentPath(Node)) + S; + NewFileName := CodeDB.AddSlash(GetNodeParentPath(Node)) + S; if CodeDB.FileExists(NewFileName) or CodeDB.FolderExists(NewFileName) then raise Exception.CreateFmt('An item named %s already exists.', [S]); SetNodeAttribute(Node, AttrTopic, S); @@ -769,7 +769,7 @@ if IsCodeSnippet(DestNode) or DestNode.HasAsParent(SelectedNode) then Exit; //==> - CodeDB.Move(SelectedNodeFullName, AddSlash(GetNodePath(DestNode)) + SelectedCaption); + CodeDB.Move(SelectedNodeFullName, CodeDB.AddSlash(GetNodePath(DestNode)) + SelectedCaption); CodeDB.SaveStorage; SelectedNode.MoveTo(DestNode, naAddChild); DestNode.AlphaSort; @@ -1426,7 +1426,7 @@ TopicName := FolderPrefix else TopicName := SnippetPrefix; - ParentPath := AddSlash(GetNodePath(ParentNode)); + ParentPath := CodeDB.AddSlash(GetNodePath(ParentNode)); for i := 1 to 101 do begin TestName := TopicName + IntToStr(i); Modified: trunk/Source/CodeLibrarian/GX_CodeLibFile.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeLibFile.pas 2024-09-16 10:29:11 UTC (rev 4318) +++ trunk/Source/CodeLibrarian/GX_CodeLibFile.pas 2024-09-16 11:44:13 UTC (rev 4319) @@ -56,18 +56,29 @@ function GetObjectAttribute(const ObjectName, AttrName: TGXUnicodeString): TGXUnicodeString; overload; function GetObjectAttribute(const FolderName, FileName, AttrName: TGXUnicodeString): TGXUnicodeString; overload; function MakeFileName(const FolderName, FileName: TGXUnicodeString): TGXUnicodeString; + function AddSlash(const Foldername: TGXUnicodeString): TGXUnicodeString; end; implementation -uses - GX_GenericUtils; - { TGXStorageFile } +function TGXStorageFile.AddSlash(const FolderName: TGXUnicodeString): TGXUnicodeString; + + function IsPathSep(const s: string; Index: Integer): Boolean; + begin + Result := (Index >= Low(string)) and (Index <= High(s)) and (s[Index] = CodeLibPathSep) + and (ByteType(s, Index) = mbSingleByte); + end; + +begin + Result := FolderName; + if not IsPathSep(Result, High(Result)) then + Result := Result + CodeLibPathSep; +end; + function TGXStorageFile.MakeFileName(const FolderName, FileName: TGXUnicodeString): TGXUnicodeString; begin - // todo: This is not consistent: Either use CodeLibPathSep or use AddSlash, but not both Result := FolderName; if Result = '' then Result := CodeLibPathSep This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tw...@us...> - 2024-09-16 12:36:08
|
Revision: 4322 http://sourceforge.net/p/gexperts/code/4322 Author: twm Date: 2024-09-16 12:36:06 +0000 (Mon, 16 Sep 2024) Log Message: ----------- * explicitly set ActivePage * align "size" left Modified Paths: -------------- trunk/Source/CodeLibrarian/GX_CodeOpt.dfm trunk/Source/CodeLibrarian/GX_CodeOpt.pas Modified: trunk/Source/CodeLibrarian/GX_CodeOpt.dfm =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeOpt.dfm 2024-09-16 12:21:08 UTC (rev 4321) +++ trunk/Source/CodeLibrarian/GX_CodeOpt.dfm 2024-09-16 12:36:06 UTC (rev 4322) @@ -74,7 +74,6 @@ Top = 21 Width = 41 Height = 17 - Alignment = taCenter AutoSize = False Caption = 'Size' end Modified: trunk/Source/CodeLibrarian/GX_CodeOpt.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeOpt.pas 2024-09-16 12:21:08 UTC (rev 4321) +++ trunk/Source/CodeLibrarian/GX_CodeOpt.pas 2024-09-16 12:36:06 UTC (rev 4322) @@ -127,6 +127,7 @@ begin inherited; + pgeCodeOpt.ActivePage := tabFonts; TControl_SetConstraints(Self, [ccMinWidth, ccMinHeight, ccMaxHeight]); TWinControl_ActivateDropFiles(edPath, edPathOnFilesDropped); TEdit_ActivateAutoComplete(edPath, [acsFileSystem], [actSuggest]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tw...@us...> - 2024-09-16 16:46:12
|
Revision: 4329 http://sourceforge.net/p/gexperts/code/4329 Author: twm Date: 2024-09-16 16:46:11 +0000 (Mon, 16 Sep 2024) Log Message: ----------- * changed oder of parameters of TfmCodeOptions.Execute, .SetData and .GetData * partial fix for bug #388 Code librarian font sizes don't get restored after IDE restart in Delphi 12 Modified Paths: -------------- trunk/Source/CodeLibrarian/GX_CodeLib.pas trunk/Source/CodeLibrarian/GX_CodeOpt.pas Modified: trunk/Source/CodeLibrarian/GX_CodeLib.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeLib.pas 2024-09-16 16:43:12 UTC (rev 4328) +++ trunk/Source/CodeLibrarian/GX_CodeLib.pas 2024-09-16 16:46:11 UTC (rev 4329) @@ -175,8 +175,6 @@ FModified: Boolean; FSearch: TSearchRecord; FLayout: TCodeLayout; - FTreeFontSize: Integer; - FCodeFontSize: Integer; FStoragePath: TGXUnicodeString; FCodeText: TGxEnhancedEditor; FCurrentSyntaxMode: TGXSyntaxHighlighter; @@ -234,7 +232,7 @@ uses Clipbrd, - u_dzVclUtils, u_dzStringUtils, u_dzDpiScaleUtils, + u_dzVclUtils, u_dzStringUtils, u_dzMiscUtils, u_dzTypInfo, u_dzDpiScaleUtils, {$IFOPT D+} GX_DbugIntf, {$ENDIF} GX_CodeSrch, GX_GxUtils, GX_OtaUtils, GX_IdeUtils, @@ -819,15 +817,36 @@ end; procedure TfmCodeLib.SaveSettings; + + procedure GetDesignFont(_Ctrl: TControl; _Font: TFont); + var + fnt: TFont; + begin + if TryGetObjectProperty(_Ctrl, 'Font', TObject(fnt)) then + _Font.Assign(fnt); +{$IFDEF GX_IDE_IS_HIDPI_AWARE} + _Font.Height := FScaler.GetControlFontSize(_Ctrl); +{$ENDIF} + end; + var Settings: IExpertSettings; + TempFont: TFont; begin Settings := TCodeLibrarianExpert.GetSettings; // Do not localize any of the following lines. Settings.WriteString('StoragePath', StoragePath); - Settings.SaveFont('Editor', FCodeText.Font); - Settings.SaveFont('TreeView', tvTopics.Font); + TempFont := TFont.Create; + try + GetDesignFont(FCodeText, TempFont); + Settings.SaveFont('Editor', TempFont); + GetDesignFont(tvTopics, TempFont); + Settings.SaveFont('TreeView', TempFont); + finally + FreeAndNil(TempFont); + end; + Settings.SaveForm('Window', Self); Settings := Settings.Subkey('Window'); Settings.WriteInteger('Layout', Ord(Layout)); @@ -839,42 +858,37 @@ procedure TfmCodeLib.LoadSettings; - procedure RescaleFonts; -{$IFDEF GX_IDE_IS_HIDPI_AWARE} + procedure SetDesignFont(_Ctrl: TControl; _Font: TFont); var - Scaler: TDpiScaler; + fnt: TFont; begin - Scaler.Init(Self); - tvTopics.Font.Size := Scaler.Calc(FTreeFontSize); - FCodeText.Font.Size := Scaler.Calc(FCodeFontSize); + if TryGetObjectProperty(_Ctrl, 'Font', TObject(fnt)) then begin + fnt.Assign(_Font); +{$IFDEF GX_IDE_IS_HIDPI_AWARE} + FScaler.SetControlFontSize(_Ctrl, fnt.Height); + fnt.Height := FScaler.Calc(fnt.Height); +{$ENDIF} + end; end; -{$ELSE} - begin - tvTopics.Font.Size := FTreeFontSize; - FCodeText.Font.Size := FCodeFontSize; - end; -{$ENDIF} var Settings: IExpertSettings; - TreeViewFont: TFont; - CodeFont: TFont; + TempFont: TFont; begin Settings := TCodeLibrarianExpert.GetSettings; // Do not localize any of the following lines. StoragePath := Settings.ReadString('StoragePath', StoragePath); - TreeViewFont := TFont.Create; - TreeViewFont.Assign(tvTopics.Font); - CodeFont := TFont.Create; - CodeFont.Assign(FCodeText.Font); - Settings.LoadFont('Editor', CodeFont); - Settings.LoadFont('TreeView', TreeViewFont); - tvTopics.Font.Name := TreeViewFont.Name; - FCodeText.Font.Name := CodeFont.Name; - FTreeFontSize := TreeViewFont.Size; - FCodeFontSize := CodeFont.Size; - RescaleFonts; + TempFont := TFont.Create; + try + Settings.LoadFont('Editor', TempFont); + SetDesignFont(FCodeText, TempFont); + Settings.LoadFont('TreeView', TempFont); + SetDesignFont(tvTopics, TempFont); + finally + FreeAndNil(TempFont); + end; + Settings.LoadForm('Window', Self); Settings := Settings.Subkey('Window'); Layout := TCodeLayout(Settings.ReadInteger('Layout', 0)); @@ -929,10 +943,22 @@ var lStoragePath: string; lLayout: TCodeLayout; + TreeFont: TFont; + TreeFontName: string; + TreeFontSize: Integer; + CodeFont: TFont; + CodeFontName: string; + CodeFontSize: Integer; begin lStoragePath := StoragePath; lLayout := Layout; - if TfmCodeOptions.Execute(Self, lStoragePath, lLayout, tvTopics.Font, FCodeText.Font) then begin + treefont := tvTopics.Font; + TreeFontName := TreeFont.Name; + TreeFontSize := TreeFont.Size; + CodeFont := FCodeText.Font; + CodeFontName := CodeFont.Name; + CodeFontSize := CodeFont.Size; + if TfmCodeOptions.Execute(Self, lStoragePath, lLayout, TreeFontName, TreeFontSize, CodeFontName, CodeFontSize) then begin if StoragePath <> lStoragePath then begin if CodeDB <> nil then CloseDB(True); @@ -947,6 +973,19 @@ end; InitializeTreeView; end; + + TreeFont.Name := TreeFontName; + TreeFont.Size := TreeFontSize; + CodeFont.Name := CodeFontName; + CodeFont.Size := CodeFontSize; + +{$IFDEF GX_IDE_IS_HIDPI_AWARE} + TreeFontSize := MulDiv(TreeFont.Height, DEFAULT_DPI, CurrentPPI); + CodeFontSize := MulDiv(CodeFont.Height, DEFAULT_DPI, CurrentPPI); + FScaler.SetControlFontSize(tvTopics, TreeFontSize); + FScaler.SetControlFontSize(FCodeText, CodeFontSize); +{$ENDIF} + Layout := lLayout; end; end; @@ -1151,9 +1190,6 @@ ToolBar.Images := il; Actions.Images := il; MainMenu.Images := il; - - tvTopics.Font.Size := FScaler.Calc(FTreeFontSize); - FCodeText.Font.Size := FScaler.Calc(FCodeFontSize); end; {$ENDIF} Modified: trunk/Source/CodeLibrarian/GX_CodeOpt.pas =================================================================== --- trunk/Source/CodeLibrarian/GX_CodeOpt.pas 2024-09-16 16:43:12 UTC (rev 4328) +++ trunk/Source/CodeLibrarian/GX_CodeOpt.pas 2024-09-16 16:46:11 UTC (rev 4329) @@ -43,12 +43,12 @@ procedure InitializeForm; procedure edPathOnFilesDropped(_Sender: TObject; _Files: TStrings); procedure SetData(const _StoragePath: string; _Layout: TCodeLayout; - _TreeFont, _EditFont: TFont); + const _TreeFont: string; _TreeFontSize: Integer; const _EditFont: string; _EditFontSize: Integer); procedure GetData(out _StoragePath: string; out _Layout: TCodeLayout; - _TreeFont, _EditFont: TFont); + out _TreeFont: string; out _TreeFontSize: Integer; out _EditFont: string; out _EditFontSize: Integer); public class function Execute(_Owner: TWinControl; var _StoragePath: string; var _Layout: TCodeLayout; - _TreeFont, _EditFont: TFont): Boolean; + var _TreeFont: string; var _TreeFontSize: Integer; var _EditFont: string; var _EditFontSize: Integer): Boolean; constructor Create(_Owner: TComponent); override; end; @@ -59,8 +59,8 @@ uses SysUtils, GX_GenericUtils, u_dzVclUtils; -class function TfmCodeOptions.Execute(_Owner: TWinControl; var _StoragePath: string; - var _Layout: TCodeLayout; _TreeFont, _EditFont: TFont): Boolean; +class function TfmCodeOptions.Execute(_Owner: TWinControl; var _StoragePath: string; var _Layout: TCodeLayout; + var _TreeFont: string; var _TreeFontSize: Integer; var _EditFont: string; var _EditFontSize: Integer): Boolean; var frm: TfmCodeOptions; begin @@ -67,10 +67,10 @@ frm := TfmCodeOptions.Create(nil); try TForm_CenterOn(frm, _Owner); - frm.SetData(_StoragePath, _Layout, _TreeFont, _EditFont); + frm.SetData(_StoragePath, _Layout, _TreeFont, _TreeFontSize, _EditFont, _EditFontSize); Result :=( frm.ShowModal = mrOk); if Result then - frm.GetData(_StoragePath, _Layout, _TreeFont, _EditFont); + frm.GetData(_StoragePath, _Layout, _TreeFont, _TreeFontSize, _EditFont, _EditFontSize); finally FreeAndNil(frm); end; @@ -77,7 +77,7 @@ end; procedure TfmCodeOptions.SetData(const _StoragePath: string; _Layout: TCodeLayout; - _TreeFont, _EditFont: TFont); + const _TreeFont: string; _TreeFontSize: Integer; const _EditFont: string; _EditFontSize: Integer); begin edPath.Text := _StoragePath; @@ -86,15 +86,15 @@ else rbTop.Checked := True; - fcTreeview.ItemIndex := fcTreeview.Items.IndexOf(_TreeFont.Name); - udTreeview.Position := _TreeFont.Size; + fcTreeview.ItemIndex := fcTreeview.Items.IndexOf(_TreeFont); + udTreeview.Position := _TreeFontSize; - fcEditor.ItemIndex := fcEditor.Items.IndexOf(_EditFont.Name); - udEditor.Position := _EditFont.Size; + fcEditor.ItemIndex := fcEditor.Items.IndexOf(_EditFont); + udEditor.Position := _EditFontSize; end; procedure TfmCodeOptions.GetData(out _StoragePath: string; out _Layout: TCodeLayout; - _TreeFont, _EditFont: TFont); + out _TreeFont: string; out _TreeFontSize: Integer; out _EditFont: string; out _EditFontSize: Integer); begin _StoragePath := edPath.Text; if rbSide.Checked then @@ -102,10 +102,10 @@ else _Layout := clTop; - _TreeFont.Name := fcTreeview.Text; - _TreeFont.Size := Trunc(StrToInt(eTreeview.Text)); - _EditFont.Name := fcEditor.Text; - _EditFont.Size := Trunc(StrToInt(eEditor.Text)); + _TreeFont:= fcTreeview.Text; + _TreeFontSize := Trunc(StrToInt(eTreeview.Text)); + _EditFont:= fcEditor.Text; + _EditFontSize := Trunc(StrToInt(eEditor.Text)); end; procedure TfmCodeOptions.sbBrowseClick(Sender: TObject); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |