From e6f4c97ba1441bccb5529b5a58c363a26fb1f39d Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 9 Jun 2011 08:55:07 +0000 Subject: [PATCH] educationlaz: implemented object inspetor hide favourite and restricted page git-svn-id: trunk@31140 - --- components/education/eduoipages.pas | 26 +++++++++++++------------- ide/customformeditor.pp | 6 ++++++ ideintf/formeditingintf.pas | 6 ++++-- ideintf/objectinspector.pp | 2 ++ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/components/education/eduoipages.pas b/components/education/eduoipages.pas index a9a6080212..f28dac8e4c 100644 --- a/components/education/eduoipages.pas +++ b/components/education/eduoipages.pas @@ -24,8 +24,9 @@ unit EduOIPages; interface uses - Classes, LResources, Forms, StdCtrls, ExtCtrls, LazConfigStorage, IDEOptionsIntf, EduOptions, - ObjectInspector, ObjInspStrConsts; + Classes, Forms, LCLProc, StdCtrls, ExtCtrls, LazConfigStorage, + ObjectInspector, ObjInspStrConsts, IDEOptionsIntf, FormEditingIntf, + EduOptions; type @@ -35,7 +36,6 @@ type private FOIPageFavs: boolean; FOIPageRestricted: boolean; - public constructor Create; override; destructor Destroy; override; @@ -44,7 +44,6 @@ type procedure Apply(Enable: boolean); override; property OIPageFavs: boolean read FOIPageFavs write FOIPageFavs; property OIPageRestricted: boolean read FOIPageRestricted write FOIPageRestricted; - end; { TEduOIPagesFrame } @@ -53,14 +52,12 @@ type ckBoxRestricted: TCheckBox; ckBoxFavs: TCheckBox; grpBoxOIPages: TGroupBox; - public function GetTitle: String; override; procedure ReadSettings(AOptions: TAbstractIDEOptions); override; - procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; + procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override; class function SupportedOptionsClass: TAbstractIDEOptionsClass; override; procedure WriteSettings(AOptions: TAbstractIDEOptions); override; - end; var @@ -88,7 +85,6 @@ begin FOIPageFavs:=false; FOIPageRestricted:=false; - end; destructor TEduOIPagesOptions.Destroy; @@ -98,7 +94,6 @@ end; function TEduOIPagesOptions.Load(Config: TConfigStorage): TModalResult; begin - FOIPageFavs:=Config.GetValue('OIPageFavs',true); FOIPageRestricted:=Config.GetValue('OIPageRestricted',true); @@ -107,7 +102,6 @@ end; function TEduOIPagesOptions.Save(Config: TConfigStorage): TModalResult; begin - Config.SetValue('OIPageFavs',FOIPageFavs); Config.SetValue('OIPageRestricted',FOIPageRestricted); @@ -115,15 +109,21 @@ begin end; procedure TEduOIPagesOptions.Apply(Enable: boolean); +var + ObjInsp: TObjectInspectorDlg; begin inherited Apply(Enable); + ObjInsp:=FormEditingHook.GetCurrentObjectInspector; + if ObjInsp=nil then begin + debugln(['TEduOIPagesOptions.Apply no OI']); + exit; + end; + ObjInsp.ShowFavorites:=FOIPageFavs or (not Enable); + ObjInsp.ShowRestricted:=FOIPageRestricted or (not Enable); end; { TEduOIPagesFrame } - - - function TEduOIPagesFrame.GetTitle: String; begin Result:=ersEduOIPages; diff --git a/ide/customformeditor.pp b/ide/customformeditor.pp index 80b125e481..91625c1252 100644 --- a/ide/customformeditor.pp +++ b/ide/customformeditor.pp @@ -120,6 +120,7 @@ type function CutSelectionToClipboard: Boolean; override; function PasteSelectionFromClipboard(Flags: TComponentPasteSelectionFlags ): Boolean; override; + function GetCurrentObjectInspector: TObjectInspectorDlg; override; // JIT components function IsJITComponent(AComponent: TComponent): boolean; @@ -647,6 +648,11 @@ begin Result:=false; end; +function TCustomFormEditor.GetCurrentObjectInspector: TObjectInspectorDlg; +begin + Result:=FObj_Inspector; +end; + function TCustomFormEditor.IsJITComponent(AComponent: TComponent): boolean; begin Result:=JITFormList.IsJITForm(AComponent) diff --git a/ideintf/formeditingintf.pas b/ideintf/formeditingintf.pas index 4b49948cd3..e406c65dbf 100644 --- a/ideintf/formeditingintf.pas +++ b/ideintf/formeditingintf.pas @@ -23,7 +23,7 @@ interface uses Math, Classes, SysUtils, LCLProc, TypInfo, types, Forms, Controls, - ProjectIntf, ComponentEditors; + ProjectIntf, ComponentEditors, ObjectInspector; const ComponentPaletteImageWidth = 24; @@ -166,11 +166,13 @@ type function CutSelectionToClipboard: Boolean; virtual; abstract; function PasteSelectionFromClipboard(Flags: TComponentPasteSelectionFlags ): Boolean; virtual; abstract; + + function GetCurrentObjectInspector: TObjectInspectorDlg; virtual; abstract; end; type TDesignerIDECommandForm = class(TCustomForm) - // dummy form class, use by the IDE commands for keys in the designers + // dummy form class, used by the IDE commands for keys in the designers end; var diff --git a/ideintf/objectinspector.pp b/ideintf/objectinspector.pp index 882b07dba8..d1e899c4cd 100644 --- a/ideintf/objectinspector.pp +++ b/ideintf/objectinspector.pp @@ -781,6 +781,8 @@ type const DefaultObjectInspectorName: string = 'ObjectInspectorDlg'; +// the ObjectInspector of the IDE can be found in FormEditingIntf + implementation {$R *.lfm}