Make show hop over a configurable option

This commit is contained in:
jean-pierre charras 2025-06-15 15:02:00 +02:00
parent 57bbc96ab2
commit ca9df9986a
14 changed files with 131 additions and 27 deletions

View File

@ -45,6 +45,7 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
m_drawingSheet(),
m_plotAll( true ),
m_plotDrawingSheet( true ),
m_show_hop_over( false ),
m_blackAndWhite( false ),
m_pageSizeSelect( JOB_PAGE_SIZE::PAGE_SIZE_AUTO ),
m_useBackgroundColor( true ),
@ -69,6 +70,9 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
m_params.emplace_back( new JOB_PARAM<bool>( "black_and_white",
&m_blackAndWhite, m_blackAndWhite ) );
m_params.emplace_back( new JOB_PARAM<bool>( "show_hop_over",
&m_blackAndWhite, m_show_hop_over ) );
m_params.emplace_back( new JOB_PARAM<JOB_PAGE_SIZE>( "page_size",
&m_pageSizeSelect, m_pageSizeSelect ) );

View File

@ -58,6 +58,7 @@ public:
bool m_plotDrawingSheet;
std::vector<wxString> m_plotPages;
bool m_show_hop_over;
bool m_blackAndWhite;
JOB_PAGE_SIZE m_pageSizeSelect;
bool m_useBackgroundColor;

View File

@ -413,6 +413,8 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
renderSettings.m_ShowHiddenPins = false;
renderSettings.m_ShowHiddenFields = false;
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
getPlotOptions( &renderSettings );
std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( m_editFrame );
@ -430,6 +432,7 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
plotOpts.m_PDFMetadata = m_plotPDFMetadata->GetValue();
plotOpts.m_outputDirectory = getOutputPath();
plotOpts.m_pageSizeSelect = m_pageSizeSelect;
plotOpts.m_plotHopOver = cfg ? cfg->m_Appearance.show_hop_over : false;
schPlotter->Plot( GetPlotFileFormat(), plotOpts, &renderSettings, &m_MessagesBox->Reporter() );

View File

@ -62,6 +62,7 @@ void PANEL_EESCHEMA_DISPLAY_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* cf
m_checkShowOPVoltages->SetValue( cfg->m_Appearance.show_op_voltages );
m_checkShowPinAltModeIcons->SetValue( cfg->m_Appearance.show_op_currents );
m_checkPageLimits->SetValue( cfg->m_Appearance.show_page_limits );
m_cbHopOver->SetValue( cfg->m_Appearance.show_hop_over );
m_checkSelDrawChildItems->SetValue( cfg->m_Selection.draw_selected_children );
m_checkSelFillShapes->SetValue( cfg->m_Selection.fill_shapes );
@ -90,33 +91,34 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
{
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
cfg->m_Appearance.default_font = m_defaultFontCtrl->GetSelection() <= 0
// This is a keyword. Do not translate.
? wxString( KICAD_FONT_NAME )
: m_defaultFontCtrl->GetStringSelection();
cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue();
cfg->m_Appearance.show_hidden_fields = m_checkShowHiddenFields->GetValue();
cfg->m_Appearance.show_erc_warnings = m_checkShowERCWarnings->GetValue();
cfg->m_Appearance.show_erc_errors = m_checkShowERCErrors->GetValue();
cfg->m_Appearance.show_erc_exclusions = m_checkShowERCExclusions->GetValue();
cfg->m_Appearance.mark_sim_exclusions = m_cbMarkSimExclusions->GetValue();
cfg->m_Appearance.show_op_voltages = m_checkShowOPVoltages->GetValue();
cfg->m_Appearance.show_op_currents = m_checkShowOPCurrents->GetValue();
cfg->m_Appearance.show_pin_alt_icons = m_checkShowPinAltModeIcons->GetValue();
cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue();
cfg->m_Appearance.default_font = m_defaultFontCtrl->GetSelection() <= 0
// This is a keyword. Do not translate.
? wxString( KICAD_FONT_NAME )
: m_defaultFontCtrl->GetStringSelection();
cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue();
cfg->m_Appearance.show_hidden_fields = m_checkShowHiddenFields->GetValue();
cfg->m_Appearance.show_erc_warnings = m_checkShowERCWarnings->GetValue();
cfg->m_Appearance.show_erc_errors = m_checkShowERCErrors->GetValue();
cfg->m_Appearance.show_erc_exclusions = m_checkShowERCExclusions->GetValue();
cfg->m_Appearance.mark_sim_exclusions = m_cbMarkSimExclusions->GetValue();
cfg->m_Appearance.show_op_voltages = m_checkShowOPVoltages->GetValue();
cfg->m_Appearance.show_op_currents = m_checkShowOPCurrents->GetValue();
cfg->m_Appearance.show_pin_alt_icons = m_checkShowPinAltModeIcons->GetValue();
cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue();
cfg->m_Appearance.show_hop_over = m_cbHopOver->GetValue();
cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue();
cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue();
cfg->m_Selection.selection_thickness = KiROUND( m_selWidthCtrl->GetValue() );
cfg->m_Selection.highlight_thickness = KiROUND( m_highlightWidthCtrl->GetValue() );
cfg->m_Selection.highlight_netclass_colors = m_highlightNetclassColors->GetValue();
cfg->m_Selection.highlight_netclass_colors_thickness = m_colHighlightThickness->GetValue();
cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue();
cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue();
cfg->m_Selection.selection_thickness = KiROUND( m_selWidthCtrl->GetValue() );
cfg->m_Selection.highlight_thickness = KiROUND( m_highlightWidthCtrl->GetValue() );
cfg->m_Selection.highlight_netclass_colors = m_highlightNetclassColors->GetValue();
cfg->m_Selection.highlight_netclass_colors_thickness = m_colHighlightThickness->GetValue();
cfg->m_Selection.highlight_netclass_colors_alpha = m_colHighlightTransparency->GetValue() / 100.0;
cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue();
cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
cfg->m_CrossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue();
cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
cfg->m_CrossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
}
m_galOptsPanel->TransferDataFromWindow();

View File

@ -135,6 +135,11 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
m_checkPageLimits->SetValue(true);
bAppearanceSizer->Add( m_checkPageLimits, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbHopOver = new wxCheckBox( this, wxID_ANY, _("Hop hover on wire crossing"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbHopOver->SetToolTip( _("Show a hop hover when two wires are crossing") );
bAppearanceSizer->Add( m_cbHopOver, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bRightColumn->Add( bAppearanceSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 );

View File

@ -1432,6 +1432,71 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Hop hover on wire crossing</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbHopOver</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Show a hop hover when two wires are crossing</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="false">

View File

@ -58,6 +58,7 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
wxCheckBox* m_checkShowOPCurrents;
wxCheckBox* m_checkShowPinAltModeIcons;
wxCheckBox* m_checkPageLimits;
wxCheckBox* m_cbHopOver;
wxStaticText* m_selectionLabel;
wxStaticLine* m_staticline2;
wxCheckBox* m_checkSelDrawChildItems;

View File

@ -342,6 +342,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
plotOpts.m_plotPages = aPlotJob->m_plotPages;
plotOpts.m_theme = aPlotJob->m_theme;
plotOpts.m_useBackgroundColor = aPlotJob->m_useBackgroundColor;
plotOpts.m_plotHopOver = aPlotJob->m_show_hop_over;
schPlotter->Plot( format, plotOpts, renderSettings.get(), m_reporter );

View File

@ -244,6 +244,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
&m_Appearance.show_page_limits, true ) );
m_params.emplace_back( new PARAM<bool>( "appearance.show_hop_over",
&m_Appearance.show_hop_over, false ) );
m_params.emplace_back( new PARAM<bool>( "appearance.show_sexpr_file_convert_warning",
&m_Appearance.show_sexpr_file_convert_warning, true ) );

View File

@ -87,6 +87,7 @@ public:
bool show_pin_alt_icons;
bool show_illegal_symbol_lib_dialog;
bool show_page_limits;
bool show_hop_over;
bool show_sexpr_file_convert_warning;
bool show_sheet_filename_case_sensitivity_dialog;
};

View File

@ -1364,9 +1364,11 @@ void SCH_PAINTER::draw( const SCH_LINE* aLine, int aLayer )
bool highlightNetclassColors = false;
double highlightAlpha = 0.6;
EESCHEMA_SETTINGS* eeschemaCfg = eeconfig();
bool showHopOver = false;
if( eeschemaCfg )
{
showHopOver = eeschemaCfg->m_Appearance.show_hop_over;
highlightNetclassColors = eeschemaCfg->m_Selection.highlight_netclass_colors;
highlightAlpha = eeschemaCfg->m_Selection.highlight_netclass_colors_alpha;
}
@ -1482,8 +1484,15 @@ void SCH_PAINTER::draw( const SCH_LINE* aLine, int aLayer )
double lineWidth = getLineWidth( aLine, drawingShadows, drawingNetColorHighlights );
double arcRadius = lineWidth * ADVANCED_CFG::GetCfg().m_hopOverArcRadius;
std::vector<VECTOR3I> curr_wire_shape = aLine->BuildWireWithHopShape( m_schematic->GetCurrentScreen(),
arcRadius );
std::vector<VECTOR3I> curr_wire_shape;
if( aLine->IsWire() && showHopOver )
curr_wire_shape = aLine->BuildWireWithHopShape( m_schematic->GetCurrentScreen(), arcRadius );
else
{
curr_wire_shape.emplace_back( aLine->GetStartPoint().x, aLine->GetStartPoint().y, 0 );
curr_wire_shape.emplace_back( aLine->GetEndPoint().x, aLine->GetEndPoint().y, 0 );
}
for( size_t ii = 1; ii < curr_wire_shape.size(); ii++ )
{

View File

@ -57,6 +57,7 @@ struct SCH_PLOT_OPTS
bool m_plotDrawingSheet;
std::vector<wxString> m_plotPages;
bool m_plotHopOver;
bool m_blackAndWhite;
int m_pageSizeSelect;
bool m_useBackgroundColor;
@ -71,6 +72,7 @@ struct SCH_PLOT_OPTS
SCH_PLOT_OPTS() :
m_plotAll( true ),
m_plotDrawingSheet( true ),
m_plotHopOver( false ),
m_blackAndWhite( false ),
m_pageSizeSelect( 0 ),
m_useBackgroundColor( true ),

View File

@ -924,7 +924,7 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter, const SCH_PLOT_OPTS& aPlotOpts ) const
{
SCH_LINE* aLine = static_cast<SCH_LINE*>( item );
if( !aLine->IsWire() )
if( !aLine->IsWire() || !aPlotOpts.m_plotHopOver )
item->Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false );
else
{

View File

@ -38,6 +38,7 @@
#define ARG_EXCLUDE_PDF_HIERARCHICAL_LINKS "--exclude-pdf-hierarchical-links"
#define ARG_EXCLUDE_PDF_METADATA "--exclude-pdf-metadata"
#define ARG_FONT_NAME "--default-font"
#define ARG_DRAW_HOP_OVER "--draw-hop-over"
#define DEPRECATED_ARG_HPGL_PEN_SIZE "--pen-size"
#define DEPRECATED_ARG_HPGL_ORIGIN "--origin"
@ -72,6 +73,11 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
.help( UTF8STDSTR( _( "Default font name" ) ) )
.default_value( wxString( "" ).ToStdString() );
m_argParser.add_argument( ARG_DRAW_HOP_OVER )
.help( UTF8STDSTR( _( "Draw hop over at wire crossings" ) ) )
.implicit_value( true )
.default_value( false );
if( aPlotFormat == SCH_PLOT_FORMAT::PDF )
{
m_argParser.add_argument( ARG_EXCLUDE_PDF_PROPERTY_POPUPS )
@ -159,6 +165,7 @@ int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway )
plotJob->m_plotDrawingSheet = !m_argParser.get<bool>( ARG_EXCLUDE_DRAWING_SHEET );
plotJob->m_pageSizeSelect = JOB_PAGE_SIZE::PAGE_SIZE_AUTO;
plotJob->m_defaultFont = m_argParser.get( ARG_FONT_NAME );
plotJob->m_show_hop_over = m_argParser.get<bool>( ARG_DRAW_HOP_OVER );
if( m_plotFormat == SCH_PLOT_FORMAT::PDF
|| m_plotFormat == SCH_PLOT_FORMAT::POST