Move grid selection for both Eeschema and Pcbnew to COMMON_TOOLS.
This commit is contained in:
parent
fc7f5630c7
commit
94a948fdd1
|
@ -63,6 +63,7 @@
|
||||||
#include <page_info.h>
|
#include <page_info.h>
|
||||||
#include <title_block.h>
|
#include <title_block.h>
|
||||||
#include <advanced_config.h>
|
#include <advanced_config.h>
|
||||||
|
#include <eeschema/tools/sch_actions.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition for enabling and disabling scroll bar setting trace output. See the
|
* Definition for enabling and disabling scroll bar setting trace output. See the
|
||||||
|
@ -522,7 +523,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
||||||
|
|
||||||
int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
|
int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
|
||||||
|
|
||||||
SetPresetGrid( idx );
|
GetToolManager()->RunAction( "common.Control.gridPreset", true, idx );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -624,69 +625,6 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SetNextGrid()
|
|
||||||
{
|
|
||||||
BASE_SCREEN * screen = GetScreen();
|
|
||||||
|
|
||||||
int new_grid_cmd = screen->GetGridCmdId();
|
|
||||||
|
|
||||||
// if the grid id is the not the last, increment it
|
|
||||||
if( screen->GridExists( new_grid_cmd + 1 ) )
|
|
||||||
new_grid_cmd += 1;
|
|
||||||
|
|
||||||
SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SetPrevGrid()
|
|
||||||
{
|
|
||||||
BASE_SCREEN * screen = GetScreen();
|
|
||||||
|
|
||||||
int new_grid_cmd = screen->GetGridCmdId();
|
|
||||||
|
|
||||||
// if the grid id is the not the first, increment it
|
|
||||||
if( screen->GridExists( new_grid_cmd - 1 ) )
|
|
||||||
new_grid_cmd -= 1;
|
|
||||||
|
|
||||||
SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SetPresetGrid( int aIndex )
|
|
||||||
{
|
|
||||||
BASE_SCREEN* screen = GetScreen();
|
|
||||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
|
||||||
|
|
||||||
if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) )
|
|
||||||
aIndex = 0;
|
|
||||||
|
|
||||||
// aIndex is a Command Id relative to ID_POPUP_GRID_LEVEL_1000 comand id code.
|
|
||||||
// we need an index in grid list (the cmd id in list is is screen->GetGrids()[0].m_CmdId):
|
|
||||||
int glistIdx = aIndex + ID_POPUP_GRID_LEVEL_1000 - screen->GetGrids()[0].m_CmdId;
|
|
||||||
|
|
||||||
if( m_gridSelectBox )
|
|
||||||
{
|
|
||||||
if( glistIdx < 0 || glistIdx >= (int) m_gridSelectBox->GetCount() )
|
|
||||||
{
|
|
||||||
wxASSERT_MSG( false, "Invalid grid index" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_gridSelectBox->SetSelection( glistIdx );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Be sure m_LastGridSizeId is up to date.
|
|
||||||
m_LastGridSizeId = aIndex;
|
|
||||||
|
|
||||||
screen->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 );
|
|
||||||
view->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
|
|
||||||
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
|
||||||
|
|
||||||
// Put cursor on new grid
|
|
||||||
SetCrossHairPosition( RefPos( true ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
|
int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -531,13 +531,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
||||||
|
|
||||||
int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
|
int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
|
||||||
|
|
||||||
// Notify GAL
|
GetToolManager()->RunAction( "common.Control.gridPreset", true, idx );
|
||||||
TOOL_MANAGER* mgr = GetToolManager();
|
|
||||||
|
|
||||||
if( mgr && IsGalCanvasActive() )
|
|
||||||
mgr->RunAction( "common.Control.gridPreset", true, idx );
|
|
||||||
else
|
|
||||||
SetPresetGrid( idx );
|
|
||||||
|
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
@ -680,65 +674,6 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SetNextGrid()
|
|
||||||
{
|
|
||||||
BASE_SCREEN * screen = GetScreen();
|
|
||||||
|
|
||||||
int new_grid_cmd = screen->GetGridCmdId();
|
|
||||||
|
|
||||||
// if the grid id is the not the last, increment it
|
|
||||||
if( screen->GridExists( new_grid_cmd + 1 ) )
|
|
||||||
new_grid_cmd += 1;
|
|
||||||
|
|
||||||
SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SetPrevGrid()
|
|
||||||
{
|
|
||||||
BASE_SCREEN * screen = GetScreen();
|
|
||||||
|
|
||||||
int new_grid_cmd = screen->GetGridCmdId();
|
|
||||||
|
|
||||||
// if the grid id is the not the first, increment it
|
|
||||||
if( screen->GridExists( new_grid_cmd - 1 ) )
|
|
||||||
new_grid_cmd -= 1;
|
|
||||||
|
|
||||||
SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SetPresetGrid( int aIndex )
|
|
||||||
{
|
|
||||||
BASE_SCREEN * screen = GetScreen();
|
|
||||||
|
|
||||||
if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) )
|
|
||||||
aIndex = screen->GetGrids()[0].m_CmdId;
|
|
||||||
|
|
||||||
// aIndex is a Command Id relative to ID_POPUP_GRID_LEVEL_1000 comand id code.
|
|
||||||
// we need an index in grid list (the cmd id in list is is screen->GetGrids()[0].m_CmdId):
|
|
||||||
int glistIdx = aIndex + ID_POPUP_GRID_LEVEL_1000 - screen->GetGrids()[0].m_CmdId;
|
|
||||||
|
|
||||||
if( m_gridSelectBox )
|
|
||||||
{
|
|
||||||
if( glistIdx < 0 || glistIdx >= (int) m_gridSelectBox->GetCount() - 2 )
|
|
||||||
{
|
|
||||||
wxASSERT_MSG( false, "Invalid grid index" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_gridSelectBox->SetSelection( glistIdx );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Be sure m_LastGridSizeId is up to date.
|
|
||||||
m_LastGridSizeId = aIndex;
|
|
||||||
GetScreen()->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 );
|
|
||||||
|
|
||||||
// Put cursor on new grid
|
|
||||||
SetCrossHairPosition( RefPos( true ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
|
int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -336,28 +336,60 @@ int COMMON_TOOLS::doZoomToPreset( int idx, bool aCenterOnCursor )
|
||||||
// Grid control
|
// Grid control
|
||||||
int COMMON_TOOLS::GridNext( const TOOL_EVENT& aEvent )
|
int COMMON_TOOLS::GridNext( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
m_frame->SetNextGrid();
|
BASE_SCREEN * screen = m_frame->GetScreen();
|
||||||
updateGrid();
|
|
||||||
|
|
||||||
return 0;
|
int new_grid_cmd = screen->GetGridCmdId();
|
||||||
|
|
||||||
|
// if the grid id is the not the last, increment it
|
||||||
|
if( screen->GridExists( new_grid_cmd + 1 ) )
|
||||||
|
new_grid_cmd += 1;
|
||||||
|
|
||||||
|
return doGridPreset( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int COMMON_TOOLS::GridPrev( const TOOL_EVENT& aEvent )
|
int COMMON_TOOLS::GridPrev( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
m_frame->SetPrevGrid();
|
BASE_SCREEN * screen = m_frame->GetScreen();
|
||||||
updateGrid();
|
|
||||||
|
|
||||||
return 0;
|
int new_grid_cmd = screen->GetGridCmdId();
|
||||||
|
|
||||||
|
// if the grid id is the not the first, increment it
|
||||||
|
if( screen->GridExists( new_grid_cmd - 1 ) )
|
||||||
|
new_grid_cmd -= 1;
|
||||||
|
|
||||||
|
return doGridPreset( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int COMMON_TOOLS::GridPreset( const TOOL_EVENT& aEvent )
|
int COMMON_TOOLS::GridPreset( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
long idx = aEvent.Parameter<intptr_t>();
|
return doGridPreset( aEvent.Parameter<intptr_t>() );
|
||||||
|
}
|
||||||
|
|
||||||
m_frame->SetPresetGrid( idx );
|
|
||||||
updateGrid();
|
int COMMON_TOOLS::doGridPreset( int idx )
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = m_frame->GetScreen();
|
||||||
|
|
||||||
|
if( !screen->GridExists( idx + ID_POPUP_GRID_LEVEL_1000 ) )
|
||||||
|
idx = 0;
|
||||||
|
|
||||||
|
screen->SetGrid( idx + ID_POPUP_GRID_LEVEL_1000 );
|
||||||
|
|
||||||
|
// Be sure m_LastGridSizeId is up to date.
|
||||||
|
m_frame->SetLastGridSizeId( idx );
|
||||||
|
|
||||||
|
// Update the combobox (if any)
|
||||||
|
wxUpdateUIEvent dummy;
|
||||||
|
m_frame->OnUpdateSelectGrid( dummy );
|
||||||
|
|
||||||
|
// Update GAL canvas from screen
|
||||||
|
getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
|
||||||
|
getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||||
|
|
||||||
|
// Put cursor on new grid
|
||||||
|
m_frame->SetCrossHairPosition( m_frame->RefPos( true ) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -415,9 +447,3 @@ void COMMON_TOOLS::setTransitions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COMMON_TOOLS::updateGrid()
|
|
||||||
{
|
|
||||||
BASE_SCREEN* screen = m_frame->GetScreen();
|
|
||||||
getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
|
|
||||||
getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
|
||||||
}
|
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
|
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
#include <wx/progdlg.h>
|
#include <wx/progdlg.h>
|
||||||
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/context_menu.h>
|
#include <tool/context_menu.h>
|
||||||
#include <sch_view.h>
|
#include <sch_view.h>
|
||||||
#include <sch_painter.h>
|
#include <sch_painter.h>
|
||||||
|
@ -231,8 +232,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
SetPresetGrid( m_LastGridSizeId );
|
|
||||||
|
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
|
||||||
if( m_canvas )
|
if( m_canvas )
|
||||||
|
@ -268,6 +267,9 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
|
setupTools();
|
||||||
|
GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );
|
||||||
|
|
||||||
Raise();
|
Raise();
|
||||||
Show( true );
|
Show( true );
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
#include <sch_base_frame.h>
|
#include <sch_base_frame.h>
|
||||||
#include <symbol_lib_table.h>
|
#include <symbol_lib_table.h>
|
||||||
#include <dialog_configure_paths.h>
|
#include <dialog_configure_paths.h>
|
||||||
|
#include <tool/tool_manager.h>
|
||||||
|
#include <tool/tool_dispatcher.h>
|
||||||
|
#include <tools/sch_actions.h>
|
||||||
|
|
||||||
#include "dialogs/panel_sym_lib_table.h"
|
#include "dialogs/panel_sym_lib_table.h"
|
||||||
|
|
||||||
|
@ -107,6 +110,22 @@ SCH_BASE_FRAME::~SCH_BASE_FRAME()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_BASE_FRAME::setupTools()
|
||||||
|
{
|
||||||
|
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||||
|
m_toolManager = new TOOL_MANAGER;
|
||||||
|
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
|
||||||
|
GetCanvas()->GetViewControls(), this );
|
||||||
|
m_actions = new SCH_ACTIONS();
|
||||||
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
||||||
|
|
||||||
|
// Register tools
|
||||||
|
m_actions->RegisterAllTools( m_toolManager );
|
||||||
|
m_toolManager->InitTools();
|
||||||
|
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
void SCH_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
wxMenuBar* menuBar = GetMenuBar();
|
wxMenuBar* menuBar = GetMenuBar();
|
||||||
|
|
|
@ -327,6 +327,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// Sets up the tool framework
|
||||||
|
void setupTools();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the library viewer only to browse library contents.
|
* Open the library viewer only to browse library contents.
|
||||||
* If the viewed is already opened from this, raise the viewer
|
* If the viewed is already opened from this, raise the viewer
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
#include <dialog_symbol_remap.h>
|
#include <dialog_symbol_remap.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
|
||||||
#include <tools/sch_actions.h>
|
#include <tools/sch_actions.h>
|
||||||
|
|
||||||
#include <wx/display.h>
|
#include <wx/display.h>
|
||||||
|
@ -414,8 +413,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||||
|
|
||||||
CreateScreens();
|
CreateScreens();
|
||||||
|
|
||||||
SetPresetGrid( m_LastGridSizeId );
|
|
||||||
|
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
|
||||||
if( m_canvas )
|
if( m_canvas )
|
||||||
|
@ -444,8 +441,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
setupTools();
|
setupTools();
|
||||||
|
GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );
|
||||||
Zoom_Automatique( false );
|
GetToolManager()->RunAction( "common.Control.zoomFitScreen", true );
|
||||||
|
|
||||||
if( GetGalCanvas() )
|
if( GetGalCanvas() )
|
||||||
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
||||||
|
@ -482,22 +479,6 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::setupTools()
|
|
||||||
{
|
|
||||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
|
||||||
m_toolManager = new TOOL_MANAGER;
|
|
||||||
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
|
|
||||||
GetCanvas()->GetViewControls(), this );
|
|
||||||
m_actions = new SCH_ACTIONS();
|
|
||||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
|
||||||
|
|
||||||
// Register tools
|
|
||||||
m_actions->RegisterAllTools( m_toolManager );
|
|
||||||
m_toolManager->InitTools();
|
|
||||||
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::SetRepeatItem( SCH_ITEM* aItem )
|
void SCH_EDIT_FRAME::SetRepeatItem( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
// we cannot store a pointer to an item in the display list here since
|
// we cannot store a pointer to an item in the display list here since
|
||||||
|
|
|
@ -203,9 +203,6 @@ private:
|
||||||
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
|
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// The Tool Framework initalization
|
|
||||||
void setupTools();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializing accessor for the pin text size
|
* Initializing accessor for the pin text size
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -60,6 +60,12 @@ OPT<TOOL_EVENT> SCH_ACTIONS::TranslateLegacyId( int aId )
|
||||||
|
|
||||||
case ID_ZOOM_SELECTION:
|
case ID_ZOOM_SELECTION:
|
||||||
return ACTIONS::zoomTool.MakeEvent();
|
return ACTIONS::zoomTool.MakeEvent();
|
||||||
|
|
||||||
|
case ID_POPUP_GRID_NEXT:
|
||||||
|
return ACTIONS::gridNext.MakeEvent();
|
||||||
|
|
||||||
|
case ID_POPUP_GRID_PREV:
|
||||||
|
return ACTIONS::gridPrev.MakeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return OPT<TOOL_EVENT>();
|
return OPT<TOOL_EVENT>();
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include <view/view_controls.h>
|
#include <view/view_controls.h>
|
||||||
#include <sch_painter.h>
|
#include <sch_painter.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
|
#include <tool/tool_manager.h>
|
||||||
|
|
||||||
// Save previous component library viewer state.
|
// Save previous component library viewer state.
|
||||||
wxString LIB_VIEW_FRAME::m_libraryName;
|
wxString LIB_VIEW_FRAME::m_libraryName;
|
||||||
|
@ -141,8 +142,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||||
|
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
|
||||||
SetPresetGrid( m_LastGridSizeId );
|
|
||||||
|
|
||||||
// Menu bar is not mandatory: uncomment/comment the next line
|
// Menu bar is not mandatory: uncomment/comment the next line
|
||||||
// to add/remove the menubar
|
// to add/remove the menubar
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
|
@ -189,12 +188,9 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
// Now Drawpanel is sized, we can use BestZoom to show the component (if any)
|
setupTools();
|
||||||
#ifdef USE_WX_GRAPHICS_CONTEXT
|
GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );
|
||||||
GetScreen()->SetScalingFactor( BestZoom() );
|
GetToolManager()->RunAction( "common.Control.zoomFitScreen", true );
|
||||||
#else
|
|
||||||
Zoom_Automatique( false );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
|
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
|
||||||
{
|
{
|
||||||
|
|
|
@ -566,23 +566,6 @@ public:
|
||||||
*/
|
*/
|
||||||
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
|
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the grid size settings to the next one available.
|
|
||||||
*/
|
|
||||||
virtual void SetNextGrid();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the grid size settings to the previous one available.
|
|
||||||
*/
|
|
||||||
virtual void SetPrevGrid();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the grid size to one of the preset values.
|
|
||||||
*
|
|
||||||
* @param aIndex is the index from the list.
|
|
||||||
*/
|
|
||||||
void SetPresetGrid( int aIndex );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command event handler for selecting grid sizes.
|
* Command event handler for selecting grid sizes.
|
||||||
*
|
*
|
||||||
|
|
|
@ -207,8 +207,8 @@ enum main_id
|
||||||
ID_POPUP_ZOOM_END_RANGE, // last zoom id
|
ID_POPUP_ZOOM_END_RANGE, // last zoom id
|
||||||
|
|
||||||
ID_ON_GRID_SELECT,
|
ID_ON_GRID_SELECT,
|
||||||
ID_POPUP_GRID_PLUS,
|
ID_POPUP_GRID_NEXT,
|
||||||
ID_POPUP_GRID_MOINS,
|
ID_POPUP_GRID_PREV,
|
||||||
ID_POPUP_GRID_SELECT,
|
ID_POPUP_GRID_SELECT,
|
||||||
ID_POPUP_GRID_LEVEL_1000, // id for first predefined grid in inches (1000 * 0.0001 inch)
|
ID_POPUP_GRID_LEVEL_1000, // id for first predefined grid in inches (1000 * 0.0001 inch)
|
||||||
ID_POPUP_GRID_LEVEL_500,
|
ID_POPUP_GRID_LEVEL_500,
|
||||||
|
|
|
@ -599,18 +599,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetFastGrid2();
|
void SetFastGrid2();
|
||||||
|
|
||||||
/**
|
|
||||||
* Virtual function SetNextGrid()
|
|
||||||
* changes the grid size settings to the next one available.
|
|
||||||
*/
|
|
||||||
void SetNextGrid() override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Virtual function SetPrevGrid()
|
|
||||||
* changes the grid size settings to the previous one available.
|
|
||||||
*/
|
|
||||||
void SetPrevGrid() override;
|
|
||||||
|
|
||||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
||||||
virtual void UseGalCanvas( bool aEnable ) override;
|
virtual void UseGalCanvas( bool aEnable ) override;
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,7 @@ private:
|
||||||
///> Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
|
///> Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
|
||||||
int doZoomToPreset( int idx, bool aCenterOnCursor );
|
int doZoomToPreset( int idx, bool aCenterOnCursor );
|
||||||
|
|
||||||
///> Applies the legacy canvas grid settings for GAL.
|
int doGridPreset( int idx );
|
||||||
void updateGrid();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -148,11 +148,11 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_SWITCH_GRID_TO_NEXT:
|
case HK_SWITCH_GRID_TO_NEXT:
|
||||||
SetNextGrid();
|
evt_type = ID_POPUP_GRID_NEXT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_SWITCH_GRID_TO_PREVIOUS:
|
case HK_SWITCH_GRID_TO_PREVIOUS:
|
||||||
SetPrevGrid();
|
evt_type = ID_POPUP_GRID_PREV;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_SWITCH_LAYER_TO_PREVIOUS:
|
case HK_SWITCH_LAYER_TO_PREVIOUS:
|
||||||
|
|
|
@ -1075,17 +1075,8 @@ void PCB_BASE_FRAME::SetFastGrid1()
|
||||||
if( m_FastGrid1 >= (int)GetScreen()->GetGridCount() )
|
if( m_FastGrid1 >= (int)GetScreen()->GetGridCount() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int cmdId = GetScreen()->GetGrids()[m_FastGrid1].m_CmdId;
|
int cmdId = GetScreen()->GetGrids()[m_FastGrid1].m_CmdId - ID_POPUP_GRID_LEVEL_1000;
|
||||||
SetPresetGrid( cmdId - ID_POPUP_GRID_LEVEL_1000 );
|
GetToolManager()->RunAction( "common.Control.gridPreset", true, cmdId );
|
||||||
|
|
||||||
if( m_gridSelectBox )
|
|
||||||
{
|
|
||||||
wxCommandEvent cmd( wxEVT_CHOICE );
|
|
||||||
cmd.SetEventObject( this );
|
|
||||||
OnSelectGrid( cmd );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetCanvas()->Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1094,46 +1085,8 @@ void PCB_BASE_FRAME::SetFastGrid2()
|
||||||
if( m_FastGrid2 >= (int)GetScreen()->GetGridCount() )
|
if( m_FastGrid2 >= (int)GetScreen()->GetGridCount() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int cmdId = GetScreen()->GetGrids()[m_FastGrid2].m_CmdId;
|
int cmdId = GetScreen()->GetGrids()[m_FastGrid2].m_CmdId - ID_POPUP_GRID_LEVEL_1000;
|
||||||
SetPresetGrid( cmdId - ID_POPUP_GRID_LEVEL_1000 );
|
GetToolManager()->RunAction( "common.Control.gridPreset", true, cmdId );
|
||||||
|
|
||||||
if( m_gridSelectBox )
|
|
||||||
{
|
|
||||||
wxCommandEvent cmd( wxEVT_CHOICE );
|
|
||||||
cmd.SetEventObject( this );
|
|
||||||
OnSelectGrid( cmd );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetCanvas()->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::SetNextGrid()
|
|
||||||
{
|
|
||||||
EDA_DRAW_FRAME::SetNextGrid();
|
|
||||||
|
|
||||||
if( m_gridSelectBox )
|
|
||||||
{
|
|
||||||
wxCommandEvent cmd( wxEVT_CHOICE );
|
|
||||||
cmd.SetEventObject( this );
|
|
||||||
OnSelectGrid( cmd );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetCanvas()->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::SetPrevGrid()
|
|
||||||
{
|
|
||||||
EDA_DRAW_FRAME::SetPrevGrid();
|
|
||||||
|
|
||||||
if( m_gridSelectBox )
|
|
||||||
{
|
|
||||||
wxCommandEvent cmd( wxEVT_CHOICE );
|
|
||||||
cmd.SetEventObject( this );
|
|
||||||
OnSelectGrid( cmd );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetCanvas()->Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,12 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
|
||||||
case ID_MODEDIT_PLACE_GRID_COORD:
|
case ID_MODEDIT_PLACE_GRID_COORD:
|
||||||
return ACTIONS::gridSetOrigin.MakeEvent();
|
return ACTIONS::gridSetOrigin.MakeEvent();
|
||||||
|
|
||||||
|
case ID_POPUP_GRID_NEXT:
|
||||||
|
return ACTIONS::gridNext.MakeEvent();
|
||||||
|
|
||||||
|
case ID_POPUP_GRID_PREV:
|
||||||
|
return ACTIONS::gridPrev.MakeEvent();
|
||||||
|
|
||||||
case ID_ZOOM_REDRAW:
|
case ID_ZOOM_REDRAW:
|
||||||
case ID_POPUP_ZOOM_REDRAW:
|
case ID_POPUP_ZOOM_REDRAW:
|
||||||
case ID_VIEWER_ZOOM_REDRAW:
|
case ID_VIEWER_ZOOM_REDRAW:
|
||||||
|
|
Loading…
Reference in New Issue