Recent

Author Topic: A feature for Lazarus?  (Read 8173 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: A feature for Lazarus?
« Reply #15 on: May 22, 2013, 08:41:42 pm »
The best improvement to the OI would be to resolve Bugtracker issue 0023891: Misbehavior on moving/resizing LCL components designtime.

That one drives me crazy.  %)  I know what the cause is but I still fall in to that trap often.  Recovery isn't difficult once you know what causes it, but it's still annoying.  And I can only guess what people think if they don't know about that trap.
Lazarus Trunk / fpc 2.6.2 / Win32

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3610
  • I like bugs.
Re: A feature for Lazarus?
« Reply #16 on: May 22, 2013, 09:52:43 pm »
The best improvement to the OI would be to resolve Bugtracker issue 0023891: Misbehavior on moving/resizing LCL components designtime.

Patches are welcome for it, too.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5465
    • wiki
Re: A feature for Lazarus?
« Reply #17 on: May 23, 2013, 01:26:01 am »
The below patch "fixes" half of the issue.

BUt it is wrong in a few ways.
- It does not solve the fact that moving in one direction is locked.
- the enable/disable calls are  implemented in a bad way. Works now, but invite errors in future. IF they are to be used (not sure, there may be a better solution without them / there probably is) then they should allow multiply nested invocations, by using a counter instead

Anyway this is probably the wrong fix, but I do not know the designer at all....

A more correct solution would probably be, to prevent the prop editor from writing the value to the control at all, since the value came from the control.



Index: designer/controlselection.pp
===================================================================
--- designer/controlselection.pp   (revision 41361)
+++ designer/controlselection.pp   (working copy)
@@ -413,6 +413,8 @@
     procedure SaveBounds;
     procedure UpdateBounds;
     procedure RestoreBounds;
+    procedure DisableSaveBounds;
+    procedure EnableSaveBounds;
 
     function MoveSelection(dx, dy: integer; TotalDeltas: Boolean): Boolean;
     function MoveSelectionWithSnapping(TotalDx, TotalDy: integer): Boolean;
@@ -1124,6 +1126,16 @@
   EndUpdate;
 end;
 
+procedure TControlSelection.DisableSaveBounds;
+begin
+  Include(FStates,cssDoNotSaveBounds);
+end;
+
+procedure TControlSelection.EnableSaveBounds;
+begin
+  Exclude(FStates,cssDoNotSaveBounds);
+end;
+
 procedure TControlSelection.AdjustGrabbers;
 var g:TGrabIndex;
   OutPix, InPix, NewGrabberLeft, NewGrabberTop: integer;
Index: designer/designer.pp
===================================================================
--- designer/designer.pp   (revision 41361)
+++ designer/designer.pp   (working copy)
@@ -2276,6 +2276,7 @@
             Include(FFlags, dfHasSized);
           end;
           //debugln('TDesigner.MouseMoveOnControl Move MouseDownComponent=',dbgsName(MouseDownComponent),' OldMouseMovePos=',dbgs(OldMouseMovePos),' MouseMovePos',dbgs(LastMouseMovePos),' MouseDownPos=',dbgs(MouseDownPos));
+          ControlSelection.DisableSaveBounds;
           if (ssAlt in Shift) then begin
             if ControlSelection.MoveSelection(LastMouseMovePos.X - MouseDownPos.X, LastMouseMovePos.Y - MouseDownPos.Y, True) then
               DoModified;
@@ -2283,6 +2284,7 @@
             if ControlSelection.MoveSelectionWithSnapping(LastMouseMovePos.X - MouseDownPos.X, LastMouseMovePos.Y - MouseDownPos.Y) then
               DoModified;
           end;
+          ControlSelection.EnableSaveBounds;
         end
         else
         begin
« Last Edit: May 23, 2013, 01:30:00 am by Martin_fr »

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: A feature for Lazarus?
« Reply #18 on: May 31, 2013, 06:47:11 am »
This is Visual Studio's answer to grouping.  I haven't really tried it in a real project so I can't say just how useful it is.  But at first glance it does seem to be nice.
Lazarus Trunk / fpc 2.6.2 / Win32