Add grid properties context menu to grid toolbar

Fixes https://gitlab.com/kicad/code/kicad/issues/5663
This commit is contained in:
Michael Kavanagh 2020-09-27 18:27:25 +01:00 committed by Jon Evans
parent 213a74cbe6
commit b2124a34dc
4 changed files with 25 additions and 0 deletions

View File

@ -32,7 +32,9 @@
#include <lib_manager.h>
#include <class_libentry.h>
#include <tool/action_toolbar.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#ifdef __UNIX__
#define LISTBOX_WIDTH 140
@ -165,5 +167,10 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( EE_ACTIONS::showElectricalTypes, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( EE_ACTIONS::showComponentTree, ACTION_TOOLBAR::TOGGLE );
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
gridMenu->Add( ACTIONS::gridProperties );
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
m_optionsToolBar->Realize();
}

View File

@ -32,6 +32,7 @@
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
/* Create the main Horizontal Toolbar for the schematic editor
*/
@ -176,5 +177,10 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( EE_ACTIONS::toggleHiddenPins, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( EE_ACTIONS::toggleForceHV, ACTION_TOOLBAR::TOGGLE );
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
gridMenu->Add( ACTIONS::gridProperties );
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
m_optionsToolBar->Realize();
}

View File

@ -27,7 +27,9 @@
#include <pcbnew_id.h>
#include <bitmaps.h>
#include <tool/action_toolbar.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <pcb_layer_box_selector.h>
void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
@ -204,6 +206,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::toggleFootprintTree, ACTION_TOOLBAR::TOGGLE );
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
gridMenu->Add( ACTIONS::gridProperties );
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
m_optionsToolBar->Realize();
}

View File

@ -366,6 +366,11 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
gridMenu->Add( ACTIONS::gridProperties );
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
m_optionsToolBar->Realize();
}