Add context menu to footprint viewer for zoom & grid.
Fixes: lp:1776126 * https://bugs.launchpad.net/kicad/+bug/1776126
This commit is contained in:
parent
813c1a2ba2
commit
de7791cc8b
|
@ -56,6 +56,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include <tool/common_tools.h>
|
||||
#include "tools/selection_tool.h"
|
||||
#include "tools/pcbnew_control.h"
|
||||
#include "tools/pcb_actions.h"
|
||||
|
||||
|
@ -216,8 +217,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
drawPanel->SetEventDispatcher( m_toolDispatcher );
|
||||
|
||||
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
||||
m_toolManager->RegisterTool( new SELECTION_TOOL ); // for std context menus (zoom & grid)
|
||||
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||
m_toolManager->InitTools();
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||
|
||||
// If a footprint was previously loaded, reload it
|
||||
if( getCurNickname().size() && getCurFootprintName().size() )
|
||||
|
|
|
@ -54,6 +54,7 @@ using namespace std::placeholders;
|
|||
#include <tool/tool_manager.h>
|
||||
#include <router/router_tool.h>
|
||||
#include <connectivity_data.h>
|
||||
#include <footprint_viewer_frame.h>
|
||||
#include "tool_event_utils.h"
|
||||
|
||||
#include "selection_tool.h"
|
||||
|
@ -206,6 +207,15 @@ SELECTION_TOOL::~SELECTION_TOOL()
|
|||
|
||||
bool SELECTION_TOOL::Init()
|
||||
{
|
||||
auto frame = getEditFrame<PCB_BASE_FRAME>();
|
||||
|
||||
if( frame && ( frame->IsType( FRAME_PCB_MODULE_VIEWER )
|
||||
|| frame->IsType( FRAME_PCB_MODULE_VIEWER_MODAL ) ) )
|
||||
{
|
||||
m_menu.AddStandardSubMenus( *frame );
|
||||
return true;
|
||||
}
|
||||
|
||||
auto selectMenu = std::make_shared<SELECT_MENU>();
|
||||
selectMenu->SetTool( this );
|
||||
m_menu.AddSubMenu( selectMenu );
|
||||
|
@ -215,8 +225,6 @@ bool SELECTION_TOOL::Init()
|
|||
menu.AddMenu( selectMenu.get(), false, SELECTION_CONDITIONS::NotEmpty );
|
||||
menu.AddSeparator( SELECTION_CONDITIONS::NotEmpty, 1000 );
|
||||
|
||||
auto frame = getEditFrame<PCB_BASE_FRAME>();
|
||||
|
||||
if( frame )
|
||||
{
|
||||
m_menu.AddStandardSubMenus( *frame );
|
||||
|
|
Loading…
Reference in New Issue