Re: [PATCH] Setup: more intuitive resizing controls + some dialogs

2003-11-02 Thread Robert Collins
On Sun, 2003-11-02 at 13:01, Igor Pechtchanski wrote:
 On Sun, 2 Nov 2003, Robert Collins wrote:
 Ah, I see.  We must have different definitions of centered.  I view
 CP_MIDDLE as same size but centered around the new position, which
 will require the left and right edges to be adjusted evenly.  You seem to
 be thinking of centered as stretch proportionally to the position in
 the dialog...  In other words, in the above example the control should
 end up at 30,49 using my definition (keeping its size at 20).  I'm not
 convinced it's a bug.  We could, of course, add other positioning controls
 (e.g., CP_SMARTSTRETCH) that do what you want.

Ok, turned into CP_CENTERED.

Rob

-- 
GPG key available at: http://members.aardvark.net.au/lifeless/keys.txt.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] Setup: more intuitive resizing controls + some dialogs

2003-11-01 Thread Robert Collins
On Sat, 2003-11-01 at 14:35, Igor Pechtchanski wrote:
 As promised.
   Igor
 ==
 ChangeLog:
 2003-10-31  Igor Pechtchanski  [EMAIL PROTECTED]
 

Applied. I think there's a bug in the MIDDLE enum handling though. I've
factored the code to be less redundant - please check...

There are still a few quirks - like the mirror selection page.

Lastly, do the vertical coords need adjusting to client coord ?

Rob

-- 
GPG key available at: http://members.aardvark.net.au/lifeless/keys.txt.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] Setup: more intuitive resizing controls + some dialogs

2003-11-01 Thread Igor Pechtchanski
On Sat, 1 Nov 2003, Robert Collins wrote:

 On Sat, 2003-11-01 at 14:35, Igor Pechtchanski wrote:
  As promised.
Igor
  ==
  ChangeLog:
  2003-10-31  Igor Pechtchanski  [EMAIL PROTECTED]
 

 Applied. I think there's a bug in the MIDDLE enum handling though. I've
 factored the code to be less redundant - please check...

Hmm, if there's a bug, I don't see quite what it is.  Would you mind
elaborating?

The factored out code looks good, BTW.

 There are still a few quirks - like the mirror selection page.

Details, please?

 Lastly, do the vertical coords need adjusting to client coord ?
 Rob

They do, and they are adjusted.  ScreenToClient takes a pointer to a
POINT, which consists of two values (x,y).  The way it's invoked, the
first call gets the (left,top) coords, and the second gets (right,bottom).
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster.  -- Patrick Naughton


Re: [PATCH] Setup: more intuitive resizing controls + some dialogs

2003-11-01 Thread Robert Collins
On Sun, 2003-11-02 at 07:20, Igor Pechtchanski wrote:
 On Sat, 1 Nov 2003, Robert Collins wrote:
 
  On Sat, 2003-11-01 at 14:35, Igor Pechtchanski wrote:
   As promised.
 Igor
   ==
   ChangeLog:
   2003-10-31  Igor Pechtchanski  [EMAIL PROTECTED]
  
 
  Applied. I think there's a bug in the MIDDLE enum handling though. I've
  factored the code to be less redundant - please check...
 
 Hmm, if there's a bug, I don't see quite what it is.  Would you mind
 elaborating?

the stretch adjustment moves both left and right by delta/2. If we had a
window 0,39, with a control at 10,29, and we resize the window to 0,79 -
a delta of 40, we'd want the control to end up at 20,59 - that is the
left adjusted by delta/4 and the right by 3/4 delta.

 Details, please?

When I resize it vertically, the url field label stays put.

Cheers,
Rob

-- 
GPG key available at: http://members.aardvark.net.au/lifeless/keys.txt.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] Setup: more intuitive resizing controls + some dialogs

2003-11-01 Thread Igor Pechtchanski
On Sun, 2 Nov 2003, Robert Collins wrote:

 On Sun, 2003-11-02 at 07:20, Igor Pechtchanski wrote:
  On Sat, 1 Nov 2003, Robert Collins wrote:
 
   On Sat, 2003-11-01 at 14:35, Igor Pechtchanski wrote:
As promised.
  Igor
==
ChangeLog:
2003-10-31  Igor Pechtchanski  [EMAIL PROTECTED]
   
  
   Applied. I think there's a bug in the MIDDLE enum handling though. I've
   factored the code to be less redundant - please check...
 
  Hmm, if there's a bug, I don't see quite what it is.  Would you mind
  elaborating?

 the stretch adjustment moves both left and right by delta/2. If we had a
 window 0,39, with a control at 10,29, and we resize the window to 0,79 -
 a delta of 40, we'd want the control to end up at 20,59 - that is the
 left adjusted by delta/4 and the right by 3/4 delta.

Ah, I see.  We must have different definitions of centered.  I view
CP_MIDDLE as same size but centered around the new position, which
will require the left and right edges to be adjusted evenly.  You seem to
be thinking of centered as stretch proportionally to the position in
the dialog...  In other words, in the above example the control should
end up at 30,49 using my definition (keeping its size at 20).  I'm not
convinced it's a bug.  We could, of course, add other positioning controls
(e.g., CP_SMARTSTRETCH) that do what you want.

  Details, please?

 When I resize it vertically, the url field label stays put.

 Cheers,
 Rob

Ok, I'll look into this.
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster.  -- Patrick Naughton


[PATCH] Setup: more intuitive resizing controls + some dialogs

2003-10-31 Thread Igor Pechtchanski
On Sun, 19 Oct 2003, Igor Pechtchanski wrote:

 On Thu, 16 Oct 2003, Igor Pechtchanski wrote:

  On Thu, 16 Oct 2003, Frank Richter wrote:
 
   On 16.10.2003 22:29, Robert Collins wrote:
Before further review, I'd like you to correct
such abuses of C++.
  
   Done.
  
   Also, this patch is a bit more useful than the last one - the Chooser
   now sizes with the window.
  
   - f.r.
 
  Okay, this does indeed give us a resizeable chooser -- yuppee!!!  The
  header row still behaves weirdly under Win2k (i.e., it fixes on a
  particular size and won't bulge until a scroll bar is touched after
  switching views), but it's something that can be lived with.
 
  Once this gets accepted, it would be relatively easy to make most other
  dialogs resizeable.  One problem, as I mentioned before, would be with
  items that need to be centered.
 
  Frank, thank you *very much* for doing this.
  Igor

 Rob, BTW, when this patch gets accepted, I have an idea on how to modify
 this code to allow more intuitive control over the elements (e.g.,
 centering).  I'll also be able to make most of the other dialogs
 resizeable.
 Igor

As promised.
Igor
==
ChangeLog:
2003-10-31  Igor Pechtchanski  [EMAIL PROTECTED]

* ControlAdjuster.h (ControlPosition): New enum type.
(ControlInfo::horizontalPos, ControlInfo::verticalPos): New
instance variables.
(ControlInfo::anchorLeft, ControlInfo::anchorTop,
ControlInfo::anchorRight, ControlInfo::anchorBottom): Remove.
* ControlAdjuster.cc (ControlAdjuster::AdjustControls): Switch to
using position specifiers instead of anchors.
* choose.cc (ChooserControlsInfo): Ditto.
* proppage.cc (DefaultControlsInfo): Ditto.
* propsheet.cc (PropSheetControlsInfo): Ditto.
* site.cc (SiteControlsInfo): Position specifiers for site
selection dialog controls.
* threebar.cc (ThreeBarControlsInfo): Position specifiers for
progress dialog controls.

-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster.  -- Patrick NaughtonIndex: ControlAdjuster.cc
===
RCS file: /cvs/cygwin-apps/setup/ControlAdjuster.cc,v
retrieving revision 2.1
diff -u -p -r2.1 ControlAdjuster.cc
--- ControlAdjuster.cc  26 Oct 2003 19:38:30 -  2.1
+++ ControlAdjuster.cc  1 Nov 2003 03:12:34 -
@@ -35,18 +35,40 @@ void ControlAdjuster::AdjustControls (HW
   
   /*
 Now adjust the rectangle.
-   If an anchor is set, the resp. edge is 'sticky' with respect to the
-   opposite border.
*/
-  if (!ci-anchorLeft) 
-ctlRect.left += widthChange;
-  if (!ci-anchorTop) 
-ctlRect.top += heightChange;
-  if (ci-anchorRight) 
-ctlRect.right += widthChange;
-  if (ci-anchorBottom) 
-ctlRect.bottom += heightChange;
-   
+  switch (ci-horizontalPos)
+  {
+   case CP_LEFT:
+ break;
+   case CP_MIDDLE:
+ ctlRect.left += widthChange/2;
+ ctlRect.right += widthChange - widthChange/2;
+ break;
+   case CP_RIGHT:
+ ctlRect.left += widthChange;
+ ctlRect.right += widthChange;
+ break;
+   case CP_STRETCH:
+ ctlRect.right += widthChange;
+ break;
+  }
+  switch (ci-verticalPos)
+  {
+   case CP_TOP:
+ break;
+   case CP_MIDDLE:
+ ctlRect.top += heightChange/2;
+ ctlRect.bottom += heightChange - heightChange/2;
+ break;
+   case CP_BOTTOM:
+ ctlRect.top += heightChange;
+ ctlRect.bottom += heightChange;
+ break;
+   case CP_STRETCH:
+ ctlRect.bottom += heightChange;
+ break;
+  }
+
   SetWindowPos (ctl, 0, ctlRect.left, ctlRect.top, 
ctlRect.width (), ctlRect.height (), SWP_NOACTIVATE | SWP_NOZORDER);
   // If not done, weird visual glitches can occur.
Index: ControlAdjuster.h
===
RCS file: /cvs/cygwin-apps/setup/ControlAdjuster.h,v
retrieving revision 2.1
diff -u -p -r2.1 ControlAdjuster.h
--- ControlAdjuster.h   26 Oct 2003 19:38:30 -  2.1
+++ ControlAdjuster.h   1 Nov 2003 03:12:34 -
@@ -28,6 +28,15 @@
   when the size changes.
  */
 
+enum ControlPosition {
+  CP_LEFT = 0,
+  CP_TOP = CP_LEFT,
+  CP_MIDDLE,
+  CP_RIGHT,
+  CP_BOTTOM = CP_RIGHT,
+  CP_STRETCH,
+};
+
 class ControlAdjuster
 {
 public:
@@ -36,12 +45,10 @@ public:
 //