IDE: in the Treeview Items Editor, add the ability to save a treeview as xml. Part of issue .

This commit is contained in:
Bart 2025-04-01 10:55:18 +02:00
parent 81bbf22fe0
commit d4168ad2aa
2 changed files with 23 additions and 6 deletions

View File

@ -12,7 +12,7 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Constraints.MinWidth = 400
KeyPreview = True
Position = poScreenCenter
LCLVersion = '3.99.0.0'
LCLVersion = '4.99.0.0'
OnActivate = FormActivate
OnClose = FormClose
OnCreate = FormCreate
@ -39,7 +39,7 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
ShowBevel = False
object btnApply: TBitBtn
AnchorSideBottom.Side = asrBottom
Left = 357
Left = 379
Height = 26
Hint = '[Shift+Enter]'
Top = 0

View File

@ -21,7 +21,9 @@ uses
Classes, SysUtils,
// LCL
LCLType, Forms, Dialogs, Buttons, Controls, StdCtrls, ComCtrls, ImgList, Spin,
ButtonPanel, ExtCtrls,
ButtonPanel, ExtCtrls, TreeStorage,
//LazUtils,
FileUtil, LazFileUtils,
// IdeIntf
PropEdits, ComponentEditors, ObjInspStrConsts, IDEImagesIntf, IDEWindowIntf;
@ -154,6 +156,7 @@ begin
// dialogs
dlgOpen.Title := sccsTrEdtOpenDialog;
dlgSave.Title := sccsTrEdtSaveDialog;
dlgSave.Filter := 'xml files|*.xml|All files|'+GetAllFilesMask+'|';
// button panel
ButtonPanel.ShowHint := true;
@ -433,6 +436,8 @@ begin
end;
procedure TTreeViewItemsEditorForm.tbSaveClick(Sender: TObject);
var
Fn: String;
function ImagesFound: boolean;
var
@ -469,9 +474,21 @@ procedure TTreeViewItemsEditorForm.tbSaveClick(Sender: TObject);
begin
FinishNodeEditing;
if ConfirmImagesLoss and dlgSave.Execute and ConfirmFileReplace then
treEditor.SaveToFile(dlgSave.FileName);
if dlgSave.Execute and ConfirmFileReplace then
begin
Fn := dlgSave.FileName;
if (CompareFileExt(Fn, 'xml', False) = 0) then
begin
TreeSaveToXML(treEditor, Fn);
end
else
begin
if ConfirmImagesLoss then
treEditor.SaveToFile(Fn);
end;
end;
//if ConfirmImagesLoss and dlgSave.Execute and ConfirmFileReplace then
// treEditor.SaveToFile(dlgSave.FileName);
end;
procedure TTreeViewItemsEditorForm.spnIndexChange(Sender: TObject);