KiCad PCB EDA Suite
Loading...
Searching...
No Matches
api_handler_pcb_tasks.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#include <api/api_handler_pcb.h>
23
24#include <base_units.h>
25#include <board.h>
26#include <board_commit.h>
28#include <dialogs/dialog_drc.h>
30#include <drc/drc_engine.h>
31#include <drc/drc_item.h>
32#include <fmt.h>
33#include <kiface_services.h>
34#include <kiway.h>
35#include <macros.h>
38#include <pcb_edit_frame.h>
39#include <pcb_marker.h>
40#include <richio.h>
41#include <string_utils.h>
42#include <tool/tool_manager.h>
43#include <tools/drc_tool.h>
48#include <zone.h>
49#include <zone_filler.h>
50
51#include <api/api_enums.h>
52#include <api/api_utils.h>
53#include <api/board/board_tasks.pb.h>
54#include <api/common/tasks.pb.h>
55
56#include <algorithm>
57#include <memory>
58
59using kiapi::board::tasks::DrcTaskResult;
60using kiapi::board::tasks::GetDrcTaskResult;
61using kiapi::board::tasks::StartDrcTask;
62using kiapi::board::tasks::StartRefillZonesTask;
63using kiapi::common::tasks::StartTaskResponse;
64using kiapi::common::tasks::TaskState;
65using kiapi::common::tasks::TaskStatusResponse;
66using kiapi::common::tasks::TS_CANCELLED;
67using kiapi::common::tasks::TS_FAILED;
68using kiapi::common::tasks::TS_RUNNING;
69using kiapi::common::tasks::TS_UNKNOWN;
70
71
73{
74public:
75 REFILL_ZONES_TASK( API_HANDLER_PCB* aHandler, std::vector<ZONE*>&& aZones ) :
76 m_handler( aHandler ),
77 m_board( aHandler->board() ),
78 m_zones( std::move( aZones ) )
79 {
80 }
81
82 void Run() override
83 {
84 PCB_EDIT_FRAME* frame = m_handler->frame();
85 TOOL_MANAGER* mgr = m_handler->toolManager();
86
87 if( !mgr->FindTool( ZONE_FILLER_TOOL_NAME ) )
89
90 ZONE_FILLER_TOOL* zoneFillerTool = mgr->GetTool<ZONE_FILLER_TOOL>();
91
92 if( !zoneFillerTool )
93 {
94 m_zones.clear();
95 m_state = TS_FAILED;
96 m_errorMessage = "zone filler tool is not available";
97 return;
98 }
99
100 std::unique_ptr<API_TASK_GUI_PROGRESS_REPORTER> reporter;
101
102 if( frame )
103 reporter = std::make_unique<API_TASK_GUI_PROGRESS_REPORTER>( frame, _( "Fill Zone(s)" ), 1, PR_CAN_ABORT );
104
105 bool filled = false;
106
107 if( m_zones.empty() )
108 {
109 filled = zoneFillerTool->FillAllZones( frame, reporter.get(), frame == nullptr );
110 }
111 else
112 {
113 std::unique_ptr<COMMIT> commit = m_handler->createCommit();
114 ZONE_FILLER filler( m_board, commit.get() );
115
116 if( reporter )
117 filler.SetProgressReporter( reporter.get() );
118
119 try
120 {
121 filled = filler.Fill( m_zones );
122 }
123 catch( ... )
124 {
125 commit->Revert();
126 throw;
127 }
128
129 if( filled )
130 commit->Push( _( "Refill zones from API task" ), SKIP_CONNECTIVITY | ZONE_FILL_OP );
131 else
132 commit->Revert();
133
134 if( filled )
135 zoneFillerTool->PostFillRefresh( frame == nullptr );
136 }
137
138 m_zones.clear();
139
140 if( !filled )
141 {
142 if( reporter && reporter->IsCancelled() )
143 {
144 m_state = TS_CANCELLED;
145 m_errorMessage = "zone fill cancelled by user";
146 }
147 else
148 {
149 m_state = TS_FAILED;
150 m_errorMessage = "zone fill failed";
151 }
152 }
153 else
154 {
155 m_handler->onModified();
156 }
157 }
158
159 void FillStatus( TaskStatusResponse& aStatus ) const override
160 {
161 if( m_state != TS_UNKNOWN )
162 aStatus.set_state( m_state );
163
164 if( !m_errorMessage.empty() )
165 aStatus.set_error_message( m_errorMessage );
166 }
167
168private:
171 std::vector<ZONE*> m_zones;
172 TaskState m_state = TS_UNKNOWN;
173 std::string m_errorMessage;
174};
175
176
178{
179public:
180 DRC_TASK( API_HANDLER_PCB* aHandler, bool aReportAllTrackErrors, bool aTestFootprints,
181 bool aRequireZonesFilled ) :
182 m_handler( aHandler ),
183 m_board( aHandler->board() ),
184 m_reportAllTrackErrors( aReportAllTrackErrors ),
185 m_testFootprints( aTestFootprints ),
186 m_requireZonesFilled( aRequireZonesFilled )
187 {
188 }
189
190 void Run() override
191 {
193 return;
194
195 std::shared_ptr<DRC_ENGINE> drcEngine = m_board->GetDesignSettings().m_DRCEngine;
196
197 try
198 {
199 drcEngine->InitEngine( m_board->GetDesignRulesPath() );
200 }
201 catch( const PARSE_ERROR& )
202 {
203 m_state = TS_FAILED;
204 m_errorMessage = "DRC incomplete: could not compile custom design rules";
205 return;
206 }
207
209 return;
210
211 EDA_UNITS units = EDA_UNITS::MM;
212 PCB_EDIT_FRAME* frame = m_handler->frame();
213
214 if( frame )
215 units = frame->GetUserUnits();
216
217 TOOL_MANAGER* mgr = m_handler->toolManager();
218 DRC_TOOL* drcTool = nullptr;
219
220 if( frame )
221 {
222 if( !mgr->FindTool( DRC_TOOL_NAME ) )
223 mgr->RegisterTool( new DRC_TOOL );
224
225 drcTool = mgr->GetTool<DRC_TOOL>();
226
227 if( !drcTool )
228 {
229 m_state = TS_FAILED;
230 m_errorMessage = "DRC tool is not available";
231 return;
232 }
233
234 if( drcTool->IsDRCRunning() )
235 {
236 m_state = TS_FAILED;
237 m_errorMessage = "another DRC run is already in progress";
238 return;
239 }
240 }
241
242 if( m_testFootprints )
243 drcEngine->SetSchematicNetlist( m_netlist.get() );
244
245 m_commit = std::make_unique<BOARD_COMMIT>( mgr );
246
247 drcEngine->SetViolationHandler(
248 [&]( const std::shared_ptr<DRC_ITEM>& aItem, const VECTOR2I& aPos, int aLayer,
249 const std::function<void( PCB_MARKER* )>& aPathGenerator )
250 {
251 PCB_MARKER* marker = new PCB_MARKER( aItem, aPos, aLayer );
252 aPathGenerator( marker );
253 m_commit->Add( marker );
254 m_violationMarkers.push_back( marker );
255 } );
256
257 m_board->RecordDRCExclusions();
258 m_board->DeleteMARKERs( true, true );
259
260 std::unique_ptr<API_TASK_GUI_PROGRESS_REPORTER> reporter;
261
262 if( frame )
263 {
264 reporter = std::make_unique<API_TASK_GUI_PROGRESS_REPORTER>( frame, _( "Running DRC" ), 1,
265 PR_CAN_ABORT );
266 drcEngine->SetProgressReporter( reporter.get() );
267 }
268
269 std::unique_ptr<DS_PROXY_VIEW_ITEM> headlessDrawingSheet;
270
271 if( frame )
272 {
273 drcEngine->SetDrawingSheet( frame->GetCanvas()->GetDrawingSheet() );
274 }
275 else
276 {
277 headlessDrawingSheet = std::make_unique<DS_PROXY_VIEW_ITEM>(
278 pcbIUScale, &m_board->GetPageSettings(), m_board->GetProject(), &m_board->GetTitleBlock(),
279 &m_board->GetProperties() );
280 headlessDrawingSheet->SetSheetName( std::string() );
281 headlessDrawingSheet->SetSheetPath( std::string() );
282 headlessDrawingSheet->SetIsFirstPage( true );
283 headlessDrawingSheet->SetFileName( TO_UTF8( m_board->GetFileName() ) );
284
285 wxString variant = m_board->GetCurrentVariant();
286 headlessDrawingSheet->SetVariantName( TO_UTF8( variant ) );
287 headlessDrawingSheet->SetVariantDesc( TO_UTF8( m_board->GetVariantDescription( variant ) ) );
288
289 drcEngine->SetDrawingSheet( headlessDrawingSheet.get() );
290 }
291
292 try
293 {
294 drcEngine->RunTests( units, m_reportAllTrackErrors, m_testFootprints, m_commit.get() );
295 }
296 catch( ... )
297 {
298 drcEngine->ClearViolationHandler();
299 drcEngine->SetProgressReporter( nullptr );
300
301 if( !frame )
302 drcEngine->SetDrawingSheet( nullptr );
303
304 headlessDrawingSheet.reset();
305 reporter.reset();
306
307 if( m_testFootprints )
308 drcEngine->SetSchematicNetlist( nullptr );
309
310 m_commit->Revert();
311 m_commit.reset();
312 m_violationMarkers.clear();
313 m_netlist.reset();
314 throw;
315 }
316
317 const bool cancelled = reporter && reporter->IsCancelled();
318
319 drcEngine->ClearViolationHandler();
320 drcEngine->SetProgressReporter( nullptr );
321
322 if( !frame )
323 drcEngine->SetDrawingSheet( nullptr );
324
325 headlessDrawingSheet.reset();
326 reporter.reset();
327
328 if( m_testFootprints )
329 drcEngine->SetSchematicNetlist( nullptr );
330
331 m_netlist.reset();
332
333 if( cancelled )
334 {
335 m_violationMarkers.clear();
336 m_commit->Revert();
337 m_commit.reset();
338
339 std::unique_ptr<COMMIT> exclusionCommit = m_handler->createCommit();
340
341 for( PCB_MARKER* marker : m_board->ResolveDRCExclusions( true ) )
342 {
343 if( frame && marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
344 marker->GetRCItem()->SetItems( frame->GetCanvas()->GetDrawingSheet() );
345
346 exclusionCommit->Add( marker );
347 }
348
349 exclusionCommit->Push( _( "DRC (cancelled)" ), SKIP_UNDO | SKIP_SET_DIRTY );
350 m_board->UpdateRatsnestExclusions();
351
352 m_state = TS_CANCELLED;
353 m_errorMessage = "DRC cancelled by user";
354
355 if( frame )
356 {
357 if( DIALOG_DRC* dialog = drcTool->GetDRCDialog() )
358 dialog->UpdateData();
359
360 frame->ShowSolderMask();
361 }
362
363 return;
364 }
365
366 m_commit->Push( _( "DRC" ), SKIP_UNDO | SKIP_SET_DIRTY );
367 m_board->ResolveDRCExclusions( false );
368
369 buildResult();
370
371 m_commit.reset();
372 m_violationMarkers.clear();
373
374 if( frame )
375 {
376 if( DIALOG_DRC* dialog = drcTool->GetDRCDialog() )
377 dialog->UpdateData();
378
379 frame->ShowSolderMask();
380 }
381 }
382
383 void FillStatus( TaskStatusResponse& aStatus ) const override
384 {
385 if( m_state != TS_UNKNOWN )
386 aStatus.set_state( m_state );
387
388 if( !m_errorMessage.empty() )
389 aStatus.set_error_message( m_errorMessage );
390 }
391
392 DrcTaskResult Result() const
393 {
394 return m_result;
395 }
396
397private:
399 {
400 for( const ZONE* zone : m_board->Zones() )
401 {
402 if( zone->GetIsRuleArea() )
403 continue;
404
405 if( !zone->IsFilled() || zone->NeedRefill() )
406 {
407 m_state = TS_FAILED;
408 m_errorMessage = "zone fills are not up to date; refill the zones "
409 "(StartRefillZonesTask) before running DRC";
410 return false;
411 }
412 }
413
414 return true;
415 }
416
418 {
419 m_netlist = std::make_unique<NETLIST>();
420
421 if( PCB_EDIT_FRAME* frame = m_handler->frame() )
422 {
423 if( !frame->FetchNetlistFromSchematic( *m_netlist,
424 _( "Schematic parity tests require a fully annotated schematic." ) ) )
425 {
426 m_state = TS_FAILED;
427 m_errorMessage = "could not fetch schematic netlist for parity tests";
428 return false;
429 }
430
431 return true;
432 }
433
434 wxFileName schematicPath( m_board->GetFileName() );
435 schematicPath.SetExt( FILEEXT::KiCadSchematicFileExtension );
436
437 if( !schematicPath.FileExists() )
438 schematicPath.SetExt( FILEEXT::LegacySchematicFileExtension );
439
440 if( !schematicPath.FileExists() )
441 {
442 m_state = TS_FAILED;
443 m_errorMessage = "schematic file not found for parity tests";
444 return false;
445 }
446
447 KIWAY* kiway = m_handler->pcbContext()->GetKiway();
448 KIFACE* eeschema = kiway ? kiway->KiFACE( KIWAY::FACE_SCH ) : nullptr;
449
450 if( !eeschema )
451 {
452 m_state = TS_FAILED;
453 m_errorMessage = "could not load schematic editor for parity tests";
454 return false;
455 }
456
458
459 if( !netlister )
460 {
461 m_state = TS_FAILED;
462 m_errorMessage = "could not load schematic editor for parity tests";
463 return false;
464 }
465
466 std::string netlistStr;
467
468 if( !( *netlister )( schematicPath.GetFullPath(), netlistStr, kiway )
469 || netlistStr.empty() || netlistStr == MAIL_SCH_GET_NETLIST_CANCELLED )
470 {
471 m_state = TS_FAILED;
472 m_errorMessage = "could not fetch schematic netlist for parity tests";
473 return false;
474 }
475
476 STRING_LINE_READER* lineReader = new STRING_LINE_READER( netlistStr, _( "Eeschema netlist" ) );
477 KICAD_NETLIST_READER netlistReader( lineReader, m_netlist.get() );
478
479 try
480 {
481 netlistReader.LoadNetlist();
482 }
483 catch( const IO_ERROR& )
484 {
485 m_state = TS_FAILED;
486 m_errorMessage = "could not parse schematic netlist for parity tests";
487 return false;
488 }
489
490 return true;
491 }
492
494 {
495 m_result.Clear();
496
497 std::stable_sort( m_violationMarkers.begin(), m_violationMarkers.end(),
498 []( const PCB_MARKER* a, const PCB_MARKER* b )
499 {
500 auto rank = []( SEVERITY aSeverity )
501 {
502 return aSeverity == RPT_SEVERITY_IGNORE
503 || aSeverity == RPT_SEVERITY_DEBUG
504 ? 0
505 : static_cast<int>( aSeverity );
506 };
507
508 return rank( a->GetSeverity() ) > rank( b->GetSeverity() );
509 } );
510
511 for( const PCB_MARKER* marker : m_violationMarkers )
512 {
513 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
514 m_result.set_excluded_count( m_result.excluded_count() + 1 );
515
516 kiapi::board::DrcMarker markerMsg;
517 PCB_MARKER::ToProto( markerMsg, *marker );
518 *m_result.add_violations() = std::move( markerMsg );
519 }
520
521 for( const std::reference_wrapper<RC_ITEM>& item : DRC_ITEM::GetItemsWithSeverities() )
522 {
523 int code = item.get().GetErrorCode();
524
525 if( code > 0
527 {
528 m_result.set_ignored_count( m_result.ignored_count() + 1 );
529 }
530 }
531 }
532
538
539 TaskState m_state = TS_UNKNOWN;
540 std::string m_errorMessage;
541
542 std::unique_ptr<NETLIST> m_netlist;
543 std::unique_ptr<BOARD_COMMIT> m_commit;
544 std::vector<PCB_MARKER*> m_violationMarkers;
545 DrcTaskResult m_result;
546};
547
548
551{
552 HANDLER_RESULT<bool> documentValidation = validateDocument( aCtx.Request.board() );
553
554 if( !documentValidation )
555 return tl::unexpected( documentValidation.error() );
556
557 if( std::optional<ApiResponseStatus> busy = checkForBusy() )
558 return tl::unexpected( *busy );
559
561
562 if( !toFill )
563 return tl::unexpected( toFill.error() );
564
565 auto task = std::make_shared<API_HANDLER_PCB::REFILL_ZONES_TASK>( this, std::move( *toFill ) );
566
567 std::optional<std::string> token = API_TASK_SCHEDULER::Instance().StartTask( task, wxS( "RefillZones" ) );
568
569 if( !token.has_value() )
570 {
571 ApiResponseStatus e;
572 e.set_status( ApiStatusCode::AS_BUSY );
573 e.set_error_message( "another task is already running" );
574 return tl::unexpected( e );
575 }
576
577 StartTaskResponse response;
578 response.mutable_token()->set_value( *token );
579 return response;
580}
581
582
584{
585 HANDLER_RESULT<bool> documentValidation = validateDocument( aCtx.Request.board() );
586
587 if( !documentValidation )
588 return tl::unexpected( documentValidation.error() );
589
590 if( std::optional<ApiResponseStatus> busy = checkForBusy() )
591 return tl::unexpected( *busy );
592
593 auto task = std::make_shared<API_HANDLER_PCB::DRC_TASK>( this,
594 aCtx.Request.report_all_track_errors(),
595 aCtx.Request.test_schematic_parity(),
596 aCtx.Request.require_zones_filled() );
597
598 std::optional<std::string> token = API_TASK_SCHEDULER::Instance().StartTask( task, wxS( "DRC" ) );
599
600 if( !token.has_value() )
601 {
602 ApiResponseStatus e;
603 e.set_status( ApiStatusCode::AS_BUSY );
604 e.set_error_message( "another task is already running" );
605 return tl::unexpected( e );
606 }
607
608 StartTaskResponse response;
609 response.mutable_token()->set_value( *token );
610 return response;
611}
612
613
615{
616 if( !aCtx.Request.has_token() || aCtx.Request.token().value().empty() )
617 {
618 ApiResponseStatus e;
619 e.set_status( ApiStatusCode::AS_BAD_REQUEST );
620 e.set_error_message( "no task token provided" );
621 return tl::unexpected( e );
622 }
623
624 std::optional<TaskStatusResponse> status =
625 API_TASK_SCHEDULER::Instance().GetStatus( aCtx.Request.token().value() );
626
627 if( !status )
628 {
629 ApiResponseStatus e;
630 e.set_status( ApiStatusCode::AS_BAD_REQUEST );
631 e.set_error_message( fmt::format( "unknown task token {}", aCtx.Request.token().value() ) );
632 return tl::unexpected( e );
633 }
634
635 if( status->state() == TS_RUNNING )
636 {
637 ApiResponseStatus e;
638 e.set_status( ApiStatusCode::AS_BUSY );
639 e.set_error_message( "the DRC task is still running" );
640 return tl::unexpected( e );
641 }
642
643 if( status->state() == TS_FAILED || status->state() == TS_CANCELLED )
644 {
645 ApiResponseStatus e;
646 e.set_status( ApiStatusCode::AS_INTERNAL_ERROR );
647 e.set_error_message( status->error_message().empty() ? std::string( "DRC task failed" )
648 : status->error_message() );
649 return tl::unexpected( e );
650 }
651
652 std::shared_ptr<API_TASK> task =
653 API_TASK_SCHEDULER::Instance().GetFinishedTask( aCtx.Request.token().value() );
654
655 if( !task )
656 {
657 ApiResponseStatus e;
658 e.set_status( ApiStatusCode::AS_BAD_REQUEST );
659 e.set_error_message( fmt::format( "no completed task with token {}", aCtx.Request.token().value() ) );
660 return tl::unexpected( e );
661 }
662
663 auto* drcTask = dynamic_cast<API_HANDLER_PCB::DRC_TASK*>( task.get() );
664
665 if( !drcTask )
666 {
667 ApiResponseStatus e;
668 e.set_status( ApiStatusCode::AS_BAD_REQUEST );
669 e.set_error_message( "task is not a DRC task" );
670 return tl::unexpected( e );
671 }
672
673 return drcTask->Result();
674}
tl::expected< T, ApiResponseStatus > HANDLER_RESULT
Definition api_handler.h:47
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
#define ZONE_FILL_OP
BOARD * board() const
HANDLER_RESULT< bool > validateDocument(const DocumentSpecifier &aDocument)
virtual std::optional< ApiResponseStatus > checkForBusy()
Checks if the editor can accept commands.
std::unique_ptr< NETLIST > m_netlist
void FillStatus(TaskStatusResponse &aStatus) const override
DRC_TASK(API_HANDLER_PCB *aHandler, bool aReportAllTrackErrors, bool aTestFootprints, bool aRequireZonesFilled)
void Run() override
The task runner; called on the main thread.
std::vector< PCB_MARKER * > m_violationMarkers
std::unique_ptr< BOARD_COMMIT > m_commit
void Run() override
The task runner; called on the main thread.
REFILL_ZONES_TASK(API_HANDLER_PCB *aHandler, std::vector< ZONE * > &&aZones)
void FillStatus(TaskStatusResponse &aStatus) const override
HANDLER_RESULT< kiapi::common::tasks::StartTaskResponse > handleStartDrcTask(const HANDLER_CONTEXT< kiapi::board::tasks::StartDrcTask > &aCtx)
API_HANDLER_PCB(PCB_EDIT_FRAME *aFrame)
HANDLER_RESULT< kiapi::common::tasks::StartTaskResponse > handleStartRefillZonesTask(const HANDLER_CONTEXT< kiapi::board::tasks::StartRefillZonesTask > &aCtx)
HANDLER_RESULT< std::vector< ZONE * > > resolveZonesToFill(const google::protobuf::RepeatedPtrField< kiapi::common::types::KIID > &aZoneIds) const
HANDLER_RESULT< kiapi::board::tasks::DrcTaskResult > handleGetDrcTaskResult(const HANDLER_CONTEXT< kiapi::board::tasks::GetDrcTaskResult > &aCtx)
PCB_EDIT_FRAME * frame() const
std::shared_ptr< API_TASK > GetFinishedTask(const std::string &aToken) const
Look up a task that has finished, for result retrieval.
std::optional< kiapi::common::tasks::TaskStatusResponse > GetStatus(const std::string &aToken) const
Get a snapshot of the task's current status.
static API_TASK_SCHEDULER & Instance()
std::optional< std::string > StartTask(const std::shared_ptr< API_TASK > &aTask, const wxString &aDescription)
Register a new task and begin running it.
SEVERITY GetSeverity(int aDRCErrorCode) const
Return the severity of a given DRC error code.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
BOARD_DESIGN_SETTINGS & GetDesignSettings()
Definition board.cpp:1318
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition drc_item.h:173
DIALOG_DRC * GetDRCDialog()
Definition drc_tool.h:62
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition drc_tool.h:72
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Read the new s-expression based KiCad netlist format.
virtual void LoadNetlist() override
Load the contents of the netlist file into aNetlist.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition kiway.cpp:216
@ FACE_SCH
eeschema DSO
Definition kiway.h:355
@ MARKER_DRAWING_SHEET
Definition marker_base.h:51
The main frame for Pcbnew.
SEVERITY GetSeverity() const override
static void ToProto(kiapi::board::DrcMarker &aMsg, const PCB_MARKER &aMarker)
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition richio.h:225
Master controller class:
T * GetTool()
Return the tool of given type or nullptr if there is no such tool registered.
TOOL_BASE * FindTool(int aId) const
Search for a tool with given ID.
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
Handle actions specific to filling copper zones.
bool FillAllZones(wxWindow *aCaller, PROGRESS_REPORTER *aReporter=nullptr, bool aHeadless=false)
void PostFillRefresh(bool aHeadless=false)
Run the shared post-fill refresh once a fill commit has been pushed with connectivity updates skipped...
void SetProgressReporter(PROGRESS_REPORTER *aReporter)
bool Fill(const std::vector< ZONE * > &aZones, bool aCheck=false, wxWindow *aParent=nullptr)
Fills the given list of zones.
Handle a list of polygons defining a copper zone.
Definition zone.h:70
#define DRC_TOOL_NAME
Definition drc_tool.h:33
#define _(s)
EDA_UNITS
Definition eda_units.h:45
static const std::string LegacySchematicFileExtension
static const std::string KiCadSchematicFileExtension
Service::Type GetKifaceService(KIFACE *aKiface)
Look up a service exported by a KIFACE.
This file contains miscellaneous commonly used macros and functions.
#define MAIL_SCH_GET_NETLIST_CANCELLED
Reply payload for MAIL_SCH_GET_NETLIST when the user deliberately aborts netlist generation (for exam...
Definition mail_type.h:79
STL namespace.
@ RPT_SEVERITY_EXCLUSION
@ RPT_SEVERITY_IGNORE
#define SKIP_CONNECTIVITY
Definition sch_commit.h:41
#define SKIP_SET_DIRTY
Definition sch_commit.h:40
#define SKIP_UNDO
Definition sch_commit.h:38
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
RequestMessageType Request
Definition api_handler.h:54
Implement a participant in the KIWAY alchemy.
Definition kiway.h:153
A filename or source description, a problem input line, a line number, a byte offset,...
IbisParser parser & reporter
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
Definition of file extensions used in Kicad.
#define PR_CAN_ABORT
#define ZONE_FILLER_TOOL_NAME