KiCad PCB EDA Suite
KICAD_MANAGER_CONTROL Class Reference

Handle actions in the kicad manager frame. More...

#include <kicad_manager_control.h>

Inheritance diagram for KICAD_MANAGER_CONTROL:
TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

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

Protected Member Functions

void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

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

Private Member Functions

int openProject (const wxString &aDefaultDir)
 

Private Attributes

KICAD_MANAGER_FRAMEm_frame
 < Pointer to the currently used edit/draw frame. More...
 
std::mutex m_loading
 

Detailed Description

Handle actions in the kicad manager frame.

Definition at line 38 of file kicad_manager_control.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 77 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ KICAD_MANAGER_CONTROL()

KICAD_MANAGER_CONTROL::KICAD_MANAGER_CONTROL ( )

Definition at line 78 of file kicad_manager_control.cpp.

78  :
79  TOOL_INTERACTIVE( "kicad.Control" ),
80  m_frame( nullptr )
81 {
82 }
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.

◆ ~KICAD_MANAGER_CONTROL()

KICAD_MANAGER_CONTROL::~KICAD_MANAGER_CONTROL ( )
inlineoverride

Definition at line 42 of file kicad_manager_control.h.

42 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

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

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ CloseProject()

int KICAD_MANAGER_CONTROL::CloseProject ( const TOOL_EVENT aEvent)

Definition at line 335 of file kicad_manager_control.cpp.

336 {
337  m_frame->CloseProject( true );
338  return 0;
339 }
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.

References KICAD_MANAGER_FRAME::CloseProject(), and m_frame.

Referenced by setTransitions().

◆ Execute()

int KICAD_MANAGER_CONTROL::Execute ( const TOOL_EVENT aEvent)

Definition at line 763 of file kicad_manager_control.cpp.

764 {
765  wxString execFile;
766  wxString param;
767 
769  execFile = GERBVIEW_EXE;
770  else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::convertImage ) )
771  execFile = BITMAPCONVERTER_EXE;
772  else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::showCalculator ) )
773  execFile = PCB_CALCULATOR_EXE;
775  execFile = PL_EDITOR_EXE;
776  else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::openTextEditor ) )
777  execFile = Pgm().GetTextEditor();
778  else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editOtherSch ) )
779  execFile = EESCHEMA_EXE;
780  else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editOtherPCB ) )
781  execFile = PCBNEW_EXE;
782  else
783  wxFAIL_MSG( wxT( "Execute(): unexpected request" ) );
784 
785  if( execFile.IsEmpty() )
786  return 0;
787 
788  if( aEvent.Parameter<wxString*>() )
789  param = *aEvent.Parameter<wxString*>();
791  param = m_frame->Prj().GetProjectPath();
792 
793  TERMINATE_HANDLER* callback = new TERMINATE_HANDLER( execFile );
794 
795  long pid = ExecuteFile( execFile, param, callback );
796 
797  if( pid > 0 )
798  {
799  wxString msg = wxString::Format( _( "%s %s opened [pid=%ld]\n" ), execFile, param, pid );
800  m_frame->PrintMsg( msg );
801 
802 #ifdef __WXMAC__
803  // This non-parameterized use of wxExecute is fine because execFile is not derived
804  // from user input.
805  wxExecute( "osascript -e 'activate application \"" + execFile + "\"'" );
806 #endif
807  }
808  else
809  {
810  delete callback;
811  }
812 
813  return 0;
814 }
void PrintMsg(const wxString &text)
const wxString PL_EDITOR_EXE
const wxString PCBNEW_EXE
static TOOL_ACTION showCalculator
static TOOL_ACTION viewGerbers
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback)
Call the executable file aEditorName with the parameter aFileName.
Definition: gestfich.cpp:115
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:122
const wxString GERBVIEW_EXE
static TOOL_ACTION convertImage
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
static TOOL_ACTION editOtherPCB
const wxString EESCHEMA_EXE
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
const wxString PCB_CALCULATOR_EXE
#define _(s)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static TOOL_ACTION editOtherSch
const wxString BITMAPCONVERTER_EXE
static TOOL_ACTION openTextEditor
static TOOL_ACTION editDrawingSheet

References _, BITMAPCONVERTER_EXE, KICAD_MANAGER_ACTIONS::convertImage, KICAD_MANAGER_ACTIONS::editDrawingSheet, KICAD_MANAGER_ACTIONS::editOtherPCB, KICAD_MANAGER_ACTIONS::editOtherSch, EESCHEMA_EXE, ExecuteFile(), Format(), GERBVIEW_EXE, PROJECT::GetProjectPath(), TOOL_EVENT::IsAction(), KICAD_MANAGER_FRAME::IsProjectActive(), m_frame, KICAD_MANAGER_ACTIONS::openTextEditor, TOOL_EVENT::Parameter(), PCB_CALCULATOR_EXE, PCBNEW_EXE, Pgm(), PL_EDITOR_EXE, EDA_BASE_FRAME::PrintMsg(), KIWAY_HOLDER::Prj(), KICAD_MANAGER_ACTIONS::showCalculator, and KICAD_MANAGER_ACTIONS::viewGerbers.

Referenced by setTransitions().

◆ getEditFrame()

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

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

Definition at line 184 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 143 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.).

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

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

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ Init()

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

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

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

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

◆ NewFromTemplate()

int KICAD_MANAGER_CONTROL::NewFromTemplate ( const TOOL_EVENT aEvent)

Definition at line 151 of file kicad_manager_control.cpp.

152 {
154 
155  wxFileName templatePath;
156  wxString envStr;
157 
158  // KiCad system template path.
159  ENV_VAR_MAP_CITER it = Pgm().GetLocalEnvVariables().find( wxT( "KICAD6_TEMPLATE_DIR" ) );
160 
161  if( it != Pgm().GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
162  {
163  templatePath.AssignDir( it->second.GetValue() );
164  ps->AddTemplatesPage( _( "System Templates" ), templatePath );
165  }
166 
167  // User template path.
168  it = Pgm().GetLocalEnvVariables().find( wxT( "KICAD_USER_TEMPLATE_DIR" ) );
169 
170  if( it != Pgm().GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
171  {
172  templatePath.AssignDir( it->second.GetValue() );
173  ps->AddTemplatesPage( _( "User Templates" ), templatePath );
174  }
175 
176  // Show the project template selector dialog
177  if( ps->ShowModal() != wxID_OK )
178  return -1;
179 
180  if( !ps->GetSelectedTemplate() )
181  {
182  wxMessageBox( _( "No project template was selected. Cannot generate new project." ),
183  _( "Error" ), wxOK | wxICON_ERROR, m_frame );
184 
185  return -1;
186  }
187 
188  // Get project destination folder and project file name.
189  wxString default_dir = wxFileName( Prj().GetProjectFullName() ).GetPathWithSep();
190  wxString title = _( "New Project Folder" );
191  wxFileDialog dlg( m_frame, title, default_dir, wxEmptyString, ProjectFileWildcard(),
192  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
193 
194  // Add a "Create a new directory" checkbox
195  dlg.SetExtraControlCreator( &DIR_CHECKBOX::Create );
196 
197  if( dlg.ShowModal() == wxID_CANCEL )
198  return -1;
199 
200  wxFileName fn( dlg.GetPath() );
201 
202  // wxFileName automatically extracts an extension. But if it isn't a .kicad_pro extension,
203  // we should keep it as part of the filename
204  if( !fn.GetExt().IsEmpty() && fn.GetExt().ToStdString() != ProjectFileExtension )
205  fn.SetName( fn.GetName() + wxT( "." ) + fn.GetExt() );
206 
207  fn.SetExt( ProjectFileExtension );
208 
209  if( !fn.IsAbsolute() )
210  fn.MakeAbsolute();
211 
212  // Append a new directory with the same name of the project file.
213  if( static_cast<DIR_CHECKBOX*>( dlg.GetExtraControl() )->CreateNewDir() )
214  fn.AppendDir( fn.GetName() );
215 
216  // Check if the project directory is empty if it already exists.
217  wxDir directory( fn.GetPath() );
218 
219  if( !fn.DirExists() )
220  {
221  if( !fn.Mkdir() )
222  {
223  wxString msg;
224  msg.Printf( _( "Folder '%s' could not be created.\n\n"
225  "Make sure you have write permissions and try again." ),
226  fn.GetPath() );
228  return -1;
229  }
230  }
231 
232  if( !fn.IsDirWritable() )
233  {
234  wxString msg;
235 
236  msg.Printf( _( "Insufficient permissions to write to folder '%s'." ), fn.GetPath() );
237  wxMessageDialog msgDlg( m_frame, msg, _( "Error" ), wxICON_ERROR | wxOK | wxCENTER );
238  msgDlg.ShowModal();
239  return -1;
240  }
241 
242  // Make sure we are not overwriting anything in the destination folder.
243  std::vector< wxFileName > destFiles;
244 
245  if( ps->GetSelectedTemplate()->GetDestinationFiles( fn, destFiles ) )
246  {
247  std::vector< wxFileName > overwrittenFiles;
248 
249  for( const auto& file : destFiles )
250  {
251  if( file.FileExists() )
252  overwrittenFiles.push_back( file );
253  }
254 
255  if( !overwrittenFiles.empty() )
256  {
257  wxString extendedMsg = _( "Overwriting files:" ) + "\n";
258 
259  for( const auto& file : overwrittenFiles )
260  extendedMsg += wxT( "\n" ) + file.GetFullName();
261 
262  KIDIALOG msgDlg( m_frame, _( "Similar files already exist in the destination folder." ),
263  _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
264  msgDlg.SetExtendedMessage( extendedMsg );
265  msgDlg.SetOKLabel( _( "Overwrite" ) );
266  msgDlg.DoNotShowCheckbox( __FILE__, __LINE__ );
267 
268  if( msgDlg.ShowModal() == wxID_CANCEL )
269  return -1;
270  }
271  }
272 
273  wxString errorMsg;
274 
275  // The selected template widget contains the template we're attempting to use to
276  // create a project
277  if( !ps->GetSelectedTemplate()->CreateProject( fn, &errorMsg ) )
278  {
279  wxMessageDialog createDlg( m_frame,
280  _( "A problem occurred creating new project from template." ),
281  _( "Error" ),
282  wxOK | wxICON_ERROR );
283 
284  if( !errorMsg.empty() )
285  createDlg.SetExtendedMessage( errorMsg );
286 
287  createDlg.ShowModal();
288  return -1;
289  }
290 
291  m_frame->CreateNewProject( fn.GetFullPath() );
292  m_frame->LoadProject( fn );
293  return 0;
294 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:45
const std::string ProjectFileExtension
PROJECT_TEMPLATE * GetSelectedTemplate()
PROJECT & Prj()
Definition: kicad.cpp:403
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
#define _(s)
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
wxString ProjectFileWildcard()
size_t GetDestinationFiles(const wxFileName &aNewProjectPath, std::vector< wxFileName > &aDestFiles)
Fetch the list of destination files to be copied when the new project is created.
bool CreateProject(wxFileName &aNewProjectPath, wxString *aErrorMsg=nullptr)
Copies and renames all template files to create a new project.
static wxWindow * Create(wxWindow *aParent)
void AddTemplatesPage(const wxString &aTitle, wxFileName &aPath)
Add a new page with aTitle, populated with templates from aPath.
void LoadProject(const wxFileName &aProjectFileName)
std::map< wxString, ENV_VAR_ITEM >::const_iterator ENV_VAR_MAP_CITER

References _, DIALOG_TEMPLATE_SELECTOR::AddTemplatesPage(), DIR_CHECKBOX::Create(), KICAD_MANAGER_FRAME::CreateNewProject(), PROJECT_TEMPLATE::CreateProject(), directory, DisplayErrorMessage(), KIDIALOG::DoNotShowCheckbox(), PROJECT_TEMPLATE::GetDestinationFiles(), DIALOG_TEMPLATE_SELECTOR::GetSelectedTemplate(), KICAD_MANAGER_FRAME::LoadProject(), m_frame, Pgm(), Prj(), ProjectFileExtension, ProjectFileWildcard(), and KIDIALOG::ShowModal().

Referenced by setTransitions().

◆ NewProject()

int KICAD_MANAGER_CONTROL::NewProject ( const TOOL_EVENT aEvent)

Definition at line 91 of file kicad_manager_control.cpp.

92 {
93  wxString default_dir = m_frame->GetMruPath();
94  wxFileDialog dlg( m_frame, _( "Create New Project" ), default_dir, wxEmptyString,
95  ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
96 
97  // Add a "Create a new directory" checkbox
98  dlg.SetExtraControlCreator( &DIR_CHECKBOX::Create );
99 
100  if( dlg.ShowModal() == wxID_CANCEL )
101  return -1;
102 
103  wxFileName pro( dlg.GetPath() );
104 
105  // wxFileName automatically extracts an extension. But if it isn't
106  // a .pro extension, we should keep it as part of the filename
107  if( !pro.GetExt().IsEmpty() && pro.GetExt().ToStdString() != ProjectFileExtension )
108  pro.SetName( pro.GetName() + wxT( "." ) + pro.GetExt() );
109 
110  pro.SetExt( ProjectFileExtension ); // enforce extension
111 
112  if( !pro.IsAbsolute() )
113  pro.MakeAbsolute();
114 
115  // Append a new directory with the same name of the project file.
116  if( static_cast<DIR_CHECKBOX*>( dlg.GetExtraControl() )->CreateNewDir() )
117  pro.AppendDir( pro.GetName() );
118 
119  // Check if the project directory is empty if it already exists.
120  wxDir directory( pro.GetPath() );
121 
122  if( !pro.DirExists() )
123  {
124  if( !pro.Mkdir() )
125  {
126  wxString msg;
127  msg.Printf( _( "Folder '%s' could not be created.\n\n"
128  "Make sure you have write permissions and try again." ),
129  pro.GetPath() );
131  return -1;
132  }
133  }
134  else if( directory.HasFiles() )
135  {
136  wxString msg = _( "The selected folder is not empty. It is recommended that you "
137  "create projects in their own empty folder.\n\n"
138  "Do you want to continue?" );
139 
140  if( !IsOK( m_frame, msg ) )
141  return -1;
142  }
143 
144  m_frame->CreateNewProject( pro );
145  m_frame->LoadProject( pro );
146 
147  return 0;
148 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
const std::string ProjectFileExtension
wxString GetMruPath() const
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
#define _(s)
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
wxString ProjectFileWildcard()
static wxWindow * Create(wxWindow *aParent)
void LoadProject(const wxFileName &aProjectFileName)
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:323

References _, DIR_CHECKBOX::Create(), KICAD_MANAGER_FRAME::CreateNewProject(), directory, DisplayErrorMessage(), EDA_BASE_FRAME::GetMruPath(), IsOK(), KICAD_MANAGER_FRAME::LoadProject(), m_frame, ProjectFileExtension, and ProjectFileWildcard().

Referenced by setTransitions().

◆ OpenDemoProject()

int KICAD_MANAGER_CONTROL::OpenDemoProject ( const TOOL_EVENT aEvent)

Definition at line 323 of file kicad_manager_control.cpp.

324 {
326 }
static wxString GetStockDemosPath()
Gets the stock (install) demos path.
Definition: paths.cpp:302
int openProject(const wxString &aDefaultDir)

References PATHS::GetStockDemosPath(), and openProject().

Referenced by setTransitions().

◆ OpenProject()

int KICAD_MANAGER_CONTROL::OpenProject ( const TOOL_EVENT aEvent)

Definition at line 329 of file kicad_manager_control.cpp.

330 {
331  return openProject( m_frame->GetMruPath() );
332 }
wxString GetMruPath() const
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
int openProject(const wxString &aDefaultDir)

References EDA_BASE_FRAME::GetMruPath(), m_frame, and openProject().

Referenced by setTransitions().

◆ openProject()

int KICAD_MANAGER_CONTROL::openProject ( const wxString &  aDefaultDir)
private

Definition at line 297 of file kicad_manager_control.cpp.

298 {
299  wxString wildcard = AllProjectFilesWildcard()
300  + wxT( "|" ) + ProjectFileWildcard()
301  + wxT( "|" ) + LegacyProjectFileWildcard();
302 
303  wxFileDialog dlg( m_frame, _( "Open Existing Project" ), aDefaultDir, wxEmptyString, wildcard,
304  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
305 
306  if( dlg.ShowModal() == wxID_CANCEL )
307  return -1;
308 
309  wxFileName pro( dlg.GetPath() );
310 
311  if( !pro.IsAbsolute() )
312  pro.MakeAbsolute();
313 
314  if( !pro.FileExists() )
315  return -1;
316 
317  m_frame->LoadProject( pro );
318 
319  return 0;
320 }
wxString AllProjectFilesWildcard()
wxString LegacyProjectFileWildcard()
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
#define _(s)
wxString ProjectFileWildcard()
void LoadProject(const wxFileName &aProjectFileName)

References _, AllProjectFilesWildcard(), LegacyProjectFileWildcard(), KICAD_MANAGER_FRAME::LoadProject(), m_frame, and ProjectFileWildcard().

Referenced by OpenDemoProject(), and OpenProject().

◆ Refresh()

int KICAD_MANAGER_CONTROL::Refresh ( const TOOL_EVENT aEvent)

Definition at line 613 of file kicad_manager_control.cpp.

614 {
616  return 0;
617 }
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.

References m_frame, and KICAD_MANAGER_FRAME::RefreshProjectTree().

Referenced by setTransitions().

◆ Reset()

void KICAD_MANAGER_CONTROL::Reset ( RESET_REASON  aReason)
overridevirtual

Bring the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 85 of file kicad_manager_control.cpp.

86 {
87  m_frame = getEditFrame<KICAD_MANAGER_FRAME>();
88 }
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.

References m_frame.

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ SaveProjectAs()

int KICAD_MANAGER_CONTROL::SaveProjectAs ( const TOOL_EVENT aEvent)

Definition at line 534 of file kicad_manager_control.cpp.

535 {
536  wxString msg;
537 
538  wxFileName currentProjectFile( Prj().GetProjectFullName() );
539  wxString currentProjectDirPath = currentProjectFile.GetPath();
540  wxString currentProjectName = Prj().GetProjectName();
541 
542  wxString default_dir = m_frame->GetMruPath();
543 
544  Prj().GetProjectFile().SaveToFile( currentProjectDirPath );
545  Prj().GetLocalSettings().SaveToFile( currentProjectDirPath );
546 
547  if( default_dir == currentProjectDirPath
548  || default_dir == currentProjectDirPath + wxFileName::GetPathSeparator() )
549  {
550  // Don't start within the current project
551  wxFileName default_dir_fn( default_dir );
552  default_dir_fn.RemoveLastDir();
553  default_dir = default_dir_fn.GetPath();
554  }
555 
556  wxFileDialog dlg( m_frame, _( "Save Project To" ), default_dir, wxEmptyString, wxEmptyString,
557  wxFD_SAVE );
558 
559  if( dlg.ShowModal() == wxID_CANCEL )
560  return -1;
561 
562  wxFileName newProjectDir( dlg.GetPath(), wxEmptyString );
563 
564  if( !newProjectDir.IsAbsolute() )
565  newProjectDir.MakeAbsolute();
566 
567  if( wxDirExists( newProjectDir.GetFullPath() ) )
568  {
569  msg.Printf( _( "'%s' already exists." ), newProjectDir.GetFullPath() );
571  return -1;
572  }
573 
574  if( !wxMkdir( newProjectDir.GetFullPath() ) )
575  {
576  msg.Printf( _( "Folder '%s' could not be created.\n\n"
577  "Please make sure you have write permissions and try again." ),
578  newProjectDir.GetPath() );
580  return -1;
581  }
582 
583  if( !newProjectDir.IsDirWritable() )
584  {
585  msg.Printf( _( "Insufficient permissions to write to folder '%s'." ),
586  newProjectDir.GetFullPath() );
587  wxMessageDialog msgDlg( m_frame, msg, _( "Error!" ), wxICON_ERROR | wxOK | wxCENTER );
588  msgDlg.ShowModal();
589  return -1;
590  }
591 
592  const wxString& newProjectDirPath = newProjectDir.GetFullPath();
593  const wxString& newProjectName = newProjectDir.GetDirs().Last();
594  wxDir currentProjectDir( currentProjectDirPath );
595 
596  SAVE_AS_TRAVERSER traverser( m_frame, currentProjectDirPath, currentProjectName,
597  newProjectDirPath, newProjectName );
598 
599  currentProjectDir.Traverse( traverser );
600 
601  if( !traverser.GetErrors().empty() )
602  DisplayErrorMessage( m_frame, traverser.GetErrors() );
603 
604  if( !traverser.GetNewProjectFile().FileExists() )
605  m_frame->CreateNewProject( traverser.GetNewProjectFile() );
606 
607  m_frame->LoadProject( traverser.GetNewProjectFile() );
608 
609  return 0;
610 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
PROJECT & Prj()
Definition: kicad.cpp:403
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:151
wxString GetMruPath() const
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
#define _(s)
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
virtual const wxString GetProjectName() const
Return the short name of the project.
Definition: project.cpp:128
void LoadProject(const wxFileName &aProjectFileName)

References _, KICAD_MANAGER_FRAME::CreateNewProject(), DisplayErrorMessage(), SAVE_AS_TRAVERSER::GetErrors(), PROJECT::GetLocalSettings(), EDA_BASE_FRAME::GetMruPath(), SAVE_AS_TRAVERSER::GetNewProjectFile(), PROJECT::GetProjectFile(), PROJECT::GetProjectName(), KICAD_MANAGER_FRAME::LoadProject(), m_frame, Prj(), PROJECT_LOCAL_SETTINGS::SaveToFile(), and PROJECT_FILE::SaveToFile().

Referenced by setTransitions().

◆ SetContextMenu()

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

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void KICAD_MANAGER_CONTROL::setTransitions ( )
overridevirtual

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

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 833 of file kicad_manager_control.cpp.

834 {
841 
844 
854 
857 
858 #ifdef PCM
859  Go( &KICAD_MANAGER_CONTROL::ShowPluginManager, KICAD_MANAGER_ACTIONS::showPluginManager.MakeEvent() );
860 #endif
861 }
static TOOL_ACTION newProject
int ShowPluginManager(const TOOL_EVENT &aEvent)
Set up handlers for various events.
int ShowPlayer(const TOOL_EVENT &aEvent)
static TOOL_ACTION showCalculator
static TOOL_ACTION openDemoProject
static TOOL_ACTION viewGerbers
int OpenDemoProject(const TOOL_EVENT &aEvent)
static TOOL_ACTION newFromTemplate
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static TOOL_ACTION convertImage
static TOOL_ACTION closeProject
int Refresh(const TOOL_EVENT &aEvent)
static TOOL_ACTION editOtherPCB
static TOOL_ACTION editSchematic
int OpenProject(const TOOL_EVENT &aEvent)
static TOOL_ACTION editFootprints
static TOOL_ACTION updateMenu
Definition: actions.h:167
int NewProject(const TOOL_EVENT &aEvent)
int SaveProjectAs(const TOOL_EVENT &aEvent)
int CloseProject(const TOOL_EVENT &aEvent)
static TOOL_ACTION editOtherSch
static TOOL_ACTION editPCB
int UpdateMenu(const TOOL_EVENT &aEvent)
static TOOL_ACTION openProject
static TOOL_ACTION saveAs
Definition: actions.h:52
static TOOL_ACTION zoomRedraw
Definition: actions.h:90
int NewFromTemplate(const TOOL_EVENT &aEvent)
static TOOL_ACTION editSymbols
int Execute(const TOOL_EVENT &aEvent)
static TOOL_ACTION openTextEditor
static TOOL_ACTION editDrawingSheet

References KICAD_MANAGER_ACTIONS::closeProject, CloseProject(), KICAD_MANAGER_ACTIONS::convertImage, KICAD_MANAGER_ACTIONS::editDrawingSheet, KICAD_MANAGER_ACTIONS::editFootprints, KICAD_MANAGER_ACTIONS::editOtherPCB, KICAD_MANAGER_ACTIONS::editOtherSch, KICAD_MANAGER_ACTIONS::editPCB, KICAD_MANAGER_ACTIONS::editSchematic, KICAD_MANAGER_ACTIONS::editSymbols, Execute(), TOOL_INTERACTIVE::Go(), KICAD_MANAGER_ACTIONS::newFromTemplate, NewFromTemplate(), KICAD_MANAGER_ACTIONS::newProject, NewProject(), KICAD_MANAGER_ACTIONS::openDemoProject, OpenDemoProject(), KICAD_MANAGER_ACTIONS::openProject, OpenProject(), KICAD_MANAGER_ACTIONS::openTextEditor, Refresh(), ACTIONS::saveAs, SaveProjectAs(), KICAD_MANAGER_ACTIONS::showCalculator, ShowPlayer(), ShowPluginManager(), UpdateMenu(), ACTIONS::updateMenu, KICAD_MANAGER_ACTIONS::viewGerbers, and ACTIONS::zoomRedraw.

◆ ShowPlayer()

int KICAD_MANAGER_CONTROL::ShowPlayer ( const TOOL_EVENT aEvent)

Definition at line 636 of file kicad_manager_control.cpp.

637 {
638  FRAME_T playerType = aEvent.Parameter<FRAME_T>();
639  KIWAY_PLAYER* player;
640 
641  if( playerType == FRAME_SCH && !m_frame->IsProjectActive() )
642  {
643  DisplayInfoMessage( m_frame, _( "Create (or open) a project to edit a schematic." ),
644  wxEmptyString );
645  return -1;
646  }
647  else if( playerType == FRAME_PCB_EDITOR && !m_frame->IsProjectActive() )
648  {
649  DisplayInfoMessage( m_frame, _( "Create (or open) a project to edit a pcb." ),
650  wxEmptyString );
651  return -1;
652  }
653 
654  // Prevent multiple KIWAY_PLAYER loading at one time
655  if( !m_loading.try_lock() )
656  return -1;
657 
658  wxBusyCursor dummy;
659 
660  const std::lock_guard<std::mutex> lock( m_loading, std::adopt_lock );
661 
662  try
663  {
664  player = m_frame->Kiway().Player( playerType, true );
665  }
666  catch( const IO_ERROR& err )
667  {
668  wxMessageBox( _( "Application failed to load:\n" ) + err.What(), _( "KiCad Error" ),
669  wxOK | wxICON_ERROR, m_frame );
670  return -1;
671  }
672 
673  if ( !player )
674  {
675  wxMessageBox( _( "Application failed to load." ), _( "KiCad Error" ),
676  wxOK | wxICON_ERROR, m_frame );
677  return -1;
678  }
679 
680  if( !player->IsVisible() ) // A hidden frame might not have the document loaded.
681  {
682  wxString filepath;
683 
684  if( playerType == FRAME_SCH )
685  {
686  wxFileName kicad_schematic( m_frame->SchFileName() );
687  wxFileName legacy_schematic( m_frame->SchLegacyFileName() );
688 
689  if( !legacy_schematic.FileExists() || kicad_schematic.FileExists() )
690  filepath = kicad_schematic.GetFullPath();
691  else
692  filepath = legacy_schematic.GetFullPath();
693  }
694  else if( playerType == FRAME_PCB_EDITOR )
695  {
696  wxFileName kicad_board( m_frame->PcbFileName() );
697  wxFileName legacy_board( m_frame->PcbLegacyFileName() );
698 
699  if( !legacy_board.FileExists() || kicad_board.FileExists() )
700  filepath = kicad_board.GetFullPath();
701  else
702  filepath = legacy_board.GetFullPath();
703  }
704 
705  if( !filepath.IsEmpty() )
706  {
707  if( !player->OpenProjectFiles( std::vector<wxString>( 1, filepath ) ) )
708  {
709  player->Destroy();
710  return -1;
711  }
712  }
713 
714  player->Show( true );
715  }
716 
717  // Needed on Windows, other platforms do not use it, but it creates no issue
718  if( player->IsIconized() )
719  player->Iconize( false );
720 
721  player->Raise();
722 
723  // Raising the window does not set the focus on Linux. This should work on
724  // any platform.
725  if( wxWindow::FindFocus() != player )
726  player->SetFocus();
727 
728  return 0;
729 }
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:64
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:32
const wxString SchLegacyFileName()
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:393
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
const wxString SchFileName()
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
#define _(s)
const wxString PcbLegacyFileName()
const wxString PcbFileName()
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:307
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References _, DisplayInfoMessage(), dummy(), FRAME_PCB_EDITOR, FRAME_SCH, KICAD_MANAGER_FRAME::IsProjectActive(), KIWAY_HOLDER::Kiway(), m_frame, m_loading, TOOL_EVENT::Parameter(), KICAD_MANAGER_FRAME::PcbFileName(), KICAD_MANAGER_FRAME::PcbLegacyFileName(), KIWAY::Player(), KICAD_MANAGER_FRAME::SchFileName(), KICAD_MANAGER_FRAME::SchLegacyFileName(), and IO_ERROR::What().

Referenced by setTransitions().

◆ ShowPluginManager()

int KICAD_MANAGER_CONTROL::ShowPluginManager ( const TOOL_EVENT aEvent)

Set up handlers for various events.

Definition at line 817 of file kicad_manager_control.cpp.

818 {
819 #ifdef PCM
820  DIALOG_PCM pcm( m_frame );
821  pcm.ShowModal();
822 
823  // For some reason, after a double click the bitmap button calling
824  // PCM keeps the focus althougt the focus was not set to this button.
825  // This hack force removing the focus from this button
826  m_frame->SetFocus();
827 #endif
828 
829  return 0;
830 }
KICAD_MANAGER_FRAME * m_frame
< Pointer to the currently used edit/draw frame.
Implementing pcm main dialog.
Definition: dialog_pcm.h:35

References m_frame.

Referenced by setTransitions().

◆ UpdateMenu()

int KICAD_MANAGER_CONTROL::UpdateMenu ( const TOOL_EVENT aEvent)

Definition at line 620 of file kicad_manager_control.cpp.

621 {
622  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
623  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
624  SELECTION dummySel;
625 
626  if( conditionalMenu )
627  conditionalMenu->Evaluate( dummySel );
628 
629  if( actionMenu )
630  actionMenu->UpdateAll();
631 
632  return 0;
633 }
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:48
void UpdateAll()
Run update handlers for the menu and its submenus.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432

References TOOL_EVENT::Parameter(), and ACTION_MENU::UpdateAll().

Referenced by setTransitions().

◆ Wait()

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

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

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

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

Member Data Documentation

◆ m_frame

KICAD_MANAGER_FRAME* KICAD_MANAGER_CONTROL::m_frame
private

< Pointer to the currently used edit/draw frame.

Definition at line 67 of file kicad_manager_control.h.

Referenced by CloseProject(), Execute(), NewFromTemplate(), NewProject(), OpenProject(), openProject(), Refresh(), Reset(), SaveProjectAs(), ShowPlayer(), and ShowPluginManager().

◆ m_loading

std::mutex KICAD_MANAGER_CONTROL::m_loading
private

Definition at line 70 of file kicad_manager_control.h.

Referenced by ShowPlayer().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

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

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 209 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 214 of file tool_base.h.

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 206 of file tool_base.h.

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


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