KiCad PCB EDA Suite
EE_POINT_EDITOR Class Reference

Class SCH_POINT_EDITOR. More...

#include <ee_point_editor.h>

Inheritance diagram for EE_POINT_EDITOR:
EE_TOOL_BASE< SCH_BASE_FRAME > TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 EE_POINT_EDITOR ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int Main (const TOOL_EVENT &aEvent)
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
TOOL_MENUGetToolMenu ()
 

Get the tool's top-level context menu

More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
OPT_TOOL_EVENT Wait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Protected Member Functions

void updateView (EDA_ITEM *aItem) const
 

Similar to getView()->Update(), but handles items that are redrawn by their parents.

More...
 
void saveCopyInUndoList (EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
 

Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.

More...
 
const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

SCH_BASE_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isLibEdit
 
TOOL_MENU m_menu
 Menu model displayed by the tool. More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

void updateItem () const
 

Updates item's points with edit points.

More...
 
void updatePoints ()
 

Updates edit points with item's points.

More...
 
void updateEditedPoint (const TOOL_EVENT &aEvent)
 

Updates which point is being edited.

More...
 
void setEditedPoint (EDIT_POINT *aPoint)
 

Sets the current point being edited. NULL means none.

More...
 
bool isModified (const EDIT_POINT &aPoint) const
 

Returns true if aPoint is the currently modified point.

More...
 
int getEditedPointIndex () const
 
bool addCornerCondition (const SELECTION &aSelection)
 
bool removeCornerCondition (const SELECTION &aSelection)
 
int addCorner (const TOOL_EVENT &aEvent)
 TOOL_ACTION handlers. More...
 
int removeCorner (const TOOL_EVENT &aEvent)
 
int modifiedSelection (const TOOL_EVENT &aEvent)
 
void saveItemsToUndo ()
 
void rollbackFromUndo ()
 

Private Attributes

EDIT_POINTm_editedPoint
 

Currently edited point, NULL if there is none.

More...
 
std::shared_ptr< EDIT_POINTSm_editPoints
 

Currently available edit points.

More...
 

Detailed Description

Class SCH_POINT_EDITOR.

Tool that displays edit points allowing to modify items by dragging the points.

Definition at line 39 of file ee_point_editor.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

81  {
82  RUN,
83  MODEL_RELOAD,
84  GAL_SWITCH
85  };
Model changes (required full reload)
Definition: tool_base.h:83
Tool is invoked after being inactive.
Definition: tool_base.h:82
Rendering engine changes.
Definition: tool_base.h:84

Constructor & Destructor Documentation

◆ EE_POINT_EDITOR()

EE_POINT_EDITOR::EE_POINT_EDITOR ( )

Definition at line 200 of file ee_point_editor.cpp.

200  :
201  EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.PointEditor" ),
202  m_editedPoint( nullptr )
203 {
204 }
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 49 of file tool_interactive.cpp.

50 {
52 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:211
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplace(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), EDIT_TOOL::doCopyToClipboard(), SCH_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), SCH_MOVE_TOOL::Main(), Main(), LIB_MOVE_TOOL::Main(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), SCH_WIRE_BUS_TOOL::StartBus(), SCH_WIRE_BUS_TOOL::StartWire(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

◆ addCorner()

int EE_POINT_EDITOR::addCorner ( const TOOL_EVENT aEvent)
private

TOOL_ACTION handlers.

Definition at line 684 of file ee_point_editor.cpp.

685 {
686  if( !m_editPoints )
687  return 0;
688 
689  LIB_POLYLINE* polyLine = dynamic_cast<LIB_POLYLINE*>( m_editPoints->GetParent() );
690 
691  if( !polyLine )
692  return false;
693 
694  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
695  polyLine->AddCorner( mapCoords( cursorPos ) );
696 
697  updateView( polyLine );
698  updatePoints();
699 
700  return 0;
701 }
void AddCorner(const wxPoint &aPosition)
void updatePoints()
Updates edit points with item's points.
static VECTOR2D mapCoords(const wxPoint &aCoord)
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:316
void updateView(EDA_ITEM *aItem) const
Similar to getView()->Update(), but handles items that are redrawn by their parents.
Definition: ee_tool_base.h:107
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References LIB_POLYLINE::AddCorner(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_BASE::getViewControls(), m_editPoints, KIGFX::mapCoords(), MD_ALT, TOOL_EVENT::Modifier(), updatePoints(), and EE_TOOL_BASE< SCH_BASE_FRAME >::updateView().

Referenced by setTransitions().

◆ addCornerCondition()

bool EE_POINT_EDITOR::addCornerCondition ( const SELECTION aSelection)
private

Definition at line 667 of file ee_point_editor.cpp.

668 {
669  if( !m_editPoints || !m_editedPoint )
670  return false;
671 
672  LIB_POLYLINE* polyLine = dynamic_cast<LIB_POLYLINE*>( m_editPoints->GetParent() );
673 
674  if( !polyLine )
675  return false;
676 
677  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
678  double threshold = getView()->ToWorld( EDIT_POINT::POINT_SIZE );
679 
680  return polyLine->HitTest( mapCoords( cursorPos ), (int) threshold );
681 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
static VECTOR2D mapCoords(const wxPoint &aCoord)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
static const int POINT_SIZE
Single point size in pixels
Definition: edit_points.h:185
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), LIB_POLYLINE::HitTest(), m_editedPoint, m_editPoints, KIGFX::mapCoords(), EDIT_POINT::POINT_SIZE, and KIGFX::VIEW::ToWorld().

Referenced by Init().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 59 of file tool_base.cpp.

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:217
friend class TOOL_SETTINGS
Definition: tool_base.h:155

References TOOL_BASE::m_toolMgr, TOOL_BASE::m_toolSettings, and TOOL_BASE::TOOL_SETTINGS.

Referenced by TOOL_MANAGER::RegisterTool().

◆ evActivate()

const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

◆ evButtonDown()

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited

◆ evButtonUp()

const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited

◆ evClick()

const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited

◆ evCommand() [1/2]

const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited

◆ evCommand() [2/2]

const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited

◆ evDrag()

const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited

◆ evMotion()

const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited

◆ getEditedPointIndex()

int EE_POINT_EDITOR::getEditedPointIndex ( ) const
inlineprivate

Definition at line 74 of file ee_point_editor.h.

75  {
76  for( unsigned i = 0; i < m_editPoints->PointsSize(); ++i )
77  {
78  if( m_editedPoint == &m_editPoints->Point( i ) )
79  return i;
80  }
81 
82  return wxNOT_FOUND;
83  }
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
size_t i
Definition: json11.cpp:597

References i, m_editedPoint, and m_editPoints.

Referenced by removeCorner(), and updateItem().

◆ getEditFrame()

template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

Returns the application window object, casted to requested user type.

Definition at line 188 of file tool_base.h.

189  {
190  return static_cast<T*>( getEditFrameInt() );
191  }
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), and TOOL_SETTINGS::getConfigBase().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

123  {
124  return m_toolId;
125  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:211

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::saveViewControls().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 144 of file tool_base.h.

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), ACTION_MENU::onMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

200  {
201  EDA_ITEM* m = getModelInt();
202  wxASSERT( dynamic_cast<T*>( m ) );
203 
204  return static_cast<T*>( m );
205  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), ZONE_CREATE_HELPER::createZoneFromExisting(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ GetName()

const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Function GetName() Returns the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:215

References TOOL_BASE::m_toolName.

Referenced by TOOL_SETTINGS::getKeyName(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:217

References TOOL_BASE::m_toolSettings.

Referenced by ROUTER_TOOL::Init(), GERBVIEW_SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

◆ GetToolMenu()

TOOL_MENU& EE_TOOL_BASE< SCH_BASE_FRAME >::GetToolMenu ( )
inlineinherited

Get the tool's top-level context menu

Definition at line 103 of file ee_tool_base.h.

103 { return m_menu; }
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: ee_tool_base.h:147

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

112  {
113  return m_type;
114  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:208

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), and TOOL_MANAGER::runTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 35 of file tool_base.cpp.

36 {
37  return m_toolMgr->GetView();
38 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), EE_SELECTION_TOOL::clearSelection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), COMMON_TOOLS::doGridPreset(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), Main(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), PCBNEW_CONTROL::updateGrid(), updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), CVPCB_SELECTION_TOOL::~CVPCB_SELECTION_TOOL(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by addCorner(), POINT_EDITOR::addCorner(), addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_WIRE_BUS_TOOL::doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), SCH_WIRE_BUS_TOOL::finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), SCH_MOVE_TOOL::Main(), Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), CVPCB_CONTROL::ResetCoords(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), EE_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), setEditedPoint(), POINT_EDITOR::setEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), SCH_MOVE_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 135 of file tool_interactive.h.

137 {
138  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
139 
140  goInternal( sptr, aConditions );
141 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), setTransitions(), LIB_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), LIB_MOVE_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), CVPCB_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), SCH_WIRE_BUS_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), EE_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), SELECTION_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool EE_POINT_EDITOR::Init ( )
overridevirtual

Function Init() Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Definition at line 215 of file ee_point_editor.cpp.

216 {
218 
219  auto& menu = m_selectionTool->GetToolMenu().GetMenu();
221  std::bind( &EE_POINT_EDITOR::addCornerCondition, this, _1 ) );
223  std::bind( &EE_POINT_EDITOR::removeCornerCondition, this, _1 ) );
224 
225  return true;
226 }
TOOL_MENU & GetToolMenu()
static TOOL_ACTION pointEditorAddCorner
Definition: ee_actions.h:144
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:69
bool addCornerCondition(const SELECTION &aSelection)
static TOOL_ACTION pointEditorRemoveCorner
Definition: ee_actions.h:145
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:143
bool removeCornerCondition(const SELECTION &aSelection)
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()

References addCornerCondition(), CONDITIONAL_MENU::AddItem(), TOOL_MENU::GetMenu(), EE_SELECTION_TOOL::GetToolMenu(), EE_TOOL_BASE< T >::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_selectionTool, EE_ACTIONS::pointEditorAddCorner, EE_ACTIONS::pointEditorRemoveCorner, and removeCornerCondition().

◆ isModified()

bool EE_POINT_EDITOR::isModified ( const EDIT_POINT aPoint) const
inlineprivate

Returns true if aPoint is the currently modified point.

Definition at line 69 of file ee_point_editor.h.

70  {
71  return m_editedPoint == &aPoint;
72  }
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.

References m_editedPoint.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

31 {
32  return m_toolMgr->IsToolActive( m_toolId );
33 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:211
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

◆ Main()

int EE_POINT_EDITOR::Main ( const TOOL_EVENT aEvent)

Definition at line 247 of file ee_point_editor.cpp.

248 {
249  static KICAD_T pointTypes[] = { LIB_ARC_T, LIB_CIRCLE_T, LIB_POLYLINE_T, LIB_RECTANGLE_T,
251 
252  if( !m_selectionTool )
253  return 0;
254 
255  const SELECTION& selection = m_selectionTool->GetSelection();
256 
257  if( selection.Size() != 1 || !selection.Front()->IsType( pointTypes ) )
258  return 0;
259 
260  Activate();
261 
263  KIGFX::VIEW* view = getView();
264  int savedToolID = m_frame->GetToolId();
265  wxString savedToolMsg = m_frame->GetToolMsg();
266  EDA_ITEM* item = (EDA_ITEM*) selection.Front();
267 
268  controls->ShowCursor( true );
269 
271 
272  if( !m_editPoints )
273  return 0;
274 
275  view->Add( m_editPoints.get() );
276  setEditedPoint( nullptr );
277  bool inDrag = false;
278  bool modified = false;
279 
280  // Main loop: keep receiving events
281  while( OPT_TOOL_EVENT evt = Wait() )
282  {
283  if( !m_editPoints
284  || evt->Matches( EVENTS::ClearedEvent )
285  || evt->Matches( EVENTS::UnselectedEvent )
286  || evt->Matches( EVENTS::SelectedEvent ) )
287  {
288  break;
289  }
290 
291  if ( !inDrag )
292  updateEditedPoint( *evt );
293 
294  if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
295  {
296  m_frame->SetToolID( ID_DRAG_POINT, -1, _( "Drag Point" ) );
297 
298  if( !inDrag )
299  {
300  saveItemsToUndo();
301  controls->ForceCursorPosition( false );
302  inDrag = true;
303  modified = true;
304  }
305 
306  m_editedPoint->SetPosition( controls->GetCursorPosition( !evt->Modifier( MD_ALT ) ) );
307 
308  updateItem();
309  updatePoints();
310 
311  view->Redraw();
312  }
313 
314  else if( evt->IsMouseUp( BUT_LEFT ) )
315  {
316  controls->SetAutoPan( false );
317  m_frame->SetToolID( savedToolID, -1, savedToolMsg );
318 
319  inDrag = false;
320 
321  m_toolMgr->PassEvent();
322  }
323 
324  else if( evt->IsCancel() )
325  {
326  if( inDrag ) // Restore the last change
327  {
329  modified = false;
330  }
331 
332  m_frame->SetToolID( savedToolID, -1, savedToolMsg );
333  break;
334  }
335 
336  else
337  {
338  m_toolMgr->PassEvent();
339  }
340 
341  controls->SetAutoPan( inDrag );
342  controls->CaptureCursor( inDrag );
343  }
344 
345  controls->SetAutoPan( false );
346  controls->CaptureCursor( false );
347  m_frame->SetToolID( savedToolID, -1, savedToolMsg );
348 
349  if( m_editPoints )
350  {
351  view->Remove( m_editPoints.get() );
352 
353  if( modified )
354  m_frame->OnModify();
355 
356  m_editPoints.reset();
357  m_frame->GetCanvas()->Refresh();
358  }
359 
360  return 0;
361 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
SELECTION & GetSelection()
Function GetSelection()
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
Definition: actions.h:132
static const TOOL_EVENT UnselectedEvent
Event sent after an item is unselected.
Definition: actions.h:133
void updateEditedPoint(const TOOL_EVENT &aEvent)
Updates which point is being edited.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual bool IsType(const KICAD_T aScanTypes[])
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:287
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
void updatePoints()
Updates edit points with item's points.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
void PassEvent()
Allows a tool to pass the already handled event to the next tool on the stack.
Definition: tool_manager.h:356
virtual void Redraw()
Function Redraw() Immediately redraws the whole view.
Definition: view.cpp:1144
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
SCH_DRAW_PANEL * GetCanvas() const override
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:143
static const TOOL_EVENT ClearedEvent
Event sent after selection is cleared.
Definition: actions.h:134
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Set the tool command ID to aId and sets the cursor to aCursor.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
void updateItem() const
Updates item's points with edit points.
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
void setEditedPoint(EDIT_POINT *aPoint)
Sets the current point being edited. NULL means none.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
Class VIEW.
Definition: view.h:61
int GetToolId() const
Definition: draw_frame.h:524
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:155
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486
wxString GetToolMsg()
Definition: draw_frame.h:747
static std::shared_ptr< EDIT_POINTS > Make(EDA_ITEM *aItem, KIGFX::GAL *aGal)
virtual void SetPosition(const VECTOR2I &aPosition)
Function SetPosition()
Definition: edit_points.h:105

References TOOL_INTERACTIVE::Activate(), KIGFX::VIEW::Add(), BUT_LEFT, KIGFX::VIEW_CONTROLS::CaptureCursor(), EVENTS::ClearedEvent, EOT, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EE_SELECTION_TOOL::GetSelection(), EDA_DRAW_FRAME::GetToolId(), EDA_DRAW_FRAME::GetToolMsg(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), ID_DRAG_POINT, EDA_ITEM::IsType(), LIB_ARC_T, LIB_CIRCLE_T, LIB_POLYLINE_T, LIB_RECTANGLE_T, m_editedPoint, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EE_TOOL_BASE< SCH_BASE_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EDIT_POINTS_FACTORY::Make(), MD_ALT, SCH_BASE_FRAME::OnModify(), TOOL_MANAGER::PassEvent(), KIGFX::VIEW::Redraw(), SCH_DRAW_PANEL::Refresh(), KIGFX::VIEW::Remove(), rollbackFromUndo(), saveItemsToUndo(), SCH_LINE_LOCATE_GRAPHIC_LINE_T, SCH_SHEET_T, EVENTS::SelectedEvent, KIGFX::VIEW_CONTROLS::SetAutoPan(), setEditedPoint(), EDIT_POINT::SetPosition(), EDA_DRAW_FRAME::SetToolID(), KIGFX::VIEW_CONTROLS::ShowCursor(), SELECTION::Size(), EVENTS::UnselectedEvent, updateEditedPoint(), updateItem(), updatePoints(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ modifiedSelection()

int EE_POINT_EDITOR::modifiedSelection ( const TOOL_EVENT aEvent)
private

Definition at line 723 of file ee_point_editor.cpp.

724 {
725  updatePoints();
726  return 0;
727 }
void updatePoints()
Updates edit points with item's points.

References updatePoints().

Referenced by setTransitions().

◆ removeCorner()

int EE_POINT_EDITOR::removeCorner ( const TOOL_EVENT aEvent)
private

Definition at line 704 of file ee_point_editor.cpp.

705 {
706  if( !m_editPoints || !m_editedPoint )
707  return 0;
708 
709  LIB_POLYLINE* polyLine = dynamic_cast<LIB_POLYLINE*>( m_editPoints->GetParent() );
710 
711  if( !polyLine || polyLine->GetCornerCount() < 3 )
712  return 0;
713 
714  polyLine->RemoveCorner( getEditedPointIndex() );
715 
716  updateView( polyLine );
717  updatePoints();
718 
719  return 0;
720 }
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
void updatePoints()
Updates edit points with item's points.
unsigned GetCornerCount() const
Definition: lib_polyline.h:79
void updateView(EDA_ITEM *aItem) const
Similar to getView()->Update(), but handles items that are redrawn by their parents.
Definition: ee_tool_base.h:107
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
int getEditedPointIndex() const
void RemoveCorner(int aIdx)

References LIB_POLYLINE::GetCornerCount(), getEditedPointIndex(), m_editedPoint, m_editPoints, LIB_POLYLINE::RemoveCorner(), updatePoints(), and EE_TOOL_BASE< SCH_BASE_FRAME >::updateView().

Referenced by setTransitions().

◆ removeCornerCondition()

bool EE_POINT_EDITOR::removeCornerCondition ( const SELECTION aSelection)
private

Definition at line 645 of file ee_point_editor.cpp.

646 {
647  if( !m_editPoints || !m_editedPoint )
648  return false;
649 
650  LIB_POLYLINE* polyLine = dynamic_cast<LIB_POLYLINE*>( m_editPoints->GetParent() );
651 
652  if( !polyLine || polyLine->GetCornerCount() < 3 )
653  return false;
654 
655  const std::vector<wxPoint>& pts = polyLine->GetPolyPoints();
656 
657  for( unsigned i = 0; i < polyLine->GetCornerCount(); ++i )
658  {
659  if( pts[i] == mapCoords( m_editedPoint->GetPosition() ) )
660  return true;
661  }
662 
663  return false;
664 }
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
unsigned GetCornerCount() const
Definition: lib_polyline.h:79
const std::vector< wxPoint > & GetPolyPoints() const
Definition: lib_polyline.h:66
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:68
static VECTOR2D mapCoords(const wxPoint &aCoord)
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
size_t i
Definition: json11.cpp:597

References LIB_POLYLINE::GetCornerCount(), LIB_POLYLINE::GetPolyPoints(), EDIT_POINT::GetPosition(), i, m_editedPoint, m_editPoints, and KIGFX::mapCoords().

Referenced by Init().

◆ Reset()

void EE_POINT_EDITOR::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() 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.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 207 of file ee_point_editor.cpp.

208 {
209  EE_TOOL_BASE::Reset( aReason );
210 
211  m_editPoints.reset();
212 }
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
Definition: ee_tool_base.h:90
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.

References m_editPoints, and EE_TOOL_BASE< T >::Reset().

◆ rollbackFromUndo()

void EE_POINT_EDITOR::rollbackFromUndo ( )
private

Definition at line 756 of file ee_point_editor.cpp.

757 {
758  if( m_isLibEdit )
759  static_cast<LIB_EDIT_FRAME*>( m_frame )->RollbackPartFromUndo();
760  else
761  static_cast<SCH_EDIT_FRAME*>( m_frame )->RollbackSchematicFromUndo();
762 }

References EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, and EE_TOOL_BASE< SCH_BASE_FRAME >::m_isLibEdit.

Referenced by Main().

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

◆ saveCopyInUndoList()

void EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList ( EDA_ITEM aItem,
UNDO_REDO_T  aType,
bool  aAppend = false 
)
inlineprotectedinherited

Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.

Definition at line 120 of file ee_tool_base.h.

121  {
122  KICAD_T itemType = aItem->Type();
123 
124  if( m_isLibEdit )
125  {
126  LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
127  editFrame->SaveCopyInUndoList( (LIB_ITEM*) aItem, aType, aAppend );
128  }
129  else
130  {
131  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
132 
133  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
134  editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem->GetParent(), UR_CHANGED, aAppend );
135  else
136  editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem, aType, aAppend );
137  }
138  }
Schematic editor (Eeschema) main window.
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EDA_ITEM * GetParent() const
Definition: base_struct.h:214
The symbol library editor main window.
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT, bool aAppend=false)
Create a copy of the current component, and save it in the undo list.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

◆ saveItemsToUndo()

void EE_POINT_EDITOR::saveItemsToUndo ( )
private

Definition at line 730 of file ee_point_editor.cpp.

731 {
732  if( m_isLibEdit )
733  {
734  saveCopyInUndoList( m_editPoints->GetParent()->GetParent(), UR_LIBEDIT );
735  }
736  else
737  {
739 
740  if( m_editPoints->GetParent()->Type() == SCH_LINE_T )
741  {
742  EDA_ITEM* connection = m_editPoints->Point( LINE_START ).GetConnection();
743 
744  if( connection )
745  saveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true );
746 
747  connection = m_editPoints->Point( LINE_END ).GetConnection();
748 
749  if( connection )
750  saveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true );
751  }
752  }
753 }
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO_T aType, bool aAppend=false)
Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their parents.
Definition: ee_tool_base.h:120
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114

References LINE_END, LINE_START, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_isLibEdit, EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_LINE_T, UR_CHANGED, and UR_LIBEDIT.

Referenced by Main().

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

Assigns a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 74 of file tool_interactive.cpp.

75 {
76  if( aMenu )
77  aMenu->SetTool( this );
78  else
79  aTrigger = CMENU_OFF;
80 
81  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
82 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

◆ setEditedPoint()

void EE_POINT_EDITOR::setEditedPoint ( EDIT_POINT aPoint)
private

Sets the current point being edited. NULL means none.

Definition at line 626 of file ee_point_editor.cpp.

627 {
629 
630  if( aPoint )
631  {
632  controls->ForceCursorPosition( true, aPoint->GetPosition() );
633  controls->ShowCursor( true );
634  }
635  else
636  {
637  controls->ShowCursor( false );
638  controls->ForceCursorPosition( false );
639  }
640 
641  m_editedPoint = aPoint;
642 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:68
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41

References KIGFX::VIEW_CONTROLS::ForceCursorPosition(), EDIT_POINT::GetPosition(), TOOL_BASE::getViewControls(), m_editedPoint, and KIGFX::VIEW_CONTROLS::ShowCursor().

Referenced by Main(), and updateEditedPoint().

◆ setTransitions()

void EE_POINT_EDITOR::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 765 of file ee_point_editor.cpp.

766 {
771 }
int Main(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
Definition: actions.h:132
static TOOL_ACTION pointEditorAddCorner
Definition: ee_actions.h:144
int modifiedSelection(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:136
static TOOL_ACTION pointEditorRemoveCorner
Definition: ee_actions.h:145
int removeCorner(const TOOL_EVENT &aEvent)
int addCorner(const TOOL_EVENT &aEvent)
TOOL_ACTION handlers.

References addCorner(), TOOL_INTERACTIVE::Go(), Main(), modifiedSelection(), EE_ACTIONS::pointEditorAddCorner, EE_ACTIONS::pointEditorRemoveCorner, removeCorner(), EVENTS::SelectedEvent, and EVENTS::SelectedItemsModified.

◆ updateEditedPoint()

void EE_POINT_EDITOR::updateEditedPoint ( const TOOL_EVENT aEvent)
private

Updates which point is being edited.

Definition at line 229 of file ee_point_editor.cpp.

230 {
231  EDIT_POINT* point = m_editedPoint;
232 
233  if( aEvent.IsMotion() )
234  {
235  point = m_editPoints->FindPoint( aEvent.Position(), getView() );
236  }
237  else if( aEvent.IsDrag( BUT_LEFT ) )
238  {
239  point = m_editPoints->FindPoint( aEvent.DragOrigin(), getView() );
240  }
241 
242  if( m_editedPoint != point )
243  setEditedPoint( point );
244 }
bool IsMotion() const
Definition: tool_event.h:290
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:280
const VECTOR2D DragOrigin() const
Returns the point where dragging has started.
Definition: tool_event.h:264
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
void setEditedPoint(EDIT_POINT *aPoint)
Sets the current point being edited. NULL means none.
Class EDIT_POINT.
Definition: edit_points.h:46
const VECTOR2D Position() const
Returns mouse cursor position in world coordinates.
Definition: tool_event.h:258

References BUT_LEFT, TOOL_EVENT::DragOrigin(), TOOL_BASE::getView(), TOOL_EVENT::IsDrag(), TOOL_EVENT::IsMotion(), m_editedPoint, m_editPoints, TOOL_EVENT::Position(), and setEditedPoint().

Referenced by Main().

◆ updateItem()

void EE_POINT_EDITOR::updateItem ( ) const
private

Updates item's points with edit points.

Definition at line 416 of file ee_point_editor.cpp.

417 {
418  EDA_ITEM* item = m_editPoints->GetParent();
419 
420  if( !item )
421  return;
422 
423  switch( item->Type() )
424  {
425  case LIB_ARC_T:
426  {
427  LIB_ARC* arc = (LIB_ARC*) item;
428 
429  arc->SetPosition( mapCoords( m_editPoints->Point( ARC_CENTER ).GetPosition() ) );
430  arc->SetStart( mapCoords( m_editPoints->Point( ARC_START ).GetPosition() ) );
431  arc->SetEnd( mapCoords( m_editPoints->Point( ARC_END ).GetPosition() ) );
432  break;
433  }
434 
435  case LIB_CIRCLE_T:
436  {
437  LIB_CIRCLE* circle = (LIB_CIRCLE*) item;
438 
439  circle->SetPosition( mapCoords( m_editPoints->Point( CIRC_CENTER ).GetPosition() ) );
440  circle->SetEnd( mapCoords( m_editPoints->Point( CIRC_END ).GetPosition() ) );
441  break;
442  }
443 
444  case LIB_POLYLINE_T:
445  {
446  LIB_POLYLINE* lines = (LIB_POLYLINE*) item;
447 
448  lines->ClearPoints();
449 
450  for( unsigned i = 0; i < m_editPoints->PointsSize(); ++i )
451  lines->AddPoint( mapCoords( m_editPoints->Point( i ).GetPosition() ) );
452 
453  break;
454  }
455 
456  case LIB_RECTANGLE_T:
457  {
458  LIB_RECTANGLE* rect = (LIB_RECTANGLE*) item;
459  VECTOR2I topLeft = m_editPoints->Point( RECT_TOPLEFT ).GetPosition();
460  VECTOR2I topRight = m_editPoints->Point( RECT_TOPRIGHT ).GetPosition();
461  VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
462  VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
463 
464  pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ),
465  topLeft, topRight, botLeft, botRight );
466 
467  rect->SetPosition( mapCoords( topLeft ) );
468  rect->SetEnd( mapCoords( botRight ) );
469  break;
470  }
471 
472  case SCH_SHEET_T:
473  {
474  SCH_SHEET* sheet = (SCH_SHEET*) item;
475  VECTOR2I topLeft = m_editPoints->Point( RECT_TOPLEFT ).GetPosition();
476  VECTOR2I topRight = m_editPoints->Point( RECT_TOPRIGHT ).GetPosition();
477  VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
478  VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
479 
481  topLeft, topRight, botLeft, botRight );
482 
483  sheet->SetPosition( (wxPoint) topLeft );
484  sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) );
485  break;
486  }
487 
488  case SCH_LINE_T:
489  {
490  SCH_LINE* line = (SCH_LINE*) item;
491 
492  line->SetStartPoint( (wxPoint) m_editPoints->Point( LINE_START ).GetPosition() );
493  line->SetEndPoint( (wxPoint) m_editPoints->Point( LINE_END ).GetPosition() );
494 
495  SCH_LINE* connection = (SCH_LINE*) ( m_editPoints->Point( LINE_START ).GetConnection() );
496 
497  if( connection )
498  {
499  if( ( connection->GetFlags() & STARTPOINT ) != 0 )
500  connection->SetStartPoint( line->GetPosition() );
501  else if( ( connection->GetFlags() & ENDPOINT ) != 0 )
502  connection->SetEndPoint( line->GetPosition() );
503 
504  getView()->Update( connection, KIGFX::GEOMETRY );
505  }
506 
507  connection = (SCH_LINE*) ( m_editPoints->Point( LINE_END ).GetConnection() );
508 
509  if( connection )
510  {
511  if( ( connection->GetFlags() & STARTPOINT ) != 0 )
512  connection->SetStartPoint( line->GetEndPoint() );
513  else if( ( connection->GetFlags() & ENDPOINT ) != 0 )
514  connection->SetEndPoint( line->GetEndPoint() );
515 
516  getView()->Update( connection, KIGFX::GEOMETRY );
517  }
518 
519  break;
520  }
521 
522  default:
523  break;
524  }
525 
526  updateView( item );
527  m_frame->SetMsgPanel( item );
528 }
void SetPosition(const wxPoint &aPosition)
void pinEditedCorner(int editedPointIndex, int minWidth, int minHeight, VECTOR2I &topLeft, VECTOR2I &topRight, VECTOR2I &botLeft, VECTOR2I &botRight)
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:94
void SetEnd(const wxPoint &aPoint)
Definition: lib_arc.h:129
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:91
int GetMinHeight() const
Return the minimum height that the sheet can be resized based on the sheet pin positions.
Definition: sch_sheet.cpp:301
void AddPoint(const wxPoint &aPoint)
static VECTOR2D mapCoords(const wxPoint &aCoord)
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:201
void SetSize(const wxSize &aSize)
Definition: sch_sheet.h:271
void ClearPoints()
Definition: lib_polyline.h:62
int GetMinWidth() const
Return the minimum width of the sheet based on the widths of the sheet pin text.
Definition: sch_sheet.cpp:261
void updateView(EDA_ITEM *aItem) const
Similar to getView()->Update(), but handles items that are redrawn by their parents.
Definition: ee_tool_base.h:107
void SetEnd(const wxPoint &aEnd)
Definition: lib_rectangle.h:96
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
int getEditedPointIndex() const
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_line.h:191
void SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
Definition: sch_sheet.cpp:693
size_t i
Definition: json11.cpp:597
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:120
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
void SetStart(const wxPoint &aPoint)
Definition: lib_arc.h:126
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:261
void SetEnd(const wxPoint &aPosition)
Definition: lib_circle.h:81
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
Color has changed.
Definition: view_item.h:57
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:119
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References LIB_POLYLINE::AddPoint(), ARC_CENTER, ARC_END, ARC_START, CIRC_CENTER, CIRC_END, LIB_POLYLINE::ClearPoints(), ENDPOINT, KIGFX::GEOMETRY, getEditedPointIndex(), SCH_LINE::GetEndPoint(), EDA_ITEM::GetFlags(), SCH_SHEET::GetMinHeight(), SCH_SHEET::GetMinWidth(), SCH_LINE::GetPosition(), TOOL_BASE::getView(), i, LIB_ARC_T, LIB_CIRCLE_T, LIB_POLYLINE_T, LIB_RECTANGLE_T, LINE_END, LINE_START, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, KIGFX::mapCoords(), pinEditedCorner(), RECT_BOTLEFT, RECT_BOTRIGHT, RECT_TOPLEFT, RECT_TOPRIGHT, SCH_LINE_T, SCH_SHEET_T, LIB_CIRCLE::SetEnd(), LIB_RECTANGLE::SetEnd(), LIB_ARC::SetEnd(), SCH_LINE::SetEndPoint(), EDA_DRAW_FRAME::SetMsgPanel(), LIB_ITEM::SetPosition(), SCH_SHEET::SetPosition(), SCH_SHEET::SetSize(), LIB_ARC::SetStart(), SCH_LINE::SetStartPoint(), STARTPOINT, EDA_ITEM::Type(), KIGFX::VIEW::Update(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Main().

◆ updatePoints()

void EE_POINT_EDITOR::updatePoints ( )
private

Updates edit points with item's points.

Definition at line 531 of file ee_point_editor.cpp.

532 {
533  if( !m_editPoints )
534  return;
535 
536  EDA_ITEM* item = m_editPoints->GetParent();
537 
538  if( !item )
539  return;
540 
541  switch( item->Type() )
542  {
543  case LIB_ARC_T:
544  {
545  LIB_ARC* arc = (LIB_ARC*) item;
546 
547  m_editPoints->Point( ARC_CENTER ).SetPosition( mapCoords( arc->GetPosition() ) );
548  m_editPoints->Point( ARC_START ).SetPosition( mapCoords( arc->GetStart() ) );
549  m_editPoints->Point( ARC_END ).SetPosition( mapCoords( arc->GetEnd() ) );
550  break;
551  }
552 
553  case LIB_CIRCLE_T:
554  {
555  LIB_CIRCLE* circle = (LIB_CIRCLE*) item;
556 
557  m_editPoints->Point( CIRC_CENTER ).SetPosition( mapCoords( circle->GetPosition() ) );
558  m_editPoints->Point( CIRC_END ).SetPosition( mapCoords( circle->GetEnd() ) );
559  break;
560  }
561 
562  case LIB_POLYLINE_T:
563  {
564  LIB_POLYLINE* lines = (LIB_POLYLINE*) item;
565  const std::vector<wxPoint>& pts = lines->GetPolyPoints();
566 
567  if( m_editPoints->PointsSize() != (unsigned) pts.size() )
568  {
569  getView()->Remove( m_editPoints.get() );
570  m_editedPoint = nullptr;
572  getView()->Add(m_editPoints.get() );
573  }
574  else
575  {
576  for( unsigned i = 0; i < pts.size(); i++ )
577  m_editPoints->Point( i ).SetPosition( mapCoords( pts[i] ) );
578  }
579 
580  break;
581  }
582 
583  case LIB_RECTANGLE_T:
584  {
585  LIB_RECTANGLE* rect = (LIB_RECTANGLE*) item;
586  wxPoint topLeft = rect->GetPosition();
587  wxPoint botRight = rect->GetEnd();
588 
589  m_editPoints->Point( RECT_TOPLEFT ).SetPosition( mapCoords( topLeft ) );
590  m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( mapCoords( botRight.x, topLeft.y ) );
591  m_editPoints->Point( RECT_BOTLEFT ).SetPosition( mapCoords( topLeft.x, botRight.y ) );
592  m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( mapCoords( botRight ) );
593  break;
594  }
595 
596  case SCH_SHEET_T:
597  {
598  SCH_SHEET* sheet = (SCH_SHEET*) item;
599  wxPoint topLeft = sheet->GetPosition();
600  wxPoint botRight = sheet->GetPosition() + sheet->GetSize();
601 
602  m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft );
603  m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y );
604  m_editPoints->Point( RECT_BOTLEFT ).SetPosition( topLeft.x, botRight.y );
605  m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
606  break;
607  }
608 
609  case SCH_LINE_T:
610  {
611  SCH_LINE* line = (SCH_LINE*) item;
612 
613  m_editPoints->Point( LINE_START ).SetPosition( line->GetStartPoint() );
614  m_editPoints->Point( LINE_END ).SetPosition( line->GetEndPoint() );
615  break;
616  }
617 
618  default:
619  break;
620  }
621 
622  getView()->Update( m_editPoints.get() );
623 }
wxPoint GetStartPoint() const
Definition: sch_line.h:90
wxPoint GetEnd() const
Definition: lib_rectangle.h:97
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_circle.h:79
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
const std::vector< wxPoint > & GetPolyPoints() const
Definition: lib_polyline.h:66
wxPoint GetEnd() const
Definition: lib_circle.h:82
wxPoint GetStart() const
Definition: lib_arc.h:125
static VECTOR2D mapCoords(const wxPoint &aCoord)
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_sheet.h:530
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:201
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
size_t i
Definition: json11.cpp:597
wxPoint GetEnd() const
Definition: lib_arc.h:128
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
wxSize GetSize()
Definition: sch_sheet.h:270
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_rectangle.h:84
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_arc.h:103
static std::shared_ptr< EDIT_POINTS > Make(EDA_ITEM *aItem, KIGFX::GAL *aGal)
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References KIGFX::VIEW::Add(), ARC_CENTER, ARC_END, ARC_START, CIRC_CENTER, CIRC_END, LIB_CIRCLE::GetEnd(), LIB_RECTANGLE::GetEnd(), LIB_ARC::GetEnd(), SCH_LINE::GetEndPoint(), LIB_POLYLINE::GetPolyPoints(), LIB_CIRCLE::GetPosition(), LIB_RECTANGLE::GetPosition(), LIB_ARC::GetPosition(), SCH_SHEET::GetPosition(), SCH_SHEET::GetSize(), LIB_ARC::GetStart(), SCH_LINE::GetStartPoint(), TOOL_BASE::getView(), i, LIB_ARC_T, LIB_CIRCLE_T, LIB_POLYLINE_T, LIB_RECTANGLE_T, LINE_END, LINE_START, m_editedPoint, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EDIT_POINTS_FACTORY::Make(), KIGFX::mapCoords(), RECT_BOTLEFT, RECT_BOTRIGHT, RECT_TOPLEFT, RECT_TOPRIGHT, KIGFX::VIEW::Remove(), SCH_LINE_T, SCH_SHEET_T, EDA_ITEM::Type(), and KIGFX::VIEW::Update().

Referenced by addCorner(), Main(), modifiedSelection(), and removeCorner().

◆ updateView()

void EE_TOOL_BASE< SCH_BASE_FRAME >::updateView ( EDA_ITEM aItem) const
inlineprotectedinherited

Similar to getView()->Update(), but handles items that are redrawn by their parents.

Definition at line 107 of file ee_tool_base.h.

108  {
109  KICAD_T itemType = aItem->Type();
110 
111  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
112  getView()->Update( aItem->GetParent() );
113 
114  getView()->Update( aItem );
115  }
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
EDA_ITEM * GetParent() const
Definition: base_struct.h:214
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

◆ Wait()

OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 55 of file tool_interactive.cpp.

56 {
57  return m_toolMgr->ScheduleWait( this, aEventList );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
OPT< TOOL_EVENT > ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses execution of a given tool until one or more events matching aConditions arrives.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_DRAWING_TOOLS::doPlaceComponent(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_editedPoint

EDIT_POINT* EE_POINT_EDITOR::m_editedPoint
private

Currently edited point, NULL if there is none.

Definition at line 98 of file ee_point_editor.h.

Referenced by addCornerCondition(), getEditedPointIndex(), isModified(), Main(), removeCorner(), removeCornerCondition(), setEditedPoint(), updateEditedPoint(), and updatePoints().

◆ m_editPoints

std::shared_ptr<EDIT_POINTS> EE_POINT_EDITOR::m_editPoints
private

◆ m_frame

SCH_BASE_FRAME * EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame
protectedinherited

Definition at line 141 of file ee_tool_base.h.

◆ m_isLibEdit

bool EE_TOOL_BASE< SCH_BASE_FRAME >::m_isLibEdit
protectedinherited

Definition at line 144 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU EE_TOOL_BASE< SCH_BASE_FRAME >::m_menu
protectedinherited

Menu model displayed by the tool.

Definition at line 147 of file ee_tool_base.h.

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_BASE_FRAME >::m_selectionTool
protectedinherited

Definition at line 143 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 211 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 216 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), EE_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_DRAWING_TOOLS::AddJunction(), SCH_DRAWING_TOOLS::AddLabel(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ClearHighlight(), PCB_EDITOR_CONTROL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_WIRE_BUS_TOOL::doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), SCH_WIRE_BUS_TOOL::DrawBusses(), DRAWING_TOOL::DrawDimension(), SCH_WIRE_BUS_TOOL::DrawLines(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_WIRE_BUS_TOOL::DrawWires(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_EDITOR_CONTROL::EnterSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), SCH_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), EE_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), SELECTION_TOOL::RequestSelection(), CVPCB_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), EE_SELECTION_TOOL::SelectConnection(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), EE_SELECTION_TOOL::SelectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), SCH_WIRE_BUS_TOOL::StartBus(), SCH_WIRE_BUS_TOOL::StartLine(), SCH_WIRE_BUS_TOOL::StartWire(), GERBVIEW_SELECTION_TOOL::toggleSelection(), EE_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), SCH_EDITOR_CONTROL::Undo(), SCH_WIRE_BUS_TOOL::UnfoldBus(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 215 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 217 of file tool_base.h.

Referenced by TOOL_BASE::attachManager(), and TOOL_BASE::GetSettings().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 208 of file tool_base.h.

Referenced by TOOL_BASE::GetType().

◆ m_view

KIGFX::SCH_VIEW* EE_TOOL_BASE< SCH_BASE_FRAME >::m_view
protectedinherited

Definition at line 142 of file ee_tool_base.h.


The documentation for this class was generated from the following files: