mirror of https://gitlab.com/basile.b/dexed.git
Merge branch 'a12_2_a13'
This commit is contained in:
commit
a031c30a05
Binary file not shown.
After Width: | Height: | Size: 781 B |
Binary file not shown.
After Width: | Height: | Size: 713 B |
|
@ -140,7 +140,7 @@
|
|||
<PackageName Value="LCL"/>
|
||||
</Item6>
|
||||
</RequiredPackages>
|
||||
<Units Count="33">
|
||||
<Units Count="34">
|
||||
<Unit0>
|
||||
<Filename Value="coedit.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
|
@ -348,6 +348,14 @@
|
|||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ce_inspectors"/>
|
||||
</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>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
|
|
@ -1018,6 +1018,39 @@ LazarusResources.Add('folder_star','PNG',[
|
|||
+#250'U'''#200'ur'#141#220'o'#253'V'#228#131#127#4#24#0'E'''#18'h'#153#158#23
|
||||
+#220#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('accept','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
|
||||
+#0#0#0#4'gAMA'#0#0#175#200'7'#5#138#233#0#0#0#25'tEXtSoftware'#0'Adobe Image'
|
||||
+'Readyq'#201'e<'#0#0#2#159'IDAT8'#203#165#147#235'KSa'#28#199#253';v'#206'vl'
|
||||
+#3#9'dD!'#130#132'P{'#21'$'#18';'#154#13#197#188',K'#211#221#189#210'6c'#216
|
||||
+'L'#139'2r^'#198'H)-'#179#212'jsNm'#234#212#230#214#148'2q'#217'QB'#204#189
|
||||
+#233'B'#181'at'#177'o'#231#236#197'L'#18'#z'#224#11#15#15#207#231#243'{'#174
|
||||
+'q'#0#226#254''''#127#12#20#248#14#137'r'#167#15#234#179'=)L'#198#227#253'a'
|
||||
+#233#136'8,u%2Rg'#162'>'#221#190'W'#180#171' '#207#155'J'#203'<'#201'!'#157
|
||||
+'G'#134#155'A'#11#250#150#187#162#233'\lF'#137#235#24'$'#189'TH'#210'C'#209
|
||||
+';'#10#216#170't'#230'xR'#228#234#156#17#206#213'~'#216'^^'#131'i'#174'2'#26
|
||||
+#174#239'X'#237'C'#227'L'#21#14#216#248#145'd'#27#159#222'&'#200#241#164#8'3'
|
||||
+#221'I'#235#28#204'M'#172#9#148#161#194'_'#2#205#204#25#232#216#148#179#169
|
||||
+#246#157#133#253#245'=\'#156#170#128#216'B'#174#139#175#147#194#152'@'#230'N'
|
||||
+'2'#168#198#178#162#149'9'#152#3'U'#222'SPL'#23'B1U'#0#245'T!'#220'k'#131'0x'
|
||||
+#149'p'#176#146#220#158'#H'#184'B'#26'b'#130#140#17'1'#211#25'l'#134'5'#216
|
||||
+#132#10'_1'#148'O'#228','#152#15#229'$'#27'O>'#198#223#184#192#181'Pd'#13'm'
|
||||
+#207#27'a'#155'kD|='#201#196#4'G'#237#9#27#15'Vn'#163'6'#160#129#214'['#196
|
||||
+#174'd'#0#139#31#230#161#154'('#196#216#218'P'#20#254#177#249#29'm'#207'.'
|
||||
+#193'0Q'#140#190'`'''#4'Fb#&'#144#220#167'6'#250#151#187'a'#244#171'P'#235
|
||||
+#215#226#211#215#143'Q'#232#253#151#183'1'#216'2['#15#181'+'#27'z'#247'i'#244
|
||||
+#7'; '#168#249']'#208'C17'#230#155#208#190'p'#25#186'I9'#204#190'jD'#190'}'
|
||||
+#142#194#155'?7ayz'#1'e'#206',hXAK'#160#14#237'^3'#168'*bk'#11#169#183#4#6
|
||||
+#249'@'#26#236'+wQ=!'#135#218'}'#18'u'#211#229'Xz'#183#128#182#217#6#148#14
|
||||
+#30#135#194'q'#2':g'#14#236#175#186#145'n='#12#170#146#216':'#196'd+_'#184
|
||||
+#143#189#26#179'G'#131#135#204#29'T'#142#230'A;'#156#3#213#144#12'J'#7#23#14
|
||||
+#206#198#163#165'.'#24#135#138'!P'#243#214')5!'#220#246#144#18#155'H:'#190
|
||||
+#129#136#152#220'ep'#176#146#214#128#25#250#209'"'#156#27#150#163#149#221#130
|
||||
+#157#133#245#206'"'#240'Ky'#17#22#166'w|'#202'{'#26'H'#154'2'#17'!i'#135#4
|
||||
+#237'~3z_X'#209';o'#133#197'kBZK*'#4#10'^'#136'R'#17#244#174#159#137':O'#138
|
||||
+'('#3#161#167'j'#8'F'#160#229#133#5'*^'#152#173#200#176#209'S'#165#132#232
|
||||
+#175#191#241'_'#243#11'g'#208#172#229'y'#186#212'c'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('bricks','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
|
||||
+#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#3'aIDATx'#218'|'#147
|
||||
|
@ -1059,6 +1092,36 @@ LazarusResources.Add('bricks','PNG',[
|
|||
+#132#127#167#247'?g'#149'S'#148#213'P'#6'P'#11#128'Y'#213#5#254#167#254#20'`'
|
||||
+#0'D,pH'#240#197#231#211#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('cancel','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
|
||||
+#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#2'kIDATx'#218#140'S'
|
||||
+'Kh'#19'a'#16#254'v'#147#168'4'#143#146#135'6'#165#180#165'Z'#144#6#244#224
|
||||
+#235#146#139'(-'#245'u'#16'E0''A'#176#164#4'-HJA'#188#9'B'#11#18#31#152#171
|
||||
+'''o'#162#130#143#152#168#8#162'h'#181'P'#209'J'#197'j'#169'5&&'#217#13#201
|
||||
+#230#189#187'Y'#255#255#183#137#171#233#193#129'og'#153#249#230#219#153'e'
|
||||
+#134#211'4'#13'z'#139#186#173#14#226'N'#17#236'"'#216'N` '#152'YAx()'#165#245
|
||||
+'|N/'#16'q[/'#154',m'#19#157'{'#188#176'm'#234#133#165#175#7#28#207'AZ\F'#129
|
||||
+' '#254#248'9'#228'|aj8)'#141#183#8'<p['#175':'#182#14#4'<#>p'#226#18#234#185
|
||||
+'4'#234#249#12#203#241'V''x'#155#11'X'#223#135#249#27#183#144#158#158#13#239
|
||||
+'OJ'#163'4g'#164#143'{'#29#182#11#174'm['#2#30#223#16'j'#175#238' z'#243'#'#6
|
||||
+#143#245#255#233'S'#202'#'#22#138'a'#240#248#0'6'#31#217'M%'#253#164#166'p'
|
||||
+#240'g~'#156#191#219'a'#235#226#205'm'#231#250#15'yQ'#154'~'#132#183#31'L'
|
||||
+#240#197'S'#152#153'7C'#149'U'#6#250#206'bskPz'#19#197#198'};a'#180#183#7'Y'
|
||||
+#173#170#193#223#181#215#139#234#220'K(U'#25#195#15'c'#236#163#212#207'~'#177
|
||||
+'1'#232'cJME'#229#253#11'tzw'#128#214#242'*'#184#3#22#11' '#23#138'D@A*t'#166
|
||||
+#217'9-h'#20'S'#163'9'#202#145#139'eX'#237'F'#144#218#195#188#162#193#195#149
|
||||
+'2DYa'#200#191'~'#130#196'T'#0#255#26#141#209'\'#131#135'\'#2#164#182#159'vP'
|
||||
+'+'#167#210#144#169#242#10#222'='#253#212'"@czNE'#20'i'#7' '#2'X('#230#171'P'
|
||||
+'*2'#195'R'#185#251#175#182#245#227#208'\'#131'W'#206'U'#137#0#190#209#17#238
|
||||
+'g%4['#211#23#127'='#127#146'A/'#210#224'e%'#141#142#16#161'#'#132#147#137'"'
|
||||
+'je'#133#253#160#207#19''''#24#153'z'#225'Y'#132'A'#31'c?'#177#162#224#251
|
||||
+#143'"'#29'!'#204'61'#236#180'O'#218'm'#198'`'#239#6#3#254#199#150#211'*'#132
|
||||
+#156'r'#217'/d'#199#154#171'|'#205'i'#191'n7s'#254'n'#167#1'd'#253'W'#181':'
|
||||
+#161#198#197':'#132'B='#28#16#178#163'-'#199't'#197#233#152'4'#25#184#160#203
|
||||
+#172#161'}'#29#176#214#248';Nv'#7#185'2'#144')q'#168')'#218#165#211#130'xv'
|
||||
+#213'k'#164#22'r8z'#136#243#19#28'%h'#28#196'"'#193'mz'#206'c'#162#184#160
|
||||
+#231#255#18'`'#0#127'(`'#250#10#24#152'n'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('cut','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
|
||||
+#0#0#0#4'gAMA'#0#0#175#200'7'#5#138#233#0#0#0#25'tEXtSoftware'#0'Adobe Image'
|
||||
|
|
|
@ -141,6 +141,32 @@ type
|
|||
|
||||
|
||||
|
||||
TOptionEditorKind = (oekAbstract, oekForm);
|
||||
TOptionEditorEvent = (oeeCancel, oeeAccept, oeeChange);
|
||||
(**
|
||||
* An implementer can expose some options to be edited in a dedicated widget.
|
||||
*)
|
||||
ICEEditableOptions = interface
|
||||
['ICEEditableOptions']
|
||||
// the widget wants the category
|
||||
function optionedWantCategory(): string;
|
||||
// the widget wants to know if the options will use a generic editor or a custom form
|
||||
function optionedWantEditorKind: TOptionEditorKind;
|
||||
// the widget wants the custom option editor form or the TPersistent containing the options
|
||||
function optionedWantContainer: TPersistent;
|
||||
// the option editor informs that something has happened
|
||||
procedure optionedEvent(anEvent: TOptionEditorEvent);
|
||||
end;
|
||||
(**
|
||||
* An implementer displays its observers editable options.
|
||||
*)
|
||||
TCEEditableOptionsSubject = class(TCECustomSubject)
|
||||
protected
|
||||
function acceptObserver(aObject: TObject): boolean; override;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
/// describes the message kind, when Auto implies that a ICELogMessageObserver guess the kind.
|
||||
TCEAppMessageKind = (amkAuto, amkBub, amkInf, amkHint, amkWarn, amkErr);
|
||||
/// describes the message context. Used by a ICELogMessageObserver to filter the messages.
|
||||
|
@ -359,18 +385,21 @@ begin
|
|||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION TCEMainMenuSubject ----------------------------------------------------}
|
||||
{$REGION Misc subjects ---------------------------------------------------------}
|
||||
function TCEMainMenuSubject.acceptObserver(aObject: TObject): boolean;
|
||||
begin
|
||||
exit(aObject is ICEMainMenuProvider);
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION TCEEditableShortCutSubject --------------------------------------------}
|
||||
function TCEEditableShortCutSubject.acceptObserver(aObject: TObject): boolean;
|
||||
begin
|
||||
exit(aObject is ICEEditableShortCut);
|
||||
end;
|
||||
|
||||
function TCEEditableOptionsSubject.acceptObserver(aObject: TObject): boolean;
|
||||
begin
|
||||
exit(aObject is ICEEditableOptions);
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICESingleService assignators ------------------------------------------}
|
||||
|
|
|
@ -11,7 +11,8 @@ uses
|
|||
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_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
|
||||
|
||||
|
@ -195,6 +196,7 @@ type
|
|||
fTlsEdWidg: TCEToolsEditorWidget;
|
||||
fPrInpWidg: TCEProcInputWidget;
|
||||
fTodolWidg: TCETodoListWidget;
|
||||
fOptEdWidg: TCEOptionEditorWidget;
|
||||
//fResWidg: TCEResmanWidget;
|
||||
{$IFDEF WIN32}
|
||||
fCdbWidg: TCECdbWidget;
|
||||
|
@ -407,6 +409,7 @@ begin
|
|||
fTlsEdWidg:= TCEToolsEditorWidget.create(self);
|
||||
fPrInpWidg:= TCEProcInputWidget.create(self);
|
||||
fTodolWidg:= TCETodoListWidget.create(self);
|
||||
fOptEdWidg:= TCEOptionEditorWidget.create(self);
|
||||
//fResWidg := TCEResmanWidget.create(self);
|
||||
|
||||
getMessageDisplay(fMsgs);
|
||||
|
@ -426,6 +429,7 @@ begin
|
|||
fWidgList.addWidget(@fTlsEdWidg);
|
||||
fWidgList.addWidget(@fPrInpWidg);
|
||||
fWidgList.addWidget(@fTodolWidg);
|
||||
fWidgList.addWidget(@fOptEdWidg);
|
||||
//fWidgList.addWidget(@fResWidg);
|
||||
|
||||
{$IFDEF WIN32}
|
||||
|
|
|
@ -20,7 +20,16 @@ type
|
|||
data: Pointer;
|
||||
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;
|
||||
imgList: TImageList;
|
||||
List: TTreeView;
|
||||
|
@ -49,6 +58,7 @@ type
|
|||
fDoc: TCESynMemo;
|
||||
fCtxt: TCEAppMessageCtxt;
|
||||
fAutoSelect: boolean;
|
||||
fEditableOptions: TCEMessagesOptions;
|
||||
fBtns: array[TCEAppMessageCtxt] of TToolButton;
|
||||
procedure filterMessages(aCtxt: TCEAppMessageCtxt);
|
||||
procedure clearOutOfRangeMessg;
|
||||
|
@ -79,6 +89,11 @@ type
|
|||
procedure docFocused(aDoc: TCESynMemo);
|
||||
procedure docChanged(aDoc: TCESynMemo);
|
||||
//
|
||||
function optionedWantCategory(): string;
|
||||
function optionedWantEditorKind: TOptionEditorKind;
|
||||
function optionedWantContainer: TPersistent;
|
||||
procedure optionedEvent(anEvent: TOptionEditorEvent);
|
||||
//
|
||||
function singleServiceName: string;
|
||||
procedure message(const aValue: string; aData: Pointer; aCtxt: TCEAppMessageCtxt; aKind: TCEAppMessageKind);
|
||||
procedure clearbyContext(aCtxt: TCEAppMessageCtxt);
|
||||
|
@ -134,6 +149,7 @@ begin
|
|||
//
|
||||
inherited;
|
||||
//
|
||||
fEditableOptions := TCEMessagesOptions.Create;
|
||||
List.PopupMenu := contextMenu;
|
||||
List.OnDeletion := @ListDeletion;
|
||||
//
|
||||
|
@ -157,6 +173,7 @@ end;
|
|||
destructor TCEMessagesWidget.destroy;
|
||||
begin
|
||||
EntitiesConnector.removeObserver(self);
|
||||
fEditableOptions.Free;
|
||||
Inherited;
|
||||
end;
|
||||
|
||||
|
@ -209,6 +226,34 @@ begin
|
|||
end;
|
||||
{$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 ---------------------------------------------}
|
||||
procedure TCEMessagesWidget.setMaxMessageCount(aValue: Integer);
|
||||
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