diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index ea1ecbce81..a386c8b4c2 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -298,42 +298,36 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_ContrastModeDisplay; }; - viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, - _( "Show La&yers Manager" ), HELP_SHOW_HIDE_LAYERMANAGER, - layers_manager_xpm, layersPaletteShownCondition ); - - viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, - _( "Show Microwa&ve Toolbar" ), HELP_SHOW_HIDE_MICROWAVE_TOOLS, - mw_toolbar_xpm, microwaveToolbarShownCondition ); - - viewMenu->AddItem( ACTIONS::showFootprintBrowser, SELECTION_CONDITIONS::ShowAlways ); - viewMenu->AddItem( ACTIONS::show3DViewer, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddCheckItem( PCB_ACTIONS::showLayersManager, layersPaletteShownCondition ); + viewMenu->AddCheckItem( PCB_ACTIONS::showMicrowaveToolbar, microwaveToolbarShownCondition ); + viewMenu->AddItem( ACTIONS::showFootprintBrowser, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::show3DViewer, SELECTION_CONDITIONS::ShowAlways ); viewMenu->AddSeparator(); - viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways ); - viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways ); - viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways ); - viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways ); - viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways ); viewMenu->AppendSeparator(); - viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition ); - viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways ); - viewMenu->AddCheckItem( PCB_ACTIONS::togglePolarCoords, polarCoordsCondition ); + viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition ); + viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddCheckItem( PCB_ACTIONS::togglePolarCoords, polarCoordsCondition ); // Units submenu CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool ); unitsSubMenu->SetTitle( _( "&Units" ) ); unitsSubMenu->SetIcon( unit_mm_xpm ); - unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition ); - unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition ); + unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition ); + unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition ); viewMenu->AddMenu( unitsSubMenu ); - viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition ); + viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition ); viewMenu->AddSeparator(); - viewMenu->AddCheckItem( PCB_ACTIONS::showRatsnest, ratsnestShownCondition ); - viewMenu->AddCheckItem( PCB_ACTIONS::ratsnestLineMode, curvedRatsnestCondition ); + viewMenu->AddCheckItem( PCB_ACTIONS::showRatsnest, ratsnestShownCondition ); + viewMenu->AddCheckItem( PCB_ACTIONS::ratsnestLineMode, curvedRatsnestCondition ); viewMenu->AddSeparator(); // Drawing Mode Submenu diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 8b8ec2d6b8..58f56cd858 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -161,15 +161,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, PCB_EDIT_FRAME::OnActionPluginRefresh ) #endif - // Option toolbar - EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, - PCB_EDIT_FRAME::OnSelectOptionToolbar ) - EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema ) - EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, - PCB_EDIT_FRAME::OnSelectOptionToolbar ) - // Tracks and vias sizes general options EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 0a47331cf0..1bed870a6a 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -552,7 +552,6 @@ public: /** * Function ShowBoardSetupDialog */ - void ShowBoardSetupDialog( wxCommandEvent& event ); void DoShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString, const wxString& aInitialParentPage = wxEmptyString ); @@ -560,7 +559,8 @@ public: void PrepareLayerIndicator(); - void OnSelectOptionToolbar( wxCommandEvent& event ); + void ToggleLayersManager(); + void ToggleMicrowaveToolbar(); /** * Function DoGenFootprintsPositionFile diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index a7c5361342..7437cb6c3d 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -121,9 +121,6 @@ enum pcbnew_ids ID_PCB_GEN_BOM_FILE_FROM_BOARD, ID_PCB_3DSHAPELIB_WIZARD, - ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, - ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, - ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_TOOL_SELF_CMD, ID_PCB_MUWAVE_TOOL_GAP_CMD, diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index a28b9e9d1b..e43c5ffee7 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -330,36 +330,32 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() wxDefaultPosition, wxDefaultSize, KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); - m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE ); KiScaledSeparator( m_optionsToolBar, this ); - m_optionsToolBar->Add( PCB_ACTIONS::showRatsnest, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::ratsnestLineMode, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::showRatsnest, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::ratsnestLineMode, ACTION_TOOLBAR::TOGGLE ); KiScaledSeparator( m_optionsToolBar, this ); - m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayEnable, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayDisable, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayOutlines, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayEnable, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayDisable, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayOutlines, ACTION_TOOLBAR::TOGGLE ); KiScaledSeparator( m_optionsToolBar, this ); - m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::viaDisplayMode, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::trackDisplayMode, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::viaDisplayMode, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::trackDisplayMode, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE ); // Tools to show/hide toolbars: KiScaledSeparator( m_optionsToolBar, this ); - m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, - wxEmptyString, KiScaledBitmap( layers_manager_xpm, this ), - HELP_SHOW_HIDE_LAYERMANAGER, wxITEM_CHECK ); - m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, - wxEmptyString, KiScaledBitmap( mw_toolbar_xpm, this ), - HELP_SHOW_HIDE_MICROWAVE_TOOLS, wxITEM_CHECK ); + m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::showMicrowaveToolbar, ACTION_TOOLBAR::TOGGLE ); KiScaledSeparator( m_optionsToolBar, this ); m_optionsToolBar->Realize(); @@ -640,31 +636,20 @@ void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar ) } -void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) +void PCB_EDIT_FRAME::ToggleLayersManager() { - int id = event.GetId(); - bool state = event.IsChecked(); + // show auxiliary Vertical layers and visibility manager toolbar + m_show_layer_manager_tools = !m_show_layer_manager_tools; + m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools ); + m_auimgr.Update(); +} - switch( id ) - { - case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE: - m_show_microwave_tools = state; - m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools ); - m_auimgr.Update(); - break; - case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR: - // show auxiliary Vertical layers and visibility manager toolbar - m_show_layer_manager_tools = state; - m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools ); - m_auimgr.Update(); - break; - - default: - DisplayErrorMessage( this, "Invalid toolbar option", - "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ); - break; - } +void PCB_EDIT_FRAME::ToggleMicrowaveToolbar() +{ + m_show_microwave_tools = !m_show_microwave_tools; + m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools ); + m_auimgr.Update(); } @@ -723,6 +708,7 @@ void PCB_EDIT_FRAME::SyncMenusAndToolbars() PCB_DISPLAY_OPTIONS* opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions(); KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions(); int zoneMode = opts->m_DisplayZonesMode; + bool ratsnestShown = GetBoard()->IsElementVisible( LAYER_RATSNEST ); m_mainToolBar->Toggle( ACTIONS::save, GetScreen() && GetScreen()->IsModify() ); m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 ); @@ -737,21 +723,23 @@ void PCB_EDIT_FRAME::SyncMenusAndToolbars() #endif m_mainToolBar->Refresh(); - m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); - m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); - m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); - m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() ); - m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor ); - m_optionsToolBar->Toggle( PCB_ACTIONS::showRatsnest, GetBoard()->IsElementVisible( LAYER_RATSNEST ) ); - m_optionsToolBar->Toggle( PCB_ACTIONS::ratsnestLineMode, opts->m_DisplayRatsnestLinesCurved ); + m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); + m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); + m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); + m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() ); + m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor ); + m_optionsToolBar->Toggle( PCB_ACTIONS::showRatsnest, ratsnestShown ); + m_optionsToolBar->Toggle( PCB_ACTIONS::ratsnestLineMode, opts->m_DisplayRatsnestLinesCurved ); + m_optionsToolBar->Toggle( PCB_ACTIONS::showLayersManager, LayerManagerShown() ); + m_optionsToolBar->Toggle( PCB_ACTIONS::showMicrowaveToolbar, MicrowaveToolbarShown() ); - m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayEnable, zoneMode == 0 ); - m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayDisable, zoneMode == 1 ); - m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayOutlines, zoneMode == 2 ); - m_optionsToolBar->Toggle( PCB_ACTIONS::trackDisplayMode, !opts->m_DisplayPcbTrackFill ); - m_optionsToolBar->Toggle( PCB_ACTIONS::viaDisplayMode, !opts->m_DisplayViaFill ); - m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill ); - m_optionsToolBar->Toggle( ACTIONS::highContrastMode, opts->m_ContrastModeDisplay ); + m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayEnable, zoneMode == 0 ); + m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayDisable, zoneMode == 1 ); + m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayOutlines, zoneMode == 2 ); + m_optionsToolBar->Toggle( PCB_ACTIONS::trackDisplayMode, !opts->m_DisplayPcbTrackFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::viaDisplayMode, !opts->m_DisplayViaFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill ); + m_optionsToolBar->Toggle( ACTIONS::highContrastMode, opts->m_ContrastModeDisplay ); m_optionsToolBar->Refresh(); m_drawToolBar->Toggle( PCB_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED ); diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index fd6029155b..541e81f0e2 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -280,6 +280,8 @@ public: static TOOL_ACTION runDRC; static TOOL_ACTION editFootprintInFpEditor; + static TOOL_ACTION showLayersManager; + static TOOL_ACTION showMicrowaveToolbar; static TOOL_ACTION showPythonConsole; static TOOL_ACTION showHelp; diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 8313030dd9..be1ada17fd 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -231,6 +231,16 @@ TOOL_ACTION PCB_ACTIONS::showPythonConsole( "pcbnew.Control.showPythonConsole", _( "Scripting Console" ), _( "Show the Python scripting console" ), py_script_xpm ); +TOOL_ACTION PCB_ACTIONS::showLayersManager( "pcbnew.Control.showLayersManager", + AS_GLOBAL, 0, + _( "Show Layers Manager" ), _( "Show/hide the layers manager" ), + layers_manager_xpm ); + +TOOL_ACTION PCB_ACTIONS::showMicrowaveToolbar( "pcbnew.Control.showMicrowaveToolbar", + AS_GLOBAL, 0, + _( "Show Microwave Toolbar" ), _( "Show/hide microwave toolbar\n(Experimental feature)" ), + mw_toolbar_xpm ); + TOOL_ACTION PCB_ACTIONS::flipBoard( "pcbnew.Control.flipBoard", AS_GLOBAL, 0, _( "Flip Board View" ), _( "Flip (mirror) the board view" ), @@ -584,6 +594,20 @@ int PCB_EDITOR_CONTROL::UpdatePCBFromSchematic( const TOOL_EVENT& aEvent ) } +int PCB_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent ) +{ + frame()->ToggleLayersManager(); + return 0; +} + + +int PCB_EDITOR_CONTROL::ToggleMicrowaveToolbar( const TOOL_EVENT& aEvent ) +{ + frame()->ToggleMicrowaveToolbar(); + return 0; +} + + int PCB_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent ) { #if defined( KICAD_SCRIPTING_WXPYTHON ) @@ -1578,6 +1602,8 @@ void PCB_EDITOR_CONTROL::setTransitions() Go( &PCB_EDITOR_CONTROL::ListNets, PCB_ACTIONS::listNets.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::UpdatePCBFromSchematic, ACTIONS::updatePcbFromSchematic.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ToggleMicrowaveToolbar, PCB_ACTIONS::showMicrowaveToolbar.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() ); } diff --git a/pcbnew/tools/pcb_editor_control.h b/pcbnew/tools/pcb_editor_control.h index 681fe2fbf4..4cf279c8b7 100644 --- a/pcbnew/tools/pcb_editor_control.h +++ b/pcbnew/tools/pcb_editor_control.h @@ -68,6 +68,8 @@ public: int GenerateFabFiles( const TOOL_EVENT& aEvent ); int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent ); + int ToggleLayersManager( const TOOL_EVENT& aEvent ); + int ToggleMicrowaveToolbar( const TOOL_EVENT& aEvent ); int TogglePythonConsole( const TOOL_EVENT& aEvent ); int Find( const TOOL_EVENT& aEvent );