mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:59:16 +02:00
IDE: in the Treeview Items Editor, add the ability to save a treeview as xml. Part of issue #40806.
This commit is contained in:
parent
81bbf22fe0
commit
d4168ad2aa
@ -12,7 +12,7 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
|
|||||||
Constraints.MinWidth = 400
|
Constraints.MinWidth = 400
|
||||||
KeyPreview = True
|
KeyPreview = True
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '3.99.0.0'
|
LCLVersion = '4.99.0.0'
|
||||||
OnActivate = FormActivate
|
OnActivate = FormActivate
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
@ -39,7 +39,7 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
|
|||||||
ShowBevel = False
|
ShowBevel = False
|
||||||
object btnApply: TBitBtn
|
object btnApply: TBitBtn
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 357
|
Left = 379
|
||||||
Height = 26
|
Height = 26
|
||||||
Hint = '[Shift+Enter]'
|
Hint = '[Shift+Enter]'
|
||||||
Top = 0
|
Top = 0
|
||||||
|
@ -21,7 +21,9 @@ uses
|
|||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
// LCL
|
// LCL
|
||||||
LCLType, Forms, Dialogs, Buttons, Controls, StdCtrls, ComCtrls, ImgList, Spin,
|
LCLType, Forms, Dialogs, Buttons, Controls, StdCtrls, ComCtrls, ImgList, Spin,
|
||||||
ButtonPanel, ExtCtrls,
|
ButtonPanel, ExtCtrls, TreeStorage,
|
||||||
|
//LazUtils,
|
||||||
|
FileUtil, LazFileUtils,
|
||||||
// IdeIntf
|
// IdeIntf
|
||||||
PropEdits, ComponentEditors, ObjInspStrConsts, IDEImagesIntf, IDEWindowIntf;
|
PropEdits, ComponentEditors, ObjInspStrConsts, IDEImagesIntf, IDEWindowIntf;
|
||||||
|
|
||||||
@ -154,6 +156,7 @@ begin
|
|||||||
// dialogs
|
// dialogs
|
||||||
dlgOpen.Title := sccsTrEdtOpenDialog;
|
dlgOpen.Title := sccsTrEdtOpenDialog;
|
||||||
dlgSave.Title := sccsTrEdtSaveDialog;
|
dlgSave.Title := sccsTrEdtSaveDialog;
|
||||||
|
dlgSave.Filter := 'xml files|*.xml|All files|'+GetAllFilesMask+'|';
|
||||||
|
|
||||||
// button panel
|
// button panel
|
||||||
ButtonPanel.ShowHint := true;
|
ButtonPanel.ShowHint := true;
|
||||||
@ -433,6 +436,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTreeViewItemsEditorForm.tbSaveClick(Sender: TObject);
|
procedure TTreeViewItemsEditorForm.tbSaveClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
Fn: String;
|
||||||
|
|
||||||
function ImagesFound: boolean;
|
function ImagesFound: boolean;
|
||||||
var
|
var
|
||||||
@ -469,9 +474,21 @@ procedure TTreeViewItemsEditorForm.tbSaveClick(Sender: TObject);
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
FinishNodeEditing;
|
FinishNodeEditing;
|
||||||
|
if dlgSave.Execute and ConfirmFileReplace then
|
||||||
if ConfirmImagesLoss and dlgSave.Execute and ConfirmFileReplace then
|
begin
|
||||||
treEditor.SaveToFile(dlgSave.FileName);
|
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;
|
end;
|
||||||
|
|
||||||
procedure TTreeViewItemsEditorForm.spnIndexChange(Sender: TObject);
|
procedure TTreeViewItemsEditorForm.spnIndexChange(Sender: TObject);
|
||||||
|
Loading…
Reference in New Issue
Block a user