kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #37325
Diff pair button
Recently during the manual layout of a board with many
differential pairs I noticed that there was no button to add
a diff-pair the way there is a button for regular tracks.
Rather, adding diff-pairs is currently accomplished using
a menu entry.
This patch adds a button to the draw toolbar (just below the
"Add tracks" button) to allow routing differential pairs.
Anthony Tonizzo
From b3dc711ace5a4050735853b4700b2b5da66d6e6a Mon Sep 17 00:00:00 2001
From: Anthony Tonizzo <atonizzo@xxxxxxxxx>
Date: Mon, 27 Aug 2018 13:28:55 -0700
Subject: [PATCH] Adds a "Route differential pair" button to the toolbar.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.19.0.rc0.228.g281dcd1b4d0-goog"
This is a multi-part message in MIME format.
--------------2.19.0.rc0.228.g281dcd1b4d0-goog
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
bitmaps_png/CMakeLists.txt | 1 +
bitmaps_png/cpp_26/add_diff_pair.cpp | 28 +++++++++++
bitmaps_png/sources/add_diff_pair.svg | 68 +++++++++++++++++++++++++++
include/bitmaps.h | 1 +
pcbnew/pcb_edit_frame.cpp | 2 +
pcbnew/pcbnew_id.h | 3 +-
pcbnew/tool_pcb_editor.cpp | 3 ++
pcbnew/tools/pcb_actions.cpp | 1 +
8 files changed, 106 insertions(+), 1 deletion(-)
create mode 100644 bitmaps_png/cpp_26/add_diff_pair.cpp
create mode 100644 bitmaps_png/sources/add_diff_pair.svg
--------------2.19.0.rc0.228.g281dcd1b4d0-goog
Content-Type: text/x-patch; name="0001-Adds-a-Route-differential-pair-button-to-the-toolbar.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Adds-a-Route-differential-pair-button-to-the-toolbar.patch"
diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt
index 7f9fcfd54..410de7318 100644
--- a/bitmaps_png/CMakeLists.txt
+++ b/bitmaps_png/CMakeLists.txt
@@ -123,6 +123,7 @@ set( BMAPS_MID
add_component
add_corner
add_dashed_line
+ add_diff_pair
add_dimension
add_document
add_gerber
diff --git a/bitmaps_png/cpp_26/add_diff_pair.cpp b/bitmaps_png/cpp_26/add_diff_pair.cpp
new file mode 100644
index 000000000..2f4ece6dd
--- /dev/null
+++ b/bitmaps_png/cpp_26/add_diff_pair.cpp
@@ -0,0 +1,28 @@
+
+/* Do not modify this file, it was automatically generated by the
+ * PNG2cpp CMake script, using a *.png file as input.
+ */
+
+#include <bitmaps.h>
+
+static const unsigned char png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
+ 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
+ 0xce, 0x00, 0x00, 0x00, 0xb1, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0x63, 0x60, 0x18, 0x05, 0x43,
+ 0x1b, 0x34, 0x30, 0xa8, 0x01, 0xf1, 0x3b, 0x22, 0xb1, 0x1a, 0x25, 0x16, 0x35, 0x03, 0xf1, 0x7f,
+ 0x22, 0x71, 0x33, 0xb9, 0xd6, 0x30, 0x02, 0x35, 0xdf, 0x43, 0x32, 0x08, 0x97, 0x4f, 0x60, 0xf2,
+ 0xf7, 0xc0, 0x7a, 0xc8, 0xf0, 0x8d, 0x1d, 0x92, 0x21, 0x27, 0xf0, 0xa8, 0x3b, 0x09, 0x57, 0xd7,
+ 0xc4, 0x60, 0x4b, 0x8e, 0x45, 0xb3, 0xe1, 0x06, 0x34, 0x32, 0x64, 0xe3, 0x51, 0x97, 0x83, 0xe4,
+ 0xa0, 0x59, 0xf8, 0x0d, 0x6d, 0x64, 0x70, 0x07, 0x2a, 0x4a, 0x43, 0xc3, 0xef, 0xa1, 0x9a, 0x7f,
+ 0x01, 0xb1, 0x08, 0x1e, 0x8b, 0x44, 0xa0, 0x6a, 0xfe, 0x43, 0xf5, 0xa0, 0x9a, 0x03, 0x32, 0x1b,
+ 0xc9, 0x12, 0x7c, 0x91, 0xbc, 0x91, 0x08, 0xdf, 0x6f, 0xc4, 0x6b, 0x06, 0xd8, 0x32, 0xc2, 0x16,
+ 0x85, 0x10, 0x61, 0x51, 0x08, 0x61, 0x8b, 0x70, 0x07, 0x1d, 0x0c, 0x73, 0x10, 0x61, 0x11, 0x07,
+ 0x4e, 0xfd, 0x70, 0x4b, 0xe8, 0x0a, 0xe8, 0xe2, 0x23, 0xba, 0xc5, 0x11, 0xdd, 0x52, 0x1d, 0xdd,
+ 0xf2, 0x11, 0x5d, 0x4b, 0x86, 0x01, 0x2d, 0xeb, 0xe8, 0x56, 0x7a, 0xd3, 0xb1, 0x3e, 0xa2, 0x63,
+ 0x0d, 0x3b, 0x0a, 0xf0, 0x00, 0x00, 0x51, 0xf7, 0x2e, 0x56, 0x7c, 0x11, 0x0a, 0x79, 0x00, 0x00,
+ 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
+};
+
+const BITMAP_OPAQUE add_diff_pair_xpm[1] = {{ png, sizeof( png ), "add_diff_pair_xpm" }};
+
+//EOF
diff --git a/bitmaps_png/sources/add_diff_pair.svg b/bitmaps_png/sources/add_diff_pair.svg
new file mode 100644
index 000000000..8237a49b5
--- /dev/null
+++ b/bitmaps_png/sources/add_diff_pair.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ height="26"
+ width="26"
+ version="1.1"
+ id="svg2"
+ inkscape:version="0.92.2pre0 (973e216, 2017-07-25)"
+ sodipodi:docname="add_diff_pair.svg">
+ <metadata
+ id="metadata40">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2420"
+ inkscape:window-height="1307"
+ id="namedview38"
+ showgrid="true"
+ inkscape:snap-to-guides="false"
+ inkscape:snap-grids="true"
+ inkscape:zoom="32.472518"
+ inkscape:cx="3.8189416"
+ inkscape:cy="13.290822"
+ inkscape:window-x="43"
+ inkscape:window-y="146"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4136" />
+ </sodipodi:namedview>
+ <defs
+ id="defs4" />
+ <path
+ id="path2990-3"
+ style="fill:none;stroke:#008000;stroke-width:2.84693623;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 12,5.5 H 9 L 7,11 H 2 M 12,5.5 h 5 l 2,5.5 h 5"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccccc" />
+ <path
+ id="path2990-3-3"
+ style="fill:none;stroke:#008000;stroke-width:2.84693623;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 14,21.5 h 3 L 19,16 h 5 M 14,21.5 H 9 L 7,16 H 2"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccccc" />
+</svg>
diff --git a/include/bitmaps.h b/include/bitmaps.h
index f7703e531..c7bd88a1d 100644
--- a/include/bitmaps.h
+++ b/include/bitmaps.h
@@ -39,6 +39,7 @@ EXTERN_BITMAP( add_circle_xpm )
EXTERN_BITMAP( add_component_xpm )
EXTERN_BITMAP( add_corner_xpm )
EXTERN_BITMAP( add_dashed_line_xpm )
+EXTERN_BITMAP( add_diff_pair_xpm )
EXTERN_BITMAP( add_dimension_xpm )
EXTERN_BITMAP( add_document_xpm )
EXTERN_BITMAP( add_gerber_xpm )
diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp
index e8bbb886d..039bc94dc 100644
--- a/pcbnew/pcb_edit_frame.cpp
+++ b/pcbnew/pcb_edit_frame.cpp
@@ -705,6 +705,8 @@ void PCB_EDIT_FRAME::enableGALSpecificMenus()
GetMenuBar()->FindItem( id_list[ii] )->Enable( enbl );
}
+ m_drawToolBar->EnableTool( ID_DIFF_PAIRR_BUTT, enbl );
+
// Update settings for GAL menus
auto view = GetGalCanvas()->GetView();
GetMenuBar()->FindItem( ID_MENU_PCB_FLIP_VIEW )->Check( view->IsMirroredX() );
diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h
index abd500807..af88a7fe9 100644
--- a/pcbnew/pcbnew_id.h
+++ b/pcbnew/pcbnew_id.h
@@ -29,6 +29,7 @@ enum pcbnew_ids
ID_PCB_SHOW_1_RATSNEST_BUTT,
ID_PCB_MODULE_BUTT,
ID_TRACK_BUTT,
+ ID_DIFF_PAIRR_BUTT,
ID_PCB_ZONES_BUTT,
ID_PCB_DRAW_VIA_BUTT,
ID_PCB_KEEPOUT_AREA_BUTT,
@@ -250,7 +251,7 @@ enum pcbnew_ids
// reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup
ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END = MAX_ITEMS_IN_PICKER + ID_POPUP_PCB_ITEM_SELECTION_START,
-
+
ID_POPUP_PCB_SPREAD_SELECTED_MODULES,
ID_POPUP_PCB_SPREAD_OFF_BOARD_MODULES,
ID_POPUP_PCB_AUTOPLACE_SELECTED_MODULES,
diff --git a/pcbnew/tool_pcb_editor.cpp b/pcbnew/tool_pcb_editor.cpp
index 66b622357..98800c6da 100644
--- a/pcbnew/tool_pcb_editor.cpp
+++ b/pcbnew/tool_pcb_editor.cpp
@@ -449,6 +449,9 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, KiScaledBitmap( add_tracks_xpm, this ),
_( "Route tracks" ), wxITEM_CHECK );
+ m_drawToolBar->AddTool( ID_DIFF_PAIRR_BUTT, wxEmptyString, KiScaledBitmap( add_diff_pair_xpm, this ),
+ _( "Route differential pair" ), wxITEM_CHECK );
+
m_drawToolBar->AddTool( ID_PCB_DRAW_VIA_BUTT, wxEmptyString, KiScaledBitmap( add_via_xpm, this ),
_( "Add vias" ), wxITEM_CHECK );
diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp
index 22ee6225e..8af51dc42 100644
--- a/pcbnew/tools/pcb_actions.cpp
+++ b/pcbnew/tools/pcb_actions.cpp
@@ -38,6 +38,7 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
return PCB_ACTIONS::routerActivateSingle.MakeEvent();
case ID_DIFF_PAIR_BUTT:
+ case ID_DIFF_PAIRR_BUTT:
return PCB_ACTIONS::routerActivateDiffPair.MakeEvent();
case ID_TUNE_SINGLE_TRACK_LEN_BUTT:
--------------2.19.0.rc0.228.g281dcd1b4d0-goog--
Follow ups