KiCad PCB EDA Suite
GERBVIEW_CONTROL Class Reference

Handle actions that are shared between different frames in Pcbnew. More...

#include <gerbview_control.h>

Inheritance diagram for GERBVIEW_CONTROL:
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

 GERBVIEW_CONTROL ()
 
 ~GERBVIEW_CONTROL () override
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
int DisplayControl (const TOOL_EVENT &aEvent)
 
int LayerNext (const TOOL_EVENT &aEvent)
 
int LayerPrev (const TOOL_EVENT &aEvent)
 
int MoveLayerUp (const TOOL_EVENT &aEvent)
 
int MoveLayerDown (const TOOL_EVENT &aEvent)
 
int ClearLayer (const TOOL_EVENT &aEvent)
 
int ClearAllLayers (const TOOL_EVENT &aEvent)
 
int ReloadAllLayers (const TOOL_EVENT &aEvent)
 
int OpenAutodetected (const TOOL_EVENT &aEvent)
 
int OpenGerber (const TOOL_EVENT &aEvent)
 
int OpenDrillFile (const TOOL_EVENT &aEvent)
 
int OpenJobFile (const TOOL_EVENT &aEvent)
 
int OpenZipFile (const TOOL_EVENT &aEvent)
 
int ToggleLayerManager (const TOOL_EVENT &aEvent)
 
int HighlightControl (const TOOL_EVENT &aEvent)
 
int ExportToPcbnew (const TOOL_EVENT &aEvent)
 
int UpdateMessagePanel (const TOOL_EVENT &aEvent)
 
int Print (const TOOL_EVENT &aEvent)
 
int LoadZipfile (const TOOL_EVENT &aEvent)
 
int LoadGerbFiles (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

EDA_DRAW_PANEL_GALcanvas ()
 
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

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
 

Private Attributes

GERBVIEW_FRAMEm_frame
 

Detailed Description

Handle actions that are shared between different frames in Pcbnew.

Definition at line 33 of file gerbview_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

◆ GERBVIEW_CONTROL()

GERBVIEW_CONTROL::GERBVIEW_CONTROL ( )

Definition at line 43 of file gerbview_control.cpp.

43 : TOOL_INTERACTIVE( "gerbview.Control" ), m_frame( nullptr )
44{
45}
GERBVIEW_FRAME * m_frame
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.

◆ ~GERBVIEW_CONTROL()

GERBVIEW_CONTROL::~GERBVIEW_CONTROL ( )
inlineoverride

Definition at line 37 of file gerbview_control.h.

37{ }

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

◆ 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().

◆ canvas()

EDA_DRAW_PANEL_GAL * GERBVIEW_CONTROL::canvas ( )
inlineprotected

Definition at line 79 of file gerbview_control.h.

80 {
81 return m_frame->GetCanvas();
82 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.

References EDA_DRAW_FRAME::GetCanvas(), and m_frame.

Referenced by ClearAllLayers(), HighlightControl(), LoadZipfile(), OpenJobFile(), and OpenZipFile().

◆ ClearAllLayers()

int GERBVIEW_CONTROL::ClearAllLayers ( const TOOL_EVENT aEvent)

Definition at line 401 of file gerbview_control.cpp.

402{
403 m_frame->Clear_DrawLayers( false );
405 canvas()->Refresh();
407
408 // Clear pending highlight selections, now outdated
410 static_cast<KIGFX::GERBVIEW_PAINTER*>( getView()->GetPainter() )->GetSettings();
411 settings->ClearHighlightSelections();
412
413 return 0;
414}
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
virtual void ClearMsgPanel()
Clear all messages from the message panel.
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...
EDA_DRAW_PANEL_GAL * canvas()
bool Clear_DrawLayers(bool query)
Methods for drawing GerbView specific items.
Store GerbView specific render settings.
void ClearHighlightSelections()
Clear all highlight selections (dcode, net, component, attribute selection)
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142

References canvas(), GERBVIEW_FRAME::Clear_DrawLayers(), KIGFX::GERBVIEW_RENDER_SETTINGS::ClearHighlightSelections(), EDA_DRAW_FRAME::ClearMsgPanel(), KIGFX::VIEW::GetPainter(), TOOL_BASE::getView(), m_frame, TOOL_BASE::m_toolMgr, EDA_DRAW_PANEL_GAL::Refresh(), TOOL_MANAGER::RunAction(), and ACTIONS::zoomFitScreen.

Referenced by setTransitions().

◆ ClearLayer()

int GERBVIEW_CONTROL::ClearLayer ( const TOOL_EVENT aEvent)

Definition at line 392 of file gerbview_control.cpp.

393{
396
397 return 0;
398}
void Erase_Current_DrawLayer(bool query)

References EDA_DRAW_FRAME::ClearMsgPanel(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), and m_frame.

Referenced by setTransitions().

◆ DisplayControl()

int GERBVIEW_CONTROL::DisplayControl ( const TOOL_EVENT aEvent)

Definition at line 233 of file gerbview_control.cpp.

234{
236 KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
237
239 {
241
243 []( KIGFX::VIEW_ITEM* aItem )
244 {
245 GERBER_DRAW_ITEM* item = static_cast<GERBER_DRAW_ITEM*>( aItem );
246
247 switch( item->m_ShapeType )
248 {
249 case GBR_CIRCLE:
250 case GBR_ARC:
251 case GBR_SEGMENT:
252 return true;
253
254 default:
255 return false;
256 }
257 } );
258 }
260 {
262
264 []( KIGFX::VIEW_ITEM* aItem )
265 {
266 GERBER_DRAW_ITEM* item = static_cast<GERBER_DRAW_ITEM*>( aItem );
267
268 switch( item->m_ShapeType )
269 {
270 case GBR_SPOT_CIRCLE:
271 case GBR_SPOT_RECT:
272 case GBR_SPOT_OVAL:
273 case GBR_SPOT_POLY:
274 case GBR_SPOT_MACRO:
275 return true;
276
277 default:
278 return false;
279 }
280 } );
281 }
283 {
285
287 []( KIGFX::VIEW_ITEM* aItem )
288 {
289 GERBER_DRAW_ITEM* item = static_cast<GERBER_DRAW_ITEM*>( aItem );
290
291 return ( item->m_ShapeType == GBR_POLYGON );
292 } );
293 }
295 {
297 }
298 else if( aEvent.IsAction( &GERBVIEW_ACTIONS::dcodeDisplay ) )
299 {
301 }
302 else if( aEvent.IsAction( &ACTIONS::highContrastMode )
304 {
306 }
307 else if( aEvent.IsAction( &GERBVIEW_ACTIONS::toggleDiffMode ) )
308 {
310
311 if( cfg->m_Display.m_DiffMode && cfg->m_Display.m_XORMode )
312 cfg->m_Display.m_XORMode = false;
313
315 }
316 else if( aEvent.IsAction( &GERBVIEW_ACTIONS::toggleXORMode ) )
317 {
319
320 if( cfg->m_Display.m_XORMode && cfg->m_Display.m_DiffMode )
321 cfg->m_Display.m_DiffMode = false;
322
324 }
325 else if( aEvent.IsAction( &GERBVIEW_ACTIONS::flipGerberView ) )
326 {
328 view->SetMirror( cfg->m_Display.m_FlipGerberView, false );
329 }
330
332
335
336 return 0;
337}
static TOOL_ACTION highContrastModeCycle
Definition: actions.h:107
static TOOL_ACTION highContrastMode
Definition: actions.h:106
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
bool m_DiffMode
Display layers in diff mode.
bool m_XORMode
Display layers in exclusive-or mode.
bool m_FlipGerberView
Display as a mirror image.
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
GBR_BASIC_SHAPE_TYPE m_ShapeType
static TOOL_ACTION dcodeDisplay
static TOOL_ACTION negativeObjectDisplay
static TOOL_ACTION flashedDisplayOutlines
static TOOL_ACTION toggleXORMode
static TOOL_ACTION toggleDiffMode
static TOOL_ACTION flipGerberView
static TOOL_ACTION linesDisplayOutlines
static TOOL_ACTION polygonsDisplayOutlines
void UpdateXORLayers()
Update each layers' differential option.
GERBVIEW_SETTINGS * gvconfig() const
void ApplyDisplaySettingsToGAL()
Updates the GAL with display settings changes.
void SetElementVisibility(int aLayerID, bool aNewState)
Change the visibility of an element category.
GBR_DISPLAY_OPTIONS m_Display
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
Definition: view.cpp:538
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1484
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1494
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
@ GBR_SPOT_OVAL
@ GBR_SEGMENT
@ GBR_SPOT_POLY
@ GBR_SPOT_RECT
@ GBR_CIRCLE
@ GBR_POLYGON
@ GBR_SPOT_CIRCLE
@ GBR_ARC
@ GBR_SPOT_MACRO
@ LAYER_DCODES
Definition: layer_ids.h:414
@ LAYER_NEGATIVE_OBJECTS
Definition: layer_ids.h:415
@ COLOR
Color has changed.
Definition: view_item.h:48
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52

References GERBVIEW_FRAME::ApplyDisplaySettingsToGAL(), KIGFX::COLOR, GERBVIEW_ACTIONS::dcodeDisplay, GERBVIEW_ACTIONS::flashedDisplayOutlines, GERBVIEW_ACTIONS::flipGerberView, GBR_ARC, GBR_CIRCLE, GBR_POLYGON, GBR_SEGMENT, GBR_SPOT_CIRCLE, GBR_SPOT_MACRO, GBR_SPOT_OVAL, GBR_SPOT_POLY, GBR_SPOT_RECT, EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetView(), GERBVIEW_FRAME::gvconfig(), ACTIONS::highContrastMode, ACTIONS::highContrastModeCycle, TOOL_EVENT::IsAction(), LAYER_DCODES, LAYER_NEGATIVE_OBJECTS, GERBVIEW_ACTIONS::linesDisplayOutlines, GERBVIEW_SETTINGS::m_Appearance, GBR_DISPLAY_OPTIONS::m_DiffMode, GERBVIEW_SETTINGS::m_Display, GBR_DISPLAY_OPTIONS::m_DisplayFlashedItemsFill, GBR_DISPLAY_OPTIONS::m_DisplayLinesFill, GBR_DISPLAY_OPTIONS::m_DisplayPolygonsFill, GBR_DISPLAY_OPTIONS::m_FlipGerberView, m_frame, GBR_DISPLAY_OPTIONS::m_HighContrastMode, GERBER_DRAW_ITEM::m_ShapeType, GBR_DISPLAY_OPTIONS::m_XORMode, GERBVIEW_ACTIONS::negativeObjectDisplay, GERBVIEW_ACTIONS::polygonsDisplayOutlines, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::REPAINT, GERBVIEW_FRAME::SetElementVisibility(), KIGFX::VIEW::SetMirror(), GERBVIEW_SETTINGS::APPEARANCE::show_dcodes, GERBVIEW_SETTINGS::APPEARANCE::show_negative_objects, GERBVIEW_ACTIONS::toggleDiffMode, GERBVIEW_ACTIONS::toggleXORMode, KIGFX::VIEW::UpdateAllItems(), KIGFX::VIEW::UpdateAllItemsConditionally(), and GERBVIEW_FRAME::UpdateXORLayers().

Referenced by setTransitions().

◆ ExportToPcbnew()

int GERBVIEW_CONTROL::ExportToPcbnew ( const TOOL_EVENT aEvent)

Definition at line 104 of file gerbview_control.cpp.

105{
106 int layercount = 0;
107
109
110 // Count the Gerber layers which are actually currently used
111 for( int ii = 0; ii < (int) images->ImagesMaxCount(); ++ii )
112 {
113 if( images->GetGbrImage( ii ) )
114 layercount++;
115 }
116
117 if( layercount == 0 )
118 {
119 DisplayInfoMessage( m_frame, _( "None of the Gerber layers contain any data" ) );
120 return 0;
121 }
122
123 wxString fileDialogName( NAMELESS_PROJECT + wxT( "." ) + KiCadPcbFileExtension );
124 wxString path = m_frame->GetMruPath();
125
126 wxFileDialog filedlg( m_frame, _( "Board File Name" ), path, fileDialogName, PcbFileWildcard(),
127 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
128
129 if( filedlg.ShowModal() == wxID_CANCEL )
130 return 0;
131
132 wxFileName fileName = filedlg.GetPath();
133
134 /* Install a dialog frame to choose the mapping
135 * between gerber layers and Pcbnew layers
136 */
138 int ok = layerdlg->ShowModal();
139 layerdlg->Destroy();
140
141 if( ok != wxID_OK )
142 return 0;
143
144 // If no extension was entered, then force the extension to be a KiCad PCB file
145 if( !fileName.HasExt() )
146 fileName.SetExt( KiCadPcbFileExtension );
147
148 m_frame->SetMruPath( fileName.GetPath() );
149
150 GBR_TO_PCB_EXPORTER gbr_exporter( m_frame, fileName.GetFullPath() );
151
152 gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable(), layerdlg->GetCopperLayersCount() );
153
154 return 0;
155}
wxString GetMruPath() const
void SetMruPath(const wxString &aPath)
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:41
A helper class to export a Gerber set of files to Pcbnew.
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
GBR_LAYOUT * GetGerberLayout() const
Show the Gerber files loaded and allow the user to choose between Gerber layers and pcb layers.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:352
#define _(s)
const std::string KiCadPcbFileExtension
wxString PcbFileWildcard()
#define NAMELESS_PROJECT
default name for nameless projects
Definition: project.h:42

References _, DisplayInfoMessage(), GBR_TO_PCB_EXPORTER::ExportPcb(), LAYERS_MAP_DIALOG::GetCopperLayersCount(), GERBER_FILE_IMAGE_LIST::GetGbrImage(), GERBVIEW_FRAME::GetGerberLayout(), GBR_LAYOUT::GetImagesList(), LAYERS_MAP_DIALOG::GetLayersLookUpTable(), EDA_BASE_FRAME::GetMruPath(), GERBER_FILE_IMAGE_LIST::ImagesMaxCount(), KiCadPcbFileExtension, m_frame, NAMELESS_PROJECT, path, PcbFileWildcard(), and EDA_BASE_FRAME::SetMruPath().

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(), 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(), 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(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), 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().

◆ HighlightControl()

int GERBVIEW_CONTROL::HighlightControl ( const TOOL_EVENT aEvent)

Definition at line 158 of file gerbview_control.cpp.

159{
160 auto settings = static_cast<KIGFX::GERBVIEW_PAINTER*>( getView()->GetPainter() )->GetSettings();
161 const auto& selection = m_toolMgr->GetTool<GERBVIEW_SELECTION_TOOL>()->GetSelection();
162 GERBER_DRAW_ITEM* item = nullptr;
163
164 if( selection.Size() == 1 )
165 {
166 item = static_cast<GERBER_DRAW_ITEM*>( selection[0] );
167 }
168
170 {
171 m_frame->m_SelComponentBox->SetSelection( 0 );
172 m_frame->m_SelNetnameBox->SetSelection( 0 );
173 m_frame->m_SelAperAttributesBox->SetSelection( 0 );
174
175 settings->ClearHighlightSelections();
176
178
179 if( gerber )
180 gerber->m_Selected_Tool = settings->m_dcodeHighlightValue;
181 }
182 else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightNet ) )
183 {
184 wxString net_name = item->GetNetAttributes().m_Netname;
185 settings->m_netHighlightString = net_name;
186 m_frame->m_SelNetnameBox->SetStringSelection( UnescapeString( net_name ) );
187 }
188 else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightComponent ) )
189 {
190 wxString net_attr = item->GetNetAttributes().m_Cmpref;
191 settings->m_componentHighlightString = net_attr;
192 m_frame->m_SelComponentBox->SetStringSelection( net_attr );
193 }
194 else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightAttribute ) )
195 {
196 D_CODE* apertDescr = item->GetDcodeDescr();
197
198 if( apertDescr )
199 {
200 wxString ap_name = apertDescr->m_AperFunction;
201 settings->m_attributeHighlightString = ap_name;
202 m_frame->m_SelAperAttributesBox->SetStringSelection( ap_name );
203 }
204 }
205 else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightDCode ) )
206 {
207 D_CODE* apertDescr = item->GetDcodeDescr();
208
209 if( apertDescr )
210 {
211 int dcodeSelected = -1;
213
214 if( gerber )
215 dcodeSelected = apertDescr->m_Num_Dcode;
216
217 if( dcodeSelected > 0 )
218 {
219 settings->m_dcodeHighlightValue = dcodeSelected;
220 gerber->m_Selected_Tool = dcodeSelected;
221 m_frame->syncLayerBox( false );
222 }
223 }
224 }
225
227 canvas()->Refresh();
228
229 return 0;
230}
A gerber DCODE (also called Aperture) definition.
Definition: dcode.h:80
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command).
Definition: dcode.h:203
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:193
wxString m_Cmpref
the component reference parent of the data
wxString m_Netname
for items associated to a net: the netname
D_CODE * GetDcodeDescr() const
Return the GetDcodeDescr of this object, or NULL.
const GBR_NETLIST_METADATA & GetNetAttributes() const
Hold the image data and parameters for one gerber file and layer parameters.
static TOOL_ACTION highlightAttribute
static TOOL_ACTION highlightNet
static TOOL_ACTION highlightComponent
static TOOL_ACTION highlightDCode
static TOOL_ACTION highlightClear
wxChoice * m_SelAperAttributesBox
void syncLayerBox(bool aRebuildLayerBox=false)
Update the currently "selected" layer within m_SelLayerBox.
wxChoice * m_SelComponentBox
wxChoice * m_SelNetnameBox
int GetActiveLayer() const
Return the active layer.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
Selection tool for GerbView, based on the one in Pcbnew.
wxString UnescapeString(const wxString &aSource)

References canvas(), KIGFX::COLOR, GERBVIEW_FRAME::GetActiveLayer(), GERBER_DRAW_ITEM::GetDcodeDescr(), GERBVIEW_FRAME::GetGbrImage(), GERBER_DRAW_ITEM::GetNetAttributes(), KIGFX::VIEW::GetPainter(), TOOL_MANAGER::GetTool(), EDA_DRAW_PANEL_GAL::GetView(), TOOL_BASE::getView(), GERBVIEW_ACTIONS::highlightAttribute, GERBVIEW_ACTIONS::highlightClear, GERBVIEW_ACTIONS::highlightComponent, GERBVIEW_ACTIONS::highlightDCode, GERBVIEW_ACTIONS::highlightNet, TOOL_EVENT::IsAction(), D_CODE::m_AperFunction, GBR_NETLIST_METADATA::m_Cmpref, m_frame, GBR_NETLIST_METADATA::m_Netname, D_CODE::m_Num_Dcode, GERBVIEW_FRAME::m_SelAperAttributesBox, GERBVIEW_FRAME::m_SelComponentBox, GERBER_FILE_IMAGE::m_Selected_Tool, GERBVIEW_FRAME::m_SelNetnameBox, TOOL_BASE::m_toolMgr, EDA_DRAW_PANEL_GAL::Refresh(), GERBVIEW_FRAME::syncLayerBox(), UnescapeString(), and KIGFX::VIEW::UpdateAllItems().

Referenced by setTransitions().

◆ Init()

◆ 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().

◆ LayerNext()

int GERBVIEW_CONTROL::LayerNext ( const TOOL_EVENT aEvent)

Definition at line 340 of file gerbview_control.cpp.

341{
342 int layer = m_frame->GetActiveLayer();
343
344 if( layer < ( (int) GERBER_FILE_IMAGE_LIST::GetImagesList().GetLoadedImageCount() - 1 ) )
345 m_frame->SetActiveLayer( layer + 1, true );
346
347 return 0;
348}
static GERBER_FILE_IMAGE_LIST & GetImagesList()
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
change the currently active layer to aLayer and update the GERBER_LAYER_WIDGET.

References GERBVIEW_FRAME::GetActiveLayer(), GERBER_FILE_IMAGE_LIST::GetImagesList(), m_frame, and GERBVIEW_FRAME::SetActiveLayer().

Referenced by setTransitions().

◆ LayerPrev()

int GERBVIEW_CONTROL::LayerPrev ( const TOOL_EVENT aEvent)

Definition at line 351 of file gerbview_control.cpp.

352{
353 int layer = m_frame->GetActiveLayer();
354
355 if( layer > 0 )
356 m_frame->SetActiveLayer( layer - 1, true );
357
358 return 0;
359}

References GERBVIEW_FRAME::GetActiveLayer(), m_frame, and GERBVIEW_FRAME::SetActiveLayer().

Referenced by setTransitions().

◆ LoadGerbFiles()

int GERBVIEW_CONTROL::LoadGerbFiles ( const TOOL_EVENT aEvent)

Set up handlers for various events.

Definition at line 485 of file gerbview_control.cpp.

486{
487 // The event parameter is a string containing names of dropped files.
488 // Each file name has been enclosed with "", so file names with space character are allowed.
489 wxString files = *aEvent.Parameter<wxString*>();
490 // ie : files = "file1""another file""file3"...
491
492 std::vector<wxString> aFileNameList;
493
494 // Isolate each file name, deletting ""
495 files = files.AfterFirst( '"' );
496
497 // Gerber files are enclosed with "".
498 // Load files names in array.
499 while( !files.empty() )
500 {
501 wxString fileName = files.BeforeFirst( '"' );
502 // Check if file exists. If not, keep on and ignore fileName
503 if( wxFileName( fileName ).Exists() )
504 aFileNameList.push_back( fileName );
505 files = files.AfterFirst( '"' );
506 files = files.AfterFirst( '"' );
507 }
508
509 if( !aFileNameList.empty() )
510 m_frame->OpenProjectFiles( aFileNameList, KICTL_CREATE );
511
512 return 0;
513}
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl) override
Open a project or set of files given by aFileList.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:442
#define KICTL_CREATE
caller thinks requested project files may not exist.
Definition: kiway_player.h:82

References KICTL_CREATE, m_frame, GERBVIEW_FRAME::OpenProjectFiles(), and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ LoadZipfile()

int GERBVIEW_CONTROL::LoadZipfile ( const TOOL_EVENT aEvent)

Definition at line 476 of file gerbview_control.cpp.

477{
478 m_frame->LoadZipArchiveFile( *aEvent.Parameter<wxString*>() );
479 canvas()->Refresh();
480
481 return 0;
482}
bool LoadZipArchiveFile(const wxString &aFileName)
Load a zipped archive file.

References canvas(), GERBVIEW_FRAME::LoadZipArchiveFile(), m_frame, TOOL_EVENT::Parameter(), and EDA_DRAW_PANEL_GAL::Refresh().

Referenced by setTransitions().

◆ MoveLayerDown()

int GERBVIEW_CONTROL::MoveLayerDown ( const TOOL_EVENT aEvent)

Definition at line 377 of file gerbview_control.cpp.

378{
379 int layer = m_frame->GetActiveLayer();
381
382 if( layer < ( (int) list.GetLoadedImageCount() - 1 ) )
383 {
384 m_frame->RemapLayers( list.SwapImages( layer, layer + 1 ) );
385 m_frame->SetActiveLayer( layer + 1 );
386 }
387
388 return 0;
389}
std::unordered_map< int, int > SwapImages(unsigned int layer1, unsigned int layer2)
Swap two images and their orders.
unsigned GetLoadedImageCount()
Get number of loaded images.
void RemapLayers(std::unordered_map< int, int > remapping)
Takes a layer remapping and reorders the layers.

References GERBVIEW_FRAME::GetActiveLayer(), GERBER_FILE_IMAGE_LIST::GetImagesList(), GERBER_FILE_IMAGE_LIST::GetLoadedImageCount(), m_frame, GERBVIEW_FRAME::RemapLayers(), GERBVIEW_FRAME::SetActiveLayer(), and GERBER_FILE_IMAGE_LIST::SwapImages().

Referenced by setTransitions().

◆ MoveLayerUp()

int GERBVIEW_CONTROL::MoveLayerUp ( const TOOL_EVENT aEvent)

Definition at line 362 of file gerbview_control.cpp.

363{
364 int layer = m_frame->GetActiveLayer();
365
366 if( layer > 0 )
367 {
369 GERBER_FILE_IMAGE_LIST::GetImagesList().SwapImages( layer, layer - 1 ) );
370 m_frame->SetActiveLayer( layer - 1 );
371 }
372
373 return 0;
374}

References GERBVIEW_FRAME::GetActiveLayer(), GERBER_FILE_IMAGE_LIST::GetImagesList(), m_frame, GERBVIEW_FRAME::RemapLayers(), and GERBVIEW_FRAME::SetActiveLayer().

Referenced by setTransitions().

◆ OpenAutodetected()

int GERBVIEW_CONTROL::OpenAutodetected ( const TOOL_EVENT aEvent)

Definition at line 54 of file gerbview_control.cpp.

55{
56 m_frame->LoadAutodetectedFiles( wxEmptyString );
57
58 return 0;
59}
bool LoadAutodetectedFiles(const wxString &aFileName)
Load a given file or selected file(s), if the filename is empty.

References GERBVIEW_FRAME::LoadAutodetectedFiles(), and m_frame.

Referenced by setTransitions().

◆ OpenDrillFile()

int GERBVIEW_CONTROL::OpenDrillFile ( const TOOL_EVENT aEvent)

Definition at line 70 of file gerbview_control.cpp.

71{
72 m_frame->LoadExcellonFiles( wxEmptyString );
73
74 return 0;
75}
bool LoadExcellonFiles(const wxString &aFileName)
Load a drill (EXCELLON) file or many files.

References GERBVIEW_FRAME::LoadExcellonFiles(), and m_frame.

Referenced by setTransitions().

◆ OpenGerber()

int GERBVIEW_CONTROL::OpenGerber ( const TOOL_EVENT aEvent)

Definition at line 62 of file gerbview_control.cpp.

63{
64 m_frame->LoadGerberFiles( wxEmptyString );
65
66 return 0;
67}
bool LoadGerberFiles(const wxString &aFileName)
Load a given Gerber file or selected file(s), if the filename is empty.

References GERBVIEW_FRAME::LoadGerberFiles(), and m_frame.

Referenced by setTransitions().

◆ OpenJobFile()

int GERBVIEW_CONTROL::OpenJobFile ( const TOOL_EVENT aEvent)

Definition at line 78 of file gerbview_control.cpp.

79{
80 m_frame->LoadGerberJobFile( wxEmptyString );
81 canvas()->Refresh();
82
83 return 0;
84}
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.

References canvas(), GERBVIEW_FRAME::LoadGerberJobFile(), m_frame, and EDA_DRAW_PANEL_GAL::Refresh().

Referenced by setTransitions().

◆ OpenZipFile()

int GERBVIEW_CONTROL::OpenZipFile ( const TOOL_EVENT aEvent)

Definition at line 87 of file gerbview_control.cpp.

88{
89 m_frame->LoadZipArchiveFile( wxEmptyString );
90 canvas()->Refresh();
91
92 return 0;
93}

References canvas(), GERBVIEW_FRAME::LoadZipArchiveFile(), m_frame, and EDA_DRAW_PANEL_GAL::Refresh().

Referenced by setTransitions().

◆ Print()

int GERBVIEW_CONTROL::Print ( const TOOL_EVENT aEvent)

Definition at line 308 of file dialog_print_gerbview.cpp.

309{
310 // Selection affects the original item visibility
312
314 settings.m_colorSettings = m_frame->GetColorSettings();
315 DIALOG_PRINT_GERBVIEW dlg( m_frame, &settings );
316 dlg.ForcePrintBorder( false );
317 dlg.ShowModal();
318
319 return 0;
320}
static TOOL_ACTION selectionClear
Clear the current selection.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
const PAGE_INFO & GetPageSettings() const override

References DIALOG_PRINT_GENERIC::ForcePrintBorder(), GERBVIEW_FRAME::GetColorSettings(), GERBVIEW_FRAME::GetPageSettings(), PRINTOUT_SETTINGS::m_colorSettings, m_frame, TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), and GERBVIEW_ACTIONS::selectionClear.

Referenced by setTransitions().

◆ ReloadAllLayers()

int GERBVIEW_CONTROL::ReloadAllLayers ( const TOOL_EVENT aEvent)

Definition at line 417 of file gerbview_control.cpp.

418{
419 // Store filenames
420 wxArrayString listOfGerberFiles;
421 std::vector<int> fileType;
423
424 for( unsigned i = 0; i < list->ImagesMaxCount(); i++ )
425 {
426 if( list->GetGbrImage( i ) == nullptr )
427 continue;
428
429 if( !list->GetGbrImage( i )->m_InUse )
430 continue;
431
432 EXCELLON_IMAGE* drill_file = dynamic_cast<EXCELLON_IMAGE*>( list->GetGbrImage( i ) );
433
434 if( drill_file )
435 fileType.push_back( 1 );
436 else
437 fileType.push_back( 0 );
438
439 listOfGerberFiles.Add( list->GetGbrImage( i )->m_FileName );
440 }
441
442 // Clear all layers
443 m_frame->Clear_DrawLayers( false );
445
446 // Load the layers from stored paths
447 wxBusyCursor wait;
448 m_frame->LoadListOfGerberAndDrillFiles( wxEmptyString, listOfGerberFiles, &fileType );
449
450 return 0;
451}
Handle a drill image.
wxString m_FileName
Full File Name for this layer.
bool m_InUse
true if this image is currently in use (a file is loaded in it) false if it must be not drawn
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
bool LoadListOfGerberAndDrillFiles(const wxString &aPath, const wxArrayString &aFilenameList, std::vector< int > *aFileType)
Load a list of Gerber and NC drill files and updates the view based on them.
MODEL3D_FORMAT_TYPE fileType(const char *aFileName)

References GERBVIEW_FRAME::Clear_DrawLayers(), EDA_DRAW_FRAME::ClearMsgPanel(), fileType(), GERBER_FILE_IMAGE_LIST::GetGbrImage(), GERBVIEW_FRAME::GetImagesList(), GERBER_FILE_IMAGE_LIST::ImagesMaxCount(), GERBVIEW_FRAME::LoadListOfGerberAndDrillFiles(), GERBER_FILE_IMAGE::m_FileName, m_frame, and GERBER_FILE_IMAGE::m_InUse.

Referenced by setTransitions().

◆ Reset()

void GERBVIEW_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 48 of file gerbview_control.cpp.

49{
50 m_frame = getEditFrame<GERBVIEW_FRAME>();
51}

References m_frame.

◆ 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().

◆ 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().

◆ 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 GERBVIEW_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 516 of file gerbview_control.cpp.

517{
526
532
540
551
556
559}
static TOOL_ACTION updateUnits
Definition: actions.h:151
static TOOL_ACTION print
Definition: actions.h:57
static const TOOL_EVENT ClearedEvent
Definition: actions.h:209
static const TOOL_EVENT SelectedEvent
Definition: actions.h:207
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:208
static TOOL_ACTION exportToPcbnew
static TOOL_ACTION loadZipFile
static TOOL_ACTION toggleLayerManager
static TOOL_ACTION openGerber
static TOOL_ACTION clearAllLayers
static TOOL_ACTION layerNext
static TOOL_ACTION openAutodetected
static TOOL_ACTION reloadAllLayers
static TOOL_ACTION layerPrev
static TOOL_ACTION openDrillFile
static TOOL_ACTION openZipFile
static TOOL_ACTION moveLayerUp
static TOOL_ACTION moveLayerDown
static TOOL_ACTION loadGerbFiles
static TOOL_ACTION openJobFile
static TOOL_ACTION clearLayer
int OpenDrillFile(const TOOL_EVENT &aEvent)
int OpenAutodetected(const TOOL_EVENT &aEvent)
int LayerNext(const TOOL_EVENT &aEvent)
int HighlightControl(const TOOL_EVENT &aEvent)
int MoveLayerDown(const TOOL_EVENT &aEvent)
int ClearLayer(const TOOL_EVENT &aEvent)
int LayerPrev(const TOOL_EVENT &aEvent)
int ReloadAllLayers(const TOOL_EVENT &aEvent)
int ToggleLayerManager(const TOOL_EVENT &aEvent)
int OpenJobFile(const TOOL_EVENT &aEvent)
int MoveLayerUp(const TOOL_EVENT &aEvent)
int ExportToPcbnew(const TOOL_EVENT &aEvent)
int OpenGerber(const TOOL_EVENT &aEvent)
int LoadGerbFiles(const TOOL_EVENT &aEvent)
Set up handlers for various events.
int ClearAllLayers(const TOOL_EVENT &aEvent)
int DisplayControl(const TOOL_EVENT &aEvent)
int LoadZipfile(const TOOL_EVENT &aEvent)
int OpenZipFile(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
int Print(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 GERBVIEW_ACTIONS::clearAllLayers, ClearAllLayers(), EVENTS::ClearedEvent, GERBVIEW_ACTIONS::clearLayer, ClearLayer(), GERBVIEW_ACTIONS::dcodeDisplay, DisplayControl(), GERBVIEW_ACTIONS::exportToPcbnew, ExportToPcbnew(), GERBVIEW_ACTIONS::flashedDisplayOutlines, GERBVIEW_ACTIONS::flipGerberView, TOOL_INTERACTIVE::Go(), ACTIONS::highContrastMode, ACTIONS::highContrastModeCycle, GERBVIEW_ACTIONS::highlightAttribute, GERBVIEW_ACTIONS::highlightClear, GERBVIEW_ACTIONS::highlightComponent, HighlightControl(), GERBVIEW_ACTIONS::highlightDCode, GERBVIEW_ACTIONS::highlightNet, GERBVIEW_ACTIONS::layerNext, LayerNext(), GERBVIEW_ACTIONS::layerPrev, LayerPrev(), GERBVIEW_ACTIONS::linesDisplayOutlines, GERBVIEW_ACTIONS::loadGerbFiles, LoadGerbFiles(), GERBVIEW_ACTIONS::loadZipFile, LoadZipfile(), GERBVIEW_ACTIONS::moveLayerDown, MoveLayerDown(), GERBVIEW_ACTIONS::moveLayerUp, MoveLayerUp(), GERBVIEW_ACTIONS::negativeObjectDisplay, GERBVIEW_ACTIONS::openAutodetected, OpenAutodetected(), GERBVIEW_ACTIONS::openDrillFile, OpenDrillFile(), GERBVIEW_ACTIONS::openGerber, OpenGerber(), GERBVIEW_ACTIONS::openJobFile, OpenJobFile(), GERBVIEW_ACTIONS::openZipFile, OpenZipFile(), GERBVIEW_ACTIONS::polygonsDisplayOutlines, Print(), ACTIONS::print, GERBVIEW_ACTIONS::reloadAllLayers, ReloadAllLayers(), EVENTS::SelectedEvent, GERBVIEW_ACTIONS::toggleDiffMode, GERBVIEW_ACTIONS::toggleLayerManager, ToggleLayerManager(), GERBVIEW_ACTIONS::toggleXORMode, EVENTS::UnselectedEvent, UpdateMessagePanel(), and ACTIONS::updateUnits.

◆ ToggleLayerManager()

int GERBVIEW_CONTROL::ToggleLayerManager ( const TOOL_EVENT aEvent)

Definition at line 96 of file gerbview_control.cpp.

97{
99
100 return 0;
101}

References m_frame, and GERBVIEW_FRAME::ToggleLayerManager().

Referenced by setTransitions().

◆ UpdateMessagePanel()

int GERBVIEW_CONTROL::UpdateMessagePanel ( const TOOL_EVENT aEvent)

Definition at line 454 of file gerbview_control.cpp.

455{
457 GERBVIEW_SELECTION& selection = selTool->GetSelection();
458
459 if( selection.GetSize() == 1 )
460 {
461 EDA_ITEM* item = (EDA_ITEM*) selection.Front();
462
463 std::vector<MSG_PANEL_ITEM> msgItems;
464 item->GetMsgPanelInfo( m_frame, msgItems );
465 m_frame->SetMsgPanel( msgItems );
466 }
467 else
468 {
470 }
471
472 return 0;
473}
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: eda_item.h:209
GERBVIEW_SELECTION & GetSelection()
Return the set of currently selected items.

References EDA_DRAW_FRAME::EraseMsgBox(), EDA_ITEM::GetMsgPanelInfo(), GERBVIEW_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), m_frame, TOOL_BASE::m_toolMgr, and EDA_DRAW_FRAME::SetMsgPanel().

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_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

◆ 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(), SYMBOL_EDITOR_CONTROL::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_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(), 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(), 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(), SYMBOL_EDITOR_CONTROL::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(), SYMBOL_EDITOR_CONTROL::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(), 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(), 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().


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