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