KiCad PCB EDA Suite
mocks.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <kiface_base.h>
25#include <confirm.h>
26#include <pcb_edit_frame.h>
27#include <eda_dde.h>
28#include <wx/file.h>
29#include <wx/snglinst.h>
30#include <wx/app.h>
31#include <board.h>
32#include <fp_lib_table.h>
34#include <footprint.h>
35#include <tools/pcb_actions.h>
37#include <router/router_tool.h>
38#include <dialog_find.h>
40#include <zone_filler.h>
41
43
44
46 DIALOG_FIND_BASE( aParent )
47{
48 // these members are initialized to avoid warnings about non initialized vars
49 m_frame = aParent;
50 m_hitList.clear();
51 m_it = m_hitList.begin();
52 m_upToDate = false;
53}
54
55void DIALOG_FIND::onFindNextClick( wxCommandEvent& aEvent )
56{
57}
58
59void DIALOG_FIND::onFindPreviousClick( wxCommandEvent& aEvent )
60{
61}
62
63void DIALOG_FIND::onSearchAgainClick( wxCommandEvent& aEvent )
64{
65}
66
67void DIALOG_FIND::onTextEnter( wxCommandEvent& event )
68{
69}
70
71void DIALOG_FIND::OnCloseButtonClick( wxCommandEvent& aEvent )
72{
73}
74
75bool DIALOG_FIND::Show( bool show )
76{
77 return true;
78}
79
80void DIALOG_FIND::OnClose( wxCloseEvent& aEvent )
81{
82}
83
84
85DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title,
86 const wxPoint& pos, const wxSize& size, long style ) :
87 DIALOG_SHIM( parent, id, title, pos, size, style )
88{
89 // these members are initialized only to avoid warnings about non initialized vars
90 searchStringLabel = nullptr;
91 m_searchCombo = nullptr;
92 m_matchCase = nullptr;
93 m_matchWords = nullptr;
94 m_wildcards = nullptr;
95 m_wrap = nullptr;
96 m_includeValues = nullptr;
97 m_includeReferences = nullptr;
98 m_includeTexts = nullptr;
99 m_includeMarkers = nullptr;
100 m_includeNets = nullptr;
101 m_findNext = nullptr;
102 m_findPrevious = nullptr;
103 m_searchAgain = nullptr;
104 m_closeButton = nullptr;
105 m_status = nullptr;
106}
107
108
110{
111}
112
113
115{
116 return nullptr;
117}
118
119
121 const wxString& title,
122 const wxPoint& pos, const wxSize& size,
123 long style ) :
124 DIALOG_SHIM( parent, id, title, pos, size, style )
125{
126 // these members are initialized only to avoid warnings about non initialized vars
127 m_Include_Modules = nullptr;
128 m_Include_PcbTexts = nullptr;
129 m_IncludeLockedModules = nullptr;
130 m_Include_Draw_Items = nullptr;
131 m_Include_Tracks = nullptr;
132 m_Include_Vias = nullptr;
133 m_Include_Edges_Items = nullptr;
134 m_Include_Zones = nullptr;
135 m_sdbSizer1 = nullptr;
136 m_sdbSizer1OK = nullptr;
137 m_sdbSizer1Cancel = nullptr;
138}
139
140
142{
143}
144
145
148 m_options( aOptions )
149{
150 // silence another compiler warning about m_options not being used
151 if( m_options.includeModules )
152 {
153 }
154}
155
156
157void DIALOG_FILTER_SELECTION::checkBoxClicked( wxCommandEvent& aEvent )
158{
159}
160
161
162void DIALOG_FILTER_SELECTION::allItemsClicked( wxCommandEvent& aEvent )
163{
164}
165
166
168{
169 return true;
170}
171
172
174{
175}
176
177
178
180
181
186{
187public:
189};
190
191
193 SELECTION_TOOL( "pcbnew.InteractiveSelection" ),
194 m_frame( NULL ),
195 m_enteredGroup( NULL ),
196 m_nonModifiedCursor( KICURSOR::ARROW ),
197 m_priv( nullptr )
198{
199}
200
201
203{
204}
205
206
208{
209 return true;
210}
211
212
213void PCB_SELECTION_TOOL::Reset( RESET_REASON aReason )
214{
215}
216
217
218int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
219{
220 return 0;
221}
222
223
225{
226}
227
228
229void PCB_SELECTION_TOOL::ExitGroup( bool aSelectGroup )
230{
231}
232
233
235{
236 return m_selection;
237}
238
239
241 bool aConfirmLockedItems )
242{
243 return m_selection;
244}
245
246
248{
250}
251
252
253bool PCB_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
254 bool* aSelectionCancelledFlag,
255 CLIENT_SELECTION_FILTER aClientFilter )
256{
257 return false;
258}
259
260
261bool PCB_SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTER aClientFilter )
262{
263 return false;
264}
265
266
268{
269 return false;
270}
271
272
274{
275 return 0;
276}
277
278
280{
281 return 0;
282}
283
284
285int PCB_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
286{
287 return 0;
288}
289
290
292{
293 return 0;
294}
295
296
298 const std::vector<BOARD_CONNECTED_ITEM*>& aStartItems, STOP_CONDITION aStopCondition )
299{
300}
301
302
303void PCB_SELECTION_TOOL::SelectAllItemsOnNet( int aNetCode, bool aSelect )
304{
305}
306
307
308int PCB_SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
309{
310 return 0;
311}
312
313
314void PCB_SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
315{
316}
317
318
320{
321}
322
323
325{
326 return 0;
327}
328
329
331{
332 return 0;
333}
334
335
337{
338 return false;
339}
340
341
349static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard,
350 const DIALOG_FILTER_SELECTION::OPTIONS& aFilterOptions )
351{
352 return false;
353}
354
355
357{
358 return 0;
359}
360
361
362void PCB_SELECTION_TOOL::FilterCollectedItems( GENERAL_COLLECTOR& aCollector, bool aMultiSelect )
363{
364}
365
366
367bool PCB_SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem, bool aMultiSelect )
368{
369 return true;
370}
371
372
373void PCB_SELECTION_TOOL::ClearSelection( bool aQuietMode )
374{
375}
376
377
379{
380}
381
382
383bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOnly ) const
384{
385 return false;
386}
387
388
389bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
390{
391 return false;
392}
393
395 const VECTOR2I& aWhere ) const
396{
397}
398
399
401{
402 return 0;
403}
404
405
407{
408}
409
410
412{
413}
414
415
417{
418}
419
420
421void PCB_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aHighlightMode,
422 SELECTION* aGroup )
423{
424}
425
426
427void PCB_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aHighlightMode,
428 SELECTION* aGroup )
429{
430}
431
434 const wxString& aCommitMessage, int aOptions )
435{
436}
437
438
440{
441 return true;
442}
443
444
445void PCB_TOOL_BASE::Reset( RESET_REASON aReason )
446{
447}
448
449
451{
452}
453
454
456{
457 return false;
458}
459
460
462{
463}
464
465
467 PCB_TOOL_BASE( "pcbnew.ZoneFiller" ),
468 m_fillInProgress( false )
469{
470}
471
472
474{
475}
476
477
478void ZONE_FILLER_TOOL::Reset( RESET_REASON aReason )
479{
480}
481
482
484{
485}
486
487
489{
491
492 return disp;
493}
494
496{
497 return nullptr;
498}
499
500
502{
503 static PCB_SELECTION sel;
504
505 return sel;
506}
507
508
510{
511 static PCB_SELECTION sel;
512
513 return sel;
514}
515
516
517EDA_ITEM* PCB_SELECTION::GetTopLeftItem( bool onlyModules ) const
518{
519 return nullptr;
520}
521
522
523const std::vector<KIGFX::VIEW_ITEM*> PCB_SELECTION::updateDrawList() const
524{
525 std::vector<VIEW_ITEM*> items;
526
527 return items;
528}
529
530
532{
533 return LSET();
534}
535
536#if 0
538
543TRACK_BALL::TRACK_BALL(float x) : CAMERA(x) {};
546
547#endif
548
550
552{
553 return nullptr;
554}
555
556
558{
559 return 0;
560}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
A class used to derive camera objects from.
Definition: camera.h:78
Class DIALOG_FILTER_SELECTION_BASE.
DIALOG_FILTER_SELECTION_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Filter Selected Items"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void checkBoxClicked(wxCommandEvent &aEvent) override
DIALOG_FILTER_SELECTION(PCB_BASE_FRAME *aParent, OPTIONS &aOptions)
Create the filter selection dialog.
void allItemsClicked(wxCommandEvent &aEvent) override
Class DIALOG_FIND_BASE.
DIALOG_FIND_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE)
void onTextEnter(wxCommandEvent &event) override
bool Show(bool show=true) override
The Show method is overridden to make the search combobox focused by default.
void onFindNextClick(wxCommandEvent &event) override
void onSearchAgainClick(wxCommandEvent &event) override
DIALOG_FIND(PCB_BASE_FRAME *aParent)
Definition: dialog_find.cpp:55
void onFindPreviousClick(wxCommandEvent &event) override
void OnClose(wxCloseEvent &event) override
void OnCloseButtonClick(wxCommandEvent &aEvent) override
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:83
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:326
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:204
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
FOOTPRINT * GetFootprintFromBoardByReference()
Private implementation of firewalled private data.
DIALOG_FILTER_SELECTION::OPTIONS m_filterOpts
void highlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr) override
Highlight the item visually.
int selectNet(const TOOL_EVENT &aEvent)
Select all copper connections belonging to the same net(s) as the items in the selection.
int filterSelection(const TOOL_EVENT &aEvent)
Return true if the given item passes the current SELECTION_FILTER_OPTIONS.
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
void GuessSelectionCandidates(GENERAL_COLLECTOR &aCollector, const VECTOR2I &aWhere) const
Try to guess best selection candidates in case multiple items are clicked, by doing some brain-dead h...
bool itemPassesFilter(BOARD_ITEM *aItem, bool aMultiSelect)
bool selectionContains(const VECTOR2I &aPoint) const
void select(EDA_ITEM *aItem) override
Take necessary action mark an item as selected.
bool selectCursor(bool aForceSelect=false, CLIENT_SELECTION_FILTER aClientFilter=nullptr)
Select an item under the cursor unless there is something already selected.
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection, filtered according to aClientFilter.
const GENERAL_COLLECTORS_GUIDE getCollectorsGuide() const
bool Selectable(const BOARD_ITEM *aItem, bool checkVisibilityOnly=false) const
void FilterCollectedItems(GENERAL_COLLECTOR &aCollector, bool aMultiSelect)
Apply the SELECTION_FITLER_OPTIONS to the collector.
bool selectPoint(const VECTOR2I &aWhere, bool aOnDrag=false, bool *aSelectionCancelledFlag=nullptr, CLIENT_SELECTION_FILTER aClientFilter=nullptr)
Select an item pointed by the parameter aWhere.
void selectAllItemsOnSheet(wxString &aSheetPath)
Select all items with the given sheet timestamp/UUID name (the sheet path).
void setTransitions() override
Zoom the screen to center and fit the current selection.
int expandConnection(const TOOL_EVENT &aEvent)
Expand the current connected-item selection to the next boundary (junctions, pads,...
virtual bool ctrlClickHighlights() override
Determines if ctrl-click is highlight net or XOR selection.
int selectSheetContents(const TOOL_EVENT &aEvent)
Select all footprints belonging to same hierarchical sheet as the selected footprint (same sheet path...
int selectSameSheet(const TOOL_EVENT &aEvent)
Set selection to items passed by parameter and connected nets (optionally).
void EnterGroup()
Enter the group at the head of the current selection.
void zoomFitSelection()
Zoom the screen to fit the bounding box for cross probing/selection sync.
void selectAllConnectedTracks(const std::vector< BOARD_CONNECTED_ITEM * > &aStartItems, STOP_CONDITION aStopCondition)
Select connected tracks and vias.
int CursorSelection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
int ClearSelection(const TOOL_EVENT &aEvent)
PCB_SELECTION & GetSelection()
int Main(const TOOL_EVENT &aEvent)
The main loop.
void RebuildSelection()
Rebuild the selection from the EDA_ITEMs' selection flags.
int updateSelection(const TOOL_EVENT &aEvent)
Event handler to update the selection VIEW_ITEM.
bool Init() override
Init() is called once upon a registration of the tool.
void SelectAllItemsOnNet(int aNetCode, bool aSelect=true)
Select all items with the given net code.
bool selectMultiple()
Handle drawing a selection box that allows one to select many items at the same time.
void ExitGroup(bool aSelectGroup=false)
Leave the currently-entered group.
void unselect(EDA_ITEM *aItem) override
Take necessary action mark an item as unselected.
int SelectAll(const TOOL_EVENT &aEvent)
PCB_SELECTION m_selection
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr) override
Unhighlight the item visually.
const LSET GetSelectionLayers()
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
const std::vector< KIGFX::VIEW_ITEM * > updateDrawList() const override
virtual bool Is45Limited() const
Should the tool use its 45° mode option?
PCB_DRAW_PANEL_GAL * canvas() const
PCBNEW_SETTINGS::DISPLAY_OPTIONS & displayOptions() const
virtual void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
virtual bool Init() override
Init() is called once upon a registration of the tool.
virtual void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
void doInteractiveItemPlacement(const TOOL_EVENT &aTool, INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
Helper function for performing a common interactive idiom: wait for a left click, place an item there...
const PCB_SELECTION & selection() const
static void NeighboringSegmentFilter(const VECTOR2I &aPt, GENERAL_COLLECTOR &aCollector)
Generic, UI-independent tool event.
Definition: tool_event.h:156
TRACK_BALL(float aInitialDistance)
Definition: track_ball.cpp:41
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
This file is part of the common library.
KICURSOR
Definition: cursors.h:34
DDE server & client.
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
const FAB_LAYER_COLOR * GetColorStandardList()
Definition: mocks.cpp:551
int GetColorStandardListCount()
Definition: mocks.cpp:557
static bool itemIsIncludedByFilter(const BOARD_ITEM &aItem, const BOARD &aBoard, const DIALOG_FILTER_SELECTION::OPTIONS &aFilterOptions)
Function itemIsIncludedByFilter()
Definition: mocks.cpp:349
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: mocks.cpp:42
OBJECT_2D_TYPE
Definition: object_2d.h:45
void(* CLIENT_SELECTION_FILTER)(const VECTOR2I &, GENERAL_COLLECTOR &, PCB_SELECTION_TOOL *)
BBOX_3D()
Create with default values a bounding box (not initialized)
Definition: bbox_3d.cpp:37
~BBOX_3D()
Definition: bbox_3d.cpp:56
Struct that will be set with the result of the user choices in the dialog.