From fd402e04acdb9378c55181383db2d87a54dd02da Mon Sep 17 00:00:00 2001 From: lazarus Date: Tue, 9 Jan 2001 18:23:21 +0000 Subject: [PATCH] Worked on moving controls. It's just not working with the X and Y coord's I'm getting. Shane git-svn-id: trunk@107 - --- designer/controlselection.pp | 34 +++--- designer/designer.pp | 184 +++++++++-------------------- ide/main.pp | 22 ++-- lcl/extctrls.pp | 5 +- lcl/include/control.inc | 15 +-- lcl/include/wincontrol.inc | 26 ++-- lcl/interfaces/gtk/gtkcallback.inc | 11 +- lcl/interfaces/gtk/gtkobject.inc | 13 +- lcl/lresources.pp | 2 +- 9 files changed, 137 insertions(+), 175 deletions(-) diff --git a/designer/controlselection.pp b/designer/controlselection.pp index 002162027d..e08ca4b79b 100644 --- a/designer/controlselection.pp +++ b/designer/controlselection.pp @@ -127,9 +127,6 @@ var procedure SetCaptureGrabber(AGrabber:TGrabber); begin -Writeln('SETCAPTUREGRABBER to....'); -if AGrabber <> nil then Writeln('something') else writeln('nil'); - CaptureGrabber:=AGrabber; end; @@ -142,7 +139,6 @@ end; constructor TGrabber.Create(AOwner: TComponent); begin -writeln('[TGrabber.Create]'); inherited Create(AOwner); ControlState := ControlState + [csCustomPaint]; FDragging := False; @@ -150,7 +146,7 @@ end; procedure TGrabber.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin -writeln('[TGrabber.MouseDown] X='+IntToStr(X+Left)+',Y='+IntToStr(Y+Top)); +//writeln('[TGrabber.MouseDown] X='+IntToStr(X+Left)+',Y='+IntToStr(Y+Top)); if CaptureGrabber<>nil then exit; // compute absolute mouse coordinates if (Button = mbLeft) and (not FDragging) @@ -171,7 +167,7 @@ begin CaptureGrabber.CaptureMouseMove(Self,Shift, X, Y); end else begin if FDragging then begin -writeln('[TGrabber.MouseMove] X='+IntToStr(X)+',Y='+IntToStr(Y)); +//writeln('[TGrabber.MouseMove] X='+IntToStr(X)+',Y='+IntToStr(Y)); DoDragMove(X+Left,Y+Top); end else inherited MouseMove(Shift, X, Y); @@ -182,10 +178,12 @@ procedure TGrabber.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integ var dx, dy: Integer; begin +//Writeln('MouseUp in TGrabber'); + if (CaptureGrabber<>nil) and (CaptureGrabber<>Self) then begin CaptureGrabber.CaptureMouseUp(Self,Button, Shift, X, Y); end else begin -writeln('[TGrabber.MouseUp] X='+IntToStr(X+Left)+',Y='+IntToStr(Y+Top)); +//writeln('[TGrabber.MouseUp] X='+IntToStr(X+Left)+',Y='+IntToStr(Y+Top)); if FDragging then EndDragging(X+Left,Y+Top) else @@ -196,14 +194,16 @@ end; procedure TGrabber.CaptureMouseMove(Sender:TControl;Shift: TShiftState; X, Y: Integer); begin +//Writeln('CaptureMouseMove in TGrabber'); if CaptureGrabber<>Self then exit; -writeln('[TGrabber.CaptureMouseMove]'); +//writeln('[TGrabber.CaptureMouseMove]'); MouseMove(Shift,X-CaptureGrabber.Left,Y-CaptureGrabber.Top); end; procedure TGrabber.CaptureMouseUp(Sender:TControl;Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin +//Writeln('CaptureMouseUp in TGrabber'); if CaptureGrabber<>Self then exit; if not (Sender is TCustomForm) then begin inc(X,TControl(Sender).Left); @@ -216,7 +216,7 @@ procedure TGrabber.DoDragMove(NewX, NewY: integer); var dx, dy: Integer; begin if FDragging then begin -writeln('[TGrabber.DoDragMove] NewX='+IntToStr(NewX)+',NewY='+IntToStr(NewY)); +//writeln('[TGrabber.DoDragMove] NewX='+IntToStr(NewX)+',NewY='+IntToStr(NewY)); if [gpLeft, gpRight] * Positions <> [] then dx := NewX - FLastMouseMove.X else dx := 0; @@ -233,7 +233,7 @@ procedure TGrabber.EndDragging(NewX, NewY: integer); var dx, dy: Integer; begin if FDragging then begin -writeln('[TGrabber.EndDragging] NewX='+IntToStr(NewX)+',NewY='+IntToStr(NewY)); +//writeln('[TGrabber.EndDragging] NewX='+IntToStr(NewX)+',NewY='+IntToStr(NewY)); DoDragMove(NewX, NewY); FDragging := False; SetCaptureGrabber(nil); @@ -257,16 +257,16 @@ end; procedure TControlSelection.MoveSelection(dx, dy: integer); begin -Writeln('**********'); +{Writeln('**********'); Writeln('Move Selection'); Writeln(Format('dx,dy = %d,%d',[dx,dy])); Writeln(Format('FLeft,FTop= %d,%d',[FLeft,FTop])); Writeln('**********'); - + } if (dx<>0) or (dy<>0) then begin Inc(FLeft,dx); Inc(FTop,dy); - // MoveContent(dx,dy); + MoveContent(dx,dy); SetGrabbers; end; end; @@ -299,6 +299,8 @@ procedure TControlSelection.AdjustSize(AControl: TControl; Initial: Boolean); var n: Integer; begin +Writeln('AdjustSize in TCOntrolSelection'); + if AControl <> nil then begin if Initial @@ -372,6 +374,8 @@ end; procedure TControlSelection.ControlMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin +Writeln('ControlMOuseDown in TCOntrolSelection'); + if Button = mbLeft then begin FStart := Point(X, Y); @@ -401,7 +405,7 @@ Writeln('TCOntrolSelection.ControlMOuseUp'); FDragging := False; Writeln(format('X-FStart.x = %d-%d=%d',[X,FStart.x,X-FStart.x])); Writeln(format('Y-FStart.Y = %d-%d=%d',[Y,FStart.y,Y-FStart.y])); - MoveContent(X - FStart.X, Y - FStart.Y); + //MoveContent(X - FStart.X, Y - FStart.Y); end; end; @@ -438,6 +442,7 @@ begin OnMoved := @GrabberMoved; end; end; +Writeln('Done in TControlSelection.Create'); end; destructor TControlSelection.Destroy; @@ -494,6 +499,7 @@ begin writeln('[TControlSelection.MoveContent] dx='+IntToStr(dx)+', dy='+IntToStr(dy)); if FControlList.Count = 1 then begin + if (TCOntrol(FControlList[0]) is TCustomForm) then exit; TControl(FControlList[0]).SetBounds(FLeft, FTop, FWidth, FHeight); end else diff --git a/designer/designer.pp b/designer/designer.pp index b15ccf8bd9..a5df650aba 100644 --- a/designer/designer.pp +++ b/designer/designer.pp @@ -64,11 +64,6 @@ type procedure ValidateRename(AComponent: TComponent; const CurName, NewName: string); override; Procedure SelectOnlyThisComponent(AComponent:TComponent); - procedure MouseUpOnForm(Sender : TObject; Button: TMouseButton; - Shift : TShiftState; X, Y: Integer); - procedure MouseDownOnForm(Sender : TObject; Button: TMouseButton; - Shift : TShiftState; X, Y: Integer); - procedure MouseMoveOnForm(Sender : TObject; Shift : TShiftState; X, Y: Integer); property IsControl: Boolean read GetIsControl write SetIsControl; property Form: TCustomForm read FCustomForm write FCustomForm; @@ -123,105 +118,11 @@ begin end; -procedure TDesigner.MouseDownOnForm(Sender : TObject; Button: TMouseButton; -Shift : TShiftState; X, Y: Integer); -Begin -Writeln('MOUSEDOWNONFORM'); - if GetCaptureGrabber<>nil then exit; - - MouseDownPos.X := X; - MouseDownPos.Y := Y; - MouseDownControl:=Sender; - LastMouseMovePos:=MouseDownPos; - -End; - -procedure TDesigner.MouseMoveOnForm(Sender : TObject; -Shift : TShiftState; X, Y: Integer); -var - CurDesigner: TDesigner; - CaptureGrabber:TGrabber; -Begin - Writeln('MouseMoveOnForm'); - CaptureGrabber:=GetCaptureGrabber; - if CaptureGrabber<>nil then begin - CaptureGrabber.CaptureMouseMove(TControl(Sender),Shift,X,Y); - end else begin - - if Assigned(MouseDownControl) then begin - LastMouseMovePos:=Point(X,Y); - end; - end; -End; - -procedure TDesigner.MouseUpOnForm(Sender : TObject; Button: TMouseButton; -Shift : TShiftState; X, Y: Integer); -var - ParentCI, NewCI : TComponentInterface; - NewLeft, NewTop, NewWidth, NewHeight : Integer; -// CInterface : TComponentInterface; - CaptureGrabber:TGrabber; -Begin - Writeln('MouseUpOnForm'); - CaptureGrabber:=GetCaptureGrabber; - if CaptureGrabber<>nil then begin - CaptureGrabber.CaptureMouseUp(TControl(Sender),Button,Shift,X,Y); - exit; - end; - MouseUpPos.X := X; - MouseUpPos.Y := Y; - - - if FMainIDE.SelectedComponent = nil then - Begin //mouse pointer button pressed. - SelectOnlyThisComponent(TComponent(Sender)); - end - else - Begin //add a new control - ParentCI:=TComponentInterface(FFormEditor.FindComponent(TComponent(Sender))); - if (TComponent(Sender) is TWinControl) - and (not (csAcceptsControls in TWinControl(Sender).ControlStyle)) then - begin - ParentCI:=TComponentInterface( - FFormEditor.FindComponent(TWinControl(Sender).Parent)); - end; - if Assigned(ParentCI) then begin - NewLeft:=Min(MouseDownPos.X,MouseUpPos.X); - NewWidth:=Abs(MouseUpPos.X-MouseDownPos.X); - NewTop:=Min(MouseDownPos.Y,MouseUpPos.Y); - NewHeight:=Abs(MouseUpPos.Y-MouseDownPos.Y); - if Abs(NewWidth+NewHeight)<7 then begin - // this very small component is probably only a wag, take default size - NewWidth:=0; - NewHeight:=0; - end; - NewCI := TComponentInterface(FFormEditor.CreateComponent(ParentCI,FMainIDE.SelectedComponent.ComponentClass - ,NewLeft,NewTop,NewWidth,NewHeight)); - NewCI.SetPropByName('Visible',True); //Control).Visible := True; - - ObjectInspector1.FillComponentComboBox; - AddControlCode(NewCI.Control); - Writeln('2222'); - if NewCI.Control is TControl then begin - // set the OnMouseDown and OnMouseUp event so we know when the control - // is selected or a new control is dropped - FMainIDE.SetDesigning(NewCI.Control); -// NewCI.SetPropByName('OnMouseUp',@MouseUpOnControl); -// NewCI.SetPropByName('OnMouseDown',@MouseDownOnControl); -// NewCI.SetPropByName('OnMouseMove',@MouseMoveOnControl); - SelectOnlyThisComponent(TComponent(NewCI.Control)); - end; - Writeln('Calling ControlClick with Nil from MouseUponForm'); - FMainIDE.ControlClick(FMainIDE.Notebook1); //this resets it to the mouse. - end; - end; - - MouseDownControl:=nil; - Writeln('Exiting MouseUPOnForm'); -end; - procedure TDesigner.MouseDownOnControl(Sender : TControl; Message : TLMessage); Begin + if assigned(MouseDownControl) and (MOuseDownControl <> Sender) then Exit; + Writeln('Left is '+Inttostr(TCOntrol(Sender).left)); + Writeln('Top is '+Inttostr(TCOntrol(Sender).Top)); Writeln('***************************'); Writeln('TDesigner.MouseDownOnControl'); Writeln(Format('X,Y = %d,%d',[TLMMOuse(Message).pos.x,TLMMOuse(Message).pos.Y])); @@ -241,11 +142,8 @@ Begin inc(MouseDownPos.Y,TControl(Sender).Top); end; - Writeln('Setting mousedowncontrol to'+TCOntrol(sender).name); MouseDownControl:=Sender; LastMouseMovePos:=MouseDownPos; - Writeln(TComponent(Sender).Name+'.OnMouseDown at '+inttostr(MouseDownPos.x) - +','+inttostr(MouseDownPos.Y)); if FMainIDE.SelectedComponent = nil then Begin //mouse pointer button pressed. @@ -271,6 +169,8 @@ var Shift : TShiftState; X,Y : Integer; Begin + + Writeln('***************************'); Writeln('In TDesigner.UpOnControl'); Writeln(Format('X,Y = %d,%d',[TLMMOuse(Message).pos.x,TLMMOuse(Message).pos.Y])); @@ -293,15 +193,26 @@ Begin Y := TLMMOuse(Message).pos.Y; CaptureGrabber:=GetCaptureGrabber; if CaptureGrabber<>nil then begin - Writeln('CaptureGrabber <> nil'); CaptureGrabber.CaptureMouseUp(TControl(Sender),Button,Shift,TLMMouse(Message).pos.X,TLMMouse(Message).pos.Y); exit; end; + if ((not (Sender is TCustomForm)) + or (( X < TControl(sender).left) or ( X > (TControl(sender).left+TControl(sender).Width))) + or (( Y < TControl(sender).Top) or ( Y > (TControl(sender).Top+TControl(sender).Height)))) then begin + inc(X,TControl(Sender).Left); + inc(Y,TControl(Sender).Top); + end; + + if MouseDownControl = Sender then Begin + Writeln('***************'); + Writeln(Format('MouseLAstPos.X,Y= %d,%d',[LastMOuseMovePos.X,LastMouseMovePos.Y])); + Writeln(Format('MouseDownPos.X,Y= %d,%d',[MOuseDownPos.X,MouseDownPos.Y])); + ControlSelection.MoveSelection(X-LastMouseMovePos.X, Y-LastMouseMovePos.Y); - //do somerthing like ControlSelection.Sizecontent but move x and y from where + //do something like ControlSelection.Sizecontent but move x and y from where // the grabber started to where it finished. ControlSelection.MoveContent(X-MouseDownPos.X,Y-MouseDownPos.Y); end; @@ -312,7 +223,6 @@ Begin inc(MouseUpPos.X,TControl(Sender).Left); inc(MouseUpPos.Y,TControl(Sender).Top); end; - Writeln(TComponent(Sender).Name+'.OnMouseUp at '+inttostr(TLMMouse(Message).pos.x)+','+inttostr(TLMMouse(Message).pos.y)); if FMainIDE.SelectedComponent = nil then Begin //mouse pointer button pressed. @@ -321,6 +231,8 @@ Begin end else Begin //add a new control + + FMainIDE.SetDesigning(FCustomForm,False); ParentCI:=TComponentInterface(FFormEditor.FindComponent(TComponent(Sender))); if (TComponent(Sender) is TWinControl) and (not (csAcceptsControls in TWinControl(Sender).ControlStyle)) then @@ -341,21 +253,18 @@ Begin NewCI := TComponentInterface(FFormEditor.CreateComponent(ParentCI,FMainIDE.SelectedComponent.ComponentClass ,NewLeft,NewTop,NewWidth,NewHeight)); NewCI.SetPropByName('Visible',True); //Control).Visible := True; - - ObjectInspector1.FillComponentComboBox; +{ if (NewCI.Control is TCOntrol) then Begin + Writeln('Setting visbile 2'); + TCOntrol(NewCI.Control).Visible := True; + end; +} ObjectInspector1.FillComponentComboBox; AddControlCode(NewCI.Control); - if NewCI.Control is TControl then begin - // set the OnMouseDown and OnMouseUp event so we know when the control - // is selected or a new control is dropped -//why cant I do this here??? NewCI.Control.SetDesigning(True); -// NewCI.SetPropByName('OnMouseUp',@MouseUpOnControl); -// NewCI.SetPropByName('OnMouseDown',@MouseDownOnControl); -// NewCI.SetPropByName('OnMouseMove',@MouseMoveOnControl); SelectOnlyThisComponent(TComponent(NewCI.Control)); - end; - Writeln('Calling ControlClick with ni from MouseUpOnControl'); + Writeln('Calling ControlClick with nil from MouseUpOnControl'); FMainIDE.ControlClick(FMainIDE.Notebook1); //this resets it to the mouse. + FMainIDE.SetDesigning(FCustomForm,True); + end; end; @@ -377,15 +286,23 @@ var Shift : TShiftState; X,Y : Integer; Begin + +// if assigned(MouseDownControl) and (MOuseDownControl <> Sender) then Exit; Writeln('MouseMoveOnControl'); X :=TLMMouse(Message).Pos.x; Y := TLMMouse(Message).Pos.Y; Writeln('MousePos'); Writeln(Format('X,y = %d,%d',[Mouse.CursorPos.X,MOuse.CursorPos.Y])); Writeln('X and Y are '+inttostr(x)+','+inttostr(y)); + If (sender is TControl) then Begin + Writeln('Sender is '+TControl(sender).Name); + Writeln('Left is '+Inttostr(TControl(sender).Left)); + Writeln('Width is '+Inttostr(TControl(sender).Width)); + Writeln('Top is '+Inttostr(TControl(sender).Top)); + Writeln('Height is '+Inttostr(TControl(sender).Height)); + end; + if Assigned(MouseDownControl) then Writeln('MouseDownControl is '+TCOntrol(MouseDownControl).Name); - -Writeln('Keys is '+inttostr(TlmMouse(Message).keys)); if (TLMMouse(Message).keys and MK_LButton) = MK_LButton then Button := mbLEft else @@ -400,19 +317,20 @@ Writeln('Keys is '+inttostr(TlmMouse(Message).keys)); CaptureGrabber:=GetCaptureGrabber; if CaptureGrabber<>nil then begin - Writeln('CaptureGrabber is <> nil'); CaptureGrabber.CaptureMouseMove(TControl(Sender),Shift,X,Y); end else begin if Assigned(MouseDownControl) then begin - Writeln('MouseDownControl is assigned'); if FMainIDE.SelectedComponent = nil then begin // mouse pointer button pressed - Writeln('SelectedComponent = nil'); - if not (Sender is TCustomForm) then begin // move selection - ControlSelection.MoveSelection( - X-LastMouseMovePos.X, Y-LastMouseMovePos.Y); + Writeln('moving stuff'); + { if not(X in ([0 ..(TControl(sender).Width)])) or + not(Y in ([0 ..(TControl(sender).Height)])) then + exit; } + ControlSelection.MoveSelection(X-LastMouseMovePos.X, Y-LastMouseMovePos.Y); +// ControlSelection.MoveContent(X-LastMouseMovePos.X, Y-LastMouseMovePos.Y); + LastMouseMovePos:=Point(X,Y); end; end; @@ -424,7 +342,14 @@ function TDesigner.IsDesignMsg(Sender: TControl; var Message: TLMessage): Boolea Begin result := false; if ((Message.msg >= LM_MOUSEFIRST) and (Message.msg <= LM_MOUSELAST)) then -Result := true; +Result := true +else +if ((Message.msg >= LM_KeyFIRST) and (Message.msg <= LM_KeyLAST)) then + Begin + Writeln('KEY MESSAGE in IsDesignMsg'); + Result := true; + end; + if (Message.msg=LM_LBUTTONDOWN) then begin @@ -437,7 +362,8 @@ if (Message.msg=LM_LBUTTONUP) then end else if Message.msg = LM_MOUSEMOVE then - MouseMoveonCOntrol(Sender, Message); + MouseMoveonCOntrol(Sender, Message) + {if Result then Writeln('It IS a design message') diff --git a/ide/main.pp b/ide/main.pp index fb50cc7d3c..e2d4ac2949 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -187,7 +187,7 @@ type Procedure FormKill(Sender : TObject); Procedure SetFlags(SLIst : TUnitInfo); Procedure SetName_Form(SList : TUnitInfo); - Procedure SetDesigning(Control : TComponent); + Procedure SetDesigning(Control : TComponent; Value : Boolean); procedure FormPaint(Sender : TObject); //these numbers are used to determine where the mouse was when the button was pressed MouseDownPos, MouseUpPos, LastMouseMovePos : TPoint; @@ -1138,9 +1138,9 @@ FControlLastActivated := Sender; end; -Procedure TMainIDE.SetDesigning(Control : TComponent); +Procedure TMainIDE.SetDesigning(Control : TComponent; Value : Boolean); Begin -Control.SetDesigning(True); +Control.SetDesigning(Value); end; @@ -1426,7 +1426,6 @@ begin 400,300)); TempForm:=TForm(CInterface.Control); - //TempForm.SetDesigning(true); TempForm.Designer := TDesigner.Create(TCustomForm(CInterface.Control)); @@ -1437,13 +1436,14 @@ begin TDesigner(tempForm.Designer).SourceEditor := SourceNotebook.CreateUnitFromForm(TempForm); - TempForm.OnMouseDown := @TDesigner(TempForm.Designer).MouseDownOnForm; - TempForm.OnMouseUp := @TDesigner(TempForm.Designer).MouseUpOnForm; - TempForm.OnMouseMove := @TDesigner(TempForm.Designer).MouseMoveOnForm; +// TempForm.OnMouseDown := @TDesigner(TempForm.Designer).MouseDownOnForm; +// TempForm.OnMouseUp := @TDesigner(TempForm.Designer).MouseUpOnForm; +// TempForm.OnMouseMove := @TDesigner(TempForm.Designer).MouseMoveOnForm; + TempForm.OnActivate := @CodeOrFormActivated; - Writeln('display form'); TempForm.Show; - Writeln('display form'); + + SetDesigning(TempForm,True); PropertyEditorHook1.LookupRoot := TForm(CInterface.Control); FormEditor1.ClearSelected; @@ -1890,6 +1890,10 @@ end. { ============================================================================= $Log$ + Revision 1.37 2001/01/09 18:23:20 lazarus + Worked on moving controls. It's just not working with the X and Y coord's I'm getting. + Shane + Revision 1.36 2001/01/08 23:48:33 lazarus MWE: ~ Changed makefiles diff --git a/lcl/extctrls.pp b/lcl/extctrls.pp index 43077165d5..de1f5053ac 100644 --- a/lcl/extctrls.pp +++ b/lcl/extctrls.pp @@ -163,7 +163,6 @@ type property ActivePage; property PageIndex; property Pages; - property Page; property PageList; property OnPageChanged; end; @@ -324,6 +323,10 @@ end. { $Log$ + Revision 1.5 2001/01/09 18:23:20 lazarus + Worked on moving controls. It's just not working with the X and Y coord's I'm getting. + Shane + Revision 1.4 2001/01/05 18:56:23 lazarus Minor changes diff --git a/lcl/include/control.inc b/lcl/include/control.inc index e8f2df453a..0fae2ab6d2 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -406,9 +406,6 @@ procedure TControl.WndPRoc(var Message : TLMessage); Var Form : TCustomForm; begin - if (csDesigning in ComponentState) then - Writeln('CSDesigning in ComponentState'); - if (csDesigning in ComponentState) then begin Form := GetParentForm(Self); @@ -704,8 +701,8 @@ procedure TControl.SetMouseCapture(Value : Boolean); const BOOLTXT: array[Boolean] of String = ('False', 'True'); begin - Assert(False, Format('trace:[TControl.SetMouseCapture] %s --> %s', [ClassName, BOOLTXT[Value]])); +Writeln('SetMOuseCapture '+Self.Classname); if MouseCapture <> Value then begin if Value @@ -991,14 +988,14 @@ Begin //The next line is commented out because it throws an exception. {if (CaptureControl <> self) and (dragging) then exit; - begin CaptureControl.Perform(CM_MOUSELEAVE,0,0); if not CaptureControl.Dragging then CaptureControl := Self; end; -} - if not (csNoStdEvents in COntrolStyle) + } + + if not (csNoStdEvents in COntrolStyle) then with Message do MouseMove(KeystoShiftState(Keys), XPos, YPos); @@ -1276,6 +1273,10 @@ end; { ============================================================================= $Log$ + Revision 1.9 2001/01/09 18:23:20 lazarus + Worked on moving controls. It's just not working with the X and Y coord's I'm getting. + Shane + Revision 1.8 2001/01/05 18:56:23 lazarus Minor changes diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index a26ef3f189..7f2ba8fb88 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -220,16 +220,13 @@ end; {------------------------------------------------------------------------------} Procedure TWinControl.CMDrag(var MEssage: TCMDrag); Begin -Assert(False, 'Trace:*********************'); -Assert(False, 'Trace:*********************'); -Assert(False, 'Trace:************CMDRAG*********'); -Assert(False, 'Trace:*********************'); with Message, DragRec^ do Begin case DragMessage of dmDragEnter, dmDragLEave,dmDragMOve, dmDragDrop : if target <> nil then TControl(target).DoDragMsg(Message); dmFindTarget:begin + Writeln('dmFindTarget'); result := longint(ControlatPos(ScreentoClient(pos),False)); if Result = 0 then Result := longint(Self); end; @@ -439,28 +436,33 @@ begin then begin // WriteLN(Format('[TWinControl.IsControlMouseMsg] %s --> We are capture', [ClassName])); Control := nil; -// if CaptureControl <> nil -// then WriteLN(Format('[TWinControl.IsControlMouseMsg] %s --> CaptureControl = %s', [ClassName, CaptureControl.ClassName])); - +{ if CaptureControl <> nil + then WriteLN(Format('[TWinControl.IsControlMouseMsg] %s --> CaptureControl = %s', [ClassName, CaptureControl.ClassName])); +} if (CaptureControl <> nil) and (CaptureControl.Parent = Self) then Control := CaptureControl; end else Control := ControlAtPos(SmallPointtoPoint(Message.Pos),False); + if CaptureControl <> nil + then WriteLN(Format('[TWinControl.IsControlMouseMsg] %s --> CaptureControl = %s', [ClassName, CaptureControl.ClassName])); + {if Control <> nil then - Writeln('---------------COntrol is present') + Writeln('---------------COntrol is present. Its '+TCOntrol(Control).name) else Writeln('ISCONTROLMOUSEMSG - Control=nil'); - } +} Result := False; if Control <> nil then begin +// Writeln('Control <> nil'); P.X := Message.XPos - Control.Left; P.Y := Message.YPos - Control.Top; // writeln('P.x and P.y = '+inttostr(p.x)+' '+inttostr(p.y)); -// WriteLN(Format('[TWinControl.IsControlMouseMsg] %s --> perform message', [ClassName])); +// WriteLN(Format('[TWinControl.IsControlMouseMsg] %s --> perform message', [Control.ClassName])); Control.Perform(Message.Msg, Message.Keys, LongInt(PointtoSmallPoint(P))); +// Writeln('done'); Result := True; end; end; @@ -1890,6 +1892,10 @@ end; { ============================================================================= $Log$ + Revision 1.7 2001/01/09 18:23:21 lazarus + Worked on moving controls. It's just not working with the X and Y coord's I'm getting. + Shane + Revision 1.6 2000/12/29 18:33:54 lazarus TStatusBar's create and destroy were not set to override TWinControls so they were never called. Shane diff --git a/lcl/interfaces/gtk/gtkcallback.inc b/lcl/interfaces/gtk/gtkcallback.inc index e57d6c8aaa..5331303168 100644 --- a/lcl/interfaces/gtk/gtkcallback.inc +++ b/lcl/interfaces/gtk/gtkcallback.inc @@ -331,6 +331,7 @@ var Msg: TLMMouseMove; ShiftState: TShiftState; begin + ShiftState := GTKEventState2ShiftState(Event^.State); with Msg do begin @@ -344,9 +345,13 @@ begin Writeln(' '+inttostr(XPos)); Writeln('Y = '); Writeln(' '+inttostr(YPos)); + Writeln('X_root = '); + Writeln(' '+inttostr(round(Event^.X_Root))); + Writeln('Y_root = '); + Writeln(' '+inttostr(round(Event^.Y_Root))); writeln('widget is ='+inttostr(longint(widget))); Writeln('------------------'); -} + } Keys := 0; if ssShift in ShiftState then Keys := Keys or MK_SHIFT; if ssCtrl in ShiftState then Keys := Keys or MK_CONTROL; @@ -1090,6 +1095,10 @@ end; { ============================================================================= $Log$ + Revision 1.11 2001/01/09 18:23:21 lazarus + Worked on moving controls. It's just not working with the X and Y coord's I'm getting. + Shane + Revision 1.10 2001/01/04 15:09:05 lazarus Tested TCustomEdit.Readonly, MaxLength and CharCase. Shane diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index bc56b69806..68c3f1d8b6 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -2000,9 +2000,12 @@ end; {------------------------------------------------------------------------------} procedure TgtkObject.ShowHide(Sender : TObject); begin - if TControl(Sender).Visible - then gtk_widget_show(PgtkWidget(TWinControl(Sender).Handle)) - else gtk_widget_hide(PgtkWidget(TWinControl(Sender).Handle)); + if TControl(Sender).Visible then begin + gtk_widget_show(PgtkWidget(TWinControl(Sender).Handle)) + end + else Begin + gtk_widget_hide(PgtkWidget(TWinControl(Sender).Handle)); + end; end; {------------------------------------------------------------------------------} @@ -2700,6 +2703,10 @@ end; { ============================================================================= $Log$ + Revision 1.16 2001/01/09 18:23:21 lazarus + Worked on moving controls. It's just not working with the X and Y coord's I'm getting. + Shane + Revision 1.15 2001/01/04 15:09:05 lazarus Tested TCustomEdit.Readonly, MaxLength and CharCase. Shane diff --git a/lcl/lresources.pp b/lcl/lresources.pp index 8a21212048..44462d21b0 100644 --- a/lcl/lresources.pp +++ b/lcl/lresources.pp @@ -140,7 +140,7 @@ begin StartPos:=-1; c:=' '; repeat - if (not (c in ['a'..'z','A'..'Z','0'..'9'])) then + if (not (c in ['a'..'z','A'..'Z','0'..'9','_'])) then StartPos:=LFMStream.Position; LFMStream.Read(c,1); if LFMStream.Position>1000 then exit;