KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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>
43
45
46
48 DIALOG_FIND_BASE( aParent )
49{
50 // these members are initialized to avoid warnings about non initialized vars
51 m_frame = aParent;
52 m_hitList.clear();
53 m_it = m_hitList.begin();
54 m_upToDate = false;
55 m_board = nullptr;
56}
57
59
60void DIALOG_FIND::OnBoardChanged( wxCommandEvent& event ) {}
61
62void DIALOG_FIND::onFindNextClick( wxCommandEvent& aEvent )
63{
64}
65
66void DIALOG_FIND::onFindPreviousClick( wxCommandEvent& aEvent )
67{
68}
69
70void DIALOG_FIND::onSearchAgainClick( wxCommandEvent& aEvent )
71{
72}
73
74void DIALOG_FIND::onTextEnter( wxCommandEvent& event )
75{
76}
77
78void DIALOG_FIND::onShowSearchPanel( wxHyperlinkEvent& event )
79{
80}
81
82bool DIALOG_FIND::Show( bool show )
83{
84 return true;
85}
86
87
88DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title,
89 const wxPoint& pos, const wxSize& size, long style ) :
90 DIALOG_SHIM( parent, id, title, pos, size, style )
91{
92 // these members are initialized only to avoid warnings about non initialized vars
93 searchStringLabel = nullptr;
94 m_searchCombo = nullptr;
95 m_matchCase = nullptr;
96 m_matchWords = nullptr;
97 m_wildcards = nullptr;
98 m_wrap = nullptr;
99 m_includeValues = nullptr;
100 m_includeReferences = nullptr;
101 m_includeTexts = nullptr;
102 m_includeMarkers = nullptr;
103 m_includeNets = nullptr;
104 m_findNext = nullptr;
105 m_findPrevious = nullptr;
106 m_searchAgain = nullptr;
107 m_closeButton = nullptr;
108 m_status = nullptr;
109}
110
111
113{
114}
115
116
118 const wxString& title,
119 const wxPoint& pos, const wxSize& size,
120 long style ) :
121 DIALOG_SHIM( parent, id, title, pos, size, style )
122{
123 // these members are initialized only to avoid warnings about non initialized vars
124 m_Include_Modules = nullptr;
125 m_Include_PcbTexts = nullptr;
126 m_IncludeLockedModules = nullptr;
127 m_Include_Draw_Items = nullptr;
128 m_Include_Tracks = nullptr;
129 m_Include_Vias = nullptr;
130 m_Include_Edges_Items = nullptr;
131 m_Include_Zones = nullptr;
132 m_sdbSizer1 = nullptr;
133 m_sdbSizer1OK = nullptr;
134 m_sdbSizer1Cancel = nullptr;
135}
136
137
139{
140}
141
142
145 m_options( aOptions )
146{
147 // silence another compiler warning about m_options not being used
148 if( m_options.includeModules )
149 {
150 }
151}
152
153
154void DIALOG_FILTER_SELECTION::checkBoxClicked( wxCommandEvent& aEvent )
155{
156}
157
158
159void DIALOG_FILTER_SELECTION::allItemsClicked( wxCommandEvent& aEvent )
160{
161}
162
163
165{
166 return true;
167}
168
169
171{
172 return true;
173}
174
175
177{
178}
179
180
181
183
184
189{
190public:
191 DIALOG_FILTER_SELECTION::OPTIONS m_filterOpts;
192};
193
194
196 SELECTION_TOOL( "common.InteractiveSelection" ),
197 m_frame( NULL ),
198 m_enteredGroup( NULL ),
199 m_nonModifiedCursor( KICURSOR::ARROW ),
200 m_priv( nullptr )
201{
202}
203
204
206{
207}
208
209
211{
212 return true;
213}
214
215
216void PCB_SELECTION_TOOL::Reset( RESET_REASON aReason )
217{
218}
219
220
221int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
222{
223 return 0;
224}
225
226
228{
229}
230
231
232void PCB_SELECTION_TOOL::ExitGroup( bool aSelectGroup )
233{
234}
235
236
238{
239 return m_selection;
240}
241
242
244{
245 return m_selection;
246}
247
248
250{
251 return GENERAL_COLLECTORS_GUIDE( LSET(), PCB_LAYER_ID::UNDEFINED_LAYER, nullptr );
252}
253
254
255bool PCB_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
256 bool* aSelectionCancelledFlag,
257 CLIENT_SELECTION_FILTER aClientFilter )
258{
259 return false;
260}
261
262
263bool PCB_SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTER aClientFilter )
264{
265 return false;
266}
267
268
270 bool aExclusiveOr )
271{
272}
273
274
276{
277 return 0;
278}
279
280
282{
283 return 0;
284}
285
286
287int PCB_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
288{
289 return 0;
290}
291
292
294{
295 return 0;
296}
297
298
300 const std::vector<BOARD_CONNECTED_ITEM*>& aStartItems, STOP_CONDITION aStopCondition )
301{
302}
303
304
305void PCB_SELECTION_TOOL::SelectAllItemsOnNet( int aNetCode, bool aSelect )
306{
307}
308
309
310int PCB_SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
311{
312 return 0;
313}
314
315
316void PCB_SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
317{
318}
319
320
322{
323}
324
325
327{
328 return 0;
329}
330
331
333{
334 return 0;
335}
336
337
339{
340 return false;
341}
342
343
351static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard,
352 const DIALOG_FILTER_SELECTION::OPTIONS& aFilterOptions )
353{
354 return false;
355}
356
357
359{
360 return 0;
361}
362
363
364void PCB_SELECTION_TOOL::FilterCollectedItems( GENERAL_COLLECTOR& aCollector, bool aMultiSelect,
366{
367}
368
369
370bool PCB_SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem, bool aMultiSelect,
372{
373 return true;
374}
375
376
377void PCB_SELECTION_TOOL::ClearSelection( bool aQuietMode )
378{
379}
380
381
383{
384}
385
386
387bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOnly ) const
388{
389 return false;
390}
391
392
393bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
394{
395 return false;
396}
397
399 const VECTOR2I& aWhere ) const
400{
401}
402
403
405{
406 return 0;
407}
408
409
411{
412}
413
414
416{
417}
418
419
421{
422}
423
424
425void PCB_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aHighlightMode,
426 SELECTION* aGroup )
427{
428}
429
430
431void PCB_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aHighlightMode,
432 SELECTION* aGroup )
433{
434}
435
438 const wxString& aCommitMessage, int aOptions )
439{
440}
441
442
444{
445 return true;
446}
447
448
449void PCB_TOOL_BASE::Reset( RESET_REASON aReason )
450{
451}
452
453
455{
456}
457
458
460{
461 return false;
462}
463
464
466{
467 return false;
468}
469
470
472{
473}
474
475
478 m_fillInProgress( false )
479{
480}
481
482
484{
485}
486
487
488void ZONE_FILLER_TOOL::Reset( RESET_REASON aReason )
489{
490}
491
492
494{
495}
496
497
499{
500 static PCBNEW_SETTINGS::DISPLAY_OPTIONS disp;
501
502 return disp;
503}
504
506{
507 return nullptr;
508}
509
510
512{
513 static PCB_SELECTION sel;
514
515 return sel;
516}
517
518
520{
521 static PCB_SELECTION sel;
522
523 return sel;
524}
525
527{
528 return BOX2I();
529}
530
531
532EDA_ITEM* PCB_SELECTION::GetTopLeftItem( bool onlyModules ) const
533{
534 return nullptr;
535}
536
537
538const std::vector<KIGFX::VIEW_ITEM*> PCB_SELECTION::updateDrawList() const
539{
540 std::vector<VIEW_ITEM*> items;
541
542 return items;
543}
544
545
546#if 0
548
553TRACK_BALL::TRACK_BALL(float x) : CAMERA(x) {};
556
557#endif
558
560
562{
563 return nullptr;
564}
565
566
568{
569 return 0;
570}
std::function< void(const VECTOR2I &, GENERAL_COLLECTOR &, PCB_SELECTION_TOOL *)> CLIENT_SELECTION_FILTER
Definition actions.h:37
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:79
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:317
A class used to derive camera objects from.
Definition camera.h:103
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)
~DIALOG_FIND() override
void onTextEnter(wxCommandEvent &event) override
DIALOG_FIND(PCB_EDIT_FRAME *aParent)
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
void onShowSearchPanel(wxHyperlinkEvent &event) override
void onFindPreviousClick(wxCommandEvent &event) override
void OnBoardChanged(wxCommandEvent &event)
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition dialog_shim.h:68
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
A general implementation of a COLLECTORS_GUIDE.
Definition collectors.h:324
Used when the right click button is pressed, or when the select tool is in effect.
Definition collectors.h:207
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
The main frame for Pcbnew.
Private implementation of firewalled private data.
DIALOG_FILTER_SELECTION::OPTIONS m_filterOpts
The selection tool: currently supports:
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 EnterGroup() override
Enter the group at the head of the current selection.
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...
void ExitGroup(bool aSelectGroup=false) override
Leave the currently-entered group.
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)
Return the current selection, filtered according to aClientFilter.
bool itemPassesFilter(BOARD_ITEM *aItem, bool aMultiSelect, PCB_SELECTION_FILTER_OPTIONS *aRejected=nullptr)
const GENERAL_COLLECTORS_GUIDE getCollectorsGuide() const
bool Selectable(const BOARD_ITEM *aItem, bool checkVisibilityOnly=false) const
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 SelectMultiple(KIGFX::PREVIEW::SELECTION_AREA &aArea, bool aSubtractive=false, bool aExclusiveOr=false)
Selects multiple PCB items within a specified area.
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
Determine 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 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)
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.
void unselect(EDA_ITEM *aItem) override
Take necessary action mark an item as unselected.
int SelectAll(const TOOL_EVENT &aEvent)
Unselect all items on the board.
void FilterCollectedItems(GENERAL_COLLECTOR &aCollector, bool aMultiSelect, PCB_SELECTION_FILTER_OPTIONS *aRejected=nullptr)
Apply the SELECTION_FITLER_OPTIONS to the collector.
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr) override
Unhighlight the item visually.
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
BOX2I GetBoundingBox() 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...
virtual bool Is90Limited() const
Should the tool limit drawing to horizontal and vertical only?
const PCB_SELECTION & selection() const
static void NeighboringSegmentFilter(const VECTOR2I &aPt, GENERAL_COLLECTOR &aCollector, PCB_SELECTION_TOOL *aSelTool)
Generic, UI-independent tool event.
Definition tool_event.h:171
TRACK_BALL(float aInitialDistance)
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:44
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition cvpcb.cpp:150
DDE server & client.
@ UNDEFINED_LAYER
Definition layer_ids.h:61
const FAB_LAYER_COLOR * GetColorStandardList()
Definition mocks.cpp:561
int GetColorStandardListCount()
Definition mocks.cpp:567
static bool itemIsIncludedByFilter(const BOARD_ITEM &aItem, const BOARD &aBoard, const DIALOG_FILTER_SELECTION::OPTIONS &aFilterOptions)
Function itemIsIncludedByFilter()
Definition mocks.cpp:351
OBJECT_2D_TYPE
Definition object_2d.h:45
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.
This file contains data structures that are saved in the project file or project local settings file ...
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
#define ZONE_FILLER_TOOL_NAME