From ca9df9986a00973825b49c9ea178dce772f67040 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 15 Jun 2025 15:02:00 +0200 Subject: [PATCH] Make show hop over a configurable option --- common/jobs/job_export_sch_plot.cpp | 4 ++ common/jobs/job_export_sch_plot.h | 1 + eeschema/dialogs/dialog_plot_schematic.cpp | 3 + .../panel_eeschema_display_options.cpp | 50 +++++++------- .../panel_eeschema_display_options_base.cpp | 5 ++ .../panel_eeschema_display_options_base.fbp | 65 +++++++++++++++++++ .../panel_eeschema_display_options_base.h | 1 + eeschema/eeschema_jobs_handler.cpp | 1 + eeschema/eeschema_settings.cpp | 3 + eeschema/eeschema_settings.h | 1 + eeschema/sch_painter.cpp | 13 +++- eeschema/sch_plotter.h | 2 + eeschema/sch_screen.cpp | 2 +- kicad/cli/command_sch_export_plot.cpp | 7 ++ 14 files changed, 131 insertions(+), 27 deletions(-) diff --git a/common/jobs/job_export_sch_plot.cpp b/common/jobs/job_export_sch_plot.cpp index c3746169ea..621ba57521 100644 --- a/common/jobs/job_export_sch_plot.cpp +++ b/common/jobs/job_export_sch_plot.cpp @@ -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( "black_and_white", &m_blackAndWhite, m_blackAndWhite ) ); + m_params.emplace_back( new JOB_PARAM( "show_hop_over", + &m_blackAndWhite, m_show_hop_over ) ); + m_params.emplace_back( new JOB_PARAM( "page_size", &m_pageSizeSelect, m_pageSizeSelect ) ); diff --git a/common/jobs/job_export_sch_plot.h b/common/jobs/job_export_sch_plot.h index 89a280a358..fdc75f4b2c 100644 --- a/common/jobs/job_export_sch_plot.h +++ b/common/jobs/job_export_sch_plot.h @@ -58,6 +58,7 @@ public: bool m_plotDrawingSheet; std::vector m_plotPages; + bool m_show_hop_over; bool m_blackAndWhite; JOB_PAGE_SIZE m_pageSizeSelect; bool m_useBackgroundColor; diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index be29101d15..4c442f1ed0 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -413,6 +413,8 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll ) renderSettings.m_ShowHiddenPins = false; renderSettings.m_ShowHiddenFields = false; + EESCHEMA_SETTINGS* cfg = dynamic_cast( Kiface().KifaceSettings() ); + getPlotOptions( &renderSettings ); std::unique_ptr schPlotter = std::make_unique( 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() ); diff --git a/eeschema/dialogs/panel_eeschema_display_options.cpp b/eeschema/dialogs/panel_eeschema_display_options.cpp index e23bb63645..5a4831bb97 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options.cpp @@ -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" ) ) { - 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(); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.cpp b/eeschema/dialogs/panel_eeschema_display_options_base.cpp index 08dd32d47a..b46257895b 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.cpp @@ -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 ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.fbp b/eeschema/dialogs/panel_eeschema_display_options_base.fbp index 26bc72dc79..189048b51f 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.fbp @@ -1432,6 +1432,71 @@ + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Hop hover on wire crossing + + 0 + + + 0 + + 1 + m_cbHopOver + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Show a hop hover when two wires are crossing + + wxFILTER_NONE + wxDefaultValidator + + + + + + diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.h b/eeschema/dialogs/panel_eeschema_display_options_base.h index 9cee0d27a5..8b32f120a1 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.h +++ b/eeschema/dialogs/panel_eeschema_display_options_base.h @@ -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; diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp index d0e3bdf731..9b0c55d4fe 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/eeschema/eeschema_jobs_handler.cpp @@ -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 ); diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index 82a7bc8bdd..ef1b4853b0 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -244,6 +244,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : m_params.emplace_back( new PARAM( "appearance.show_page_limits", &m_Appearance.show_page_limits, true ) ); + m_params.emplace_back( new PARAM( "appearance.show_hop_over", + &m_Appearance.show_hop_over, false ) ); + m_params.emplace_back( new PARAM( "appearance.show_sexpr_file_convert_warning", &m_Appearance.show_sexpr_file_convert_warning, true ) ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index cc749ba58f..715f7b2cbd 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -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; }; diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 2f20279c0a..12824355d5 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -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 curr_wire_shape = aLine->BuildWireWithHopShape( m_schematic->GetCurrentScreen(), - arcRadius ); + std::vector 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++ ) { diff --git a/eeschema/sch_plotter.h b/eeschema/sch_plotter.h index 31797ddb9a..bf05073334 100644 --- a/eeschema/sch_plotter.h +++ b/eeschema/sch_plotter.h @@ -57,6 +57,7 @@ struct SCH_PLOT_OPTS bool m_plotDrawingSheet; std::vector 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 ), diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 81f605deac..ef5567ff49 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -924,7 +924,7 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter, const SCH_PLOT_OPTS& aPlotOpts ) const { SCH_LINE* aLine = static_cast( item ); - if( !aLine->IsWire() ) + if( !aLine->IsWire() || !aPlotOpts.m_plotHopOver ) item->Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false ); else { diff --git a/kicad/cli/command_sch_export_plot.cpp b/kicad/cli/command_sch_export_plot.cpp index 63f7986514..d8f77840c5 100644 --- a/kicad/cli/command_sch_export_plot.cpp +++ b/kicad/cli/command_sch_export_plot.cpp @@ -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( 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( ARG_DRAW_HOP_OVER ); if( m_plotFormat == SCH_PLOT_FORMAT::PDF || m_plotFormat == SCH_PLOT_FORMAT::POST