gtk intf now ignores size notifications of unrealized widgets

git-svn-id: trunk@5808 -
This commit is contained in:
mattias 2004-08-17 19:01:37 +00:00
parent 8fbf5f70d1
commit 508c219f38
9 changed files with 127 additions and 24 deletions

View File

@ -1539,7 +1539,7 @@ constructor TEnvironmentOptionsDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Position:=poScreenCenter;
IDEDialogLayoutList.ApplyLayout(Self,510,450);
IDEDialogLayoutList.ApplyLayout(Self,510,480);
Caption:=lisMenuGeneralOptions;
OnResize:=@EnvironmentOptionsDialogResize;

View File

@ -290,7 +290,9 @@ var
begin
{$IFDEF VerboseSizeMsg}
DebugLn('TControl.ChangeBounds A ',Name,':',ClassName,' Old=',Left,',',Top,',',Width,',',Height,' New=',ALeft,',',ATop,',',AWidth,',',AHeight);
DebugLn('TControl.ChangeBounds A ',Name,':',ClassName,
' Old='+dbgs(Left)+','+dbgs(Top)+','+dbgs(Width),',',dbgs(Height),
' New='+dbgs(ALeft)+','+dbgs(ATop)+','+dbgs(AWidth),',',dbgs(AHeight));
{$ENDIF}
// constraint the size
DoConstrainedResize(AWidth, AHeight);
@ -2836,12 +2838,15 @@ end;
Undock and float.
Float means here: create the floating dock site and dock this control into it.
Exception: Forms do not need float dock sites and float on their own.
------------------------------------------------------------------------------}
function TControl.ManualFloat(TheScreenRect: TRect): Boolean;
var
FloatHost: TWinControl;
begin
// undock from old floating host dock site
Result := (HostDockSite=nil) or HostDockSite.DoUndock(nil,Self);
// create new float dock site and dock this control into it.
if Result then begin
FloatHost := CreateFloatingDockSite(TheScreenRect);
if FloatHost<>nil then
@ -3049,7 +3054,7 @@ end;
Contructor for the class.
------------------------------------------------------------------------------}
constructor TControl.Create(TheOwner : TComponent);
constructor TControl.Create(TheOwner: TComponent);
begin
//if AnsiCompareText(ClassName,'TSpeedButton')=0 then
// DebugLn('TControl.Create START ',Name,':',ClassName);
@ -3078,6 +3083,7 @@ begin
FTabOrder := -1;
TabStop := False;
FDragCursor := crDrag;
FFloatingDockSiteClass := TCustomDockForm;
//DebugLn('TControl.Create END ',Name,':',ClassName);
end;
@ -3220,6 +3226,9 @@ end;
{ =============================================================================
$Log$
Revision 1.208 2004/08/17 19:01:36 mattias
gtk intf now ignores size notifications of unrealized widgets
Revision 1.207 2004/08/05 21:20:47 mattias
moved designer/abstractformeditor.pp to ideintf/formeditingintf.pas

View File

@ -888,7 +888,7 @@ function TWinControl.GetClientRect: TRect;
FClientWidth:=NewClientRect.Right;
FClientHeight:=NewClientRect.Bottom;
{$IFDEF VerboseSizeMsg}
DebugLn('StoreClientRect ',Name,':',ClassName,' ',FClientWidth,',',FClientHeight);
DebugLn('StoreClientRect ',Name,':',ClassName,' ',dbgs(FClientWidth),',',dbgs(FClientHeight));
{$ENDIF}
if ClientSizeChanged then begin
for i:=0 to ControlCount-1 do
@ -2973,8 +2973,10 @@ var
NewWidth, NewHeight: integer;
begin
{$IFDEF VerboseSizeMsg}
DebugLn('TWinControl.WMMove A ',Name,':',ClassName,' Message=',Message.XPos,',',Message.YPos,
' BoundsRealized=',FBoundsRealized.Left,',',FBoundsRealized.Top,',',FBoundsRealized.Right-FBoundsRealized.Left,',',FBoundsRealized.Bottom-FBoundsRealized.Top);
DebugLn('TWinControl.WMMove A ',Name,':',ClassName,' Message=',dbgs(Message.XPos),',',dbgs(Message.YPos),
' BoundsRealized='+dbgs(FBoundsRealized.Left)+','+dbgs(FBoundsRealized.Top),
','+dbgs(FBoundsRealized.Right-FBoundsRealized.Left),
'x'+dbgs(FBoundsRealized.Bottom-FBoundsRealized.Top));
{$ENDIF}
NewWidth:=Width;
NewHeight:=Height;
@ -3791,6 +3793,9 @@ end;
{ =============================================================================
$Log$
Revision 1.262 2004/08/17 19:01:36 mattias
gtk intf now ignores size notifications of unrealized widgets
Revision 1.261 2004/08/13 19:48:53 mattias
added default assembler style for compiler options

View File

@ -2014,16 +2014,20 @@ begin
}
{$IFDEF VerboseSizeMsg}
DebugLn('gtksize_allocateCB: ',
TControl(Data).Name,':',TControl(Data).ClassName,
' widget=',HexStr(Cardinal(Widget),8),
TControl(Data).Name+':'+TControl(Data).ClassName,
' widget='+HexStr(Cardinal(Widget),8)+WidgetFlagsToString(widget)+
' fixwidget=',HexStr(Cardinal(GetFixedWidget(Widget)),8),
' OldPos=',TControl(Data).Left,',',TControl(Data).Top,',',TControl(Data).Width,',',TControl(Data).Height);
' GtkPos=',dbgs(Widget^.allocation.x)+','+dbgs(Widget^.allocation.y),
','+dbgs(Widget^.allocation.width)+'x'+dbgs(Widget^.allocation.width)+
' LCLPos='+dbgs(TControl(Data).Left)+','+dbgs(TControl(Data).Top),
','+dbgs(TControl(Data).Width)+'x'+dbgs(TControl(Data).Height));
{$ENDIF}
{$IFDEF VerboseFormPositioning}
if TControl(Data) is TCustomForm then
DebugLn('VFP gtksize_allocateCB: ',TControl(Data).ClassName,' ',Size^.X,',',Size^.Y);
DebugLn('VFP gtksize_allocateCB: ',TControl(Data).ClassName,' ',dbgs(Size^.X),',',dbgs(Size^.Y));
{$ENDIF}
SaveSizeNotification(Widget);
if GTK_WIDGET_REALIZED(Widget) then
SaveSizeNotification(Widget);
end;
function gtksize_allocate_client(widget: PGtkWidget; size: pGtkAllocation;
@ -2040,9 +2044,9 @@ begin
DebugLn('gtksize_allocate_client: ',
TControl(Data).Name,':',TControl(Data).ClassName,
' widget=',HexStr(Cardinal(Widget),8),
' NewSize=',Size^.Width,',',Size^.Height,
' Allocation=',widget^.Allocation.Width,',',Widget^.Allocation.Height,
' Requisiton=',widget^.Requisition.Width,',',Widget^.Requisition.Height
' NewSize=',dbgs(Size^.Width),',',dbgs(Size^.Height),
' Allocation='+dbgs(widget^.Allocation.Width)+'x'+dbgs(Widget^.Allocation.Height),
' Requisiton='+dbgs(widget^.Requisition.Width)+'x'+dbgs(Widget^.Requisition.Height)
);
{$ENDIF}
if not TWinControl(Data).HandleAllocated then begin
@ -2050,7 +2054,8 @@ begin
end;
MainWidget:=PGtkWidget(TWinControl(Data).Handle);
ClientWidget:=GetFixedWidget(MainWidget);
SaveClientSizeNotification(ClientWidget);
if GTK_WIDGET_REALIZED(ClientWidget) then
SaveClientSizeNotification(ClientWidget);
end else begin
// owner is not TWinControl -> ignore
DebugLn('WARNING: gtksize_allocate_client: Data is not TWinControl. Data=',
@ -2872,6 +2877,9 @@ end;
{ =============================================================================
$Log$
Revision 1.244 2004/08/17 19:01:36 mattias
gtk intf now ignores size notifications of unrealized widgets
Revision 1.243 2004/08/04 10:51:13 mazen
* fix left mouse button click reaction

View File

@ -432,7 +432,10 @@ begin
// reposition
{$IFDEF VerboseSizeMsg}
DebugLn('TGtkWidgetSet.SetWindowSizeAndPosition B ',AWinControl.Name,':',AWinControl.ClassName,' Visible=',AWinControl.Visible,' Old=',PGtkWidget(Window)^.allocation.X,',',PGtkWidget(Window)^.allocation.Y,' New=',AWinControl.Left,',',AWinControl.Top,',',Width,',',Height);
DebugLn('TGtkWidgetSet.SetWindowSizeAndPosition B ',AWinControl.Name,':',AWinControl.ClassName,
' Visible=',dbgs(AWinControl.Visible),
' Old=',dbgs(PGtkWidget(Window)^.allocation.X)+','+dbgs(PGtkWidget(Window)^.allocation.Y),
' New=',dbgs(AWinControl.Left)+','+dbgs(AWinControl.Top)+','+dbgs(Width)+'x'+dbgs(Height));
{$ENDIF}
gtk_widget_set_uposition(PGtkWidget(Window),AWinControl.Left,AWinControl.Top);
end;
@ -766,7 +769,7 @@ procedure TGtkWidgetSet.SendCachedLCLMessages;
begin
if FWidgetsWithResizeRequest.Count=0 then exit;
{$IFDEF VerboseSizeMsg}
DebugLn('GGG1 SendCachedLCLResizeRequests SizeMsgCount=',FWidgetsWithResizeRequest.Count);
DebugLn('GGG1 SendCachedLCLResizeRequests SizeMsgCount=',dbgs(FWidgetsWithResizeRequest.Count));
{$ENDIF}
TopologicalList:=CreateTopologicalSortedWidgets(FWidgetsWithResizeRequest);
@ -781,7 +784,7 @@ procedure TGtkWidgetSet.SendCachedLCLMessages;
{$IFDEF VerboseSizeMsg}
if AnsiCompareText(LCLControl.ClassName,'TScrollBar')=0 then
DebugLn('SendCachedLCLMessages ',LCLControl.Name,':',LCLControl.ClassName,
' ',LCLControl.Left,',',LCLControl.Top,',',LCLControl.Width,',',LCLControl.Height);
' ',dbgs(LCLControl.Left)+','+dbgs(LCLControl.Top)+','+dbgs(LCLControl.Width)+'x'+dbgs(LCLControl.Height));
{$ENDIF}
IsTopLevelWidget:= (LCLControl is TCustomForm)
@ -882,10 +885,17 @@ procedure TGtkWidgetSet.SendCachedGtkMessages;
end;
begin
if not GTK_WIDGET_REALIZED(MainWidget) then begin
{$IFDEF VerboseSizeMsg}
DebugLn('SendSizeNotificationToLCL ',LCLControl.Name,':',LCLControl.ClassName,' MainWidget=',WidgetFlagsToString(MainWidget),' Ignored, because not realized ');
{$ENDIF}
exit;
end;
LCLControl:=TWinControl(GetLCLObject(MainWidget));
if LCLControl=nil then exit;
{$IFDEF VerboseSizeMsg}
DebugLn('JJJ1 SendSizeNotificationToLCL ',LCLControl.Name,':',LCLControl.ClassName);
DebugLn('JJJ1 SendSizeNotificationToLCL ',LCLControl.Name,':',LCLControl.ClassName,' MainWidget=',WidgetFlagsToString(MainWidget));
{$ENDIF}
GtkLeft:=MainWidget^.Allocation.X;
@ -927,8 +937,8 @@ procedure TGtkWidgetSet.SendCachedGtkMessages;
{$IFDEF VerboseSizeMsg}
DebugLn('JJJ2 ',LCLControl.Name,
' GTK=',GtkLeft,',',GtkTop,',',GtkWidth,',',GtkHeight,
' LCL=',LCLLeft,',',LCLTop,',',LCLWidth,',',LCLHeight
' GTK=',dbgs(GtkLeft)+','+dbgs(GtkTop)+','+dbgs(GtkWidth)+'x'+dbgs(GtkHeight),
' LCL=',dbgs(LCLLeft)+','+dbgs(LCLTop)+','+dbgs(LCLWidth)+'x'+dbgs(LCLHeight)
);
{$ENDIF}
// first send a LM_WINDOWPOSCHANGED message
@ -1028,7 +1038,8 @@ procedure TGtkWidgetSet.SendCachedGtkMessages;
-> invalidate client rectangles
}
{$IFDEF VerboseSizeMsg}
DebugLn('HHH1 SendCachedGtkClientResizeNotifications Invalidating ClientRects ... FixSizeMsgCount=',FFixWidgetsResized.Count);
DebugLn('HHH1 SendCachedGtkClientResizeNotifications Invalidating ClientRects ... '
,' FixSizeMsgCount=',dbgs(FFixWidgetsResized.Count));
{$ENDIF}
FFixWidgetsResized.AssignTo(List);
for i:=0 to List.Count-1 do begin
@ -1045,7 +1056,7 @@ procedure TGtkWidgetSet.SendCachedGtkMessages;
-> send WMSize, WMMove, and WMWindowPosChanged messages
}
{$IFDEF VerboseSizeMsg}
DebugLn('HHH2 SendCachedGtkClientResizeNotifications SizeMsgCount=',FWidgetsResized.Count);
DebugLn('HHH2 SendCachedGtkClientResizeNotifications SizeMsgCount=',dbgs(FWidgetsResized.Count));
{$ENDIF}
repeat
MainWidget:=FWidgetsResized.First;
@ -1141,7 +1152,7 @@ begin
{$IFDEF VerboseSizeMsg}
LCLObject:=GetNearestLCLObject(Widget);
DbgOut('TGtkWidgetSet.RealizeWidgetSize Widget='+HexStr(Cardinal(Widget),8),
DbgOut('TGtkWidgetSet.RealizeWidgetSize Widget='+HexStr(Cardinal(Widget),8)+WidgetFlagsToString(Widget)+
' New='+dbgs(NewWidth)+','+dbgs(NewHeight));
if (LCLObject<>nil) and (LCLObject is TControl) then begin
with TControl(LCLObject) do
@ -9239,6 +9250,9 @@ end;
{ =============================================================================
$Log$
Revision 1.527 2004/08/17 19:01:36 mattias
gtk intf now ignores size notifications of unrealized widgets
Revision 1.526 2004/08/13 21:46:31 mattias
added TLazIntfImage.SetColor_BPP32_R8G8B8_A1_BIO_TTB_RBO

View File

@ -729,6 +729,24 @@ begin
{$endif gtk1}
end;
function WidgetFlagsToString(Widget: PGtkWidget): string;
begin
Result:='[';
if Widget=nil then
Result:=Result+'nil'
else begin
if GTK_WIDGET_REALIZED(Widget) then
Result:=Result+'R';
if GTK_WIDGET_MAPPED(Widget) then
Result:=Result+'M';
if GTK_WIDGET_VISIBLE(Widget) then
Result:=Result+'V';
if GTK_WIDGET_DRAWABLE(Widget) then
Result:=Result+'D';
end;
Result:=Result+']';
end;
{------------------------------------------------------------------------------
function WidgetIsDestroyingHandle(Widget: PGtkWidget): boolean;
@ -7111,6 +7129,9 @@ end;
{ =============================================================================
$Log$
Revision 1.293 2004/08/17 19:01:37 mattias
gtk intf now ignores size notifications of unrealized widgets
Revision 1.292 2004/08/16 16:03:52 mattias
added UniCode keyvals

View File

@ -273,6 +273,7 @@ function GtkWidgetIsA(Widget: PGtkWidget; AType: TGtkType): boolean;
function GetWidgetClassName(Widget: PGtkWidget): string;
function GetWidgetDebugReport(Widget: PGtkWidget): string;
function GetWindowDebugReport(AWindow: PGDKWindow): string;
function WidgetFlagsToString(Widget: PGtkWidget): string;
// gtk resources
procedure Set_RC_Name(Sender: TObject; AWidget: PGtkWidget);

View File

@ -120,6 +120,10 @@ procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9: string);
procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10: string);
procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11: string);
procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12: string);
procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13: string);
procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14: string);
procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15: string);
procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16: string);
procedure DbgOut(const s: string);
procedure DbgOut(const s1,s2: string);
@ -725,6 +729,30 @@ begin
DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12);
end;
procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12,
s13: string);
begin
DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13);
end;
procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13,
s14: string);
begin
DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14);
end;
procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13,
s14, s15: string);
begin
DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14+s15);
end;
procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13,
s14, s15, s16: string);
begin
DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14+s15+s16);
end;
procedure DBGOut(const s: string);
begin
if TextRec(Output).Mode<>fmClosed then

View File

@ -148,6 +148,10 @@ type
property Color;
property Constraints;
property Ctl3D;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ParentColor;
@ -161,8 +165,15 @@ type
property Visible;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDockDrop;
property OnDockOver;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
@ -170,6 +181,9 @@ type
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
@ -1158,6 +1172,9 @@ end.
{ =============================================================================
$Log$
Revision 1.160 2004/08/17 19:01:36 mattias
gtk intf now ignores size notifications of unrealized widgets
Revision 1.159 2004/08/15 22:31:51 mattias
fixed fpc 1.0.10 compilation