Moved some layout editor specific tool actions to another class (PCB_EDITOR_CONTROL).
This commit is contained in:
parent
8898b34755
commit
eee2779f6b
|
@ -262,6 +262,7 @@ set( PCBNEW_CLASS_SRCS
|
||||||
tools/drawing_tool.cpp
|
tools/drawing_tool.cpp
|
||||||
tools/edit_tool.cpp
|
tools/edit_tool.cpp
|
||||||
tools/pcbnew_control.cpp
|
tools/pcbnew_control.cpp
|
||||||
|
tools/pcb_editor_control.cpp
|
||||||
tools/pcb_tools.cpp
|
tools/pcb_tools.cpp
|
||||||
tools/common_actions.cpp
|
tools/common_actions.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 CERN
|
||||||
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pcb_editor_control.h"
|
||||||
|
#include "common_actions.h"
|
||||||
|
|
||||||
|
#include <wxPcbStruct.h>
|
||||||
|
#include <class_board.h>
|
||||||
|
#include <class_draw_panel_gal.h>
|
||||||
|
|
||||||
|
PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() :
|
||||||
|
TOOL_INTERACTIVE( "pcbnew.EditorControl" )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PCB_EDITOR_CONTROL::Reset( RESET_REASON aReason )
|
||||||
|
{
|
||||||
|
m_frame = getEditFrame<PCB_EDIT_FRAME>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PCB_EDITOR_CONTROL::Init()
|
||||||
|
{
|
||||||
|
setTransitions();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Track & via size control
|
||||||
|
int PCB_EDITOR_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
BOARD* board = getModel<BOARD>();
|
||||||
|
int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() + 1;
|
||||||
|
|
||||||
|
if( widthIndex >= (int) board->GetDesignSettings().m_TrackWidthList.size() )
|
||||||
|
widthIndex = board->GetDesignSettings().m_TrackWidthList.size() - 1;
|
||||||
|
|
||||||
|
board->GetDesignSettings().SetTrackWidthIndex( widthIndex );
|
||||||
|
board->GetDesignSettings().UseCustomTrackViaSize( false );
|
||||||
|
|
||||||
|
wxUpdateUIEvent dummy;
|
||||||
|
m_frame->OnUpdateSelectTrackWidth( dummy );
|
||||||
|
setTransitions();
|
||||||
|
|
||||||
|
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PCB_EDITOR_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
BOARD* board = getModel<BOARD>();
|
||||||
|
int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() - 1;
|
||||||
|
|
||||||
|
if( widthIndex < 0 )
|
||||||
|
widthIndex = 0;
|
||||||
|
|
||||||
|
board->GetDesignSettings().SetTrackWidthIndex( widthIndex );
|
||||||
|
board->GetDesignSettings().UseCustomTrackViaSize( false );
|
||||||
|
|
||||||
|
wxUpdateUIEvent dummy;
|
||||||
|
m_frame->OnUpdateSelectTrackWidth( dummy );
|
||||||
|
setTransitions();
|
||||||
|
|
||||||
|
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PCB_EDITOR_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
BOARD* board = getModel<BOARD>();
|
||||||
|
int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() + 1;
|
||||||
|
|
||||||
|
if( sizeIndex >= (int) board->GetDesignSettings().m_ViasDimensionsList.size() )
|
||||||
|
sizeIndex = board->GetDesignSettings().m_ViasDimensionsList.size() - 1;
|
||||||
|
|
||||||
|
board->GetDesignSettings().SetViaSizeIndex( sizeIndex );
|
||||||
|
board->GetDesignSettings().UseCustomTrackViaSize( false );
|
||||||
|
|
||||||
|
wxUpdateUIEvent dummy;
|
||||||
|
m_frame->OnUpdateSelectViaSize( dummy );
|
||||||
|
setTransitions();
|
||||||
|
|
||||||
|
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PCB_EDITOR_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
BOARD* board = getModel<BOARD>();
|
||||||
|
int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() - 1;
|
||||||
|
|
||||||
|
if( sizeIndex < 0 )
|
||||||
|
sizeIndex = 0;
|
||||||
|
|
||||||
|
board->GetDesignSettings().SetViaSizeIndex( sizeIndex );
|
||||||
|
board->GetDesignSettings().UseCustomTrackViaSize( false );
|
||||||
|
|
||||||
|
wxUpdateUIEvent dummy;
|
||||||
|
m_frame->OnUpdateSelectViaSize( dummy );
|
||||||
|
setTransitions();
|
||||||
|
|
||||||
|
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PCB_EDITOR_CONTROL::setTransitions()
|
||||||
|
{
|
||||||
|
// Track & via size control
|
||||||
|
Go( &PCB_EDITOR_CONTROL::TrackWidthInc, COMMON_ACTIONS::trackWidthInc.MakeEvent() );
|
||||||
|
Go( &PCB_EDITOR_CONTROL::TrackWidthDec, COMMON_ACTIONS::trackWidthDec.MakeEvent() );
|
||||||
|
Go( &PCB_EDITOR_CONTROL::ViaSizeInc, COMMON_ACTIONS::viaSizeInc.MakeEvent() );
|
||||||
|
Go( &PCB_EDITOR_CONTROL::ViaSizeDec, COMMON_ACTIONS::viaSizeDec.MakeEvent() );
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 CERN
|
||||||
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PCB_EDITOR_CONTROL_H
|
||||||
|
#define PCB_EDITOR_CONTROL_H
|
||||||
|
|
||||||
|
#include <tool/tool_interactive.h>
|
||||||
|
|
||||||
|
class PCB_EDIT_FRAME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PCBNEW_CONTROL
|
||||||
|
*
|
||||||
|
* Handles hot keys that are not accepted by any other tool.
|
||||||
|
*/
|
||||||
|
class PCB_EDITOR_CONTROL : public TOOL_INTERACTIVE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PCB_EDITOR_CONTROL();
|
||||||
|
|
||||||
|
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||||
|
void Reset( RESET_REASON aReason );
|
||||||
|
|
||||||
|
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||||
|
bool Init();
|
||||||
|
|
||||||
|
// Track & via size control
|
||||||
|
int TrackWidthInc( TOOL_EVENT& aEvent );
|
||||||
|
int TrackWidthDec( TOOL_EVENT& aEvent );
|
||||||
|
int ViaSizeInc( TOOL_EVENT& aEvent );
|
||||||
|
int ViaSizeDec( TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
private:
|
||||||
|
///> Sets up handlers for various events.
|
||||||
|
void setTransitions();
|
||||||
|
|
||||||
|
///> Pointerto the currently used edit frame.
|
||||||
|
PCB_EDIT_FRAME* m_frame;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -35,6 +35,7 @@
|
||||||
#include "drawing_tool.h"
|
#include "drawing_tool.h"
|
||||||
#include "point_editor.h"
|
#include "point_editor.h"
|
||||||
#include "pcbnew_control.h"
|
#include "pcbnew_control.h"
|
||||||
|
#include "pcb_editor_control.h"
|
||||||
#include "common_actions.h"
|
#include "common_actions.h"
|
||||||
#include <router/router_tool.h>
|
#include <router/router_tool.h>
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ void PCB_EDIT_FRAME::setupTools()
|
||||||
m_toolManager->RegisterTool( new DRAWING_TOOL );
|
m_toolManager->RegisterTool( new DRAWING_TOOL );
|
||||||
m_toolManager->RegisterTool( new POINT_EDITOR );
|
m_toolManager->RegisterTool( new POINT_EDITOR );
|
||||||
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
||||||
|
m_toolManager->RegisterTool( new PCB_EDITOR_CONTROL );
|
||||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||||
|
|
||||||
// Run the selection tool, it is supposed to be always active
|
// Run the selection tool, it is supposed to be always active
|
||||||
|
|
|
@ -46,7 +46,7 @@ PCBNEW_CONTROL::PCBNEW_CONTROL() :
|
||||||
|
|
||||||
void PCBNEW_CONTROL::Reset( RESET_REASON aReason )
|
void PCBNEW_CONTROL::Reset( RESET_REASON aReason )
|
||||||
{
|
{
|
||||||
m_frame = getEditFrame<PCB_EDIT_FRAME>();
|
m_frame = getEditFrame<PCB_BASE_FRAME>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ int PCBNEW_CONTROL::TrackDisplayMode( TOOL_EVENT& aEvent )
|
||||||
int PCBNEW_CONTROL::PadDisplayMode( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::PadDisplayMode( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
wxCommandEvent dummy;
|
wxCommandEvent dummy;
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->OnTogglePadDrawMode( dummy );
|
m_frame->OnTogglePadDrawMode( dummy );
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -219,8 +219,8 @@ int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent )
|
||||||
// Layer control
|
// Layer control
|
||||||
int PCBNEW_CONTROL::LayerTop( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerTop( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, F_Cu );
|
m_frame->SwitchLayer( NULL, F_Cu );
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
|
m_frame->GetGalCanvas()->SetFocus();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -229,8 +229,8 @@ int PCBNEW_CONTROL::LayerTop( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerInner1( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerInner1( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, In1_Cu );
|
m_frame->SwitchLayer( NULL, In1_Cu );
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
|
m_frame->GetGalCanvas()->SetFocus();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -239,8 +239,8 @@ int PCBNEW_CONTROL::LayerInner1( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerInner2( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerInner2( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, In2_Cu );
|
m_frame->SwitchLayer( NULL, In2_Cu );
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
|
m_frame->GetGalCanvas()->SetFocus();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -249,8 +249,8 @@ int PCBNEW_CONTROL::LayerInner2( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerInner3( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerInner3( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, In3_Cu );
|
m_frame->SwitchLayer( NULL, In3_Cu );
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
|
m_frame->GetGalCanvas()->SetFocus();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -259,8 +259,8 @@ int PCBNEW_CONTROL::LayerInner3( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerInner4( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerInner4( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, In4_Cu );
|
m_frame->SwitchLayer( NULL, In4_Cu );
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
|
m_frame->GetGalCanvas()->SetFocus();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -269,8 +269,8 @@ int PCBNEW_CONTROL::LayerInner4( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerInner5( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerInner5( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, In5_Cu );
|
m_frame->SwitchLayer( NULL, In5_Cu );
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
|
m_frame->GetGalCanvas()->SetFocus();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -279,8 +279,8 @@ int PCBNEW_CONTROL::LayerInner5( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerInner6( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerInner6( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, In6_Cu );
|
m_frame->SwitchLayer( NULL, In6_Cu );
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
|
m_frame->GetGalCanvas()->SetFocus();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -289,8 +289,8 @@ int PCBNEW_CONTROL::LayerInner6( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerBottom( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerBottom( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, B_Cu );
|
m_frame->SetActiveLayer( B_Cu );
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
|
m_frame->GetGalCanvas()->SetFocus();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -299,8 +299,8 @@ int PCBNEW_CONTROL::LayerBottom( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
|
PCB_BASE_FRAME* editFrame = m_frame;
|
||||||
LAYER_NUM layer = editFrame->GetActiveLayer();
|
LAYER_NUM layer = editFrame->GetActiveLayer();
|
||||||
|
|
||||||
if( layer < F_Cu || layer >= B_Cu )
|
if( layer < F_Cu || layer >= B_Cu )
|
||||||
{
|
{
|
||||||
|
@ -325,8 +325,8 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
|
PCB_BASE_FRAME* editFrame = m_frame;
|
||||||
LAYER_NUM layer = editFrame->GetActiveLayer();
|
LAYER_NUM layer = editFrame->GetActiveLayer();
|
||||||
|
|
||||||
if( layer <= F_Cu || layer > B_Cu )
|
if( layer <= F_Cu || layer > B_Cu )
|
||||||
{
|
{
|
||||||
|
@ -399,7 +399,7 @@ int PCBNEW_CONTROL::LayerAlphaDec( TOOL_EVENT& aEvent )
|
||||||
// Grid control
|
// Grid control
|
||||||
int PCBNEW_CONTROL::GridFast1( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::GridFast1( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SetFastGrid1();
|
m_frame->SetFastGrid1();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -408,7 +408,7 @@ int PCBNEW_CONTROL::GridFast1( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::GridFast2( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::GridFast2( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SetFastGrid2();
|
m_frame->SetFastGrid2();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -417,7 +417,7 @@ int PCBNEW_CONTROL::GridFast2( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::GridNext( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::GridNext( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SetNextGrid();
|
m_frame->SetNextGrid();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -426,7 +426,7 @@ int PCBNEW_CONTROL::GridNext( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SetPrevGrid();
|
m_frame->SetPrevGrid();
|
||||||
setTransitions();
|
setTransitions();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -436,7 +436,7 @@ int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
|
||||||
int PCBNEW_CONTROL::GridSetOrigin( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::GridSetOrigin( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
Activate();
|
Activate();
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL,
|
m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL,
|
||||||
_( "Adjust grid origin" ) );
|
_( "Adjust grid origin" ) );
|
||||||
|
|
||||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||||
|
@ -466,91 +466,6 @@ int PCBNEW_CONTROL::GridSetOrigin( TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Track & via size control
|
|
||||||
int PCBNEW_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
|
|
||||||
{
|
|
||||||
BOARD* board = getModel<BOARD>();
|
|
||||||
int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() + 1;
|
|
||||||
|
|
||||||
if( widthIndex >= (int) board->GetDesignSettings().m_TrackWidthList.size() )
|
|
||||||
widthIndex = board->GetDesignSettings().m_TrackWidthList.size() - 1;
|
|
||||||
|
|
||||||
board->GetDesignSettings().SetTrackWidthIndex( widthIndex );
|
|
||||||
board->GetDesignSettings().UseCustomTrackViaSize( false );
|
|
||||||
|
|
||||||
wxUpdateUIEvent dummy;
|
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectTrackWidth( dummy );
|
|
||||||
setTransitions();
|
|
||||||
|
|
||||||
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int PCBNEW_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
|
|
||||||
{
|
|
||||||
BOARD* board = getModel<BOARD>();
|
|
||||||
int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() - 1;
|
|
||||||
|
|
||||||
if( widthIndex < 0 )
|
|
||||||
widthIndex = 0;
|
|
||||||
|
|
||||||
board->GetDesignSettings().SetTrackWidthIndex( widthIndex );
|
|
||||||
board->GetDesignSettings().UseCustomTrackViaSize( false );
|
|
||||||
|
|
||||||
wxUpdateUIEvent dummy;
|
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectTrackWidth( dummy );
|
|
||||||
setTransitions();
|
|
||||||
|
|
||||||
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int PCBNEW_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
|
|
||||||
{
|
|
||||||
BOARD* board = getModel<BOARD>();
|
|
||||||
int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() + 1;
|
|
||||||
|
|
||||||
if( sizeIndex >= (int) board->GetDesignSettings().m_ViasDimensionsList.size() )
|
|
||||||
sizeIndex = board->GetDesignSettings().m_ViasDimensionsList.size() - 1;
|
|
||||||
|
|
||||||
board->GetDesignSettings().SetViaSizeIndex( sizeIndex );
|
|
||||||
board->GetDesignSettings().UseCustomTrackViaSize( false );
|
|
||||||
|
|
||||||
wxUpdateUIEvent dummy;
|
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectViaSize( dummy );
|
|
||||||
setTransitions();
|
|
||||||
|
|
||||||
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int PCBNEW_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
|
|
||||||
{
|
|
||||||
BOARD* board = getModel<BOARD>();
|
|
||||||
int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() - 1;
|
|
||||||
|
|
||||||
if( sizeIndex < 0 )
|
|
||||||
sizeIndex = 0;
|
|
||||||
|
|
||||||
board->GetDesignSettings().SetViaSizeIndex( sizeIndex );
|
|
||||||
board->GetDesignSettings().UseCustomTrackViaSize( false );
|
|
||||||
|
|
||||||
wxUpdateUIEvent dummy;
|
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectViaSize( dummy );
|
|
||||||
setTransitions();
|
|
||||||
|
|
||||||
m_toolMgr->RunAction( COMMON_ACTIONS::trackViaSizeChanged );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
int PCBNEW_CONTROL::ResetCoords( TOOL_EVENT& aEvent )
|
int PCBNEW_CONTROL::ResetCoords( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
|
@ -630,12 +545,6 @@ void PCBNEW_CONTROL::setTransitions()
|
||||||
Go( &PCBNEW_CONTROL::GridPrev, COMMON_ACTIONS::gridPrev.MakeEvent() );
|
Go( &PCBNEW_CONTROL::GridPrev, COMMON_ACTIONS::gridPrev.MakeEvent() );
|
||||||
Go( &PCBNEW_CONTROL::GridSetOrigin, COMMON_ACTIONS::gridSetOrigin.MakeEvent() );
|
Go( &PCBNEW_CONTROL::GridSetOrigin, COMMON_ACTIONS::gridSetOrigin.MakeEvent() );
|
||||||
|
|
||||||
// Track & via size control
|
|
||||||
Go( &PCBNEW_CONTROL::TrackWidthInc, COMMON_ACTIONS::trackWidthInc.MakeEvent() );
|
|
||||||
Go( &PCBNEW_CONTROL::TrackWidthDec, COMMON_ACTIONS::trackWidthDec.MakeEvent() );
|
|
||||||
Go( &PCBNEW_CONTROL::ViaSizeInc, COMMON_ACTIONS::viaSizeInc.MakeEvent() );
|
|
||||||
Go( &PCBNEW_CONTROL::ViaSizeDec, COMMON_ACTIONS::viaSizeDec.MakeEvent() );
|
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
Go( &PCBNEW_CONTROL::ResetCoords, COMMON_ACTIONS::resetCoords.MakeEvent() );
|
Go( &PCBNEW_CONTROL::ResetCoords, COMMON_ACTIONS::resetCoords.MakeEvent() );
|
||||||
Go( &PCBNEW_CONTROL::SwitchUnits, COMMON_ACTIONS::switchUnits.MakeEvent() );
|
Go( &PCBNEW_CONTROL::SwitchUnits, COMMON_ACTIONS::switchUnits.MakeEvent() );
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include <tool/tool_interactive.h>
|
#include <tool/tool_interactive.h>
|
||||||
|
|
||||||
class PCB_EDIT_FRAME;
|
class PCB_BASE_FRAME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PCBNEW_CONTROL
|
* Class PCBNEW_CONTROL
|
||||||
|
@ -97,7 +97,7 @@ private:
|
||||||
void setTransitions();
|
void setTransitions();
|
||||||
|
|
||||||
///> Pointerto the currently used edit frame.
|
///> Pointerto the currently used edit frame.
|
||||||
PCB_EDIT_FRAME* m_frame;
|
PCB_BASE_FRAME* m_frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue