KiCad PCB EDA Suite
kiway.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) 2014 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
5 * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.TXT for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <cstring>
26
27#include <ignore.h>
28#include <macros.h>
29#include <kiway.h>
30#include <kiway_player.h>
31#include <kiway_express.h>
32#include <pgm_base.h>
33#include <config.h>
34#include <core/arraydim.h>
35#include <id.h>
36#include <kiplatform/app.h>
39#include <tool/action_manager.h>
40#include <logging.h>
41
42#include <wx/dynlib.h>
43#include <wx/stdpaths.h>
44#include <wx/debug.h>
45#include <wx/utils.h>
46#include <confirm.h>
47
48KIFACE* KIWAY::m_kiface[KIWAY_FACE_COUNT];
49int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
50
51
52
53KIWAY::KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop ):
54 m_program( aProgram ), m_ctl( aCtlBits ), m_top( nullptr ), m_blockingDialog( wxID_NONE )
55{
56 SetTop( aTop ); // hook player_destroy_handler() into aTop.
57
58 // Set the array of all known frame window IDs to empty = wxID_NONE,
59 // once they are be created, they are added with FRAME_T as index to this array.
60 // Note: A non empty entry does not mean the frame still exists.
61 // It means only the frame was created at least once. It can be destroyed after.
62 // These entries are not cleared automatically on window closing. The purpose is just
63 // to allow a call to wxWindow::FindWindowById() using a FRAME_T frame type
64 for( int n = 0; n < KIWAY_PLAYER_COUNT; n++ )
65 m_playerFrameId[n] = wxID_NONE;
66}
67
68
69#if 0
70// Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are
71// propagated upwards to parent windows if not handled below. Therefore the
72// m_top window should receive all wxWindowDestroyEvents originating from
73// KIWAY_PLAYERs. It does anyways, but now player_destroy_handler eavesdrops
74// on that event stream looking for KIWAY_PLAYERs being closed.
75
76void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
77{
78 // Currently : do nothing
79 event.Skip(); // skip to who, the wxApp? I'm the top window.
80}
81#endif
82
83
84void KIWAY::SetTop( wxFrame* aTop )
85{
86#if 0
87 if( m_top )
88 {
89 m_top->Disconnect( wxEVT_DESTROY,
90 wxWindowDestroyEventHandler( KIWAY::player_destroy_handler ),
91 nullptr, this );
92 }
93
94 if( aTop )
95 {
96 aTop->Connect( wxEVT_DESTROY,
97 wxWindowDestroyEventHandler( KIWAY::player_destroy_handler ),
98 nullptr, this );
99 }
100#endif
101
102 m_top = aTop;
103}
104
105
106const wxString KIWAY::dso_search_path( FACE_T aFaceId )
107{
108 const char* name;
109
110 switch( aFaceId )
111 {
112 case FACE_SCH: name = KIFACE_PREFIX "eeschema"; break;
113 case FACE_PCB: name = KIFACE_PREFIX "pcbnew"; break;
114 case FACE_CVPCB: name = KIFACE_PREFIX "cvpcb"; break;
115 case FACE_GERBVIEW: name = KIFACE_PREFIX "gerbview"; break;
116 case FACE_PL_EDITOR: name = KIFACE_PREFIX "pl_editor"; break;
117 case FACE_PCB_CALCULATOR: name = KIFACE_PREFIX "pcb_calculator"; break;
118 case FACE_BMP2CMP: name = KIFACE_PREFIX "bitmap2component"; break;
119 case FACE_PYTHON: name = KIFACE_PREFIX "kipython"; break;
120
121 default:
122 wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
123 return wxEmptyString;
124 }
125
126#ifndef __WXMAC__
127 wxString path;
128
130 {
131 // The 2 *.cpp program launchers: single_top.cpp and kicad.cpp expect
132 // the *.kiface's to reside in same directory as their binaries do.
133 path = wxStandardPaths::Get().GetExecutablePath();
134 }
135
136 wxFileName fn = path;
137#else
138 // we have the dso's in main OSX bundle kicad.app/Contents/PlugIns
139 wxFileName fn = Pgm().GetExecutablePath();
140 fn.AppendDir( wxT( "Contents" ) );
141 fn.AppendDir( wxT( "PlugIns" ) );
142#endif
143
144 fn.SetName( name );
145
146 // To speed up development, it's sometimes nice to run kicad from inside
147 // the build path. In that case, each program will be in a subdirectory.
148 // To find the DSOs, we need to go up one directory and then enter a subdirectory.
149
150 if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
151 {
152#ifdef __WXMAC__
153 // On Mac, all of the kifaces are placed in the kicad.app bundle, even though the individual
154 // standalone binaries are placed in separate bundles before the make install step runs.
155 // So, we have to jump up to the kicad directory, then the PlugIns section of the kicad
156 // bundle.
157 fn = wxStandardPaths::Get().GetExecutablePath();
158
159 fn.RemoveLastDir();
160 fn.RemoveLastDir();
161 fn.RemoveLastDir();
162 fn.RemoveLastDir();
163 fn.AppendDir( wxT( "kicad" ) );
164 fn.AppendDir( wxT( "kicad.app" ) );
165 fn.AppendDir( wxT( "Contents" ) );
166 fn.AppendDir( wxT( "PlugIns" ) );
167 fn.SetName( name );
168#else
169 const char* dirName;
170
171 // The subdirectories usually have the same name as the kiface
172 switch( aFaceId )
173 {
174 case FACE_PL_EDITOR: dirName = "pagelayout_editor"; break;
175 case FACE_PYTHON: dirName = "scripting"; break;
176 default: dirName = name + 1; break;
177 }
178
179 fn.RemoveLastDir();
180 fn.AppendDir( dirName );
181#endif
182 }
183
184 // Here a "suffix" == an extension with a preceding '.',
185 // so skip the preceding '.' to get an extension
186 fn.SetExt( &KIFACE_SUFFIX[1] );
187
188 return fn.GetFullPath();
189}
190
191
193{
194 return Pgm().GetSettingsManager().Prj();
195}
196
197
198KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
199{
200 // Since this will be called from python, cannot assume that code will
201 // not pass a bad aFaceId.
202 if( (unsigned) aFaceId >= arrayDim( m_kiface ) )
203 {
204 // @todo : throw an exception here for python's benefit, at least that
205 // way it gets some explanatory text.
206
207 wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
208 return nullptr;
209 }
210
211 // return the previously loaded KIFACE, if it was.
212 if( m_kiface[aFaceId] )
213 return m_kiface[aFaceId];
214
215 wxString msg;
216
217 // DSO with KIFACE has not been loaded yet, does caller want to load it?
218 if( doLoad )
219 {
220 wxString dname = dso_search_path( aFaceId );
221
222 // Insert DLL search path for kicad_3dsg from build dir
223 if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
224 {
225 wxFileName myPath = wxStandardPaths::Get().GetExecutablePath();
226
227 if( !myPath.GetPath().EndsWith( wxT( "pcbnew" ) ) )
228 {
229 myPath.RemoveLastDir();
230 myPath.AppendDir( wxT( "pcbnew" ) );
232 }
233 }
234
235#ifdef KICAD_WIN32_VERIFY_CODESIGN
236 bool codeSignOk = KIPLATFORM::ENV::VerifyFileSignature( dname );
237 if( !codeSignOk )
238 {
239 msg.Printf( _( "Failed to verify kiface library '%s' signature." ), dname );
240 THROW_IO_ERROR( msg );
241 }
242#endif
243
244 wxDynamicLibrary dso;
245
246 void* addr = nullptr;
247
248 // For some reason wxDynamicLibrary::Load() crashes in some languages
249 // (chinese for instance) when loading the dynamic library.
250 // The crash happens for Eeschema.
251 // So switch to "C" locale during loading (LC_COLLATE is enough).
252 int lc_new_type = LC_COLLATE;
253 std::string user_locale = setlocale( lc_new_type, nullptr );
254 setlocale( lc_new_type, "C" );
255
256 bool success = dso.Load( dname, wxDL_VERBATIM | wxDL_NOW | wxDL_GLOBAL );
257
258 setlocale( lc_new_type, user_locale.c_str() );
259
260 if( !success )
261 {
262 // Failure: error reporting UI was done via wxLogSysError().
263 // No further reporting required here. Apparently this is not true on all
264 // platforms and/or wxWidgets builds and KiCad will crash. Throwing the exception
265 // here and catching it in the KiCad launcher resolves the crash issue. See bug
266 // report https://bugs.launchpad.net/kicad/+bug/1577786.
267
268 msg.Printf( _( "Failed to load kiface library '%s'." ), dname );
269 THROW_IO_ERROR( msg );
270 }
271 else if( ( addr = dso.GetSymbol( wxT( KIFACE_INSTANCE_NAME_AND_VERSION ) ) ) == nullptr )
272 {
273 // Failure: error reporting UI was done via wxLogSysError().
274 // No further reporting required here. Assume the same thing applies here as
275 // above with the Load() call. This has not been tested.
276 msg.Printf( _( "Could not read instance name and version from kiface library '%s'." ),
277 dname );
278 THROW_IO_ERROR( msg );
279 }
280 else
281 {
282 KIFACE_GETTER_FUNC* ki_getter = (KIFACE_GETTER_FUNC*) addr;
283
284 KIFACE* kiface = ki_getter( &m_kiface_version[aFaceId], KIFACE_VERSION, m_program );
285
286 // KIFACE_GETTER_FUNC function comment (API) says the non-NULL is unconditional.
287 wxASSERT_MSG( kiface,
288 wxT( "attempted DSO has a bug, failed to return a KIFACE*" ) );
289
290 // Give the DSO a single chance to do its "process level" initialization.
291 // "Process level" specifically means stay away from any projects in there.
292 if( kiface->OnKifaceStart( m_program, m_ctl ) )
293 {
294 // Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
295 ignore_unused( dso.Detach() );
296
297 return m_kiface[aFaceId] = kiface;
298 }
299 }
300
301 // In any of the failure cases above, dso.Unload() should be called here
302 // by dso destructor.
303 // However:
304
305 // There is a file installation bug. We only look for KIFACE's which we know
306 // to exist, and we did not find one. If we do not find one, this is an
307 // installation bug.
308
309 msg = wxString::Format( _( "Fatal Installation Bug. File:\n"
310 "'%s'\ncould not be loaded\n" ), dname );
311
312 if( ! wxFileExists( dname ) )
313 msg << _( "It is missing.\n" );
314 else
315 msg << _( "Perhaps a shared library (.dll or .so) file is missing.\n" );
316
317 msg << _( "From command line: argv[0]:\n'" );
318 msg << wxStandardPaths::Get().GetExecutablePath() << wxT( "'\n" );
319
320 // This is a fatal error, one from which we cannot recover, nor do we want
321 // to protect against in client code which would require numerous noisy
322 // tests in numerous places. So we inform the user that the installation
323 // is bad. This exception will likely not get caught until way up in the
324 // wxApp derivative, at which point the process will exit gracefully.
325 THROW_IO_ERROR( msg );
326 }
327
328 return nullptr;
329}
330
331
333{
334 switch( aFrameType )
335 {
336 case FRAME_SCH:
338 case FRAME_SCH_VIEWER:
340 case FRAME_SIMULATOR:
341 return FACE_SCH;
342
343 case FRAME_PCB_EDITOR:
349 return FACE_PCB;
350
351 case FRAME_CVPCB:
353 return FACE_CVPCB;
354
355 case FRAME_PYTHON:
356 return FACE_PYTHON;
357
358 case FRAME_GERBER:
359 return FACE_GERBVIEW;
360
361 case FRAME_PL_EDITOR:
362 return FACE_PL_EDITOR;
363
364 case FRAME_CALC:
365 return FACE_PCB_CALCULATOR;
366
367 case FRAME_BM2CMP:
368 return FACE_BMP2CMP;
369
370 default:
371 return FACE_T( -1 );
372 }
373}
374
375
377{
378 wxWindowID storedId = m_playerFrameId[aFrameType];
379
380 if( storedId == wxID_NONE )
381 return nullptr;
382
383 wxWindow* frame = wxWindow::FindWindowById( storedId );
384
385 // Since wxWindow::FindWindow*() is not cheap (especially if the window does not exist),
386 // clear invalid entries to save CPU on repeated calls that do not lead to frame creation
387 if( !frame )
388 m_playerFrameId[aFrameType].compare_exchange_strong( storedId, wxID_NONE );
389
390 return static_cast<KIWAY_PLAYER*>( frame );
391}
392
393
394KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow* aParent )
395{
396 // Since this will be called from python, cannot assume that code will
397 // not pass a bad aFrameType.
398 if( (unsigned) aFrameType >= KIWAY_PLAYER_COUNT )
399 {
400 // @todo : throw an exception here for python's benefit, at least that
401 // way it gets some explanatory text.
402
403 wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFrameType" ) );
404 return nullptr;
405 }
406
407 // return the previously opened window
408 KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
409
410 if( frame )
411 return frame;
412
413 if( doCreate )
414 {
415 try
416 {
417 FACE_T face_type = KifaceType( aFrameType );
418 KIFACE* kiface = KiFACE( face_type );
419
420 frame = (KIWAY_PLAYER*) kiface->CreateKiWindow(
421 aParent, // Parent window of frame in modal mode,
422 // NULL in non modal mode
423 aFrameType,
424 this,
425 m_ctl // questionable need, these same flags
426 // were passed to KIFACE::OnKifaceStart()
427 );
428
429 m_playerFrameId[aFrameType].store( frame->GetId() );
430 return frame;
431 }
432 catch( const IO_ERROR& ioe )
433 {
434 DisplayErrorMessage( nullptr, _( "Error loading editor." ), ioe.What() );
435 }
436 catch( const std::exception& e)
437 {
438 DisplayErrorMessage( nullptr, _( "Error loading editor." ), e.what() );
439 }
440 catch( ... )
441 {
442 DisplayErrorMessage( nullptr, _( "Error loading editor." ) );
443 }
444 }
445
446 return nullptr;
447}
448
449
450bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
451{
452 // Since this will be called from python, cannot assume that code will
453 // not pass a bad aFrameType.
454 if( (unsigned) aFrameType >= KIWAY_PLAYER_COUNT )
455 {
456 // @todo : throw an exception here for python's benefit, at least that
457 // way it gets some explanatory text.
458
459 wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFrameType" ) );
460 return false;
461 }
462
463 KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
464
465 if( frame == nullptr ) // Already closed
466 return true;
467
468 if( frame->NonUserClose( doForce ) )
469 {
470 m_playerFrameId[aFrameType] = wxID_NONE;
471 return true;
472 }
473
474 return false;
475}
476
477
478bool KIWAY::PlayersClose( bool doForce )
479{
480 bool ret = true;
481
482 for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
483 {
484 ret = ret && PlayerClose( FRAME_T( i ), doForce );
485 }
486
487 return ret;
488}
489
490
491void KIWAY::ExpressMail( FRAME_T aDestination, MAIL_T aCommand, std::string& aPayload,
492 wxWindow* aSource )
493{
494 KIWAY_EXPRESS mail( aDestination, aCommand, aPayload, aSource );
495
496 ProcessEvent( mail );
497}
498
499
500void KIWAY::GetActions( std::vector<TOOL_ACTION*>& aActions ) const
501{
503 aActions.push_back( action );
504}
505
506
507void KIWAY::SetLanguage( int aLanguage )
508{
509 wxString errMsg;
510 bool ret = false;
511
512 {
513 // Only allow the traces to be logged by wx. We use our own system to log when the
514 // OS doesn't support the language, so we want to hide the wx error.
515 WX_LOG_TRACE_ONLY logtraceOnly;
516 Pgm().SetLanguageIdentifier( aLanguage );
517 ret = Pgm().SetLanguage( errMsg );
518 }
519
520 if( !ret )
521 {
522 wxString lang;
523
524 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
525 {
526 if( aLanguage == LanguagesList[ii].m_KI_Lang_Identifier )
527 {
528 if( LanguagesList[ii].m_DoNotTranslate )
529 lang = LanguagesList[ii].m_Lang_Label;
530 else
531 lang = wxGetTranslation( LanguagesList[ii].m_Lang_Label );
532
533 break;
534 }
535 }
536
537 DisplayErrorMessage( nullptr,
538 wxString::Format( _( "Unable to switch language to %s" ), lang ),
539 errMsg );
540 return;
541 }
542
543#if 1
544 // This is a risky hack that goes away if we allow the language to be
545 // set only from the top most frame if !Kiface.IsSingle()
546
547 // Only for the C++ project manager, and not for the python one and not for
548 // single_top do we look for the EDA_BASE_FRAME as the top level window.
549 // For single_top this is not needed because that window is registered in
550 // the array below.
552 {
553 // A dynamic_cast could be better, but creates link issues
554 // (some basic_frame functions not found) on some platforms,
555 // so a static_cast is used.
556 EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top );
557
558 if( top )
559 top->ShowChangedLanguage();
560 }
561#endif
562
563 for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
564 {
565 KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i );
566
567 if( frame )
568 {
569 frame->ShowChangedLanguage();
570 }
571 }
572}
573
574
575void KIWAY::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
576{
578 {
579 // A dynamic_cast could be better, but creates link issues
580 // (some basic_frame functions not found) on some platforms,
581 // so a static_cast is used.
582 EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top );
583
584 if( top )
585 top->CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
586 }
587
588 for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
589 {
590 KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i );
591
592 if( frame )
593 frame->CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
594 }
595}
596
597
599{
601 {
602 // A dynamic_cast could be better, but creates link issues
603 // (some basic_frame functions not found) on some platforms,
604 // so a static_cast is used.
605 EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top );
606
607 if( top )
608 top->ProjectChanged();
609 }
610
611 for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
612 {
613 KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i );
614
615 if( frame )
616 frame->ProjectChanged();
617 }
618}
619
621{
622 return wxWindow::FindWindowById( m_blockingDialog );
623}
624
625void KIWAY::SetBlockingDialog( wxWindow* aWin )
626{
627 if( !aWin )
628 m_blockingDialog = wxID_NONE;
629 else
630 m_blockingDialog = aWin->GetId();
631}
632
633
634bool KIWAY::ProcessEvent( wxEvent& aEvent )
635{
636 KIWAY_EXPRESS* mail = dynamic_cast<KIWAY_EXPRESS*>( &aEvent );
637
638 if( mail )
639 {
640 FRAME_T dest = mail->Dest();
641
642 // see if recipient is alive
643 KIWAY_PLAYER* alive = Player( dest, false );
644
645 if( alive )
646 {
647#if 1
648 return alive->ProcessEvent( aEvent );
649#else
650 alive->KiwayMailIn( *mail );
651 return true;
652#endif
653 }
654 }
655
656 return false;
657}
658
659
661{
662 KIFACE* kiface = KiFACE( aFace );
663
664 return kiface->HandleJob( job );
665}
666
667
669{
671 {
672 // A dynamic_cast could be better, but creates link issues
673 // (some basic_frame functions not found) on some platforms,
674 // so a static_cast is used.
675 EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top );
676
677 if( top )
678 top->Close( false );
679 }
680}
681
682
684{
685 for( KIFACE* i : m_kiface )
686 {
687 if( i )
688 i->OnKifaceEnd();
689 }
690}
const char * name
Definition: DXF_plotter.cpp:56
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
static std::list< TOOL_ACTION * > & GetActionList()
Return list of TOOL_ACTIONs.
The base frame for deriving all KiCad main window classes.
bool NonUserClose(bool aForce)
virtual void ProjectChanged()
Notification event that the project has changed.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
bool ProcessEvent(wxEvent &aEvent) override
Override the default process event handler to implement the auto save feature.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:28
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
FRAME_T Dest()
Return the destination player id of the message.
Definition: kiway_express.h:44
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
virtual void KiwayMailIn(KIWAY_EXPRESS &aEvent)
Receive KIWAY_EXPRESS messages from other players.
void OnKiCadExit()
Definition: kiway.cpp:668
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition: kiway.cpp:575
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
const wxString dso_search_path(FACE_T aFaceId)
Get the [path &] name of the DSO holding the requested FACE_T.
Definition: kiway.cpp:106
int ProcessJob(KIWAY::FACE_T aFace, JOB *job)
Definition: kiway.cpp:660
PGM_BASE * m_program
Definition: kiway.h:462
void SetBlockingDialog(wxWindow *aWin)
Definition: kiway.cpp:625
virtual bool PlayerClose(FRAME_T aFrameType, bool doForce)
Call the KIWAY_PLAYER::Close( bool force ) function on the window and if not vetoed,...
Definition: kiway.cpp:450
static FACE_T KifaceType(FRAME_T aFrameType)
A simple mapping function which returns the FACE_T which is known to implement aFrameType.
Definition: kiway.cpp:332
wxWindowID m_blockingDialog
Definition: kiway.h:467
KIWAY(PGM_BASE *aProgram, int aCtlBits, wxFrame *aTop=nullptr)
Definition: kiway.cpp:53
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
Definition: kiway.cpp:620
static KIFACE * m_kiface[KIWAY_FACE_COUNT]
Definition: kiway.h:459
wxFrame * m_top
Definition: kiway.h:465
virtual void SetLanguage(int aLanguage)
Change the language and then calls ShowChangedLanguage() on all #KIWAY_PLAYERs.
Definition: kiway.cpp:507
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition: kiway.cpp:198
FACE_T
Known KIFACE implementations.
Definition: kiway.h:285
@ FACE_SCH
eeschema DSO
Definition: kiway.h:286
@ FACE_PL_EDITOR
Definition: kiway.h:290
@ FACE_PYTHON
Definition: kiway.h:293
@ FACE_PCB
pcbnew DSO
Definition: kiway.h:287
@ FACE_CVPCB
Definition: kiway.h:288
@ FACE_GERBVIEW
Definition: kiway.h:289
@ FACE_BMP2CMP
Definition: kiway.h:292
@ FACE_PCB_CALCULATOR
Definition: kiway.h:291
static int m_kiface_version[KIWAY_FACE_COUNT]
Definition: kiway.h:460
KIWAY_PLAYER * GetPlayerFrame(FRAME_T aFrameType)
Definition: kiway.cpp:376
bool ProcessEvent(wxEvent &aEvent) override
Definition: kiway.cpp:634
virtual bool PlayersClose(bool doForce)
Call the KIWAY_PLAYER::Close( bool force ) function on all the windows and if none are vetoed,...
Definition: kiway.cpp:478
std::atomic< wxWindowID > m_playerFrameId[KIWAY_PLAYER_COUNT]
Definition: kiway.h:475
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:491
void OnKiwayEnd()
Definition: kiway.cpp:683
virtual void GetActions(std::vector< TOOL_ACTION * > &aActions) const
Append all registered actions to the given list.
Definition: kiway.cpp:500
void SetTop(wxFrame *aTop)
Tell this KIWAY about the top most frame in the program and optionally allows it to play the role of ...
Definition: kiway.cpp:84
virtual void ProjectChanged()
Calls ProjectChanged() on all KIWAY_PLAYERs.
Definition: kiway.cpp:598
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:192
int m_ctl
Definition: kiway.h:463
Container for data for KiCad programs.
Definition: pgm_base.h:95
Container for project specific data.
Definition: project.h:64
Represent a single user action.
Definition: tool_action.h:68
A logger class that filters out all log messages that are not generated by wxLogTrace and ignores the...
Definition: logging.h:32
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:325
This file is part of the common library.
return & kiface
Definition: cvpcb.cpp:112
int PGM_BASE * aProgram
Definition: cvpcb.cpp:110
#define _(s)
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:33
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
@ FRAME_FOOTPRINT_VIEWER_MODAL
Definition: frame_type.h:43
@ FRAME_CALC
Definition: frame_type.h:59
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
@ FRAME_CVPCB_DISPLAY
Definition: frame_type.h:49
@ FRAME_FOOTPRINT_VIEWER
Definition: frame_type.h:42
@ FRAME_BM2CMP
Definition: frame_type.h:57
@ FRAME_FOOTPRINT_WIZARD
Definition: frame_type.h:44
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_SCH_VIEWER_MODAL
Definition: frame_type.h:37
@ FRAME_SIMULATOR
Definition: frame_type.h:38
@ KIWAY_PLAYER_COUNT
Definition: frame_type.h:61
@ FRAME_PL_EDITOR
Definition: frame_type.h:55
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41
@ FRAME_GERBER
Definition: frame_type.h:53
@ FRAME_PYTHON
Definition: frame_type.h:51
@ FRAME_PCB_DISPLAY3D
Definition: frame_type.h:45
@ FRAME_CVPCB
Definition: frame_type.h:48
void ignore_unused(const T &)
Definition: ignore.h:24
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
#define KFCTL_CPP_PROJECT_SUITE
Running under C++ project mgr, possibly with others.
Definition: kiway.h:159
KIFACE * KIFACE_GETTER_FUNC(int *aKIFACEversion, int aKIWAYversion, PGM_BASE *aProgram)
Point to the one and only KIFACE export.
Definition: kiway.h:498
#define KIFACE_INSTANCE_NAME_AND_VERSION
Definition: kiway.h:115
#define KIFACE_VERSION
The KIWAY and KIFACE classes are used to communicate between various process modules,...
Definition: kiway.h:110
#define KFCTL_STANDALONE
Running as a standalone Top.
Definition: kiway.h:158
This file contains miscellaneous commonly used macros and functions.
MAIL_T
The set of mail types sendable via KIWAY::ExpressMail() and supplied as the aCommand parameter to tha...
Definition: mail_type.h:38
void AddDynamicLibrarySearchPath(const wxString &aPath)
Inserts a search path for loading dynamic libraries.
Definition: gtk/app.cpp:93
bool VerifyFileSignature(const wxString &aPath)
Validates the code signing signature of a given file This is most likely only ever going to be applic...
LANGUAGE_DESCR LanguagesList[]
An array containing all the languages that KiCad supports.
Definition: pgm_base.cpp:85
see class PGM_BASE
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:151
int m_KI_Lang_Identifier
KiCad identifier used in menu selection (See id.h)
Definition: pgm_base.h:66
wxString m_Lang_Label
Labels used in menus.
Definition: pgm_base.h:69