mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 14:38:12 +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
components/ideintf
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user