pcbnew: Draw Ratsnest with arcs to avoid overlap

Adds a toggle button that allows switching between straight lines and
curves for the ratsnest lines.

Fixes: lp:1766597
* https://bugs.launchpad.net/kicad/+bug/1766597
This commit is contained in:
MaPePeR 2018-04-30 09:52:49 +02:00 committed by Jeff Young
parent ca7aec2d4e
commit e7d32c54b9
20 changed files with 327 additions and 4 deletions

View File

@ -173,6 +173,7 @@ set( BMAPS_MID
cancel cancel
change_entry_orient change_entry_orient
contrast_mode contrast_mode
curved_ratsnest
create_cmp_file create_cmp_file
checked_ok checked_ok
color_materials color_materials

View File

@ -0,0 +1,45 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps_png/bitmaps_list.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, 0x04, 0x00, 0x00, 0x00, 0x03, 0x43, 0x84,
0x45, 0x00, 0x00, 0x01, 0xc7, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x95, 0x94, 0xbb, 0x4f, 0xc2,
0x50, 0x14, 0xc6, 0xbf, 0x2a, 0x21, 0x91, 0xd5, 0x8d, 0x38, 0x34, 0xba, 0xa1, 0xb8, 0xd0, 0xc1,
0x41, 0x01, 0x11, 0x16, 0xf1, 0x1f, 0x70, 0x70, 0xd1, 0x89, 0x38, 0xaa, 0x69, 0xe2, 0xa4, 0x4e,
0x1a, 0x07, 0x56, 0xcb, 0x66, 0x34, 0xf2, 0x1a, 0x1c, 0xd4, 0xc1, 0x18, 0x12, 0x17, 0x9c, 0x40,
0x37, 0x95, 0x89, 0xc6, 0xc4, 0x26, 0xb2, 0xc0, 0x40, 0x4c, 0x0c, 0x31, 0xf5, 0xf6, 0x45, 0xef,
0x6d, 0x0b, 0xea, 0x39, 0xcb, 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xbf, 0xd8, 0x0f, 0x3c, 0x1e, 0x28, 0x8f,
0xaa, 0xd6, 0xe8, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE curved_ratsnest_xpm[1] = {{ png, sizeof( png ), "curved_ratsnest_xpm" }};
//EOF

View File

@ -111,6 +111,7 @@ EXTERN_BITMAP( create_cmp_file_xpm )
EXTERN_BITMAP( cursor_shape_xpm ) EXTERN_BITMAP( cursor_shape_xpm )
EXTERN_BITMAP( custom_pad_to_primitives_xpm ) EXTERN_BITMAP( custom_pad_to_primitives_xpm )
EXTERN_BITMAP( cursor_xpm ) EXTERN_BITMAP( cursor_xpm )
EXTERN_BITMAP( curved_ratsnest_xpm )
EXTERN_BITMAP( cut_xpm ) EXTERN_BITMAP( cut_xpm )
EXTERN_BITMAP( cvpcb_xpm ) EXTERN_BITMAP( cvpcb_xpm )
EXTERN_BITMAP( dashline_xpm ) EXTERN_BITMAP( dashline_xpm )

View File

@ -0,0 +1,189 @@
<?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.4 (5da689c313, 2019-01-14)"
sodipodi:docname="curved_ratsnest.svg"
inkscape:export-filename="E:\Projects\kicad\bitmaps_png\sources\curved_ratsnest.png"
inkscape:export-xdpi="193"
inkscape:export-ydpi="193">
<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></dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</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="1920"
inkscape:window-height="1017"
id="namedview38"
showgrid="true"
inkscape:snap-to-guides="false"
inkscape:snap-grids="true"
inkscape:zoom="22.627417"
inkscape:cx="15.228405"
inkscape:cy="6.3905024"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer2"
showguides="true"
inkscape:guide-bbox="true"
inkscape:snap-object-midpoints="false"
inkscape:snap-others="true"
inkscape:snap-midpoints="false"
inkscape:object-nodes="false"
inkscape:object-paths="false"
inkscape:snap-bbox="false">
<inkscape:grid
type="xygrid"
id="grid3017"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.5"
spacingy="0.5"
originx="0"
originy="0" />
</sodipodi:namedview>
<defs
id="defs4">
<filter
id="c"
height="1.3651"
width="1.2097"
color-interpolation-filters="sRGB"
y="-0.18257"
x="-0.10484">
<feGaussianBlur
stdDeviation="1.5978799"
id="feGaussianBlur7" />
</filter>
<filter
id="d"
height="1.4696"
width="1.4809999"
color-interpolation-filters="sRGB"
y="-0.23481999"
x="-0.24049">
<feGaussianBlur
stdDeviation="1.5978799"
id="feGaussianBlur10" />
</filter>
</defs>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Bottom">
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 5,21 C 2,13 2,13 5,5"
id="path4198"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 5,5 C 13,2 13,2 21,5"
id="path4200"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 5,5 c 5.019544,3.0117263 7.519506,4.5117034 9.52343,6.523476"
id="path4202"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<ellipse
ry="2.6984549"
rx="2.6875672"
id="path2992-3"
style="fill:#e6e6e6;fill-opacity:1;stroke:#1a1a1a;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
cx="5"
cy="5" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 13,13 8,8"
id="path4204"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 21,5 21,21 5,21"
id="path4206"
inkscape:connector-curvature="0" />
<ellipse
ry="2.6984549"
rx="2.6875672"
id="path2992-3-1"
style="fill:#e6e6e6;fill-opacity:1;stroke:#1a1a1a;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
cx="21"
cy="5" />
<ellipse
ry="2.6984549"
rx="2.6875672"
id="path2992-3-3"
style="fill:#e6e6e6;fill-opacity:1;stroke:#1a1a1a;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
cx="5"
cy="21" />
<ellipse
ry="2.6984549"
rx="2.6875672"
id="path2992-3-0"
style="fill:#e6e6e6;fill-opacity:1;stroke:#1a1a1a;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
cx="21"
cy="21" />
</g>
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="Top"
sodipodi:insensitive="true"
style="display:inline">
<path
style="fill:none;stroke:#999999;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1.5,24.5 23,-23"
id="path4065"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -84,6 +84,7 @@ public:
bool m_ContrastModeDisplay; bool m_ContrastModeDisplay;
int m_MaxLinksShowed; // in track creation: number of hairwires shown int m_MaxLinksShowed; // in track creation: number of hairwires shown
bool m_Show_Module_Ratsnest; // When moving a footprint: allows displaying a ratsnest bool m_Show_Module_Ratsnest; // When moving a footprint: allows displaying a ratsnest
bool m_DisplayRatsnestLinesCurved;
public: public:

View File

@ -56,4 +56,5 @@ PCB_DISPLAY_OPTIONS::PCB_DISPLAY_OPTIONS()
m_ContrastModeDisplay = false; m_ContrastModeDisplay = false;
m_MaxLinksShowed = 3; // in track creation: number of hairwires shown m_MaxLinksShowed = 3; // in track creation: number of hairwires shown
m_Show_Module_Ratsnest = true; // When moving a footprint: allows displaying a ratsnest m_Show_Module_Ratsnest = true; // When moving a footprint: allows displaying a ratsnest
m_DisplayRatsnestLinesCurved = true;
} }

View File

@ -232,6 +232,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
PCB_EDIT_FRAME::OnSelectOptionToolbar ) PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
PCB_EDIT_FRAME::OnSelectOptionToolbar ) PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, PCB_EDIT_FRAME::OnUpdatePCBFromSch ) EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, PCB_EDIT_FRAME::OnUpdatePCBFromSch )
EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema ) EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema )
@ -271,6 +273,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable ) EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_RATSNEST, PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_RATSNEST, PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnUpdateViaDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnUpdateViaDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_CURVED_RATSNEST_LINES, PCB_EDIT_FRAME::OnUpdateCurvedRatsnest )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnUpdateTraceDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnUpdateTraceDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode ) PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode )

View File

@ -363,6 +363,7 @@ public:
void OnConfigurePaths( wxCommandEvent& aEvent ); void OnConfigurePaths( wxCommandEvent& aEvent );
void OnUpdatePCBFromSch( wxCommandEvent& event ); void OnUpdatePCBFromSch( wxCommandEvent& event );
void OnRunEeschema( wxCommandEvent& event ); void OnRunEeschema( wxCommandEvent& event );
void OnUpdateCurvedRatsnest( wxUpdateUIEvent& aEvent );
void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, const bool aEdit = true ); void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, const bool aEdit = true );
void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, const bool aEdit = true ); void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, const bool aEdit = true );

View File

@ -136,6 +136,7 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOption
m_sketchBoardGfx = !aOptions->m_DisplayDrawItemsFill; m_sketchBoardGfx = !aOptions->m_DisplayDrawItemsFill;
m_sketchFpGfx = !aOptions->m_DisplayModEdgeFill; m_sketchFpGfx = !aOptions->m_DisplayModEdgeFill;
m_sketchFpTxtfx = !aOptions->m_DisplayModTextFill; m_sketchFpTxtfx = !aOptions->m_DisplayModTextFill;
m_curvedRatsnestlines = aOptions->m_DisplayRatsnestLinesCurved;
// Whether to draw tracks, vias & pads filled or as outlines // Whether to draw tracks, vias & pads filled or as outlines
m_sketchMode[LAYER_PADS_TH] = !aOptions->m_DisplayPadFill; m_sketchMode[LAYER_PADS_TH] = !aOptions->m_DisplayPadFill;

View File

@ -162,6 +162,11 @@ public:
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_CURSOR ]; } const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_CURSOR ]; }
inline bool GetCurvedRatsnestLinesEnabled() const
{
return m_curvedRatsnestlines;
}
protected: protected:
///> Flag determining if items on a given layer should be drawn as an outline or a filled item ///> Flag determining if items on a given layer should be drawn as an outline or a filled item
bool m_sketchMode[GAL_LAYER_ID_END]; bool m_sketchMode[GAL_LAYER_ID_END];
@ -190,6 +195,9 @@ protected:
///> Flag determining if zones should have outlines drawn ///> Flag determining if zones should have outlines drawn
bool m_zoneOutlines; bool m_zoneOutlines;
///> Flag determining if ratsnest lines should be drawn curved
bool m_curvedRatsnestlines = true;
///> Maximum font size for netnames (and other dynamically shown strings) ///> Maximum font size for netnames (and other dynamically shown strings)
static const double MAX_FONT_SIZE; static const double MAX_FONT_SIZE;

View File

@ -197,6 +197,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
&displ_opts->m_DisplayDrawItemsFill, FILLED ) ); &displ_opts->m_DisplayDrawItemsFill, FILLED ) );
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ),
&displ_opts->m_DisplayZonesMode, 0, 0, 2 ) ); &displ_opts->m_DisplayZonesMode, 0, 0, 2 ) );
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "CurvedRatsnestLines" ),
&displ_opts->m_DisplayRatsnestLinesCurved, true ) );
// Miscellaneous: // Miscellaneous:
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ),

View File

@ -311,6 +311,7 @@ enum pcbnew_ids
ID_TB_OPTIONS_SHOW_VIAS_SKETCH, ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
ID_DEC_LAYER_ALPHA, ID_DEC_LAYER_ALPHA,
ID_INC_LAYER_ALPHA, ID_INC_LAYER_ALPHA,
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,

View File

@ -104,6 +104,10 @@ void PCB_BASE_FRAME::DrawGeneralRatsnest( wxDC* aDC, int aNetcode )
COLOR4D color = Settings().Colors().GetItemColor( LAYER_RATSNEST ); COLOR4D color = Settings().Colors().GetItemColor( LAYER_RATSNEST );
auto displ_opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
const bool curved_ratsnest = displ_opts->m_DisplayRatsnestLinesCurved;
for( int i = 1 /* skip "No Net" at [0] */; i < connectivity->GetNetCount(); ++i ) for( int i = 1 /* skip "No Net" at [0] */; i < connectivity->GetNetCount(); ++i )
{ {
RN_NET* net = connectivity->GetRatsnestForNet( i ); RN_NET* net = connectivity->GetRatsnestForNet( i );
@ -128,8 +132,17 @@ void PCB_BASE_FRAME::DrawGeneralRatsnest( wxDC* aDC, int aNetcode )
|| dn->Parent()->GetLocalRatsnestVisible(); || dn->Parent()->GetLocalRatsnestVisible();
if( enable && show ) if( enable && show )
GRLine( m_canvas->GetClipBox(), aDC, wxPoint( s.x, s.y ), wxPoint( d.x, {
d.y ), 0, color ); if (curved_ratsnest) {
auto dx = d.x - s.x;
auto dy = d.y - s.y;
auto cx = s.x + 0.5 * dx + 1.2 * dy;
auto cy = s.y + 0.5 * dy - 1.2 * dx;
GRArc1( m_canvas->GetClipBox(), aDC, s.x, s.y, d.x, d.y, cx, cy, 0, color);
} else {
GRLine( m_canvas->GetClipBox(), aDC, s.x, s.y, d.x, d.y, 0, color );
}
}
} }
} }
} }

View File

@ -34,6 +34,7 @@
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <pcb_painter.h> #include <pcb_painter.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <pcb_base_frame.h>
#include <memory> #include <memory>
#include <utility> #include <utility>
@ -71,13 +72,15 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
gal->SetIsStroke( true ); gal->SetIsStroke( true );
gal->SetIsFill( false ); gal->SetIsFill( false );
gal->SetLineWidth( 1.0 ); gal->SetLineWidth( 1.0 );
auto rs = aView->GetPainter()->GetSettings(); auto rs = static_cast<PCB_RENDER_SETTINGS*>(aView->GetPainter()->GetSettings());
auto color = rs->GetColor( NULL, LAYER_RATSNEST ); auto color = rs->GetColor( NULL, LAYER_RATSNEST );
int highlightedNet = rs->GetHighlightNetCode(); int highlightedNet = rs->GetHighlightNetCode();
gal->SetStrokeColor( color.Brightened(0.5) ); gal->SetStrokeColor( color.Brightened(0.5) );
const bool curved_ratsnest = rs->GetCurvedRatsnestLinesEnabled();
// Draw the "dynamic" ratsnest (i.e. for objects that may be currently being moved) // Draw the "dynamic" ratsnest (i.e. for objects that may be currently being moved)
for( const auto& l : m_data->GetDynamicRatsnest() ) for( const auto& l : m_data->GetDynamicRatsnest() )
{ {
@ -145,12 +148,22 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
} }
else else
{ {
if (curved_ratsnest) {
auto dx = target.x - source.x;
auto dy = target.y - source.y;
const auto center = VECTOR2I(
source.x + 0.5 * dx - 0.1 * dy,
source.y + 0.5 * dy + 0.1 * dx
);
gal->DrawCurve( source, center, center, target );
} else {
gal->DrawLine( source, target ); gal->DrawLine( source, target );
} }
} }
} }
} }
} }
}
void RATSNEST_VIEWITEM::ViewGetLayers( int aLayers[], int& aCount ) const void RATSNEST_VIEWITEM::ViewGetLayers( int aLayers[], int& aCount ) const

View File

@ -416,6 +416,10 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
KiScaledBitmap( contrast_mode_xpm, this ), KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ), _( "Enable high contrast display mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_CURVED_RATSNEST_LINES, wxEmptyString,
KiScaledBitmap( curved_ratsnest_xpm, this ),
_( "Show ratsnest lines with curved lines" ),
wxITEM_CHECK );
// Tools to show/hide toolbars: // Tools to show/hide toolbars:
KiScaledSeparator( m_optionsToolBar, this ); KiScaledSeparator( m_optionsToolBar, this );
@ -837,6 +841,13 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
} }
case ID_TB_OPTIONS_CURVED_RATSNEST_LINES:
{
displ_opts->m_DisplayRatsnestLinesCurved = !state;
m_canvas->Refresh();
break;
}
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE: case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
m_show_microwave_tools = state; m_show_microwave_tools = state;
m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools ); m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );

View File

@ -147,6 +147,16 @@ void PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent )
_( "High contrast display mode" ) ); _( "High contrast display mode" ) );
} }
void PCB_EDIT_FRAME::OnUpdateCurvedRatsnest( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayRatsnestLinesCurved );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
displ_opts->m_DisplayRatsnestLinesCurved ?
_( "Show ratlines as curves" ) :
_( "Show ratlines as straight lines" ) );
}
void PCB_EDIT_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
{ {

View File

@ -120,6 +120,9 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
case ID_VIEWER_ZOOM_PAGE: case ID_VIEWER_ZOOM_PAGE:
return ACTIONS::zoomFitScreen.MakeEvent(); return ACTIONS::zoomFitScreen.MakeEvent();
case ID_TB_OPTIONS_CURVED_RATSNEST_LINES:
return PCB_ACTIONS::ratsnestLineMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH: case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
return PCB_ACTIONS::trackDisplayMode.MakeEvent(); return PCB_ACTIONS::trackDisplayMode.MakeEvent();

View File

@ -262,6 +262,7 @@ public:
static TOOL_ACTION selectpositionRelativeItem; static TOOL_ACTION selectpositionRelativeItem;
// Display modes // Display modes
static TOOL_ACTION ratsnestLineMode;
static TOOL_ACTION trackDisplayMode; static TOOL_ACTION trackDisplayMode;
static TOOL_ACTION padDisplayMode; static TOOL_ACTION padDisplayMode;
static TOOL_ACTION viaDisplayMode; static TOOL_ACTION viaDisplayMode;

View File

@ -68,6 +68,10 @@ extern IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl );
// Display modes // Display modes
TOOL_ACTION PCB_ACTIONS::ratsnestLineMode( "pcbnew.Control.ratsnestLineMode",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode", TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_DISPLAY_MODE ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_DISPLAY_MODE ),
"", "" ); "", "" );
@ -257,6 +261,18 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
int PCBNEW_CONTROL::RatsnestLineMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts->m_DisplayRatsnestLinesCurved );
view()->UpdateDisplayOptions( opts );
canvas()->RedrawRatsnest();
canvas()->Refresh();
return 0;
}
int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
{ {
auto opts = displayOptions(); auto opts = displayOptions();
@ -996,6 +1012,7 @@ void PCBNEW_CONTROL::setTransitions()
{ {
// Display modes // Display modes
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::RatsnestLineMode, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );

View File

@ -51,6 +51,7 @@ public:
void Reset( RESET_REASON aReason ) override; void Reset( RESET_REASON aReason ) override;
// Display modes // Display modes
int RatsnestLineMode( const TOOL_EVENT& aEvent );
int ZoneDisplayMode( const TOOL_EVENT& aEvent ); int ZoneDisplayMode( const TOOL_EVENT& aEvent );
int TrackDisplayMode( const TOOL_EVENT& aEvent ); int TrackDisplayMode( const TOOL_EVENT& aEvent );
int PadDisplayMode( const TOOL_EVENT& aEvent ); int PadDisplayMode( const TOOL_EVENT& aEvent );