mirror of https://gitlab.com/basile.b/dexed.git
parent
c667795cc3
commit
e6659329c9
|
@ -1,24 +1,24 @@
|
||||||
inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
||||||
Left = 816
|
Left = 1471
|
||||||
Height = 557
|
Height = 424
|
||||||
Top = 191
|
Top = 10
|
||||||
Width = 411
|
Width = 411
|
||||||
Caption = 'Dub project editor'
|
Caption = 'Dub project editor'
|
||||||
ClientHeight = 557
|
ClientHeight = 424
|
||||||
ClientWidth = 411
|
ClientWidth = 411
|
||||||
inherited Back: TPanel
|
inherited Back: TPanel
|
||||||
Height = 557
|
Height = 424
|
||||||
Width = 411
|
Width = 411
|
||||||
ClientHeight = 557
|
ClientHeight = 424
|
||||||
ClientWidth = 411
|
ClientWidth = 411
|
||||||
inherited Content: TPanel
|
inherited Content: TPanel
|
||||||
Height = 557
|
Height = 424
|
||||||
Width = 411
|
Width = 411
|
||||||
ClientHeight = 557
|
ClientHeight = 424
|
||||||
ClientWidth = 411
|
ClientWidth = 411
|
||||||
object PageControl1: TPageControl[0]
|
object PageControl1: TPageControl[0]
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 549
|
Height = 416
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 403
|
Width = 403
|
||||||
ActivePage = TabSheet2
|
ActivePage = TabSheet2
|
||||||
|
@ -28,7 +28,7 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object TabSheet1: TTabSheet
|
object TabSheet1: TTabSheet
|
||||||
Caption = 'Inspector'
|
Caption = 'Inspector'
|
||||||
ClientHeight = 521
|
ClientHeight = 389
|
||||||
ClientWidth = 395
|
ClientWidth = 395
|
||||||
object pnlToolBar1: TPanel
|
object pnlToolBar1: TPanel
|
||||||
Left = 4
|
Left = 4
|
||||||
|
@ -43,31 +43,11 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
||||||
ClientHeight = 26
|
ClientHeight = 26
|
||||||
ClientWidth = 387
|
ClientWidth = 387
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object btnAddProp1: TSpeedButton
|
|
||||||
Left = 0
|
|
||||||
Height = 26
|
|
||||||
Hint = 'add an empty configuration'
|
|
||||||
Top = 0
|
|
||||||
Width = 28
|
|
||||||
Align = alLeft
|
|
||||||
Layout = blGlyphBottom
|
|
||||||
ShowCaption = False
|
|
||||||
end
|
|
||||||
object btnDelProp1: TSpeedButton
|
|
||||||
Left = 28
|
|
||||||
Height = 26
|
|
||||||
Hint = 'remove selected configuration'
|
|
||||||
Top = 0
|
|
||||||
Width = 28
|
|
||||||
Align = alLeft
|
|
||||||
Layout = blGlyphBottom
|
|
||||||
ShowCaption = False
|
|
||||||
end
|
|
||||||
object fltInspect: TTreeFilterEdit
|
object fltInspect: TTreeFilterEdit
|
||||||
Left = 58
|
Left = 2
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 327
|
Width = 383
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
NumGlyphs = 1
|
NumGlyphs = 1
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -79,7 +59,7 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
||||||
end
|
end
|
||||||
object treeInspect: TTreeView
|
object treeInspect: TTreeView
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 485
|
Height = 353
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 387
|
Width = 387
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -101,21 +81,11 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
||||||
end
|
end
|
||||||
object TabSheet2: TTabSheet
|
object TabSheet2: TTabSheet
|
||||||
Caption = 'Editor'
|
Caption = 'Editor'
|
||||||
ClientHeight = 521
|
ClientHeight = 388
|
||||||
ClientWidth = 395
|
ClientWidth = 395
|
||||||
object edValue: TMemo
|
|
||||||
Left = 4
|
|
||||||
Height = 93
|
|
||||||
Top = 424
|
|
||||||
Width = 387
|
|
||||||
Align = alBottom
|
|
||||||
BorderSpacing.Around = 4
|
|
||||||
ScrollBars = ssAutoVertical
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object propTree: TTreeView
|
object propTree: TTreeView
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 388
|
Height = 324
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 387
|
Width = 387
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -125,7 +95,7 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
||||||
Images = imgList
|
Images = imgList
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
ScrollBars = ssAutoBoth
|
ScrollBars = ssAutoBoth
|
||||||
TabOrder = 1
|
TabOrder = 0
|
||||||
OnSelectionChanged = propTreeSelectionChanged
|
OnSelectionChanged = propTreeSelectionChanged
|
||||||
Options = [tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
Options = [tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||||
end
|
end
|
||||||
|
@ -141,21 +111,11 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 26
|
ClientHeight = 26
|
||||||
ClientWidth = 387
|
ClientWidth = 387
|
||||||
TabOrder = 2
|
TabOrder = 1
|
||||||
object btnAddProp: TSpeedButton
|
object btnAddProp: TSpeedButton
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 26
|
Height = 26
|
||||||
Hint = 'add an empty configuration'
|
Hint = 'add property'
|
||||||
Top = 0
|
|
||||||
Width = 28
|
|
||||||
Align = alLeft
|
|
||||||
Layout = blGlyphBottom
|
|
||||||
ShowCaption = False
|
|
||||||
end
|
|
||||||
object btnDelProp: TSpeedButton
|
|
||||||
Left = 28
|
|
||||||
Height = 26
|
|
||||||
Hint = 'remove selected configuration'
|
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 28
|
Width = 28
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
|
@ -175,6 +135,48 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
FilteredTreeview = propTree
|
FilteredTreeview = propTree
|
||||||
end
|
end
|
||||||
|
object btnDelProp: TSpeedButton
|
||||||
|
Left = 28
|
||||||
|
Height = 26
|
||||||
|
Hint = 'delete selected property'
|
||||||
|
Top = 0
|
||||||
|
Width = 28
|
||||||
|
Align = alLeft
|
||||||
|
Layout = blGlyphBottom
|
||||||
|
ShowCaption = False
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 2
|
||||||
|
Height = 26
|
||||||
|
Top = 360
|
||||||
|
Width = 391
|
||||||
|
Align = alBottom
|
||||||
|
BorderSpacing.Around = 2
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 26
|
||||||
|
ClientWidth = 391
|
||||||
|
TabOrder = 2
|
||||||
|
object edProp: TEdit
|
||||||
|
Left = 2
|
||||||
|
Height = 22
|
||||||
|
Top = 2
|
||||||
|
Width = 359
|
||||||
|
Align = alClient
|
||||||
|
BorderSpacing.Around = 2
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object btnAcceptProp: TSpeedButton
|
||||||
|
Left = 363
|
||||||
|
Height = 26
|
||||||
|
Hint = 'accept property value'
|
||||||
|
Top = 0
|
||||||
|
Width = 28
|
||||||
|
Align = alRight
|
||||||
|
Layout = blGlyphBottom
|
||||||
|
OnClick = btnAcceptPropClick
|
||||||
|
ShowCaption = False
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,21 +7,21 @@ interface
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, Controls, Graphics,
|
Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, Controls, Graphics,
|
||||||
Dialogs, ExtCtrls, Menus, StdCtrls, Buttons, ComCtrls, jsonparser, fpjson,
|
Dialogs, ExtCtrls, Menus, StdCtrls, Buttons, ComCtrls, jsonparser, fpjson,
|
||||||
ce_widget, ce_common, ce_interfaces, ce_observer, ce_dubproject;
|
ce_widget, ce_common, ce_interfaces, ce_observer, ce_dubproject, ce_sharedres;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCEDubProjectEditorWidget }
|
{ TCEDubProjectEditorWidget }
|
||||||
|
|
||||||
TCEDubProjectEditorWidget = class(TCEWidget, ICEProjectObserver)
|
TCEDubProjectEditorWidget = class(TCEWidget, ICEProjectObserver)
|
||||||
|
btnAcceptProp: TSpeedButton;
|
||||||
btnAddProp: TSpeedButton;
|
btnAddProp: TSpeedButton;
|
||||||
btnAddProp1: TSpeedButton;
|
|
||||||
btnDelProp: TSpeedButton;
|
btnDelProp: TSpeedButton;
|
||||||
btnDelProp1: TSpeedButton;
|
edProp: TEdit;
|
||||||
edValue: TMemo;
|
|
||||||
fltEdit: TTreeFilterEdit;
|
fltEdit: TTreeFilterEdit;
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
PageControl1: TPageControl;
|
PageControl1: TPageControl;
|
||||||
|
Panel1: TPanel;
|
||||||
pnlToolBar: TPanel;
|
pnlToolBar: TPanel;
|
||||||
pnlToolBar1: TPanel;
|
pnlToolBar1: TPanel;
|
||||||
propTree: TTreeView;
|
propTree: TTreeView;
|
||||||
|
@ -29,6 +29,7 @@ type
|
||||||
treeInspect: TTreeView;
|
treeInspect: TTreeView;
|
||||||
TabSheet1: TTabSheet;
|
TabSheet1: TTabSheet;
|
||||||
TabSheet2: TTabSheet;
|
TabSheet2: TTabSheet;
|
||||||
|
procedure btnAcceptPropClick(Sender: TObject);
|
||||||
procedure propTreeSelectionChanged(Sender: TObject);
|
procedure propTreeSelectionChanged(Sender: TObject);
|
||||||
procedure treeInspectDblClick(Sender: TObject);
|
procedure treeInspectDblClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
@ -62,6 +63,10 @@ begin
|
||||||
inherited;
|
inherited;
|
||||||
fNodeSources := treeInspect.Items[0];
|
fNodeSources := treeInspect.Items[0];
|
||||||
fNodeConfig := treeInspect.Items[1];
|
fNodeConfig := treeInspect.Items[1];
|
||||||
|
//
|
||||||
|
AssignPng(btnAddProp, 'textfield_add');
|
||||||
|
AssignPng(btnDelProp, 'textfield_delete');
|
||||||
|
AssignPng(btnAcceptProp, 'accept');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEDubProjectEditorWidget.SetVisible(Value: boolean);
|
procedure TCEDubProjectEditorWidget.SetVisible(Value: boolean);
|
||||||
|
@ -141,6 +146,13 @@ begin
|
||||||
updateValueEditor;
|
updateValueEditor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEDubProjectEditorWidget.btnAcceptPropClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if fSelectedNode = nil then exit;
|
||||||
|
//
|
||||||
|
setJsonValueFromEditor;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEDubProjectEditorWidget.setJsonValueFromEditor;
|
procedure TCEDubProjectEditorWidget.setJsonValueFromEditor;
|
||||||
var
|
var
|
||||||
dat: TJSONData;
|
dat: TJSONData;
|
||||||
|
@ -151,34 +163,37 @@ var
|
||||||
begin
|
begin
|
||||||
if fSelectedNode = nil then exit;
|
if fSelectedNode = nil then exit;
|
||||||
if fSelectedNode.Data = nil then exit;
|
if fSelectedNode.Data = nil then exit;
|
||||||
|
if fProj = nil then exit;
|
||||||
//
|
//
|
||||||
|
fProj.beginModification;
|
||||||
dat := TJSONData(fSelectedNode.Data);
|
dat := TJSONData(fSelectedNode.Data);
|
||||||
case dat.JSONType of
|
case dat.JSONType of
|
||||||
jtNumber:
|
jtNumber:
|
||||||
case TJSONNumber(dat).NumberType of
|
case TJSONNumber(dat).NumberType of
|
||||||
ntFloat:
|
ntFloat:
|
||||||
if TryStrToFloat(edValue.Text, vFloat) then
|
if TryStrToFloat(edProp.Text, vFloat) then
|
||||||
dat.AsFloat := vFloat;
|
dat.AsFloat := vFloat;
|
||||||
ntInt64:
|
ntInt64:
|
||||||
if TryStrToInt64(edValue.Text, vInt64) then
|
if TryStrToInt64(edProp.Text, vInt64) then
|
||||||
dat.AsInt64 := vInt64;
|
dat.AsInt64 := vInt64;
|
||||||
ntInteger:
|
ntInteger:
|
||||||
if TryStrToInt(edValue.Text, vInt) then
|
if TryStrToInt(edProp.Text, vInt) then
|
||||||
dat.AsInteger := vInt;
|
dat.AsInteger := vInt;
|
||||||
end;
|
end;
|
||||||
jtBoolean:
|
jtBoolean:
|
||||||
if TryStrToBool(edValue.Text, vBool) then
|
if TryStrToBool(edProp.Text, vBool) then
|
||||||
dat.AsBoolean := vBool;
|
dat.AsBoolean := vBool;
|
||||||
jtString:
|
jtString:
|
||||||
dat.AsString := edValue.Text;
|
dat.AsString := edProp.Text;
|
||||||
end;
|
end;
|
||||||
|
fProj.endModification;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEDubProjectEditorWidget.updateValueEditor;
|
procedure TCEDubProjectEditorWidget.updateValueEditor;
|
||||||
var
|
var
|
||||||
dat: TJSONData;
|
dat: TJSONData;
|
||||||
begin
|
begin
|
||||||
edValue.Clear;
|
edProp.Clear;
|
||||||
if fSelectedNode = nil then exit;
|
if fSelectedNode = nil then exit;
|
||||||
if fSelectedNode.Data = nil then exit;
|
if fSelectedNode.Data = nil then exit;
|
||||||
//
|
//
|
||||||
|
@ -187,16 +202,16 @@ begin
|
||||||
jtNumber:
|
jtNumber:
|
||||||
case TJSONNumber(dat).NumberType of
|
case TJSONNumber(dat).NumberType of
|
||||||
ntFloat:
|
ntFloat:
|
||||||
edValue.Text := FloatToStr(dat.AsFloat);
|
edProp.Text := FloatToStr(dat.AsFloat);
|
||||||
ntInt64:
|
ntInt64:
|
||||||
edValue.Text := IntToStr(dat.AsInt64);
|
edProp.Text := IntToStr(dat.AsInt64);
|
||||||
ntInteger:
|
ntInteger:
|
||||||
edValue.Text := IntToStr(dat.AsInteger);
|
edProp.Text := IntToStr(dat.AsInteger);
|
||||||
end;
|
end;
|
||||||
jtBoolean:
|
jtBoolean:
|
||||||
edValue.Text := BoolToStr(dat.AsBoolean);
|
edProp.Text := BoolToStr(dat.AsBoolean);
|
||||||
jtString:
|
jtString:
|
||||||
edValue.Text := dat.AsString;
|
edProp.Text := dat.AsString;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -244,7 +259,7 @@ procedure TCEDubProjectEditorWidget.updateEditor;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
propTree.Items.Clear;
|
propTree.Items.Clear;
|
||||||
edValue.Clear;
|
edProp.Clear;
|
||||||
if (fProj = nil) or (fProj.json = nil) then
|
if (fProj = nil) or (fProj.json = nil) then
|
||||||
exit;
|
exit;
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue