Commit 902d0e3f authored by Maciej Suminski's avatar Maciej Suminski

Tools are processing const TOOL_EVENT& (Tool Framework).

parent 69553d6f
......@@ -101,7 +101,7 @@ struct TOOL_MANAGER::TOOL_STATE
CONTEXT_MENU_TRIGGER contextMenuTrigger;
/// Tool execution context
COROUTINE<int, TOOL_EVENT&>* cofunc;
COROUTINE<int, const TOOL_EVENT&>* cofunc;
/// The event that triggered the execution/wakeup of the tool after Wait() call
TOOL_EVENT wakeupEvent;
......@@ -464,7 +464,7 @@ optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
}
void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
{
// iterate over all registered tools
BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
......@@ -512,7 +512,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
// as the state changes, the transition table has to be set up again
st->transitions.clear();
st->cofunc = new COROUTINE<int, TOOL_EVENT&>( tr.second );
st->cofunc = new COROUTINE<int, const TOOL_EVENT&>( tr.second );
// got match? Run the handler.
st->cofunc->Call( aEvent );
......@@ -529,7 +529,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
}
bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
bool TOOL_MANAGER::dispatchStandardEvents( const TOOL_EVENT& aEvent )
{
if( aEvent.Action() == TA_KEY_PRESSED )
{
......@@ -542,7 +542,7 @@ bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
}
bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent )
{
if( aEvent.IsActivate() )
{
......@@ -559,7 +559,7 @@ bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
}
void TOOL_MANAGER::dispatchContextMenu( TOOL_EVENT& aEvent )
void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
{
BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
{
......@@ -614,7 +614,7 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
}
bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
bool TOOL_MANAGER::ProcessEvent( const TOOL_EVENT& aEvent )
{
// Early dispatch of events destined for the TOOL_MANAGER
if( !dispatchStandardEvents( aEvent ) )
......
......@@ -51,7 +51,7 @@ enum TOOL_TYPE
/// Unique identifier for tools
typedef int TOOL_ID;
typedef DELEGATE<int, TOOL_EVENT&> TOOL_STATE_FUNC;
typedef DELEGATE<int, const TOOL_EVENT&> TOOL_STATE_FUNC;
/**
* Class TOOL_BASE
......
......@@ -70,7 +70,7 @@ public:
* No conditions means any event.
*/
template <class T>
void Go( int (T::* aStateFunc)( TOOL_EVENT& ),
void Go( int (T::* aStateFunc)( const TOOL_EVENT& ),
const TOOL_EVENT_LIST& aConditions = TOOL_EVENT( TC_ANY, TA_ANY ) );
/**
......@@ -110,7 +110,7 @@ private:
// hide TOOL_MANAGER implementation
template <class T>
void TOOL_INTERACTIVE::Go( int (T::* aStateFunc)( TOOL_EVENT& ),
void TOOL_INTERACTIVE::Go( int (T::* aStateFunc)( const TOOL_EVENT& ),
const TOOL_EVENT_LIST& aConditions )
{
TOOL_STATE_FUNC sptr( static_cast<T*>( this ), aStateFunc );
......
......@@ -169,7 +169,7 @@ public:
* Propagates an event to tools that requested events of matching type(s).
* @param aEvent is the event to be processed.
*/
bool ProcessEvent( TOOL_EVENT& aEvent );
bool ProcessEvent( const TOOL_EVENT& aEvent );
/**
* Puts an event to the event queue to be processed at the end of event processing cycle.
......@@ -309,7 +309,7 @@ private:
* Function dispatchInternal
* Passes an event at first to the active tools, then to all others.
*/
void dispatchInternal( TOOL_EVENT& aEvent );
void dispatchInternal( const TOOL_EVENT& aEvent );
/**
* Function dispatchStandardEvents()
......@@ -317,7 +317,7 @@ private:
* @param aEvent is the event to be processed.
* @return False if the event was processed and should not go any further.
*/
bool dispatchStandardEvents( TOOL_EVENT& aEvent );
bool dispatchStandardEvents( const TOOL_EVENT& aEvent );
/**
* Function dispatchActivation()
......@@ -325,13 +325,13 @@ private:
* @param aEvent is an event to be tested.
* @return True if a tool was invoked, false otherwise.
*/
bool dispatchActivation( TOOL_EVENT& aEvent );
bool dispatchActivation( const TOOL_EVENT& aEvent );
/**
* Function dispatchContextMenu()
* Handles context menu related events.
*/
void dispatchContextMenu( TOOL_EVENT& aEvent );
void dispatchContextMenu( const TOOL_EVENT& aEvent );
/**
* Function invokeTool()
......
......@@ -725,7 +725,7 @@ void ROUTER_TOOL::performRouting()
}
int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
int ROUTER_TOOL::Main( const TOOL_EVENT& aEvent )
{
VIEW_CONTROLS* ctls = getViewControls();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
......
......@@ -41,7 +41,7 @@ public:
~ROUTER_TOOL();
void Reset( RESET_REASON aReason );
int Main( TOOL_EVENT& aEvent );
int Main( const TOOL_EVENT& aEvent );
private:
PNS_ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 );
......
......@@ -74,7 +74,7 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
}
int DRAWING_TOOL::DrawLine( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
{
boost::optional<VECTOR2D> startingPoint;
......@@ -135,7 +135,7 @@ int DRAWING_TOOL::DrawLine( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawCircle( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
{
if( m_editModules )
{
......@@ -184,7 +184,7 @@ int DRAWING_TOOL::DrawCircle( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
{
if( m_editModules )
{
......@@ -233,7 +233,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::PlaceText( TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
{
if( m_editModules )
return placeTextModule();
......@@ -242,7 +242,7 @@ int DRAWING_TOOL::PlaceText( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
{
DIMENSION* dimension = NULL;
int width, maxThickness;
......@@ -421,7 +421,7 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawZone( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_PCB_ZONES_BUTT, wxCURSOR_PENCIL, _( "Add zones" ) );
......@@ -429,7 +429,7 @@ int DRAWING_TOOL::DrawZone( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawKeepout( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawKeepout( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_PCB_KEEPOUT_AREA_BUTT, wxCURSOR_PENCIL, _( "Add keepout" ) );
......@@ -437,7 +437,7 @@ int DRAWING_TOOL::DrawKeepout( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceTarget( const TOOL_EVENT& aEvent )
{
PCB_TARGET* target = new PCB_TARGET( m_board );
......@@ -525,7 +525,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceModule( const TOOL_EVENT& aEvent )
{
MODULE* module = NULL;
......@@ -635,7 +635,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::PlaceDXF( TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
{
DIALOG_DXF_IMPORT dlg( m_frame );
int dlgResult = dlg.ShowModal();
......@@ -825,7 +825,7 @@ int DRAWING_TOOL::PlaceDXF( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::SetAnchor( TOOL_EVENT& aEvent )
int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
{
assert( m_editModules );
......
......@@ -58,7 +58,7 @@ public:
* to click at least two times to determine the origin and the end for a line. If there are
* more clicks, the line is drawn as a continous polyline.
*/
int DrawLine( TOOL_EVENT& aEvent );
int DrawLine( const TOOL_EVENT& aEvent );
/**
* Function DrawCircle()
......@@ -66,7 +66,7 @@ public:
* to first click on a point that is going to be used as the center of the circle. The second
* click determines the circle radius.
*/
int DrawCircle( TOOL_EVENT& aEvent );
int DrawCircle( const TOOL_EVENT& aEvent );
/**
* Function DrawArc()
......@@ -74,14 +74,14 @@ public:
* to first click on a point that is going to be used as the center of the arc. The second
* click determines the origin and radius, the third one - the angle.
*/
int DrawArc( TOOL_EVENT& aEvent );
int DrawArc( const TOOL_EVENT& aEvent );
/**
* Function PlaceText()
* Displays a dialog that allows to input text and its settings and then lets the user decide
* where to place the text in editor.
*/
int PlaceText( TOOL_EVENT& aEvent );
int PlaceText( const TOOL_EVENT& aEvent );
/**
* Function DrawDimension()
......@@ -89,7 +89,7 @@ public:
* to first click on a point that is going to be used as the origin of the dimension.
* The second click determines the end and the third click modifies its height.
*/
int DrawDimension( TOOL_EVENT& aEvent );
int DrawDimension( const TOOL_EVENT& aEvent );
/**
* Function DrawZone()
......@@ -98,7 +98,7 @@ public:
* as a boundary polygon of the zone. Double click or clicking on the origin of the boundary
* polyline finishes the drawing.
*/
int DrawZone( TOOL_EVENT& aEvent );
int DrawZone( const TOOL_EVENT& aEvent );
/**
* Function DrawKeepout()
......@@ -107,31 +107,31 @@ public:
* be used as a boundary polygon of the area. Double click or clicking on the origin of the
* boundary polyline finishes the drawing.
*/
int DrawKeepout( TOOL_EVENT& aEvent );
int DrawKeepout( const TOOL_EVENT& aEvent );
/**
* Function PlaceTarget()
* Allows user to place a layer alignment target.
*/
int PlaceTarget( TOOL_EVENT& aEvent );
int PlaceTarget( const TOOL_EVENT& aEvent );
/**
* Function PlaceModule()
* Displays a dialog to select a module to be added and allows the user to set its position.
*/
int PlaceModule( TOOL_EVENT& aEvent );
int PlaceModule( const TOOL_EVENT& aEvent );
/**
* Function PlaceDXF()
* Places a drawing imported from a DXF file in module editor.
*/
int PlaceDXF( TOOL_EVENT& aEvent );
int PlaceDXF( const TOOL_EVENT& aEvent );
/**
* Function SetAnchor()
* Places the footprint anchor (only in module editor).
*/
int SetAnchor( TOOL_EVENT& aEvent );
int SetAnchor( const TOOL_EVENT& aEvent );
/**
* Function EditModules()
......
......@@ -81,7 +81,7 @@ bool EDIT_TOOL::Init()
}
int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -238,7 +238,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
}
int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
......@@ -307,7 +307,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
}
int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
......@@ -361,7 +361,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
}
int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
......@@ -415,7 +415,7 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
}
int EDIT_TOOL::Remove( TOOL_EVENT& aEvent )
int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......
......@@ -61,35 +61,35 @@ public:
* Main loop in which events are handled.
* @param aEvent is the handled event.
*/
int Main( TOOL_EVENT& aEvent );
int Main( const TOOL_EVENT& aEvent );
/**
* Function Edit()
*
* Displays properties window for the selected object.
*/
int Properties( TOOL_EVENT& aEvent );
int Properties( const TOOL_EVENT& aEvent );
/**
* Function Rotate()
*
* Rotates currently selected items.
*/
int Rotate( TOOL_EVENT& aEvent );
int Rotate( const TOOL_EVENT& aEvent );
/**
* Function Flip()
*
* Rotates currently selected items. The rotation point is the current cursor position.
*/
int Flip( TOOL_EVENT& aEvent );
int Flip( const TOOL_EVENT& aEvent );
/**
* Function Remove()
*
* Deletes currently selected items. The rotation point is the current cursor position.
*/
int Remove( TOOL_EVENT& aEvent );
int Remove( const TOOL_EVENT& aEvent );
/**
* Function EditModules()
......
......@@ -119,7 +119,7 @@ static wxString getNextPadName( MODULE* aModule )
}
int MODULE_TOOLS::PlacePad( TOOL_EVENT& aEvent )
int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
......@@ -222,7 +222,7 @@ int MODULE_TOOLS::PlacePad( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent )
int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
{
std::list<D_PAD*> pads;
std::set<D_PAD*> allPads;
......@@ -329,7 +329,7 @@ int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::CopyItems( TOOL_EVENT& aEvent )
int MODULE_TOOLS::CopyItems( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
......@@ -401,7 +401,7 @@ int MODULE_TOOLS::CopyItems( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::PasteItems( TOOL_EVENT& aEvent )
int MODULE_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
{
// Parse clipboard
PCB_IO io( CTL_FOR_CLIPBOARD );
......@@ -533,7 +533,7 @@ int MODULE_TOOLS::PasteItems( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::ModuleTextOutlines( TOOL_EVENT& aEvent )
int MODULE_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -570,7 +570,7 @@ int MODULE_TOOLS::ModuleTextOutlines( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::ModuleEdgeOutlines( TOOL_EVENT& aEvent )
int MODULE_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......
......@@ -55,41 +55,41 @@ public:
* Function PlacePad()
* Places a pad in module editor.
*/
int PlacePad( TOOL_EVENT& aEvent );
int PlacePad( const TOOL_EVENT& aEvent );
/**
* Function EnumeratePads()
* Tool for quick pad enumeration.
*/
int EnumeratePads( TOOL_EVENT& aEvent );
int EnumeratePads( const TOOL_EVENT& aEvent );
/**
* Function CopyItems()
*
* Copies selected items to the clipboard. Works only in "edit modules" mode.
*/
int CopyItems( TOOL_EVENT& aEvent );
int CopyItems( const TOOL_EVENT& aEvent );
/**
* Function PastePad()
*
* Pastes items from the clipboard. Works only in "edit modules" mode.
*/
int PasteItems( TOOL_EVENT& aEvent );
int PasteItems( const TOOL_EVENT& aEvent );
/**
* Function ModuleTextOutlines()
*
* Toggles display mode for module texts (outline/filled).
*/
int ModuleTextOutlines( TOOL_EVENT& aEvent );
int ModuleTextOutlines( const TOOL_EVENT& aEvent );
/**
* Function ModuleEdgeOutlines()
*
* Toggles display mode for module edges (outline/filled).
*/
int ModuleEdgeOutlines( TOOL_EVENT& aEvent );
int ModuleEdgeOutlines( const TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
......
......@@ -75,7 +75,7 @@ bool PCB_EDITOR_CONTROL::Init()
// Track & via size control
int PCB_EDITOR_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() + 1;
......@@ -96,7 +96,7 @@ int PCB_EDITOR_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() - 1;
......@@ -117,7 +117,7 @@ int PCB_EDITOR_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() + 1;
......@@ -138,7 +138,7 @@ int PCB_EDITOR_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() - 1;
......@@ -160,7 +160,7 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
// Zone actions
int PCB_EDITOR_CONTROL::ZoneFill( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ZoneFill( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
......@@ -181,7 +181,7 @@ int PCB_EDITOR_CONTROL::ZoneFill( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ZoneFillAll( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ZoneFillAll( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
......@@ -199,7 +199,7 @@ int PCB_EDITOR_CONTROL::ZoneFillAll( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ZoneUnfill( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
......@@ -220,7 +220,7 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ZoneUnfillAll( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
......
......@@ -46,16 +46,16 @@ public:
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 );
int TrackWidthInc( const TOOL_EVENT& aEvent );
int TrackWidthDec( const TOOL_EVENT& aEvent );
int ViaSizeInc( const TOOL_EVENT& aEvent );
int ViaSizeDec( const TOOL_EVENT& aEvent );
// Zone actions
int ZoneFill( TOOL_EVENT& aEvent );
int ZoneFillAll( TOOL_EVENT& aEvent );
int ZoneUnfill( TOOL_EVENT& aEvent );
int ZoneUnfillAll( TOOL_EVENT& aEvent );
int ZoneFill( const TOOL_EVENT& aEvent );
int ZoneFillAll( const TOOL_EVENT& aEvent );
int ZoneUnfill( const TOOL_EVENT& aEvent );
int ZoneUnfillAll( const TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
......
......@@ -60,7 +60,7 @@ bool PCBNEW_CONTROL::Init()
}
int PCBNEW_CONTROL::ZoomInOut( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ZoomInOut( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
double zoomScale = 1.0;
......@@ -77,7 +77,7 @@ int PCBNEW_CONTROL::ZoomInOut( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ZoomInOutCenter( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ZoomInOutCenter( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
double zoomScale = 1.0;
......@@ -94,7 +94,7 @@ int PCBNEW_CONTROL::ZoomInOutCenter( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ZoomCenter( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ZoomCenter( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
view->SetCenter( getViewControls()->GetCursorPosition() );
......@@ -104,7 +104,7 @@ int PCBNEW_CONTROL::ZoomCenter( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
KIGFX::GAL* gal = m_frame->GetGalCanvas()->GetGAL();
......@@ -140,7 +140,7 @@ int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::TrackDisplayMode( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -165,7 +165,7 @@ int PCBNEW_CONTROL::TrackDisplayMode( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::PadDisplayMode( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -190,7 +190,7 @@ int PCBNEW_CONTROL::PadDisplayMode( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ViaDisplayMode( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -215,7 +215,7 @@ int PCBNEW_CONTROL::ViaDisplayMode( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ZoneDisplayMode( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -246,7 +246,7 @@ int PCBNEW_CONTROL::ZoneDisplayMode( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::HighContrastMode( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -264,7 +264,7 @@ int PCBNEW_CONTROL::HighContrastMode( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::HighContrastInc( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::HighContrastInc( const TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
......@@ -273,7 +273,7 @@ int PCBNEW_CONTROL::HighContrastInc( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::HighContrastDec( const TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
......@@ -283,7 +283,7 @@ int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent )
// Layer control
int PCBNEW_CONTROL::LayerSwitch( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::LayerSwitch( const TOOL_EVENT& aEvent )
{
if( aEvent.IsAction( &COMMON_ACTIONS::layerTop ) )
m_frame->SwitchLayer( NULL, F_Cu );
......@@ -308,7 +308,7 @@ int PCBNEW_CONTROL::LayerSwitch( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
{
PCB_BASE_FRAME* editFrame = m_frame;
LAYER_NUM layer = editFrame->GetActiveLayer();
......@@ -336,7 +336,7 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
{
PCB_BASE_FRAME* editFrame = m_frame;
LAYER_NUM layer = editFrame->GetActiveLayer();
......@@ -364,7 +364,7 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::LayerAlphaInc( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -387,7 +387,7 @@ int PCBNEW_CONTROL::LayerAlphaInc( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::LayerAlphaDec( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -411,7 +411,7 @@ int PCBNEW_CONTROL::LayerAlphaDec( TOOL_EVENT& aEvent )
// Grid control
int PCBNEW_CONTROL::GridFast1( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::GridFast1( const TOOL_EVENT& aEvent )
{
m_frame->SetFastGrid1();
setTransitions();
......@@ -420,7 +420,7 @@ int PCBNEW_CONTROL::GridFast1( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::GridFast2( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::GridFast2( const TOOL_EVENT& aEvent )
{
m_frame->SetFastGrid2();
setTransitions();
......@@ -429,7 +429,7 @@ int PCBNEW_CONTROL::GridFast2( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::GridNext( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::GridNext( const TOOL_EVENT& aEvent )
{
m_frame->SetNextGrid();
setTransitions();
......@@ -438,7 +438,7 @@ int PCBNEW_CONTROL::GridNext( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::GridPrev( const TOOL_EVENT& aEvent )
{
m_frame->SetPrevGrid();
setTransitions();
......@@ -447,7 +447,7 @@ int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::GridSetOrigin( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
{
Activate();
m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL,
......@@ -481,7 +481,7 @@ int PCBNEW_CONTROL::GridSetOrigin( TOOL_EVENT& aEvent )
// Miscellaneous
int PCBNEW_CONTROL::ResetCoords( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
{
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
......@@ -493,7 +493,7 @@ int PCBNEW_CONTROL::ResetCoords( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::SwitchCursor( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent )
{
const unsigned int BIG_CURSOR = 4000;
const unsigned int SMALL_CURSOR = 80;
......@@ -511,7 +511,7 @@ int PCBNEW_CONTROL::SwitchCursor( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::SwitchUnits( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent )
{
// TODO should not it be refactored to pcb_frame member function?
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
......@@ -528,7 +528,7 @@ int PCBNEW_CONTROL::SwitchUnits( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ShowHelp( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
{
// TODO
DisplayInfoMessage( m_frame, _( "Not implemented yet." ) );
......@@ -538,7 +538,7 @@ int PCBNEW_CONTROL::ShowHelp( TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ToBeDone( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ToBeDone( const TOOL_EVENT& aEvent )
{
DisplayInfoMessage( m_frame, _( "Not implemented yet." ) );
setTransitions();
......
......@@ -47,40 +47,40 @@ public:
bool Init();
// View controls
int ZoomInOut( TOOL_EVENT& aEvent );
int ZoomInOutCenter( TOOL_EVENT& aEvent );
int ZoomCenter( TOOL_EVENT& aEvent );
int ZoomFitScreen( TOOL_EVENT& aEvent );
int ZoomInOut( const TOOL_EVENT& aEvent );
int ZoomInOutCenter( const TOOL_EVENT& aEvent );
int ZoomCenter( const TOOL_EVENT& aEvent );
int ZoomFitScreen( const TOOL_EVENT& aEvent );
// Display modes
int TrackDisplayMode( TOOL_EVENT& aEvent );
int PadDisplayMode( TOOL_EVENT& aEvent );
int ViaDisplayMode( TOOL_EVENT& aEvent );
int ZoneDisplayMode( TOOL_EVENT& aEvent );
int HighContrastMode( TOOL_EVENT& aEvent );
int HighContrastInc( TOOL_EVENT& aEvent );
int HighContrastDec( TOOL_EVENT& aEvent );
int TrackDisplayMode( const TOOL_EVENT& aEvent );
int PadDisplayMode( const TOOL_EVENT& aEvent );
int ViaDisplayMode( const TOOL_EVENT& aEvent );
int ZoneDisplayMode( const TOOL_EVENT& aEvent );
int HighContrastMode( const TOOL_EVENT& aEvent );
int HighContrastInc( const TOOL_EVENT& aEvent );
int HighContrastDec( const TOOL_EVENT& aEvent );
// Layer control
int LayerSwitch( TOOL_EVENT& aEvent );
int LayerNext( TOOL_EVENT& aEvent );
int LayerPrev( TOOL_EVENT& aEvent );
int LayerAlphaInc( TOOL_EVENT& aEvent );
int LayerAlphaDec( TOOL_EVENT& aEvent );
int LayerSwitch( const TOOL_EVENT& aEvent );
int LayerNext( const TOOL_EVENT& aEvent );
int LayerPrev( const TOOL_EVENT& aEvent );
int LayerAlphaInc( const TOOL_EVENT& aEvent );
int LayerAlphaDec( const TOOL_EVENT& aEvent );
// Grid control
int GridFast1( TOOL_EVENT& aEvent );
int GridFast2( TOOL_EVENT& aEvent );
int GridNext( TOOL_EVENT& aEvent );
int GridPrev( TOOL_EVENT& aEvent );
int GridSetOrigin( TOOL_EVENT& aEvent );
int GridFast1( const TOOL_EVENT& aEvent );
int GridFast2( const TOOL_EVENT& aEvent );
int GridNext( const TOOL_EVENT& aEvent );
int GridPrev( const TOOL_EVENT& aEvent );
int GridSetOrigin( const TOOL_EVENT& aEvent );
// Miscellaneous
int ResetCoords( TOOL_EVENT& aEvent );
int SwitchCursor( TOOL_EVENT& aEvent );
int SwitchUnits( TOOL_EVENT& aEvent );
int ShowHelp( TOOL_EVENT& aEvent );
int ToBeDone( TOOL_EVENT& aEvent );
int ResetCoords( const TOOL_EVENT& aEvent );
int SwitchCursor( const TOOL_EVENT& aEvent );
int SwitchUnits( const TOOL_EVENT& aEvent );
int ShowHelp( const TOOL_EVENT& aEvent );
int ToBeDone( const TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
......
......@@ -72,7 +72,7 @@ bool PLACEMENT_TOOL::Init()
}
int PLACEMENT_TOOL::AlignTop( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::AlignTop( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -115,7 +115,7 @@ int PLACEMENT_TOOL::AlignTop( TOOL_EVENT& aEvent )
}
int PLACEMENT_TOOL::AlignBottom( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -158,7 +158,7 @@ int PLACEMENT_TOOL::AlignBottom( TOOL_EVENT& aEvent )
}
int PLACEMENT_TOOL::AlignLeft( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::AlignLeft( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -201,7 +201,7 @@ int PLACEMENT_TOOL::AlignLeft( TOOL_EVENT& aEvent )
}
int PLACEMENT_TOOL::AlignRight( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::AlignRight( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -256,7 +256,7 @@ static bool compareY( const BOARD_ITEM* aA, const BOARD_ITEM* aB )
}
int PLACEMENT_TOOL::DistributeHorizontally( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -305,7 +305,7 @@ int PLACEMENT_TOOL::DistributeHorizontally( TOOL_EVENT& aEvent )
}
int PLACEMENT_TOOL::DistributeVertically( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......
......@@ -46,22 +46,22 @@ public:
bool Init();
/// TODO
int AlignTop( TOOL_EVENT& aEvent );
int AlignTop( const TOOL_EVENT& aEvent );
/// TODO
int AlignBottom( TOOL_EVENT& aEvent );
int AlignBottom( const TOOL_EVENT& aEvent );
/// TODO
int AlignLeft( TOOL_EVENT& aEvent );
int AlignLeft( const TOOL_EVENT& aEvent );
/// TODO
int AlignRight( TOOL_EVENT& aEvent );
int AlignRight( const TOOL_EVENT& aEvent );
/// TODO
int DistributeHorizontally( TOOL_EVENT& aEvent );
int DistributeHorizontally( const TOOL_EVENT& aEvent );
/// TODO
int DistributeVertically( TOOL_EVENT& aEvent );
int DistributeVertically( const TOOL_EVENT& aEvent );
private:
/// TODO
......
......@@ -219,7 +219,7 @@ bool POINT_EDITOR::Init()
}
int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent )
int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -797,8 +797,8 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
void POINT_EDITOR::setTransitions()
{
Go( &POINT_EDITOR::OnSelectionChange, m_selectionTool->SelectedEvent );
Go( &POINT_EDITOR::OnSelectionChange, m_selectionTool->UnselectedEvent );
Go( &POINT_EDITOR::OnSelectionChange, SELECTION_TOOL::SelectedEvent );
Go( &POINT_EDITOR::OnSelectionChange, SELECTION_TOOL::UnselectedEvent );
}
......
......@@ -53,7 +53,7 @@ public:
*
* Change selection event handler.
*/
int OnSelectionChange( TOOL_EVENT& aEvent );
int OnSelectionChange( const TOOL_EVENT& aEvent );
private:
///> Selection tool used for obtaining selected items
......
......@@ -51,9 +51,6 @@
SELECTION_TOOL::SELECTION_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" ),
SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ),
UnselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.unselected" ),
ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ),
m_frame( NULL ), m_additive( false ), m_multiple( false ),
m_editModules( false ), m_locked( true )
{
......@@ -90,7 +87,7 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
}
int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
......@@ -234,8 +231,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
unselect( aItem );
// Inform other potentially interested tools
TOOL_EVENT unselectEvent( UnselectedEvent );
m_toolMgr->ProcessEvent( unselectEvent );
m_toolMgr->ProcessEvent( UnselectedEvent );
}
else
{
......@@ -248,8 +244,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
select( aItem );
// Inform other potentially interested tools
TOOL_EVENT selectEvent( SelectedEvent );
m_toolMgr->ProcessEvent( selectEvent );
m_toolMgr->ProcessEvent( SelectedEvent );
}
}
}
......@@ -384,8 +379,7 @@ bool SELECTION_TOOL::selectMultiple()
if( !m_selection.Empty() )
{
// Inform other potentially interested tools
TOOL_EVENT selectEvent( SelectedEvent );
m_toolMgr->ProcessEvent( selectEvent );
m_toolMgr->ProcessEvent( SelectedEvent );
}
break; // Stop waiting for events
......@@ -456,7 +450,7 @@ bool SELECTION_TOOL::CheckLock()
}
int SELECTION_TOOL::CursorSelection( TOOL_EVENT& aEvent )
int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
{
selectCursor( getView()->ToWorld( getViewControls()->GetMousePosition() ) );
setTransitions();
......@@ -465,7 +459,7 @@ int SELECTION_TOOL::CursorSelection( TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::ClearSelection( TOOL_EVENT& aEvent )
int SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
{
clearSelection();
setTransitions();
......@@ -473,7 +467,7 @@ int SELECTION_TOOL::ClearSelection( TOOL_EVENT& aEvent )
return 0;
}
int SELECTION_TOOL::SelectItem( TOOL_EVENT& aEvent )
int SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
{
// Check if there is an item to be selected
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aEvent.Parameter() );
......@@ -483,8 +477,7 @@ int SELECTION_TOOL::SelectItem( TOOL_EVENT& aEvent )
select( item );
// Inform other potentially interested tools
TOOL_EVENT select( SelectedEvent );
m_toolMgr->ProcessEvent( select );
m_toolMgr->ProcessEvent( SelectedEvent );
}
setTransitions();
......@@ -492,7 +485,7 @@ int SELECTION_TOOL::SelectItem( TOOL_EVENT& aEvent )
return 0;
}
int SELECTION_TOOL::UnselectItem( TOOL_EVENT& aEvent )
int SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
{
// Check if there is an item to be selected
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aEvent.Parameter() );
......@@ -502,8 +495,7 @@ int SELECTION_TOOL::UnselectItem( TOOL_EVENT& aEvent )
unselect( item );
// Inform other potentially interested tools
TOOL_EVENT unselect( UnselectedEvent );
m_toolMgr->ProcessEvent( unselect );
m_toolMgr->ProcessEvent( UnselectedEvent );
}
setTransitions();
......@@ -521,15 +513,14 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
select( aItem );
// Inform other potentially interested tools
TOOL_EVENT selectEvent( SelectedEvent );
m_toolMgr->ProcessEvent( selectEvent );
m_toolMgr->ProcessEvent( SelectedEvent );
}
m_frame->GetGalCanvas()->ForceRefresh();
}
int SELECTION_TOOL::find( TOOL_EVENT& aEvent )
int SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
{
DIALOG_FIND dlg( m_frame );
dlg.EnableWarp( false );
......@@ -541,7 +532,7 @@ int SELECTION_TOOL::find( TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::findMove( TOOL_EVENT& aEvent )
int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent )
{
MODULE* module = m_frame->GetModuleByName();
......@@ -579,8 +570,7 @@ void SELECTION_TOOL::clearSelection()
m_locked = true;
// Inform other potentially interested tools
TOOL_EVENT clearEvent( ClearedEvent );
m_toolMgr->ProcessEvent( clearEvent );
m_toolMgr->ProcessEvent( ClearedEvent );
}
......@@ -811,8 +801,7 @@ void SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
}
// Inform other potentially interested tools
TOOL_EVENT unselected( UnselectedEvent );
m_toolMgr->ProcessEvent( unselected );
m_toolMgr->ProcessEvent( UnselectedEvent );
}
......@@ -939,3 +928,8 @@ void SELECTION::clear()
items.ClearItemsList();
group->Clear();
}
const TOOL_EVENT SELECTION_TOOL::SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" );
const TOOL_EVENT SELECTION_TOOL::UnselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.unselected" );
const TOOL_EVENT SELECTION_TOOL::ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" );
......@@ -103,7 +103,7 @@ public:
*
* The main loop.
*/
int Main( TOOL_EVENT& aEvent );
int Main( const TOOL_EVENT& aEvent );
/**
* Function GetSelection()
......@@ -152,25 +152,25 @@ public:
bool CheckLock();
///> Select a single item under cursor event handler.
int CursorSelection( TOOL_EVENT& aEvent );
int CursorSelection( const TOOL_EVENT& aEvent );
///> Clear current selection event handler.
int ClearSelection( TOOL_EVENT& aEvent );
int ClearSelection( const TOOL_EVENT& aEvent );
///> Item selection event handler.
int SelectItem( TOOL_EVENT& aEvent );
int SelectItem( const TOOL_EVENT& aEvent );
///> Item unselection event handler.
int UnselectItem( TOOL_EVENT& aEvent );
int UnselectItem( const TOOL_EVENT& aEvent );
///> Event sent after an item is selected.
const TOOL_EVENT SelectedEvent;
static const TOOL_EVENT SelectedEvent;
///> Event sent after an item is unselected.
const TOOL_EVENT UnselectedEvent;
static const TOOL_EVENT UnselectedEvent;
///> Event sent after selection is cleared.
const TOOL_EVENT ClearedEvent;
static const TOOL_EVENT ClearedEvent;
private:
/**
......@@ -197,10 +197,10 @@ private:
void findCallback( BOARD_ITEM* aItem );
///> Find an item.
int find( TOOL_EVENT& aEvent );
int find( const TOOL_EVENT& aEvent );
///> Find an item and start moving.
int findMove( TOOL_EVENT& aEvent );
int findMove( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events.
void setTransitions();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment