mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 10:57:55 +02:00
IDE: in the Treeview Items Editor, add the ability to load a treeview from xml. Resolves issue #40806.
This commit is contained in:
parent
d4168ad2aa
commit
6b2d34231b
@ -157,6 +157,7 @@ begin
|
|||||||
dlgOpen.Title := sccsTrEdtOpenDialog;
|
dlgOpen.Title := sccsTrEdtOpenDialog;
|
||||||
dlgSave.Title := sccsTrEdtSaveDialog;
|
dlgSave.Title := sccsTrEdtSaveDialog;
|
||||||
dlgSave.Filter := 'xml files|*.xml|All files|'+GetAllFilesMask+'|';
|
dlgSave.Filter := 'xml files|*.xml|All files|'+GetAllFilesMask+'|';
|
||||||
|
dlgOpen.Filter := dlgSave.Filter;
|
||||||
|
|
||||||
// button panel
|
// button panel
|
||||||
ButtonPanel.ShowHint := true;
|
ButtonPanel.ShowHint := true;
|
||||||
@ -410,6 +411,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTreeViewItemsEditorForm.tbOpenClick(Sender: TObject);
|
procedure TTreeViewItemsEditorForm.tbOpenClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
Fn: String;
|
||||||
|
|
||||||
function ConfirmTreeReplace: boolean;
|
function ConfirmTreeReplace: boolean;
|
||||||
begin
|
begin
|
||||||
@ -426,8 +429,11 @@ begin
|
|||||||
|
|
||||||
if ConfirmTreeReplace and dlgOpen.Execute then
|
if ConfirmTreeReplace and dlgOpen.Execute then
|
||||||
begin
|
begin
|
||||||
treEditor.LoadFromFile(dlgOpen.FileName);
|
Fn := dlgOpen.FileName;
|
||||||
|
if (CompareFileExt(Fn, 'xml', False) = 0) then
|
||||||
|
TreeLoadFromXML(treEditor, Fn)
|
||||||
|
else
|
||||||
|
treEditor.LoadFromFile(Fn);
|
||||||
treEditor.FullExpand;
|
treEditor.FullExpand;
|
||||||
treEditor.Selected := treEditor.Items.GetFirstNode;
|
treEditor.Selected := treEditor.Items.GetFirstNode;
|
||||||
treEditor.SetFocus;
|
treEditor.SetFocus;
|
||||||
|
Loading…
Reference in New Issue
Block a user