KiCad PCB EDA Suite
EE_POINT_EDITOR Class Reference

Tool that displays edit points allowing to modify items by dragging the points. 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 }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 EE_POINT_EDITOR ()
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int Main (const TOOL_EVENT &aEvent)
 
bool HasPoint ()
 Indicate the cursor is over an edit point. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void updateItem (EDA_ITEM *aItem, bool aUpdateRTree) const
 Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the SCH_SCREEN's RTree. More...
 
void saveCopyInUndoList (EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

SCH_BASE_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isSymbolEditor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void updateParentItem () const
 < Update item's points with edit points. More...
 
void updatePoints ()
 Update which point is being edited. More...
 
void updateEditedPoint (const TOOL_EVENT &aEvent)
 Clear references to the points. More...
 
int clearEditedPoints (const TOOL_EVENT &aEvent)
 Set the current point being edited. NULL means none. More...
 
void setEditedPoint (EDIT_POINT *aPoint)
 Return true if aPoint is the currently modified point. More...
 
bool isModified (const EDIT_POINT &aPoint) const
 
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
 

Detailed Description

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

Definition at line 38 of file ee_point_editor.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine 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 77 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ EE_POINT_EDITOR()

EE_POINT_EDITOR::EE_POINT_EDITOR ( )

Definition at line 210 of file ee_point_editor.cpp.

210  :
211  EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.PointEditor" ),
212  m_editedPoint( nullptr )
213 {
214 }
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool InvokeTool(TOOL_ID aToolId)
Call 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(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ addCorner()

int EE_POINT_EDITOR::addCorner ( const TOOL_EVENT aEvent)
private

TOOL_ACTION handlers.

Definition at line 852 of file ee_point_editor.cpp.

853 {
854  if( !m_editPoints || m_editPoints->GetParent()->Type() != LIB_SHAPE_T )
855  return 0;
856 
857  LIB_SHAPE* shape = static_cast<LIB_SHAPE*>( m_editPoints->GetParent() );
858  SHAPE_LINE_CHAIN& poly = shape->GetPolyShape().Outline( 0 );
859 
861  wxPoint pos = mapCoords( cursor );
862  int currentMinDistance = INT_MAX;
863  int closestLineStart = 0;
864 
865  for( unsigned i = 0; i < poly.GetPointCount() - 1; ++i )
866  {
867  int distance = (int) DistanceLinePoint( (wxPoint) poly.CPoint( i ),
868  (wxPoint) poly.CPoint( i + 1 ), pos );
869 
870  if( distance < currentMinDistance )
871  {
872  currentMinDistance = distance;
873  closestLineStart = i;
874  }
875  }
876 
877  saveItemsToUndo();
878  poly.Insert( closestLineStart + 1, pos );
879 
880  updateItem( shape, true );
881  updatePoints();
882 
883  m_frame->OnModify();
884 
885  return 0;
886 }
void updatePoints()
Update which point is being edited.
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
SHAPE_LINE_CHAIN & Outline(int aIndex)
bool DisableGridSnapping() const
Definition: tool_event.h:341
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
static VECTOR2D mapCoords(const wxPoint &aCoord)
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:227
void updateItem(EDA_ITEM *aItem, bool aUpdateRTree) const
Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the ...
Definition: ee_tool_base.h:103
std::shared_ptr< EDIT_POINTS > m_editPoints
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
double DistanceLinePoint(const wxPoint &linePointA, const wxPoint &linePointB, const wxPoint &referencePoint)
Compute the distance between a line and a reference point Reference: http://mathworld....
Definition: trigo.h:163
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References cursor, TOOL_EVENT::DisableGridSnapping(), distance(), DistanceLinePoint(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_SHAPE::GetPolyShape(), TOOL_BASE::getViewControls(), LIB_SHAPE_T, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, KIGFX::mapCoords(), SCH_BASE_FRAME::OnModify(), SHAPE_POLY_SET::Outline(), saveItemsToUndo(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), and updatePoints().

Referenced by setTransitions().

◆ addCornerCondition()

bool EE_POINT_EDITOR::addCornerCondition ( const SELECTION aSelection)
private

Definition at line 835 of file ee_point_editor.cpp.

836 {
837  if( !m_editPoints || m_editPoints->GetParent()->Type() != LIB_SHAPE_T )
838  return false;
839 
840  LIB_SHAPE* shape = static_cast<LIB_SHAPE*>( m_editPoints->GetParent() );
841 
842  if( shape->GetShape() != SHAPE_T::POLY )
843  return false;
844 
845  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
846  double threshold = getView()->ToWorld( EDIT_POINT::POINT_SIZE );
847 
848  return shape->HitTest( (wxPoint) cursorPos, (int) threshold );
849 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:449
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: lib_shape.cpp:45
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
std::shared_ptr< EDIT_POINTS > m_editPoints
static const int POINT_SIZE
Border size when not hovering.
Definition: edit_points.h:186
SHAPE_T GetShape() const
Definition: eda_shape.h:101
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_SHAPE::GetShape(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), LIB_SHAPE::HitTest(), LIB_SHAPE_T, m_editPoints, EDIT_POINT::POINT_SIZE, POLY, and KIGFX::VIEW::ToWorld().

Referenced by Init().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ clearEditedPoints()

int EE_POINT_EDITOR::clearEditedPoints ( const TOOL_EVENT aEvent)
private

Set the current point being edited. NULL means none.

Definition at line 240 of file ee_point_editor.cpp.

241 {
242  setEditedPoint( nullptr );
243 
244  return 0;
245 }
void setEditedPoint(EDIT_POINT *aPoint)
Return true if aPoint is the currently modified point.

References setEditedPoint().

Referenced by setTransitions().

◆ getEditedPointIndex()

int EE_POINT_EDITOR::getEditedPointIndex ( ) const
inlineprivate

Definition at line 82 of file ee_point_editor.h.

83  {
84  for( unsigned i = 0; i < m_editPoints->PointsSize(); ++i )
85  {
86  if( m_editedPoint == &m_editPoints->Point( i ) )
87  return i;
88  }
89 
90  return wxNOT_FOUND;
91  }
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.
std::shared_ptr< EDIT_POINTS > m_editPoints

References m_editedPoint, and m_editPoints.

Referenced by Main(), removeCorner(), and updateParentItem().

◆ getEditFrame()

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

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

Definition at line 184 of file tool_base.h.

185  {
186 #if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
187  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
188 #endif
189  return static_cast<T*>( getToolHolderInt() );
190  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

121  {
122  return m_toolId;
123  }
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209

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(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return 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
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), TOOL_MANAGER::RegisterTool(), and TOOL_MANAGER::runTool().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

109  {
110  return m_type;
111  }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:206

References TOOL_BASE::m_type.

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

◆ getView()

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

Returns the instance of #VIEW object used in the application.

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

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

Referenced by addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), PCB_PICKER_TOOL::Main(), Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

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

Return 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 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

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

Referenced by addCorner(), PCB_POINT_EDITOR::addCorner(), addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PCB_PICKER_TOOL::Main(), Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), PL_POINT_EDITOR::setEditedPoint(), setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_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

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149 {
150  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151 
152  goInternal( sptr, aConditions );
153 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), setTransitions(), PL_POINT_EDITOR::setTransitions(), ROUTER_TOOL::setTransitions(), SCRIPTING_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PAD_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), DRC_TOOL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ HasPoint()

bool EE_POINT_EDITOR::HasPoint ( )
inline

Indicate the cursor is over an edit point.

Used to coordinate cursor shapes with other tools.Set up handlers for various events.

Definition at line 55 of file ee_point_editor.h.

References m_editedPoint.

Referenced by EE_SELECTION_TOOL::Main().

◆ Init()

bool EE_POINT_EDITOR::Init ( )
overridevirtual

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 226 of file ee_point_editor.cpp.

227 {
229 
230  auto& menu = m_selectionTool->GetToolMenu().GetMenu();
232  std::bind( &EE_POINT_EDITOR::addCornerCondition, this, _1 ) );
234  std::bind( &EE_POINT_EDITOR::removeCornerCondition, this, _1 ) );
235 
236  return true;
237 }
static TOOL_ACTION pointEditorAddCorner
Definition: ee_actions.h:136
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MENU & GetToolMenu()
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:66
bool addCornerCondition(const SELECTION &aSelection)
static TOOL_ACTION pointEditorRemoveCorner
Definition: ee_actions.h:137
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
bool removeCornerCondition(const SELECTION &aSelection)
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.

References addCornerCondition(), CONDITIONAL_MENU::AddItem(), TOOL_MENU::GetMenu(), TOOL_INTERACTIVE::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

Definition at line 77 of file ee_point_editor.h.

78  {
79  return m_editedPoint == &aPoint;
80  }
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 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

Referenced by EDIT_TOOL::Drag(), ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ Main()

int EE_POINT_EDITOR::Main ( const TOOL_EVENT aEvent)

Definition at line 274 of file ee_point_editor.cpp.

275 {
276  static KICAD_T supportedTypes[] = {
277  LIB_SHAPE_T,
278  SCH_SHEET_T,
280  SCH_BITMAP_T,
281  EOT
282  };
283 
284  if( !m_selectionTool )
285  return 0;
286 
287  if( m_isSymbolEditor )
288  {
289  SYMBOL_EDIT_FRAME* editor = getEditFrame<SYMBOL_EDIT_FRAME>();
290 
291  if( !editor->IsSymbolEditable() || editor->IsSymbolAlias() )
292  return 0;
293  }
294 
295  const EE_SELECTION& selection = m_selectionTool->GetSelection();
296 
297  if( selection.Size() != 1 || !selection.Front()->IsType( supportedTypes ) )
298  return 0;
299 
300  // Wait till drawing tool is done
301  if( selection.Front()->IsNew() )
302  return 0;
303 
304  Activate();
305 
307  KIGFX::VIEW* view = getView();
308  EDA_ITEM* item = (EDA_ITEM*) selection.Front();
309 
310  controls->ShowCursor( true );
311 
313  view->Add( m_editPoints.get() );
314  setEditedPoint( nullptr );
315  updateEditedPoint( aEvent );
316  bool inDrag = false;
317  bool modified = false;
318 
319  // Main loop: keep receiving events
320  while( TOOL_EVENT* evt = Wait() )
321  {
322  if( !m_editPoints || evt->IsSelectionEvent() )
323  break;
324 
325  if ( !inDrag )
326  updateEditedPoint( *evt );
327 
328  if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
329  {
330  if( !inDrag )
331  {
332  saveItemsToUndo();
333  controls->ForceCursorPosition( false );
334  inDrag = true;
335  modified = true;
336  }
337 
338  bool snap = !evt->DisableGridSnapping();
339  EDA_SHAPE* shape = dynamic_cast<EDA_SHAPE*>( item );
340 
341  if( shape && shape->GetShape() == SHAPE_T::ARC && getEditedPointIndex() == ARC_CENTER )
342  snap = false;
343 
344  m_editedPoint->SetPosition( controls->GetCursorPosition( snap ) );
345 
347  updatePoints();
348  }
349  else if( inDrag && evt->IsMouseUp( BUT_LEFT ) )
350  {
351  if( modified )
352  {
353  m_frame->OnModify();
354  modified = false;
355  }
356 
357  controls->SetAutoPan( false );
358  inDrag = false;
359  }
360  else if( evt->IsCancelInteractive() || evt->IsActivate() )
361  {
362  if( inDrag ) // Restore the last change
363  {
365  inDrag = false;
366  modified = false;
367  break;
368  }
369  else if( evt->IsCancelInteractive() )
370  {
371  break;
372  }
373 
374  if( evt->IsActivate() )
375  break;
376  }
377  else
378  {
379  evt->SetPassEvent();
380  }
381 
382  controls->SetAutoPan( inDrag );
383  controls->CaptureCursor( inDrag );
384  }
385 
386  controls->SetAutoPan( false );
387  controls->CaptureCursor( false );
388  setEditedPoint( nullptr );
389 
390  if( m_editPoints )
391  {
392  view->Remove( m_editPoints.get() );
393 
394  if( modified )
395  m_frame->OnModify();
396 
397  m_editPoints.reset();
398  m_frame->GetCanvas()->Refresh();
399  }
400 
401  return 0;
402 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
void updateEditedPoint(const TOOL_EVENT &aEvent)
Clear references to the points.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.
void updatePoints()
Update which point is being edited.
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
bool IsNew() const
Definition: eda_item.h:118
EE_SELECTION & GetSelection()
Return the set of currently selected items.
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)
Force the cursor to stay within the drawing panel area.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:152
An interface for classes handling user events controlling the view behavior such as zooming,...
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:179
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:182
void updateParentItem() const
< Update item's points with edit points.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
std::shared_ptr< EDIT_POINTS > m_editPoints
int getEditedPointIndex() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
void setEditedPoint(EDIT_POINT *aPoint)
Return true if aPoint is the currently modified point.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void Activate()
Run the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
SHAPE_T GetShape() const
Definition: eda_shape.h:101
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
static std::shared_ptr< EDIT_POINTS > Make(EDA_ITEM *aItem, SCH_BASE_FRAME *frame)
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:145
The symbol library editor main window.
virtual void SetPosition(const VECTOR2I &aPosition)
Set new coordinates for an EDIT_POINT.
Definition: edit_points.h:106

References TOOL_INTERACTIVE::Activate(), KIGFX::VIEW::Add(), ARC, ARC_CENTER, BUT_LEFT, KIGFX::VIEW_CONTROLS::CaptureCursor(), editor, EOT, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), getEditedPointIndex(), EE_SELECTION_TOOL::GetSelection(), EDA_SHAPE::GetShape(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), EDA_ITEM::IsNew(), EDA_ITEM::IsType(), LIB_SHAPE_T, m_editedPoint, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor, EE_TOOL_BASE< SCH_BASE_FRAME >::m_selectionTool, EDIT_POINTS_FACTORY::Make(), SCH_BASE_FRAME::OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::Remove(), rollbackFromUndo(), saveItemsToUndo(), SCH_BITMAP_T, SCH_LINE_LOCATE_GRAPHIC_LINE_T, SCH_SHEET_T, KIGFX::VIEW_CONTROLS::SetAutoPan(), setEditedPoint(), EDIT_POINT::SetPosition(), KIGFX::VIEW_CONTROLS::ShowCursor(), SELECTION::Size(), updateEditedPoint(), updateParentItem(), updatePoints(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ modifiedSelection()

int EE_POINT_EDITOR::modifiedSelection ( const TOOL_EVENT aEvent)
private

Definition at line 912 of file ee_point_editor.cpp.

913 {
914  updatePoints();
915  return 0;
916 }
void updatePoints()
Update which point is being edited.

References updatePoints().

Referenced by setTransitions().

◆ removeCorner()

int EE_POINT_EDITOR::removeCorner ( const TOOL_EVENT aEvent)
private

Definition at line 889 of file ee_point_editor.cpp.

890 {
891  if( !m_editPoints || !m_editedPoint || m_editPoints->GetParent()->Type() != LIB_SHAPE_T )
892  return 0;
893 
894  LIB_SHAPE* shape = static_cast<LIB_SHAPE*>( m_editPoints->GetParent() );
895  SHAPE_LINE_CHAIN& poly = shape->GetPolyShape().Outline( 0 );
896 
897  if( poly.GetPointCount() < 3 )
898  return 0;
899 
900  saveItemsToUndo();
901  poly.Remove( getEditedPointIndex() );
902 
903  updateItem( shape, true );
904  updatePoints();
905 
906  m_frame->OnModify();
907 
908  return 0;
909 }
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.
void updatePoints()
Update which point is being edited.
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
SHAPE_LINE_CHAIN & Outline(int aIndex)
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:227
void updateItem(EDA_ITEM *aItem, bool aUpdateRTree) const
Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the ...
Definition: ee_tool_base.h:103
std::shared_ptr< EDIT_POINTS > m_editPoints
int getEditedPointIndex() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...

References getEditedPointIndex(), EDA_SHAPE::GetPolyShape(), LIB_SHAPE_T, m_editedPoint, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, SCH_BASE_FRAME::OnModify(), SHAPE_POLY_SET::Outline(), saveItemsToUndo(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), and updatePoints().

Referenced by setTransitions().

◆ removeCornerCondition()

bool EE_POINT_EDITOR::removeCornerCondition ( const SELECTION aSelection)
private

Definition at line 810 of file ee_point_editor.cpp.

811 {
812  if( !m_editPoints || !m_editedPoint || m_editPoints->GetParent()->Type() != LIB_SHAPE_T )
813  return false;
814 
815  LIB_SHAPE* shape = static_cast<LIB_SHAPE*>( m_editPoints->GetParent() );
816 
817  if( shape->GetPolyShape().IsEmpty() )
818  return false;
819 
820  SHAPE_LINE_CHAIN& poly = shape->GetPolyShape().Outline( 0 );
821 
822  if( poly.GetPointCount() < 3 )
823  return false;
824 
825  for( const VECTOR2I& pt : poly.CPoints() )
826  {
827  if( pt == mapCoords( m_editedPoint->GetPosition() ) )
828  return true;
829  }
830 
831  return false;
832 }
virtual size_t GetPointCount() const override
bool IsEmpty() const
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
Definition: edit_points.h:70
const std::vector< VECTOR2I > & CPoints() const
SHAPE_LINE_CHAIN & Outline(int aIndex)
static VECTOR2D mapCoords(const wxPoint &aCoord)
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:227
std::shared_ptr< EDIT_POINTS > m_editPoints
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...

References SHAPE_LINE_CHAIN::CPoints(), SHAPE_LINE_CHAIN::GetPointCount(), EDA_SHAPE::GetPolyShape(), EDIT_POINT::GetPosition(), SHAPE_POLY_SET::IsEmpty(), LIB_SHAPE_T, m_editedPoint, m_editPoints, KIGFX::mapCoords(), and SHAPE_POLY_SET::Outline().

Referenced by Init().

◆ Reset()

void EE_POINT_EDITOR::Reset ( RESET_REASON  aReason)
overridevirtual

Bring 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 217 of file ee_point_editor.cpp.

218 {
219  EE_TOOL_BASE::Reset( aReason );
220 
221  m_editPoints.reset();
222  m_editedPoint = nullptr;
223 }
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
Definition: ee_tool_base.h:86
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.
std::shared_ptr< EDIT_POINTS > m_editPoints

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

◆ rollbackFromUndo()

void EE_POINT_EDITOR::rollbackFromUndo ( )
private

Definition at line 945 of file ee_point_editor.cpp.

946 {
947  if( m_isSymbolEditor )
948  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->RollbackSymbolFromUndo();
949  else
950  static_cast<SCH_EDIT_FRAME*>( m_frame )->RollbackSchematicFromUndo();
951 }

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

Referenced by Main().

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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  aType,
bool  aAppend = false 
)
inlineprotectedinherited

Definition at line 134 of file ee_tool_base.h.

135  {
136  wxASSERT( aItem );
137 
138  KICAD_T itemType = aItem->Type();
139  bool selected = aItem->IsSelected();
140 
141  // IS_SELECTED flag should not be set on undo items which were added for
142  // a drag operation.
143  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
144  aItem->ClearSelected();
145 
146  if( m_isSymbolEditor )
147  {
148  SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
149  wxASSERT( editFrame );
150 
151  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
152  }
153  else
154  {
155  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
156  wxASSERT( editFrame );
157 
158  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
159  {
160  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
161  static_cast<SCH_ITEM*>( aItem->GetParent() ),
162  UNDO_REDO::CHANGED, aAppend );
163  }
164  else
165  {
166  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
167  static_cast<SCH_ITEM*>( aItem ),
168  aType, aAppend );
169  }
170  }
171 
172  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
173  aItem->SetSelected();
174  }
bool IsSelected() const
Definition: eda_item.h:122
void ClearSelected()
Definition: eda_item.h:131
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:155
Schematic editor (Eeschema) main window.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetSelected()
Definition: eda_item.h:128
void SaveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current symbol, and save it in the undo list.
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
#define TEMP_SELECTED
flag indicating that the structure has already selected
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
The symbol library editor main window.

◆ saveItemsToUndo()

void EE_POINT_EDITOR::saveItemsToUndo ( )
private

Definition at line 919 of file ee_point_editor.cpp.

920 {
921  if( m_isSymbolEditor )
922  {
923  saveCopyInUndoList( m_editPoints->GetParent()->GetParent(), UNDO_REDO::LIBEDIT );
924  }
925  else
926  {
928 
929  if( m_editPoints->GetParent()->Type() == SCH_LINE_T )
930  {
931  std::pair<EDA_ITEM*, int> connected = m_editPoints->Point( LINE_START ).GetConnected();
932 
933  if( connected.first )
934  saveCopyInUndoList( (SCH_ITEM*) connected.first, UNDO_REDO::CHANGED, true );
935 
936  connected = m_editPoints->Point( LINE_END ).GetConnected();
937 
938  if( connected.first )
939  saveCopyInUndoList( (SCH_ITEM*) connected.first, UNDO_REDO::CHANGED, true );
940  }
941  }
942 }
void saveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aType, bool aAppend=false)
Definition: ee_tool_base.h:134
std::shared_ptr< EDIT_POINTS > m_editPoints
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182

References CHANGED, LIBEDIT, LINE_END, LINE_START, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor, EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), and SCH_LINE_T.

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

◆ SetContextMenu()

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

Assign 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 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior 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(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setEditedPoint()

void EE_POINT_EDITOR::setEditedPoint ( EDIT_POINT aPoint)
private

Return true if aPoint is the currently modified point.

Definition at line 788 of file ee_point_editor.cpp.

789 {
791 
792  if( aPoint )
793  {
795  controls->ForceCursorPosition( true, aPoint->GetPosition() );
796  controls->ShowCursor( true );
797  }
798  else
799  {
800  if( m_frame->ToolStackIsEmpty() )
801  controls->ShowCursor( false );
802 
803  controls->ForceCursorPosition( false );
804  }
805 
806  m_editedPoint = aPoint;
807 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
Definition: edit_points.h:70
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42

References ARROW, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SCH_BASE_FRAME::GetCanvas(), EDIT_POINT::GetPosition(), TOOL_BASE::getViewControls(), m_editedPoint, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::ShowCursor(), and TOOLS_HOLDER::ToolStackIsEmpty().

Referenced by clearEditedPoints(), Main(), and updateEditedPoint().

◆ setTransitions()

void EE_POINT_EDITOR::setTransitions ( )
overridevirtual

This method is meant to be overridden in order to specify handlers for events.

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 954 of file ee_point_editor.cpp.

955 {
962 }
int Main(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
static TOOL_ACTION activatePointEditor
Definition: actions.h:168
int clearEditedPoints(const TOOL_EVENT &aEvent)
Set the current point being edited. NULL means none.
static TOOL_ACTION pointEditorAddCorner
Definition: ee_actions.h:136
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))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:205
static TOOL_ACTION pointEditorRemoveCorner
Definition: ee_actions.h:137
int removeCorner(const TOOL_EVENT &aEvent)
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:202
int addCorner(const TOOL_EVENT &aEvent)
TOOL_ACTION handlers.

References ACTIONS::activatePointEditor, addCorner(), EVENTS::ClearedEvent, clearEditedPoints(), 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

Clear references to the points.

Definition at line 248 of file ee_point_editor.cpp.

249 {
250  EDIT_POINT* point = m_editedPoint;
251 
252  if( !m_editPoints )
253  {
254  point = nullptr;
255  }
256  else if( aEvent.IsMotion() )
257  {
258  point = m_editPoints->FindPoint( aEvent.Position(), getView() );
259  }
260  else if( aEvent.IsDrag( BUT_LEFT ) )
261  {
262  point = m_editPoints->FindPoint( aEvent.DragOrigin(), getView() );
263  }
264  else
265  {
266  point = m_editPoints->FindPoint( getViewControls()->GetCursorPosition(), getView() );
267  }
268 
269  if( m_editedPoint != point )
270  setEditedPoint( point );
271 }
bool IsMotion() const
Definition: tool_event.h:300
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:285
const VECTOR2D DragOrigin() const
Returns information about mouse buttons state.
Definition: tool_event.h:269
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
std::shared_ptr< EDIT_POINTS > m_editPoints
void setEditedPoint(EDIT_POINT *aPoint)
Return true if aPoint is the currently modified point.
Represent a single point that can be used for modifying items.
Definition: edit_points.h:47
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
const VECTOR2D Position() const
Returns the point where dragging has started.
Definition: tool_event.h:263

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

Referenced by Main().

◆ updateItem()

void EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem ( EDA_ITEM aItem,
bool  aUpdateRTree 
) const
inlineprotectedinherited

Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the SCH_SCREEN's RTree.

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

Definition at line 103 of file ee_tool_base.h.

◆ updateParentItem()

void EE_POINT_EDITOR::updateParentItem ( ) const
private

< Update item's points with edit points.

Update edit points with item's points.

Definition at line 476 of file ee_point_editor.cpp.

477 {
478  EDA_ITEM* item = m_editPoints->GetParent();
479 
480  if( !item )
481  return;
482 
483  switch( item->Type() )
484  {
485  case LIB_SHAPE_T:
486  {
487  LIB_SHAPE* shape = static_cast<LIB_SHAPE*>( item );
488 
489  switch( shape->GetShape() )
490  {
491  case SHAPE_T::ARC:
493  {
494  shape->SetEditState( 4 );
495  shape->CalcEdit( mapCoords( m_editPoints->Point( ARC_CENTER ).GetPosition() ) );
496  }
497  else if( getEditedPointIndex() == ARC_START )
498  {
499  shape->SetEditState( 2 );
500  shape->CalcEdit( mapCoords( m_editPoints->Point( ARC_START ).GetPosition() ) );
501  }
502  else if( getEditedPointIndex() == ARC_END )
503  {
504  shape->SetEditState( 3 );
505  shape->CalcEdit( mapCoords( m_editPoints->Point( ARC_END ).GetPosition() ) );
506  }
507  break;
508 
509  case SHAPE_T::CIRCLE:
510  shape->SetPosition( mapCoords( m_editPoints->Point( CIRC_CENTER ).GetPosition() ) );
511  shape->SetEnd( mapCoords( m_editPoints->Point( CIRC_END ).GetPosition() ) );
512  break;
513 
514  case SHAPE_T::POLY:
515  shape->GetPolyShape().RemoveAllContours();
516  shape->GetPolyShape().NewOutline();
517 
518  for( unsigned i = 0; i < m_editPoints->PointsSize(); ++i )
519  {
520  wxPoint pt = mapCoords( m_editPoints->Point( i ).GetPosition() );
521  shape->GetPolyShape().Append( pt.x, pt.y, -1, -1, true );
522  }
523 
524  break;
525 
526  case SHAPE_T::RECT:
527  {
528  EE_GRID_HELPER gridHelper( m_toolMgr );
529  VECTOR2I topLeft = m_editPoints->Point( RECT_TOPLEFT ).GetPosition();
530  VECTOR2I topRight = m_editPoints->Point( RECT_TOPRIGHT ).GetPosition();
531  VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
532  VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
533 
534  pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ),
535  topLeft, topRight, botLeft, botRight, &gridHelper );
536 
537  shape->SetPosition( mapCoords( topLeft ) );
538  shape->SetEnd( mapCoords( botRight ) );
539  }
540  break;
541 
542  case SHAPE_T::BEZIER:
543  // TODO
544  break;
545 
546  default:
547  wxFAIL_MSG( wxT( "EE_POINT_EDITOR::updateParentItem not implemented for " )
548  + shape->SHAPE_T_asString() );
549  }
550  }
551  break;
552 
553  case SCH_BITMAP_T:
554  {
555  EE_GRID_HELPER gridHelper( m_toolMgr );
556  SCH_BITMAP* bitmap = (SCH_BITMAP*) item;
557  VECTOR2I topLeft = m_editPoints->Point( RECT_TOPLEFT ).GetPosition();
558  VECTOR2I topRight = m_editPoints->Point( RECT_TOPRIGHT ).GetPosition();
559  VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
560  VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
561 
562  pinEditedCorner( getEditedPointIndex(), Mils2iu( 50 ), Mils2iu( 50 ),
563  topLeft, topRight, botLeft, botRight, &gridHelper );
564 
565  double oldWidth = bitmap->GetSize().x;
566  double newWidth = topRight.x - topLeft.x;
567  double widthRatio = newWidth / oldWidth;
568 
569  double oldHeight = bitmap->GetSize().y;
570  double newHeight = botLeft.y - topLeft.y;
571  double heightRatio = newHeight / oldHeight;
572 
573  bitmap->SetImageScale( bitmap->GetImageScale() * std::min( widthRatio, heightRatio ) );
574  }
575  break;
576 
577  case SCH_SHEET_T:
578  {
579  SCH_SHEET* sheet = (SCH_SHEET*) item;
580  EE_GRID_HELPER gridHelper( m_toolMgr );
581  VECTOR2I topLeft = m_editPoints->Point( RECT_TOPLEFT ).GetPosition();
582  VECTOR2I topRight = m_editPoints->Point( RECT_TOPRIGHT ).GetPosition();
583  VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
584  VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
585  int edited = getEditedPointIndex();
586 
588  sheet->GetMinWidth( edited == RECT_TOPRIGHT || edited == RECT_BOTRIGHT ),
589  sheet->GetMinHeight( edited == RECT_BOTLEFT || edited == RECT_BOTRIGHT ),
590  topLeft, topRight, botLeft, botRight, &gridHelper );
591 
592  // Pin positions are relative to origin. Attempt to leave them where they
593  // are if the origin moves.
594  wxPoint originDelta = sheet->GetPosition() - (wxPoint) topLeft;
595 
596  sheet->SetPosition( (wxPoint) topLeft );
597  sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) );
598 
599  // Update the fields if we're in autoplace mode
601  sheet->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
602 
603  // Keep sheet pins attached to edges:
604  for( SCH_SHEET_PIN* pin : sheet->GetPins() )
605  {
606  wxPoint pos = pin->GetPosition();
607 
608  pos += originDelta;
609 
610  switch( pin->GetSide() )
611  {
612  case SHEET_SIDE::LEFT: pos.x = topLeft.x; break;
613  case SHEET_SIDE::RIGHT: pos.x = topRight.x; break;
614  case SHEET_SIDE::TOP: pos.y = topLeft.y; break;
615  case SHEET_SIDE::BOTTOM: pos.y = botLeft.y; break;
616  case SHEET_SIDE::UNDEFINED: break;
617  }
618 
619  pin->SetPosition( pos );
620  }
621  }
622  break;
623 
624  case SCH_LINE_T:
625  {
626  SCH_LINE* line = (SCH_LINE*) item;
627 
628  line->SetStartPoint( (wxPoint) m_editPoints->Point( LINE_START ).GetPosition() );
629  line->SetEndPoint( (wxPoint) m_editPoints->Point( LINE_END ).GetPosition() );
630 
631  std::pair<EDA_ITEM*, int> connected = m_editPoints->Point( LINE_START ).GetConnected();
632 
633  if( connected.first )
634  {
635  if( connected.second == STARTPOINT )
636  static_cast<SCH_LINE*>( connected.first )->SetStartPoint( line->GetPosition() );
637  else if( connected.second == ENDPOINT )
638  static_cast<SCH_LINE*>( connected.first )->SetEndPoint( line->GetPosition() );
639 
640  updateItem( connected.first, true );
641  }
642 
643  connected = m_editPoints->Point( LINE_END ).GetConnected();
644 
645  if( connected.first )
646  {
647  if( connected.second == STARTPOINT )
648  static_cast<SCH_LINE*>( connected.first )->SetStartPoint( line->GetEndPoint() );
649  else if( connected.second == ENDPOINT )
650  static_cast<SCH_LINE*>( connected.first )->SetEndPoint( line->GetEndPoint() );
651 
652  updateItem( connected.first, true );
653  }
654  }
655  break;
656 
657  default:
658  break;
659  }
660 
661  updateItem( item, true );
662  m_frame->SetMsgPanel( item );
663 }
#define STARTPOINT
When a line is selected, these flags indicate which.
void SetEnd(const wxPoint &aEnd)
Definition: eda_shape.h:135
int GetMinWidth(bool aFromLeft) const
Return the minimum width of the sheet based on the widths of the sheet pin text.
Definition: sch_sheet.cpp:461
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetEditState(int aState)
Definition: lib_shape.h:79
int GetMinHeight(bool aFromTop) const
Return the minimum height that the sheet can be resized based on the sheet pin positions.
Definition: sch_sheet.cpp:495
#define ENDPOINT
ends. (Used to support dragging.)
FIELDS_AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition: sch_item.h:424
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:94
void SetPosition(const wxPoint &aPosition) override
Definition: lib_shape.h:88
wxSize GetSize() const
Definition: sch_bitmap.cpp:125
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
void SetImageScale(double aScale)
Definition: sch_bitmap.h:71
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
void CalcEdit(const wxPoint &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
Definition: lib_shape.h:76
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:71
static VECTOR2D mapCoords(const wxPoint &aCoord)
wxPoint GetPosition() const override
Definition: sch_sheet.h:379
int NewOutline()
Creates a new hole in a given outline.
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:40
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:227
void updateItem(EDA_ITEM *aItem, bool aUpdateRTree) const
Similar to getView()->Update(), but handles items that are redrawn by their parents and updating the ...
Definition: ee_tool_base.h:103
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
void SetSize(const wxSize &aSize)
Definition: sch_sheet.h:105
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:183
std::shared_ptr< EDIT_POINTS > m_editPoints
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
Definition: sch_line.h:231
void SetPosition(const wxPoint &aPosition) override
Definition: sch_sheet.cpp:879
double GetImageScale() const
Definition: sch_bitmap.h:66
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
SHAPE_T GetShape() const
Definition: eda_shape.h:101
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_sheet.cpp:579
static void pinEditedCorner(int aEditedPointIndex, int minWidth, int minHeight, VECTOR2I &topLeft, VECTOR2I &topRight, VECTOR2I &botLeft, VECTOR2I &botRight, EE_GRID_HELPER *aGrid)
Update the coordinates of 4 corners of a rectangle, according to constraints and the moved corner.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References SHAPE_POLY_SET::Append(), ARC, ARC_CENTER, ARC_END, ARC_START, SCH_SHEET::AutoplaceFields(), BEZIER, BOTTOM, LIB_SHAPE::CalcEdit(), CIRC_CENTER, CIRC_END, CIRCLE, ENDPOINT, FIELDS_AUTOPLACED_AUTO, getEditedPointIndex(), SCH_LINE::GetEndPoint(), SCH_ITEM::GetFieldsAutoplaced(), SCH_BITMAP::GetImageScale(), SCH_SHEET::GetMinHeight(), SCH_SHEET::GetMinWidth(), SCH_SHEET::GetPins(), EDA_SHAPE::GetPolyShape(), SCH_LINE::GetPosition(), SCH_SHEET::GetPosition(), EDA_SHAPE::GetShape(), SCH_BITMAP::GetSize(), LEFT, LIB_SHAPE_T, LINE_END, LINE_START, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, TOOL_BASE::m_toolMgr, KIGFX::mapCoords(), SHAPE_POLY_SET::NewOutline(), pin, pinEditedCorner(), POLY, RECT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_TOPLEFT, RECT_TOPRIGHT, SHAPE_POLY_SET::RemoveAllContours(), RIGHT, SCH_BITMAP_T, SCH_LINE_T, SCH_SHEET_T, LIB_SHAPE::SetEditState(), EDA_SHAPE::SetEnd(), SCH_LINE::SetEndPoint(), SCH_BITMAP::SetImageScale(), EDA_DRAW_FRAME::SetMsgPanel(), LIB_SHAPE::SetPosition(), SCH_SHEET::SetPosition(), SCH_SHEET::SetSize(), SCH_LINE::SetStartPoint(), EDA_SHAPE::SHAPE_T_asString(), STARTPOINT, TOP, EDA_ITEM::Type(), UNDEFINED, EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Main().

◆ updatePoints()

void EE_POINT_EDITOR::updatePoints ( )
private

Update which point is being edited.

Definition at line 666 of file ee_point_editor.cpp.

667 {
668  if( !m_editPoints )
669  return;
670 
671  EDA_ITEM* item = m_editPoints->GetParent();
672 
673  if( !item )
674  return;
675 
676  switch( item->Type() )
677  {
678  case LIB_SHAPE_T:
679  {
680  LIB_SHAPE* shape = static_cast<LIB_SHAPE*>( item );
681 
682  switch( shape->GetShape() )
683  {
684  case SHAPE_T::ARC:
685  m_editPoints->Point( ARC_CENTER ).SetPosition( mapCoords( shape->GetPosition() ) );
686  m_editPoints->Point( ARC_START ).SetPosition( mapCoords( shape->GetStart() ) );
687  m_editPoints->Point( ARC_END ).SetPosition( mapCoords( shape->GetEnd() ) );
688  break;
689 
690  case SHAPE_T::CIRCLE:
691  m_editPoints->Point( CIRC_CENTER ).SetPosition( mapCoords( shape->GetPosition() ) );
692  m_editPoints->Point( CIRC_END ).SetPosition( mapCoords( shape->GetEnd() ) );
693  break;
694 
695  case SHAPE_T::POLY:
696  {
697  if( (int) m_editPoints->PointsSize() != shape->GetPointCount() )
698  {
699  getView()->Remove( m_editPoints.get() );
700  m_editedPoint = nullptr;
702  getView()->Add( m_editPoints.get() );
703  }
704  else
705  {
706  int ii = 0;
707 
708  for( const VECTOR2I& pt : shape->GetPolyShape().Outline( 0 ).CPoints() )
709  m_editPoints->Point( ii++ ).SetPosition( mapCoords( pt ) );
710  }
711 
712  break;
713  }
714 
715  case SHAPE_T::RECT:
716  {
717  // point editor works only with rectangles having width and height > 0
718  // Some symbols can have rectangles with width or height < 0
719  // So normalize the size:
720  BOX2I dummy;
721  dummy.SetOrigin( mapCoords( shape->GetPosition() ) );
722  dummy.SetEnd( mapCoords( shape->GetEnd() ) );
723  dummy.Normalize();
724  VECTOR2I topLeft = dummy.GetPosition();
725  VECTOR2I botRight = dummy.GetEnd();
726 
727  m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft );
728  m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( VECTOR2I( botRight.x, topLeft.y ) );
729  m_editPoints->Point( RECT_BOTLEFT ).SetPosition( VECTOR2I( topLeft.x, botRight.y ) );
730  m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
731  }
732  break;
733 
734  case SHAPE_T::BEZIER:
735  // TODO
736  break;
737 
738  default:
739  wxFAIL_MSG( wxT( "EE_POINT_EDITOR::updatePoints not implemented for " )
740  + shape->SHAPE_T_asString() );
741  }
742  }
743  break;
744 
745  case SCH_BITMAP_T:
746  {
747  SCH_BITMAP* bitmap = (SCH_BITMAP*) item;
748  wxPoint topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2;
749  wxPoint botRight = bitmap->GetPosition() + bitmap->GetSize() / 2;
750 
751  m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft );
752  m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y );
753  m_editPoints->Point( RECT_BOTLEFT ).SetPosition( topLeft.x, botRight.y );
754  m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
755  }
756  break;
757 
758  case SCH_SHEET_T:
759  {
760  SCH_SHEET* sheet = (SCH_SHEET*) item;
761  wxPoint topLeft = sheet->GetPosition();
762  wxPoint botRight = sheet->GetPosition() + sheet->GetSize();
763 
764  m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft );
765  m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y );
766  m_editPoints->Point( RECT_BOTLEFT ).SetPosition( topLeft.x, botRight.y );
767  m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
768  }
769  break;
770 
771  case SCH_LINE_T:
772  {
773  SCH_LINE* line = (SCH_LINE*) item;
774 
775  m_editPoints->Point( LINE_START ).SetPosition( line->GetStartPoint() );
776  m_editPoints->Point( LINE_END ).SetPosition( line->GetEndPoint() );
777  }
778  break;
779 
780  default:
781  break;
782  }
783 
784  getView()->Update( m_editPoints.get() );
785 }
wxPoint GetStartPoint() const
Definition: sch_line.h:90
const wxPoint & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:106
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
EDIT_POINT * m_editedPoint
< Currently edited point, NULL if there is none.
virtual wxPoint GetPosition() const
Definition: eda_item.h:251
wxPoint GetPosition() const override
Definition: sch_bitmap.h:136
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
int GetPointCount() const
Definition: eda_shape.cpp:1222
const wxPoint & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:131
wxSize GetSize() const
Definition: sch_bitmap.cpp:125
const std::vector< VECTOR2I > & CPoints() const
SHAPE_LINE_CHAIN & Outline(int aIndex)
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:71
static VECTOR2D mapCoords(const wxPoint &aCoord)
wxPoint GetPosition() const override
Definition: sch_sheet.h:379
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:40
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:227
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
std::shared_ptr< EDIT_POINTS > m_editPoints
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
wxSize GetSize() const
Definition: sch_sheet.h:104
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
SHAPE_T GetShape() const
Definition: eda_shape.h:101
wxPoint GetPosition() const override
Definition: lib_shape.h:87
static std::shared_ptr< EDIT_POINTS > Make(EDA_ITEM *aItem, SCH_BASE_FRAME *frame)
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References KIGFX::VIEW::Add(), ARC, ARC_CENTER, ARC_END, ARC_START, BEZIER, CIRC_CENTER, CIRC_END, CIRCLE, SHAPE_LINE_CHAIN::CPoints(), dummy(), EDA_SHAPE::GetEnd(), SCH_LINE::GetEndPoint(), EDA_SHAPE::GetPointCount(), EDA_SHAPE::GetPolyShape(), LIB_SHAPE::GetPosition(), SCH_BITMAP::GetPosition(), EDA_ITEM::GetPosition(), SCH_SHEET::GetPosition(), EDA_SHAPE::GetShape(), SCH_BITMAP::GetSize(), SCH_SHEET::GetSize(), EDA_SHAPE::GetStart(), SCH_LINE::GetStartPoint(), TOOL_BASE::getView(), LIB_SHAPE_T, LINE_END, LINE_START, m_editedPoint, m_editPoints, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EDIT_POINTS_FACTORY::Make(), KIGFX::mapCoords(), SHAPE_POLY_SET::Outline(), POLY, RECT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_TOPLEFT, RECT_TOPRIGHT, KIGFX::VIEW::Remove(), SCH_BITMAP_T, SCH_LINE_T, SCH_SHEET_T, EDA_SHAPE::SHAPE_T_asString(), EDA_ITEM::Type(), KIGFX::VIEW::Update(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Suspend execution of the tool until an event specified in aEventList arrives.

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_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.

Currently available edit points.

Definition at line 106 of file ee_point_editor.h.

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

◆ m_editPoints

◆ m_frame

SCH_BASE_FRAME * EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame
protectedinherited

Definition at line 177 of file ee_tool_base.h.

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 180 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), BOARD_EDITOR_CONTROL::Init(), GERBVIEW_SELECTION_TOOL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_BASE_FRAME >::m_selectionTool
protectedinherited

Definition at line 179 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 209 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 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), DRC_TOOL::CrossProbe(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_REANNOTATE_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), GLOBAL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), BOARD_INSPECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_POINT_EDITOR::Init(), BOARD_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), PL_SELECTION_TOOL::onDisambiguationExpire(), EE_SELECTION_TOOL::onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), PAD_TOOL::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), updateParentItem(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 206 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().

◆ m_view

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

Definition at line 178 of file ee_tool_base.h.


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