Object inspector has hints now.

Shane

git-svn-id: trunk@428 -
This commit is contained in:
lazarus 2001-11-16 20:08:41 +00:00
parent c0580a1c76
commit 56d379cf31
6 changed files with 126 additions and 7 deletions

View File

@ -260,8 +260,8 @@ begin
Result:=true;
Sender.Dispatch(Message);
if (ControlSelection.IsSelected(Sender)) then begin
writeln('*** LM_Size ',Sender.Name,':',Sender.ClassName,' Type=',Message.SizeType
,' ',Message.Width,',',Message.Height,' Pos=',Sender.Left,',',Sender.Top);
// writeln('*** LM_Size ',Sender.Name,':',Sender.ClassName,' Type=',Message.SizeType
// ,' ',Message.Width,',',Message.Height,' Pos=',Sender.Left,',',Sender.Top);
if not ControlSelection.IsResizing then begin
ControlSelection.AdjustSize;
if Assigned(FOnPropertiesChanged) then

View File

@ -138,6 +138,14 @@ type
FExpandedProperties:TStringList;
FBorderStyle:TBorderStyle;
//hint stuff
FHintTimer : TTimer;
FHintWindow : THintWindow;
FLastMouseMovePos : TPoint;
Procedure HintTimer(sender : TObject);
Procedure ResetHintTimer(Sender : TObject; Shift: TShiftstate; X,Y : Integer);
function GetRow(Index:integer):TOIPropertyGridRow;
function GetRowCount:integer;
procedure ClearRows;
@ -174,6 +182,7 @@ type
procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;
procedure WMSize(var Msg: TWMSize); message WM_SIZE;
procedure WMMouseMove(var Msg: TWMMouseMove); message WM_MOUSEMOVE;
procedure SetBorderStyle(Value: TBorderStyle);
procedure UpdateScrollBar;
protected
@ -323,6 +332,8 @@ begin
OnKeyDown:=@ValueEditKeyDown;
Visible:=false;
Enabled:=false;
OnMouseMove := @ResetHintTimer;
end;
ValueComboBox:=TComboBox.Create(Self);
@ -333,6 +344,7 @@ begin
Visible:=false;
Enabled:=false;
Parent:=Self;
OnMouseMove := @ResetHintTimer;
end;
ValueButton:=TButton.Create(Self);
@ -347,6 +359,21 @@ begin
FDefaultItemHeight:=ValueComboBox.Height-3;
BuildPropertyList;
FHintTimer := TTimer.Create(nil);
FHintTimer.Interval := 500;
FHintTimer.Enabled := False;
FHintTimer.OnTimer := @HintTimer;
FHintWindow := THintWindow.Create(nil);
FHIntWindow.Visible := False;
FHintWindow.Caption := 'This is a hint window'#13#10'NEat huh?';
FHintWindow.HideInterval := 4000;
FHintWindow.AutoHide := True;
end;
procedure TOIPropertyGrid.UpdateScrollBar;
@ -429,6 +456,8 @@ begin
FValueFont.Free;
FNameFont.Free;
FExpandedProperties.Free;
FHintTimer.free;
FHintWindow.Free;
inherited Destroy;
end;
@ -817,7 +846,8 @@ end;
procedure TOIPropertyGrid.MouseDown(Button:TMouseButton; Shift:TShiftState;
X,Y:integer);
var IconX,Index:integer;
var
IconX,Index:integer;
PointedRow:TOIpropertyGridRow;
begin
//ShowMessageDialog('X'+IntToStr(X)+',Y'+IntToStr(Y));
@ -1177,6 +1207,81 @@ begin
Result:=TOIPropertyGridRow(FRows[Index]);
end;
Procedure TOIPropertyGrid.HintTimer(sender : TObject);
var
Rect : TRect;
AHint : String;
Control : TControl;
Position : TPoint;
BW : Integer;
IconX,Index:integer;
PointedRow:TOIpropertyGridRow;
begin
BW := 0;
FHintTimer.Enabled := False;
Position := Mouse.CursorPos;
if ( (FLastMouseMovePos.X <= 0) or (FLastMouseMOvePos.Y <= 0) or (FLastMouseMovePos.X >= Width) or (FLastMouseMovePos.Y >= Height)) then Exit;
Position := ScreenToClient(Position);
if ((Position.X <=0) or (Position.X >= Width) or (Position.Y <= 0) or (Position.Y >= Height)) then Exit;
AHint := '';
Index:=MouseToIndex(Position.Y,false);
if (Index>=0) and (Index<FRows.Count) then
begin
IconX:=GetTreeIconX(Index);
PointedRow:=Rows[Index];
if Assigned(PointedRow) then
Begin
if position.X <= FSplitterX then
Begin
if Assigned(PointedRow.Editor) then
AHint := PointedRow.Editor.GetName
end
else
AHint := PointedRow.LastPaintedValue;
end;
end;
if AHint = '' then Exit;
Rect := FHintWindow.CalcHintRect(0,AHint,nil); //no maxwidth
Position := ClientToScreen(FLastMouseMovePos);
Rect.Left := Position.X+10;
Rect.Top := Position.Y+10;
Rect.Right := Rect.Left + Rect.Right+3;
Rect.Bottom := Rect.Top + Rect.Bottom+3;
FHintWindow.ActivateHint(Rect,AHint);
end;
Procedure TOIPropertyGrid.ResetHintTimer(Sender : TObject; Shift: TShiftstate; X,Y : Integer);
begin
if FHintWIndow.Visible then
FHintWindow.Visible := False;
FHintTimer.Enabled := False;
FHintTimer.Enabled := True;
if (Sender is TOIPropertyGrid) then
Begin
FLastMouseMovePos.X := X;
FLastMouseMovePos.Y := Y;
end
else
begin //account for the controls position. THis is used for the FCurrentEdit control
FLastMouseMovePos.X := TWinControl(sender).Left+X;
FLastMouseMovePos.Y := TWinControl(Sender).Top+Y;
end;
end;
procedure TOIPropertyGrid.WMMouseMove(var Msg: TWMMouseMove);
begin
inherited;
ResetHintTimer(self,[],Msg.pos.x,Msg.Pos.Y);
end;
//------------------------------------------------------------------------------
{ TOIPropertyGridRow }

View File

@ -669,12 +669,10 @@ CheckHeap('TCustomFormEditor.CreateComponent C '+IntToStr(GetMem_Cnt));
CheckHeap('TCustomFormEditor.CreateComponent D '+IntToStr(GetMem_Cnt));
{$ENDIF}
if ParentCI <> nil then Begin
Writeln('ParentCI <> nil');
TempName := Temp.FControl.ClassName;
delete(TempName,1,1);
//make it more presentable
TempName := TempName[1] + lowercase(Copy(TempName,2,length(tempname)));
writeln('TempName is '''+TempName+'''');
Num := 0;
Found := True;
While Found do Begin
@ -691,7 +689,6 @@ CheckHeap('TCustomFormEditor.CreateComponent D '+IntToStr(GetMem_Cnt));
end;
end;
Temp.FControl.Name := TempName+IntToStr(Num);
Writeln('TempName + num = '+TempName+Inttostr(num));
end;
{$IFDEF IDE_MEM_CHECK}

View File

@ -262,6 +262,7 @@ var
LogBrush: TLogBrush;
//Attributes: TGdkWindowAttr;
//AttributesMask: gint;
FG,BG : TgdkColor; //foreground and background
begin
// initialize app level gtk engine
gtk_set_locale ();
@ -289,6 +290,14 @@ begin
FGTKToolTips := gtk_tooltips_new;
gtk_object_ref(PGTKObject(FGTKToolTips));
gtk_toolTips_Enable(FGTKToolTips);
FG.red := $FFFFFF;
FG.Green := $FFFFFF;
fg.blue := $FFFFFF;
BG.REd := $444444;
bg.Green := $ffffff;
bg.Blue := $111111;
gtk_toolTips_set_colors(FGTKToolTips,@FG,@BG);
// Init stock objects;
LogBrush.lbStyle := BS_NULL;
@ -3314,6 +3323,10 @@ end;
{ =============================================================================
$Log$
Revision 1.72 2001/11/16 20:08:39 lazarus
Object inspector has hints now.
Shane
Revision 1.71 2001/11/14 17:46:58 lazarus
Changes to make toggling between form and unit work.
Added BringWindowToTop

View File

@ -890,6 +890,10 @@ end;
{ =============================================================================
$Log$
Revision 1.26 2001/11/16 20:08:41 lazarus
Object inspector has hints now.
Shane
Revision 1.25 2001/11/12 16:56:08 lazarus
MG: CLIPBOARD

View File

@ -47,6 +47,7 @@ WM_SYSCHAR = LM_SYSCHAR;
WM_SYSKEYDOWN = LM_SYSKEYDOWN;
WM_SYSKEYUP = LM_SYSKEYUP;
WM_VSCROLL = LM_VSCROLL;
WM_MOUSEMOVE = LM_MOUSEMOVE;
type
@ -61,7 +62,6 @@ TWMSETCURSOR = TLMSETCURSOR;
TWMSetFocus = TLMSetFocus;
TWMSIZE = TLMSIZE;
TWMGetDlgCode = TLMNoParams;