From 567eee5674be75e6c6ffa6960bc0038f92fb9135 Mon Sep 17 00:00:00 2001 From: lazarus Date: Wed, 21 Mar 2001 23:48:29 +0000 Subject: [PATCH] MG: fixed window positions git-svn-id: trunk@234 - --- designer/designer.pp | 4 ++-- ide/main.pp | 9 ++++----- lcl/include/control.inc | 13 +++++++++++-- lcl/interfaces/gtk/gtkcallback.inc | 24 ++++++++++++++++++++---- lcl/interfaces/gtk/gtkobject.inc | 7 ++++--- lcl/interfaces/gtk/gtkproc.inc | 4 ++-- lcl/interfaces/gtk/gtkwinapi.inc | 6 ++++-- 7 files changed, 47 insertions(+), 20 deletions(-) diff --git a/designer/designer.pp b/designer/designer.pp index 1fbed00422..0272e10f69 100644 --- a/designer/designer.pp +++ b/designer/designer.pp @@ -188,8 +188,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); + writeln('*** LM_Size ',Sender.Name,':',Sender.ClassName,' Type=',Message.SizeType + ,' ',Message.Width,',',Message.Height,' Pos=',Sender.Left,',',Sender.Top); ControlSelection.AdjustSize; if Assigned(FOnPropertiesChanged) then FOnPropertiesChanged(Self); diff --git a/ide/main.pp b/ide/main.pp index b9c78fd695..431b8c1103 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -584,7 +584,7 @@ begin ObjectInspector1.SetBounds(Left,Top,Width,Height); end else begin ObjectInspector1.SetBounds( - 0,Top+Height+30,230,Max(Screen.Height-Top-Height-100,50)); + 0,Top+Height+30,230,Max(Screen.Height-Top-Height-120,50)); end; ObjectInspector1.OnAddAvailComponent:=@OIOnAddAvailableComponent; ObjectInspector1.OnSelectComponentInOI:=@OIOnSelectComponent; @@ -1582,8 +1582,7 @@ writeln('TMainIDE.DoNewEditorUnit 1'); // create jitform CInterface := TComponentInterface( FormEditor1.CreateComponent(nil,TForm, - ObjectInspector1.Left+ObjectInspector1.Width+15,ObjectInspector1.Top+15, - 400,300)); + ObjectInspector1.Left+ObjectInspector1.Width+40,Top+Height+50,400,300)); TempForm:=TForm(CInterface.Control); NewUnitInfo.Form:=TempForm; SetDefaultsForForm(TempForm); @@ -2949,8 +2948,8 @@ end. { ============================================================================= $Log$ - Revision 1.78 2001/03/21 14:25:59 lazarus - MG: Bugfixes + changed ide closing + Revision 1.79 2001/03/21 23:48:28 lazarus + MG: fixed window positions Revision 1.75 2001/03/19 14:00:46 lazarus MG: fixed many unreleased DC and GDIObj bugs diff --git a/lcl/include/control.inc b/lcl/include/control.inc index fa77e7dd63..c28f3a10cc 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -14,6 +14,7 @@ {------------------------------------------------------------------------------} procedure TControl.Adjustsize; begin +//writeln('[TControl.Adjustsize] ',Name,':',ClassName); if not (csLoading in ComponentState) then SetBounds(Left, Top, Width, Height); end; @@ -677,6 +678,7 @@ end; {------------------------------------------------------------------------------} Procedure TControl.SetBoundsRect(const Rect : TRect); Begin +//writeln('[TControl.SetBoundsRect] ',Name,':',ClassName); with Rect do SetBounds(Left,Top,Right - Left, Bottom - Top); end; @@ -718,7 +720,7 @@ const BOOLTXT: array[Boolean] of String = ('False', 'True'); begin -Writeln('SetMOuseCapture '+Self.Classname); +Writeln('SetMouseCapture '+Self.Classname); if MouseCapture <> Value then begin if Value @@ -857,7 +859,8 @@ end; {------------------------------------------------------------------------------} procedure TControl.SetBounds(ALeft, ATop, AWidth, AHeight : integer); begin - if (ALeft = Left) and (ATop = Top) and (AWidth = Width) and (AHeight = Height) then Exit; + if (ALeft = Left) and (ATop = Top) and (AWidth = Width) and (AHeight = Height) + then Exit; IsResizing := True; try FLeft := ALeft; @@ -1198,9 +1201,12 @@ end; ------------------------------------------------------------------------------} destructor TControl.Destroy; begin +//writeln('[TControl.Destroy] A ',Name,':',ClassName); SetParent(nil); FFont.Free; +//writeln('[TControl.Destroy] B ',Name,':',ClassName); inherited Destroy; +//writeln('[TControl.Destroy] END ',Name,':',ClassName); end; {------------------------------------------------------------------------------ @@ -1296,6 +1302,9 @@ end; { ============================================================================= $Log$ + Revision 1.17 2001/03/21 23:48:29 lazarus + MG: fixed window positions + Revision 1.16 2001/03/19 14:00:50 lazarus MG: fixed many unreleased DC and GDIObj bugs diff --git a/lcl/interfaces/gtk/gtkcallback.inc b/lcl/interfaces/gtk/gtkcallback.inc index 57d8832e5e..62d3f8c9ae 100644 --- a/lcl/interfaces/gtk/gtkcallback.inc +++ b/lcl/interfaces/gtk/gtkcallback.inc @@ -560,11 +560,13 @@ begin Result := DeliverMessage(Data, Mess) = 0; end; -function gtksize_allocateCB( widget: PGtkWidget; size :pGtkAllocation; data: gPointer) : GBoolean; cdecl; +function gtksize_allocateCB( widget: PGtkWidget; size :pGtkAllocation; + data: gPointer) : GBoolean; cdecl; var PosMsg : TLMWindowPosChanged; SizeMsg: TLMSize; MoveMsg: TLMMove; + Dummy: TPoint; begin EventTrace('size-allocate', data); @@ -579,9 +581,19 @@ begin try with PosMsg.WindowPos^ do begin - if TObject(data) is TWinControl - then hWnd := TWinControl(data).Handle - else hWnd := 0; + if TObject(data) is TWinControl then begin + hWnd := TWinControl(data).Handle; + if TObject(data) is TCustomForm then begin + //writeln('[gtksize_allocateCB] CUSTOMFORM ************' + // ,TControl(Data).Left,',',TControl(Data).Top,' ',Size^.X,',',Size^.Y); + Dummy.X:=TControl(Data).Left; + Dummy.Y:=TControl(Data).Top; + gdk_window_get_root_origin(widget^.window, @Dummy.X, @Dummy.Y); + Size^.X:=Dummy.X; + Size^.Y:=Dummy.Y; + end; + end else + hWnd := 0; hWndInsertAfter := 0; x := Size^.X; y := Size^.Y; @@ -617,6 +629,7 @@ Writeln('***********************'); Height := Size^.Height; end; Assert(False, 'Trace:[gtksize_allocateCB] DeliverMessage LM_SIZE'); + Result := DeliverPostMessage(Data, SizeMsg) or Result; with MoveMsg do @@ -1091,6 +1104,9 @@ end; { ============================================================================= $Log$ + Revision 1.27 2001/03/21 23:48:29 lazarus + MG: fixed window positions + Revision 1.26 2001/03/19 14:44:22 lazarus MG: fixed many unreleased DC and GDIObj bugs diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index 32eee6b509..d863cefb80 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -557,7 +557,8 @@ activate_time : the time at which the activation event occurred. LM_SetSize : begin Assert(False, Format('Trace: [TgtkObject.IntSendMessage3] %s --> LM_SetSize(%d, %d, %d, %d)', [Sender.ClassNAme, PRect(Data)^.Left,PRect(Data)^.Top,PRect(Data)^.Right,PRect(Data)^.Bottom])); - ResizeChild(Sender,PRect(Data)^.Left,PRect(Data)^.Top,PRect(Data)^.Right,PRect(Data)^.Bottom); + ResizeChild(Sender,PRect(Data)^.Left,PRect(Data)^.Top, + PRect(Data)^.Right,PRect(Data)^.Bottom); end; LM_ShowModal : @@ -2757,8 +2758,8 @@ end; { ============================================================================= $Log$ - Revision 1.38 2001/03/21 14:26:00 lazarus - MG: Bugfixes + changed ide closing + Revision 1.39 2001/03/21 23:48:29 lazarus + MG: fixed window positions Revision 1.36 2001/03/19 18:51:57 lazarus MG: added dynhasharray and renamed tsynautocompletion diff --git a/lcl/interfaces/gtk/gtkproc.inc b/lcl/interfaces/gtk/gtkproc.inc index d0dc4ab340..442575ec49 100644 --- a/lcl/interfaces/gtk/gtkproc.inc +++ b/lcl/interfaces/gtk/gtkproc.inc @@ -725,8 +725,8 @@ end; { ============================================================================= $Log$ - Revision 1.13 2001/03/21 14:26:00 lazarus - MG: Bugfixes + changed ide closing + Revision 1.14 2001/03/21 23:48:29 lazarus + MG: fixed window positions Revision 1.12 2001/03/19 14:44:22 lazarus MG: fixed many unreleased DC and GDIObj bugs diff --git a/lcl/interfaces/gtk/gtkwinapi.inc b/lcl/interfaces/gtk/gtkwinapi.inc index 40237a9928..33dc0bfc0b 100644 --- a/lcl/interfaces/gtk/gtkwinapi.inc +++ b/lcl/interfaces/gtk/gtkwinapi.inc @@ -2120,6 +2120,7 @@ begin Begin gdk_window_get_origin(Widget^.Window, @X, @Y); gdk_window_get_size(Widget^.Window, @W, @H); +writeln('[TgtkObject.GetWindowRect] ',x,',',y,',',w,',',h); end else Begin @@ -2684,6 +2685,7 @@ Begin gdk_window_get_origin(Widget^.Window, @X, @Y); end; +writeln('[TGTKObject.ScreenToClient] ',x,',',y,' P=',P.X,',',P.Y); dec(P.X, X); dec(P.Y, Y); Result := -1; @@ -3423,8 +3425,8 @@ end; { ============================================================================= $Log$ - Revision 1.29 2001/03/21 14:26:00 lazarus - MG: Bugfixes + changed ide closing + Revision 1.30 2001/03/21 23:48:29 lazarus + MG: fixed window positions Revision 1.26 2001/03/19 18:51:57 lazarus MG: added dynhasharray and renamed tsynautocompletion