mirror of https://gitlab.com/basile.b/dexed.git
dev option editor - 1
This commit is contained in:
parent
2130807c62
commit
7b3dc52906
|
@ -140,7 +140,7 @@
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item6>
|
</Item6>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="33">
|
<Units Count="34">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="coedit.lpr"/>
|
<Filename Value="coedit.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
@ -348,6 +348,14 @@
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ce_inspectors"/>
|
<UnitName Value="ce_inspectors"/>
|
||||||
</Unit32>
|
</Unit32>
|
||||||
|
<Unit33>
|
||||||
|
<Filename Value="..\src\ce_optionseditor.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="CEOptionEditorWidget"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="ce_optionseditor"/>
|
||||||
|
</Unit33>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
|
|
@ -11,7 +11,8 @@ uses
|
||||||
ce_common, ce_dmdwrap, ce_project, ce_dcd, ce_plugin, ce_synmemo, ce_widget,
|
ce_common, ce_dmdwrap, ce_project, ce_dcd, ce_plugin, ce_synmemo, ce_widget,
|
||||||
ce_messages, ce_interfaces, ce_editor, ce_projinspect, ce_projconf, ce_search,
|
ce_messages, ce_interfaces, ce_editor, ce_projinspect, ce_projconf, ce_search,
|
||||||
ce_staticexplorer, ce_miniexplorer, ce_libman, ce_libmaneditor, ce_todolist,
|
ce_staticexplorer, ce_miniexplorer, ce_libman, ce_libmaneditor, ce_todolist,
|
||||||
ce_observer, ce_writableComponent, ce_toolseditor, ce_procinput, ce_cdbcmd;
|
ce_observer, ce_writableComponent, ce_toolseditor, ce_procinput, ce_optionseditor,
|
||||||
|
ce_cdbcmd;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -195,6 +196,7 @@ type
|
||||||
fTlsEdWidg: TCEToolsEditorWidget;
|
fTlsEdWidg: TCEToolsEditorWidget;
|
||||||
fPrInpWidg: TCEProcInputWidget;
|
fPrInpWidg: TCEProcInputWidget;
|
||||||
fTodolWidg: TCETodoListWidget;
|
fTodolWidg: TCETodoListWidget;
|
||||||
|
fOptEdWidg: TCEOptionEditorWidget;
|
||||||
//fResWidg: TCEResmanWidget;
|
//fResWidg: TCEResmanWidget;
|
||||||
{$IFDEF WIN32}
|
{$IFDEF WIN32}
|
||||||
fCdbWidg: TCECdbWidget;
|
fCdbWidg: TCECdbWidget;
|
||||||
|
@ -407,6 +409,7 @@ begin
|
||||||
fTlsEdWidg:= TCEToolsEditorWidget.create(self);
|
fTlsEdWidg:= TCEToolsEditorWidget.create(self);
|
||||||
fPrInpWidg:= TCEProcInputWidget.create(self);
|
fPrInpWidg:= TCEProcInputWidget.create(self);
|
||||||
fTodolWidg:= TCETodoListWidget.create(self);
|
fTodolWidg:= TCETodoListWidget.create(self);
|
||||||
|
fOptEdWidg:= TCEOptionEditorWidget.create(self);
|
||||||
//fResWidg := TCEResmanWidget.create(self);
|
//fResWidg := TCEResmanWidget.create(self);
|
||||||
|
|
||||||
getMessageDisplay(fMsgs);
|
getMessageDisplay(fMsgs);
|
||||||
|
@ -426,6 +429,7 @@ begin
|
||||||
fWidgList.addWidget(@fTlsEdWidg);
|
fWidgList.addWidget(@fTlsEdWidg);
|
||||||
fWidgList.addWidget(@fPrInpWidg);
|
fWidgList.addWidget(@fPrInpWidg);
|
||||||
fWidgList.addWidget(@fTodolWidg);
|
fWidgList.addWidget(@fTodolWidg);
|
||||||
|
fWidgList.addWidget(@fOptEdWidg);
|
||||||
//fWidgList.addWidget(@fResWidg);
|
//fWidgList.addWidget(@fResWidg);
|
||||||
|
|
||||||
{$IFDEF WIN32}
|
{$IFDEF WIN32}
|
||||||
|
|
|
@ -20,7 +20,16 @@ type
|
||||||
data: Pointer;
|
data: Pointer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCEMessagesWidget = class(TCEWidget, ICEMultiDocObserver, ICEProjectObserver, ICEMessagesDisplay)
|
TCEMessagesOptions = class(TPersistent)
|
||||||
|
private
|
||||||
|
fMaxCount: Integer;
|
||||||
|
fAutoSelect: boolean;
|
||||||
|
published
|
||||||
|
property maxMessageCount: integer read fMaxCount write fMaxCount;
|
||||||
|
property autoSelect: boolean read fAutoSelect write fAutoSelect;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TCEMessagesWidget = class(TCEWidget, ICEEditableOptions, ICEMultiDocObserver, ICEProjectObserver, ICEMessagesDisplay)
|
||||||
btnClearCat: TBitBtn;
|
btnClearCat: TBitBtn;
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
List: TTreeView;
|
List: TTreeView;
|
||||||
|
@ -49,6 +58,7 @@ type
|
||||||
fDoc: TCESynMemo;
|
fDoc: TCESynMemo;
|
||||||
fCtxt: TCEAppMessageCtxt;
|
fCtxt: TCEAppMessageCtxt;
|
||||||
fAutoSelect: boolean;
|
fAutoSelect: boolean;
|
||||||
|
fEditableOptions: TCEMessagesOptions;
|
||||||
fBtns: array[TCEAppMessageCtxt] of TToolButton;
|
fBtns: array[TCEAppMessageCtxt] of TToolButton;
|
||||||
procedure filterMessages(aCtxt: TCEAppMessageCtxt);
|
procedure filterMessages(aCtxt: TCEAppMessageCtxt);
|
||||||
procedure clearOutOfRangeMessg;
|
procedure clearOutOfRangeMessg;
|
||||||
|
@ -79,6 +89,11 @@ type
|
||||||
procedure docFocused(aDoc: TCESynMemo);
|
procedure docFocused(aDoc: TCESynMemo);
|
||||||
procedure docChanged(aDoc: TCESynMemo);
|
procedure docChanged(aDoc: TCESynMemo);
|
||||||
//
|
//
|
||||||
|
function optionedWantCategory(): string;
|
||||||
|
function optionedWantEditorKind: TOptionEditorKind;
|
||||||
|
function optionedWantContainer: TPersistent;
|
||||||
|
procedure optionedEvent(anEvent: TOptionEditorEvent);
|
||||||
|
//
|
||||||
function singleServiceName: string;
|
function singleServiceName: string;
|
||||||
procedure message(const aValue: string; aData: Pointer; aCtxt: TCEAppMessageCtxt; aKind: TCEAppMessageKind);
|
procedure message(const aValue: string; aData: Pointer; aCtxt: TCEAppMessageCtxt; aKind: TCEAppMessageKind);
|
||||||
procedure clearbyContext(aCtxt: TCEAppMessageCtxt);
|
procedure clearbyContext(aCtxt: TCEAppMessageCtxt);
|
||||||
|
@ -134,6 +149,7 @@ begin
|
||||||
//
|
//
|
||||||
inherited;
|
inherited;
|
||||||
//
|
//
|
||||||
|
fEditableOptions := TCEMessagesOptions.Create;
|
||||||
List.PopupMenu := contextMenu;
|
List.PopupMenu := contextMenu;
|
||||||
List.OnDeletion := @ListDeletion;
|
List.OnDeletion := @ListDeletion;
|
||||||
//
|
//
|
||||||
|
@ -157,6 +173,7 @@ end;
|
||||||
destructor TCEMessagesWidget.destroy;
|
destructor TCEMessagesWidget.destroy;
|
||||||
begin
|
begin
|
||||||
EntitiesConnector.removeObserver(self);
|
EntitiesConnector.removeObserver(self);
|
||||||
|
fEditableOptions.Free;
|
||||||
Inherited;
|
Inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -209,6 +226,34 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEEditableOptions ----------------------------------------------------}
|
||||||
|
function TCEMessagesWidget.optionedWantCategory(): string;
|
||||||
|
begin
|
||||||
|
exit('Messages');
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEMessagesWidget.optionedWantEditorKind: TOptionEditorKind;
|
||||||
|
begin
|
||||||
|
exit(oekAbstract);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEMessagesWidget.optionedWantContainer: TPersistent;
|
||||||
|
begin
|
||||||
|
fEditableOptions.maxMessageCount:= fMaxMessCnt;
|
||||||
|
fEditableOptions.autoSelect:= fActAutoSel.Checked;
|
||||||
|
exit(fEditableOptions);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.optionedEvent(anEvent: TOptionEditorEvent);
|
||||||
|
begin
|
||||||
|
if anEvent = oeeAccept then
|
||||||
|
begin
|
||||||
|
fMaxMessCnt := fEditableOptions.maxMessageCount;
|
||||||
|
fActAutoSel.Checked := fEditableOptions.autoSelect;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION ICESessionOptionsObserver ---------------------------------------------}
|
{$REGION ICESessionOptionsObserver ---------------------------------------------}
|
||||||
procedure TCEMessagesWidget.setMaxMessageCount(aValue: Integer);
|
procedure TCEMessagesWidget.setMaxMessageCount(aValue: Integer);
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
inherited CEOptionEditorWidget: TCEOptionEditorWidget
|
||||||
|
Left = 626
|
||||||
|
Height = 377
|
||||||
|
Top = 270
|
||||||
|
Width = 548
|
||||||
|
Caption = 'Options editor'
|
||||||
|
ClientHeight = 377
|
||||||
|
ClientWidth = 548
|
||||||
|
inherited Back: TPanel
|
||||||
|
Height = 377
|
||||||
|
Width = 548
|
||||||
|
ClientHeight = 377
|
||||||
|
ClientWidth = 548
|
||||||
|
inherited Content: TPanel
|
||||||
|
Height = 377
|
||||||
|
Width = 548
|
||||||
|
ClientHeight = 377
|
||||||
|
ClientWidth = 548
|
||||||
|
object pnlBody: TPanel[0]
|
||||||
|
Left = 4
|
||||||
|
Height = 335
|
||||||
|
Top = 4
|
||||||
|
Width = 540
|
||||||
|
Align = alClient
|
||||||
|
BorderSpacing.Around = 4
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 335
|
||||||
|
ClientWidth = 540
|
||||||
|
TabOrder = 0
|
||||||
|
object selCat: TTreeView
|
||||||
|
Left = 0
|
||||||
|
Height = 335
|
||||||
|
Top = 0
|
||||||
|
Width = 193
|
||||||
|
Align = alLeft
|
||||||
|
DefaultItemHeight = 18
|
||||||
|
ScrollBars = ssAutoBoth
|
||||||
|
TabOrder = 0
|
||||||
|
OnDeletion = selCatDeletion
|
||||||
|
OnSelectionChanged = selCatSelectionChanged
|
||||||
|
end
|
||||||
|
object pnlEd: TPanel
|
||||||
|
Left = 199
|
||||||
|
Height = 335
|
||||||
|
Top = 0
|
||||||
|
Width = 341
|
||||||
|
Align = alClient
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 335
|
||||||
|
ClientWidth = 341
|
||||||
|
TabOrder = 1
|
||||||
|
object inspector: TTIPropertyGrid
|
||||||
|
Left = 0
|
||||||
|
Height = 335
|
||||||
|
Top = 0
|
||||||
|
Width = 341
|
||||||
|
Align = alClient
|
||||||
|
DefaultValueFont.Color = clWindowText
|
||||||
|
Filter = [tkInteger, tkChar, tkEnumeration, tkFloat, tkSet, tkMethod, tkSString, tkLString, tkAString, tkWString, tkVariant, tkArray, tkRecord, tkInterface, tkClass, tkObject, tkWChar, tkBool, tkInt64, tkQWord, tkDynArray, tkInterfaceRaw, tkProcVar, tkUString, tkUChar, tkHelper]
|
||||||
|
Indent = 16
|
||||||
|
NameFont.Color = clWindowText
|
||||||
|
OnModified = inspectorModified
|
||||||
|
ValueFont.Color = clMaroon
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Splitter1: TSplitter
|
||||||
|
Left = 193
|
||||||
|
Height = 335
|
||||||
|
Top = 0
|
||||||
|
Width = 6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object pnlFooter: TPanel[1]
|
||||||
|
Left = 4
|
||||||
|
Height = 30
|
||||||
|
Top = 343
|
||||||
|
Width = 540
|
||||||
|
Align = alBottom
|
||||||
|
BorderSpacing.Around = 4
|
||||||
|
BevelOuter = bvLowered
|
||||||
|
ClientHeight = 30
|
||||||
|
ClientWidth = 540
|
||||||
|
TabOrder = 1
|
||||||
|
object btnCancel: TSpeedButton
|
||||||
|
Left = 333
|
||||||
|
Height = 24
|
||||||
|
Top = 3
|
||||||
|
Width = 100
|
||||||
|
Align = alRight
|
||||||
|
BorderSpacing.Left = 2
|
||||||
|
BorderSpacing.Around = 2
|
||||||
|
OnClick = btnCancelClick
|
||||||
|
end
|
||||||
|
object btnAccept: TSpeedButton
|
||||||
|
Left = 437
|
||||||
|
Height = 24
|
||||||
|
Top = 3
|
||||||
|
Width = 100
|
||||||
|
Align = alRight
|
||||||
|
BorderSpacing.Left = 2
|
||||||
|
BorderSpacing.Around = 2
|
||||||
|
OnClick = btnAcceptClick
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
inherited contextMenu: TPopupMenu
|
||||||
|
left = 144
|
||||||
|
top = 24
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,167 @@
|
||||||
|
unit ce_optionseditor;
|
||||||
|
|
||||||
|
{$I ce_defines.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, ExtCtrls,
|
||||||
|
Menus, ComCtrls, StdCtrls, Buttons, ce_common, ce_widget, ce_interfaces,
|
||||||
|
ce_observer;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
PCategoryData = ^TCategoryData;
|
||||||
|
TCategoryData = record
|
||||||
|
kind: TOptionEditorKind;
|
||||||
|
container: TPersistent;
|
||||||
|
observer: ICEEditableOptions;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TCEOptionEditorWidget = class(TCEWidget)
|
||||||
|
btnCancel: TSpeedButton;
|
||||||
|
btnAccept: TSpeedButton;
|
||||||
|
pnlEd: TPanel;
|
||||||
|
pnlBody: TPanel;
|
||||||
|
pnlFooter: TPanel;
|
||||||
|
Splitter1: TSplitter;
|
||||||
|
inspector: TTIPropertyGrid;
|
||||||
|
selCat: TTreeView;
|
||||||
|
procedure btnAcceptClick(Sender: TObject);
|
||||||
|
procedure btnCancelClick(Sender: TObject);
|
||||||
|
procedure inspectorModified(Sender: TObject);
|
||||||
|
procedure selCatDeletion(Sender: TObject; Node: TTreeNode);
|
||||||
|
procedure selCatSelectionChanged(Sender: TObject);
|
||||||
|
protected
|
||||||
|
procedure UpdateShowing; override;
|
||||||
|
private
|
||||||
|
fEdOptsSubj: TCEEditableOptionsSubject;
|
||||||
|
procedure updateCategories;
|
||||||
|
public
|
||||||
|
constructor create(aOwner: TComponent); override;
|
||||||
|
destructor destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{$REGION Standard Comp/Obj------------------------------------------------------}
|
||||||
|
constructor TCEOptionEditorWidget.create(aOwner: TComponent);
|
||||||
|
var
|
||||||
|
png: TPortableNetworkGraphic;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
fEdOptsSubj := TCEEditableOptionsSubject.create;
|
||||||
|
//
|
||||||
|
png := TPortableNetworkGraphic.Create;
|
||||||
|
try
|
||||||
|
png.LoadFromLazarusResource('cancel');
|
||||||
|
btnCancel.Glyph.Assign(png);
|
||||||
|
png.LoadFromLazarusResource('accept');
|
||||||
|
btnAccept.Glyph.Assign(png);
|
||||||
|
finally
|
||||||
|
png.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TCEOptionEditorWidget.destroy;
|
||||||
|
begin
|
||||||
|
fEdOptsSubj.Free;
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEOptionEditorWidget.UpdateShowing;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if Visible then updateCategories;
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION Option editor things --------------------------------------------------}
|
||||||
|
procedure TCEOptionEditorWidget.updateCategories;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
dt: PCategoryData;
|
||||||
|
ed: ICEEditableOptions;
|
||||||
|
begin
|
||||||
|
inspector.TIObject := nil;
|
||||||
|
selCat.Items.Clear;
|
||||||
|
for i:= 0 to fEdOptsSubj.observersCount-1 do
|
||||||
|
begin
|
||||||
|
dt := new(PCategoryData);
|
||||||
|
ed := fEdOptsSubj.observers[i] as ICEEditableOptions;
|
||||||
|
selCat.Items.AddObject(nil, ed.optionedWantCategory, dt);
|
||||||
|
dt^.container := ed.optionedWantContainer;
|
||||||
|
dt^.kind := ed.optionedWantEditorKind;
|
||||||
|
dt^.observer := ed;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEOptionEditorWidget.selCatDeletion(Sender: TObject; Node: TTreeNode);
|
||||||
|
begin
|
||||||
|
if node.Data <> nil then
|
||||||
|
Dispose(PCategoryData(node.Data));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEOptionEditorWidget.selCatSelectionChanged(Sender: TObject);
|
||||||
|
var
|
||||||
|
dt: PCategoryData;
|
||||||
|
begin
|
||||||
|
inspector.TIObject := nil;
|
||||||
|
if pnlEd.ControlCount > 0 then
|
||||||
|
pnlEd.Controls[0].Parent := nil;
|
||||||
|
if selCat.Selected = nil then exit;
|
||||||
|
if selCat.Selected.Data = nil then exit;
|
||||||
|
//
|
||||||
|
dt := PCategoryData(selCat.Selected.Data);
|
||||||
|
if dt^.container = nil then exit;
|
||||||
|
case dt^.kind of
|
||||||
|
oekForm:
|
||||||
|
begin
|
||||||
|
TForm(dt^.container).Parent := pnlEd;
|
||||||
|
TForm(dt^.container).Align := alClient;
|
||||||
|
TForm(dt^.container).BorderStyle:= bsNone;
|
||||||
|
end;
|
||||||
|
oekAbstract:
|
||||||
|
begin
|
||||||
|
inspector.Parent := pnlEd;
|
||||||
|
inspector.Align := alClient;
|
||||||
|
inspector.TIObject := dt^.container;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEOptionEditorWidget.inspectorModified(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if selCat.Selected = nil then exit;
|
||||||
|
if selcat.Selected.Data = nil then exit;
|
||||||
|
//
|
||||||
|
PCategoryData(selCat.Selected.Data)^
|
||||||
|
.observer
|
||||||
|
.optionedEvent(oeeChange);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEOptionEditorWidget.btnCancelClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if selCat.Selected = nil then exit;
|
||||||
|
if selcat.Selected.Data = nil then exit;
|
||||||
|
//
|
||||||
|
PCategoryData(selCat.Selected.Data)^
|
||||||
|
.observer
|
||||||
|
.optionedEvent(oeeCancel);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEOptionEditorWidget.btnAcceptClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if selCat.Selected = nil then exit;
|
||||||
|
if selcat.Selected.Data = nil then exit;
|
||||||
|
//
|
||||||
|
PCategoryData(selCat.Selected.Data)^
|
||||||
|
.observer
|
||||||
|
.optionedEvent(oeeAccept);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue