From 64807034a47f9d0f37251d6f7b32d69698720606 Mon Sep 17 00:00:00 2001 From: Ineiev Date: Thu, 2 Jul 2009 08:31:25 +0400 Subject: [PATCH] add PedanticThinLines mode add PedanticThinLines member to SettingType: when it is set, lines and arcs in thindraw mode are shown as outlines rather than as centerlines; add subactions Display(TogglePedanticThinLines), Display(Thindraw,...), pedantic_thindraw flag to control this behaviour --- ChangeLog | 7 +++++++ src/action.c | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- src/draw.c | 42 ++++++++++++++++++++++++++++++++++++------ src/flags.c | 13 +++++++++---- src/global.h | 1 + src/gpcb-menu.res | 1 + src/pcb-menu.res | 1 + 7 files changed, 99 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd22fb5..724c250 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-07-09 17:17 ineiev + + * src/action.c, src/draw.c, src/flags.c src/global.h, + src/gpcb-menu.res, src/pcb-menu.res: add + Display(TogglePedanticThinLines), Display(Thindraw), + pedantic_thindraw flag + 2009-05-17 15:17 jaredcasper * configure.ac,src/hid/lpr/hid.conf: Added top level check for diff --git a/src/action.c b/src/action.c index ce7527f..bc6d0aa 100644 --- a/src/action.c +++ b/src/action.c @@ -1,11 +1,8 @@ -/* $Id$ */ -/* 15 Oct 2008 Ineiev: add CycleCrosshair action */ - /* * COPYRIGHT * * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1994,1995,1996, 2009 Thomas Nau * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton * * This program is free software; you can redistribute it and/or modify @@ -75,8 +72,6 @@ #include #endif -RCSID ("$Id$"); - /* --------------------------------------------------------------------------- * some local types */ @@ -168,6 +163,7 @@ typedef enum F_TextByName, F_TextScale, F_Thermal, + F_Thindraw, F_ToLayout, F_ToggleAllDirections, F_ToggleAutoDRC, @@ -180,6 +176,7 @@ typedef enum F_ToggleObject, F_ToggleShowDRC, F_ToggleLiveRoute, + F_TogglePedanticThinLines, F_ToggleRubberBandMode, F_ToggleStartDirection, F_ToggleSnapPin, @@ -400,6 +397,7 @@ static FunctionType Functions[] = { {"TextByName", F_TextByName}, {"TextScale", F_TextScale}, {"Thermal", F_Thermal}, + {"Thindraw", F_Thindraw}, {"ToLayout", F_ToLayout}, {"Toggle45Degree", F_ToggleAllDirections}, {"ToggleClearLine", F_ToggleClearLine}, @@ -421,6 +419,7 @@ static FunctionType Functions[] = { {"ToggleOrthoMove", F_ToggleOrthoMove}, {"ToggleShowDRC", F_ToggleShowDRC}, {"ToggleLiveRoute", F_ToggleLiveRoute}, + {"TogglePedanticThinLines", F_TogglePedanticThinLines}, {"ToggleAutoDRC", F_ToggleAutoDRC}, {"ToggleUniqueNames", F_ToggleUniqueNames}, {"Value", F_Value}, @@ -2412,8 +2411,9 @@ static const char display_syntax[] = "Display(ToggleMask|ToggleName|ToggleClearLine|ToggleFullPoly|ToggleSnapPin)\n" "Display(ToggleThindraw|ToggleThindrawPoly|ToggleOrthoMove|ToggleLocalRef)\n" "Display(ToggleCheckPlanes|ToggleShowDRC|ToggleAutoDRC)\n" - "Display(ToggleLiveRoute|LockNames|OnlyNames)\n" - "Display(Pinout|PinOrPadName)\n" "Display(Scroll, Direction)"; + "Display(ToggleLiveRoute|TogglePedanticThinLines|LockNames|OnlyNames)\n" + "Display(Pinout|PinOrPadName)\n" "Display(Scroll, Direction)\n" + "Display(Thindraw, [on|off|toggle], [fast|pedantic|toggle])"; static const char display_help[] = "Several display-related actions."; @@ -2464,9 +2464,14 @@ you can see the relative distance you've moved. @item ToggleThindraw If set, objects on the screen are drawn as outlines (lines are drawn -as center-lines). This lets you see line endpoints hidden under pins, +as center-lines or as outlines when TogglePedanticThinLines is set). +This lets you see line endpoints hidden under pins, for example. +@item TogglePedanticThinLines +If set, lines and arcs on the screen are drawn as outlines in +thindraw mode rather than as center-lines. + @item ToggleThindrawPoly If set, polygons on the screen are drawn as outlines. @@ -2531,6 +2536,10 @@ Steps the crosshair in the given direction, with 1=down/left, 2=down, etc, according to the numeric keypad layout. If amount is not given, the crosshair steps along the grid. +@item Thindraw +Sets all Thindraw parameters explicitly. When an argument is empty, +the flag is not affected. + @end table %end-doc */ @@ -2621,6 +2630,28 @@ ActionDisplay (int argc, char **argv, int childX, int childY) Crosshair.shape = Basic_Crosshair_Shape; break; + case F_Thindraw: + if (argc > 1 && argv[1][0]) + { + if(!strcmp (argv[1], "off")) + CLEAR_FLAG (THINDRAWFLAG, PCB); + else if(!strcmp (argv[1], "toggle")) + TOGGLE_FLAG (THINDRAWFLAG, PCB); + else if(!strcmp (argv[1], "on")) + SET_FLAG (THINDRAWFLAG, PCB); + } + if (argc > 2 && argv[2][0]) + { + if (!strcmp (argv[2], "pedantic")) + Settings.PedanticThinLines = !0; + else if(!strcmp (argv[2], "fast")) + Settings.PedanticThinLines = 0; + else if(!strcmp (argv[2], "toggle")) + Settings.PedanticThinLines = !Settings.PedanticThinLines; + } + ClearAndRedrawOutput (); + break; + case F_ToggleRubberBandMode: TOGGLE_FLAG (RUBBERBANDFLAG, PCB); break; @@ -2674,6 +2705,10 @@ ActionDisplay (int argc, char **argv, int childX, int childY) TOGGLE_FLAG (LIVEROUTEFLAG, PCB); break; + case F_TogglePedanticThinLines: + Settings.PedanticThinLines = !Settings.PedanticThinLines; + break; + case F_ToggleAutoDRC: TOGGLE_FLAG (AUTODRCFLAG, PCB); if (TEST_FLAG (AUTODRCFLAG, PCB) && Settings.Mode == LINE_MODE) diff --git a/src/draw.c b/src/draw.c index 1d902b2..c696b53 100644 --- a/src/draw.c +++ b/src/draw.c @@ -1,10 +1,8 @@ -/* $Id$ */ - /* * COPYRIGHT * * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2003, 2004 Thomas Nau + * Copyright (C) 1994,1995,1996, 2003, 2004, 2009 Thomas Nau * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Contact addresses for paper mail and Email: * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany @@ -54,8 +52,6 @@ #include #endif -RCSID ("$Id$"); - #define SMALL_SMALL_TEXT_SIZE 0 #define SMALL_TEXT_SIZE 1 #define NORMAL_TEXT_SIZE 2 @@ -1568,12 +1564,21 @@ ClearPad (PadTypePtr Pad, Boolean mask) static void DrawLineLowLevel (LineTypePtr Line, Boolean HaveGathered) { + int gathering; + if (Gathering && !HaveGathered) { AddPart (Line); return; } + if (Settings.PedanticThinLines && TEST_FLAG (THINDRAWFLAG, PCB)) + { + gathering = Gathering; Gathering = 0; + DrawPadLowLevel (Output.fgGC, (PadTypePtr)Line, 0, 0); + Gathering = gathering; + return; + } gui->set_line_cap (Output.fgGC, Trace_Cap); if (TEST_FLAG (THINDRAWFLAG, PCB)) gui->set_line_width (Output.fgGC, 0); @@ -1692,6 +1697,26 @@ DrawPolygonLowLevel (PolygonTypePtr Polygon) printf ("DrawPolygonLowLevel: Called without Gathering set!\n"); } +/* Draw arc in PedanticThinLines mode */ +static void +draw_arc_outline (ArcTypePtr a) +{ + BDimension wid = a->Thickness / 2; + BDimension wx = a->Width, wy = a->Height; + BoxTypePtr bx = GetArcEnds (a); + int sa = a->StartAngle, d = a->Delta; + + gui->draw_arc (Output.fgGC, a->X, a->Y, wx + wid, wy + wid, sa, d); + if (wid > pixel_slop) + { + gui->draw_arc (Output.fgGC, a->X, a->Y, wx - wid, wy - wid, sa, d); + gui->draw_arc (Output.fgGC, bx->X1, bx->Y1, + wid, wid, sa, -180 * SGN (d)); + gui->draw_arc (Output.fgGC, bx->X2, bx->Y2, + wid, wid, sa + d, 180 * SGN (d)); + } +} + /* --------------------------------------------------------------------------- * lowlevel routine to element arcs */ @@ -1710,6 +1735,11 @@ DrawArcLowLevel (ArcTypePtr Arc) gui->set_line_width (Output.fgGC, 0); else gui->set_line_width (Output.fgGC, Arc->Thickness); + if (Settings.PedanticThinLines && TEST_FLAG (THINDRAWFLAG, PCB)) + { + draw_arc_outline (Arc); + return; + } gui->set_line_cap (Output.fgGC, Trace_Cap); gui->draw_arc (Output.fgGC, Arc->X, Arc->Y, Arc->Width, diff --git a/src/flags.c b/src/flags.c index c6c7458..c203aeb 100644 --- a/src/flags.c +++ b/src/flags.c @@ -1,10 +1,8 @@ -/* $Id$ */ - /* * COPYRIGHT * * PCB, interactive printed circuit board design - * Copyright (C) 2005 DJ Delorie + * Copyright (C) 2005, 2009 DJ Delorie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -71,6 +69,12 @@ FlagGridSize (int dummy) } static int +FlagPedanticThindraw (int dummy) +{ + return Settings.PedanticThinLines; +} + +static int FlagBuffer (int dummy) { return (int) (Settings.BufferNumber + 1); @@ -171,6 +175,7 @@ HID_Flag flags_flag_list[] = { {"gridsize", FlagGridSize, 0}, {"elementname", FlagElementName, 0}, {"have_regex", FlagHaveRegex, 0}, + {"pedantic_thindraw", FlagPedanticThindraw, 0}, {"silk_shown", FlagLayerShown, FL_SILK}, {"pins_shown", FlagLayerShown, FL_PINS}, diff --git a/src/global.h b/src/global.h index 3c383be..5fbf44b 100644 --- a/src/global.h +++ b/src/global.h @@ -621,6 +621,7 @@ typedef struct /* some resources... */ AutoDRC, /* */ ShowNumber, /* pinout shows number */ OrthogonalMoves, /* */ + PedanticThinLines, /* outline arcs and lines in thinline mode */ ResetAfterElement, /* reset connections after each element */ liveRouting, /* autorouter shows tracks in progress */ RingBellWhenFinished, /* flag if a signal should be */ diff --git a/src/gpcb-menu.res b/src/gpcb-menu.res index b844f56..1ed6c9f 100644 --- a/src/gpcb-menu.res +++ b/src/gpcb-menu.res @@ -216,6 +216,7 @@ MainMenu = {"New polygons are full ones" checked=newfullpoly Display(ToggleFullPoly)} {"Show autorouter trials" checked=liveroute Display(ToggleLiveRoute)} {"Thin draw" checked=thindraw Display(ToggleThindraw) a={"|" "|"}} + {"Pedantic thin lines" checked=pedantic_thindraw Display(TogglePedanticThinlines) a={"Ctrl-[" "Ctrl["}} {"Thin draw poly" checked=thindrawpoly Display(ToggleThindrawPoly) a={"Ctrl-Shift-P" "Ctrl Shiftp"}} {"Check polygons" checked=checkplanes Display(ToggleCheckPlanes)} - diff --git a/src/pcb-menu.res b/src/pcb-menu.res index 5186183..daa6756 100644 --- a/src/pcb-menu.res +++ b/src/pcb-menu.res @@ -200,6 +200,7 @@ MainMenu = {"New polygons are full ones" checked=newfullpoly Display(ToggleFullPoly)} {"Show autorouter trials" checked=liveroute Display(ToggleLiveRoute)} {"Thin draw" checked=thindraw Display(ToggleThindraw) a={"|" "|"}} + {"Pedantic thin lines" checked=pedantic_thindraw Display(TogglePedanticThinlines) a={"Ctrl-[" "Ctrl["}} {"Thin draw poly" checked=thindrawpoly Display(ToggleThindrawPoly) a={"Ctrl-Shift-P" "Ctrl Shiftp"}} {"Check polygons" checked=checkplanes Display(ToggleCheckPlanes)} - -- 1.6.3.3