void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event ) { bool select = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME; if( !Pgm().GetPdfBrowserName() && !select ) { DisplayError( this, _( "You must choose a PDF viewer before using this option." ) ); } wxString mask( wxT( "*" ) ); #ifdef __WINDOWS__ mask += wxT( ".exe" ); #endif wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask; Pgm().ReadPdfBrowserInfos(); wxFileName fn = Pgm().GetPdfBrowserName(); wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(), fn.GetFullPath(), wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) return; Pgm().SetPdfBrowserName( dlg.GetPath() ); Pgm().WritePdfBrowserInfos(); }
void KIWAY::SetLanguage( int aLanguage ) { Pgm().SetLanguageIdentifier( aLanguage ); Pgm().SetLanguage(); #if 1 // This is a risky hack that goes away if we allow the language to be // set only from the top most frame if !Kiface.IsSingle() // Only for the C++ project manager, and not for the python one and not for // single_top do we look for the EDA_BASE_FRAME as the top level window. // For single_top this is not needed because that window is registered in // the array below. if( m_ctl & KFCTL_CPP_PROJECT_SUITE ) { // A dynamic_cast could be better, but creates link issues // (some basic_frame functions not found) on some platforms, // so a static_cast is used. EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top ); if( top ) top->ShowChangedLanguage(); } #endif for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i ) { KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i ); if( frame ) { frame->ShowChangedLanguage(); } } }
bool OnInit() // overload wxApp virtual { try { return Pgm().OnPgmInit( this ); } catch( const std::exception& e ) { wxLogError( wxT( "Unhandled exception class: %s what: %s" ), GetChars( FROM_UTF8( typeid(e).name() )), GetChars( FROM_UTF8( e.what() ) ) ); } catch( const IO_ERROR& ioe ) { wxLogError( GetChars( ioe.errorText ) ); } catch(...) { wxLogError( wxT( "Unhandled exception of unknown type" ) ); } Pgm().OnPgmExit(); return false; }
CMP_TREE_NODE_UNIT::CMP_TREE_NODE_UNIT( CMP_TREE_NODE* aParent, int aUnit ) { static void* locale = nullptr; static wxString namePrefix; // Fetching translations can take a surprising amount of time when loading libraries, // so only do it when necessary. if( Pgm().GetLocale() != locale ) { namePrefix = _( "Unit" ); locale = Pgm().GetLocale(); } Parent = aParent; Type = UNIT; Unit = aUnit; LibId = aParent->LibId; Name = namePrefix + " " + LIB_PART::SubReference( aUnit, false ); Desc = wxEmptyString; MatchName = wxEmptyString; IntrinsicRank = -aUnit; }
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size ) : wxScrolledWindow( parent, id, pos, size, drawPanelStyle ) { wxASSERT( parent ); ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS ); DisableKeyboardScrolling(); m_scrollIncrementX = std::min( size.x / 8, 10 ); m_scrollIncrementY = std::min( size.y / 8, 10 ); SetLayoutDirection( wxLayout_LeftToRight ); SetBackgroundColour( parent->GetDrawBgColor().ToColour() ); #if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC SetBackgroundStyle( wxBG_STYLE_CUSTOM ); #endif m_ClipBox.SetSize( size ); m_ClipBox.SetX( 0 ); m_ClipBox.SetY( 0 ); m_canStartBlock = -1; // Command block can start if >= 0 m_abortRequest = false; m_enableMousewheelPan = false; m_enableZoomNoCenter = false; m_enableAutoPan = true; m_ignoreMouseEvents = false; // Be sure a mouse release button event will be ignored when creating the canvas // if the mouse click was not made inside the canvas (can happen sometimes, when // launching a editor from a double click made in another frame) m_ignoreNextLeftButtonRelease = true; m_mouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL; Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false ); Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false ); Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true ); m_requestAutoPan = false; m_enableBlockCommands = false; m_minDragEventCount = 0; #ifdef __WXMAC__ m_defaultCursor = m_currentCursor = wxCURSOR_CROSS; m_showCrossHair = false; #else m_defaultCursor = m_currentCursor = wxCURSOR_ARROW; m_showCrossHair = true; #endif m_cursorLevel = 0; m_PrintIsMirrored = false; m_ClickTimer = (wxTimer*) NULL; m_doubleClickInterval = 250; }
void EDA_BASE_FRAME::SetLanguage( wxCommandEvent& event ) { int id = event.GetId(); Pgm().SetLanguageIdentifier( id ); Pgm().SetLanguage(); ReCreateMenuBar(); GetMenuBar()->Refresh(); }
void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event ) { // Ask for the current editor and instruct GetEditorName() to not show // unless we pass false as argument. wxString editorname = Pgm().GetEditorName( false ); // Ask the user to select a new editor, but suggest the current one as the default. editorname = Pgm().AskUserForPreferredEditor( editorname ); // If we have a new editor name request it to be copied to m_editor_name and saved // to the preferences file. If the user cancelled the dialog then the previous // value will be retained. if( !editorname.IsEmpty() ) Pgm().SetEditorName( editorname ); }
/** * Initializes the <code>AboutAppInfo</code> object with application specific information. * * This the object which holds all information about the application */ static void InitKiCadAboutNew( AboutAppInfo& info ) { // Set application specific icon const wxTopLevelWindow* const tlw = wxDynamicCast( Pgm().App().GetTopWindow(), wxTopLevelWindow ); if( tlw ) info.SetIcon( tlw->GetIcon() ); else { wxBitmap bitmap = KiBitmap( icon_kicad_xpm ); wxIcon icon; icon.CopyFromBitmap( bitmap ); info.SetIcon( icon ); } /* Set title */ info.SetAppName( wxT( ".: " ) + Pgm().App().GetAppName() + wxT( " :." ) ); /* Copyright information */ info.SetCopyright( wxT( "(C) 1992-2015 KiCad Developers Team" ) ); /* KiCad build version */ wxString version; version << wxT( "Version: " ) << GetBuildVersion() #ifdef DEBUG << wxT( ", debug" ) #else << wxT( ", release" ) #endif << wxT( " build" ); info.SetBuildVersion( version ); /* wxWidgets version */ wxString libVersion; libVersion << wxT( "wxWidgets " ) << wxMAJOR_VERSION << wxT( "." ) << wxMINOR_VERSION << wxT( "." ) << wxRELEASE_NUMBER /* Unicode or ANSI version */ #if wxUSE_UNICODE << wxT( " Unicode " ); #else << wxT( " ANSI " );
void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aGroupName, const PARAM_CFG_ARRAY& aParams, const wxString& aFileName ) { std::unique_ptr<wxConfigBase> cfg( configCreate( aSList, aGroupName, aFileName ) ); if( !cfg.get() ) { // could not find template return; } cfg->SetPath( wxT( "/" ) ); cfg->Write( wxT( "update" ), DateAndTime() ); // @todo: pass in aLastClient wxString: cfg->Write( wxT( "last_client" ), Pgm().App().GetAppName() ); // Save parameters cfg->DeleteGroup( aGroupName ); // Erase all data cfg->Flush(); cfg->SetPath( aGroupName ); cfg->Write( wxT( "version" ), CONFIG_VERSION ); cfg->SetPath( wxT( "/" ) ); wxConfigSaveParams( cfg.get(), aParams, aGroupName ); cfg->SetPath( wxT( "/" ) ); // cfg is deleted here by std::unique_ptr, that saves the *.pro file to disk }
DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, MODULE* aModule, wxDC* aDC ) : DIALOG_MODULE_BOARD_EDITOR_BASE( aParent ), m_OrientValidator( 1, &m_OrientValue ) { m_Parent = aParent; m_DC = aDC; m_CurrentModule = aModule; // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) ); SetIcon( icon ); m_OrientValidator.SetRange( -360.0, 360.0 ); m_OrientValueCtrl->SetValidator( m_OrientValidator ); m_OrientValidator.SetWindow( m_OrientValueCtrl ); aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() ); m_PreviewPane = new PANEL_PREV_3D( m_Panel3D, aParent->Prj().Get3DCacheManager() ); bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 ); m_NoteBook->SetSelection( m_page ); m_sdbSizerStdButtonsOK->SetDefault(); GetSizer()->SetSizeHints( this ); Centre(); Layout(); }
void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) { m_canvas->SetAbortRequest( true ); if( GetScreen()->IsModify() ) { wxString msg = wxString::Format( _( "Save the changes in\n" "'%s'\n" "before closing?" ), GetChars( GetBoard()->GetFileName() ) ); int ii = DisplayExitDialog( this, msg ); switch( ii ) { case wxID_CANCEL: Event.Veto(); return; case wxID_NO: break; case wxID_YES: // save the board. if the board has no name, // the ID_SAVE_BOARD_AS will actually made Files_io_from_id( ID_SAVE_BOARD ); break; } } GetGalCanvas()->StopDrawing(); // Delete the auto save file if it exists. wxFileName fn = GetBoard()->GetFileName(); // Auto save file name is the normal file name prefixed with a '$'. fn.SetName( wxT( "$" ) + fn.GetName() ); // Remove the auto save file on a normal close of Pcbnew. if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) ) { wxString msg = wxString::Format( _( "The auto save file '%s' could not be removed!" ), GetChars( fn.GetFullPath() ) ); wxMessageBox( msg, Pgm().App().GetAppName(), wxOK | wxICON_ERROR, this ); } // Delete board structs and undo/redo lists, to avoid crash on exit // when deleting some structs (mainly in undo/redo lists) too late Clear_Pcb( false ); // do not show the window because ScreenPcb will be deleted and we do not // want any paint event Show( false ); Destroy(); }
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aModule, std::vector<MODULE_3D_SETTINGS> *aParentModelList ) : PANEL_PREV_3D_BASE( aParent, wxID_ANY ) { m_userUnits = aFrame->GetUserUnits(); initPanel(); // Initialize the color settings to draw the board and the footprint m_dummyBoard->SetColorsSettings( &aFrame->Settings().Colors() ); m_parentModelList = aParentModelList; m_dummyModule = new MODULE( *aModule ); m_dummyBoard->Add( m_dummyModule ); // Set 3d viewer configuration for preview m_settings3Dviewer = new CINFO3D_VISU(); bool option; Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false ); m_settings3Dviewer->SetFlag( FL_MOUSEWHEEL_PANNING, option ); // Create the 3D canvas m_previewPane = new EDA_3D_CANVAS( this, COGL_ATT_LIST::GetAttributesList( true ), m_dummyBoard, *m_settings3Dviewer, aFrame->Prj().Get3DCacheManager() ); m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 ); }
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxString& aHelpText, const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL ) { wxMenuItem* item; item = new wxMenuItem( aMenu, aId, aText, aHelpText, aType ); // Retrieve the global applicaton show icon option: bool useImagesInMenus; Pgm().CommonSettings()->Read( USE_ICONS_IN_MENUS_KEY, &useImagesInMenus ); if( useImagesInMenus ) { if( aType == wxITEM_CHECK || aType == wxITEM_RADIO ) { #if defined( __WINDOWS__ ) item->SetBitmaps( KiBitmap( checked_ok_xpm ), aImage ); // A workaround to a strange bug on Windows, wx Widgets 3.0: // size of bitmaps is not taken in account for wxITEM_{CHECK,RADIO} menu // unless we call SetFont item->SetFont( *wxNORMAL_FONT ); #endif } else if( aType != wxITEM_RADIO ) { item->SetBitmap( aImage ); } } aMenu->Append( item ); return item; }
int OnRun() // overload wxApp virtual { int ret = -1; try { ret = wxApp::OnRun(); } catch( const std::exception& e ) { wxLogError( wxT( "Unhandled exception class: %s what: %s" ), GetChars( FROM_UTF8( typeid(e).name() )), GetChars( FROM_UTF8( e.what() ) ) );; } catch( const IO_ERROR& ioe ) { wxLogError( GetChars( ioe.errorText ) ); } catch(...) { wxLogError( wxT( "Unhandled exception of unknown type" ) ); } Pgm().OnPgmExit(); return ret; }
void EDA_DRAW_FRAME::CommonSettingsChanged() { EDA_BASE_FRAME::CommonSettingsChanged(); wxConfigBase* settings = Pgm().CommonSettings(); int autosaveInterval; settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); SetAutoSaveInterval( autosaveInterval ); int historySize; settings->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE ); Kiface().GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) ); bool option; settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option ); m_canvas->SetEnableMousewheelPan( option ); settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option ); m_canvas->SetEnableZoomNoCenter( option ); settings->Read( ENBL_AUTO_PAN_KEY, &option ); m_canvas->SetEnableAutoPan( option ); m_galDisplayOptions.ReadCommonConfig( *settings, this ); }
// Creates the header section static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame ) { wxString msg; BOARD *board = aFrame->GetBoard(); fputs( "$HEADER\n", aFile ); fputs( "GENCAD 1.4\n", aFile ); // Please note: GenCAD syntax requires quoted strings if they can contain spaces msg.Printf( wxT( "USER \"%s %s\"\n" ), GetChars( Pgm().App().GetAppName() ), GetChars( GetBuildVersion() ) ); fputs( TO_UTF8( msg ), aFile ); msg = wxT( "DRAWING \"" ) + board->GetFileName() + wxT( "\"\n" ); fputs( TO_UTF8( msg ), aFile ); const TITLE_BLOCK& tb = aFrame->GetTitleBlock(); msg = wxT( "REVISION \"" ) + tb.GetRevision() + wxT( " " ) + tb.GetDate() + wxT( "\"\n" ); fputs( TO_UTF8( msg ), aFile ); fputs( "UNITS INCH\n", aFile ); msg.Printf( wxT( "ORIGIN %g %g\n" ), MapXTo( aFrame->GetAuxOrigin().x ), MapYTo( aFrame->GetAuxOrigin().y ) ); fputs( TO_UTF8( msg ), aFile ); fputs( "INTERTRACK 0\n", aFile ); fputs( "$ENDHEADER\n\n", aFile ); return true; }
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( aParent, id, title, pos, size, style, name ), KIWAY_HOLDER( 0 ), m_qmodal_loop( 0 ), m_qmodal_showing( false ), m_qmodal_parent_disabler( 0 ) { // pray that aParent is either a KIWAY_PLAYER or DIALOG_SHIM derivation. KIWAY_HOLDER* h = dynamic_cast<KIWAY_HOLDER*>( aParent ); // wxASSERT_MSG( h, wxT( "DIALOG_SHIM's parent is NULL or not derived from KIWAY_PLAYER nor DIALOG_SHIM" ) ); if( h ) SetKiway( this, &h->Kiway() ); #ifdef __WINDOWS__ // On Windows, the app top windows can be brought to the foreground // (at least temporary) in certain circumstances, // for instance when calling an external tool in Eeschema boom generation. // So set the parent KIWAY_PLAYER kicad frame (if exists) to top window // to avoid this annoying behavior KIWAY_PLAYER* parent_kiwayplayer = dynamic_cast<KIWAY_PLAYER*>( aParent ); if( parent_kiwayplayer ) Pgm().App().SetTopWindow( parent_kiwayplayer ); #endif #if DLGSHIM_USE_SETFOCUS Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHIM::onInit ) ); #endif }
void KICAD_MANAGER_FRAME::OnOpenTextEditor( wxCommandEvent& event ) { wxString editorname = Pgm().GetEditorName(); if( !editorname.IsEmpty() ) Execute( this, editorname, wxEmptyString ); }
void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event ) { if( Kiway.PlayersClose( false ) ) { int px, py; UpdateFileHistory( GetProjectFileName(), &Pgm().GetFileHistory() ); if( !IsIconized() ) // save main frame position and size { GetPosition( &px, &py ); m_FramePos.x = px; m_FramePos.y = py; GetSize( &px, &py ); m_FrameSize.x = px; m_FrameSize.y = py; } Event.SetCanVeto( true ); m_LeftWin->Show( false ); Destroy(); } }
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param, wxProcess *callback ) { wxString fullFileName; fullFileName = FindKicadFile( ExecFile ); #ifdef __WXMAC__ if( wxFileExists( fullFileName ) || wxDir::Exists( fullFileName ) ) { return ProcessExecute( Pgm().GetExecutablePath() + wxT( "/" ) + ExecFile + wxT( " " ) + param, wxEXEC_ASYNC, callback ); } else { return ProcessExecute( wxT( "/usr/bin/open " ) + param, wxEXEC_ASYNC, callback ); } #else if( wxFileExists( fullFileName ) ) { if( !param.IsEmpty() ) fullFileName += wxT( " " ) + param; return ProcessExecute( fullFileName, wxEXEC_ASYNC, callback ); } #endif wxString msg; msg.Printf( _( "Command <%s> could not found" ), GetChars( fullFileName ) ); DisplayError( frame, msg, 20 ); return -1; }
int OnRun() // overload wxApp virtual { int ret = -1; try { ret = wxApp::OnRun(); } catch( const std::exception& e ) { wxLogError( wxT( "Unhandled exception class: %s what: %s" ), GetChars( FROM_UTF8( typeid(e).name() )), GetChars( FROM_UTF8( e.what() ) ) ); } catch( const IO_ERROR& ioe ) { wxLogError( GetChars( ioe.errorText ) ); } catch(...) { wxLogError( wxT( "Unhandled exception of unknown type" ) ); } // Works properly when wxPython scripting is disabled. #if !defined( KICAD_SCRIPTING_WXPYTHON ) Pgm().OnPgmExit(); #endif return ret; }
WIZARD_FPLIB_TABLE::WIZARD_FPLIB_TABLE( wxWindow* aParent ) : WIZARD_FPLIB_TABLE_BASE( aParent ), m_welcomeDlg( m_pages[0] ), m_fileSelectDlg( m_pages[1] ), m_githubListDlg( m_pages[2] ), m_reviewDlg( m_pages[3] ), m_targetDlg( m_pages[4] ), m_selectedFilter( 0 ) { m_filePicker->SetFilter( getFilterString() ); // Initialize default download dir wxString default_path; wxGetEnv( FP_LIB_TABLE::GlobalPathEnvVariableName(), &default_path ); setDownloadDir( default_path ); m_filePicker->SetPath( default_path ); // Restore the Github url wxString githubUrl; wxConfigBase* cfg = Pgm().CommonSettings(); cfg->Read( KICAD_FPLIBS_URL_KEY, &githubUrl ); cfg->Read( KICAD_FPLIBS_LAST_DOWNLOAD_DIR, &m_lastGithubDownloadDirectory ); if( !m_lastGithubDownloadDirectory.IsEmpty() ) { setDownloadDir( m_lastGithubDownloadDirectory ); m_filePicker->SetPath( m_lastGithubDownloadDirectory ); } else { m_lastGithubDownloadDirectory = default_path; } if( githubUrl.IsEmpty() ) githubUrl = wxT( "https://github.com/KiCad" ); SetGithubURL( githubUrl ); // Give the minimal size to the dialog, which allows displaying any page wxSize minsize; for( unsigned ii = 0; ii < m_pages.size(); ii++ ) { wxSize size = m_pages[ii]->GetSizer()->CalcMin(); minsize.x = std::max( minsize.x, size.x ); minsize.y = std::max( minsize.y, size.y ); } SetMinSize( minsize ); SetPageSize( minsize ); GetSizer()->SetSizeHints( this ); Center(); if( !m_radioAddGithub->GetValue() && !m_radioAddLocal->GetValue() ) m_radioAddLocal->SetValue( true ); setupDialogOrder(); updateGithubControls(); Connect( wxEVT_RADIOBUTTON, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnSourceCheck ), NULL, this ); Connect( wxEVT_DIRCTRL_SELECTIONCHANGED, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnSelectFiles ), NULL, this ); Connect( wxEVT_CHECKLISTBOX, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnCheckGithubList ), NULL, this ); }
wxString FindKicadFile( const wxString& shortname ) { // Test the presence of the file in the directory shortname of // the KiCad binary path. wxString fullFileName = Pgm().GetExecutablePath() + shortname; if( wxFileExists( fullFileName ) ) return fullFileName; // Test the presence of the file in the directory shortname // defined by the environment variable KiCad. if( Pgm().IsKicadEnvVariableDefined() ) { fullFileName = Pgm().GetKicadEnvVariable() + shortname; if( wxFileExists( fullFileName ) ) return fullFileName; } // find binary file from possibilities list: // /usr/local/kicad/linux or c:/kicad/winexe // Path list for KiCad binary files const static wxChar* possibilities[] = { #ifdef __WINDOWS__ wxT( "c:/kicad/bin/" ), wxT( "d:/kicad/bin/" ), wxT( "c:/Program Files/kicad/bin/" ), wxT( "d:/Program Files/kicad/bin/" ), #else wxT( "/usr/bin/" ), wxT( "/usr/local/bin/" ), wxT( "/usr/local/kicad/bin/" ), #endif }; for( unsigned i=0; i<DIM(possibilities); ++i ) { fullFileName = possibilities[i] + shortname; if( wxFileExists( fullFileName ) ) return fullFileName; } return shortname; }
int OnExit() // overload wxApp virtual { // Kiways.OnEnd(); Pgm().OnPgmExit(); return wxApp::OnExit(); }
bool OnInit() // overload wxApp virtual { // if( Kiways.OnStart( this ) ) { return Pgm().OnPgmInit( this ); } return false; }
int OnExit() // overload wxApp virtual { // Fixes segfault when wxPython scripting is enabled. #if defined( KICAD_SCRIPTING_WXPYTHON ) Pgm().OnPgmExit(); #endif return wxApp::OnExit(); }
void KICAD_MANAGER_FRAME::TERMINATE_HANDLER::OnTerminate( int pid, int status ) { wxString msg = wxString::Format( _( "%s closed [pid=%d]\n" ), GetChars( appName ), pid ); ( (KICAD_MANAGER_FRAME*) Pgm().App().GetTopWindow() )->PrintMsg( msg ); delete this; }
WIZARD_FPLIB_TABLE::~WIZARD_FPLIB_TABLE() { // Use this if you want to store kicad lib URL in pcbnew/cvpcb section config: // wxConfigBase* cfg = Kiface().KifaceSettings(); // Use this if you want to store kicad lib URL in common section config: wxConfigBase* cfg = Pgm().CommonSettings(); cfg->Write( KICAD_FPLIBS_URL_KEY, GetGithubURL() ); }
void KICAD_MANAGER_FRAME::OnSaveProject( wxCommandEvent& event ) { if( !wxIsWritable( GetProjectFileName() ) ) return; // was: wxGetApp().WriteProjectConfig( m_ProjectFileName.GetFullPath(), // GeneralGroupName, s_KicadManagerParams ); Prj().ConfigSave( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams ); }
void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event ) { // show all files in file dialog (in Kicad all files are editable texts): wxString wildcard = AllFilesWildcard(); wxString default_dir = Prj().GetProjectPath(); wxFileDialog dlg( this, _( "Load File to Edit" ), default_dir, wxEmptyString, wildcard, wxFD_OPEN ); if( dlg.ShowModal() == wxID_CANCEL ) return; wxString filename = wxT( "\"" ); filename += dlg.GetPath() + wxT( "\"" ); if( !dlg.GetPath().IsEmpty() && !Pgm().GetEditorName().IsEmpty() ) Execute( this, Pgm().GetEditorName(), filename ); }