Improve informational hierarchy of PNS Router Settings dialog.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15182
This commit is contained in:
Jeff Young 2023-07-17 13:57:48 +01:00
parent 5e18287ff9
commit a1de7a77f4
5 changed files with 1096 additions and 851 deletions

View File

@ -27,16 +27,17 @@
#include <router/pns_routing_settings.h>
DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTINGS& aSettings ) :
DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings )
DIALOG_PNS_SETTINGS_BASE( aParent ),
m_settings( aSettings )
{
// Add tool tip to the mode radio box, one by option
// (cannot be made with wxFormBuilder for each item )
m_mode->SetItemToolTip( 0, _( "DRC violation: highlight obstacles" ) );
m_mode->SetItemToolTip( 1, _( "DRC violation: shove tracks and vias" ) );
m_mode->SetItemToolTip( 2, _( "DRC violation: walk around obstacles" ) );
// Load widgets' values from settings
m_mode->SetSelection( m_settings.Mode() );
switch( m_settings.Mode() )
{
case PNS::RM_MarkObstacles: m_rbMarkObstacles->SetValue( true ); break;
case PNS::RM_Shove: m_rbShove->SetValue( true ); break;
case PNS::RM_Walkaround: m_rbWalkaround->SetValue( true ); break;
}
m_shoveVias->SetValue( m_settings.ShoveVias() );
m_backPressure->SetValue( m_settings.JumpOverObstacles() );
m_removeLoops->SetValue( m_settings.RemoveLoops() );
@ -65,7 +66,10 @@ DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTIN
bool DIALOG_PNS_SETTINGS::TransferDataFromWindow()
{
// Save widgets' values to settings
m_settings.SetMode( (PNS::PNS_MODE) m_mode->GetSelection() );
if ( m_rbMarkObstacles->GetValue() ) m_settings.SetMode( PNS::RM_MarkObstacles );
else if( m_rbShove->GetValue() ) m_settings.SetMode( PNS::RM_Shove );
else if( m_rbWalkaround->GetValue() ) m_settings.SetMode( PNS::RM_Walkaround );
m_settings.SetShoveVias( m_shoveVias->GetValue() );
m_settings.SetJumpOverObstacles( m_backPressure->GetValue() );
m_settings.SetRemoveLoops( m_removeLoops->GetValue() );
@ -75,12 +79,8 @@ bool DIALOG_PNS_SETTINGS::TransferDataFromWindow()
m_settings.SetOptimizeEntireDraggedTrack( m_optimizeEntireDraggedTrack->GetValue() );
m_settings.SetAutoPosture( m_autoPosture->GetValue() );
m_settings.SetFixAllSegments( m_fixAllSegments->GetValue() );
if( m_violateDrc->IsEnabled() )
m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
if( m_freeAngleMode->IsEnabled() )
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
return true;
}
@ -88,26 +88,9 @@ bool DIALOG_PNS_SETTINGS::TransferDataFromWindow()
void DIALOG_PNS_SETTINGS::onModeChange( wxCommandEvent& aEvent )
{
if( m_mode->GetSelection() == PNS::RM_MarkObstacles )
{
m_freeAngleMode->SetValue( m_settings.GetFreeAngleMode() );
m_freeAngleMode->Enable();
m_freeAngleMode->Enable( m_rbMarkObstacles->GetValue() );
m_violateDrc->Enable( m_rbMarkObstacles->GetValue() );
m_violateDrc->SetValue( m_settings.GetAllowDRCViolationsSetting() );
m_violateDrc->Enable();
}
else
{
if( m_freeAngleMode->IsEnabled() )
m_settings.SetFreeAngleMode( m_freeAngleMode->GetValue() );
m_freeAngleMode->SetValue( false );
m_freeAngleMode->Enable( false );
if( m_violateDrc->IsEnabled() )
m_settings.SetAllowDRCViolations( m_violateDrc->GetValue() );
m_violateDrc->SetValue( false );
m_violateDrc->Enable( false );
}
m_shoveVias->Enable( m_rbShove->GetValue() );
m_backPressure->Enable( m_rbShove->GetValue() );
}

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
@ -19,32 +19,27 @@
* with this program. If not, see <http://www.gnu.or/licenses/>.
*/
/**
* Push and Shove router settings dialog.
*/
#ifndef __dialog_pns_settings__
#define __dialog_pns_settings__
#ifndef DIALOG_PNS_SETTINGS_H
#define DIALOG_PNS_SETTINGS_H
#include "dialog_pns_settings_base.h"
namespace PNS {
class ROUTING_SETTINGS;
}
class DIALOG_PNS_SETTINGS : public DIALOG_PNS_SETTINGS_BASE
{
public:
DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTINGS& aSettings );
public:
DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS::ROUTING_SETTINGS& aSettings );
bool TransferDataFromWindow() override;
bool TransferDataFromWindow() override;
private:
virtual void onModeChange( wxCommandEvent& aEvent ) override;
private:
virtual void onModeChange( wxCommandEvent& aEvent ) override;
PNS::ROUTING_SETTINGS& m_settings;
private:
PNS::ROUTING_SETTINGS& m_settings;
};
#endif // __dialog_pns_settings__
#endif // DIALOG_PNS_SETTINGS_H

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -16,70 +16,112 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxString m_modeChoices[] = { _("Highlight collisions"), _("Shove"), _("Walk around") };
int m_modeNChoices = sizeof( m_modeChoices ) / sizeof( wxString );
m_mode = new wxRadioBox( this, wxID_ANY, _("Mode"), wxDefaultPosition, wxDefaultSize, m_modeNChoices, m_modeChoices, 1, wxRA_SPECIFY_COLS );
m_mode->SetSelection( 0 );
bMainSizer->Add( m_mode, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bColumns;
bColumns = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* bOptions;
bOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
wxStaticBoxSizer* sbModeSizer;
sbModeSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Mode") ), wxVERTICAL );
m_freeAngleMode = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Free angle mode (no shove/walkaround)"), wxDefaultPosition, wxDefaultSize, 0 );
bOptions->Add( m_freeAngleMode, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_rbMarkObstacles = new wxRadioButton( sbModeSizer->GetStaticBox(), wxID_ANY, _("Highlight collisions"), wxDefaultPosition, wxDefaultSize, 0 );
sbModeSizer->Add( m_rbMarkObstacles, 0, wxRIGHT, 5 );
m_shoveVias = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Shove vias"), wxDefaultPosition, wxDefaultSize, 0 );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_freeAngleMode = new wxCheckBox( sbModeSizer->GetStaticBox(), wxID_ANY, _("Free angle mode"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_freeAngleMode, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
m_violateDrc = new wxCheckBox( sbModeSizer->GetStaticBox(), wxID_ANY, _("Allow DRC violations"), wxDefaultPosition, wxDefaultSize, 0 );
m_violateDrc->SetToolTip( _("(Highlight collisions mode only) - allows one to establish a track even if is violating the DRC rules.") );
bSizer2->Add( m_violateDrc, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
sbModeSizer->Add( bSizer2, 0, wxRIGHT|wxLEFT, 20 );
sbModeSizer->Add( 0, 15, 1, wxEXPAND, 5 );
m_rbShove = new wxRadioButton( sbModeSizer->GetStaticBox(), wxID_ANY, _("Shove"), wxDefaultPosition, wxDefaultSize, 0 );
sbModeSizer->Add( m_rbShove, 0, wxRIGHT, 5 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
m_shoveVias = new wxCheckBox( sbModeSizer->GetStaticBox(), wxID_ANY, _("Shove vias"), wxDefaultPosition, wxDefaultSize, 0 );
m_shoveVias->SetToolTip( _("When disabled, vias are treated as un-movable objects and hugged instead of shoved.") );
bOptions->Add( m_shoveVias, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bSizer3->Add( m_shoveVias, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
m_backPressure = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Jump over obstacles"), wxDefaultPosition, wxDefaultSize, 0 );
m_backPressure = new wxCheckBox( sbModeSizer->GetStaticBox(), wxID_ANY, _("Jump over obstacles"), wxDefaultPosition, wxDefaultSize, 0 );
m_backPressure->SetToolTip( _("When enabled, the router tries to move colliding traces behind solid obstacles (e.g. pads) instead of \"reflecting\" back the collision") );
bOptions->Add( m_backPressure, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bSizer3->Add( m_backPressure, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
sbModeSizer->Add( bSizer3, 0, wxRIGHT|wxLEFT, 20 );
sbModeSizer->Add( 0, 15, 1, wxEXPAND, 5 );
m_rbWalkaround = new wxRadioButton( sbModeSizer->GetStaticBox(), wxID_ANY, _("Walk around"), wxDefaultPosition, wxDefaultSize, 0 );
sbModeSizer->Add( m_rbWalkaround, 0, wxBOTTOM|wxRIGHT, 5 );
bColumns->Add( sbModeSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bColumns->Add( 5, 0, 0, 0, 5 );
wxStaticBoxSizer* bOptions;
bOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General Options") ), wxVERTICAL );
wxGridSizer* gSizer1;
gSizer1 = new wxGridSizer( 0, 1, 2, 0 );
m_removeLoops = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Remove redundant tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_removeLoops->SetToolTip( _("Removes loops while routing (e.g. if the new track ensures same connectivity as an already existing one, the old track is removed).\nLoop removal works locally (only between the start and end of the currently routed trace).") );
bOptions->Add( m_removeLoops, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
gSizer1->Add( m_removeLoops, 0, wxRIGHT|wxLEFT, 5 );
m_smartPads = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Optimize pad connections"), wxDefaultPosition, wxDefaultSize, 0 );
m_smartPads->SetToolTip( _("When enabled, the router tries to break out pads/vias in a clean way, avoiding acute angles and jagged breakout traces.") );
bOptions->Add( m_smartPads, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
gSizer1->Add( m_smartPads, 0, wxRIGHT|wxLEFT, 5 );
m_smoothDragged = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Smooth dragged segments"), wxDefaultPosition, wxDefaultSize, 0 );
m_smoothDragged->SetToolTip( _("When enabled, the router attempts to merge several jagged segments into a single straight one (dragging mode).") );
bOptions->Add( m_smoothDragged, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_violateDrc = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Allow DRC violations"), wxDefaultPosition, wxDefaultSize, 0 );
m_violateDrc->SetToolTip( _("(Highlight collisions mode only) - allows one to establish a track even if is violating the DRC rules.") );
bOptions->Add( m_violateDrc, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
gSizer1->Add( m_smoothDragged, 0, wxRIGHT|wxLEFT, 5 );
m_suggestEnding = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Suggest track finish"), wxDefaultPosition, wxDefaultSize, 0 );
m_suggestEnding->Enable( false );
bOptions->Add( m_suggestEnding, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
gSizer1->Add( m_suggestEnding, 0, wxRIGHT|wxLEFT, 5 );
m_optimizeEntireDraggedTrack = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Optimize entire track being dragged"), wxDefaultPosition, wxDefaultSize, 0 );
m_optimizeEntireDraggedTrack->SetToolTip( _("When enabled, the entire portion of the track that is visible on the screen will be optimized and re-routed when a segment is dragged. When disabled, only the area near the segment being dragged will be optimized.") );
bOptions->Add( m_optimizeEntireDraggedTrack, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
gSizer1->Add( m_optimizeEntireDraggedTrack, 0, wxRIGHT|wxLEFT, 5 );
m_autoPosture = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Use mouse path to set track posture"), wxDefaultPosition, wxDefaultSize, 0 );
m_autoPosture->SetToolTip( _("When enabled, the posture of tracks will be guided by how the mouse is moved from the starting location") );
bOptions->Add( m_autoPosture, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
gSizer1->Add( m_autoPosture, 0, wxRIGHT|wxLEFT, 5 );
m_fixAllSegments = new wxCheckBox( bOptions->GetStaticBox(), wxID_ANY, _("Fix all segments on click"), wxDefaultPosition, wxDefaultSize, 0 );
m_fixAllSegments->SetToolTip( _("When enabled, all track segments will be fixed in place up to the cursor location. When disabled, the last segment (closest to the cursor) will remain free and follow the cursor.") );
bOptions->Add( m_fixAllSegments, 0, wxALL, 5 );
gSizer1->Add( m_fixAllSegments, 0, wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bOptions, 1, wxEXPAND|wxALL, 5 );
bOptions->Add( gSizer1, 1, wxEXPAND, 5 );
bColumns->Add( bOptions, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bColumns, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
@ -96,16 +138,20 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID
bMainSizer->Fit( this );
// Connect Events
m_mode->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onModeChange ), NULL, this );
m_rbMarkObstacles->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onModeChange ), NULL, this );
m_freeAngleMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onFreeAngleModeChange ), NULL, this );
m_rbShove->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onModeChange ), NULL, this );
m_rbWalkaround->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onModeChange ), NULL, this );
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this );
}
DIALOG_PNS_SETTINGS_BASE::~DIALOG_PNS_SETTINGS_BASE()
{
// Disconnect Events
m_mode->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onModeChange ), NULL, this );
m_rbMarkObstacles->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onModeChange ), NULL, this );
m_freeAngleMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onFreeAngleModeChange ), NULL, this );
m_rbShove->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onModeChange ), NULL, this );
m_rbWalkaround->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::onModeChange ), NULL, this );
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -12,7 +12,7 @@
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/radiobut.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
@ -34,14 +34,16 @@ class DIALOG_PNS_SETTINGS_BASE : public DIALOG_SHIM
private:
protected:
wxRadioBox* m_mode;
wxRadioButton* m_rbMarkObstacles;
wxCheckBox* m_freeAngleMode;
wxCheckBox* m_violateDrc;
wxRadioButton* m_rbShove;
wxCheckBox* m_shoveVias;
wxCheckBox* m_backPressure;
wxRadioButton* m_rbWalkaround;
wxCheckBox* m_removeLoops;
wxCheckBox* m_smartPads;
wxCheckBox* m_smoothDragged;
wxCheckBox* m_violateDrc;
wxCheckBox* m_suggestEnding;
wxCheckBox* m_optimizeEntireDraggedTrack;
wxCheckBox* m_autoPosture;