Footprint browser: Handle frame calls
The frame() call requires an edit frame but the browser is derived from PCB_BASE_FRAME. Fixes: lp:1849962 * https://bugs.launchpad.net/kicad/+bug/1849962
This commit is contained in:
parent
4f594550a2
commit
39241dc0ff
|
@ -50,6 +50,7 @@
|
||||||
#include <tools/selection_tool.h>
|
#include <tools/selection_tool.h>
|
||||||
#include <tools/pcbnew_control.h>
|
#include <tools/pcbnew_control.h>
|
||||||
#include <tools/pcb_actions.h>
|
#include <tools/pcb_actions.h>
|
||||||
|
#include "tools/pcbnew_picker_tool.h"
|
||||||
#include <board_commit.h>
|
#include <board_commit.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <eda_pattern_match.h>
|
#include <eda_pattern_match.h>
|
||||||
|
@ -204,6 +205,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
||||||
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
||||||
m_toolManager->RegisterTool( new COMMON_TOOLS ); // for std context menus (zoom & grid)
|
m_toolManager->RegisterTool( new COMMON_TOOLS ); // for std context menus (zoom & grid)
|
||||||
m_toolManager->RegisterTool( new COMMON_CONTROL );
|
m_toolManager->RegisterTool( new COMMON_CONTROL );
|
||||||
|
m_toolManager->RegisterTool( new PCBNEW_PICKER_TOOL ); // for setting grid origin
|
||||||
m_toolManager->InitTools();
|
m_toolManager->InitTools();
|
||||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ protected:
|
||||||
|
|
||||||
PCB_BASE_EDIT_FRAME* frame() const
|
PCB_BASE_EDIT_FRAME* frame() const
|
||||||
{
|
{
|
||||||
return getEditFrame<PCB_BASE_EDIT_FRAME>();
|
return getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOARD* board() const { return getModel<BOARD>(); }
|
BOARD* board() const { return getModel<BOARD>(); }
|
||||||
|
|
|
@ -41,17 +41,18 @@ PCBNEW_PICKER_TOOL::PCBNEW_PICKER_TOOL()
|
||||||
int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||||
GRID_HELPER grid( frame() );
|
auto tool_frame = getEditFrame<PCB_BASE_FRAME>();
|
||||||
|
GRID_HELPER grid( tool_frame );
|
||||||
int finalize_state = WAIT_CANCEL;
|
int finalize_state = WAIT_CANCEL;
|
||||||
|
|
||||||
std::string tool = *aEvent.Parameter<std::string*>();
|
std::string tool = *aEvent.Parameter<std::string*>();
|
||||||
frame()->PushTool( tool );
|
tool_frame->PushTool( tool );
|
||||||
Activate();
|
Activate();
|
||||||
setControls();
|
setControls();
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
frame()->GetCanvas()->SetCursor( m_cursor );
|
tool_frame->GetCanvas()->SetCursor( m_cursor );
|
||||||
|
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
|
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
|
||||||
|
@ -155,7 +156,7 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
controls->ForceCursorPosition( false );
|
controls->ForceCursorPosition( false );
|
||||||
frame()->PopTool( tool );
|
tool_frame->PopTool( tool );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue