From ffd6fde700b6d9db304e3dc70533335f3c50cf2d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 4 Oct 2021 13:42:08 +0100 Subject: [PATCH] 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 --- common/tool/actions.cpp | 7 +- pcbnew/tools/pcb_actions.cpp | 10 ++ pcbnew/tools/pcb_actions.h | 2 + pcbnew/tools/pcb_control.cpp | 50 +++++- pcbnew/tools/pcb_control.h | 4 +- pcbnew/widgets/appearance_controls.cpp | 167 +++++++++++------- pcbnew/widgets/appearance_controls.h | 9 +- pcbnew/widgets/appearance_controls_base.cpp | 14 +- pcbnew/widgets/appearance_controls_base.fbp | 184 ++++++-------------- pcbnew/widgets/appearance_controls_base.h | 1 - 10 files changed, 236 insertions(+), 212 deletions(-) diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index 19d43a817e..e0fe46ffcf 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -530,14 +530,15 @@ TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle", TOOL_ACTION ACTIONS::highContrastMode( "common.Control.highContrastMode", AS_GLOBAL, 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 ); TOOL_ACTION ACTIONS::highContrastModeCycle( "common.Control.highContrastModeCycle", AS_GLOBAL, 'H', "", - _( "Single Layer View Mode (3-state)" ), - _( "Toggle inactive layers between normal, dimmed, and hidden" ), + _( "Inactive Layer View Mode (3-state)" ), + _( "Cycle inactive layers between normal, dimmed, and hidden" ), BITMAPS::contrast_mode ); TOOL_ACTION ACTIONS::selectionTool( "common.InteractiveSelection.selectionTool", diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 00765f655b..e19b121f13 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -793,6 +793,16 @@ TOOL_ACTION PCB_ACTIONS::ratsnestLineMode( "pcbnew.Control.ratsnestLineMode", _( "Curved Ratsnest Lines" ), _( "Show ratsnest with curved lines" ), 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", AS_GLOBAL, 'K', LEGACY_HK_NAME( "Track Display Mode" ), diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index e6b6117349..7caa91f677 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -237,6 +237,8 @@ public: // Display modes static TOOL_ACTION showRatsnest; static TOOL_ACTION ratsnestLineMode; + static TOOL_ACTION netColorModeCycle; + static TOOL_ACTION ratsnestModeCycle; static TOOL_ACTION trackDisplayMode; static TOOL_ACTION padDisplayMode; static TOOL_ACTION viaDisplayMode; diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 741d5dcf05..99ac4c860a 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -284,10 +284,9 @@ int PCB_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent ) { PCB_DISPLAY_OPTIONS opts = displayOptions(); - opts.m_ContrastModeDisplay = - ( opts.m_ContrastModeDisplay == HIGH_CONTRAST_MODE::NORMAL ) ? - HIGH_CONTRAST_MODE::DIMMED : - HIGH_CONTRAST_MODE::NORMAL; + opts.m_ContrastModeDisplay = opts.m_ContrastModeDisplay == HIGH_CONTRAST_MODE::NORMAL + ? HIGH_CONTRAST_MODE::DIMMED + : HIGH_CONTRAST_MODE::NORMAL; 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 ) { m_frame->SwitchLayer( nullptr, aEvent.Parameter() ); @@ -1238,6 +1278,8 @@ void PCB_CONTROL::setTransitions() Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayToggle.MakeEvent() ); Go( &PCB_CONTROL::HighContrastMode, ACTIONS::highContrastMode.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() ); // Layer control diff --git a/pcbnew/tools/pcb_control.h b/pcbnew/tools/pcb_control.h index ffb428bbc8..a2c8bda002 100644 --- a/pcbnew/tools/pcb_control.h +++ b/pcbnew/tools/pcb_control.h @@ -65,8 +65,10 @@ public: // Update the view with the new high-contrast mode from the display settings 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 NetColorModeCycle( const TOOL_EVENT& aEvent ); + int RatsnestModeCycle( const TOOL_EVENT& aEvent ); // Layer control int LayerSwitch( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index 0e34c4637c..5972c59040 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -431,7 +431,6 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo m_windowLayers->SetFont( infoFont ); m_windowObjects->SetFont( infoFont ); m_presetsLabel->SetFont( infoFont ); - m_presetsHotkey->SetFont( infoFont ); createControls(); @@ -542,12 +541,12 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo m_netsGrid->SetDefaultCellFont( font ); m_netsGrid->SetDefaultRowSize( font.GetPixelSize().y + rowHeightPadding ); - m_netsGrid->GetGridWindow()->Bind( wxEVT_MOTION, - &APPEARANCE_CONTROLS::OnNetGridMouseEvent, this ); + m_netsGrid->GetGridWindow()->Bind( wxEVT_MOTION, &APPEARANCE_CONTROLS::OnNetGridMouseEvent, + this ); // To handle middle click on color swatches - m_netsGrid->GetGridWindow()->Bind( wxEVT_MIDDLE_UP, - &APPEARANCE_CONTROLS::OnNetGridMouseEvent, this ); + m_netsGrid->GetGridWindow()->Bind( wxEVT_MIDDLE_UP, &APPEARANCE_CONTROLS::OnNetGridMouseEvent, + this ); m_netsGrid->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() { + int hotkey; + wxString msg; + wxFont infoFont = KIUI::GetInfoFont( this ); + // Create layer display options m_paneLayerDisplayOptions = new WX_COLLAPSIBLE_PANE( m_panelLayers, wxID_ANY, _( "Layer Display Options" ) ); @@ -586,34 +589,43 @@ void APPEARANCE_CONTROLS::createControls() wxBoxSizer* layerDisplayOptionsSizer; layerDisplayOptionsSizer = new wxBoxSizer( wxVERTICAL ); - m_staticTextContrastModeTitle = new wxStaticText( layerDisplayPane, wxID_ANY, - _( "Inactive layers:" ), wxDefaultPosition, - wxDefaultSize, 0 ); - m_staticTextContrastModeTitle->Wrap( -1 ); - layerDisplayOptionsSizer->Add( m_staticTextContrastModeTitle, 0, - wxEXPAND | wxBOTTOM | wxLEFT, 2 ); + hotkey = PCB_ACTIONS::highContrastModeCycle.GetHotKey(); + + if( hotkey ) + msg = wxString::Format( _( "Inactive layers (%s):" ), KeyNameFromKeyCode( hotkey ) ); + else + 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; contrastModeSizer = new wxBoxSizer( wxHORIZONTAL ); m_rbHighContrastNormal = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Normal" ), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_rbHighContrastNormal->SetFont( infoFont ); m_rbHighContrastNormal->SetValue( true ); 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" ), - wxDefaultPosition, wxDefaultSize, 0 ); + m_rbHighContrastDim = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Dim" ) ); + m_rbHighContrastDim->SetFont( infoFont ); 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" ), - wxDefaultPosition, wxDefaultSize, 0 ); + m_rbHighContrastOff = new wxRadioButton( layerDisplayPane, wxID_ANY, _( "Hide" ) ); + m_rbHighContrastOff->SetFont( infoFont ); m_rbHighContrastOff->SetToolTip( _( "Inactive layers will be hidden" ) ); contrastModeSizer->Add( m_rbHighContrastOff, 0, 0, 5 ); + contrastModeSizer->AddStretchSpacer(); layerDisplayOptionsSizer->Add( contrastModeSizer, 0, wxEXPAND, 5 ); @@ -621,8 +633,8 @@ void APPEARANCE_CONTROLS::createControls() wxDefaultSize, wxLI_HORIZONTAL ); layerDisplayOptionsSizer->Add( m_layerDisplaySeparator, 0, wxEXPAND | wxTOP | wxBOTTOM, 5 ); - m_cbFlipBoard = new wxCheckBox( layerDisplayPane, wxID_ANY, _( "Flip board view" ), - wxDefaultPosition, wxDefaultSize, 0 ); + m_cbFlipBoard = new wxCheckBox( layerDisplayPane, wxID_ANY, _( "Flip board view" ) ); + m_cbFlipBoard->SetFont( infoFont ); layerDisplayOptionsSizer->Add( m_cbFlipBoard, 0, 0, 5 ); layerDisplayPane->SetSizer( layerDisplayOptionsSizer ); @@ -652,8 +664,15 @@ void APPEARANCE_CONTROLS::createControls() //// Net color mode - m_txtNetDisplayTitle = new wxStaticText( netDisplayPane, wxID_ANY, _( "Net colors:" ), - wxDefaultPosition, wxDefaultSize, 0 ); + hotkey = PCB_ACTIONS::netColorModeCycle.GetHotKey(); + + 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->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, wxDefaultSize, wxRB_GROUP ); + m_rbNetColorAll->SetFont( infoFont ); 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" ), - wxDefaultPosition, wxDefaultSize, 0 ); + m_rbNetColorRatsnest = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Ratsnest" ) ); + m_rbNetColorRatsnest->SetFont( infoFont ); m_rbNetColorRatsnest->SetValue( true ); 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, - wxDefaultSize, 0 ); + m_rbNetColorOff = new wxRadioButton( netDisplayPane, wxID_ANY, _( "None" ) ); + m_rbNetColorOff->SetFont( infoFont ); m_rbNetColorOff->SetToolTip( _( "Net and netclass colors are not shown" ) ); netColorSizer->Add( m_rbNetColorOff, 0, 0, 5 ); @@ -684,27 +706,43 @@ void APPEARANCE_CONTROLS::createControls() //// Ratsnest display - m_txtRatsnestVisibility = new wxStaticText( netDisplayPane, wxID_ANY, _( "Ratsnest display:" ), - wxDefaultPosition, wxDefaultSize, 0 ); + hotkey = PCB_ACTIONS::ratsnestModeCycle.GetHotKey(); + + 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->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 ); 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 ); - m_rbRatsnestAllLayers->SetToolTip( _( "Ratsnest lines are shown to items on all layers" ) ); + m_rbRatsnestAllLayers->SetFont( infoFont ); 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" ), - wxDefaultPosition, wxDefaultSize, 0 ); - m_rbRatsnestVisibleLayers->SetToolTip( _( "Ratsnest lines are shown to items on visible layers" ) ); + m_rbRatsnestVisLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Visible layers" ) ); + m_rbRatsnestVisLayers->SetFont( infoFont ); + 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 ); @@ -726,15 +764,13 @@ void APPEARANCE_CONTROLS::createControls() Thaw(); } ); - m_rbNetColorAll->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorModeChanged, this ); - m_rbNetColorOff->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorModeChanged, this ); - m_rbNetColorRatsnest->Bind( wxEVT_RADIOBUTTON, - &APPEARANCE_CONTROLS::onNetColorModeChanged, this ); + m_rbNetColorAll->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this ); + m_rbNetColorOff->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this ); + m_rbNetColorRatsnest->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorMode, this ); - m_rbRatsnestAllLayers->Bind( wxEVT_RADIOBUTTON, - &APPEARANCE_CONTROLS::onRatsnestModeChanged, this ); - m_rbRatsnestVisibleLayers->Bind( wxEVT_RADIOBUTTON, - &APPEARANCE_CONTROLS::onRatsnestModeChanged, this ); + m_rbRatsnestAllLayers->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this ); + m_rbRatsnestVisLayers->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this ); + m_rbRatsnestNone->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onRatsnestMode, this ); } @@ -842,11 +878,11 @@ void APPEARANCE_CONTROLS::OnNetGridRightClick( wxGridEvent& event ) wxString netName = m_netsGrid->GetCellValue( event.GetRow(), NET_GRID_TABLE::COL_LABEL ); wxMenu menu; - menu.Append( new wxMenuItem( &menu, ID_SET_NET_COLOR, - _( "Set Net Color" ), wxEmptyString, wxITEM_NORMAL ) ); + menu.Append( new wxMenuItem( &menu, ID_SET_NET_COLOR, _( "Set Net Color" ), wxEmptyString, + wxITEM_NORMAL ) ); menu.Append( new wxMenuItem( &menu, ID_HIGHLIGHT_NET, - wxString::Format( _( "Highlight %s" ), netName ), - wxEmptyString, wxITEM_NORMAL ) ); + wxString::Format( _( "Highlight %s" ), netName ), wxEmptyString, + wxITEM_NORMAL ) ); menu.Append( new wxMenuItem( &menu, ID_SELECT_NET, wxString::Format( _( "Select Tracks and Vias in %s" ), netName ), wxEmptyString, wxITEM_NORMAL ) ); @@ -856,10 +892,10 @@ void APPEARANCE_CONTROLS::OnNetGridRightClick( wxGridEvent& event ) menu.AppendSeparator(); - menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_NETS, - _( "Show All Nets" ), wxEmptyString, wxITEM_NORMAL ) ); - menu.Append( new wxMenuItem( &menu, ID_HIDE_OTHER_NETS, - _( "Hide All Other Nets" ), wxEmptyString, wxITEM_NORMAL ) ); + menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_NETS, _( "Show All Nets" ), wxEmptyString, + wxITEM_NORMAL ) ); + menu.Append( new wxMenuItem( &menu, ID_HIDE_OTHER_NETS, _( "Hide All Other Nets" ), + wxEmptyString, wxITEM_NORMAL ) ); menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &APPEARANCE_CONTROLS::onNetContextMenu, this ); @@ -1268,10 +1304,12 @@ void APPEARANCE_CONTROLS::UpdateDisplayOptions() 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 ); else - m_rbRatsnestVisibleLayers->SetValue( true ); + m_rbRatsnestVisLayers->SetValue( true ); wxASSERT( m_objectSettingsMap.count( LAYER_RATSNEST ) ); APPEARANCE_SETTING* ratsnest = m_objectSettingsMap.at( LAYER_RATSNEST ); @@ -1598,7 +1636,8 @@ void APPEARANCE_CONTROLS::rebuildLayerContextMenu() m_layerContextMenu->AppendSeparator(); 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" ), 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(); @@ -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(); if( m_rbRatsnestAllLayers->GetValue() ) + { + options.m_ShowGlobalRatsnest = true; options.m_RatsnestMode = RATSNEST_MODE::ALL; - else + } + else if( m_rbRatsnestVisLayers->GetValue() ) + { + options.m_ShowGlobalRatsnest = true; options.m_RatsnestMode = RATSNEST_MODE::VISIBLE; + } + else + { + options.m_ShowGlobalRatsnest = false; + } m_frame->SetDisplayOptions( options ); m_frame->GetCanvas()->RedrawRatsnest(); diff --git a/pcbnew/widgets/appearance_controls.h b/pcbnew/widgets/appearance_controls.h index 8d92393ffd..54ee3d4bef 100644 --- a/pcbnew/widgets/appearance_controls.h +++ b/pcbnew/widgets/appearance_controls.h @@ -345,9 +345,9 @@ private: wxString netclassNameFromEvent( wxEvent& aEvent ); - void onNetColorModeChanged( wxCommandEvent& aEvent ); + void onNetColorMode( wxCommandEvent& aEvent ); - void onRatsnestModeChanged( wxCommandEvent& aEvent ); + void onRatsnestMode( wxCommandEvent& aEvent ); void onNetclassContextMenu( wxCommandEvent& aEvent ); @@ -434,7 +434,7 @@ private: // Layer display options controls WX_COLLAPSIBLE_PANE* m_paneLayerDisplayOptions; - wxStaticText* m_staticTextContrastModeTitle; + wxStaticText* m_inactiveLayersLabel; wxRadioButton* m_rbHighContrastNormal; wxRadioButton* m_rbHighContrastDim; wxRadioButton* m_rbHighContrastOff; @@ -449,7 +449,8 @@ private: wxRadioButton* m_rbNetColorOff; wxStaticText* m_txtRatsnestVisibility; wxRadioButton* m_rbRatsnestAllLayers; - wxRadioButton* m_rbRatsnestVisibleLayers; + wxRadioButton* m_rbRatsnestVisLayers; + wxRadioButton* m_rbRatsnestNone; enum POPUP_ID { diff --git a/pcbnew/widgets/appearance_controls_base.cpp b/pcbnew/widgets/appearance_controls_base.cpp index ca33b44ed4..73011b1f34 100644 --- a/pcbnew/widgets/appearance_controls_base.cpp +++ b/pcbnew/widgets/appearance_controls_base.cpp @@ -158,19 +158,9 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID wxBoxSizer* bPresets; bPresets = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bPresetsLabels; - bPresetsLabels = new wxBoxSizer( wxHORIZONTAL ); - - m_presetsLabel = new wxStaticText( this, wxID_ANY, _("Presets:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_presetsLabel = new wxStaticText( this, wxID_ANY, _("Presets (Ctrl+Tab):"), wxDefaultPosition, wxDefaultSize, 0 ); m_presetsLabel->Wrap( -1 ); - bPresetsLabels->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 ); + bPresets->Add( m_presetsLabel, 1, wxRIGHT|wxLEFT, 2 ); wxString m_cbLayerPresetsChoices[] = { _("All Layers"), _("(unsaved)") }; int m_cbLayerPresetsNChoices = sizeof( m_cbLayerPresetsChoices ) / sizeof( wxString ); diff --git a/pcbnew/widgets/appearance_controls_base.fbp b/pcbnew/widgets/appearance_controls_base.fbp index 7fb814384b..a434d9f8b9 100644 --- a/pcbnew/widgets/appearance_controls_base.fbp +++ b/pcbnew/widgets/appearance_controls_base.fbp @@ -1126,136 +1126,64 @@ wxVERTICAL none - 7 - wxEXPAND|wxTOP + 2 + wxRIGHT|wxLEFT 1 - + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Presets (Ctrl+Tab): + 0 + + 0 + + + 0 - bPresetsLabels - wxHORIZONTAL - none - - 2 - wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Presets: - 0 - - 0 - - - 0 - - 1 - m_presetsLabel - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 2 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - (Ctrl+Tab) - 0 - - 0 - - - 0 - - 1 - m_presetsHotkey - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - + 1 + m_presetsLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 diff --git a/pcbnew/widgets/appearance_controls_base.h b/pcbnew/widgets/appearance_controls_base.h index c98b1b3253..686f5f6234 100644 --- a/pcbnew/widgets/appearance_controls_base.h +++ b/pcbnew/widgets/appearance_controls_base.h @@ -64,7 +64,6 @@ class APPEARANCE_CONTROLS_BASE : public wxPanel wxScrolledWindow* m_netclassScrolledWindow; wxBoxSizer* m_netclassOuterSizer; wxStaticText* m_presetsLabel; - wxStaticText* m_presetsHotkey; wxChoice* m_cbLayerPresets; // Virtual event handlers, overide them in your derived class