KiCad PCB EDA Suite
SYMBOL_EDITOR_CONTROL Class Reference

Handle actions for the various symbol editor and viewers. More...

#include <symbol_editor_control.h>

Inheritance diagram for SYMBOL_EDITOR_CONTROL:
EE_TOOL_BASE< SCH_BASE_FRAME > TOOL_INTERACTIVE TOOL_BASE

Public Types

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

Public Member Functions

 SYMBOL_EDITOR_CONTROL ()
 
virtual ~SYMBOL_EDITOR_CONTROL ()
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int AddLibrary (const TOOL_EVENT &aEvent)
 
int AddSymbol (const TOOL_EVENT &aEvent)
 
int EditSymbol (const TOOL_EVENT &aEvent)
 
int Save (const TOOL_EVENT &aEvt)
 
int Revert (const TOOL_EVENT &aEvent)
 
int CutCopyDelete (const TOOL_EVENT &aEvent)
 
int DuplicateSymbol (const TOOL_EVENT &aEvent)
 
int RenameSymbol (const TOOL_EVENT &aEvent)
 
int ExportSymbol (const TOOL_EVENT &aEvent)
 
int ExportView (const TOOL_EVENT &aEvent)
 
int ExportSymbolAsSVG (const TOOL_EVENT &aEvent)
 
int AddSymbolToSchematic (const TOOL_EVENT &aEvent)
 
int OnDeMorgan (const TOOL_EVENT &aEvent)
 
int ShowElectricalTypes (const TOOL_EVENT &aEvent)
 
int ShowPinNumbers (const TOOL_EVENT &aEvent)
 
int PinLibrary (const TOOL_EVENT &aEvent)
 
int UnpinLibrary (const TOOL_EVENT &aEvent)
 
int ToggleSymbolTree (const TOOL_EVENT &aEvent)
 
int ToggleSyncedPinsMode (const TOOL_EVENT &aEvent)
 
int DdAddLibrary (const TOOL_EVENT &aEvent)
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

void setTransitions () override
 < Set up handlers for various events. More...
 
void resetTransitions ()
 Clear the current transition map and restores the default one created by setTransitions(). More...
 
void goInternal (TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
 
EDA_ITEMgetModelInt () const
 
TOOLS_HOLDERgetToolHolderInt () const
 

Detailed Description

Handle actions for the various symbol editor and viewers.

Definition at line 37 of file symbol_editor_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.

REDRAW 

Full drawing refresh.

Definition at line 77 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ SYMBOL_EDITOR_CONTROL()

SYMBOL_EDITOR_CONTROL::SYMBOL_EDITOR_CONTROL ( )
inline

Definition at line 40 of file symbol_editor_control.h.

40 :
41 EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.SymbolLibraryControl" )
42 { }

◆ ~SYMBOL_EDITOR_CONTROL()

virtual SYMBOL_EDITOR_CONTROL::~SYMBOL_EDITOR_CONTROL ( )
inlinevirtual

Definition at line 44 of file symbol_editor_control.h.

44{ }

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:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
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(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_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(), SCH_DRAWING_TOOLS::DrawShape(), 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(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), ROUTER_TOOL::RouteSelected(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ AddLibrary()

int SYMBOL_EDITOR_CONTROL::AddLibrary ( const TOOL_EVENT aEvent)

Definition at line 133 of file symbol_editor_control.cpp.

134{
135 bool createNew = aEvent.IsAction( &ACTIONS::newLibrary );
136
138 static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->AddLibraryFile( createNew );
139
140 return 0;
141}
static TOOL_ACTION newLibrary
Definition: actions.h:48
bool IsType(FRAME_T aType) const
The symbol library editor main window.
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:81
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35

References FRAME_SCH_SYMBOL_EDITOR, TOOL_EVENT::IsAction(), EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, and ACTIONS::newLibrary.

Referenced by setTransitions().

◆ AddSymbol()

int SYMBOL_EDITOR_CONTROL::AddSymbol ( const TOOL_EVENT aEvent)

Definition at line 169 of file symbol_editor_control.cpp.

170{
172 {
173 SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
174
175 LIB_ID sel = editFrame->GetTreeLIBID();
176 const wxString& libName = sel.GetLibNickname();
177 wxString msg;
178
179 if( libName.IsEmpty() )
180 {
181 msg.Printf( _( "No symbol library selected." ) );
183 return 0;
184 }
185
186 if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) )
187 {
188 msg.Printf( _( "Symbol library '%s' is not writable." ), libName );
190 return 0;
191 }
192
193 if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) )
194 {
195 editFrame->CreateNewSymbol();
196 }
198 {
199 editFrame->CreateNewSymbol( sel.GetLibItemName() );
200 }
201 else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
202 {
203 editFrame->ImportSymbol();
204 }
205 }
206
207 return 0;
208}
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
static TOOL_ACTION newSymbol
Definition: ee_actions.h:183
static TOOL_ACTION importSymbol
Definition: ee_actions.h:192
static TOOL_ACTION deriveFromExistingSymbol
Definition: ee_actions.h:184
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
void CreateNewSymbol(const wxString &inheritFromSymbolName=wxEmptyString)
Create a new symbol in the selected library.
LIB_ID GetTreeLIBID(int *aUnit=nullptr) const
Return the LIB_ID of the library or symbol selected in the symbol tree.
LIB_SYMBOL_LIBRARY_MANAGER & GetLibManager()
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
#define _(s)

References _, SYMBOL_EDIT_FRAME::CreateNewSymbol(), EE_ACTIONS::deriveFromExistingSymbol, FRAME_SCH_SYMBOL_EDITOR, LIB_ID::GetLibItemName(), SYMBOL_EDIT_FRAME::GetLibManager(), LIB_ID::GetLibNickname(), SYMBOL_EDIT_FRAME::GetTreeLIBID(), SYMBOL_EDIT_FRAME::ImportSymbol(), EE_ACTIONS::importSymbol, TOOL_EVENT::IsAction(), SYMBOL_LIBRARY_MANAGER::IsLibraryReadOnly(), EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EE_ACTIONS::newSymbol, and EDA_BASE_FRAME::ShowInfoBarError().

Referenced by setTransitions().

◆ AddSymbolToSchematic()

int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic ( const TOOL_EVENT aEvent)

Definition at line 615 of file symbol_editor_control.cpp.

616{
617 LIB_SYMBOL* libSymbol = nullptr;
618 LIB_ID libId;
619 int unit, convert;
620
621 if( m_isSymbolEditor )
622 {
623 SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
624
625 libSymbol = editFrame->GetCurSymbol();
626 unit = editFrame->GetUnit();
627 convert = editFrame->GetConvert();
628
629 if( libSymbol )
630 libId = libSymbol->GetLibId();
631 }
632 else
633 {
634 SYMBOL_VIEWER_FRAME* viewerFrame = getEditFrame<SYMBOL_VIEWER_FRAME>();
635
636 if( viewerFrame->IsModal() )
637 {
638 // if we're modal then we just need to return the symbol selection; the caller is
639 // already in a EE_ACTIONS::placeSymbol coroutine.
640 viewerFrame->FinishModal();
641 return 0;
642 }
643 else
644 {
645 libSymbol = viewerFrame->GetSelectedSymbol();
646 unit = viewerFrame->GetUnit();
647 convert = viewerFrame->GetConvert();
648
649 if( libSymbol )
650 libId = libSymbol->GetLibId();
651 }
652 }
653
654 if( libSymbol )
655 {
656 SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
657
658 if( !schframe ) // happens when the schematic editor is not active (or closed)
659 {
660 DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
661 return 0;
662 }
663
664 wxWindow* blocking_dialog = schframe->Kiway().GetBlockingDialog();
665
666 if( blocking_dialog )
667 blocking_dialog->Close( true );
668
669 wxCHECK( libSymbol->GetLibId().IsValid(), 0 );
670
671 SCH_SYMBOL* symbol = new SCH_SYMBOL( *libSymbol, libId, &schframe->GetCurrentSheet(),
672 unit, convert );
673
674 symbol->SetParent( schframe->GetScreen() );
675
676 if( schframe->eeconfig()->m_AutoplaceFields.enable )
677 symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
678
679 schframe->Raise();
680 schframe->GetToolManager()->RunAction( EE_ACTIONS::placeSymbol, false, symbol );
681 }
682
683 return 0;
684}
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
AUTOPLACE_FIELDS m_AutoplaceFields
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:79
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
bool IsModal() const override
Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame...
Definition: kiway_player.h:159
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
Definition: kiway.cpp:620
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
Define a library symbol object.
Definition: lib_symbol.h:99
LIB_ID GetLibId() const override
Definition: lib_symbol.h:141
EESCHEMA_SETTINGS * eeconfig() const
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET_PATH & GetCurrentSheet() const
Schematic symbol object.
Definition: sch_symbol.h:81
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the symbol.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
Symbol library viewer main window.
void FinishModal()
Send the selected symbol back to the caller.
LIB_SYMBOL * GetSelectedSymbol() const
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:325
@ FRAME_SCH
Definition: frame_type.h:34

References _, SCH_SYMBOL::AutoplaceFields(), convert, DisplayErrorMessage(), SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, SYMBOL_VIEWER_FRAME::FinishModal(), FRAME_SCH, KIWAY::GetBlockingDialog(), SYMBOL_EDIT_FRAME::GetConvert(), SYMBOL_VIEWER_FRAME::GetConvert(), SCH_EDIT_FRAME::GetCurrentSheet(), SYMBOL_EDIT_FRAME::GetCurSymbol(), LIB_SYMBOL::GetLibId(), SCH_EDIT_FRAME::GetScreen(), SYMBOL_VIEWER_FRAME::GetSelectedSymbol(), TOOLS_HOLDER::GetToolManager(), SYMBOL_EDIT_FRAME::GetUnit(), SYMBOL_VIEWER_FRAME::GetUnit(), KIWAY_PLAYER::IsModal(), LIB_ID::IsValid(), KIWAY_HOLDER::Kiway(), EESCHEMA_SETTINGS::m_AutoplaceFields, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor, EE_ACTIONS::placeSymbol, KIWAY::Player(), TOOL_MANAGER::RunAction(), and EDA_ITEM::SetParent().

Referenced by setTransitions().

◆ 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}

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ CutCopyDelete()

int SYMBOL_EDITOR_CONTROL::CutCopyDelete ( const TOOL_EVENT aEvent)

Definition at line 249 of file symbol_editor_control.cpp.

250{
252 {
253 SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
254
255 if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::copySymbol ) )
256 editFrame->CopySymbolToClipboard();
257
258 if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::deleteSymbol ) )
259 {
260 bool hasWritableLibs = false;
261 wxString msg;
262
263 for( LIB_ID& sel : editFrame->GetSelectedLibIds() )
264 {
265 const wxString& libName = sel.GetLibNickname();
266
267 if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) )
268 msg.Printf( _( "Symbol library '%s' is not writable." ), libName );
269 else
270 hasWritableLibs = true;
271 }
272
273 if( !msg.IsEmpty() )
275
276 if( !hasWritableLibs )
277 return 0;
278
279 editFrame->DeleteSymbolFromLibrary();
280 }
281 }
282
283 return 0;
284}
static TOOL_ACTION deleteSymbol
Definition: ee_actions.h:188
static TOOL_ACTION cutSymbol
Definition: ee_actions.h:189
static TOOL_ACTION copySymbol
Definition: ee_actions.h:190
void DeleteSymbolFromLibrary()
std::vector< LIB_ID > GetSelectedLibIds() const

References _, EE_ACTIONS::copySymbol, SYMBOL_EDIT_FRAME::CopySymbolToClipboard(), EE_ACTIONS::cutSymbol, EE_ACTIONS::deleteSymbol, SYMBOL_EDIT_FRAME::DeleteSymbolFromLibrary(), FRAME_SCH_SYMBOL_EDITOR, SYMBOL_EDIT_FRAME::GetLibManager(), SYMBOL_EDIT_FRAME::GetSelectedLibIds(), TOOL_EVENT::IsAction(), SYMBOL_LIBRARY_MANAGER::IsLibraryReadOnly(), EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, and EDA_BASE_FRAME::ShowInfoBarError().

Referenced by setTransitions().

◆ DdAddLibrary()

int SYMBOL_EDITOR_CONTROL::DdAddLibrary ( const TOOL_EVENT aEvent)

Definition at line 144 of file symbol_editor_control.cpp.

145{
146 wxString libFile = *aEvent.Parameter<wxString*>();
148 static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->DdAddLibrary( libFile );
149
150 return 0;
151}
void DdAddLibrary(wxString aLibFile)
Add a library dropped file to the symbol library table.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:442

References SYMBOL_EDIT_FRAME::DdAddLibrary(), FRAME_SCH_SYMBOL_EDITOR, EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ DuplicateSymbol()

int SYMBOL_EDITOR_CONTROL::DuplicateSymbol ( const TOOL_EVENT aEvent)

Definition at line 287 of file symbol_editor_control.cpp.

288{
290 {
291 SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
292 LIB_ID sel = editFrame->GetTargetLibId();
293 // DuplicateSymbol() is called to duplicate a symbol, or to paste a previously
294 // saved symbol in clipboard
295 bool isPasteAction = aEvent.IsAction( &EE_ACTIONS::pasteSymbol );
296 wxString msg;
297
298 if( !sel.IsValid() && !isPasteAction )
299 {
300 // When duplicating a symbol, a source symbol must exists.
301 msg.Printf( _( "No symbol selected" ) );
303 return 0;
304 }
305
306 const wxString& libName = sel.GetLibNickname();
307
308 if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) )
309 {
310 msg.Printf( _( "Symbol library '%s' is not writable." ), libName );
312 return 0;
313 }
314
315 editFrame->DuplicateSymbol( isPasteAction );
316 }
317
318 return 0;
319}
static TOOL_ACTION pasteSymbol
Definition: ee_actions.h:191
LIB_ID GetTargetLibId() const
Return either the symbol selected in the symbol tree (if context menu is active) or the symbol on the...
void DuplicateSymbol(bool aFromClipboard)
Insert a duplicate symbol.

References _, SYMBOL_EDIT_FRAME::DuplicateSymbol(), FRAME_SCH_SYMBOL_EDITOR, SYMBOL_EDIT_FRAME::GetLibManager(), LIB_ID::GetLibNickname(), SYMBOL_EDIT_FRAME::GetTargetLibId(), TOOL_EVENT::IsAction(), SYMBOL_LIBRARY_MANAGER::IsLibraryReadOnly(), EDA_BASE_FRAME::IsType(), LIB_ID::IsValid(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EE_ACTIONS::pasteSymbol, and EDA_BASE_FRAME::ShowInfoBarError().

Referenced by setTransitions().

◆ EditSymbol()

int SYMBOL_EDITOR_CONTROL::EditSymbol ( const TOOL_EVENT aEvent)

Definition at line 154 of file symbol_editor_control.cpp.

155{
157 {
158 SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
159 int unit = 0;
160 LIB_ID partId = editFrame->GetTreeLIBID( &unit );
161
162 editFrame->LoadSymbol( partId.GetLibItemName(), partId.GetLibNickname(), unit );
163 }
164
165 return 0;
166}
void LoadSymbol(const wxString &aLibrary, const wxString &aSymbol, int Unit)

References FRAME_SCH_SYMBOL_EDITOR, LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), SYMBOL_EDIT_FRAME::GetTreeLIBID(), EDA_BASE_FRAME::IsType(), SYMBOL_EDIT_FRAME::LoadSymbol(), and EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame.

Referenced by setTransitions().

◆ ExportSymbol()

int SYMBOL_EDITOR_CONTROL::ExportSymbol ( const TOOL_EVENT aEvent)

Definition at line 240 of file symbol_editor_control.cpp.

241{
243 static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->ExportSymbol();
244
245 return 0;
246}
int ExportSymbol(const TOOL_EVENT &aEvent)

References ExportSymbol(), FRAME_SCH_SYMBOL_EDITOR, EDA_BASE_FRAME::IsType(), and EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame.

Referenced by ExportSymbol(), and setTransitions().

◆ ExportSymbolAsSVG()

int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG ( const TOOL_EVENT aEvent)

Definition at line 566 of file symbol_editor_control.cpp.

567{
568 if( !m_isSymbolEditor )
569 return 0;
570
571 SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
572 LIB_SYMBOL* symbol = editFrame->GetCurSymbol();
573
574 if( !symbol )
575 {
576 wxMessageBox( _( "No symbol to export" ) );
577 return 0;
578 }
579
580 wxFileName fn( symbol->GetName() );
581 fn.SetExt( SVGFileExtension );
582
583 wxString pro_dir = wxPathOnly( m_frame->Prj().GetProjectFullName() );
584
585 wxString fullFileName = wxFileSelector( _( "SVG File Name" ), pro_dir, fn.GetFullName(),
586 SVGFileExtension, SVGFileWildcard(), wxFD_SAVE,
587 m_frame );
588
589 if( !fullFileName.IsEmpty() )
590 {
591 PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings();
592 PAGE_INFO pageTemp = pageSave;
593
594 BOX2I symbolBBox = symbol->GetUnitBoundingBox( editFrame->GetUnit(),
595 editFrame->GetConvert(), false );
596
597 // Add a small margin (10% of size)to the plot bounding box
598 symbolBBox.Inflate( symbolBBox.GetSize().x * 0.1, symbolBBox.GetSize().y * 0.1 );
599
600 pageTemp.SetWidthMils( schIUScale.IUToMils( symbolBBox.GetSize().x ) );
601 pageTemp.SetHeightMils( schIUScale.IUToMils( symbolBBox.GetSize().y ) );
602
603 // Add an offet to plot the symbol centered on the page.
604 VECTOR2I plot_offset = symbolBBox.GetOrigin();
605
606 editFrame->GetScreen()->SetPageSettings( pageTemp );
607 editFrame->SVGPlotSymbol( fullFileName, -plot_offset );
608 editFrame->GetScreen()->SetPageSettings( pageSave );
609 }
610
611 return 0;
612}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
const Vec & GetOrigin() const
Definition: box2.h:183
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
const Vec & GetSize() const
Definition: box2.h:179
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
wxString GetName() const override
Definition: lib_symbol.h:138
const BOX2I GetUnitBoundingBox(int aUnit, int aConvert, bool aIgnoreHiddenFields=true) const
Get the bounding box for the symbol.
Definition: lib_symbol.cpp:953
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
void SetWidthMils(int aWidthInMils)
Definition: page_info.cpp:245
void SetHeightMils(int aHeightInMils)
Definition: page_info.cpp:259
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:120
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:131
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: sch_screen.h:132
void SVGPlotSymbol(const wxString &aFullFileName, VECTOR2I aOffset)
Create the SVG print file for the current edited symbol.
const std::string SVGFileExtension
wxString SVGFileWildcard()
constexpr int IUToMils(int iu) const
Definition: base_units.h:100

References _, SYMBOL_EDIT_FRAME::GetConvert(), SYMBOL_EDIT_FRAME::GetCurSymbol(), LIB_SYMBOL::GetName(), BOX2< Vec >::GetOrigin(), SCH_SCREEN::GetPageSettings(), PROJECT::GetProjectFullName(), SCH_BASE_FRAME::GetScreen(), BOX2< Vec >::GetSize(), SYMBOL_EDIT_FRAME::GetUnit(), LIB_SYMBOL::GetUnitBoundingBox(), BOX2< Vec >::Inflate(), EDA_IU_SCALE::IUToMils(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor, KIWAY_HOLDER::Prj(), schIUScale, PAGE_INFO::SetHeightMils(), SCH_SCREEN::SetPageSettings(), PAGE_INFO::SetWidthMils(), SVGFileExtension, SVGFileWildcard(), SYMBOL_EDIT_FRAME::SVGPlotSymbol(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ ExportView()

int SYMBOL_EDITOR_CONTROL::ExportView ( const TOOL_EVENT aEvent)

Definition at line 528 of file symbol_editor_control.cpp.

529{
530 if( !m_isSymbolEditor )
531 return 0;
532
533 SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
534 LIB_SYMBOL* symbol = editFrame->GetCurSymbol();
535
536 if( !symbol )
537 {
538 wxMessageBox( _( "No symbol to export" ) );
539 return 0;
540 }
541
542 wxFileName fn( symbol->GetName() );
543 fn.SetExt( "png" );
544
545 wxString projectPath = wxPathOnly( m_frame->Prj().GetProjectFullName() );
546
547 wxFileDialog dlg( editFrame, _( "Image File Name" ), projectPath, fn.GetFullName(),
548 PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
549
550 if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
551 {
552 // calling wxYield is mandatory under Linux, after closing the file selector dialog
553 // to refresh the screen before creating the PNG or JPEG image from screen
554 wxYield();
555
556 if( !SaveCanvasImageToFile( editFrame, dlg.GetPath(), BITMAP_TYPE::PNG ) )
557 {
558 wxMessageBox( wxString::Format( _( "Can't save file '%s'." ), dlg.GetPath() ) );
559 }
560 }
561
562 return 0;
563}
bool SaveCanvasImageToFile(EDA_DRAW_FRAME *aFrame, const wxString &aFileName, BITMAP_TYPE aBitmapType)
Save the current view as an image file.
Definition: bitmap.cpp:216
wxString PngFileWildcard()
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

References _, Format(), SYMBOL_EDIT_FRAME::GetCurSymbol(), LIB_SYMBOL::GetName(), PROJECT::GetProjectFullName(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor, PNG, PngFileWildcard(), KIWAY_HOLDER::Prj(), and SaveCanvasImageToFile().

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

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), and ZONE_CREATE_HELPER::setUniquePriority().

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

122 {
123 return m_toolId;
124 }

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

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

References TOOL_BASE::getModelInt().

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

◆ getModelInt()

EDA_ITEM * TOOL_BASE::getModelInt ( ) const
privateinherited

Definition at line 54 of file tool_base.cpp.

55{
56 return m_toolMgr->GetModel();
57}
EDA_ITEM * GetModel() const
Definition: tool_manager.h:292

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

Referenced by TOOL_BASE::getModel().

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

135 {
136 return m_toolName;
137 }
std::string m_toolName
Definition: tool_base.h:214

References TOOL_BASE::m_toolName.

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

◆ getToolHolderInt()

TOOLS_HOLDER * TOOL_BASE::getToolHolderInt ( ) const
privateinherited

Definition at line 48 of file tool_base.cpp.

49{
50 return m_toolMgr->GetToolHolder();
51}
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:296

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

Referenced by TOOL_BASE::getEditFrame().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

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:285

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(), SCH_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), EE_SELECTION_TOOL::GuessSelectionCandidates(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), ROUTER_TOOL::handleCommonEvents(), EE_SELECTION_TOOL::highlight(), PL_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::highlightNet(), PNS::TOOL_BASE::highlightNets(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EE_SELECTION_TOOL::Reset(), EE_TOOL_BASE< T >::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PNS::TOOL_BASE::Reset(), BOARD_EDITOR_CONTROL::Reset(), DRAWING_TOOL::Reset(), PCB_CONTROL::Reset(), PCB_SELECTION_TOOL::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::selectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleERCErrors(), SCH_EDITOR_CONTROL::ToggleERCExclusions(), SCH_EDITOR_CONTROL::ToggleERCWarnings(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_EDITOR_CONTROL::ToggleOPCurrents(), SCH_EDITOR_CONTROL::ToggleOPVoltages(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PL_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_FIND_REPLACE_TOOL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< T >::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_SELECTION_TOOL::view(), PCB_TOOL_BASE::view(), PCB_VIEWER_TOOLS::view(), EE_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox(), 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}
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:287

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

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), PCB_SELECTION_TOOL::controls(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), COMMON_TOOLS::CursorControl(), EDIT_TOOL::DeleteItems(), 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(), SCH_DRAWING_TOOLS::DrawShape(), 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_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), 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(), DRAWING_TOOL::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), DRAWING_TOOL::Reset(), PCB_POINT_EDITOR::Reset(), COMMON_TOOLS::ResetLocalCoords(), ROUTER_TOOL::RouteSelected(), PCB_SELECTION_TOOL::selectCursor(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCB_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_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}
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58

References TOOL_INTERACTIVE::goInternal().

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

◆ goInternal()

void TOOL_INTERACTIVE::goInternal ( TOOL_STATE_FUNC aState,
const TOOL_EVENT_LIST aConditions 
)
privateinherited

Definition at line 70 of file tool_interactive.cpp.

71{
72 m_toolMgr->ScheduleNextState( this, aState, aConditions );
73}
void ScheduleNextState(TOOL_BASE *aTool, TOOL_STATE_FUNC &aHandler, const TOOL_EVENT_LIST &aConditions)
Define a state transition.

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

Referenced by TOOL_INTERACTIVE::Go().

◆ Init()

bool SYMBOL_EDITOR_CONTROL::Init ( )
overridevirtual

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

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

Reimplemented from TOOL_BASE.

Definition at line 42 of file symbol_editor_control.cpp.

43{
44 m_frame = getEditFrame<SCH_BASE_FRAME>();
47
49 {
50 CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
51 SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
52
53 wxCHECK( editFrame, false );
54
55 auto libSelectedCondition =
56 [ editFrame ]( const SELECTION& aSel )
57 {
58 LIB_ID sel = editFrame->GetTreeLIBID();
59 return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
60 };
61 // The libInferredCondition allows you to do things like New Symbol and Paste with a
62 // symbol selected (in other words, when we know the library context even if the library
63 // itself isn't selected.
64 auto libInferredCondition =
65 [ editFrame ]( const SELECTION& aSel )
66 {
67 LIB_ID sel = editFrame->GetTreeLIBID();
68 return !sel.GetLibNickname().empty();
69 };
70 auto pinnedLibSelectedCondition =
71 [ editFrame ]( const SELECTION& aSel )
72 {
73 LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
74 return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
75 };
76 auto unpinnedLibSelectedCondition =
77 [ editFrame ](const SELECTION& aSel )
78 {
79 LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode();
80 return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
81 };
82 auto symbolSelectedCondition =
83 [ editFrame ]( const SELECTION& aSel )
84 {
85 LIB_ID sel = editFrame->GetTargetLibId();
86 return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
87 };
88 auto saveSymbolAsCondition =
89 [ editFrame ]( const SELECTION& aSel )
90 {
91 LIB_ID sel = editFrame->GetTargetLibId();
92 return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
93 };
94 auto multiSelectedCondition =
95 [ editFrame ]( const SELECTION& aSel )
96 {
97 return editFrame->GetTreeSelectionCount() > 1;
98 };
99
100 ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
101 ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
102
103 ctxMenu.AddSeparator();
104 ctxMenu.AddItem( EE_ACTIONS::newSymbol, libInferredCondition );
105 ctxMenu.AddItem( EE_ACTIONS::deriveFromExistingSymbol, symbolSelectedCondition );
106
107 ctxMenu.AddSeparator();
108 ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition || libInferredCondition );
109 ctxMenu.AddItem( EE_ACTIONS::saveLibraryAs, libSelectedCondition );
110 ctxMenu.AddItem( EE_ACTIONS::saveSymbolAs, saveSymbolAsCondition );
111 ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition || libInferredCondition );
112
113 ctxMenu.AddSeparator();
114 ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition || multiSelectedCondition );
115 ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition || multiSelectedCondition );
116 ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, libInferredCondition );
117 ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition );
118 ctxMenu.AddItem( EE_ACTIONS::renameSymbol, symbolSelectedCondition );
119 ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition || multiSelectedCondition );
120
121 ctxMenu.AddSeparator();
122 ctxMenu.AddItem( EE_ACTIONS::importSymbol, libInferredCondition );
123 ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
124
125 // If we've got nothing else to show, at least show a hide tree option
126 ctxMenu.AddItem( EE_ACTIONS::hideSymbolTree, !libInferredCondition );
127 }
128
129 return true;
130}
static TOOL_ACTION revert
Definition: actions.h:55
static TOOL_ACTION pinLibrary
Definition: actions.h:113
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION unpinLibrary
Definition: actions.h:114
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
static TOOL_ACTION saveSymbolAs
Definition: ee_actions.h:182
static TOOL_ACTION duplicateSymbol
Definition: ee_actions.h:186
static TOOL_ACTION saveLibraryAs
Definition: ee_actions.h:181
static TOOL_ACTION hideSymbolTree
Definition: ee_actions.h:230
static TOOL_ACTION renameSymbol
Definition: ee_actions.h:187
static TOOL_ACTION exportSymbol
Definition: ee_actions.h:193
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:191
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
enum TYPE m_Type
int GetTreeSelectionCount() const
LIB_TREE_NODE * GetCurrentTreeNode() const
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44
bool empty() const
Definition: utf8.h:103

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddSeparator(), EE_ACTIONS::copySymbol, EE_ACTIONS::cutSymbol, EE_ACTIONS::deleteSymbol, EE_ACTIONS::deriveFromExistingSymbol, EE_ACTIONS::duplicateSymbol, UTF8::empty(), EE_ACTIONS::exportSymbol, FRAME_SCH_SYMBOL_EDITOR, SYMBOL_EDIT_FRAME::GetCurrentTreeNode(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), TOOL_MENU::GetMenu(), SYMBOL_EDIT_FRAME::GetTargetLibId(), TOOL_MANAGER::GetTool(), SYMBOL_EDIT_FRAME::GetTreeLIBID(), SYMBOL_EDIT_FRAME::GetTreeSelectionCount(), EE_ACTIONS::hideSymbolTree, EE_ACTIONS::importSymbol, EDA_BASE_FRAME::IsType(), LIB_TREE_NODE::LIB, EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor, TOOL_INTERACTIVE::m_menu, LIB_TREE_NODE::m_Pinned, EE_TOOL_BASE< SCH_BASE_FRAME >::m_selectionTool, TOOL_BASE::m_toolMgr, LIB_TREE_NODE::m_Type, EE_ACTIONS::newSymbol, EE_ACTIONS::pasteSymbol, ACTIONS::pinLibrary, EE_ACTIONS::renameSymbol, ACTIONS::revert, ACTIONS::save, EE_ACTIONS::saveLibraryAs, EE_ACTIONS::saveSymbolAs, and ACTIONS::unpinLibrary.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32{
34}
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(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ OnDeMorgan()

int SYMBOL_EDITOR_CONTROL::OnDeMorgan ( const TOOL_EVENT aEvent)

Definition at line 412 of file symbol_editor_control.cpp.

413{
415 LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN;
416
418 {
421
422 SYMBOL_EDIT_FRAME* symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
423 symbolEditor->SetConvert( convert );
424
426 symbolEditor->RebuildView();
427 }
429 {
430 SYMBOL_VIEWER_FRAME* symbolViewer = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
431 symbolViewer->SetUnitAndConvert( symbolViewer->GetUnit(), convert );
432 }
433
434 return 0;
435}
static TOOL_ACTION cancelInteractive
Definition: actions.h:63
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:134
void SetConvert(int aConvert)
void SetUnitAndConvert(int aUnit, int aConvert)
Set unit and convert, and set flag preventing them from automatically resetting to 1.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
@ FRAME_SCH_VIEWER_MODAL
Definition: frame_type.h:37

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, convert, FRAME_SCH_SYMBOL_EDITOR, FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, SYMBOL_VIEWER_FRAME::GetUnit(), TOOL_EVENT::IsAction(), EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, TOOL_BASE::m_toolMgr, TOOL_BASE::MODEL_RELOAD, SYMBOL_EDIT_FRAME::RebuildView(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::RunAction(), SYMBOL_EDIT_FRAME::SetConvert(), SYMBOL_VIEWER_FRAME::SetUnitAndConvert(), and EE_ACTIONS::showDeMorganStandard.

Referenced by setTransitions().

◆ PinLibrary()

int SYMBOL_EDITOR_CONTROL::PinLibrary ( const TOOL_EVENT aEvent)

Definition at line 438 of file symbol_editor_control.cpp.

439{
441 {
442 SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
443 LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
444
445 if( currentNode && !currentNode->m_Pinned )
446 {
447 m_frame->Prj().PinLibrary( currentNode->m_LibId.GetLibNickname(), true );
448
449 currentNode->m_Pinned = true;
450 editFrame->RegenerateLibraryTree();
451 }
452 }
453
454 return 0;
455}
void PinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
Definition: project.cpp:156
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.

References FRAME_SCH_SYMBOL_EDITOR, SYMBOL_EDIT_FRAME::GetCurrentTreeNode(), LIB_ID::GetLibNickname(), EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, LIB_TREE_NODE::m_LibId, LIB_TREE_NODE::m_Pinned, PROJECT::PinLibrary(), KIWAY_HOLDER::Prj(), and SYMBOL_EDIT_FRAME::RegenerateLibraryTree().

Referenced by setTransitions().

◆ RenameSymbol()

int SYMBOL_EDITOR_CONTROL::RenameSymbol ( const TOOL_EVENT aEvent)

Definition at line 322 of file symbol_editor_control.cpp.

323{
325 {
326 SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
327 LIB_SYMBOL_LIBRARY_MANAGER& libMgr = editFrame->GetLibManager();
328
329 LIB_ID libId = editFrame->GetTreeLIBID();
330 wxString libName = libId.GetLibNickname();
331 wxString symbolName = libId.GetLibItemName();
332 wxString newName = symbolName;
333 bool done = false;
334
335 if( !libMgr.LibraryExists( libName ) )
336 return 0;
337
338 while( !done )
339 {
340 wxTextEntryDialog dlg( m_frame, _( "New name:" ), _( "Change Symbol Name" ), newName );
341
342 if( dlg.ShowModal() != wxID_OK )
343 return 0; // canceled by user
344
345 newName = EscapeString( dlg.GetValue(), CTX_LIBID );
346 newName.Trim( true ).Trim( false );
347
348 if( newName.IsEmpty() )
349 {
350 DisplayErrorMessage( editFrame, _( "Symbol name cannot be empty." ) );
351 }
352 else if( libMgr.SymbolExists( newName, libName ) )
353 {
354 DisplayErrorMessage( editFrame, wxString::Format( _( "Symbol name '%s' already "
355 "in use in library '%s'." ),
356 UnescapeString( newName ),
357 libName ) );
358 newName = symbolName;
359 }
360 else
361 {
362 done = true;
363 }
364 }
365
366 wxString oldName = symbolName;
367 LIB_SYMBOL* libSymbol = nullptr;
368
369 if( editFrame->IsCurrentSymbol( libId ) )
370 {
371 // Update buffered copy
372 libSymbol = libMgr.GetBufferedSymbol( oldName, libName );
373
374 libSymbol->SetName( newName );
375 libSymbol->GetFieldById( VALUE_FIELD )->SetText( newName );
376
377 libMgr.UpdateSymbolAfterRename( libSymbol, newName, libName );
378
379 // Now update canvasy copy
380 libSymbol = editFrame->GetCurSymbol();
381
382 libSymbol->SetName( newName );
383 libSymbol->GetFieldById( VALUE_FIELD )->SetText( newName );
384
385 editFrame->RebuildView();
386 editFrame->OnModify();
387
388 // N.B. The view needs to be rebuilt first as the Symbol Properties change may
389 // invalidate the view pointers by rebuilting the field table
390 editFrame->UpdateMsgPanel();
391 }
392 else
393 {
394 libSymbol = libMgr.GetBufferedSymbol( oldName, libName );
395
396 libSymbol->SetName( newName );
397 libSymbol->GetFieldById( VALUE_FIELD )->SetText( newName );
398
399 libMgr.UpdateSymbolAfterRename( libSymbol, newName, libName );
400 libMgr.SetSymbolModified( newName, libName );
401 }
402
403 wxDataViewItem treeItem = libMgr.GetAdapter()->FindItem( libId );
404 editFrame->UpdateLibraryTree( treeItem, libSymbol );
405 editFrame->FocusOnLibId( LIB_ID( libName, newName ) );
406 }
407
408 return 0;
409}
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:165
Symbol library management helper that is specific to the symbol library editor frame.
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > & GetAdapter()
Return the adapter object that provides the stored data.
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:437
bool IsCurrentSymbol(const LIB_ID &aLibId) const
Restore the empty editor screen, without any symbol or library selected.
void FocusOnLibId(const LIB_ID &aLibID)
void UpdateMsgPanel() override
Redraw the message panel.
void UpdateLibraryTree(const wxDataViewItem &aTreeItem, LIB_SYMBOL *aSymbol)
Update a symbol node in the library tree.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
LIB_SYMBOL * GetBufferedSymbol(const wxString &aAlias, const wxString &aLibrary)
Return the symbol copy from the buffer.
bool UpdateSymbolAfterRename(LIB_SYMBOL *aSymbol, const wxString &oldAlias, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol when the name has changed.
bool LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Return true if library exists.
void SetSymbolModified(const wxString &aAlias, const wxString &aLibrary)
bool SymbolExists(const wxString &aAlias, const wxString &aLibrary) const
Return true if symbol with a specific alias exists in library (either original one or buffered).
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LIBID
Definition: string_utils.h:55
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".

References _, CTX_LIBID, DisplayErrorMessage(), EscapeString(), SYMBOL_EDIT_FRAME::FocusOnLibId(), Format(), FRAME_SCH_SYMBOL_EDITOR, LIB_SYMBOL_LIBRARY_MANAGER::GetAdapter(), SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol(), SYMBOL_EDIT_FRAME::GetCurSymbol(), LIB_SYMBOL::GetFieldById(), LIB_ID::GetLibItemName(), SYMBOL_EDIT_FRAME::GetLibManager(), LIB_ID::GetLibNickname(), SYMBOL_EDIT_FRAME::GetTreeLIBID(), SYMBOL_EDIT_FRAME::IsCurrentSymbol(), EDA_BASE_FRAME::IsType(), SYMBOL_LIBRARY_MANAGER::LibraryExists(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, SYMBOL_EDIT_FRAME::OnModify(), SYMBOL_EDIT_FRAME::RebuildView(), LIB_SYMBOL::SetName(), SYMBOL_LIBRARY_MANAGER::SetSymbolModified(), EDA_TEXT::SetText(), SYMBOL_LIBRARY_MANAGER::SymbolExists(), UnescapeString(), SYMBOL_EDIT_FRAME::UpdateLibraryTree(), SYMBOL_EDIT_FRAME::UpdateMsgPanel(), SYMBOL_LIBRARY_MANAGER::UpdateSymbolAfterRename(), and VALUE_FIELD.

Referenced by setTransitions().

◆ Reset()

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

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

87 {
88 if( aReason == MODEL_RELOAD )
89 {
90 // Init variables used by every drawing tool
91 m_frame = getEditFrame<T>();
92 m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) != nullptr;
93 }
94
95 m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
96 }
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36

◆ resetTransitions()

void TOOL_INTERACTIVE::resetTransitions ( )
privateinherited

Clear the current transition map and restores the default one created by setTransitions().

Definition at line 63 of file tool_interactive.cpp.

64{
67}
virtual void setTransitions()=0
This method is meant to be overridden in order to specify handlers for events.
void ClearTransitions(TOOL_BASE *aTool)
Clear the state transition map for a tool.

References TOOL_MANAGER::ClearTransitions(), TOOL_BASE::m_toolMgr, and TOOL_INTERACTIVE::setTransitions().

◆ Revert()

int SYMBOL_EDITOR_CONTROL::Revert ( const TOOL_EVENT aEvent)

Definition at line 231 of file symbol_editor_control.cpp.

232{
234 static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->Revert();
235
236 return 0;
237}
int Revert(const TOOL_EVENT &aEvent)

References FRAME_SCH_SYMBOL_EDITOR, EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, and Revert().

Referenced by Revert(), and setTransitions().

◆ 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}
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

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

Referenced by DRAWING_TOOL::PlaceText().

◆ Save()

int SYMBOL_EDITOR_CONTROL::Save ( const TOOL_EVENT aEvt)

Definition at line 211 of file symbol_editor_control.cpp.

212{
214 {
215 SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
216
217 if( aEvt.IsAction( &EE_ACTIONS::save ) )
218 editFrame->Save();
219 else if( aEvt.IsAction( &EE_ACTIONS::saveLibraryAs ) )
220 editFrame->SaveLibraryAs();
221 else if( aEvt.IsAction( &EE_ACTIONS::saveSymbolAs ) )
222 editFrame->SaveSymbolAs();
223 else if( aEvt.IsAction( &EE_ACTIONS::saveAll ) )
224 editFrame->SaveAll();
225 }
226
227 return 0;
228}
static TOOL_ACTION saveAll
Definition: actions.h:54
void SaveAll()
Save all modified symbols and libraries.
void Save()
Save the selected symbol or library.
void SaveSymbolAs()
Save the currently selected symbol to a new name and/or location.
void SaveLibraryAs()
Save the currently selected library to a new file.

References FRAME_SCH_SYMBOL_EDITOR, TOOL_EVENT::IsAction(), EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, SYMBOL_EDIT_FRAME::Save(), ACTIONS::save, SYMBOL_EDIT_FRAME::SaveAll(), ACTIONS::saveAll, SYMBOL_EDIT_FRAME::SaveLibraryAs(), EE_ACTIONS::saveLibraryAs, SYMBOL_EDIT_FRAME::SaveSymbolAs(), and EE_ACTIONS::saveSymbolAs.

Referenced by setTransitions().

◆ saveCopyInUndoList()

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

Definition at line 134 of file ee_tool_base.h.

136 {
137 wxASSERT( aItem );
138
139 KICAD_T itemType = aItem->Type();
140 bool selected = aItem->IsSelected();
141
142 // IS_SELECTED flag should not be set on undo items which were added for
143 // a drag operation.
144 if( selected && aItem->HasFlag( SELECTED_BY_DRAG ) )
145 aItem->ClearSelected();
146
147 if( m_isSymbolEditor )
148 {
149 SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
150 wxCHECK_RET( editFrame, wxT( "editFrame is null" ) );
151
152 editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
153 }
154 else
155 {
156 SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
157 wxASSERT( editFrame );
158
159 if( editFrame )
160 {
161 if( itemType == SCH_FIELD_T )
162 {
163 editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
164 static_cast<SCH_ITEM*>( aItem->GetParent() ),
165 UNDO_REDO::CHANGED, aAppend,
166 false );
167 }
168 else if( itemType == SCH_PIN_T || itemType == SCH_SHEET_PIN_T )
169 {
170 editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
171 static_cast<SCH_ITEM*>( aItem->GetParent() ),
172 UNDO_REDO::CHANGED, aAppend,
173 aDirtyConnectivity );
174 }
175 else
176 {
177 editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
178 static_cast<SCH_ITEM*>( aItem ), aType,
179 aAppend, aDirtyConnectivity );
180 }
181 }
182 }
183
184 if( selected && aItem->HasFlag( SELECTED_BY_DRAG ) )
185 aItem->SetSelected();
186 }
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
void ClearSelected()
Definition: eda_item.h:118
bool IsSelected() const
Definition: eda_item.h:106
void SetSelected()
Definition: eda_item.h:115
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:143
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
void SaveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current symbol, and save it in the undo list.
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_FIELD_T
Definition: typeinfo.h:155
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157
@ SCH_PIN_T
Definition: typeinfo.h:159

◆ 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}
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.
@ CMENU_OFF
Definition: tool_event.h:149

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

Referenced by SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void SYMBOL_EDITOR_CONTROL::setTransitions ( )
overrideprivatevirtual

< Set up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 687 of file symbol_editor_control.cpp.

688{
695
697
703
714
717
725}
static TOOL_ACTION addLibrary
Definition: actions.h:49
static TOOL_ACTION ddAddLibrary
Definition: actions.h:60
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:135
static TOOL_ACTION editSymbol
Definition: ee_actions.h:185
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:176
static TOOL_ACTION showPinNumbers
Definition: ee_actions.h:228
static TOOL_ACTION exportSymbolAsSVG
Definition: ee_actions.h:233
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:221
static TOOL_ACTION showSymbolTree
Definition: ee_actions.h:229
static TOOL_ACTION exportSymbolView
Definition: ee_actions.h:232
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:227
int ToggleSyncedPinsMode(const TOOL_EVENT &aEvent)
int OnDeMorgan(const TOOL_EVENT &aEvent)
int Save(const TOOL_EVENT &aEvt)
int EditSymbol(const TOOL_EVENT &aEvent)
int ExportView(const TOOL_EVENT &aEvent)
int ShowElectricalTypes(const TOOL_EVENT &aEvent)
int DuplicateSymbol(const TOOL_EVENT &aEvent)
int UnpinLibrary(const TOOL_EVENT &aEvent)
int AddLibrary(const TOOL_EVENT &aEvent)
int AddSymbol(const TOOL_EVENT &aEvent)
int ToggleSymbolTree(const TOOL_EVENT &aEvent)
int ExportSymbolAsSVG(const TOOL_EVENT &aEvent)
int ShowPinNumbers(const TOOL_EVENT &aEvent)
int DdAddLibrary(const TOOL_EVENT &aEvent)
int AddSymbolToSchematic(const TOOL_EVENT &aEvent)
int PinLibrary(const TOOL_EVENT &aEvent)
int RenameSymbol(const TOOL_EVENT &aEvent)
int CutCopyDelete(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).

References AddLibrary(), ACTIONS::addLibrary, AddSymbol(), EE_ACTIONS::addSymbolToSchematic, AddSymbolToSchematic(), EE_ACTIONS::copySymbol, CutCopyDelete(), EE_ACTIONS::cutSymbol, DdAddLibrary(), ACTIONS::ddAddLibrary, EE_ACTIONS::deleteSymbol, EE_ACTIONS::deriveFromExistingSymbol, EE_ACTIONS::duplicateSymbol, DuplicateSymbol(), EE_ACTIONS::editSymbol, EditSymbol(), EE_ACTIONS::exportSymbol, ExportSymbol(), EE_ACTIONS::exportSymbolAsSVG, ExportSymbolAsSVG(), EE_ACTIONS::exportSymbolView, ExportView(), TOOL_INTERACTIVE::Go(), EE_ACTIONS::hideSymbolTree, EE_ACTIONS::importSymbol, ACTIONS::newLibrary, EE_ACTIONS::newSymbol, OnDeMorgan(), EE_ACTIONS::pasteSymbol, PinLibrary(), ACTIONS::pinLibrary, EE_ACTIONS::renameSymbol, RenameSymbol(), Revert(), ACTIONS::revert, Save(), ACTIONS::save, ACTIONS::saveAll, EE_ACTIONS::saveLibraryAs, EE_ACTIONS::saveSymbolAs, EE_ACTIONS::showDeMorganAlternate, EE_ACTIONS::showDeMorganStandard, EE_ACTIONS::showElectricalTypes, ShowElectricalTypes(), EE_ACTIONS::showPinNumbers, ShowPinNumbers(), EE_ACTIONS::showSymbolTree, ToggleSymbolTree(), EE_ACTIONS::toggleSyncedPinsMode, ToggleSyncedPinsMode(), UnpinLibrary(), and ACTIONS::unpinLibrary.

◆ ShowElectricalTypes()

int SYMBOL_EDITOR_CONTROL::ShowElectricalTypes ( const TOOL_EVENT aEvent)

Definition at line 490 of file symbol_editor_control.cpp.

491{
493 renderSettings->m_ShowPinsElectricalType = !renderSettings->m_ShowPinsElectricalType;
494
495 // Update canvas
498
499 return 0;
500}
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Store schematic specific render settings.
Definition: sch_painter.h:71
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1484
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52

References SCH_BASE_FRAME::GetCanvas(), SCH_BASE_FRAME::GetRenderSettings(), SCH_DRAW_PANEL::GetView(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, KIGFX::SCH_RENDER_SETTINGS::m_ShowPinsElectricalType, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, and KIGFX::VIEW::UpdateAllItems().

Referenced by setTransitions().

◆ ShowPinNumbers()

◆ ToggleSymbolTree()

int SYMBOL_EDITOR_CONTROL::ToggleSymbolTree ( const TOOL_EVENT aEvent)

Definition at line 478 of file symbol_editor_control.cpp.

479{
481 {
482 wxCommandEvent dummy;
483 static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->OnToggleSymbolTree( dummy );
484 }
485
486 return 0;
487}
std::vector< FAB_LAYER_COLOR > dummy

References dummy, FRAME_SCH_SYMBOL_EDITOR, EDA_BASE_FRAME::IsType(), and EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame.

Referenced by setTransitions().

◆ ToggleSyncedPinsMode()

int SYMBOL_EDITOR_CONTROL::ToggleSyncedPinsMode ( const TOOL_EVENT aEvent)

Definition at line 516 of file symbol_editor_control.cpp.

517{
518 if( !m_isSymbolEditor )
519 return 0;
520
521 SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
522 editFrame->m_SyncPinEdit = !editFrame->m_SyncPinEdit;
523
524 return 0;
525}
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...

References EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor, and SYMBOL_EDIT_FRAME::m_SyncPinEdit.

Referenced by setTransitions().

◆ UnpinLibrary()

int SYMBOL_EDITOR_CONTROL::UnpinLibrary ( const TOOL_EVENT aEvent)

Definition at line 458 of file symbol_editor_control.cpp.

459{
461 {
462 SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
463 LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode();
464
465 if( currentNode && currentNode->m_Pinned )
466 {
467 m_frame->Prj().UnpinLibrary( currentNode->m_LibId.GetLibNickname(), true );
468
469 currentNode->m_Pinned = false;
470 editFrame->RegenerateLibraryTree();
471 }
472 }
473
474 return 0;
475}
void UnpinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
Definition: project.cpp:177

References FRAME_SCH_SYMBOL_EDITOR, SYMBOL_EDIT_FRAME::GetCurrentTreeNode(), LIB_ID::GetLibNickname(), EDA_BASE_FRAME::IsType(), EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame, LIB_TREE_NODE::m_LibId, LIB_TREE_NODE::m_Pinned, KIWAY_HOLDER::Prj(), SYMBOL_EDIT_FRAME::RegenerateLibraryTree(), and PROJECT::UnpinLibrary().

Referenced by setTransitions().

◆ updateItem()

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

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

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

Definition at line 103 of file ee_tool_base.h.

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

Member Data Documentation

◆ m_frame

SCH_BASE_FRAME * EE_TOOL_BASE< SCH_BASE_FRAME >::m_frame
protectedinherited

Definition at line 189 of file ee_tool_base.h.

◆ m_isSymbolEditor

bool EE_TOOL_BASE< SCH_BASE_FRAME >::m_isSymbolEditor
protectedinherited

Definition at line 192 of file ee_tool_base.h.

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), EDA_3D_CONTROLLER::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< T >::Init(), SCH_DRAWING_TOOLS::Init(), SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), ZOOM_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_SELECTION_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), DRAWING_TOOL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PCB_VIEWER_TOOLS::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_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::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ m_selectionTool

EE_SELECTION_TOOL* EE_TOOL_BASE< SCH_BASE_FRAME >::m_selectionTool
protectedinherited

Definition at line 191 of file ee_tool_base.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

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

Referenced by TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), BOARD_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ChangeLineMode(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), SCH_EDITOR_CONTROL::ClearHighlight(), BOARD_INSPECTION_TOOL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), SCH_EDITOR_CONTROL::doCopy(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), 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(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::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(), PCB_SELECTION_TOOL::EnterGroup(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::ExitGroup(), 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(), PCB_SELECTION_TOOL::grabUnconnected(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), DRAWING_TOOL::Init(), EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), PCB_POINT_EDITOR::Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_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(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::NextLineMode(), OnDeMorgan(), SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::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::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), GERBVIEW_CONTROL::Print(), PCB_CONTROL::Print(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::rebuildConnectivity(), ZONE_FILLER_TOOL::rebuildConnectivity(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDITOR_CONTROL::Redo(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), PCB_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SCH_EDITOR_CONTROL::Revert(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_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(), SCH_EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), COMMON_TOOLS::ToggleCursor(), COMMON_TOOLS::ToggleCursorStyle(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SCH_MOVE_TOOL::trimDanglingLines(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), GROUP_TOOL::Ungroup(), PCB_SELECTION_TOOL::unrouteSelected(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), 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 214 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 207 of file tool_base.h.

Referenced by TOOL_BASE::GetType().

◆ m_view

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

Definition at line 190 of file ee_tool_base.h.


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