KiCad PCB EDA Suite
SCH_DRAWING_TOOLS Class Reference

SCH_DRAWING_TOOLS. More...

#include <sch_drawing_tools.h>

Inheritance diagram for SCH_DRAWING_TOOLS:
EE_TOOL_BASE< SCH_EDIT_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

 SCH_DRAWING_TOOLS ()
 
 ~SCH_DRAWING_TOOLS () override
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int PlaceComponent (const TOOL_EVENT &aEvent)
 
int SingleClickPlace (const TOOL_EVENT &aEvent)
 
int TwoClickPlace (const TOOL_EVENT &aEvent)
 
int DrawSheet (const TOOL_EVENT &aEvent)
 
int PlaceImage (const TOOL_EVENT &aEvent)
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
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...
 
TOOL_EVENTWait (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...
 
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...
 
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_EDIT_FRAMEm_frame
 
KIGFX::SCH_VIEWm_view
 
EE_SELECTION_TOOLm_selectionTool
 
bool m_isLibEdit
 
TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change 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
 

Private Member Functions

SCH_TEXTgetNextNewText ()
 Gets the next queued text item. More...
 
SCH_TEXTcreateNewText (const VECTOR2I &aPosition, int aType)
 
void sizeSheet (SCH_SHEET *aSheet, VECTOR2I aPos)
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 

Private Attributes

std::vector< COMPONENT_SELECTIONm_symbolHistoryList
 
std::vector< COMPONENT_SELECTIONm_powerHistoryList
 
PINSHEETLABEL_SHAPE m_lastGlobalLabelShape
 
LABEL_SPIN_STYLE m_lastTextOrientation
 
bool m_lastTextBold
 
bool m_lastTextItalic
 
std::deque< std::unique_ptr< SCH_TEXT > > m_queuedTexts
 
std::unique_ptr< STATUS_TEXT_POPUPm_statusPopup
 

Detailed Description

SCH_DRAWING_TOOLS.

Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.)

Definition at line 46 of file sch_drawing_tools.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 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SCH_DRAWING_TOOLS()

SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS ( )

◆ ~SCH_DRAWING_TOOLS()

SCH_DRAWING_TOOLS::~SCH_DRAWING_TOOLS ( )
inlineoverride

Definition at line 50 of file sch_drawing_tools.h.

50 { }

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

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
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(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), PlaceComponent(), PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ 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 60 of file tool_base.cpp.

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

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ createNewText()

SCH_TEXT * SCH_DRAWING_TOOLS::createNewText ( const VECTOR2I aPosition,
int  aType 
)
private

Definition at line 586 of file sch_drawing_tools.cpp.

587 {
588  SCHEMATIC* schematic = getModel<SCHEMATIC>();
589  SCHEMATIC_SETTINGS& settings = schematic->Settings();
590  SCH_TEXT* textItem = nullptr;
591 
592  m_queuedTexts.clear();
593 
594  switch( aType )
595  {
596  case LAYER_NOTES:
597  textItem = new SCH_TEXT( (wxPoint) aPosition );
598  break;
599 
600  case LAYER_LOCLABEL:
601  textItem = new SCH_LABEL( (wxPoint) aPosition );
602  break;
603 
604  case LAYER_HIERLABEL:
605  textItem = new SCH_HIERLABEL( (wxPoint) aPosition );
606  textItem->SetShape( m_lastGlobalLabelShape );
607  break;
608 
609  case LAYER_GLOBLABEL:
610  textItem = new SCH_GLOBALLABEL( (wxPoint) aPosition );
611  textItem->SetShape( m_lastGlobalLabelShape );
612  break;
613 
614  default:
615  DisplayError( m_frame, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) );
616  return nullptr;
617  }
618 
619  textItem->SetParent( schematic );
620  textItem->SetBold( m_lastTextBold );
621  textItem->SetItalic( m_lastTextItalic );
623  textItem->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
624  textItem->SetFlags( IS_NEW | IS_MOVED );
625 
626  DIALOG_LABEL_EDITOR dlg( m_frame, textItem );
627 
628  if( dlg.ShowModal() != wxID_OK || textItem->GetText().IsEmpty() )
629  {
630  delete textItem;
631  return nullptr;
632  }
633 
634  if( aType != LAYER_NOTES )
635  {
636  UTF8 text( textItem->GetText() );
637  int brace_count = 0;
638  int bracket_count = 0;
639  bool last_space = false;
640  UTF8 token;
641 
642  for( auto chIt = text.ubegin(); chIt != text.uend(); chIt++ )
643  {
644  switch( *chIt )
645  {
646  case '{':
647  brace_count++;
648  last_space = false;
649  break;
650 
651  case '[':
652  bracket_count++;
653  last_space = false;
654  break;
655 
656  case '}':
657  brace_count = std::max( 0, brace_count - 1 );
658  last_space = false;
659  break;
660 
661  case ']':
662  bracket_count = std::max( 0, bracket_count - 1 );
663  last_space = false;
664  break;
665 
666  case ' ':
667  case '\n':
668  case '\r':
669  case '\t':
670  if( !token.empty() && bracket_count == 0 && brace_count == 0 )
671  {
672  std::unique_ptr<SCH_TEXT> nextitem( static_cast<SCH_TEXT*>( textItem->Clone() ) );
673  nextitem->SetText( token.wx_str() );
674  m_queuedTexts.push_back( std::move( nextitem ) );
675  token.clear();
676  continue;
677  }
678 
679  // Skip leading whitespace
680  if( token.empty() || last_space )
681  continue;
682 
683  last_space = true;
684  break;
685 
686  default:
687  last_space = false;
688  break;
689  }
690 
691  token += *chIt;
692  }
693 
694  if( !token.empty() )
695  {
696  std::unique_ptr<SCH_TEXT> nextitem( static_cast<SCH_TEXT*>( textItem->Clone() ) );
697  nextitem->SetText( token.wx_str() );
698  m_queuedTexts.push_back( std::move( nextitem ) );
699  }
700 
701  delete textItem;
702  textItem = getNextNewText();
703 
704  if( !textItem )
705  return nullptr;
706  }
707 
708  m_lastTextBold = textItem->IsBold();
709  m_lastTextItalic = textItem->IsItalic();
711 
712  if( textItem->Type() == SCH_GLOBAL_LABEL_T || textItem->Type() == SCH_HIER_LABEL_T )
713  m_lastGlobalLabelShape = textItem->GetShape();
714 
715  return textItem;
716 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
UTF8 is an 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to...
Definition: utf8.h:73
bool IsBold() const
Definition: eda_text.h:183
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:239
PINSHEETLABEL_SHAPE m_lastGlobalLabelShape
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:42
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:138
void SetItalic(bool isItalic)
Definition: eda_text.h:179
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:238
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
bool IsItalic() const
Definition: eda_text.h:180
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: sch_text.cpp:144
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
LABEL_SPIN_STYLE GetLabelSpinStyle() const
Definition: sch_text.h:232
SCH_TEXT * getNextNewText()
Gets the next queued text item.
wxString wx_str() const
Definition: utf8.cpp:51
std::deque< std::unique_ptr< SCH_TEXT > > m_queuedTexts
These settings were stored in SCH_BASE_FRAME previously.
LABEL_SPIN_STYLE m_lastTextOrientation
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:230
void clear()
Definition: utf8.h:113
void SetBold(bool aBold)
Definition: eda_text.h:182
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:127
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:237
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
bool empty() const
Definition: utf8.h:108
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References UTF8::clear(), SCH_TEXT::Clone(), DisplayError(), UTF8::empty(), SCH_TEXT::GetLabelSpinStyle(), getNextNewText(), SCH_TEXT::GetShape(), EDA_TEXT::GetText(), IS_MOVED, IS_NEW, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), LAYER_GLOBLABEL, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NOTES, SCHEMATIC_SETTINGS::m_DefaultTextSize, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, m_lastGlobalLabelShape, m_lastTextBold, m_lastTextItalic, m_lastTextOrientation, m_queuedTexts, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EDA_TEXT::SetBold(), EDA_ITEM::SetFlags(), EDA_TEXT::SetItalic(), SCH_TEXT::SetLabelSpinStyle(), EDA_ITEM::SetParent(), SCH_TEXT::SetShape(), EDA_TEXT::SetTextSize(), SCHEMATIC::Settings(), EDA_ITEM::Type(), and UTF8::wx_str().

Referenced by TwoClickPlace().

◆ DrawSheet()

int SCH_DRAWING_TOOLS::DrawSheet ( const TOOL_EVENT aEvent)

Definition at line 915 of file sch_drawing_tools.cpp.

916 {
918  SCH_SHEET* sheet = nullptr;
919 
921  getViewControls()->ShowCursor( true );
922 
923  std::string tool = aEvent.GetCommandStr().get();
924  m_frame->PushTool( tool );
925  Activate();
926 
927  // Prime the pump
928  if( aEvent.HasPosition() )
930 
931  // Main loop: keep receiving events
932  while( TOOL_EVENT* evt = Wait() )
933  {
934  if( !pointEditor->HasPoint() )
935  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
936 
937  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
938 
939  auto cleanup = [&] () {
941  m_view->ClearPreview();
942  delete sheet;
943  sheet = nullptr;
944  };
945 
946  if( evt->IsCancelInteractive() )
947  {
948  if( sheet )
949  cleanup();
950  else
951  {
952  m_frame->PopTool( tool );
953  break;
954  }
955  }
956  else if( evt->IsActivate() )
957  {
958  if( sheet )
959  cleanup();
960 
961  if( evt->IsPointEditor() )
962  {
963  // don't exit (the point editor runs in the background)
964  }
965  else if( evt->IsMoveTool() )
966  {
967  // leave ourselves on the stack so we come back after the move
968  break;
969  }
970  else
971  {
972  m_frame->PopTool( tool );
973  break;
974  }
975  }
976 
977  else if( evt->IsClick( BUT_LEFT ) && !sheet )
978  {
980 
982 
983  sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(),
984  static_cast<wxPoint>( cursorPos ) );
985  sheet->SetFlags( IS_NEW | IS_RESIZED );
986  sheet->SetScreen( NULL );
987  sheet->SetBorderWidth( cfg->m_Drawing.default_line_thickness );
988  sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color );
989  sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
990  sheet->GetFields()[ SHEETNAME ].SetText( "Untitled Sheet" );
991  sheet->GetFields()[ SHEETFILENAME ].SetText( "untitled.kicad_sch" );
992  sizeSheet( sheet, cursorPos );
993 
994  m_view->ClearPreview();
995  m_view->AddToPreview( sheet->Clone() );
996  }
997 
998  else if( sheet && ( evt->IsClick( BUT_LEFT )
999  || evt->IsAction( &EE_ACTIONS::finishSheet ) ) )
1000  {
1001  m_view->ClearPreview();
1002  getViewControls()->SetAutoPan( false );
1003  getViewControls()->CaptureCursor( false );
1004 
1005  if( m_frame->EditSheetProperties( static_cast<SCH_SHEET*>( sheet ),
1006  &m_frame->GetCurrentSheet(), nullptr ) )
1007  {
1008  sheet->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
1009 
1010  m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), sheet, false );
1012  m_selectionTool->AddItemToSel( sheet );
1013  }
1014  else
1015  {
1016  delete sheet;
1017  }
1018 
1019  sheet = nullptr;
1020  }
1021 
1022  else if( sheet && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
1023  {
1024  sizeSheet( sheet, cursorPos );
1025  m_view->ClearPreview();
1026  m_view->AddToPreview( sheet->Clone() );
1027  }
1028 
1029  else if( evt->IsClick( BUT_RIGHT ) )
1030  {
1031  // Warp after context menu only if dragging...
1032  if( !sheet )
1034 
1036  }
1037  else
1038  evt->SetPassEvent();
1039 
1040  // Enable autopanning and cursor capture only when there is a sheet to be placed
1041  getViewControls()->SetAutoPan( sheet != nullptr );
1042  getViewControls()->CaptureCursor( sheet != nullptr );
1043  }
1044 
1045  return 0;
1046 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
static TOOL_ACTION finishSheet
Definition: ee_actions.h:98
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1578
bool HasPoint()
Indicates the cursor is over an edit point.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
#define NULL
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces 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.
TOOL_EVENT.
Definition: tool_event.h:171
void ClearPreview()
Definition: view.cpp:1566
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
int AddItemToSel(const TOOL_EVENT &aEvent)
EE_POINT_EDITOR.
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:408
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118
bool EditSheetProperties(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aClearAnnotationNewItems)
Edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:465
void Activate()
Function Activate() Runs the tool.
SCH_SHEET_PATH & GetCurrentSheet() const
bool HasPosition() const
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:260
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION refreshPreview
Definition: actions.h:102
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:119
void sizeSheet(SCH_SHEET *aSheet, VECTOR2I aPos)

References TOOL_INTERACTIVE::Activate(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, ACTIONS::cursorClick, EESCHEMA_SETTINGS::DRAWING::default_line_thickness, EESCHEMA_SETTINGS::DRAWING::default_sheet_background_color, EESCHEMA_SETTINGS::DRAWING::default_sheet_border_color, SCH_EDIT_FRAME::EditSheetProperties(), SCH_BASE_FRAME::eeconfig(), EE_ACTIONS::finishSheet, SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), TOOL_BASE::getViewControls(), EE_POINT_EDITOR::HasPoint(), TOOL_EVENT::HasPosition(), IS_NEW, IS_RESIZED, SCH_SHEET_PATH::Last(), EESCHEMA_SETTINGS::m_Drawing, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MD_ALT, NULL, TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), SHEETFILENAME, SHEETNAME, TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), sizeSheet(), SCH_EDIT_FRAME::UpdateHierarchyNavigator(), TOOL_MANAGER::VetoContextMenuMouseWarp(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ 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 187 of file tool_base.h.

188  {
189 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
190  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
191 #endif
192  return static_cast<T*>( getToolHolderInt() );
193  }
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

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

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

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

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

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

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

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

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

References TOOL_BASE::m_toolName.

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

◆ getNextNewText()

SCH_TEXT * SCH_DRAWING_TOOLS::getNextNewText ( )
private

Gets the next queued text item.

Returns
next SCH_TEXT* or nullptr if empty

Definition at line 574 of file sch_drawing_tools.cpp.

575 {
576  if( m_queuedTexts.empty() )
577  return nullptr;
578 
579  auto next_text = std::move( m_queuedTexts.front() );
580  m_queuedTexts.pop_front();
581 
582  return next_text.release();
583 }
std::deque< std::unique_ptr< SCH_TEXT > > m_queuedTexts

References m_queuedTexts.

Referenced by createNewText(), and TwoClickPlace().

◆ GetToolMenu()

◆ 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 110 of file tool_base.h.

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

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

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

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

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::checkPart(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), 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(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), 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 42 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), PlaceComponent(), PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_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(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_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 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
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 LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), POINT_EDITOR::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), PAD_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRC::setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool SCH_DRAWING_TOOLS::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 59 of file sch_drawing_tools.cpp.

60 {
62 
63  auto belowRootSheetCondition =
64  [&]( const SELECTION& aSel )
65  {
66  return m_frame->GetCurrentSheet().Last() != &m_frame->Schematic().Root();
67  };
68 
69  auto& ctxMenu = m_menu.GetMenu();
70  ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
71 
72  return true;
73 }
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:177
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:69
SCHEMATIC & Schematic() const
SCH_SHEET & Root() const
Definition: schematic.h:97
SCH_SHEET_PATH & GetCurrentSheet() const
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()

References CONDITIONAL_MENU::AddItem(), SCH_EDIT_FRAME::GetCurrentSheet(), TOOL_MENU::GetMenu(), EE_TOOL_BASE< T >::Init(), SCH_SHEET_PATH::Last(), EE_ACTIONS::leaveSheet, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, SCHEMATIC::Root(), and SCH_EDIT_FRAME::Schematic().

◆ 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
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.

Referenced by EDIT_TOOL::isRouterActive(), and ROUTER_TOOL::onViaCommand().

◆ PlaceComponent()

int SCH_DRAWING_TOOLS::PlaceComponent ( const TOOL_EVENT aEvent)

Definition at line 76 of file sch_drawing_tools.cpp.

77 {
78  SCH_COMPONENT* component = aEvent.Parameter<SCH_COMPONENT*>();
79  SCHLIB_FILTER filter;
80  std::vector<COMPONENT_SELECTION>* historyList = nullptr;
81 
82  if( aEvent.IsAction( &EE_ACTIONS::placeSymbol ) )
83  historyList = &m_symbolHistoryList;
84  else if (aEvent.IsAction( &EE_ACTIONS::placePower ) )
85  {
86  historyList = &m_powerHistoryList;
87  filter.FilterPowerParts( true );
88  }
89  else
90  wxFAIL_MSG( "PlaceCompontent(): unexpected request" );
91 
92  getViewControls()->ShowCursor( true );
93 
94  // If a component was passed in get it ready for placement.
95  if( component )
96  {
97  component->SetFlags( IS_NEW | IS_MOVED );
98 
100  m_selectionTool->AddItemToSel( component );
101  }
102 
103  std::string tool = aEvent.GetCommandStr().get();
104  m_frame->PushTool( tool );
105  Activate();
106 
107  // Prime the pump
108  if( component )
109  {
110  getViewControls()->WarpCursor( getViewControls()->GetMousePosition( false ) );
112  }
113  else if( aEvent.HasPosition() )
115 
116  // Main loop: keep receiving events
117  while( TOOL_EVENT* evt = Wait() )
118  {
119  m_frame->GetCanvas()->SetCurrentCursor( component ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
120  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
121 
122  auto cleanup = [&] () {
124  m_view->ClearPreview();
125  delete component;
126  component = nullptr;
127  };
128 
129  if( evt->IsCancelInteractive() )
130  {
131  if( component )
132  cleanup();
133  else
134  {
135  m_frame->PopTool( tool );
136  break;
137  }
138  }
139  else if( evt->IsActivate() )
140  {
141  if( component )
142  cleanup();
143 
144  if( evt->IsMoveTool() )
145  {
146  // leave ourselves on the stack so we come back after the move
147  break;
148  }
149  else
150  {
151  m_frame->PopTool( tool );
152  break;
153  }
154  }
155  else if( evt->IsClick( BUT_LEFT ) )
156  {
157  if( !component )
158  {
160 
161  // Pick the module to be placed
162  bool footprintPreviews = m_frame->eeconfig()->m_Appearance.footprint_preview;
163  COMPONENT_SELECTION sel = m_frame->SelectCompFromLibTree( &filter, *historyList,
164  true, 1, 1,
165  footprintPreviews );
166 
167  // Restore cursor after dialog
168  getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
169 
170  LIB_PART* part = sel.LibId.IsValid() ? m_frame->GetLibPart( sel.LibId ) : nullptr;
171 
172  if( !part )
173  continue;
174 
175  component = new SCH_COMPONENT(
176  *part, &m_frame->GetCurrentSheet(), sel, (wxPoint) cursorPos );
177  component->SetParent( m_frame->GetCurrentSheet().LastScreen() );
178  component->SetFlags( IS_NEW | IS_MOVED );
179 
181  component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
182 
183  m_frame->SaveCopyForRepeatItem( component );
184 
185  m_view->ClearPreview();
186  m_view->AddToPreview( component->Clone() );
187  m_selectionTool->AddItemToSel( component );
188  }
189  else
190  {
191  SCH_COMPONENT* next_comp = nullptr;
192 
193  m_view->ClearPreview();
194  m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), component, false );
195 
196  EE_SELECTION new_sel;
197  new_sel.Add( component );
198 
200  m_frame->OnModify();
201 
204  {
205  int new_unit = component->GetUnit();
206 
208  && component->GetUnit() < component->GetUnitCount() )
209  new_unit++;
210  else
211  new_unit = 1;
212 
213  // We are either stepping to the next unit or next component
214  if( m_frame->eeconfig()->m_SymChooserPanel.keep_symbol || new_unit > 1 )
215  {
216  // Deselect the last placed symbol: obviously we do not want to
217  // apply some changes (like rotation, mirror...) to previously placed
218  // symbols.
220 
221  next_comp = static_cast<SCH_COMPONENT*>( component->Duplicate() );
222  next_comp->SetFlags( IS_NEW | IS_MOVED );
223  next_comp->SetUnit( new_unit );
224  next_comp->SetUnitSelection( &m_frame->GetCurrentSheet(), new_unit );
225 
227  component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
228 
229  m_frame->SaveCopyForRepeatItem( next_comp );
230  m_view->AddToPreview( next_comp->Clone() );
231  m_selectionTool->AddItemToSel( next_comp );
232  }
233  }
234 
235  component = next_comp;
236  }
237  }
238  else if( evt->IsClick( BUT_RIGHT ) )
239  {
240  // Warp after context menu only if dragging...
241  if( !component )
243 
245  }
246  else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
247  {
248  if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
249  && evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_CMP_MAX )
250  {
251  int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
252 
253  if( component )
254  {
255  m_frame->SelectUnit( component, unit );
257  }
258  }
259  }
260  else if( component && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
261  {
262  component->SetPosition( (wxPoint)cursorPos );
263  m_view->ClearPreview();
264  m_view->AddToPreview( component->Clone() );
265  }
266  else
267  evt->SetPassEvent();
268 
269  // Enable autopanning and cursor capture only when there is a module to be placed
270  getViewControls()->SetAutoPan( component != nullptr );
271  getViewControls()->CaptureCursor( component != nullptr );
272  }
273 
274  return 0;
275 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
std::vector< COMPONENT_SELECTION > m_symbolHistoryList
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1578
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
int GetUnitCount() const
Return the number of units per package of the symbol.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void SetPosition(const wxPoint &aPosition) override
Set the schematic item position to aPosition.
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
std::vector< COMPONENT_SELECTION > m_powerHistoryList
bool IsValid() const
Definition: lib_id.h:171
PANEL_SYM_CHOOSER m_SymChooserPanel
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:76
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
int GetUnit() const
AUTOPLACE_FIELDS m_AutoplaceFields
static TOOL_ACTION placePower
Definition: ee_actions.h:78
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:81
#define NULL
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
TOOL_EVENT.
Definition: tool_event.h:171
void ClearPreview()
Definition: view.cpp:1566
Define a library symbol object.
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
void SetUnit(int aUnit)
Change the unit number to aUnit.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:77
static TOOL_ACTION addNeededJunctions
Definition: ee_actions.h:75
COMPONENT_SELECTION SelectCompFromLibTree(const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Function SelectComponentFromLib Calls the library viewer to select component to import into schematic...
Definition: getpart.cpp:89
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
void SelectUnit(SCH_COMPONENT *aComponent, int aUnit)
Definition: getpart.cpp:196
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
int AddItemToSel(const TOOL_EVENT &aEvent)
SCH_SCREEN * LastScreen()
Function LastScreen.
int ClearSelection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:408
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the component.
Schematic symbol object.
Definition: sch_component.h:88
void Activate()
Function Activate() Runs the tool.
SCH_SHEET_PATH & GetCurrentSheet() const
bool HasPosition() const
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:260
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION refreshPreview
Definition: actions.h:102
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:119
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References TOOL_INTERACTIVE::Activate(), SELECTION::Add(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), EE_SELECTION_TOOL::AddItemToSel(), EE_ACTIONS::addNeededJunctions, KIGFX::VIEW::AddToPreview(), SCH_COMPONENT::AutoplaceFields(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, EE_SELECTION_TOOL::ClearSelection(), SCH_COMPONENT::Clone(), ACTIONS::cursorClick, SCH_ITEM::Duplicate(), SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, EESCHEMA_SETTINGS::APPEARANCE::footprint_preview, SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), SCH_EDIT_FRAME::GetCurrentSheet(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_BASE_FRAME::GetLibPart(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT_CMP_MAX, IS_MOVED, IS_NEW, TOOL_EVENT::IsAction(), LIB_ID::IsValid(), EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::keep_symbol, SCH_SHEET_PATH::LastScreen(), COMPONENT_SELECTION::LibId, EESCHEMA_SETTINGS::m_Appearance, EESCHEMA_SETTINGS::m_AutoplaceFields, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, m_powerHistoryList, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, m_symbolHistoryList, EESCHEMA_SETTINGS::m_SymChooserPanel, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MD_ALT, NULL, SCH_EDIT_FRAME::OnModify(), TOOL_EVENT::Parameter(), EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::place_all_units, EE_ACTIONS::placePower, EE_ACTIONS::placeSymbol, TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_BASE_FRAME::SelectCompFromLibTree(), SCH_EDIT_FRAME::SelectUnit(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), EDA_ITEM::SetParent(), SCH_COMPONENT::SetPosition(), SCH_COMPONENT::SetUnit(), SCH_COMPONENT::SetUnitSelection(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TA_CHOICE_MENU_CHOICE, TC_COMMAND, TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpCursor().

Referenced by setTransitions().

◆ PlaceImage()

int SCH_DRAWING_TOOLS::PlaceImage ( const TOOL_EVENT aEvent)

Definition at line 278 of file sch_drawing_tools.cpp.

279 {
280  SCH_BITMAP* image = aEvent.Parameter<SCH_BITMAP*>();
281  bool immediateMode = image;
282  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
283 
285  getViewControls()->ShowCursor( true );
286 
287  // Add all the drawable parts to preview
288  if( image )
289  {
290  image->SetPosition( (wxPoint)cursorPos );
291  m_view->ClearPreview();
292  m_view->AddToPreview( image->Clone() );
293  }
294 
295  std::string tool = aEvent.GetCommandStr().get();
296  m_frame->PushTool( tool );
297  Activate();
298 
299  // Prime the pump
300  if( image )
302  else if( aEvent.HasPosition() )
304 
305  // Main loop: keep receiving events
306  while( TOOL_EVENT* evt = Wait() )
307  {
308  m_frame->GetCanvas()->SetCurrentCursor( image ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
309  cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
310 
311  auto cleanup = [&] () {
313  m_view->ClearPreview();
314  delete image;
315  image = nullptr;
316  };
317 
318  if( evt->IsCancelInteractive() )
319  {
320  if( image )
321  cleanup();
322  else
323  {
324  m_frame->PopTool( tool );
325  break;
326  }
327 
328  if( immediateMode )
329  {
330  m_frame->PopTool( tool );
331  break;
332  }
333  }
334  else if( evt->IsActivate() )
335  {
336  if( image )
337  cleanup();
338 
339  if( evt->IsMoveTool() )
340  {
341  // leave ourselves on the stack so we come back after the move
342  break;
343  }
344  else
345  {
346  m_frame->PopTool( tool );
347  break;
348  }
349  }
350  else if( evt->IsClick( BUT_LEFT ) )
351  {
352  if( !image )
353  {
355  wxFileDialog dlg( m_frame, _( "Choose Image" ), wxEmptyString, wxEmptyString,
356  _( "Image Files " ) + wxImage::GetImageExtWildcard(), wxFD_OPEN );
357 
358  if( dlg.ShowModal() != wxID_OK )
359  continue;
360 
361  // Restore cursor after dialog
362  getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
363 
364  wxString fullFilename = dlg.GetPath();
365 
366  if( wxFileExists( fullFilename ) )
367  image = new SCH_BITMAP( (wxPoint)cursorPos );
368 
369  if( !image || !image->ReadImageFile( fullFilename ) )
370  {
371  wxMessageBox( _( "Couldn't load image from \"%s\"" ), fullFilename );
372  delete image;
373  image = nullptr;
374  continue;
375  }
376 
377  image->SetFlags( IS_NEW | IS_MOVED );
378 
379  m_frame->SaveCopyForRepeatItem( image );
380 
381  m_view->ClearPreview();
382  m_view->AddToPreview( image->Clone() );
383  m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
384 
385  m_selectionTool->AddItemToSel( image );
386 
387  getViewControls()->SetCursorPosition( cursorPos, false );
388  }
389  else
390  {
392  image = nullptr;
394 
395  m_view->ClearPreview();
396 
397  if( immediateMode )
398  {
399  m_frame->PopTool( tool );
400  break;
401  }
402  }
403  }
404  else if( evt->IsClick( BUT_RIGHT ) )
405  {
406  // Warp after context menu only if dragging...
407  if( !image )
409 
411  }
412  else if( image && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
413  {
414  image->SetPosition( (wxPoint)cursorPos );
415  m_view->ClearPreview();
416  m_view->AddToPreview( image->Clone() );
417  m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
418  }
419  else
420  evt->SetPassEvent();
421 
422  // Enable autopanning and cursor capture only when there is a module to be placed
423  getViewControls()->SetAutoPan( image != nullptr );
424  getViewControls()->CaptureCursor( image != nullptr );
425  }
426 
427  return 0;
428 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
static TOOL_ACTION activatePointEditor
Definition: actions.h:164
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1578
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1406
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Moves cursor to the requested position expressed in world coordinates.
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT.
Definition: tool_event.h:171
void ClearPreview()
Definition: view.cpp:1566
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:42
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
int AddItemToSel(const TOOL_EVENT &aEvent)
#define _(s)
Definition: 3d_actions.cpp:33
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:408
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: sch_bitmap.cpp:89
void Activate()
Function Activate() Runs the tool.
bool ReadImageFile(const wxString &aFullFilename)
Reads and stores an image file.
Definition: sch_bitmap.cpp:83
bool HasPosition() const
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:260
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
void SetPosition(const wxPoint &aPosition) override
Set the schematic item position to aPosition.
Definition: sch_bitmap.h:141
static TOOL_ACTION refreshPreview
Definition: actions.h:102
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
Definition: actions.h:119
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References _, TOOL_INTERACTIVE::Activate(), ACTIONS::activatePointEditor, SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, SCH_BITMAP::Clone(), ACTIONS::cursorClick, SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), IS_MOVED, IS_NEW, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MD_ALT, TOOL_EVENT::Parameter(), TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), SCH_BITMAP::ReadImageFile(), KIGFX::VIEW::RecacheAllItems(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), EDA_ITEM::SetFlags(), SCH_BITMAP::SetPosition(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpCursor().

Referenced by setTransitions().

◆ Reset()

void EE_TOOL_BASE< SCH_EDIT_FRAME >::Reset ( RESET_REASON  aReason)
inlineoverridevirtualinherited

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 90 of file ee_tool_base.h.

91  {
92  if( aReason == MODEL_RELOAD )
93  {
94  // Init variables used by every drawing tool
95  m_frame = getEditFrame<T>();
96  m_isLibEdit = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ) != nullptr;
97  }
98 
99  m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
100  }
Model changes (required full reload)
Definition: tool_base.h:82
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36

◆ 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 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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_EDIT_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 117 of file ee_tool_base.h.

118  {
119  KICAD_T itemType = aItem->Type();
120  bool selected = aItem->IsSelected();
121 
122  // IS_SELECTED flag should not be set on undo items which were added for
123  // a drag operation.
124  if( selected && aItem->HasFlag( TEMP_SELECTED ))
125  aItem->ClearSelected();
126 
127  if( m_isLibEdit )
128  {
129  LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
130  wxASSERT( editFrame );
131 
132  editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
133  }
134  else
135  {
136  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
137  wxASSERT( editFrame );
138 
139  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
140  {
141  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
142  static_cast<SCH_ITEM*>( aItem->GetParent() ),
143  UR_CHANGED, aAppend );
144  }
145  else
146  {
147  editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
148  static_cast<SCH_ITEM*>( aItem ),
149  aType, aAppend );
150  }
151  }
152 
153  if( selected && aItem->HasFlag( TEMP_SELECTED ) )
154  aItem->SetSelected();
155  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
bool IsSelected() const
Definition: base_struct.h:203
void ClearSelected()
Definition: base_struct.h:211
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
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetSelected()
Definition: base_struct.h:208
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
The symbol library editor main window.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
bool HasFlag(STATUS_FLAGS aFlag)
Definition: base_struct.h:235
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:193

◆ 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 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:219
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(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void SCH_DRAWING_TOOLS::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 1062 of file sch_drawing_tools.cpp.

1063 {
1076 }
int TwoClickPlace(const TOOL_EVENT &aEvent)
int PlaceComponent(const TOOL_EVENT &aEvent)
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:87
static TOOL_ACTION placeJunction
Definition: ee_actions.h:83
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:84
int PlaceImage(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 TOOL_ACTION drawSheet
Definition: ee_actions.h:88
static TOOL_ACTION placePower
Definition: ee_actions.h:78
int SingleClickPlace(const TOOL_EVENT &aEvent)
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:91
static TOOL_ACTION placeImage
Definition: ee_actions.h:93
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:90
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:77
static TOOL_ACTION placeLabel
Definition: ee_actions.h:85
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:82
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:86
int DrawSheet(const TOOL_EVENT &aEvent)

References DrawSheet(), EE_ACTIONS::drawSheet, TOOL_INTERACTIVE::Go(), EE_ACTIONS::importSheetPin, EE_ACTIONS::placeBusWireEntry, PlaceComponent(), EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, PlaceImage(), EE_ACTIONS::placeImage, EE_ACTIONS::placeJunction, EE_ACTIONS::placeLabel, EE_ACTIONS::placeNoConnect, EE_ACTIONS::placePower, EE_ACTIONS::placeSchematicText, EE_ACTIONS::placeSymbol, SingleClickPlace(), and TwoClickPlace().

◆ SingleClickPlace()

int SCH_DRAWING_TOOLS::SingleClickPlace ( const TOOL_EVENT aEvent)

Definition at line 431 of file sch_drawing_tools.cpp.

432 {
433  wxPoint cursorPos;
434  KICAD_T type = aEvent.Parameter<KICAD_T>();
435 
436  if( type == SCH_JUNCTION_T && aEvent.HasPosition() )
437  {
438  EE_SELECTION& selection = m_selectionTool->GetSelection();
439  SCH_LINE* wire = dynamic_cast<SCH_LINE*>( selection.Front() );
440 
441  if( wire )
442  {
443  SEG seg( wire->GetStartPoint(), wire->GetEndPoint() );
444  VECTOR2I nearest = seg.NearestPoint( getViewControls()->GetCursorPosition() );
445  getViewControls()->SetCrossHairCursorPosition( nearest, false );
446  getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
447  }
448  }
449 
451  getViewControls()->ShowCursor( true );
452  getViewControls()->SetSnapping( true );
453 
454  SCH_ITEM* previewItem;
455  switch( type )
456  {
457  case SCH_NO_CONNECT_T:
458  previewItem = new SCH_NO_CONNECT( cursorPos );
459  break;
460  case SCH_JUNCTION_T:
461  previewItem = new SCH_JUNCTION( cursorPos );
462  break;
464  previewItem = new SCH_BUS_WIRE_ENTRY( cursorPos );
465  break;
466  default:
467  wxASSERT_MSG( false, "Unknown item type in SCH_DRAWING_TOOLS::SingleClickPlace" );
468  return 0;
469  }
470 
471  previewItem->SetParent( m_frame->GetScreen() );
472 
473  m_view->ClearPreview();
474  m_view->AddToPreview( previewItem->Clone() );
475 
476  std::string tool = aEvent.GetCommandStr().get();
477  m_frame->PushTool( tool );
478  Activate();
479 
480  // Prime the pump
481  if( aEvent.HasPosition() )
483 
484  // Main loop: keep receiving events
485  while( TOOL_EVENT* evt = Wait() )
486  {
487  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
488  cursorPos = (wxPoint) getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
489 
490  if( evt->IsCancelInteractive() )
491  {
492  m_frame->PopTool( tool );
493  break;
494  }
495  else if( evt->IsActivate() )
496  {
497  if( evt->IsMoveTool() )
498  {
499  // leave ourselves on the stack so we come back after the move
500  break;
501  }
502  else
503  {
504  m_frame->PopTool( tool );
505  break;
506  }
507  }
508  else if( evt->IsClick( BUT_LEFT ) )
509  {
510  if( !m_frame->GetScreen()->GetItem( cursorPos, 0, type ) )
511  {
512  if( type == SCH_JUNCTION_T )
513  m_frame->AddJunction( m_frame->GetScreen(), cursorPos, false );
514  else
515  {
516  SCH_ITEM* newItem = static_cast<SCH_ITEM*>( previewItem->Clone() );
517  newItem->SetPosition( cursorPos );
518  newItem->SetFlags( IS_NEW );
519 
520  m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), newItem, false );
521  m_frame->SaveCopyForRepeatItem( newItem );
522 
524  m_frame->OnModify();
525  }
526  }
527  }
528  else if( evt->IsClick( BUT_RIGHT ) )
529  {
531  }
532  else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
533  {
534  previewItem->SetPosition( (wxPoint)cursorPos );
535  m_view->ClearPreview();
536  m_view->AddToPreview( previewItem->Clone() );
537  }
538  else if( evt->Category() == TC_COMMAND )
539  {
540  if( ( type == SCH_BUS_WIRE_ENTRY_T )
541  && ( evt->IsAction( &EE_ACTIONS::rotateCW )
542  || evt->IsAction( &EE_ACTIONS::rotateCCW )
543  || evt->IsAction( &EE_ACTIONS::mirrorX )
544  || evt->IsAction( &EE_ACTIONS::mirrorY ) ) )
545  {
546  SCH_BUS_ENTRY_BASE* busItem = static_cast<SCH_BUS_ENTRY_BASE*>( previewItem );
547 
548  // The bus entries only rotate in one direction
549  if( evt->IsAction( &EE_ACTIONS::rotateCW )
550  || evt->IsAction( &EE_ACTIONS::rotateCCW ) )
551  busItem->Rotate( busItem->GetPosition() );
552  else if( evt->IsAction( &EE_ACTIONS::mirrorX ) )
553  busItem->MirrorX( busItem->GetPosition().x );
554  else if( evt->IsAction( &EE_ACTIONS::mirrorY ) )
555  busItem->MirrorY( busItem->GetPosition().y );
556 
557  m_view->ClearPreview();
558  m_view->AddToPreview( previewItem->Clone() );
559  }
560  }
561  else
562  evt->SetPassEvent();
563  }
564 
565  delete previewItem;
566  m_view->ClearPreview();
567 
568  return 0;
569 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
wxPoint GetStartPoint() const
Definition: sch_line.h:94
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1578
static TOOL_ACTION mirrorY
Definition: ee_actions.h:119
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
static TOOL_ACTION rotateCW
Definition: ee_actions.h:116
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, bool aFinal=true)
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:43
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:117
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
virtual void SetPosition(const wxPoint &aPosition)=0
Set the schematic item position to aPosition.
virtual void PopTool(const std::string &actionName)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT.
Definition: tool_event.h:171
void ClearPreview()
Definition: view.cpp:1566
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
static TOOL_ACTION mirrorX
Definition: ee_actions.h:118
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
Definition: seg.h:39
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
void MirrorX(int aXaxis_position) override
Mirror item relative to the X axis about aXaxis_position.
Class for a wire to bus entry.
void Activate()
Function Activate() Runs the tool.
SCH_ITEM * GetItem(const wxPoint &aPosition, int aAccuracy=0, KICAD_T aType=SCH_LOCATE_ANY_T)
Check aPosition within a distance of aAccuracy for items of type aFilter.
Definition: sch_screen.cpp:309
bool HasPosition() const
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:260
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void MirrorY(int aYaxis_position) override
Mirror item relative to the Y axis about aYaxis_position.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION refreshPreview
Definition: actions.h:102
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:184
static TOOL_ACTION cursorClick
Definition: actions.h:119
wxPoint GetPosition() const override
wxPoint GetEndPoint() const
Definition: sch_line.h:97

References TOOL_INTERACTIVE::Activate(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_EDIT_FRAME::AddJunction(), KIGFX::VIEW::AddToPreview(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), ACTIONS::cursorClick, SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SCH_LINE::GetEndPoint(), SCH_SCREEN::GetItem(), SCH_BUS_ENTRY_BASE::GetPosition(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SCH_LINE::GetStartPoint(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), IS_NEW, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MD_ALT, SCH_BUS_ENTRY_BASE::MirrorX(), EE_ACTIONS::mirrorX, SCH_BUS_ENTRY_BASE::MirrorY(), EE_ACTIONS::mirrorY, SCH_EDIT_FRAME::OnModify(), TOOL_EVENT::Parameter(), TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, SCH_BUS_ENTRY_BASE::Rotate(), EE_ACTIONS::rotateCCW, EE_ACTIONS::rotateCW, TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), SCH_BUS_WIRE_ENTRY_T, SCH_JUNCTION_T, SCH_NO_CONNECT_T, SCH_EDIT_FRAME::SchematicCleanUp(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), EDA_ITEM::SetParent(), SCH_ITEM::SetPosition(), KIGFX::VIEW_CONTROLS::SetSnapping(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TC_COMMAND, TOOL_INTERACTIVE::Wait(), KIGFX::VIEW_CONTROLS::WarpCursor(), wxPoint::x, and wxPoint::y.

Referenced by setTransitions().

◆ sizeSheet()

void SCH_DRAWING_TOOLS::sizeSheet ( SCH_SHEET aSheet,
VECTOR2I  aPos 
)
private

Definition at line 1049 of file sch_drawing_tools.cpp.

1050 {
1051  wxPoint pos = aSheet->GetPosition();
1052  wxPoint size = (wxPoint) aPos - pos;
1053 
1054  size.x = std::max( size.x, MIN_SHEET_WIDTH );
1055  size.y = std::max( size.y, MIN_SHEET_HEIGHT );
1056 
1057  wxPoint grid = m_frame->GetNearestGridPosition( pos + size );
1058  aSheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
1059 }
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:42
wxPoint GetPosition() const override
Definition: sch_sheet.h:570
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:43
void Resize(const wxSize &aSize)
Resize this sheet to aSize and adjust all of the labels accordingly.
Definition: sch_sheet.cpp:800

References EDA_DRAW_FRAME::GetNearestGridPosition(), SCH_SHEET::GetPosition(), EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, MIN_SHEET_HEIGHT, MIN_SHEET_WIDTH, SCH_SHEET::Resize(), wxPoint::x, and wxPoint::y.

Referenced by DrawSheet().

◆ TwoClickPlace()

int SCH_DRAWING_TOOLS::TwoClickPlace ( const TOOL_EVENT aEvent)

Definition at line 719 of file sch_drawing_tools.cpp.

720 {
721  EDA_ITEM* item = nullptr;
722  bool importMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
723  KICAD_T type = aEvent.Parameter<KICAD_T>();
724 
726  getViewControls()->ShowCursor( true );
727 
728  std::string tool = aEvent.GetCommandStr().get();
729  m_frame->PushTool( tool );
730  Activate();
731 
732  // Prime the pump
733  if( aEvent.HasPosition() )
735 
736  // Main loop: keep receiving events
737  while( TOOL_EVENT* evt = Wait() )
738  {
739  m_frame->GetCanvas()->SetCurrentCursor( item ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
740  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
741 
742  auto cleanup = [&] () {
744  m_view->ClearPreview();
745  delete item;
746  item = nullptr;
747  };
748 
749  if( evt->IsCancelInteractive() )
750  {
751  if( item )
752  cleanup();
753  else
754  {
755  m_frame->PopTool( tool );
756  break;
757  }
758  }
759  else if( evt->IsActivate() )
760  {
761  if( item )
762  cleanup();
763 
764  if( evt->IsPointEditor() )
765  {
766  // don't exit (the point editor runs in the background)
767  }
768  else if( evt->IsMoveTool() )
769  {
770  // leave ourselves on the stack so we come back after the move
771  break;
772  }
773  else
774  {
775  m_frame->PopTool( tool );
776  break;
777  }
778  }
779  else if( evt->IsClick( BUT_LEFT ) )
780  {
781  // First click creates...
782  if( !item )
783  {
785 
786  switch( type )
787  {
788  case SCH_LABEL_T:
789  item = createNewText( cursorPos, LAYER_LOCLABEL );
790  break;
791  case SCH_HIER_LABEL_T:
792  item = createNewText( cursorPos, LAYER_HIERLABEL );
793  break;
794  case SCH_GLOBAL_LABEL_T:
795  item = createNewText( cursorPos, LAYER_GLOBLABEL );
796  break;
797  case SCH_TEXT_T:
798  item = createNewText( cursorPos, LAYER_NOTES );
799  break;
800  case SCH_SHEET_PIN_T:
801  {
802  SCH_HIERLABEL* label = nullptr;
803  SCH_SHEET* sheet = nullptr;
804 
805  if( m_selectionTool->SelectPoint( cursorPos, EE_COLLECTOR::SheetsOnly, &item ) )
806  sheet = dynamic_cast<SCH_SHEET*>( item );
807 
808  item = nullptr;
809 
810  if( !sheet )
811  {
812  m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
813  m_statusPopup->SetText( _( "Click over a sheet." ) );
814  m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
815  m_statusPopup->PopupFor( 2000 );
816  break;
817  }
818 
819  if( importMode )
820  {
821  label = m_frame->ImportHierLabel( sheet );
822 
823  if( !label )
824  {
825  m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
826  m_statusPopup->SetText( _( "No new hierarchical labels found." ) );
827  m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
828  m_statusPopup->PopupFor( 2000 );
829  break;
830  }
831  }
832 
833  item = m_frame->CreateSheetPin( sheet, label );
834  break;
835  }
836  default:
837  break;
838  }
839 
840  // Restore cursor after dialog
841  getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
842 
843  if( item )
844  {
845  item->SetFlags( IS_NEW | IS_MOVED );
846  m_view->ClearPreview();
847  m_view->AddToPreview( item->Clone() );
848  m_selectionTool->AddItemToSel( item );
849  }
850 
851  getViewControls()->SetCursorPosition( cursorPos, false );
852  }
853 
854  // ... and second click places:
855  else
856  {
857  item->ClearFlags( IS_MOVED );
859  item = getNextNewText();
860 
861  if( item )
862  {
864  item->SetFlags( IS_NEW | IS_MOVED );
865  m_view->ClearPreview();
866  m_view->AddToPreview( item->Clone() );
867  m_selectionTool->AddItemToSel( item );
868  }
869  else
870  {
871  m_view->ClearPreview();
872  }
873  }
874  }
875  else if( evt->IsClick( BUT_RIGHT ) )
876  {
877  // Warp after context menu only if dragging...
878  if( !item )
880 
882  }
883  else if( item && evt->IsSelectionEvent() )
884  {
885  // This happens if our text was replaced out from under us by ConvertTextType()
886  EE_SELECTION& selection = m_selectionTool->GetSelection();
887 
888  if( selection.GetSize() == 1 )
889  {
890  item = (SCH_ITEM*) selection.Front();
891  m_view->ClearPreview();
892  m_view->AddToPreview( item->Clone() );
893  }
894  else
895  item = nullptr;
896  }
897  else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
898  {
899  static_cast<SCH_ITEM*>( item )->SetPosition( (wxPoint) cursorPos );
900  m_view->ClearPreview();
901  m_view->AddToPreview( item->Clone() );
902  }
903  else
904  evt->SetPassEvent();
905 
906  // Enable autopanning and cursor capture only when there is a module to be placed
907  getViewControls()->SetAutoPan( item != nullptr );
908  getViewControls()->CaptureCursor( item != nullptr );
909  }
910 
911  return 0;
912 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
Definition: view.cpp:1578
STATUS_TEXT_POPUP.
Definition: status_popup.h:79
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Moves cursor to the requested position expressed in world coordinates.
static const KICAD_T SheetsOnly[]
Definition: ee_collectors.h:48
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
EE_SELECTION & GetSelection()
Function GetSelection()
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT.
Definition: tool_event.h:171
void ClearPreview()
Definition: view.cpp:1566
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:160
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:90
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:100
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
SCH_TEXT * getNextNewText()
Gets the next queued text item.
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
SCH_HIERLABEL * ImportHierLabel(SCH_SHEET *aSheet)
Import a hierarchical label with no attached sheet pin.
Definition: sheet.cpp:520
int AddItemToSel(const TOOL_EVENT &aEvent)
bool SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
Function SelectPoint() Selects one or all items pointed by the parameter aWhere.
#define _(s)
Definition: 3d_actions.cpp:33
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:408
SCH_TEXT * createNewText(const VECTOR2I &aPosition, int aType)
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
void Activate()
Function Activate() Runs the tool.
bool HasPosition() const
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:260
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
SCH_SHEET_PIN * CreateSheetPin(SCH_SHEET *aSheet, SCH_HIERLABEL *aLabel)
Create a new SCH_SHEET_PIN object and add it to aSheet at the current cursor position.
Definition: sheet.cpp:484
static TOOL_ACTION refreshPreview
Definition: actions.h:102
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
EDA_ITEM * Front() const
Definition: selection.h:184
static TOOL_ACTION cursorClick
Definition: actions.h:119
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup

References _, TOOL_INTERACTIVE::Activate(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), EE_SELECTION_TOOL::AddItemToSel(), KIGFX::VIEW::AddToPreview(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), EDA_ITEM::ClearFlags(), KIGFX::VIEW::ClearPreview(), EE_ACTIONS::clearSelection, EDA_ITEM::Clone(), createNewText(), SCH_EDIT_FRAME::CreateSheetPin(), ACTIONS::cursorClick, SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), getNextNewText(), SCH_EDIT_FRAME::GetScreen(), EE_SELECTION_TOOL::GetSelection(), SELECTION::GetSize(), TOOL_BASE::getViewControls(), TOOL_EVENT::HasPosition(), SCH_EDIT_FRAME::ImportHierLabel(), EE_ACTIONS::importSheetPin, IS_MOVED, IS_NEW, TOOL_EVENT::IsAction(), LAYER_GLOBLABEL, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NOTES, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame, TOOL_INTERACTIVE::m_menu, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool, m_statusPopup, TOOL_BASE::m_toolMgr, EE_TOOL_BASE< SCH_EDIT_FRAME >::m_view, MD_ALT, TOOL_EVENT::Parameter(), TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_SHEET_PIN_T, SCH_TEXT_T, EE_SELECTION_TOOL::SelectPoint(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), EDA_ITEM::SetFlags(), EE_COLLECTOR::SheetsOnly, TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), TOOL_MANAGER::VetoContextMenuMouseWarp(), TOOL_INTERACTIVE::Wait(), and KIGFX::VIEW_CONTROLS::WarpCursor().

Referenced by setTransitions().

◆ updateView()

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

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

Definition at line 104 of file ee_tool_base.h.

105  {
106  KICAD_T itemType = aItem->Type();
107 
108  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
109  getView()->Update( aItem->GetParent() );
110 
111  getView()->Update( aItem );
112  }
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:195
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:1544
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

◆ Wait()

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

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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 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(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), PlaceComponent(), PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_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(), SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_frame

SCH_EDIT_FRAME * EE_TOOL_BASE< SCH_EDIT_FRAME >::m_frame
protectedinherited

Definition at line 158 of file ee_tool_base.h.

◆ m_isLibEdit

bool EE_TOOL_BASE< SCH_EDIT_FRAME >::m_isLibEdit
protectedinherited

Definition at line 161 of file ee_tool_base.h.

◆ m_lastGlobalLabelShape

PINSHEETLABEL_SHAPE SCH_DRAWING_TOOLS::m_lastGlobalLabelShape
private

Definition at line 80 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_lastTextBold

bool SCH_DRAWING_TOOLS::m_lastTextBold
private

Definition at line 82 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_lastTextItalic

bool SCH_DRAWING_TOOLS::m_lastTextItalic
private

Definition at line 83 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_lastTextOrientation

LABEL_SPIN_STYLE SCH_DRAWING_TOOLS::m_lastTextOrientation
private

Definition at line 81 of file sch_drawing_tools.h.

Referenced by createNewText().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), PlaceComponent(), PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and TwoClickPlace().

◆ m_powerHistoryList

std::vector<COMPONENT_SELECTION> SCH_DRAWING_TOOLS::m_powerHistoryList
private

Definition at line 78 of file sch_drawing_tools.h.

Referenced by PlaceComponent().

◆ m_queuedTexts

std::deque<std::unique_ptr<SCH_TEXT> > SCH_DRAWING_TOOLS::m_queuedTexts
private

Definition at line 85 of file sch_drawing_tools.h.

Referenced by createNewText(), and getNextNewText().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_EDIT_FRAME >::m_selectionTool
protectedinherited

Definition at line 160 of file ee_tool_base.h.

◆ m_statusPopup

std::unique_ptr<STATUS_TEXT_POPUP> SCH_DRAWING_TOOLS::m_statusPopup
private

Definition at line 87 of file sch_drawing_tools.h.

Referenced by TwoClickPlace().

◆ m_symbolHistoryList

std::vector<COMPONENT_SELECTION> SCH_DRAWING_TOOLS::m_symbolHistoryList
private

Definition at line 77 of file sch_drawing_tools.h.

Referenced by PlaceComponent().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

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

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_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_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), 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(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PCB_INSPECTION_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), PlaceComponent(), PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::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 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

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

◆ m_view

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

Definition at line 159 of file ee_tool_base.h.


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