Reformatting.
This commit is contained in:
parent
e697a2c41c
commit
e87eea7abc
|
@ -207,7 +207,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent &aEvent )
|
||||||
|
|
||||||
if( type == wxEVT_MOTION )
|
if( type == wxEVT_MOTION )
|
||||||
{
|
{
|
||||||
wxMouseEvent *me = static_cast<wxMouseEvent*>(&aEvent );
|
wxMouseEvent *me = static_cast<wxMouseEvent*>( &aEvent );
|
||||||
pos = getView()->ToWorld( VECTOR2D( me->GetX(), me->GetY() ) );
|
pos = getView()->ToWorld( VECTOR2D( me->GetX(), me->GetY() ) );
|
||||||
if( pos != m_lastMousePos )
|
if( pos != m_lastMousePos )
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,10 +100,10 @@ void TOOL_MANAGER::ScheduleNextState( TOOL_BASE *aTool, TOOL_STATE_FUNC& aHandle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE *aTool,
|
optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
|
||||||
const TOOL_EVENT_LIST& aConditions )
|
const TOOL_EVENT_LIST& aConditions )
|
||||||
{
|
{
|
||||||
ToolState *st = m_toolState[aTool];
|
ToolState* st = m_toolState[aTool];
|
||||||
|
|
||||||
st->pendingWait = true;
|
st->pendingWait = true;
|
||||||
st->waitEvents = aConditions;
|
st->waitEvents = aConditions;
|
||||||
|
|
|
@ -58,7 +58,6 @@ typedef DELEGATE<int, TOOL_EVENT&> TOOL_STATE_FUNC;
|
||||||
class TOOL_BASE
|
class TOOL_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TOOL_BASE( TOOL_Type aType, TOOL_ID aId, const std::string& aName = std::string( "" ) ) :
|
TOOL_BASE( TOOL_Type aType, TOOL_ID aId, const std::string& aName = std::string( "" ) ) :
|
||||||
m_type( aType ),
|
m_type( aType ),
|
||||||
m_toolId( aId ),
|
m_toolId( aId ),
|
||||||
|
@ -95,7 +94,7 @@ protected:
|
||||||
* Sets the TOOL_MANAGER the tool will belong to.
|
* Sets the TOOL_MANAGER the tool will belong to.
|
||||||
* Called by TOOL_MANAGER::RegisterTool()
|
* Called by TOOL_MANAGER::RegisterTool()
|
||||||
*/
|
*/
|
||||||
void attachManager( TOOL_MANAGER *aManager );
|
void attachManager( TOOL_MANAGER* aManager );
|
||||||
|
|
||||||
KiGfx::VIEW* getView();
|
KiGfx::VIEW* getView();
|
||||||
KiGfx::VIEW_CONTROLS* getViewControls();
|
KiGfx::VIEW_CONTROLS* getViewControls();
|
||||||
|
@ -107,7 +106,7 @@ protected:
|
||||||
* run-time type check
|
* run-time type check
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T *getEditFrame()
|
T* getEditFrame()
|
||||||
{
|
{
|
||||||
return static_cast<T*>( getEditFrameInt() );
|
return static_cast<T*>( getEditFrameInt() );
|
||||||
}
|
}
|
||||||
|
@ -120,12 +119,11 @@ protected:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T* getModel( KICAD_T modelType )
|
T* getModel( KICAD_T modelType )
|
||||||
{
|
{
|
||||||
EDA_ITEM *m = getModelInt();
|
EDA_ITEM* m = getModelInt();
|
||||||
// assert(modelType == m->Type());
|
// assert(modelType == m->Type());
|
||||||
return static_cast<T*>( m );
|
return static_cast<T*>( m );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
TOOL_Type m_type;
|
TOOL_Type m_type;
|
||||||
TOOL_ID m_toolId;
|
TOOL_ID m_toolId;
|
||||||
std::string m_toolName;
|
std::string m_toolName;
|
||||||
|
|
|
@ -98,7 +98,7 @@ enum TOOL_MouseButtons
|
||||||
enum TOOL_ContextMenuTrigger
|
enum TOOL_ContextMenuTrigger
|
||||||
{
|
{
|
||||||
CMENU_BUTTON = 0, // On the right button
|
CMENU_BUTTON = 0, // On the right button
|
||||||
CMENU_NOW, // Right now (after TOOL_INTERACTIVE::SetContxtMenu)
|
CMENU_NOW, // Right now (after TOOL_INTERACTIVE::SetContextMenu)
|
||||||
CMENU_OFF // Never
|
CMENU_OFF // Never
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -217,10 +217,10 @@ public:
|
||||||
|
|
||||||
bool Matches( const TOOL_EVENT& aEvent ) const
|
bool Matches( const TOOL_EVENT& aEvent ) const
|
||||||
{
|
{
|
||||||
if( ! ( m_category & aEvent.m_category ) )
|
if( !( m_category & aEvent.m_category ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( ! ( m_actions & aEvent.m_actions ) )
|
if( !( m_actions & aEvent.m_actions ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( m_category == TC_Command )
|
if( m_category == TC_Command )
|
||||||
|
|
|
@ -49,14 +49,14 @@ public:
|
||||||
* Brings the tool to a known, initial state. If the tool claimed anything from the model or the view,
|
* Brings the tool to a known, initial state. If the tool claimed anything from the model or the view,
|
||||||
* it must release it when its reset.
|
* it must release it when its reset.
|
||||||
*/
|
*/
|
||||||
virtual void Reset ( ) = 0;
|
virtual void Reset() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetContextMenu()
|
* Function SetContextMenu()
|
||||||
*
|
*
|
||||||
* Assigns a context menu and tells when it should be activated
|
* Assigns a context menu and tells when it should be activated
|
||||||
*/
|
*/
|
||||||
void SetContextMenu( CONTEXT_MENU *aMenu, TOOL_ContextMenuTrigger aTrigger = CMENU_BUTTON );
|
void SetContextMenu( CONTEXT_MENU* aMenu, TOOL_ContextMenuTrigger aTrigger = CMENU_BUTTON );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Go()
|
* Function Go()
|
||||||
|
@ -65,7 +65,8 @@ public:
|
||||||
* No conditions means any event.
|
* No conditions means any event.
|
||||||
*/
|
*/
|
||||||
template<class T>
|
template<class T>
|
||||||
void Go ( int (T::*aStateFunc)( TOOL_EVENT& ), const TOOL_EVENT_LIST & aConditions = TOOL_EVENT( TC_Any, TA_Any ) );
|
void Go( int (T::*aStateFunc)( TOOL_EVENT& ),
|
||||||
|
const TOOL_EVENT_LIST& aConditions = TOOL_EVENT( TC_Any, TA_Any ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Wait()
|
* Function Wait()
|
||||||
|
@ -73,25 +74,27 @@ public:
|
||||||
* Suspends execution of the tool until an event specified in aEventList arrives.
|
* Suspends execution of the tool until an event specified in aEventList arrives.
|
||||||
* No parameters means waiting for any event.
|
* No parameters means waiting for any event.
|
||||||
*/
|
*/
|
||||||
OPT_TOOL_EVENT Wait ( const TOOL_EVENT_LIST & aEventList = TOOL_EVENT ( TC_Any, TA_Any ) );
|
OPT_TOOL_EVENT Wait( const TOOL_EVENT_LIST& aEventList = TOOL_EVENT ( TC_Any, TA_Any ) );
|
||||||
|
|
||||||
|
|
||||||
/** functions below are not yet implemented - their interface may change */
|
/** functions below are not yet implemented - their interface may change */
|
||||||
template<class Parameters, class ReturnValue>
|
template<class Parameters, class ReturnValue>
|
||||||
bool InvokeTool ( const std::string& aToolName, const Parameters& parameters, ReturnValue& returnValue );
|
bool InvokeTool( const std::string& aToolName, const Parameters& parameters,
|
||||||
|
ReturnValue& returnValue );
|
||||||
|
|
||||||
template<class Parameters, class ReturnValue>
|
template<class Parameters, class ReturnValue>
|
||||||
bool InvokeWindow ( const std::string& aWindowName, const Parameters& parameters, ReturnValue& returnValue );
|
bool InvokeWindow( const std::string& aWindowName, const Parameters& parameters,
|
||||||
|
ReturnValue& returnValue );
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void Yield ( const T& returnValue );
|
void Yield( const T& returnValue );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* helper functions for constructing events for Wait() and Go() with
|
/* helper functions for constructing events for Wait() and Go() with
|
||||||
less typing */
|
less typing */
|
||||||
const TOOL_EVENT evActivate( std::string aToolName = "" );
|
const TOOL_EVENT evActivate( std::string aToolName = "" );
|
||||||
const TOOL_EVENT evCommand( int aCommandId = -1 );
|
const TOOL_EVENT evCommand( int aCommandId = -1 );
|
||||||
const TOOL_EVENT evCommand( std::string aCommandStr = "");
|
const TOOL_EVENT evCommand( std::string aCommandStr = "" );
|
||||||
const TOOL_EVENT evMotion();
|
const TOOL_EVENT evMotion();
|
||||||
const TOOL_EVENT evClick( int aButton = MB_Any );
|
const TOOL_EVENT evClick( int aButton = MB_Any );
|
||||||
const TOOL_EVENT evDrag( int aButton = MB_Any );
|
const TOOL_EVENT evDrag( int aButton = MB_Any );
|
||||||
|
@ -104,9 +107,10 @@ private:
|
||||||
|
|
||||||
// hide TOOL_MANAGER implementation
|
// hide TOOL_MANAGER implementation
|
||||||
template<class T>
|
template<class T>
|
||||||
void TOOL_INTERACTIVE::Go( int (T::*aStateFunc)( TOOL_EVENT& ), const TOOL_EVENT_LIST& aConditions )
|
void TOOL_INTERACTIVE::Go( int (T::*aStateFunc)( TOOL_EVENT& ),
|
||||||
|
const TOOL_EVENT_LIST& aConditions )
|
||||||
{
|
{
|
||||||
TOOL_STATE_FUNC sptr (static_cast<T*>( this ), aStateFunc);
|
TOOL_STATE_FUNC sptr( static_cast<T*>( this ), aStateFunc );
|
||||||
goInternal( sptr, aConditions );
|
goInternal( sptr, aConditions );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,17 +73,17 @@ public:
|
||||||
* An user-defined parameter object can be also passed
|
* An user-defined parameter object can be also passed
|
||||||
*/
|
*/
|
||||||
void InvokeTool( TOOL_ID aToolId );
|
void InvokeTool( TOOL_ID aToolId );
|
||||||
void InvokeTool( const std::string& name );
|
void InvokeTool( const std::string& aName );
|
||||||
|
|
||||||
template <class Parameters>
|
template <class Parameters>
|
||||||
void InvokeTool( const std::string& name, const Parameters& aToolParams );
|
void InvokeTool( const std::string& aName, const Parameters& aToolParams );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function FindTool()
|
* Function FindTool()
|
||||||
* Searches for a tool with given name or ID
|
* Searches for a tool with given name or ID
|
||||||
*/
|
*/
|
||||||
TOOL_BASE* FindTool( int aId );
|
TOOL_BASE* FindTool( int aId ) const;
|
||||||
TOOL_BASE* FindTool( const std::string& aName );
|
TOOL_BASE* FindTool( const std::string& aName ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the state of a given tool by clearing its wait and
|
* Resets the state of a given tool by clearing its wait and
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ViewIsVisible()
|
* Function ViewIsVisible()
|
||||||
* Returns if the item is visible (or not).
|
* Returns information if the item is visible (or not).
|
||||||
*
|
*
|
||||||
* @return when true, the item is visible (i.e. to be displayed, not visible in the
|
* @return when true, the item is visible (i.e. to be displayed, not visible in the
|
||||||
* *current* viewport)
|
* *current* viewport)
|
||||||
|
@ -160,7 +160,7 @@ public:
|
||||||
* Function ViewRelease()
|
* Function ViewRelease()
|
||||||
* Releases the item from an associated dynamic VIEW. For static views calling has no effect.
|
* Releases the item from an associated dynamic VIEW. For static views calling has no effect.
|
||||||
*/
|
*/
|
||||||
void ViewRelease();
|
virtual void ViewRelease();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class VIEW;
|
friend class VIEW;
|
||||||
|
@ -171,7 +171,7 @@ protected:
|
||||||
*
|
*
|
||||||
* @param aView[]: dynamic VIEW instance the item is being added to.
|
* @param aView[]: dynamic VIEW instance the item is being added to.
|
||||||
*/
|
*/
|
||||||
void viewAssign( VIEW* aView )
|
virtual void viewAssign( VIEW* aView )
|
||||||
{
|
{
|
||||||
// release the item from a previously assigned dynamic view (if there is any)
|
// release the item from a previously assigned dynamic view (if there is any)
|
||||||
ViewRelease();
|
ViewRelease();
|
||||||
|
@ -182,7 +182,6 @@ protected:
|
||||||
VIEW* m_view; ///* Current dynamic view the item is assigned to.
|
VIEW* m_view; ///* Current dynamic view the item is assigned to.
|
||||||
bool m_visible; ///* Are we visible in the current dynamic VIEW.
|
bool m_visible; ///* Are we visible in the current dynamic VIEW.
|
||||||
|
|
||||||
private:
|
|
||||||
///* Helper for storing cached items group ids
|
///* Helper for storing cached items group ids
|
||||||
typedef std::pair<int, int> GroupPair;
|
typedef std::pair<int, int> GroupPair;
|
||||||
|
|
||||||
|
@ -198,7 +197,7 @@ private:
|
||||||
* @param aLayer is the layer number for which group id is queried.
|
* @param aLayer is the layer number for which group id is queried.
|
||||||
* @return group id or -1 in case there is no group id (ie. item is not cached).
|
* @return group id or -1 in case there is no group id (ie. item is not cached).
|
||||||
*/
|
*/
|
||||||
int getGroup( int aLayer ) const;
|
virtual int getGroup( int aLayer ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function getAllGroups()
|
* Function getAllGroups()
|
||||||
|
@ -206,7 +205,7 @@ private:
|
||||||
*
|
*
|
||||||
* @return vector of group ids.
|
* @return vector of group ids.
|
||||||
*/
|
*/
|
||||||
std::vector<int> getAllGroups() const;
|
virtual std::vector<int> getAllGroups() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function setGroup()
|
* Function setGroup()
|
||||||
|
@ -215,13 +214,13 @@ private:
|
||||||
* @param aLayer is the layer numbe.
|
* @param aLayer is the layer numbe.
|
||||||
* @param aGroup is the group id.
|
* @param aGroup is the group id.
|
||||||
*/
|
*/
|
||||||
void setGroup( int aLayer, int aGroup );
|
virtual void setGroup( int aLayer, int aGroup );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function deleteGroups()
|
* Function deleteGroups()
|
||||||
* Removes all of the stored group ids. Forces recaching of the item.
|
* Removes all of the stored group ids. Forces recaching of the item.
|
||||||
*/
|
*/
|
||||||
void deleteGroups();
|
virtual void deleteGroups();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function storesGroups()
|
* Function storesGroups()
|
||||||
|
@ -229,7 +228,7 @@ private:
|
||||||
*
|
*
|
||||||
* @returns true in case it is cached at least for one layer.
|
* @returns true in case it is cached at least for one layer.
|
||||||
*/
|
*/
|
||||||
bool storesGroups() const;
|
virtual bool storesGroups() const;
|
||||||
};
|
};
|
||||||
} // namespace KiGfx
|
} // namespace KiGfx
|
||||||
|
|
||||||
|
|
|
@ -366,8 +366,7 @@ enum pcbnew_ids
|
||||||
ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
|
ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
|
||||||
ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD,
|
ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD,
|
||||||
|
|
||||||
ID_SELECTION_TOOL
|
ID_SELECTION_TOOL
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PCBNEW_ID_H_
|
#endif // PCBNEW_ID_H_
|
||||||
|
|
Loading…
Reference in New Issue