Improve consistency and hotkey access in Appearances.

Added hotkey for cycling through net & netclass color modes.
Added hotkey for cycling through ratsnest layer visibilities.
Added code to display hotkey (if set) on the above and on high-contrast
cycle.

Fixes https://gitlab.com/kicad/code/kicad/issues/9312
This commit is contained in:
Jeff Young 2021-10-04 13:42:08 +01:00
parent 78ddb1408f
commit ffd6fde700
10 changed files with 236 additions and 212 deletions

View File

@ -530,14 +530,15 @@ TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle",
TOOL_ACTION ACTIONS::highContrastMode( "common.Control.highContrastMode", TOOL_ACTION ACTIONS::highContrastMode( "common.Control.highContrastMode",
AS_GLOBAL, AS_GLOBAL,
0, LEGACY_HK_NAME( "Toggle High Contrast Mode" ), 0, LEGACY_HK_NAME( "Toggle High Contrast Mode" ),
_( "Single Layer View Mode" ), _( "Toggle inactive layers between normal and dimmed" ), _( "Inactive Layer View Mode" ),
_( "Toggle inactive layers between normal and dimmed" ),
BITMAPS::contrast_mode ); BITMAPS::contrast_mode );
TOOL_ACTION ACTIONS::highContrastModeCycle( "common.Control.highContrastModeCycle", TOOL_ACTION ACTIONS::highContrastModeCycle( "common.Control.highContrastModeCycle",
AS_GLOBAL, AS_GLOBAL,
'H', "", 'H', "",
_( "Single Layer View Mode (3-state)" ), _( "Inactive Layer View Mode (3-state)" ),
_( "Toggle inactive layers between normal, dimmed, and hidden" ), _( "Cycle inactive layers between normal, dimmed, and hidden" ),
BITMAPS::contrast_mode ); BITMAPS::contrast_mode );
TOOL_ACTION ACTIONS::selectionTool( "common.InteractiveSelection.selectionTool", TOOL_ACTION ACTIONS::selectionTool( "common.InteractiveSelection.selectionTool",

View File

@ -793,6 +793,16 @@ TOOL_ACTION PCB_ACTIONS::ratsnestLineMode( "pcbnew.Control.ratsnestLineMode",
_( "Curved Ratsnest Lines" ), _( "Show ratsnest with curved lines" ), _( "Curved Ratsnest Lines" ), _( "Show ratsnest with curved lines" ),
BITMAPS::curved_ratsnest ); BITMAPS::curved_ratsnest );
TOOL_ACTION PCB_ACTIONS::ratsnestModeCycle( "pcbnew.Control.ratsnestModeCycle",
AS_GLOBAL, 0, "",
_( "Ratsnest Mode (3-state)" ),
_( "Cycle between showing ratsnests for all layers, just visible layers, and none" ) );
TOOL_ACTION PCB_ACTIONS::netColorModeCycle( "pcbnew.Control.netColorMode",
AS_GLOBAL, 0, "",
_( "Net Color Mode (3-state)" ),
_( "Cycle between using net and netclass colors for all nets, just ratsnests, and none" ) );
TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode", TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
AS_GLOBAL, AS_GLOBAL,
'K', LEGACY_HK_NAME( "Track Display Mode" ), 'K', LEGACY_HK_NAME( "Track Display Mode" ),

View File

@ -237,6 +237,8 @@ public:
// Display modes // Display modes
static TOOL_ACTION showRatsnest; static TOOL_ACTION showRatsnest;
static TOOL_ACTION ratsnestLineMode; static TOOL_ACTION ratsnestLineMode;
static TOOL_ACTION netColorModeCycle;
static TOOL_ACTION ratsnestModeCycle;
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

@ -284,10 +284,9 @@ int PCB_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
{ {
PCB_DISPLAY_OPTIONS opts = displayOptions(); PCB_DISPLAY_OPTIONS opts = displayOptions();
opts.m_ContrastModeDisplay = opts.m_ContrastModeDisplay = opts.m_ContrastModeDisplay == HIGH_CONTRAST_MODE::NORMAL
( opts.m_ContrastModeDisplay == HIGH_CONTRAST_MODE::NORMAL ) ? ? HIGH_CONTRAST_MODE::DIMMED
HIGH_CONTRAST_MODE::DIMMED : : HIGH_CONTRAST_MODE::NORMAL;
HIGH_CONTRAST_MODE::NORMAL;
m_frame->SetDisplayOptions( opts ); m_frame->SetDisplayOptions( opts );
@ -312,6 +311,47 @@ int PCB_CONTROL::HighContrastModeCycle( const TOOL_EVENT& aEvent )
} }
int PCB_CONTROL::NetColorModeCycle( const TOOL_EVENT& aEvent )
{
PCB_DISPLAY_OPTIONS opts = displayOptions();
switch( opts.m_NetColorMode )
{
case NET_COLOR_MODE::ALL: opts.m_NetColorMode = NET_COLOR_MODE::RATSNEST; break;
case NET_COLOR_MODE::RATSNEST: opts.m_NetColorMode = NET_COLOR_MODE::OFF; break;
case NET_COLOR_MODE::OFF: opts.m_NetColorMode = NET_COLOR_MODE::ALL; break;
}
m_frame->SetDisplayOptions( opts );
return 0;
}
int PCB_CONTROL::RatsnestModeCycle( const TOOL_EVENT& aEvent )
{
PCB_DISPLAY_OPTIONS opts = displayOptions();
if( !opts.m_ShowGlobalRatsnest )
{
opts.m_ShowGlobalRatsnest = true;
opts.m_RatsnestMode = RATSNEST_MODE::ALL;
}
else if( opts.m_RatsnestMode == RATSNEST_MODE::ALL )
{
opts.m_RatsnestMode = RATSNEST_MODE::VISIBLE;
}
else
{
opts.m_ShowGlobalRatsnest = false;
}
m_frame->SetDisplayOptions( opts );
return 0;
}
int PCB_CONTROL::LayerSwitch( const TOOL_EVENT& aEvent ) int PCB_CONTROL::LayerSwitch( const TOOL_EVENT& aEvent )
{ {
m_frame->SwitchLayer( nullptr, aEvent.Parameter<PCB_LAYER_ID>() ); m_frame->SwitchLayer( nullptr, aEvent.Parameter<PCB_LAYER_ID>() );
@ -1238,6 +1278,8 @@ void PCB_CONTROL::setTransitions()
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayToggle.MakeEvent() ); Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayToggle.MakeEvent() );
Go( &PCB_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() ); Go( &PCB_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() );
Go( &PCB_CONTROL::HighContrastModeCycle, ACTIONS::highContrastModeCycle.MakeEvent() ); Go( &PCB_CONTROL::HighContrastModeCycle, ACTIONS::highContrastModeCycle.MakeEvent() );
Go( &PCB_CONTROL::NetColorModeCycle, PCB_ACTIONS::netColorModeCycle.MakeEvent() );
Go( &PCB_CONTROL::RatsnestModeCycle, PCB_ACTIONS::ratsnestModeCycle.MakeEvent() );
Go( &PCB_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() ); Go( &PCB_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() );
// Layer control // Layer control

View File

@ -65,8 +65,10 @@ public:
// Update the view with the new high-contrast mode from the display settings // Update the view with the new high-contrast mode from the display settings
int HighContrastMode( const TOOL_EVENT& aEvent ); int HighContrastMode( const TOOL_EVENT& aEvent );
// Rotate through the available high-contrast modes // Rotate through the available high-contrast, net color and ratsnest color modes
int HighContrastModeCycle( const TOOL_EVENT& aEvent ); int HighContrastModeCycle( const TOOL_EVENT& aEvent );
int NetColorModeCycle( const TOOL_EVENT& aEvent );
int RatsnestModeCycle( const TOOL_EVENT& aEvent );
// Layer control // Layer control
int LayerSwitch( const TOOL_EVENT& aEvent ); int LayerSwitch( const TOOL_EVENT& aEvent );

View File

@ -431,7 +431,6 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo
m_windowLayers->SetFont( infoFont ); m_windowLayers->SetFont( infoFont );
m_windowObjects->SetFont( infoFont ); m_windowObjects->SetFont( infoFont );
m_presetsLabel->SetFont( infoFont ); m_presetsLabel->SetFont( infoFont );
m_presetsHotkey->SetFont( infoFont );
createControls(); createControls();
@ -542,12 +541,12 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo
m_netsGrid->SetDefaultCellFont( font ); m_netsGrid->SetDefaultCellFont( font );
m_netsGrid->SetDefaultRowSize( font.GetPixelSize().y + rowHeightPadding ); m_netsGrid->SetDefaultRowSize( font.GetPixelSize().y + rowHeightPadding );
m_netsGrid->GetGridWindow()->Bind( wxEVT_MOTION, m_netsGrid->GetGridWindow()->Bind( wxEVT_MOTION, &APPEARANCE_CONTROLS::OnNetGridMouseEvent,
&APPEARANCE_CONTROLS::OnNetGridMouseEvent, this ); this );
// To handle middle click on color swatches // To handle middle click on color swatches
m_netsGrid->GetGridWindow()->Bind( wxEVT_MIDDLE_UP, m_netsGrid->GetGridWindow()->Bind( wxEVT_MIDDLE_UP, &APPEARANCE_CONTROLS::OnNetGridMouseEvent,
&APPEARANCE_CONTROLS::OnNetGridMouseEvent, this ); this );
m_netsGrid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT ); m_netsGrid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT );
m_netclassScrolledWindow->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT ); m_netclassScrolledWindow->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT );
@ -575,6 +574,10 @@ APPEARANCE_CONTROLS::~APPEARANCE_CONTROLS()
void APPEARANCE_CONTROLS::createControls() void APPEARANCE_CONTROLS::createControls()
{ {
int hotkey;
wxString msg;
wxFont infoFont = KIUI::GetInfoFont( this );
// Create layer display options // Create layer display options
m_paneLayerDisplayOptions = new WX_COLLAPSIBLE_PANE( m_panelLayers, wxID_ANY, m_paneLayerDisplayOptions = new WX_COLLAPSIBLE_PANE( m_panelLayers, wxID_ANY,
_( "Layer Display Options" ) ); _( "Layer Display Options" ) );
@ -586,34 +589,43 @@ void APPEARANCE_CONTROLS::createControls()
wxBoxSizer* layerDisplayOptionsSizer; wxBoxSizer* layerDisplayOptionsSizer;
layerDisplayOptionsSizer = new wxBoxSizer( wxVERTICAL ); layerDisplayOptionsSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextContrastModeTitle = new wxStaticText( layerDisplayPane, wxID_ANY, hotkey = PCB_ACTIONS::highContrastModeCycle.GetHotKey();
_( "Inactive layers:" ), wxDefaultPosition,
wxDefaultSize, 0 ); if( hotkey )
m_staticTextContrastModeTitle->Wrap( -1 ); msg = wxString::Format( _( "Inactive layers (%s):" ), KeyNameFromKeyCode( hotkey ) );
layerDisplayOptionsSizer->Add( m_staticTextContrastModeTitle, 0, else
wxEXPAND | wxBOTTOM | wxLEFT, 2 ); msg = _( "Inactive layers:" );
m_inactiveLayersLabel = new wxStaticText( layerDisplayPane, wxID_ANY, msg );
m_inactiveLayersLabel->SetFont( infoFont );
m_inactiveLayersLabel->Wrap( -1 );
layerDisplayOptionsSizer->Add( m_inactiveLayersLabel, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2 );
wxBoxSizer* contrastModeSizer; wxBoxSizer* contrastModeSizer;
contrastModeSizer = new wxBoxSizer( wxHORIZONTAL ); contrastModeSizer = new wxBoxSizer( wxHORIZONTAL );
m_rbHighContrastNormal = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Normal" ), m_rbHighContrastNormal = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Normal" ),
wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbHighContrastNormal->SetFont( infoFont );
m_rbHighContrastNormal->SetValue( true ); m_rbHighContrastNormal->SetValue( true );
m_rbHighContrastNormal->SetToolTip( _( "Inactive layers will be shown in full color" ) ); m_rbHighContrastNormal->SetToolTip( _( "Inactive layers will be shown in full color" ) );
contrastModeSizer->Add( m_rbHighContrastNormal, 0, wxRIGHT, 4 ); contrastModeSizer->Add( m_rbHighContrastNormal, 0, wxRIGHT, 5 );
contrastModeSizer->AddStretchSpacer();
m_rbHighContrastDim = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Dim" ), m_rbHighContrastDim = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Dim" ) );
wxDefaultPosition, wxDefaultSize, 0 ); m_rbHighContrastDim->SetFont( infoFont );
m_rbHighContrastDim->SetToolTip( _( "Inactive layers will be dimmed" ) ); m_rbHighContrastDim->SetToolTip( _( "Inactive layers will be dimmed" ) );
contrastModeSizer->Add( m_rbHighContrastDim, 0, wxRIGHT | wxLEFT, 10 ); contrastModeSizer->Add( m_rbHighContrastDim, 0, wxRIGHT, 5 );
contrastModeSizer->AddStretchSpacer();
m_rbHighContrastOff = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Hide" ), m_rbHighContrastOff = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Hide" ) );
wxDefaultPosition, wxDefaultSize, 0 ); m_rbHighContrastOff->SetFont( infoFont );
m_rbHighContrastOff->SetToolTip( _( "Inactive layers will be hidden" ) ); m_rbHighContrastOff->SetToolTip( _( "Inactive layers will be hidden" ) );
contrastModeSizer->Add( m_rbHighContrastOff, 0, 0, 5 ); contrastModeSizer->Add( m_rbHighContrastOff, 0, 0, 5 );
contrastModeSizer->AddStretchSpacer();
layerDisplayOptionsSizer->Add( contrastModeSizer, 0, wxEXPAND, 5 ); layerDisplayOptionsSizer->Add( contrastModeSizer, 0, wxEXPAND, 5 );
@ -621,8 +633,8 @@ void APPEARANCE_CONTROLS::createControls()
wxDefaultSize, wxLI_HORIZONTAL ); wxDefaultSize, wxLI_HORIZONTAL );
layerDisplayOptionsSizer->Add( m_layerDisplaySeparator, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 ); layerDisplayOptionsSizer->Add( m_layerDisplaySeparator, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 );
m_cbFlipBoard = new wxCheckBox( layerDisplayPane, wxID_ANY, _( "Flip board view" ), m_cbFlipBoard = new wxCheckBox( layerDisplayPane, wxID_ANY, _( "Flip board view" ) );
wxDefaultPosition, wxDefaultSize, 0 ); m_cbFlipBoard->SetFont( infoFont );
layerDisplayOptionsSizer->Add( m_cbFlipBoard, 0, 0, 5 ); layerDisplayOptionsSizer->Add( m_cbFlipBoard, 0, 0, 5 );
layerDisplayPane->SetSizer( layerDisplayOptionsSizer ); layerDisplayPane->SetSizer( layerDisplayOptionsSizer );
@ -652,8 +664,15 @@ void APPEARANCE_CONTROLS::createControls()
//// Net color mode //// Net color mode
m_txtNetDisplayTitle = new wxStaticText( netDisplayPane, wxID_ANY, _( "Net colors:" ), hotkey = PCB_ACTIONS::netColorModeCycle.GetHotKey();
wxDefaultPosition, wxDefaultSize, 0 );
if( hotkey )
msg = wxString::Format( _( "Net colors (%s):" ), KeyNameFromKeyCode( hotkey ) );
else
msg = _( "Net colors:" );
m_txtNetDisplayTitle = new wxStaticText( netDisplayPane, wxID_ANY, msg );
m_txtNetDisplayTitle->SetFont( infoFont );
m_txtNetDisplayTitle->Wrap( -1 ); m_txtNetDisplayTitle->Wrap( -1 );
m_txtNetDisplayTitle->SetToolTip( _( "Choose when to show net and netclass colors" ) ); m_txtNetDisplayTitle->SetToolTip( _( "Choose when to show net and netclass colors" ) );
@ -663,19 +682,22 @@ void APPEARANCE_CONTROLS::createControls()
m_rbNetColorAll = new wxRadioButton( netDisplayPane, wxID_ANY, _( "All" ), wxDefaultPosition, m_rbNetColorAll = new wxRadioButton( netDisplayPane, wxID_ANY, _( "All" ), wxDefaultPosition,
wxDefaultSize, wxRB_GROUP ); wxDefaultSize, wxRB_GROUP );
m_rbNetColorAll->SetFont( infoFont );
m_rbNetColorAll->SetToolTip( _( "Net and netclass colors are shown on all copper items" ) ); m_rbNetColorAll->SetToolTip( _( "Net and netclass colors are shown on all copper items" ) );
netColorSizer->Add( m_rbNetColorAll, 0, wxRIGHT, 10 ); netColorSizer->Add( m_rbNetColorAll, 0, wxRIGHT, 5 );
netColorSizer->AddStretchSpacer();
m_rbNetColorRatsnest = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Ratsnest" ), m_rbNetColorRatsnest = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Ratsnest" ) );
wxDefaultPosition, wxDefaultSize, 0 ); m_rbNetColorRatsnest->SetFont( infoFont );
m_rbNetColorRatsnest->SetValue( true ); m_rbNetColorRatsnest->SetValue( true );
m_rbNetColorRatsnest->SetToolTip( _( "Net and netclass colors are shown on the ratsnest only" ) ); m_rbNetColorRatsnest->SetToolTip( _( "Net and netclass colors are shown on the ratsnest only" ) );
netColorSizer->Add( m_rbNetColorRatsnest, 0, wxRIGHT, 4 ); netColorSizer->Add( m_rbNetColorRatsnest, 0, wxRIGHT, 5 );
netColorSizer->AddStretchSpacer();
m_rbNetColorOff = new wxRadioButton( netDisplayPane, wxID_ANY, _( "None" ), wxDefaultPosition, m_rbNetColorOff = new wxRadioButton( netDisplayPane, wxID_ANY, _( "None" ) );
wxDefaultSize, 0 ); m_rbNetColorOff->SetFont( infoFont );
m_rbNetColorOff->SetToolTip( _( "Net and netclass colors are not shown" ) ); m_rbNetColorOff->SetToolTip( _( "Net and netclass colors are not shown" ) );
netColorSizer->Add( m_rbNetColorOff, 0, 0, 5 ); netColorSizer->Add( m_rbNetColorOff, 0, 0, 5 );
@ -684,27 +706,43 @@ void APPEARANCE_CONTROLS::createControls()
//// Ratsnest display //// Ratsnest display
m_txtRatsnestVisibility = new wxStaticText( netDisplayPane, wxID_ANY, _( "Ratsnest display:" ), hotkey = PCB_ACTIONS::ratsnestModeCycle.GetHotKey();
wxDefaultPosition, wxDefaultSize, 0 );
if( hotkey )
msg = wxString::Format( _( "Ratsnest display (%s):" ), KeyNameFromKeyCode( hotkey ) );
else
msg = _( "Ratsnest display:" );
m_txtRatsnestVisibility = new wxStaticText( netDisplayPane, wxID_ANY, msg );
m_txtRatsnestVisibility->SetFont( infoFont );
m_txtRatsnestVisibility->Wrap( -1 ); m_txtRatsnestVisibility->Wrap( -1 );
m_txtRatsnestVisibility->SetToolTip( _( "Choose what ratsnest lines to display" ) ); m_txtRatsnestVisibility->SetToolTip( _( "Choose which ratsnest lines to display" ) );
netDisplayOptionsSizer->Add( m_txtRatsnestVisibility, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2 ); netDisplayOptionsSizer->Add( m_txtRatsnestVisibility, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2 );
wxBoxSizer* ratsnestDisplayModeSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* ratsnestDisplayModeSizer = new wxBoxSizer( wxHORIZONTAL );
m_rbRatsnestAllLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "All layers" ), m_rbRatsnestAllLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "All" ),
wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbRatsnestAllLayers->SetToolTip( _( "Ratsnest lines are shown to items on all layers" ) ); m_rbRatsnestAllLayers->SetFont( infoFont );
m_rbRatsnestAllLayers->SetValue( true ); m_rbRatsnestAllLayers->SetValue( true );
m_rbRatsnestAllLayers->SetToolTip( _( "Show ratsnest lines to items on all layers" ) );
ratsnestDisplayModeSizer->Add( m_rbRatsnestAllLayers, 0, wxRIGHT, 10 ); ratsnestDisplayModeSizer->Add( m_rbRatsnestAllLayers, 0, wxRIGHT, 5 );
ratsnestDisplayModeSizer->AddStretchSpacer();
m_rbRatsnestVisibleLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Visible layers" ), m_rbRatsnestVisLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Visible layers" ) );
wxDefaultPosition, wxDefaultSize, 0 ); m_rbRatsnestVisLayers->SetFont( infoFont );
m_rbRatsnestVisibleLayers->SetToolTip( _( "Ratsnest lines are shown to items on visible layers" ) ); m_rbRatsnestVisLayers->SetToolTip( _( "Show ratsnest lines to items on visible layers" ) );
ratsnestDisplayModeSizer->Add( m_rbRatsnestVisibleLayers, 0, wxRIGHT, 4 ); ratsnestDisplayModeSizer->Add( m_rbRatsnestVisLayers, 0, wxRIGHT, 5 );
ratsnestDisplayModeSizer->AddStretchSpacer();
m_rbRatsnestNone = new wxRadioButton( netDisplayPane, wxID_ANY, _( "None" ) );
m_rbRatsnestNone->SetFont( infoFont );
m_rbRatsnestNone->SetToolTip( _( "Hide all ratsnest lines" ) );
ratsnestDisplayModeSizer->Add( m_rbRatsnestNone, 0, 0, 5 );
netDisplayOptionsSizer->Add( ratsnestDisplayModeSizer, 0, wxEXPAND | wxBOTTOM, 5 ); netDisplayOptionsSizer->Add( ratsnestDisplayModeSizer, 0, wxEXPAND | wxBOTTOM, 5 );
@ -726,15 +764,13 @@ void APPEARANCE_CONTROLS::createControls()
Thaw(); Thaw();
} ); } );
m_rbNetColorAll->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorModeChanged, this ); m_rbNetColorAll->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this );
m_rbNetColorOff->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorModeChanged, this ); m_rbNetColorOff->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this );
m_rbNetColorRatsnest->Bind( wxEVT_RADIOBUTTON, m_rbNetColorRatsnest->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this );
&APPEARANCE_CONTROLS::onNetColorModeChanged, this );
m_rbRatsnestAllLayers->Bind( wxEVT_RADIOBUTTON, m_rbRatsnestAllLayers->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this );
&APPEARANCE_CONTROLS::onRatsnestModeChanged, this ); m_rbRatsnestVisLayers->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this );
m_rbRatsnestVisibleLayers->Bind( wxEVT_RADIOBUTTON, m_rbRatsnestNone->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this );
&APPEARANCE_CONTROLS::onRatsnestModeChanged, this );
} }
@ -842,11 +878,11 @@ void APPEARANCE_CONTROLS::OnNetGridRightClick( wxGridEvent& event )
wxString netName = m_netsGrid->GetCellValue( event.GetRow(), NET_GRID_TABLE::COL_LABEL ); wxString netName = m_netsGrid->GetCellValue( event.GetRow(), NET_GRID_TABLE::COL_LABEL );
wxMenu menu; wxMenu menu;
menu.Append( new wxMenuItem( &menu, ID_SET_NET_COLOR, menu.Append( new wxMenuItem( &menu, ID_SET_NET_COLOR, _( "Set Net Color" ), wxEmptyString,
_( "Set Net Color" ), wxEmptyString, wxITEM_NORMAL ) ); wxITEM_NORMAL ) );
menu.Append( new wxMenuItem( &menu, ID_HIGHLIGHT_NET, menu.Append( new wxMenuItem( &menu, ID_HIGHLIGHT_NET,
wxString::Format( _( "Highlight %s" ), netName ), wxString::Format( _( "Highlight %s" ), netName ), wxEmptyString,
wxEmptyString, wxITEM_NORMAL ) ); wxITEM_NORMAL ) );
menu.Append( new wxMenuItem( &menu, ID_SELECT_NET, menu.Append( new wxMenuItem( &menu, ID_SELECT_NET,
wxString::Format( _( "Select Tracks and Vias in %s" ), netName ), wxString::Format( _( "Select Tracks and Vias in %s" ), netName ),
wxEmptyString, wxITEM_NORMAL ) ); wxEmptyString, wxITEM_NORMAL ) );
@ -856,10 +892,10 @@ void APPEARANCE_CONTROLS::OnNetGridRightClick( wxGridEvent& event )
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_NETS, menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_NETS, _( "Show All Nets" ), wxEmptyString,
_( "Show All Nets" ), wxEmptyString, wxITEM_NORMAL ) ); wxITEM_NORMAL ) );
menu.Append( new wxMenuItem( &menu, ID_HIDE_OTHER_NETS, menu.Append( new wxMenuItem( &menu, ID_HIDE_OTHER_NETS, _( "Hide All Other Nets" ),
_( "Hide All Other Nets" ), wxEmptyString, wxITEM_NORMAL ) ); wxEmptyString, wxITEM_NORMAL ) );
menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &APPEARANCE_CONTROLS::onNetContextMenu, this ); menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &APPEARANCE_CONTROLS::onNetContextMenu, this );
@ -1268,10 +1304,12 @@ void APPEARANCE_CONTROLS::UpdateDisplayOptions()
if( !m_isFpEditor ) if( !m_isFpEditor )
{ {
if( options.m_RatsnestMode == RATSNEST_MODE::ALL ) if( !options.m_ShowGlobalRatsnest )
m_rbRatsnestNone->SetValue( true );
else if( options.m_RatsnestMode == RATSNEST_MODE::ALL )
m_rbRatsnestAllLayers->SetValue( true ); m_rbRatsnestAllLayers->SetValue( true );
else else
m_rbRatsnestVisibleLayers->SetValue( true ); m_rbRatsnestVisLayers->SetValue( true );
wxASSERT( m_objectSettingsMap.count( LAYER_RATSNEST ) ); wxASSERT( m_objectSettingsMap.count( LAYER_RATSNEST ) );
APPEARANCE_SETTING* ratsnest = m_objectSettingsMap.at( LAYER_RATSNEST ); APPEARANCE_SETTING* ratsnest = m_objectSettingsMap.at( LAYER_RATSNEST );
@ -1598,7 +1636,8 @@ void APPEARANCE_CONTROLS::rebuildLayerContextMenu()
m_layerContextMenu->AppendSeparator(); m_layerContextMenu->AppendSeparator();
AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT_ASSEMBLY, AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT_ASSEMBLY,
_( "Show Only Front Assembly Layers" ), KiBitmap( BITMAPS::show_front_assembly_layers ) ); _( "Show Only Front Assembly Layers" ),
KiBitmap( BITMAPS::show_front_assembly_layers ) );
AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT, _( "Show Only Front Layers" ), AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT, _( "Show Only Front Layers" ),
KiBitmap( BITMAPS::show_all_front_layers ) ); KiBitmap( BITMAPS::show_all_front_layers ) );
@ -2644,7 +2683,7 @@ wxString APPEARANCE_CONTROLS::netclassNameFromEvent( wxEvent& aEvent )
} }
void APPEARANCE_CONTROLS::onNetColorModeChanged( wxCommandEvent& aEvent ) void APPEARANCE_CONTROLS::onNetColorMode( wxCommandEvent& aEvent )
{ {
PCB_DISPLAY_OPTIONS options = m_frame->GetDisplayOptions(); PCB_DISPLAY_OPTIONS options = m_frame->GetDisplayOptions();
@ -2661,14 +2700,24 @@ void APPEARANCE_CONTROLS::onNetColorModeChanged( wxCommandEvent& aEvent )
} }
void APPEARANCE_CONTROLS::onRatsnestModeChanged( wxCommandEvent& aEvent ) void APPEARANCE_CONTROLS::onRatsnestMode( wxCommandEvent& aEvent )
{ {
PCB_DISPLAY_OPTIONS options = m_frame->GetDisplayOptions(); PCB_DISPLAY_OPTIONS options = m_frame->GetDisplayOptions();
if( m_rbRatsnestAllLayers->GetValue() ) if( m_rbRatsnestAllLayers->GetValue() )
{
options.m_ShowGlobalRatsnest = true;
options.m_RatsnestMode = RATSNEST_MODE::ALL; options.m_RatsnestMode = RATSNEST_MODE::ALL;
else }
else if( m_rbRatsnestVisLayers->GetValue() )
{
options.m_ShowGlobalRatsnest = true;
options.m_RatsnestMode = RATSNEST_MODE::VISIBLE; options.m_RatsnestMode = RATSNEST_MODE::VISIBLE;
}
else
{
options.m_ShowGlobalRatsnest = false;
}
m_frame->SetDisplayOptions( options ); m_frame->SetDisplayOptions( options );
m_frame->GetCanvas()->RedrawRatsnest(); m_frame->GetCanvas()->RedrawRatsnest();

View File

@ -345,9 +345,9 @@ private:
wxString netclassNameFromEvent( wxEvent& aEvent ); wxString netclassNameFromEvent( wxEvent& aEvent );
void onNetColorModeChanged( wxCommandEvent& aEvent ); void onNetColorMode( wxCommandEvent& aEvent );
void onRatsnestModeChanged( wxCommandEvent& aEvent ); void onRatsnestMode( wxCommandEvent& aEvent );
void onNetclassContextMenu( wxCommandEvent& aEvent ); void onNetclassContextMenu( wxCommandEvent& aEvent );
@ -434,7 +434,7 @@ private:
// Layer display options controls // Layer display options controls
WX_COLLAPSIBLE_PANE* m_paneLayerDisplayOptions; WX_COLLAPSIBLE_PANE* m_paneLayerDisplayOptions;
wxStaticText* m_staticTextContrastModeTitle; wxStaticText* m_inactiveLayersLabel;
wxRadioButton* m_rbHighContrastNormal; wxRadioButton* m_rbHighContrastNormal;
wxRadioButton* m_rbHighContrastDim; wxRadioButton* m_rbHighContrastDim;
wxRadioButton* m_rbHighContrastOff; wxRadioButton* m_rbHighContrastOff;
@ -449,7 +449,8 @@ private:
wxRadioButton* m_rbNetColorOff; wxRadioButton* m_rbNetColorOff;
wxStaticText* m_txtRatsnestVisibility; wxStaticText* m_txtRatsnestVisibility;
wxRadioButton* m_rbRatsnestAllLayers; wxRadioButton* m_rbRatsnestAllLayers;
wxRadioButton* m_rbRatsnestVisibleLayers; wxRadioButton* m_rbRatsnestVisLayers;
wxRadioButton* m_rbRatsnestNone;
enum POPUP_ID enum POPUP_ID
{ {

View File

@ -158,19 +158,9 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bPresets; wxBoxSizer* bPresets;
bPresets = new wxBoxSizer( wxVERTICAL ); bPresets = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bPresetsLabels; m_presetsLabel = new wxStaticText( this, wxID_ANY, _("Presets (Ctrl+Tab):"), wxDefaultPosition, wxDefaultSize, 0 );
bPresetsLabels = new wxBoxSizer( wxHORIZONTAL );
m_presetsLabel = new wxStaticText( this, wxID_ANY, _("Presets:"), wxDefaultPosition, wxDefaultSize, 0 );
m_presetsLabel->Wrap( -1 ); m_presetsLabel->Wrap( -1 );
bPresetsLabels->Add( m_presetsLabel, 1, wxRIGHT|wxLEFT, 2 ); bPresets->Add( m_presetsLabel, 1, wxRIGHT|wxLEFT, 2 );
m_presetsHotkey = new wxStaticText( this, wxID_ANY, _("(Ctrl+Tab)"), wxDefaultPosition, wxDefaultSize, 0 );
m_presetsHotkey->Wrap( -1 );
bPresetsLabels->Add( m_presetsHotkey, 0, wxRIGHT|wxLEFT, 2 );
bPresets->Add( bPresetsLabels, 1, wxEXPAND|wxTOP, 7 );
wxString m_cbLayerPresetsChoices[] = { _("All Layers"), _("(unsaved)") }; wxString m_cbLayerPresetsChoices[] = { _("All Layers"), _("(unsaved)") };
int m_cbLayerPresetsNChoices = sizeof( m_cbLayerPresetsChoices ) / sizeof( wxString ); int m_cbLayerPresetsNChoices = sizeof( m_cbLayerPresetsChoices ) / sizeof( wxString );

View File

@ -1125,15 +1125,6 @@
<property name="name">bPresets</property> <property name="name">bPresets</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">7</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bPresetsLabels</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">2</property> <property name="border">2</property>
<property name="flag">wxRIGHT|wxLEFT</property> <property name="flag">wxRIGHT|wxLEFT</property>
@ -1166,7 +1157,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Presets:</property> <property name="label">Presets (Ctrl+Tab):</property>
<property name="markup">0</property> <property name="markup">0</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
@ -1195,69 +1186,6 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></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="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="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">(Ctrl+Tab)</property>
<property name="markup">0</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_presetsHotkey</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"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">2</property> <property name="border">2</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>

View File

@ -64,7 +64,6 @@ class APPEARANCE_CONTROLS_BASE : public wxPanel
wxScrolledWindow* m_netclassScrolledWindow; wxScrolledWindow* m_netclassScrolledWindow;
wxBoxSizer* m_netclassOuterSizer; wxBoxSizer* m_netclassOuterSizer;
wxStaticText* m_presetsLabel; wxStaticText* m_presetsLabel;
wxStaticText* m_presetsHotkey;
wxChoice* m_cbLayerPresets; wxChoice* m_cbLayerPresets;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class