mirror of https://gitlab.com/basile.b/dexed.git
dub proj editor, dont loose selection
This commit is contained in:
parent
96f754999b
commit
8ef75e82b0
|
@ -400,6 +400,7 @@ end;
|
||||||
procedure TCEDubProjectEditorWidget.btnDelPropClick(Sender: TObject);
|
procedure TCEDubProjectEditorWidget.btnDelPropClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
prt: TJSONData;
|
prt: TJSONData;
|
||||||
|
sel: TTreeNode;
|
||||||
begin
|
begin
|
||||||
if fSelectedNode.isNil then exit;
|
if fSelectedNode.isNil then exit;
|
||||||
if fSelectedNode.Level = 0 then exit;
|
if fSelectedNode.Level = 0 then exit;
|
||||||
|
@ -413,6 +414,13 @@ begin
|
||||||
TJSONObject(prt).Delete(fSelectedNode.Index)
|
TJSONObject(prt).Delete(fSelectedNode.Index)
|
||||||
else if prt.JSONType = jtArray then
|
else if prt.JSONType = jtArray then
|
||||||
TJSONArray(prt).Delete(fSelectedNode.Index);
|
TJSONArray(prt).Delete(fSelectedNode.Index);
|
||||||
|
sel := fSelectedNode.GetPrevSibling;
|
||||||
|
if sel.isNil then
|
||||||
|
sel := fSelectedNode.GetNextSibling;
|
||||||
|
if sel.isNil then
|
||||||
|
sel := fSelectedNode.Parent;
|
||||||
|
if sel.isNotNil then
|
||||||
|
sel.Selected:=true;
|
||||||
fProj.endModification;
|
fProj.endModification;
|
||||||
|
|
||||||
updateValueEditor;
|
updateValueEditor;
|
||||||
|
@ -581,8 +589,14 @@ procedure TCEDubProjectEditorWidget.updateEditor;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
var
|
||||||
|
str: string = '';
|
||||||
|
rcl: TTreeNode;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
if propTree.Selected.isNotNil then
|
||||||
|
str := propTree.Selected.GetTextPath;
|
||||||
|
|
||||||
propTree.Items.Clear;
|
propTree.Items.Clear;
|
||||||
edProp.Clear;
|
edProp.Clear;
|
||||||
if fProj.isNil or fProj.json.isNil then
|
if fProj.isNil or fProj.json.isNil then
|
||||||
|
@ -590,6 +604,15 @@ begin
|
||||||
|
|
||||||
propTree.BeginUpdate;
|
propTree.BeginUpdate;
|
||||||
addPropsFrom(propTree.Items.Add(nil, 'project'), fProj.json);
|
addPropsFrom(propTree.Items.Add(nil, 'project'), fProj.json);
|
||||||
|
if str.isNotEmpty then
|
||||||
|
begin
|
||||||
|
rcl := propTree.Items.FindNodeWithTextPath(str);
|
||||||
|
if rcl.isNotNil then
|
||||||
|
begin
|
||||||
|
rcl.Selected := true;
|
||||||
|
rcl.MakeVisible;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
propTree.EndUpdate;
|
propTree.EndUpdate;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
Loading…
Reference in New Issue