mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 09:39:13 +02:00
implemented generic function to hide TComponents without page in designer
git-svn-id: trunk@5164 -
This commit is contained in:
parent
bf8c04c86a
commit
9bcc3289ba
@ -33,8 +33,7 @@ unit DesignerProcs;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLIntf, Forms, Controls, LCLType, Graphics, VCLGlobals,
|
Classes, SysUtils, LCLIntf, Forms, Controls, LCLType, Graphics, VCLGlobals;
|
||||||
Menus;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TDesignerDCFlag = (ddcDCOriginValid, ddcFormOriginValid,
|
TDesignerDCFlag = (ddcDCOriginValid, ddcFormOriginValid,
|
||||||
@ -81,6 +80,12 @@ const
|
|||||||
NonVisualCompWidth = NonVisualCompIconWidth+2*NonVisualCompBorder;
|
NonVisualCompWidth = NonVisualCompIconWidth+2*NonVisualCompBorder;
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
TOnComponentIsInvisible = procedure(AComponent: TComponent;
|
||||||
|
var Invisible: boolean) of object;
|
||||||
|
var
|
||||||
|
OnComponentIsInvisible: TOnComponentIsInvisible;
|
||||||
|
|
||||||
function GetParentLevel(AControl: TControl): integer;
|
function GetParentLevel(AControl: TControl): integer;
|
||||||
function ControlIsInDesignerVisible(AControl: TControl): boolean;
|
function ControlIsInDesignerVisible(AControl: TControl): boolean;
|
||||||
function ComponentIsInvisible(AComponent: TComponent): boolean;
|
function ComponentIsInvisible(AComponent: TComponent): boolean;
|
||||||
@ -281,7 +286,10 @@ end;
|
|||||||
|
|
||||||
function ComponentIsInvisible(AComponent: TComponent): boolean;
|
function ComponentIsInvisible(AComponent: TComponent): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(AComponent is TMenuItem);
|
if Assigned(OnComponentIsInvisible) then
|
||||||
|
OnComponentIsInvisible(AComponent,Result)
|
||||||
|
else
|
||||||
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDesignerDeviceContext }
|
{ TDesignerDeviceContext }
|
||||||
|
@ -39,7 +39,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Dialogs, Graphics, ExtCtrls, Buttons, Menus, LResources,
|
Classes, SysUtils, Dialogs, Graphics, ExtCtrls, Buttons, Menus, LResources,
|
||||||
AVL_Tree, ComponentReg, IDEProcs, PackageDefs, LazarusIDEStrConsts;
|
AVL_Tree, LazarusIDEStrConsts, ComponentReg, DesignerProcs, IDEProcs,
|
||||||
|
PackageDefs;
|
||||||
|
|
||||||
const
|
const
|
||||||
ComponentPaletteBtnWidth = 25;
|
ComponentPaletteBtnWidth = 25;
|
||||||
@ -75,6 +76,8 @@ type
|
|||||||
procedure OnPageRemovedComponent(Page: TBaseComponentPage;
|
procedure OnPageRemovedComponent(Page: TBaseComponentPage;
|
||||||
Component: TRegisteredComponent); override;
|
Component: TRegisteredComponent); override;
|
||||||
procedure Update; override;
|
procedure Update; override;
|
||||||
|
procedure CheckComponentHasIcon(AComponent: TComponent;
|
||||||
|
var Invisible: boolean);
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -270,14 +273,26 @@ begin
|
|||||||
UpdateNoteBookButtons;
|
UpdateNoteBookButtons;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TComponentPalette.CheckComponentHasIcon(AComponent: TComponent;
|
||||||
|
var Invisible: boolean);
|
||||||
|
var
|
||||||
|
RegComp: TRegisteredComponent;
|
||||||
|
begin
|
||||||
|
RegComp:=FindComponent(AComponent.ClassName);
|
||||||
|
Invisible:=(RegComp<>nil) and (RegComp.PageName='');
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TComponentPalette.Create;
|
constructor TComponentPalette.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
fComponents:=TAVLTree.Create(@CompareRegisteredComponents);
|
fComponents:=TAVLTree.Create(@CompareRegisteredComponents);
|
||||||
|
OnComponentIsInvisible:=@CheckComponentHasIcon;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TComponentPalette.Destroy;
|
destructor TComponentPalette.Destroy;
|
||||||
begin
|
begin
|
||||||
|
if OnComponentIsInvisible=@CheckComponentHasIcon then
|
||||||
|
OnComponentIsInvisible:=nil;
|
||||||
NoteBook:=nil;
|
NoteBook:=nil;
|
||||||
fComponents.Free;
|
fComponents.Free;
|
||||||
fComponents:=nil;
|
fComponents:=nil;
|
||||||
|
@ -946,9 +946,6 @@ end;
|
|||||||
Set the shortcut
|
Set the shortcut
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Procedure TMenuItem.SetShortCut(const AValue : TShortCut);
|
Procedure TMenuItem.SetShortCut(const AValue : TShortCut);
|
||||||
var
|
|
||||||
NewKey: Word;
|
|
||||||
NewShift: TShiftState;
|
|
||||||
Begin
|
Begin
|
||||||
if FShortCut <> AValue then begin
|
if FShortCut <> AValue then begin
|
||||||
ShortCutChanged(FShortCut, AValue);
|
ShortCutChanged(FShortCut, AValue);
|
||||||
@ -1081,6 +1078,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.48 2004/02/04 13:55:08 mattias
|
||||||
|
implemented generic function to hide TComponents without page in designer
|
||||||
|
|
||||||
Revision 1.47 2004/02/04 13:40:19 mattias
|
Revision 1.47 2004/02/04 13:40:19 mattias
|
||||||
ShortCutToText now deletes any modifier
|
ShortCutToText now deletes any modifier
|
||||||
|
|
||||||
@ -1253,6 +1253,9 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.48 2004/02/04 13:55:08 mattias
|
||||||
|
implemented generic function to hide TComponents without page in designer
|
||||||
|
|
||||||
Revision 1.47 2004/02/04 13:40:19 mattias
|
Revision 1.47 2004/02/04 13:40:19 mattias
|
||||||
ShortCutToText now deletes any modifier
|
ShortCutToText now deletes any modifier
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user