implemented component tree for OI

git-svn-id: trunk@4528 -
This commit is contained in:
mattias 2003-08-26 14:33:40 +00:00
parent f5d2c38786
commit 43ea5ac01c
7 changed files with 141 additions and 88 deletions

View File

@ -330,7 +330,7 @@ type
ShowOptionsPopupMenuItem: TMenuItem;
procedure AvailComboBoxCloseUp(Sender: TObject);
procedure ComponentTreeSelectionChanged(Sender: TObject);
procedure NoteBookResize(Sender: TObject);
procedure ObjectInspectorResize(Sender: TObject);
procedure OnBackgroundColPopupMenuItemClick(Sender :TObject);
procedure OnShowHintPopupMenuItemClick(Sender :TObject);
procedure OnShowOptionsPopupMenuItemClick(Sender :TObject);
@ -364,6 +364,8 @@ type
procedure SetShowComponentTree(const AValue: boolean);
procedure SetUsePairSplitter(const AValue: boolean);
procedure CreatePairSplitter;
procedure DestroyNoteBook;
procedure CreateNoteBook;
public
constructor Create(AnOwner: TComponent); override;
destructor Destroy; override;
@ -2064,12 +2066,10 @@ begin
FEventGridSplitterX);
XMLConfig.SetDeleteValue('ObjectInspectorOptions/Bounds/DefaultItemHeight',
FDefaultItemHeight,20);
{$IFNDEF CompTree}
XMLConfig.SetDeleteValue('ObjectInspectorOptions/ComponentTree/Show/Value',
FShowComponentTree,true);
XMLConfig.SetDeleteValue('ObjectInspectorOptions/ComponentTree/Height/Value',
FComponentTreeHeight,100);
{$ENDIF}
XMLConfig.SetDeleteValue('ObjectInspectorOptions/GridBackgroundColor',
FGridBackgroundColor,clBackground);
@ -2155,10 +2155,8 @@ begin
Name := DefaultObjectInspectorName;
FDefaultItemHeight := 22;
FComponentTreeHeight:=100;
{$IFDEF CompTree}
FShowComponentTree:=true;
FUsePairSplitter:=TPairSplitter.IsSupportedByInterface;
{$ENDIF}
// StatusBar
StatusBar:=TStatusBar.Create(Self);
@ -2188,9 +2186,6 @@ begin
,'ShowComponentTreePopupMenuItem','Show Component Tree',''
,@OnShowComponentTreePopupMenuItemClick,FShowComponentTree,true,true);
ShowComponentTreePopupMenuItem.ShowAlwaysCheckable:=true;
{$IFNDEF CompTree}
ShowComponentTreePopupMenuItem.Enabled:=false;
{$ENDIF}
AddPopupMenuItem(ShowOptionsPopupMenuItem,nil
,'ShowOptionsPopupMenuItem','Options',''
,@OnShowOptionsPopupMenuItemClick,false,true,FOnShowOptions<>nil);
@ -2229,59 +2224,9 @@ begin
Visible:=FShowComponentTree;
end;
// NoteBook
NoteBook:=TNoteBook.Create(Self);
with NoteBook do begin
Name:='NoteBook';
if PairSplitter1<>nil then begin
Parent:=PairSplitter1.Sides[1];
end else begin
Parent:=Self;
end;
Align:= alClient;
if PageCount>0 then
Pages.Strings[0]:=oisProperties
else
Pages.Add(oisProperties);
Pages.Add(oisEvents);
PageIndex:=0;
PopupMenu:=MainPopupMenu;
OnResize:=@NoteBookResize;
end;
// property grid
PropertyGrid:=TOIPropertyGrid.CreateWithParams(Self,PropertyEditorHook
,[tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat, tkSet{, tkMethod}
, tkSString, tkLString, tkAString, tkWString, tkVariant
{, tkArray, tkRecord, tkInterface}, tkClass, tkObject, tkWChar, tkBool
, tkInt64, tkQWord],
FDefaultItemHeight);
with PropertyGrid do begin
Name:='PropertyGrid';
Parent:=NoteBook.Page[0];
ValueEdit.Parent:=Parent;
ValueComboBox.Parent:=Parent;
ValueButton.Parent:=Parent;
Selections:=Self.FComponentList;
Align:=alClient;
PopupMenu:=MainPopupMenu;
OnModified:=@OnGridModified;
end;
// event grid
EventGrid:=TOIPropertyGrid.CreateWithParams(Self,PropertyEditorHook,
[tkMethod],FDefaultItemHeight);
with EventGrid do begin
Name:='EventGrid';
Parent:=NoteBook.Page[1];
ValueEdit.Parent:=Parent;
ValueComboBox.Parent:=Parent;
ValueButton.Parent:=Parent;
Selections:=Self.FComponentList;
Align:=alClient;
PopupMenu:=MainPopupMenu;
OnModified:=@OnGridModified;
end;
CreateNoteBook;
OnResize:=@ObjectInspectorResize;
end;
destructor TObjectInspector.Destroy;
@ -2509,11 +2454,11 @@ begin
FOnSelectComponentsInOI(Self);
end;
procedure TObjectInspector.NoteBookResize(Sender: TObject);
procedure TObjectInspector.ObjectInspectorResize(Sender: TObject);
begin
{$IFDEF CompTree}
writeln('TObjectInspector.NoteBookResize A ',Left,',',Top,',',Width,',',Height);
{$ENDIF}
if (ComponentTree<>nil) and (ComponentTree.Visible)
and (ComponentTree.Parent=Self) then
ComponentTree.Height:=ClientHeight div 4;
end;
procedure TObjectInspector.OnBackgroundColPopupMenuItemClick(Sender :TObject);
@ -2557,36 +2502,34 @@ end;
procedure TObjectInspector.SetShowComponentTree(const AValue: boolean);
begin
{$IFNDEF CompTree}
exit;
{$ENDIF}
if FShowComponentTree=AValue then exit;
FShowComponentTree:=AValue;
BeginUpdate;
ShowComponentTreePopupMenuItem.Checked:=FShowComponentTree;
writeln('TObjectInspector.SetShowComponentTree A ',FShowComponentTree);
ComponentTree.Visible:=FShowComponentTree;
AvailCompsComboBox.Visible:=not FShowComponentTree;
// hide controls while rebuilding
if PairSplitter1<>nil then
PairSplitter1.Visible:=false;
DestroyNoteBook;
ComponentTree.Visible:=false;
AvailCompsComboBox.Visible:=false;
// rebuild controls
if FUsePairSplitter and FShowComponentTree then begin
CreatePairSplitter;
ComponentTree.Parent:=PairSplitter1.Sides[0];
ComponentTree.Align:=alClient;
NoteBook.Parent:=PairSplitter1.Sides[1];
NoteBook.Align:=alClient;
writeln('TObjectInspector.SetShowComponentTree B ',NoteBook.Parent.Name,':',NoteBook.Parent.ClassName,' ',
NoteBook.Visible,' ',NoteBook.Height,' ',NoteBook.Parent.ClientHeight,' ',
NoteBook.Parent.Height,' ',
PairSplitter1.Height,' ',NoteBook.HandleAllocated);
end else begin
PairSplitter1.Visible:=false;
ComponentTree.Parent:=Self;
ComponentTree.Align:=alTop;
ComponentTree.Height:=ComponentTreeHeight;
NoteBook.Parent:=Self;
NoteBook.Align:=alClient;
PairSplitter1.Free;
PairSplitter1:=nil;
if PairSplitter1<>nil then begin
PairSplitter1.Free;
PairSplitter1:=nil;
end;
end;
ComponentTree.Visible:=FShowComponentTree;
AvailCompsComboBox.Visible:=not FShowComponentTree;
CreateNoteBook;
EndUpdate;
end;
@ -2611,6 +2554,84 @@ begin
end;
end;
procedure TObjectInspector.DestroyNoteBook;
begin
if NoteBook<>nil then
NoteBook.Visible:=false;
if PropertyGrid<>nil then begin
PropertyGrid.Free;
PropertyGrid:=nil;
end;
if EventGrid<>nil then begin
EventGrid.Free;
EventGrid:=nil;
end;
if NoteBook<>nil then begin
NoteBook.Free;
NoteBook:=nil;
end;
end;
procedure TObjectInspector.CreateNoteBook;
begin
DestroyNoteBook;
// NoteBook
NoteBook:=TNoteBook.Create(Self);
with NoteBook do begin
Name:='NoteBook';
if PairSplitter1<>nil then begin
Parent:=PairSplitter1.Sides[1];
end else begin
Parent:=Self;
end;
Align:= alClient;
if PageCount>0 then
Pages.Strings[0]:=oisProperties
else
Pages.Add(oisProperties);
Page[0].Name:='PropertyPage';
Pages.Add(oisEvents);
Page[1].Name:='EventPage';
PageIndex:=0;
PopupMenu:=MainPopupMenu;
end;
// property grid
PropertyGrid:=TOIPropertyGrid.CreateWithParams(Self,PropertyEditorHook
,[tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat, tkSet{, tkMethod}
, tkSString, tkLString, tkAString, tkWString, tkVariant
{, tkArray, tkRecord, tkInterface}, tkClass, tkObject, tkWChar, tkBool
, tkInt64, tkQWord],
FDefaultItemHeight);
with PropertyGrid do begin
Name:='PropertyGrid';
Parent:=NoteBook.Page[0];
ValueEdit.Parent:=Parent;
ValueComboBox.Parent:=Parent;
ValueButton.Parent:=Parent;
Selections:=Self.FComponentList;
Align:=alClient;
PopupMenu:=MainPopupMenu;
OnModified:=@OnGridModified;
end;
// event grid
EventGrid:=TOIPropertyGrid.CreateWithParams(Self,PropertyEditorHook,
[tkMethod],FDefaultItemHeight);
with EventGrid do begin
Name:='EventGrid';
Parent:=NoteBook.Page[1];
ValueEdit.Parent:=Parent;
ValueComboBox.Parent:=Parent;
ValueButton.Parent:=Parent;
Selections:=Self.FComponentList;
Align:=alClient;
PopupMenu:=MainPopupMenu;
OnModified:=@OnGridModified;
end;
end;
procedure TObjectInspector.OnShowHintPopupMenuItemClick(Sender : TObject);
begin
PropertyGrid.ShowHint:=not PropertyGrid.ShowHint;

View File

@ -3250,7 +3250,6 @@ end;
procedure TMethodPropertyEditor.GetValues(Proc: TGetStringProc);
begin
//RaiseGDBException('TMethodPropertyEditor.GetValues');
writeln('### TMethodPropertyEditor.GetValues');
Proc('(None)');
PropertyHook.GetMethods(GetTypeData(GetPropType), Proc);

View File

@ -70,6 +70,7 @@ type
procedure WMPaint(var Msg: TLMPaint); message LM_PAINT;
procedure SetParent(AParent : TWinControl); override;
property Flags: TPageFlags read FFlags write FFlags;
procedure CMHitTest(var Message: TLMNCHITTEST); message CM_HITTEST;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -751,6 +752,9 @@ end.
{
$Log$
Revision 1.69 2003/08/26 14:33:40 mattias
implemented component tree for OI
Revision 1.68 2003/08/14 15:31:42 mattias
started TTabSheet and TPageControl

View File

@ -572,7 +572,7 @@ begin
end;
{------------------------------------------------------------------------------
procedure TControl.DoOnResize;
procedure TControl.DoOnChangeBounds;
Call events
------------------------------------------------------------------------------}
@ -1768,6 +1768,7 @@ begin
if (FLastResizeWidth<>Width) or (FLastResizeHeight<>Height)
or (FLastResizeClientWidth<>ClientWidth)
or (FLastResizeClientHeight<>ClientHeight) then begin
//if AnsiCompareText('NOTEBOOK',Name)=0 then
{writeln('[TControl.Resize] ',Name,':',ClassName,
' Last=',FLastResizeWidth,',',FLastResizeHeight,
' LastClient=',FLastResizeClientWidth,',',FLastResizeClientHeight,
@ -2480,6 +2481,9 @@ end;
{ =============================================================================
$Log$
Revision 1.150 2003/08/26 14:33:40 mattias
implemented component tree for OI
Revision 1.149 2003/08/23 11:30:50 mattias
fixed SetComboHeight in win32 intf and finddeclaration of overloaded proc definition

View File

@ -21,8 +21,6 @@
constructor TNotebook.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
TabPosition := tpTop;
ShowTabs := True;
SetInitialBounds(0,0,200,200);
end;
@ -36,6 +34,9 @@ end;
{
$Log$
Revision 1.4 2003/08/26 14:33:40 mattias
implemented component tree for OI
Revision 1.3 2003/08/20 15:06:57 mattias
implemented Build+Run File

View File

@ -99,6 +99,22 @@ begin
end;
end;
{------------------------------------------------------------------------------
procedure TPage.CMHitTest(var Message: TLMNCHITTEST);
------------------------------------------------------------------------------}
procedure TPage.CMHitTest(var Message: TLMNCHITTEST);
begin
if (Parent<>nil) and (Parent is TCustomNotebook)
and (TCustomNotebook(Parent).ActivePageComponent<>Self) then
Message.Result:=0 // no hit
else
inherited;
{writeln('TPage.CMHitTest A ',Name,' ',(Parent<>nil),' ',
(Parent is TCustomNotebook),' ',
(TCustomNotebook(Parent).ActivePageComponent<>Self),
' Message.Result=',Message.Result);}
end;
{------------------------------------------------------------------------------
TPage Destroy
------------------------------------------------------------------------------}
@ -138,6 +154,9 @@ end;
// included by extctrls.pp
{
$Log$
Revision 1.18 2003/08/26 14:33:40 mattias
implemented component tree for OI
Revision 1.17 2003/08/14 15:31:42 mattias
started TTabSheet and TPageControl

View File

@ -286,7 +286,7 @@ var
'');
{$ENDIF}
end;
// set the new bounds
if (Control.Left <> NewLeft) or (Control.Top <> NewTop)
or (Control.Width <> NewWidth) or (Control.Height <> NewHeight) then begin
@ -1453,6 +1453,8 @@ var
)
or
(
(not (csDesigning in ComponentState))
and
(Visible)
and
(Enabled or AllowDisabled)
@ -1462,12 +1464,12 @@ var
)
);
{$IFDEF VerboseMouseBugfix}
{writeln('GetControlAtPos ',Name,
writeln('GetControlAtPos ',Name,':',ClassName,
' Pos=',Pos.X,',',Pos.Y,
' P=',P.X,',',P.Y,
' ClientBounds=',ClientBounds.Left,',',ClientBounds.Top,',',ClientBounds.Right,',',ClientBounds.Bottom,
' OnlyCl=',OnlyClientAreas,
' Result=',Result);}
' Result=',Result);
{$ENDIF}
if Result then
LControl := AControl;
@ -2984,6 +2986,9 @@ end;
{ =============================================================================
$Log$
Revision 1.164 2003/08/26 14:33:40 mattias
implemented component tree for OI
Revision 1.163 2003/08/25 16:18:15 mattias
fixed background color of TPanel and clicks of TSpeedButton from Micha