From 6c05e5d1a8b22fde99c2493396a2fbed535b1e63 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 24 Oct 2021 23:07:06 +0100 Subject: [PATCH] Implement user viewports. ADDED popup to Appearances palette where users can define viewports for later selection. Fixes https://gitlab.com/kicad/code/kicad/issues/2271 --- common/dialogs/eda_view_switcher.cpp | 8 +- common/project/board_project_settings.cpp | 63 +++++++ common/project/project_file.cpp | 2 + include/dialogs/eda_view_switcher.h | 7 +- include/project/board_project_settings.h | 31 ++++ include/project/project_file.h | 5 +- pcbnew/pcb_base_edit_frame.cpp | 30 +++- pcbnew/pcbnew_config.cpp | 2 + pcbnew/widgets/appearance_controls.cpp | 187 +++++++++++++++++++- pcbnew/widgets/appearance_controls.h | 36 +++- pcbnew/widgets/appearance_controls_base.cpp | 25 ++- pcbnew/widgets/appearance_controls_base.fbp | 149 +++++++++++++++- pcbnew/widgets/appearance_controls_base.h | 3 + 13 files changed, 525 insertions(+), 23 deletions(-) diff --git a/common/dialogs/eda_view_switcher.cpp b/common/dialogs/eda_view_switcher.cpp index ba42d7fca3..2cba294901 100644 --- a/common/dialogs/eda_view_switcher.cpp +++ b/common/dialogs/eda_view_switcher.cpp @@ -33,10 +33,12 @@ #endif -EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems ) : +EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems, + wxKeyCode aCtrlKey ) : EDA_VIEW_SWITCHER_BASE( aParent ), m_tabState( true ), - m_receivingEvents( false ) + m_receivingEvents( false ), + m_ctrlKey( aCtrlKey ) { m_listBox->InsertItems( aItems, 0 ); m_listBox->SetSelection( std::min( 1, (int) m_listBox->GetCount() - 1 ) ); @@ -129,7 +131,7 @@ bool EDA_VIEW_SWITCHER::TryBefore( wxEvent& aEvent ) } // Check for control key trailing edge - if( !wxGetKeyState( WXK_RAW_CONTROL ) ) + if( !wxGetKeyState( m_ctrlKey ) ) { wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) ); } diff --git a/common/project/board_project_settings.cpp b/common/project/board_project_settings.cpp index e32e3270cd..059cd96fbd 100644 --- a/common/project/board_project_settings.cpp +++ b/common/project/board_project_settings.cpp @@ -128,3 +128,66 @@ void PARAM_LAYER_PRESET::jsonToPresets( const nlohmann::json& aJson ) } } } + + +PARAM_VIEWPORT::PARAM_VIEWPORT( const std::string& aPath, std::vector* aViewportList ) : + PARAM_LAMBDA( aPath, + std::bind( &PARAM_VIEWPORT::viewportsToJson, this ), + std::bind( &PARAM_VIEWPORT::jsonToViewports, this, _1 ), + {} ), + m_viewports( aViewportList ) +{ + wxASSERT( aViewportList ); +} + + +nlohmann::json PARAM_VIEWPORT::viewportsToJson() +{ + nlohmann::json ret = nlohmann::json::array(); + + for( const VIEWPORT& viewport : *m_viewports ) + { + nlohmann::json js = { + { "name", viewport.name }, + { "x", viewport.rect.GetX() }, + { "y", viewport.rect.GetY() }, + { "w", viewport.rect.GetWidth() }, + { "h", viewport.rect.GetHeight() } + }; + + ret.push_back( js ); + } + + return ret; +} + + +void PARAM_VIEWPORT::jsonToViewports( const nlohmann::json& aJson ) +{ + if( aJson.empty() || !aJson.is_array() ) + return; + + m_viewports->clear(); + + for( const nlohmann::json& viewport : aJson ) + { + if( viewport.contains( "name" ) ) + { + VIEWPORT v( viewport.at( "name" ).get() ); + + if( viewport.contains( "x" ) ) + v.rect.SetX( viewport.at( "x" ).get() ); + + if( viewport.contains( "y" ) ) + v.rect.SetY( viewport.at( "y" ).get() ); + + if( viewport.contains( "w" ) ) + v.rect.SetWidth( viewport.at( "w" ).get() ); + + if( viewport.contains( "h" ) ) + v.rect.SetHeight( viewport.at( "h" ).get() ); + + m_viewports->emplace_back( v ); + } + } +} \ No newline at end of file diff --git a/common/project/project_file.cpp b/common/project/project_file.cpp index d0ff2b9baf..de2a8729cc 100644 --- a/common/project/project_file.cpp +++ b/common/project/project_file.cpp @@ -109,6 +109,8 @@ PROJECT_FILE::PROJECT_FILE( const wxString& aFullPath ) : m_NetSettings = std::make_shared( this, "net_settings" ); m_params.emplace_back( new PARAM_LAYER_PRESET( "board.layer_presets", &m_LayerPresets ) ); + + m_params.emplace_back( new PARAM_VIEWPORT( "board.viewports", &m_Viewports ) ); } diff --git a/include/dialogs/eda_view_switcher.h b/include/dialogs/eda_view_switcher.h index 317fa410c3..42cf3d1789 100644 --- a/include/dialogs/eda_view_switcher.h +++ b/include/dialogs/eda_view_switcher.h @@ -29,7 +29,7 @@ class EDA_VIEW_SWITCHER : public EDA_VIEW_SWITCHER_BASE { public: - EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems ); + EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems, wxKeyCode aCtrlKey ); int GetSelection() const { return m_listBox->GetSelection(); } @@ -38,8 +38,9 @@ protected: bool Show( bool show ) override; protected: - bool m_tabState; - bool m_receivingEvents; + bool m_tabState; + bool m_receivingEvents; + wxKeyCode m_ctrlKey; }; #endif // EDA_VIEW_SWITCHER_H diff --git a/include/project/board_project_settings.h b/include/project/board_project_settings.h index a28094156f..3a64cb501a 100644 --- a/include/project/board_project_settings.h +++ b/include/project/board_project_settings.h @@ -26,6 +26,7 @@ // Can be removed by refactoring PARAM_LAYER_PRESET #include +#include /** * This file contains data structures that are saved in the project file or project local settings @@ -181,4 +182,34 @@ private: std::vector* m_presets; }; + +struct VIEWPORT +{ + VIEWPORT( const wxString& aName = wxEmptyString ) : + name( aName ) + { } + + VIEWPORT( const wxString& aName, const BOX2D& aRect ) : + name( aName ), + rect( aRect ) + { } + + wxString name; + BOX2D rect; +}; + + +class PARAM_VIEWPORT : public PARAM_LAMBDA +{ +public: + PARAM_VIEWPORT( const std::string& aPath, std::vector* aViewportList ); + +private: + nlohmann::json viewportsToJson(); + + void jsonToViewports( const nlohmann::json& aJson ); + + std::vector* m_viewports; +}; + #endif // KICAD_BOARD_PROJECT_SETTINGS_H diff --git a/include/project/project_file.h b/include/project/project_file.h index 78ed0e584a..0204e7d9fa 100644 --- a/include/project/project_file.h +++ b/include/project/project_file.h @@ -167,8 +167,9 @@ public: */ std::shared_ptr m_NetSettings; - /// List of stored layer presets - std::vector m_LayerPresets; + + std::vector m_LayerPresets; /// List of stored layer presets + std::vector m_Viewports; /// List of stored viewports (pos + zoom) private: /// An list of schematic sheets in this project diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index e57e61c8af..1832b0ca37 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -94,18 +94,19 @@ void PCB_BASE_EDIT_FRAME::doCloseWindow() bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent ) { - static bool s_switcherShown = false; + static bool s_presetSwitcherShown = false; + static bool s_viewportSwitcherShown = false; - if( !s_switcherShown && wxGetKeyState( WXK_RAW_CONTROL ) && wxGetKeyState( WXK_TAB ) ) + if( !s_presetSwitcherShown && wxGetKeyState( WXK_RAW_CONTROL ) && wxGetKeyState( WXK_TAB ) ) { if( m_appearancePanel && this->IsActive() ) { const wxArrayString& mru = m_appearancePanel->GetLayerPresetsMRU(); - EDA_VIEW_SWITCHER switcher( this, mru ); + EDA_VIEW_SWITCHER switcher( this, mru, WXK_RAW_CONTROL ); - s_switcherShown = true; + s_presetSwitcherShown = true; switcher.ShowModal(); - s_switcherShown = false; + s_presetSwitcherShown = false; int idx = switcher.GetSelection(); @@ -115,6 +116,25 @@ bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent ) return true; } } + else if( !s_viewportSwitcherShown && wxGetKeyState( WXK_ALT ) && wxGetKeyState( WXK_TAB ) ) + { + if( m_appearancePanel && this->IsActive() ) + { + const wxArrayString& mru = m_appearancePanel->GetViewportsMRU(); + EDA_VIEW_SWITCHER switcher( this, mru, WXK_ALT ); + + s_viewportSwitcherShown = true; + switcher.ShowModal(); + s_viewportSwitcherShown = false; + + int idx = switcher.GetSelection(); + + if( idx >= 0 && idx < (int) mru.size() ) + m_appearancePanel->ApplyViewport( mru[idx] ); + + return true; + } + } return PCB_BASE_FRAME::TryBefore( aEvent ); } diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index ceb5056f84..f8da929729 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -94,6 +94,7 @@ bool PCB_EDIT_FRAME::LoadProjectSettings() netclassColors[pair.first] = pair.second->GetPcbColor(); m_appearancePanel->SetUserLayerPresets( project.m_LayerPresets ); + m_appearancePanel->SetUserViewports( project.m_Viewports ); PCB_SELECTION_TOOL* selTool = GetToolManager()->GetTool(); SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter(); @@ -145,6 +146,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings() project.m_BoardDrawingSheetFile = BASE_SCREEN::m_DrawingSheetFileName; project.m_LayerPresets = m_appearancePanel->GetUserLayerPresets(); + project.m_Viewports = m_appearancePanel->GetUserViewports(); RecordDRCExclusions(); diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index 193ce0ab5a..99024c6af3 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -432,6 +432,7 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo m_windowLayers->SetFont( infoFont ); m_windowObjects->SetFont( infoFont ); m_presetsLabel->SetFont( infoFont ); + m_viewportsLabel->SetFont( infoFont ); createControls(); @@ -983,6 +984,7 @@ void APPEARANCE_CONTROLS::OnBoardChanged() rebuildNets(); rebuildLayerPresetsWidget(); syncLayerPresetSelection(); + rebuildViewportsWidget(); UpdateDisplayOptions(); @@ -1394,6 +1396,51 @@ void APPEARANCE_CONTROLS::ApplyLayerPreset( const LAYER_PRESET& aPreset ) } +std::vector APPEARANCE_CONTROLS::GetUserViewports() const +{ + std::vector ret; + + for( const std::pair& pair : m_viewports ) + ret.emplace_back( pair.second ); + + return ret; +} + + +void APPEARANCE_CONTROLS::SetUserViewports( std::vector& aViewportList ) +{ + m_viewports.clear(); + + for( const VIEWPORT& viewport : aViewportList ) + { + if( m_viewports.count( viewport.name ) ) + continue; + + m_viewports[viewport.name] = viewport; + + m_viewportMRU.Add( viewport.name ); + } + + rebuildViewportsWidget(); +} + + +void APPEARANCE_CONTROLS::ApplyViewport( const wxString& aViewportName ) +{ + updateViewportSelection( aViewportName ); + + wxCommandEvent dummy; + onViewportChanged( dummy ); +} + + +void APPEARANCE_CONTROLS::ApplyViewport( const VIEWPORT& aViewport ) +{ + updateViewportSelection( aViewport.name ); + doApplyViewport( aViewport ); +} + + void APPEARANCE_CONTROLS::rebuildLayers() { BOARD* board = m_frame->GetBoard(); @@ -2343,7 +2390,7 @@ void APPEARANCE_CONTROLS::rebuildLayerPresetsWidget() m_cbLayerPresets->SetSelection( 0 ); - // At least the build in presets should always be present + // At least the built-in presets should always be present wxASSERT( !m_layerPresets.empty() ); // Default preset: all layers @@ -2541,6 +2588,144 @@ void APPEARANCE_CONTROLS::doApplyLayerPreset( const LAYER_PRESET& aPreset ) } +void APPEARANCE_CONTROLS::rebuildViewportsWidget() +{ + m_cbViewports->Clear(); + + for( std::pair& pair : m_viewports ) + m_cbViewports->Append( pair.first, static_cast( &pair.second ) ); + + m_cbViewports->Append( wxT( "-----" ) ); + m_cbViewports->Append( _( "Save viewport..." ) ); + m_cbViewports->Append( _( "Delete viewport..." ) ); + + m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 ); + m_lastSelectedViewport = nullptr; +} + + +void APPEARANCE_CONTROLS::updateViewportSelection( const wxString& aName ) +{ + int idx = m_cbViewports->FindString( aName ); + + if( idx >= 0 && m_cbViewports->GetSelection() != idx ) + { + m_cbViewports->SetSelection( idx ); + m_lastSelectedViewport = static_cast( m_cbViewports->GetClientData( idx ) ); + } + else if( idx < 0 ) + { + m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 ); // separator + m_lastSelectedViewport = nullptr; + } +} + + +void APPEARANCE_CONTROLS::onViewportChanged( wxCommandEvent& aEvent ) +{ + int count = m_cbViewports->GetCount(); + int index = m_cbViewports->GetSelection(); + + if( index >= 0 && index < count - 3 ) + { + VIEWPORT* viewport = static_cast( m_cbViewports->GetClientData( index ) ); + + if( viewport ) + doApplyViewport( *viewport ); + + if( !viewport->name.IsEmpty() ) + { + m_viewportMRU.Remove( viewport->name ); + m_viewportMRU.Insert( viewport->name, 0 ); + } + } + else if( index == count - 2 ) + { + // Save current state to new preset + wxString name; + + wxTextEntryDialog dlg( this, _( "Viewport name:" ), _( "Save Viewport" ), name ); + + if( dlg.ShowModal() != wxID_OK ) + { + if( m_lastSelectedViewport ) + m_cbViewports->SetStringSelection( m_lastSelectedViewport->name ); + else + m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 ); + + return; + } + + name = dlg.GetValue(); + bool exists = m_viewports.count( name ); + + if( !exists ) + { + m_viewports[name] = VIEWPORT( name, m_frame->GetCanvas()->GetView()->GetViewport() ); + + index = m_cbViewports->Insert( name, index-1, static_cast( &m_viewports[name] ) ); + } + else + { + index = m_cbViewports->FindString( name ); + m_viewportMRU.Remove( name ); + } + + m_cbViewports->SetSelection( index ); + m_viewportMRU.Insert( name, 0 ); + + return; + } + else if( index == count - 1 ) + { + // Delete an existing preset + wxArrayString headers; + std::vector items; + + headers.Add( _( "Viewports" ) ); + + for( std::pair& pair : m_viewports ) + { + wxArrayString item; + item.Add( pair.first ); + items.emplace_back( item ); + } + + EDA_LIST_DIALOG dlg( m_frame, _( "Delete Viewport" ), headers, items ); + dlg.SetListLabel( _( "Select viewport:" ) ); + + if( dlg.ShowModal() == wxID_OK ) + { + wxString viewportName = dlg.GetTextSelection(); + int idx = m_cbViewports->FindString( viewportName ); + + if( idx != wxNOT_FOUND ) + { + m_layerPresets.erase( viewportName ); + m_cbViewports->Delete( idx ); + m_viewportMRU.Remove( viewportName ); + } + } + + if( m_lastSelectedViewport ) + m_cbViewports->SetStringSelection( m_lastSelectedViewport->name ); + else + m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 ); + + return; + } + + passOnFocus(); +} + + +void APPEARANCE_CONTROLS::doApplyViewport( const VIEWPORT& aViewport ) +{ + m_frame->GetCanvas()->GetView()->SetViewport( aViewport.rect ); + m_frame->GetCanvas()->Refresh(); +} + + void APPEARANCE_CONTROLS::OnColorSwatchChanged( wxCommandEvent& aEvent ) { COLOR_SWATCH* swatch = static_cast( aEvent.GetEventObject() ); diff --git a/pcbnew/widgets/appearance_controls.h b/pcbnew/widgets/appearance_controls.h index 7d8d115fa2..98ab666af5 100644 --- a/pcbnew/widgets/appearance_controls.h +++ b/pcbnew/widgets/appearance_controls.h @@ -260,6 +260,21 @@ public: return m_presetMRU; } + ///< Return a list of viewports created by the user. + std::vector GetUserViewports() const; + + ///< Update the current viewports from those saved in the project file. + void SetUserViewports( std::vector& aPresetList ); + + void ApplyViewport( const wxString& aPresetName ); + + void ApplyViewport( const VIEWPORT& aPreset ); + + const wxArrayString& GetViewportsMRU() + { + return m_viewportMRU; + } + void OnColorSwatchChanged( wxCommandEvent& aEvent ); void OnLayerContextMenu( wxCommandEvent& aEvent ); @@ -311,6 +326,8 @@ private: void syncLayerPresetSelection(); + void rebuildViewportsWidget(); + void onLayerLeftClick( wxMouseEvent& aEvent ); void rightClickHandler( wxMouseEvent& aEvent ); @@ -335,6 +352,12 @@ private: void doApplyLayerPreset( const LAYER_PRESET& aPreset ); + void updateViewportSelection( const wxString& aName ); + + void onViewportChanged( wxCommandEvent& aEvent ) override; + + void doApplyViewport( const VIEWPORT& aViewport ); + void onNetclassVisibilityChanged( wxCommandEvent& aEvent ); void showNetclass( const wxString& aClassName, bool aShow = true ); @@ -397,15 +420,14 @@ private: // TODO(JE) Move preset storage to the PCB_CONTROL tool - // Storage for all layer presets std::map m_layerPresets; + LAYER_PRESET* m_currentPreset; + LAYER_PRESET* m_lastSelectedUserPreset; + wxArrayString m_presetMRU; - LAYER_PRESET* m_currentPreset; - - /// The last user (non-read-only) preset selected by the user - LAYER_PRESET* m_lastSelectedUserPreset; - - wxArrayString m_presetMRU; + std::map m_viewports; + VIEWPORT* m_lastSelectedViewport; + wxArrayString m_viewportMRU; wxMenu* m_layerContextMenu; diff --git a/pcbnew/widgets/appearance_controls_base.cpp b/pcbnew/widgets/appearance_controls_base.cpp index 605641b3fa..5cc8b6bc3d 100644 --- a/pcbnew/widgets/appearance_controls_base.cpp +++ b/pcbnew/widgets/appearance_controls_base.cpp @@ -171,7 +171,28 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID bPresets->Add( m_cbLayerPresets, 0, wxALL|wxEXPAND, 2 ); - bBottomMargin->Add( bPresets, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bBottomMargin->Add( bPresets, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + + bBottomMargin->Add( 0, 2, 0, wxEXPAND, 5 ); + + wxBoxSizer* bViewports; + bViewports = new wxBoxSizer( wxVERTICAL ); + + m_viewportsLabel = new wxStaticText( this, wxID_ANY, _("Viewports (Alt+Tab):"), wxDefaultPosition, wxDefaultSize, 0 ); + m_viewportsLabel->Wrap( -1 ); + bViewports->Add( m_viewportsLabel, 1, wxRIGHT|wxLEFT, 2 ); + + wxString m_cbViewportsChoices[] = { _("(unsaved)") }; + int m_cbViewportsNChoices = sizeof( m_cbViewportsChoices ) / sizeof( wxString ); + m_cbViewports = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbViewportsNChoices, m_cbViewportsChoices, 0 ); + m_cbViewports->SetSelection( 1 ); + m_cbViewports->SetToolTip( _("Layer presets") ); + + bViewports->Add( m_cbViewports, 0, wxALL|wxEXPAND, 2 ); + + + bBottomMargin->Add( bViewports, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_sizerOuter->Add( bBottomMargin, 0, wxBOTTOM|wxEXPAND, 2 ); @@ -195,6 +216,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID m_netsGrid->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this ); m_panelNetclasses->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this ); m_cbLayerPresets->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onLayerPresetChanged ), NULL, this ); + m_cbViewports->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onViewportChanged ), NULL, this ); } APPEARANCE_CONTROLS_BASE::~APPEARANCE_CONTROLS_BASE() @@ -214,5 +236,6 @@ APPEARANCE_CONTROLS_BASE::~APPEARANCE_CONTROLS_BASE() m_netsGrid->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this ); m_panelNetclasses->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this ); m_cbLayerPresets->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onLayerPresetChanged ), NULL, this ); + m_cbViewports->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onViewportChanged ), NULL, this ); } diff --git a/pcbnew/widgets/appearance_controls_base.fbp b/pcbnew/widgets/appearance_controls_base.fbp index 3deb4897cc..d6e723b33d 100644 --- a/pcbnew/widgets/appearance_controls_base.fbp +++ b/pcbnew/widgets/appearance_controls_base.fbp @@ -1118,7 +1118,7 @@ none 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 0 @@ -1253,6 +1253,153 @@ + + 5 + wxEXPAND + 0 + + 2 + protected + 0 + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + + bViewports + wxVERTICAL + none + + 2 + wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Viewports (Alt+Tab): + 0 + + 0 + + + 0 + + 1 + m_viewportsLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 2 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "(unsaved)" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_cbViewports + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + ; ; forward_declare + 0 + Layer presets + + wxFILTER_NONE + wxDefaultValidator + + + + + onViewportChanged + + + + diff --git a/pcbnew/widgets/appearance_controls_base.h b/pcbnew/widgets/appearance_controls_base.h index a5b2ff8c3b..27988ff119 100644 --- a/pcbnew/widgets/appearance_controls_base.h +++ b/pcbnew/widgets/appearance_controls_base.h @@ -66,6 +66,8 @@ class APPEARANCE_CONTROLS_BASE : public WX_PANEL wxBoxSizer* m_netclassOuterSizer; wxStaticText* m_presetsLabel; wxChoice* m_cbLayerPresets; + wxStaticText* m_viewportsLabel; + wxChoice* m_cbViewports; // Virtual event handlers, overide them in your derived class virtual void OnSetFocus( wxFocusEvent& event ) { event.Skip(); } @@ -75,6 +77,7 @@ class APPEARANCE_CONTROLS_BASE : public WX_PANEL virtual void OnNetGridDoubleClick( wxGridEvent& event ) { event.Skip(); } virtual void OnNetGridRightClick( wxGridEvent& event ) { event.Skip(); } virtual void onLayerPresetChanged( wxCommandEvent& event ) { event.Skip(); } + virtual void onViewportChanged( wxCommandEvent& event ) { event.Skip(); } public: