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 To: gEDA user mailing list Subject: [geda-user] RFC: increment dialog patch Message-ID: <20120326204111.GA23076@malakian.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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" "Shiftg"}} - {"Grid +5mil" SetValue(Grid,+5,mil) a={"G" "g"}} - {"Grid -0.05mm" SetValue(Grid,-0.05,mm) a={"Shift-Ctrl-G" "Shift Ctrlg"}} - {"Grid +0.05mm" SetValue(Grid,+0.05,mm) a={"Ctrl-G" "Ctrlg"}} + {"Grid -" SetValue(Grid,-) a={"Shift-G" "Shiftg"}} + {"Grid +" SetValue(Grid,+) a={"G" "g"}} } {"Realign grid" GetXY(Click to set the grid origin) Display(ToggleGrid)} - @@ -400,12 +398,12 @@ MainMenu = {"ChangeHole Object" a={"Ctrl-H" "Ctrlh"} ChangeHole(Object)} {"ChangeJoin Object" a={"J" "j"} ChangeJoin(Object)} {"ChangeJoin SelectedObject" a={"Shift-J" "Shiftj"} ChangeJoin(SelectedObjects)} - {"Clear Object +2 mil" a={"K" "k"} ChangeClearSize(Object,+2,mil)} - {"Clear Object -2 mil" a={"Shift-K" "Shiftk"} ChangeClearSize(Object,-2,mil)} - {"Clear Selected +2 mil" a={"Ctrl-K" "Ctrlk"} ChangeClearSize(SelectedObjects,+2,mil)} - {"Clear Selected -2 mil" a={"Shift-Ctrl-K" "Shift Ctrlk"} ChangeClearSize(SelectedObjects,-2,mil)} - {"Line Tool size +5 mil" a={"L" "l"} SetValue(LineSize,+5,mil)} - {"Line Tool size -5 mil" a={"Shift-L" "Shiftl"} SetValue(LineSize,-5,mil)} + {"Clear Object +" a={"K" "k"} ChangeClearSize(Object,+)} + {"Clear Object -" a={"Shift-K" "Shiftk"} ChangeClearSize(Object,-)} + {"Clear Selected +" a={"Ctrl-K" "Ctrlk"} ChangeClearSize(SelectedObjects,+)} + {"Clear Selected -" a={"Shift-Ctrl-K" "Shift Ctrlk"} ChangeClearSize(SelectedObjects,-)} + {"Line Tool size +" a={"L" "l"} SetValue(LineSize,+)} + {"Line Tool size -" a={"Shift-L" "Shiftl"} SetValue(LineSize,-)} {"Move Object to current layer" a={"M" "m"} MoveToCurrentLayer(Object)} {"MarkCrosshair" a={"Ctrl-M" "Ctrlm"} MarkCrosshair()} {"Select shortest rat" a={"Shift-N" "Shiftn"} AddRats(Close)} @@ -419,8 +417,8 @@ MainMenu = {"Polygon PreviousPoint" a={"P" "p"} Polygon(PreviousPoint)} {"Polygon Close" a={"Shift-P" "Shiftp"} Polygon(Close)} {"ChangeSquare Object" a={"Q" "q"} ChangeSquare(ToggleObject)} - {"ChangeSize +5 mil" a={"S" "s"} ChangeSize(Object,+5,mil)} - {"ChangeSize -5 mil" a={"Shift-S" "Shifts"} ChangeSize(Object,-5,mil)} + {"ChangeSize +" a={"S" "s"} ChangeSize(Object,+)} + {"ChangeSize -" a={"Shift-S" "Shifts"} ChangeSize(Object,-)} {"ChangeDrill +5 mil" a={"Alt-S" "Alts"} ChangeDrillSize(Object,+5,mil)} {"ChangeDrill -5 mil" a={"Alt-Shift-S" "Alt Shifts"} ChangeDrillSize(Object,-5,mil)} {"Text Tool scale +10 mil" a={"T" "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" "Shiftg"}} - {"Grid +5mil" SetValue(Grid,+5,mil) a={"G" "g"}} - {"Grid -0.05mm" SetValue(Grid,-0.05,mm) a={"Shift-Ctrl-G" "Shift Ctrlg"}} - {"Grid +0.05mm" SetValue(Grid,+0.05,mm) a={"Ctrl-G" "Ctrlg"}} + {"Grid -" SetValue(Grid,-) a={"Shift-G" "Shiftg"}} + {"Grid +" SetValue(Grid,+) a={"G" "g"}} } - {"Shown Layers" @@ -383,12 +381,12 @@ MainMenu = {"ChangeHole Object" a={"Ctrl-H" "Ctrlh"} ChangeHole(Object)} {"ChangeJoin Object" a={"J" "j"} ChangeJoin(Object)} {"ChangeJoin SelectedObject" a={"Shift-J" "Shiftj"} ChangeJoin(SelectedObjects)} - {"Clear Object +2 mil" a={"K" "k"} ChangeClearSize(Object,+2,mil)} - {"Clear Object -2 mil" a={"Shift-K" "Shiftk"} ChangeClearSize(Object,-2,mil)} - {"Clear Selected +2 mil" a={"Ctrl-K" "Ctrlk"} ChangeClearSize(SelectedObjects,+2,mil)} - {"Clear Selected -2 mil" a={"Shift-Ctrl-K" "Shift Ctrlk"} ChangeClearSize(SelectedObjects,-2,mil)} - {"Line Tool size +5 mil" a={"L" "l"} SetValue(LineSize,+5,mil)} - {"Line Tool size -5 mil" a={"Shift-L" "Shiftl"} SetValue(LineSize,-5,mil)} + {"Clear Object +" a={"K" "k"} ChangeClearSize(Object,+)} + {"Clear Object -" a={"Shift-K" "Shiftk"} ChangeClearSize(Object,-)} + {"Clear Selected +" a={"Ctrl-K" "Ctrlk"} ChangeClearSize(SelectedObjects,+)} + {"Clear Selected -" a={"Shift-Ctrl-K" "Shift Ctrlk"} ChangeClearSize(SelectedObjects,-)} + {"Line Tool size +" a={"L" "l"} SetValue(LineSize,+)} + {"Line Tool size -" a={"Shift-L" "Shiftl"} SetValue(LineSize,-)} {"Move Object to current layer" a={"M" "m"} MoveToCurrentLayer(Object)} {"MarkCrosshair" a={"Ctrl-M" "Ctrlm"} MarkCrosshair()} {"Select shortest rat" a={"Shift-N" "Shiftn"} AddRats(Close)} @@ -402,8 +400,8 @@ MainMenu = {"Polygon PreviousPoint" a={"P" "p"} Polygon(PreviousPoint)} {"Polygon Close" a={"Shift-P" "Shiftp"} Polygon(Close)} {"ChangeSquare Object" a={"Q" "q"} ChangeSquare(Object)} - {"ChangeSize +5 mil" a={"S" "s"} ChangeSize(Object,+5,mil)} - {"ChangeSize -5 mil" a={"Shift-S" "Shifts"} ChangeSize(Object,-5,mil)} + {"ChangeSize +" a={"S" "s"} ChangeSize(Object,+)} + {"ChangeSize -" a={"Shift-S" "Shifts"} ChangeSize(Object,-)} {"ChangeDrill +5 mil" a={"Alt-S" "Alts"} ChangeDrillSize(Object,+5,mil)} {"ChangeDrill -5 mil" a={"Alt-Shift-S" "Alt Shifts"} ChangeDrillSize(Object,-5,mil)} {"Text Tool scale +10 mil" a={"T" "t"} SetValue(TextScale,+10,mil)}