From 56b97ad5b7867d674b651a68c5f329d1cf03630d Mon Sep 17 00:00:00 2001 From: lazarus Date: Tue, 27 Mar 2001 14:27:43 +0000 Subject: [PATCH] Changes from Nagy Zsolt Shane git-svn-id: trunk@242 - --- ide/uniteditor.pp | 16 +++-- lcl/include/bevel.inc | 96 +++++++++++++++++++++++++++++ lcl/include/statusbar.inc | 101 +++++++++++++------------------ lcl/include/wincontrol.inc | 28 +++++---- lcl/interfaces/gtk/gtkobject.inc | 9 ++- 5 files changed, 176 insertions(+), 74 deletions(-) diff --git a/ide/uniteditor.pp b/ide/uniteditor.pp index 1948a8d262..3d43c9af42 100644 --- a/ide/uniteditor.pp +++ b/ide/uniteditor.pp @@ -1179,8 +1179,9 @@ begin //get the control name nmControlType := _Control.name; + writeln('Calling GetAncestor'); Ancestor := GetAncestor; - + Writeln('Called'); //find the place in the code to start looking for it For I := 0 to TempSource.Count-1 do @@ -1289,9 +1290,16 @@ Function TSourceEditor.GetAncestor : String; var PI : PTypeInfo; begin - PI := FControl.ClassInfo; - Result := PI^.Name; - Delete(Result,1,1); + writeln('In Get Ancewstor'); + if (FControl <> nil) then + Begin + PI := FControl.ClassInfo; + Writeln('1'); + Result := PI^.Name; + Writeln('2'); + Delete(Result,1,1); + Writeln('3'); + end; end; diff --git a/lcl/include/bevel.inc b/lcl/include/bevel.inc index dee3950966..fe310ffe04 100644 --- a/lcl/include/bevel.inc +++ b/lcl/include/bevel.inc @@ -43,6 +43,98 @@ Begin End; End; +(*Procedure TBevel.Paint; +Var + Colora, Colorb:TColor; +Begin + Case Style Of + bsRaised: + Begin + Colora:=clWhite; + Colorb:=clGray; + End; + bsLowered: + Begin + Colora:=clGray; + Colorb:=clWhite; + End; + End; + Canvas.Pen.Width:=1; + Case Shape Of + bsBox: + With Canvas Do + Begin + Pen.Color:=Colora; + MoveTo(Left, Top + Height - 1); + LineTo(Left, Top); + LineTo(Left + Width - 2, Top); + Pen.Color:=Colorb; + LineTo(Left + Width - 2, Top + Height - 1); + LIneTo(Left , Top + Height - 1); + End; + bsFrame: + With Canvas Do + Begin + Pen.Color:=Colora; + MoveTo(Left, Top + Height - 1); + LineTo(Left, Top); + LineTo(Left + Width - 1, Top); + MoveTo(Left + Width - 2, Top + 1); + LineTo(Left + Width - 2, Top + Height - 2); + LineTo(Left + 1, Top + Height - 2); + Pen.Color:=Colorb; + MoveTo(Left + 1, Top + Height - 2); + LineTo(Left + 1, Top + 1); + LineTo(Left + Width - 2, Top + 1); + MoveTo(Left + Width - 1, Top); + LineTo(Left + Width - 1, Top + Height - 1); + LineTo(Left, Top + Height - 1); + End; + bsTopLine: + With Canvas Do + Begin + Pen.Color:=Colora; + MoveTo(Left, Top); + LineTo(Left + Width - 1, Top); + Pen.Color:=Colorb; + MoveTo(Left, Top + 1); + LineTo(Left + Width - 1, Top + 1); + End; + bsBottomLine: + With Canvas Do + Begin + Pen.Color:=Colorb; + MoveTo(Left, Top + Height - 1); + LineTo(Left + Width - 1, Top + Height - 1); + Pen.Color:=Colora; + MoveTo(Left, Top + Height - 2); + LineTo(Left + Width - 1, Top + Height - 2); + End; + bsLeftLine: + With Canvas Do + Begin + Pen.Color:=Colora; + MoveTo(Left, Top); + LineTo(Left, Top + Height - 1); + Pen.Color:=Colorb; + MoveTo(Left + 1, Top); + LineTo(Left + 1, Top + Height - 1); + End; + bsRightLine: + With Canvas Do + Begin + Pen.Color:=Colorb; + MoveTo(Left + Width - 1, Top); + LineTo(Left + Width - 1, Top + Height - 1); + Pen.Color:=Colora; + MoveTo(Left + Width - 2, Top); + LineTo(Left + Width - 2, Top + Height); + End; + End; +End; + + *) + Procedure TBevel.Paint; Var Colora, Colorb:TColor; @@ -132,6 +224,10 @@ End; { $Log$ + Revision 1.2 2001/03/27 14:27:43 lazarus + Changes from Nagy Zsolt + Shane + Revision 1.1 2000/07/13 10:28:24 michael + Initial import diff --git a/lcl/include/statusbar.inc b/lcl/include/statusbar.inc index ee107a941c..d608ed779d 100644 --- a/lcl/include/statusbar.inc +++ b/lcl/include/statusbar.inc @@ -56,70 +56,61 @@ begin inherited Destroy; end; +{------------------------------------------------------------------------------} +{ TStatusBar DrawBevel } +{------------------------------------------------------------------------------} Procedure TStatusBar.DrawBevel(xLeft, PanelNum : Integer ); +var + Colora,Colorb:TColor; Begin -//writeln('[TStatusBar.DrawBevel] ',Canvas.Classname); - Canvas.Brush.Color := color; - Canvas.FillRect(Rect(XLeft,Top,XLeft +Panels[PanelNum].Width,Top+Height)); - if (Panels[PanelNum].Bevel = pbRaised) then - with Canvas do begin - Pen.Width:=1; - Pen.Color := clWhite; - Line(XLeft,Top,XLeft+Panels[PanelNum].Width-1,Top); - Line(XLeft,Top,XLeft,Top+Height-1); - Line(XLeft,Top+1,XLeft+Panels[PanelNum].Width-1,Top+1); - Line(XLeft+1,Top,XLeft+1,Top+Height-1); - Pen.Color := clBlack; - Line(XLeft,Top+Height-5,XLeft+Panels[PanelNum].Width-1,Top+Height-5); - Line(XLeft+Panels[PanelNum].Width-2,Top,XLeft+Panels[PanelNum].Width-2,Top+Height-1); - Line(XLeft,Top+Height-6,XLeft+Panels[PanelNum].Width-1,Top+Height-6); - Line(XLeft+Panels[PanelNum].Width-3,Top,XLeft+Panels[PanelNum].Width-3,Top+Height-2); - end - else + Canvas.Brush.Color := Color; + Canvas.FillRect(Rect(XLeft,Top,XLeft+Panels[PanelNum].Width,Top+Height)); + + if Panels[PanelNum].Bevel = pbRaised then + begin + Colora:=clWhite; + Colorb:=clGray; + end; if Panels[PanelNum].Bevel = pbLowered then - Begin - Canvas.Pen.Color := clBlack; - Canvas.Line(XLeft,Top,XLeft+Panels[PanelNum].Width-1,Top); - Canvas.Line(XLeft,Top,XLeft,Top+Height-1); - Canvas.Line(XLeft,Top+1,XLeft+Panels[PanelNum].Width-1,Top+1); - Canvas.Line(XLeft+1,Top,XLeft+1,Top+Height-1); - Canvas.Pen.Color := clWhite; - Canvas.Line(XLeft,Top+Height-5,XLeft+Panels[PanelNum].Width-1,Top+Height-5); - Canvas.Line(XLeft+Panels[PanelNum].Width-1,Top,XLeft+Panels[PanelNum].Width-1,Top+Height-1); - Canvas.Line(XLeft,Top+Height-6,XLeft+Panels[PanelNum].Width-1,Top+Height-6); - Canvas.Line(XLeft+Panels[PanelNum].Width-2,Top,XLeft+Panels[PanelNum].Width-2,Top+Height-4); - end - else - if Panels[PanelNum].Bevel = pbNone then - Begin -{ Canvas.Pen.Color := clBlack; - Canvas.Line(XLeft,Top,XLeft+Panels[PanelNum].Width-1,Top); - Canvas.Line(XLeft,Top,XLeft,Top+Height-1); - Canvas.Line(XLeft,Top+Height-1,XLeft+Panels[PanelNum].Width-1,Top+Height-1); - Canvas.Line(XLeft+Panels[PanelNum].Width-1,Top,XLeft+Panels[PanelNum].Width-1,Top+Height-1); -} - end + begin + Colora:=clGray; + Colorb:=clWhite; + end; + Canvas.Pen.Width:=1; + if (Panels[PanelNum].Bevel = pbRaised) or (Panels[PanelNum].Bevel = pbLowered) then + With Canvas Do + Begin + Pen.Color:=Colora; + MoveTo(XLeft,Top+Height-1); + LineTo(XLeft,Top); + LineTo(XLeft+Panels[PanelNum].Width-1,Top); + Pen.Color:=Colorb; + LineTo(XLeft+Panels[PanelNum].Width-1,Top+Height-1); + LIneTo(XLeft,Top+Height-1); + End; End; + Procedure TStatusBar.DrawDivider(X : Integer); Begin - Canvas.Pen.Color := clWhite; - Canvas.Line(X,Top,X,Top+Height); - Canvas.Pen.Color := clBlack; - Canvas.Line(X+1,Top,X+1,Top+Height); + Canvas.Pen.Width:=1; + Canvas.Pen.Color := clBtnFace; + Canvas.Line(X,Top,X,Top+Height-1); + Canvas.Pen.Color := clBtnFace; + Canvas.Line(X+1,Top,X+1,Top+Height-1); End; Procedure TStatusBar.WMPaint(var Msg: TLMPaint); var I : Integer; - X,Y : Integer; + X,Y,X2 : Integer; Begin -//Writeln('[TSTATUSBAR].WMPAINT'); inherited; + X2:=(Height-Canvas.TextHeight('L')) div 2; if SimplePanel = False then Begin if Panels.Count = 0 then exit; @@ -129,22 +120,16 @@ Begin For I := 0 to Panels.Count-1 do Begin if I = Panels.Count-1 then - Panels[I].Width := Width-X; //this sets the last panel to the width of the statusbar + Panels[I].Width := ClientWidth-X; //this sets the last panel to the width of the statusbar DrawBevel(X,I); - Canvas.TextOut(X+2,Y+2,Panels[i].Text); + Canvas.TextOut(X+2,Y+X2,Panels[i].Text); //draw divider if I < Panels.Count-1 then DrawDivider(X+Panels[i].Width); - X := X + Panels[i].Width +1; - // Writeln('SimplePanel = False'); - // Writeln('Panels[0].Text = '+Panels[0].Text); + inc(X); + X := X + Panels[i].Width+1; end; - -// ExtTextOut(Handle,1,1,0,nil,pchar(Panels[0].Text),Length(Panels[0].Text),nil); end - else - if SimplePanel = True then - Begin - Canvas.TextOut(Left+2,Top+2,SimpleText); - end; + else Canvas.TextOut(Left+2,Top+X2,SimpleText); + End; diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index 1d8f30c182..45eea6a24a 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -1589,18 +1589,20 @@ end; ------------------------------------------------------------------------------} procedure TWinControl.WMWindowPosChanged(var Message : TLMWindowPosChanged); begin - if Message.WindowPos <> nil - then with Message.WindowPos^ do - begin - FLeft := X; - FWidth := cX; - FTop := Y; - FHeight := cY; - Assert(False, Format('Trace:[TWinControl.WMWindowPosChanged] %s --> Message.WindowPos(%d, %d)(%d, %d)', [ClassName, X, Y, cx, cy])); - end - else Assert(False, Format('Trace:[TWinControl.WMWindowPosChanged] %s --> Message.WindowPos = nil', [ClassName])); +Writeln('[TWINCONTROL].WMWINDOWPOSCHANGED'); + if Message.WindowPos <> nil then + with Message.WindowPos^ do + begin + Writeln(Format('Sizes are %d,%d,%d,%d',[X,Y,cx,cy])); + FLeft := X; + FWidth := cX; + FTop := Y; + FHeight := cY; + Assert(False, Format('Trace:[TWinControl.WMWindowPosChanged] %s --> Message.WindowPos(%d, %d)(%d, %d)', [ClassName, X, Y, cx, cy])); + end + else Assert(False, Format('Trace:[TWinControl.WMWindowPosChanged] %s --> Message.WindowPos = nil', [ClassName])); - inherited WMWindowPosChanged(Message); + inherited WMWindowPosChanged(Message); end; @@ -1963,6 +1965,10 @@ end; { ============================================================================= $Log$ + Revision 1.27 2001/03/27 14:27:43 lazarus + Changes from Nagy Zsolt + Shane + Revision 1.26 2001/03/26 14:58:31 lazarus MG: setwindowpos + bugfixes diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index 6557f4b880..1e48e4b481 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -1824,7 +1824,10 @@ begin begin Assert(Sender is TForm); p := gtk_window_new(FormStyleMap[TForm(Sender).BorderStyle]); - gtk_container_set_border_width(GTK_CONTAINER(P), 2); +// I comment the next line because this causes that when I align something +// it's right and bottom don't visible. +//Nagy Zsolt 2001/03/27 +// gtk_container_set_border_width(GTK_CONTAINER(P), 2); TempInt:= FormSizeableMap[TForm(Sender).BorderStyle]; gtk_window_set_policy (GTK_WINDOW (p), TempInt, TempInt, 0); gtk_window_set_title(pGtkWindow(p), strTemp); @@ -2772,6 +2775,10 @@ end; { ============================================================================= $Log$ + Revision 1.41 2001/03/27 14:27:43 lazarus + Changes from Nagy Zsolt + Shane + Revision 1.40 2001/03/26 14:58:31 lazarus MG: setwindowpos + bugfixes