From ea8505352b0e9a84200167fddca183d3e5703a29 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 18 Feb 2015 13:57:03 +0100 Subject: [PATCH 1/4] updated icons --- icons/other/accept.png | Bin 0 -> 781 bytes icons/other/cancel.png | Bin 0 -> 713 bytes src/ce_icons.inc | 63 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 icons/other/accept.png create mode 100644 icons/other/cancel.png diff --git a/icons/other/accept.png b/icons/other/accept.png new file mode 100644 index 0000000000000000000000000000000000000000..89c8129a490b329f3165f32fa0781701aab417ea GIT binary patch literal 781 zcmV+o1M>WdP)4-QibtN)VXQDpczE`xXAkUjh%RI>;okxb7K@0kpyQ1k_Y(|Oe7$m(^ zNYX>mI||sUbmn+c3<&FnE=4u#()KBS^SH8e)Qs5i!#lY=$-1gbH6VluzU=m=EP78&5vQ z-?+fFP-G2l&l_QzYealK$;1Rl?FkzXR&Jv@fBPNjCr#AYRyJ7UJQ0v#?)7Ott=>3`#-pV!7>9}>Q1jL)H6h&gkP@3nI=+F3nA~M>u#(n* z8T!#8oEw&-mED4!h4s!N@Jo3S7N&Q6%6l3}nlcd~X@>;uelvPsSkXIgg~e+^T1zSf z3SNj(5%jK~i8@b;C zw53{*2K3q+MFegEzPgS^xjHiL2?sfp2G-`R3c1Wrou<4SI{Ztq$T&5$qz^PGBIISwVOxDW&y% zPA?E~TQ8a{Z4;e)ys&NRg{7|t9M3^oTtb%kfqxc$*7Y--r1dw~(Hm4ew7%qcmrvk9!@q3$ATj0v_KGYOn4fdh;U& zkM;lQQ_3S2ied2h05%`lO(p%Lrf~3Qew@GCVe8_}ZRh$Ac~P2vgts3|@WoS@nKwg~ zRR;RbVsmRydK1OQeLG>aw+C6Rs=?p2*Nf`hODI(t!w+NZqtwrSu`%dlN=-%O{R?z@ zcYxOND!2m{3m_MYL_k3*bf(!kEoc-|qdCfvi)C2tMv&UWyrRLwl`=$GVaUIJg2Yq+ z{~C?aT!V*P0;IN|c2Fy)(vYe03f?{a)FMD*dQL?YX$K$zSSaSJP%1LRQn~xDw)NxC zT!UB6Rfzz;(Gl)vB{W;p7k@o}l0h%h;AJI^ju4?Egp-LPYGsA}pwAO07@2zES%g6! zV?VK?;QNmv9U;s%G3>NY+HJ;Q?*;?@$ClG7gq(8OFJ#A>t9;FAziu~k{%)rMWc^pQ zI-$nJI)p+!91yajEyr}l>6kPbxS-3dp?w{&*7!S4b_cmKkSTGfDcYsef_Qe-Yor!( vIC_Zl6C5RI9K<5QZFv{}NyTe<)!33K*Df00000NkvXXu0mjfS&>A7 literal 0 HcmV?d00001 diff --git a/src/ce_icons.inc b/src/ce_icons.inc index aa5c0a8c..38b59cc4 100644 --- a/src/ce_icons.inc +++ b/src/ce_icons.inc @@ -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'#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' From 2130807c62b16adb20a02e5db1f8f02951658fac Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 18 Feb 2015 13:57:40 +0100 Subject: [PATCH 2/4] added interface for the editable options --- src/ce_interfaces.pas | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/ce_interfaces.pas b/src/ce_interfaces.pas index 92ada5a0..4e694446 100644 --- a/src/ce_interfaces.pas +++ b/src/ce_interfaces.pas @@ -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. @@ -366,11 +392,16 @@ begin end; {$ENDREGION} -{$REGION TCEEditableShortCutSubject --------------------------------------------} +{$REGION Misc subjects ---------------------------------------------------------} 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 ------------------------------------------} From 7b3dc5290663d37f48dd9c51442c911fd31d63de Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 18 Feb 2015 13:58:05 +0100 Subject: [PATCH 3/4] dev option editor - 1 --- lazproj/coedit.lpi | 10 ++- src/ce_main.pas | 6 +- src/ce_messages.pas | 47 ++++++++++- src/ce_optionseditor.lfm | 111 ++++++++++++++++++++++++++ src/ce_optionseditor.pas | 167 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 338 insertions(+), 3 deletions(-) create mode 100644 src/ce_optionseditor.lfm create mode 100644 src/ce_optionseditor.pas diff --git a/lazproj/coedit.lpi b/lazproj/coedit.lpi index 1059579c..012c5c5f 100644 --- a/lazproj/coedit.lpi +++ b/lazproj/coedit.lpi @@ -140,7 +140,7 @@ - + @@ -348,6 +348,14 @@ + + + + + + + + diff --git a/src/ce_main.pas b/src/ce_main.pas index f9702a5c..0912558b 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -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} diff --git a/src/ce_messages.pas b/src/ce_messages.pas index 92ccb67c..9dba2b4c 100644 --- a/src/ce_messages.pas +++ b/src/ce_messages.pas @@ -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 diff --git a/src/ce_optionseditor.lfm b/src/ce_optionseditor.lfm new file mode 100644 index 00000000..b23540ad --- /dev/null +++ b/src/ce_optionseditor.lfm @@ -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 diff --git a/src/ce_optionseditor.pas b/src/ce_optionseditor.pas new file mode 100644 index 00000000..cf3ed2ff --- /dev/null +++ b/src/ce_optionseditor.pas @@ -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. + From 1a9baafe306de3545f2ee4bcc95adb4a41a90912 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 18 Feb 2015 14:38:10 +0100 Subject: [PATCH 4/4] nothing --- src/ce_interfaces.pas | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ce_interfaces.pas b/src/ce_interfaces.pas index 4e694446..1b4e6586 100644 --- a/src/ce_interfaces.pas +++ b/src/ce_interfaces.pas @@ -385,14 +385,12 @@ begin end; {$ENDREGION} -{$REGION TCEMainMenuSubject ----------------------------------------------------} +{$REGION Misc subjects ---------------------------------------------------------} function TCEMainMenuSubject.acceptObserver(aObject: TObject): boolean; begin exit(aObject is ICEMainMenuProvider); end; -{$ENDREGION} -{$REGION Misc subjects ---------------------------------------------------------} function TCEEditableShortCutSubject.acceptObserver(aObject: TObject): boolean; begin exit(aObject is ICEEditableShortCut);