delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/03/26/16:44:06

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
Date: Mon, 26 Mar 2012 13:41:11 -0700
From: Andrew Poelstra <asp11 AT sfu DOT ca>
To: gEDA user mailing list <geda-user AT delorie DOT com>
Subject: [geda-user] RFC: increment dialog patch
Message-ID: <20120326204111.GA23076@malakian.lan>
MIME-Version: 1.0
User-Agent: Mutt/1.5.20 (2009-12-10)
Reply-To: geda-user AT delorie DOT com

Hey all,


I have finally decided to take a look at bug 699464:

https://bugs.launchpad.net/pcb/+bug/699464

This bug is regarding the fact that the Preferences->Increments dialog
does nothing as of now. (Nothing is saved, and the relevant values are
ignored by gpcb-menu.res.)

The following partial fix changes gpcb-menu.res to give 0 to the
ChangeSize funtions, rather than the hardcoded +/-5mil. The functions
then interpret 0 as "preference-defined value". Therefore, the dialog
will affect the current session, though the preferences are still not
saved.

(Actually, it passes "+" and "-" instead of 0. My recent commit d4ec435e
is needed for GetValue() to have correct behavior for this input.)


This is a user-visible change, so I am posting it for comments before
pushing.


diff --git a/src/action.c b/src/action.c
index 700bf29..b29d40b 100644
--- a/src/action.c
+++ b/src/action.c
@@ -2193,6 +2193,9 @@ ActionSetValue (int argc, char **argv, Coord x, Coord y)
 	    SetGrid (value, false);
 	  else
 	    {
+              if (value == 0)
+                value = val[0] == '-' ? -Settings.increments->grid
+                                      :  Settings.increments->grid;
               /* On the way down, short against the minimum 
                * PCB drawing unit */
               if ((value + PCB->Grid) < 1)
@@ -2206,6 +2209,9 @@ ActionSetValue (int argc, char **argv, Coord x, Coord y)
 
 	case F_LineSize:
 	case F_Line:
+          if (!absolute && value == 0)
+            value = val[0] == '-' ? -Settings.increments->line
+                                  :  Settings.increments->line;
 	  SetLineSize (absolute ? value : value + Settings.LineThickness);
 	  hid_action ("RouteStylesChanged");
 	  break;
@@ -4048,6 +4054,9 @@ ActionChangeSize (int argc, char **argv, Coord x, Coord y)
   if (function && delta)
     {
       value = GetValue (delta, units, &absolute);
+      if (value == 0)
+        value = delta[0] == '-' ? -Settings.increments->size
+                                :  Settings.increments->size;
       switch (GetFunctionID (function))
 	{
 	case F_Object:
@@ -4207,6 +4216,9 @@ ActionChangeClearSize (int argc, char **argv, Coord x, Coord y)
   if (function && delta)
     {
       value = 2 * GetValue (delta, units, &absolute);
+      if (value == 0)
+        value = delta[0] == '-' ? -Settings.increments->clear
+                                :  Settings.increments->clear;
       switch (GetFunctionID (function))
 	{
 	case F_Object:
diff --git a/src/gpcb-menu.res.in b/src/gpcb-menu.res.in
index 0c15b1c..f28edff 100644
--- a/src/gpcb-menu.res.in
+++ b/src/gpcb-menu.res.in
@@ -144,10 +144,8 @@ MainMenu =
     {"0.5 mm"  checked=gridsize,0.50mm SetUnits(mm) SetValue(Grid,0.5mm)}
     {"1 mm"    checked=gridsize,1mm SetUnits(mm) SetValue(Grid,1mm)}
     -
-    {"Grid -5mil" SetValue(Grid,-5,mil) a={"Shift-G" "Shift<Key>g"}}
-    {"Grid +5mil" SetValue(Grid,+5,mil) a={"G" "<Key>g"}}
-    {"Grid -0.05mm" SetValue(Grid,-0.05,mm) a={"Shift-Ctrl-G" "Shift Ctrl<Key>g"}}
-    {"Grid +0.05mm" SetValue(Grid,+0.05,mm) a={"Ctrl-G" "Ctrl<Key>g"}}
+    {"Grid -" SetValue(Grid,-) a={"Shift-G" "Shift<Key>g"}}
+    {"Grid +" SetValue(Grid,+) a={"G" "<Key>g"}}
    }
    {"Realign grid" GetXY(Click to set the grid origin) Display(ToggleGrid)}
    -
@@ -400,12 +398,12 @@ MainMenu =
     {"ChangeHole Object" a={"Ctrl-H" "Ctrl<Key>h"} ChangeHole(Object)}
     {"ChangeJoin Object" a={"J" "<Key>j"} ChangeJoin(Object)}
     {"ChangeJoin SelectedObject" a={"Shift-J" "Shift<Key>j"} ChangeJoin(SelectedObjects)}
-    {"Clear Object +2 mil" a={"K" "<Key>k"} ChangeClearSize(Object,+2,mil)}
-    {"Clear Object -2 mil" a={"Shift-K" "Shift<Key>k"} ChangeClearSize(Object,-2,mil)}
-    {"Clear Selected +2 mil" a={"Ctrl-K" "Ctrl<Key>k"} ChangeClearSize(SelectedObjects,+2,mil)}
-    {"Clear Selected -2 mil" a={"Shift-Ctrl-K" "Shift Ctrl<Key>k"} ChangeClearSize(SelectedObjects,-2,mil)}
-    {"Line Tool size +5 mil" a={"L" "<Key>l"} SetValue(LineSize,+5,mil)}
-    {"Line Tool size -5 mil" a={"Shift-L" "Shift<Key>l"} SetValue(LineSize,-5,mil)}
+    {"Clear Object +" a={"K" "<Key>k"} ChangeClearSize(Object,+)}
+    {"Clear Object -" a={"Shift-K" "Shift<Key>k"} ChangeClearSize(Object,-)}
+    {"Clear Selected +" a={"Ctrl-K" "Ctrl<Key>k"} ChangeClearSize(SelectedObjects,+)}
+    {"Clear Selected -" a={"Shift-Ctrl-K" "Shift Ctrl<Key>k"} ChangeClearSize(SelectedObjects,-)}
+    {"Line Tool size +" a={"L" "<Key>l"} SetValue(LineSize,+)}
+    {"Line Tool size -" a={"Shift-L" "Shift<Key>l"} SetValue(LineSize,-)}
     {"Move Object to current layer" a={"M" "<Key>m"} MoveToCurrentLayer(Object)}
     {"MarkCrosshair" a={"Ctrl-M" "Ctrl<Key>m"} MarkCrosshair()}
     {"Select shortest rat" a={"Shift-N" "Shift<Key>n"} AddRats(Close)}
@@ -419,8 +417,8 @@ MainMenu =
     {"Polygon PreviousPoint" a={"P" "<Key>p"} Polygon(PreviousPoint)}
     {"Polygon Close" a={"Shift-P" "Shift<Key>p"} Polygon(Close)}
     {"ChangeSquare Object" a={"Q" "<Key>q"} ChangeSquare(ToggleObject)}
-    {"ChangeSize +5 mil" a={"S" "<Key>s"} ChangeSize(Object,+5,mil)}
-    {"ChangeSize -5 mil" a={"Shift-S" "Shift<Key>s"} ChangeSize(Object,-5,mil)}
+    {"ChangeSize +" a={"S" "<Key>s"} ChangeSize(Object,+)}
+    {"ChangeSize -" a={"Shift-S" "Shift<Key>s"} ChangeSize(Object,-)}
     {"ChangeDrill +5 mil" a={"Alt-S" "Alt<Key>s"} ChangeDrillSize(Object,+5,mil)}
     {"ChangeDrill -5 mil" a={"Alt-Shift-S" "Alt Shift<Key>s"} ChangeDrillSize(Object,-5,mil)}
     {"Text Tool scale +10 mil" a={"T" "<Key>t"} SetValue(TextScale,+10,mil)}
diff --git a/src/pcb-menu.res.in b/src/pcb-menu.res.in
index 7e6e8bd..84c4a45 100644
--- a/src/pcb-menu.res.in
+++ b/src/pcb-menu.res.in
@@ -111,10 +111,8 @@ MainMenu =
     {"0.5 mm"  checked=gridsize,0.50mm SetUnits(mm) SetValue(Grid,0.5mm)}
     {"1 mm"    checked=gridsize,1mm SetUnits(mm) SetValue(Grid,1mm)}
     -
-    {"Grid -5mil" SetValue(Grid,-5,mil) a={"Shift-G" "Shift<Key>g"}}
-    {"Grid +5mil" SetValue(Grid,+5,mil) a={"G" "<Key>g"}}
-    {"Grid -0.05mm" SetValue(Grid,-0.05,mm) a={"Shift-Ctrl-G" "Shift Ctrl<Key>g"}}
-    {"Grid +0.05mm" SetValue(Grid,+0.05,mm) a={"Ctrl-G" "Ctrl<Key>g"}}
+    {"Grid -" SetValue(Grid,-) a={"Shift-G" "Shift<Key>g"}}
+    {"Grid +" SetValue(Grid,+) a={"G" "<Key>g"}}
    }
    -
    {"Shown Layers"
@@ -383,12 +381,12 @@ MainMenu =
     {"ChangeHole Object" a={"Ctrl-H" "Ctrl<Key>h"} ChangeHole(Object)}
     {"ChangeJoin Object" a={"J" "<Key>j"} ChangeJoin(Object)}
     {"ChangeJoin SelectedObject" a={"Shift-J" "Shift<Key>j"} ChangeJoin(SelectedObjects)}
-    {"Clear Object +2 mil" a={"K" "<Key>k"} ChangeClearSize(Object,+2,mil)}
-    {"Clear Object -2 mil" a={"Shift-K" "Shift<Key>k"} ChangeClearSize(Object,-2,mil)}
-    {"Clear Selected +2 mil" a={"Ctrl-K" "Ctrl<Key>k"} ChangeClearSize(SelectedObjects,+2,mil)}
-    {"Clear Selected -2 mil" a={"Shift-Ctrl-K" "Shift Ctrl<Key>k"} ChangeClearSize(SelectedObjects,-2,mil)}
-    {"Line Tool size +5 mil" a={"L" "<Key>l"} SetValue(LineSize,+5,mil)}
-    {"Line Tool size -5 mil" a={"Shift-L" "Shift<Key>l"} SetValue(LineSize,-5,mil)}
+    {"Clear Object +" a={"K" "<Key>k"} ChangeClearSize(Object,+)}
+    {"Clear Object -" a={"Shift-K" "Shift<Key>k"} ChangeClearSize(Object,-)}
+    {"Clear Selected +" a={"Ctrl-K" "Ctrl<Key>k"} ChangeClearSize(SelectedObjects,+)}
+    {"Clear Selected -" a={"Shift-Ctrl-K" "Shift Ctrl<Key>k"} ChangeClearSize(SelectedObjects,-)}
+    {"Line Tool size +" a={"L" "<Key>l"} SetValue(LineSize,+)}
+    {"Line Tool size -" a={"Shift-L" "Shift<Key>l"} SetValue(LineSize,-)}
     {"Move Object to current layer" a={"M" "<Key>m"} MoveToCurrentLayer(Object)}
     {"MarkCrosshair" a={"Ctrl-M" "Ctrl<Key>m"} MarkCrosshair()}
     {"Select shortest rat" a={"Shift-N" "Shift<Key>n"} AddRats(Close)}
@@ -402,8 +400,8 @@ MainMenu =
     {"Polygon PreviousPoint" a={"P" "<Key>p"} Polygon(PreviousPoint)}
     {"Polygon Close" a={"Shift-P" "Shift<Key>p"} Polygon(Close)}
     {"ChangeSquare Object" a={"Q" "<Key>q"} ChangeSquare(Object)}
-    {"ChangeSize +5 mil" a={"S" "<Key>s"} ChangeSize(Object,+5,mil)}
-    {"ChangeSize -5 mil" a={"Shift-S" "Shift<Key>s"} ChangeSize(Object,-5,mil)}
+    {"ChangeSize +" a={"S" "<Key>s"} ChangeSize(Object,+)}
+    {"ChangeSize -" a={"Shift-S" "Shift<Key>s"} ChangeSize(Object,-)}
     {"ChangeDrill +5 mil" a={"Alt-S" "Alt<Key>s"} ChangeDrillSize(Object,+5,mil)}
     {"ChangeDrill -5 mil" a={"Alt-Shift-S" "Alt Shift<Key>s"} ChangeDrillSize(Object,-5,mil)}
     {"Text Tool scale +10 mil" a={"T" "<Key>t"} SetValue(TextScale,+10,mil)}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019