Minor changees

Shane

git-svn-id: trunk@127 -
This commit is contained in:
lazarus 2001-01-18 13:27:31 +00:00
parent 5fff3549d0
commit 6bde1f02ae
6 changed files with 49 additions and 173 deletions

View File

@ -413,7 +413,7 @@ Writeln('ControlMOuseMove in TCOntrolSelection');
SetGrabbers;
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;
@ -425,7 +425,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;

View File

@ -175,15 +175,19 @@ Begin
if GetCaptureGrabber<>nil then exit;
MouseDownPos.X := TLMMOuse(Message).pos.X;
MouseDownPos.Y := TLMMOuse(Message).pos.Y;
//adjust X and Y by adding the Control corners.
if not (Sender is TCustomForm) then begin
inc(MouseDownPos.X,TControl(Sender).Left);
inc(MouseDownPos.Y,TControl(Sender).Top);
end;
if not assigned(MouseDownControl) then
Begin
MouseDownPos.X := TLMMOuse(Message).pos.X;
MouseDownPos.Y := TLMMOuse(Message).pos.Y;
//adjust X and Y by adding the Control corners.
MouseDownControl:=Sender;
if not (Sender is TCustomForm) then
begin
inc(MouseDownPos.X,TControl(Sender).Left);
inc(MouseDownPos.Y,TControl(Sender).Top);
end;
LastMouseMovePos:=MouseDownPos;
end;
Shift := [];
if (TLMMouse(Message).keys and MK_Shift) = MK_Shift then
@ -198,8 +202,7 @@ Begin
MouseDownControl:=Sender;
LastMouseMovePos:=MouseDownPos;
Writeln('Sender is '+sender.name);
if FMainIDE.SelectedComponent = nil then
Begin //mouse pointer button pressed.
@ -250,25 +253,18 @@ Begin
exit;
end;
if ((not (Sender is TCustomForm))
{ 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);
// ControlSelection.MoveSelection(X-LastMouseMovePos.X, Y-LastMouseMovePos.Y);
//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;
// ControlSelection.MoveContent(X-MouseDownPos.X,Y-MouseDownPos.Y);
MouseUpPos.X := TLMMouse(Message).pos.X;
MouseUpPos.Y := TLMMouse(Message).pos.Y;
@ -305,12 +301,11 @@ Begin
end;
NewCI := TComponentInterface(FFormEditor.CreateComponent(ParentCI,FMainIDE.SelectedComponent.ComponentClass
,NewLeft,NewTop,NewWidth,NewHeight));
NewCI.SetPropByName('Visible',True); //Control).Visible := True;
{ if (NewCI.Control is TCOntrol) then Begin
Writeln('Setting visbile 2');
TCOntrol(NewCI.Control).Visible := True;
end;
} ObjectInspector1.FillComponentComboBox;
NewCI.SetPropByName('Visible',True);
NewCI.SetPropByName('Designing',True);
FMainIDE.SetDesigning(NewCI.Control,True);
ObjectInspector1.FillComponentComboBox;
AddControlCode(NewCI.Control);
SelectOnlyThisComponent(TComponent(NewCI.Control));
@ -375,7 +370,7 @@ Begin
if Assigned(MouseDownControl) then begin
if FMainIDE.SelectedComponent = nil then begin
// mouse pointer button pressed
if not (Sender is TCustomForm) then begin
{ if not (Sender is TCustomForm) then} begin
// move selection
Writeln('moving stuff');
{ if not(X in ([0 ..(TControl(sender).Width)])) or

View File

@ -204,6 +204,7 @@ writeln('[TJITForms.DoCreateJITForm] Initializing new instance ...');
TComponent(FCurReadForm):=Instance;
try
Instance.Create(Application);
Writeln('New form name is '+NewFormName);
if NewFormName<>'' then
Instance.Name:=NewFormName;
DoRenameClass(FCurReadClass,NewClassName);

View File

@ -1165,7 +1165,9 @@ end;
Procedure TMainIDE.SetDesigning(Control : TComponent; Value : Boolean);
Begin
Writeln('Setting designing');
Control.SetDesigning(Value);
Writeln('Set');
end;
@ -1295,141 +1297,7 @@ begin
end;
}
{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{
Used when we click on a control that was created.
This can be used to detect when
a control is dropped onto a form
}
{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{procedure TMainIDE.MouseDownOnControl(Sender : TObject; Button: TMouseButton;
Shift : TShiftState; X, Y: Integer);
Begin
if GetCaptureGrabber<>nil then exit;
MouseDownPos.X := X;
MouseDownPos.Y := Y;
if not (Sender is TCustomForm) then begin
inc(MouseDownPos.X,TControl(Sender).Left);
inc(MouseDownPos.Y,TControl(Sender).Top);
end;
MouseDownControl:=Sender;
LastMouseMovePos:=MouseDownPos;
Writeln(TComponent(Sender).Name+'.OnMouseDown at '+inttostr(MouseDownPos.x)
+','+inttostr(MouseDownPos.Y)+' x='+IntToStr(x));
if SelectedComponent = nil then
Begin //mouse pointer button pressed.
if not (Sender is TCustomForm) then begin
SelectOnlyThisComponent(TComponent(Sender));
end;
end;
End;
procedure TMainIDE.MouseMoveOnControl(Sender : TObject;
Shift : TShiftState; X, Y: Integer);
var
CurDesigner: TDesigner;
CaptureGrabber:TGrabber;
Begin
CaptureGrabber:=GetCaptureGrabber;
if CaptureGrabber<>nil then begin
CaptureGrabber.CaptureMouseMove(TControl(Sender),Shift,X,Y);
end else begin
CurDesigner:=FindDesigner(TComponent(Sender));
if Assigned(MouseDownControl) then begin
if SelectedComponent = nil then begin
// mouse pointer button pressed
if not (Sender is TCustomForm) then begin
// move selection
if Assigned(CurDesigner) then begin
CurDesigner.ControlSelection.MoveSelection(
X-LastMouseMovePos.X, Y-LastMouseMovePos.Y);
LastMouseMovePos:=Point(X,Y);
end;
end;
end;
end;
end;
End;
procedure TMainIDE.MouseUpOnControl(Sender : TObject; Button: TMouseButton;
Shift : TShiftState; X, Y: Integer);
// We clicked on the form. Let's see what the active selection is in the IDE
// control bar. If it's the pointer, then we set the
// FormEditor1.SelectedComponents to Sender,
// otherwise we drop a control and call the CreateComponent function.
var
ParentCI, NewCI : TComponentInterface;
NewLeft, NewTop, NewWidth, NewHeight : Integer;
// CInterface : TComponentInterface;
CaptureGrabber:TGrabber;
Begin
CaptureGrabber:=GetCaptureGrabber;
if CaptureGrabber<>nil then begin
CaptureGrabber.CaptureMouseUp(TControl(Sender),Button,Shift,X,Y);
exit;
end;
MouseUpPos.X := X;
MouseUpPos.Y := Y;
if not (Sender is TCustomForm) then begin
inc(MouseUpPos.X,TControl(Sender).Left);
inc(MouseUpPos.Y,TControl(Sender).Top);
end;
Writeln(TComponent(Sender).Name+'.OnMouseUp at '+inttostr(x)+','+inttostr(y));
if SelectedComponent = nil then
Begin //mouse pointer button pressed.
if Sender is TCustomForm then
SelectOnlyThisComponent(TComponent(Sender));
end
else
Begin //add a new control
ParentCI:=TComponentInterface(FormEditor1.FindComponent(TComponent(Sender)));
if (TComponent(Sender) is TWinControl)
and (not (csAcceptsControls in TWinControl(Sender).ControlStyle)) then
begin
ParentCI:=TComponentInterface(
FormEditor1.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(FormEditor1.CreateComponent(ParentCI,SelectedComponent.ComponentClass
,NewLeft,NewTop,NewWidth,NewHeight));
NewCI.SetPropByName('Visible',True); //Control).Visible := True;
ObjectInspector1.FillComponentComboBox;
TDesigner(TForm(NewCI.Control.Owner).Designer).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
writeln('NewComponent is TControl');
NewCI.Control.SetDesigning(True);
// NewCI.SetPropByName('OnMouseUp',@MouseUpOnControl);
// NewCI.SetPropByName('OnMouseDown',@MouseDownOnControl);
// NewCI.SetPropByName('OnMouseMove',@MouseMoveOnControl);
SelectOnlyThisComponent(TComponent(NewCI.Control));
end;
end;
end;
MouseDownControl:=nil;
ControlClick(Notebook1); //this resets it to the mouse.
end;
}
{------------------------------------------------------------------------------}
procedure TMainIDE.mnuNewFormClicked(Sender : TObject);
var
@ -1456,7 +1324,6 @@ begin
SetDefaultsForForm(TempForm);
TDesigner(tempForm.Designer).SourceEditor := SourceNotebook.CreateUnitFromForm(TForm(TempForm));
TempForm.Show;
SetDesigning(TempForm,True);
PropertyEditorHook1.LookupRoot := TForm(CInterface.Control);
@ -1927,6 +1794,10 @@ end.
{ =============================================================================
$Log$
Revision 1.49 2001/01/18 13:27:30 lazarus
Minor changees
Shane
Revision 1.48 2001/01/16 23:30:45 lazarus
trying to determine what's crashing LAzarus on load.
Shane

View File

@ -650,6 +650,7 @@ begin
PI := _Control.ClassInfo;
nmControlType := PI^.Name;
Ancestor := GetAncestor;
Ancestor := 'TFORM';
//find the place in the code to add this now.
//Anyone have good method sfor parsing the source to find spots like this?
@ -657,9 +658,13 @@ begin
//not very good because it could be a comment or just a description of the class.
//but for now I'll use it.
For I := 0 to TempSource.Count-1 do
if (pos(Ancestor,TempSource.Strings[i]) <> 0) and (pos(TWinControl(_Control.Owner).Name,TempSource.Strings[i]) <> 0) and (pos('CLASS',Uppercase(TempSource.Strings[i])) <> 0) then
begin
Writeln('Ancestor is '+Ancestor);
Writeln('TWinControl(_Control.Owner).Name is '+TWinControl(_Control.Owner).Name);
Writeln('Line is '+TempSource.Strings[i]);
if (pos(Ancestor,TempSource.Strings[i]) <> 0) and (pos(lowercase(TWinControl(_Control.Owner).Name),lowercase(TempSource.Strings[i])) <> 0) and (pos('CLASS',Uppercase(TempSource.Strings[i])) <> 0) then
Break;
end;
//if I => FSource.Count then I didn't find the line...
@ -828,7 +833,7 @@ Begin
Add('uses Classes, Graphics, Controls, Forms, Dialogs;');
Add('');
Add('type');
Add(Format(' T%s = class(T%s)', [nmForm,nmAncestor]));
Add(Format(' T%s = class(T%s)', [nmForm,'FORM']));
Add(' private');
Add(' { private declarations }');
Add(' public');

View File

@ -1757,15 +1757,15 @@ var
R : TRect;
begin
if (ALeft = Left) and (ATop = Top) and (AWidth = Width) and (AHeight = Height) then Exit;
FLeft := aLeft;
FTop := aTop;
FWidth := aWidth;
FHeight := aHeight;
if HandleAllocated
then begin
R:= Rect(ALeft, ATop, AWidth, AHeight);
CNSendMessage(LM_SetSize, Self, @R);
FLeft := aLeft;
FTop := aTop;
FWidth := aWidth;
FHeight := aHeight;
end
else inherited SetBounds(aLeft, aTop, aWidth, aHeight);
end;
@ -1895,6 +1895,10 @@ end;
{ =============================================================================
$Log$
Revision 1.10 2001/01/18 13:27:31 lazarus
Minor changees
Shane
Revision 1.9 2001/01/15 18:25:51 lazarus
Fixed a stupid error I caused by using a variable as an index in main.pp and this variable sometimes caused an exception because the index was out of range.
Shane