diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 7871e4127b..385dc88cab 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -1,7 +1,3 @@ -/** - * @file dialog_gendrill.cpp - */ - /* * This program source code file is part of KiCad, a free EDA CAD application. * @@ -35,15 +31,13 @@ #include #include #include - +#include #include #include #include - #include #include #include - #include @@ -67,11 +61,11 @@ static DRILL_PRECISION precisionListForMetric( 3, 3 ); /* This function displays the dialog frame for drill tools */ -void PCB_EDIT_FRAME::InstallDrillFrame( wxCommandEvent& event ) +int PCB_EDITOR_CONTROL::GenerateDrillFiles( const TOOL_EVENT& aEvent ) { - DIALOG_GENDRILL dlg( this, this ); - + DIALOG_GENDRILL dlg( frame(), frame() ); dlg.ShowModal(); + return 0; } diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 6f5e0f0d4a..a967883264 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -1,12 +1,7 @@ - -/** - * @file pcbnew/dialogs/dialog_netlist.cpp - */ - /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2017 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -150,6 +145,7 @@ void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event ) void DIALOG_NETLIST::OnUpdatePCB( wxCommandEvent& event ) { + BOARD* pcb = m_parent->GetBoard(); wxFileName fn = m_NetlistFilenameCtrl->GetValue(); if( !fn.IsOk() ) @@ -165,8 +161,8 @@ void DIALOG_NETLIST::OnUpdatePCB( wxCommandEvent& event ) } // Give the user a chance to bail out when making changes from a netlist. - if( m_parent->GetBoard()->IsEmpty() - || IsOK( this, _( "The changes made cannot be undone. Are you sure you want to update the PCB?" ) ) ) + if( pcb->IsEmpty() || IsOK( this, _( "The changes made cannot be undone. " + "Are you sure you want to update the PCB?" ) ) ) { m_MessageWindow->SetLabel( _( "Changes Applied To PCB" ) ); loadNetlist( false ); diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 54f41ecb81..09ecdbfc06 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -111,10 +111,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } break; - case ID_GET_NETLIST: - InstallNetlistFrame(); - break; - case ID_TOOLBARH_PCB_SELECT_LAYER: SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) ); diff --git a/pcbnew/exporters/gen_footprints_placefile.cpp b/pcbnew/exporters/gen_footprints_placefile.cpp index 5369abd180..faacefd14b 100644 --- a/pcbnew/exporters/gen_footprints_placefile.cpp +++ b/pcbnew/exporters/gen_footprints_placefile.cpp @@ -1,10 +1,7 @@ -/** - * @file gen_modules_placefile.cpp - */ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2015-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -39,17 +36,15 @@ #include #include #include - +#include #include #include - #include #include #include #include - - #include + /* * The ASCII format of the kicad place file is: * ### Module positions - created on 04/12/2012 15:24:24 ### @@ -410,10 +405,11 @@ static bool HasNonSMDPins( MODULE* aModule ) return false; } -void PCB_EDIT_FRAME::GenFootprintsPositionFile( wxCommandEvent& event ) +int PCB_EDITOR_CONTROL::GeneratePosFile( const TOOL_EVENT& aEvent ) { - DIALOG_GEN_FOOTPRINT_POSITION dlg( this ); + DIALOG_GEN_FOOTPRINT_POSITION dlg( frame() ); dlg.ShowModal(); + return 0; } /* @@ -424,10 +420,8 @@ void PCB_EDIT_FRAME::GenFootprintsPositionFile( wxCommandEvent& event ) * if aFullFileName is empty, the file is not created, only the * count of footprints to place is returned */ -int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, - bool aUnitsMM, - bool aForceSmdItems, int aSide, - bool aFormatCSV ) +int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM, + bool aForceSmdItems, int aSide, bool aFormatCSV ) { // Minimal text lengths: int lenRefText = 8; @@ -476,8 +470,8 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, } else { - DBG(printf( "skipping %s because its attribute is not CMS and it has non SMD pins\n", - TO_UTF8(footprint->GetReference()) ) ); + DBG( printf( "skipping %s because it is not marked CMS and has non-SMD pins\n", + TO_UTF8( footprint->GetReference() ) ) ); continue; } } @@ -503,6 +497,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, return footprintCount; FILE * file = wxFopen( aFullFileName, wxT( "wt" ) ); + if( file == NULL ) return -1; diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 09253188c0..ea1ecbce81 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -76,9 +76,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() Kiface().GetFileHistory().UseMenu( openRecentMenu ); Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu ); - fileMenu->AddItem( ACTIONS::doNew, SELECTION_CONDITIONS::ShowAlways ); - fileMenu->AddItem( ACTIONS::open, SELECTION_CONDITIONS::ShowAlways ); - fileMenu->AddMenu( openRecentMenu, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddItem( ACTIONS::doNew, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddItem( ACTIONS::open, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddMenu( openRecentMenu, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddItem( PCB_ACTIONS::appendBoard, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddItem( ID_IMPORT_NON_KICAD_BOARD, @@ -89,22 +89,22 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() fileMenu->AddSeparator(); } - fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition ); + fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition ); // Save as menu: // under a project mgr we do not want to modify the board filename // to keep consistency with the project mgr which expects files names same as prj name // for main files if( Kiface().IsSingle() ) - fileMenu->AddItem( ACTIONS::saveAs, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddItem( ACTIONS::saveAs, SELECTION_CONDITIONS::ShowAlways ); else - fileMenu->AddItem( ACTIONS::saveCopyAs, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddItem( ACTIONS::saveCopyAs, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); fileMenu->AddItem( ID_MENU_RECOVER_BOARD_AUTOSAVE, _( "Resc&ue" ), _( "Clear board and get last rescue file automatically saved by Pcbnew" ), - rescue_xpm, SELECTION_CONDITIONS::ShowAlways ); + rescue_xpm, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddItem( ID_MENU_READ_BOARD_BACKUP_FILE, _( "Revert to Last Backup" ), @@ -117,10 +117,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() submenuImport->SetTitle( _( "Import" ) ); submenuImport->SetIcon( import_xpm ); - submenuImport->Add( _( "Netlist..." ), _( "Read netlist and update board connectivity" ), - ID_GET_NETLIST, netlist_xpm ); - submenuImport->Add( _( "Specctra Session..." ), _( "Import routed Specctra session (*.ses) file" ), - ID_GEN_IMPORT_SPECCTRA_SESSION, import_xpm ); + submenuImport->Add( PCB_ACTIONS::importNetlist ); + submenuImport->Add( PCB_ACTIONS::importSpecctraSession ); submenuImport->Add( _( "Graphics..." ), _( "Import 2D drawing file" ), ID_GEN_IMPORT_GRAPHICS_FILE, import_vector_xpm ); @@ -133,8 +131,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() submenuExport->SetTitle( _( "Export" ) ); submenuExport->SetIcon( export_xpm ); - submenuExport->Add( _( "Specctra DSN..." ), _( "Export Specctra DSN routing info" ), - ID_GEN_EXPORT_SPECCTRA, export_dsn_xpm ); + submenuExport->Add( PCB_ACTIONS::exportSpecctraDSN ); submenuExport->Add( _( "GenCAD..." ), _( "Export GenCAD board representation" ), ID_GEN_EXPORT_FILE_GENCADFORMAT, export_xpm ); submenuExport->Add( _( "VRML..." ), _( "Export VRML 3D board representation" ), @@ -159,37 +156,22 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() submenuFabOutputs->SetTitle( _( "Fabrication Outputs" ) ); submenuFabOutputs->SetIcon( fabrication_xpm ); - submenuFabOutputs->Add( _( "&Gerbers (.gbr)..." ), - _( "Generate Gerbers for fabrication" ), - ID_GEN_PLOT_GERBER, post_compo_xpm ); - submenuFabOutputs->Add( _( "&Drill Files (.drl)..." ), - _( "Generate Excellon drill file(s)" ), - ID_PCB_GEN_DRILL_FILE, post_drill_xpm ); - submenuFabOutputs->Add( _( "Footprint &Positions (.pos)..." ), - _( "Generate footprint position file for pick and place" ), - ID_PCB_GEN_POS_MODULES_FILE, post_compo_xpm ); - submenuFabOutputs->Add( _( "&Footprint Report (.rpt)..." ), - _( "Create report of all footprints from current board" ), - ID_GEN_EXPORT_FILE_MODULE_REPORT, tools_xpm ); - submenuFabOutputs->Add( _( "IPC-D-356 Netlist File..." ), - _( "Generate IPC-D-356 netlist file" ), - ID_PCB_GEN_D356_FILE, netlist_xpm ); - submenuFabOutputs->Add( _( "&BOM..." ), - _( "Create bill of materials from current schematic" ), - ID_PCB_GEN_BOM_FILE_FROM_BOARD, bom_xpm ); + submenuFabOutputs->Add( PCB_ACTIONS::generateGerbers ); + submenuFabOutputs->Add( PCB_ACTIONS::generateDrillFiles ); + submenuFabOutputs->Add( PCB_ACTIONS::generatePosFile ); + submenuFabOutputs->Add( PCB_ACTIONS::generateReportFile ); + submenuFabOutputs->Add( PCB_ACTIONS::generateD356File ); + submenuFabOutputs->Add( PCB_ACTIONS::generateBOM ); - fileMenu->AddMenu( submenuFabOutputs, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddMenu( submenuFabOutputs, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); - fileMenu->AddItem( ID_BOARD_SETUP_DIALOG, - _( "&Board Setup..." ), - _( "Edit board setup including layers, design rules and various defaults" ), - options_board_xpm, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddItem( PCB_ACTIONS::boardSetup, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); - fileMenu->AddItem( ACTIONS::pageSettings, SELECTION_CONDITIONS::ShowAlways ); - fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways ); - fileMenu->AddItem( ACTIONS::plot, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddItem( ACTIONS::pageSettings, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddItem( ACTIONS::plot, SELECTION_CONDITIONS::ShowAlways ); // Archive submenu ACTION_MENU* submenuArchive = new ACTION_MENU(); @@ -208,7 +190,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES, library_archive_as_xpm ); fileMenu->AddSeparator(); - fileMenu->AddMenu( submenuArchive, SELECTION_CONDITIONS::ShowAlways ); + fileMenu->AddMenu( submenuArchive, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); // Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT @@ -230,33 +212,33 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() return GetToolId() == ID_NO_TOOL_SELECTED; }; - editMenu->AddItem( ACTIONS::undo, enableUndoCondition ); - editMenu->AddItem( ACTIONS::redo, enableRedoCondition ); + editMenu->AddItem( ACTIONS::undo, enableUndoCondition ); + editMenu->AddItem( ACTIONS::redo, enableRedoCondition ); editMenu->AddSeparator(); - editMenu->AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty ); - editMenu->AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty ); - editMenu->AddItem( ACTIONS::paste, noActiveToolCondition ); + editMenu->AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty ); + editMenu->AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty ); + editMenu->AddItem( ACTIONS::paste, noActiveToolCondition ); editMenu->AddSeparator(); - editMenu->AddItem( PCB_ACTIONS::deleteTool, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::deleteTool, SELECTION_CONDITIONS::ShowAlways ); editMenu->AddSeparator(); - editMenu->AddItem( ACTIONS::find, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( ACTIONS::find, SELECTION_CONDITIONS::ShowAlways ); editMenu->AddSeparator(); - editMenu->AddItem( PCB_ACTIONS::editTracksAndVias, SELECTION_CONDITIONS::ShowAlways ); - editMenu->AddItem( PCB_ACTIONS::editTextAndGraphics, SELECTION_CONDITIONS::ShowAlways ); - editMenu->AddItem( PCB_ACTIONS::changeFootprints, SELECTION_CONDITIONS::ShowAlways ); - editMenu->AddItem( PCB_ACTIONS::swapLayers, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::editTracksAndVias, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::editTextAndGraphics, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::changeFootprints, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::swapLayers, SELECTION_CONDITIONS::ShowAlways ); editMenu->AddSeparator(); - editMenu->AddItem( PCB_ACTIONS::zoneFillAll, SELECTION_CONDITIONS::ShowAlways ); - editMenu->AddItem( PCB_ACTIONS::zoneUnfillAll, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::zoneFillAll, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::zoneUnfillAll, SELECTION_CONDITIONS::ShowAlways ); editMenu->AddSeparator(); - editMenu->AddItem( PCB_ACTIONS::globalDeletions, SELECTION_CONDITIONS::ShowAlways ); - editMenu->AddItem( PCB_ACTIONS::cleanupTracksAndVias, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::globalDeletions, SELECTION_CONDITIONS::ShowAlways ); + editMenu->AddItem( PCB_ACTIONS::cleanupTracksAndVias, SELECTION_CONDITIONS::ShowAlways ); editMenu->Resolve(); @@ -343,15 +325,15 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool ); unitsSubMenu->SetTitle( _( "&Units" ) ); unitsSubMenu->SetIcon( unit_mm_xpm ); - unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition ); - unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition ); + unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition ); + unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition ); viewMenu->AddMenu( unitsSubMenu ); - viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition ); + viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition ); viewMenu->AddSeparator(); - viewMenu->AddCheckItem( PCB_ACTIONS::showRatsnest, ratsnestShownCondition ); - viewMenu->AddCheckItem( PCB_ACTIONS::ratsnestLineMode, curvedRatsnestCondition ); + viewMenu->AddCheckItem( PCB_ACTIONS::showRatsnest, ratsnestShownCondition ); + viewMenu->AddCheckItem( PCB_ACTIONS::ratsnestLineMode, curvedRatsnestCondition ); viewMenu->AddSeparator(); // Drawing Mode Submenu @@ -374,12 +356,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) ); contrastModeSubMenu->SetIcon( contrast_mode_xpm ); - contrastModeSubMenu->AddCheckItem( ACTIONS::highContrastMode, contrastModeCondition ); + contrastModeSubMenu->AddCheckItem( ACTIONS::highContrastMode, contrastModeCondition ); contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways ); contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways ); viewMenu->AddMenu( contrastModeSubMenu ); - viewMenu->AddCheckItem( PCB_ACTIONS::flipBoard, boardFlippedCondition ); + viewMenu->AddCheckItem( PCB_ACTIONS::flipBoard, boardFlippedCondition ); #ifdef __APPLE__ viewMenu->AppendSeparator(); @@ -391,25 +373,25 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() // CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool ); - placeMenu->AddItem( PCB_ACTIONS::placeModule, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( PCB_ACTIONS::drawVia, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( PCB_ACTIONS::drawZone, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( PCB_ACTIONS::drawZoneKeepout, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( PCB_ACTIONS::placeText, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( PCB_ACTIONS::drawArc, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( PCB_ACTIONS::drawCircle, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( PCB_ACTIONS::drawLine, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( PCB_ACTIONS::drawPolygon, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::placeModule, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawVia, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawZone, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawZoneKeepout, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::placeText, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawArc, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawCircle, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawLine, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawPolygon, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddSeparator(); - placeMenu->AddItem( PCB_ACTIONS::drawDimension, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawDimension, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddSeparator(); - placeMenu->AddItem( PCB_ACTIONS::placeTarget, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::placeTarget, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddSeparator(); - placeMenu->AddItem( PCB_ACTIONS::drillOrigin, SELECTION_CONDITIONS::ShowAlways ); - placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drillOrigin, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddSeparator(); @@ -484,7 +466,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() submenuActionPlugins->AppendSeparator(); toolsMenu->AddSeparator(); - toolsMenu->AddMenu( submenuActionPlugins, SELECTION_CONDITIONS::ShowAlways ); + toolsMenu->AddMenu( submenuActionPlugins, SELECTION_CONDITIONS::ShowAlways ); #endif toolsMenu->Resolve(); @@ -500,19 +482,19 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; }; - prefsMenu->AddItem( ACTIONS::configurePaths, SELECTION_CONDITIONS::ShowAlways ); - prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways ); + prefsMenu->AddItem( ACTIONS::configurePaths, SELECTION_CONDITIONS::ShowAlways ); + prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways ); #ifdef BUILD_GITHUB_PLUGIN prefsMenu->AddItem( ID_PCB_3DSHAPELIB_WIZARD, _( "Add &3D Shapes Libraries Wizard..." ), _( "Download 3D shape libraries from GitHub" ), - import3d_xpm, SELECTION_CONDITIONS::ShowAlways ); + import3d_xpm, SELECTION_CONDITIONS::ShowAlways ); #endif prefsMenu->AddItem( wxID_PREFERENCES, AddHotkeyName( _( "Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), - preference_xpm, SELECTION_CONDITIONS::ShowAlways ); + preference_xpm, SELECTION_CONDITIONS::ShowAlways ); prefsMenu->AddSeparator(); Pgm().AddMenuLanguageList( prefsMenu ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 362d15f67d..8b8ec2d6b8 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -127,20 +127,12 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_IMPORT_NON_KICAD_BOARD, PCB_EDIT_FRAME::Files_io ) EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PCB_EDIT_FRAME::OnFileHistory ) - EVT_MENU( ID_GEN_PLOT, PCB_EDIT_FRAME::ToPlotter ) - EVT_MENU( ID_GEN_PLOT_GERBER, PCB_EDIT_FRAME::ToPlotter ) - - EVT_MENU( ID_GEN_EXPORT_SPECCTRA, PCB_EDIT_FRAME::ExportToSpecctra ) EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, PCB_EDIT_FRAME::ExportToGenCAD ) - EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, PCB_EDIT_FRAME::GenFootprintsReport ) EVT_MENU( ID_GEN_EXPORT_FILE_VRML, PCB_EDIT_FRAME::OnExportVRML ) EVT_MENU( ID_GEN_EXPORT_FILE_IDF3, PCB_EDIT_FRAME::OnExportIDF3 ) EVT_MENU( ID_GEN_EXPORT_FILE_STEP, PCB_EDIT_FRAME::OnExportSTEP ) EVT_MENU( ID_GEN_EXPORT_FILE_HYPERLYNX, PCB_EDIT_FRAME::OnExportHyperlynx ) - EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,PCB_EDIT_FRAME::ImportSpecctraSession ) - EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN, PCB_EDIT_FRAME::ImportSpecctraDesign ) - EVT_MENU( ID_MENU_ARCHIVE_MODULES_IN_LIBRARY, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES, PCB_EDIT_FRAME::Process_Special_Functions ) @@ -153,19 +145,11 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_GRID_SETTINGS, PCB_EDIT_FRAME::OnGridSettings ) // menu Postprocess - EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, PCB_EDIT_FRAME::GenFootprintsPositionFile ) - EVT_MENU( ID_PCB_GEN_DRILL_FILE, PCB_EDIT_FRAME::InstallDrillFrame ) - EVT_MENU( ID_PCB_GEN_D356_FILE, PCB_EDIT_FRAME::GenD356File ) EVT_MENU( ID_PCB_GEN_CMP_FILE, PCB_EDIT_FRAME::RecreateCmpFileFromBoard ) - EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, PCB_EDIT_FRAME::RecreateBOMFileFromBoard ) - - // Menu Get Design Rules Editor - EVT_MENU( ID_BOARD_SETUP_DIALOG, PCB_EDIT_FRAME::ShowBoardSetupDialog ) // Horizontal toolbar EVT_TOOL( ID_RUN_LIBRARY, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_GEN_PLOT_SVG, PCB_EDIT_FRAME::ExportSVG ) - EVT_TOOL( ID_GET_NETLIST, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::Process_Special_Functions ) @@ -569,12 +553,6 @@ void PCB_EDIT_FRAME::ActivateGalCanvas() } -void PCB_EDIT_FRAME::ShowBoardSetupDialog( wxCommandEvent& event ) -{ - DoShowBoardSetupDialog(); -} - - void PCB_EDIT_FRAME::DoShowBoardSetupDialog( const wxString& aInitialPage, const wxString& aInitialParentPage ) { @@ -917,20 +895,20 @@ void PCB_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) } -void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event ) +void PCB_EDIT_FRAME::ToPlotter( int aID ) { PCB_PLOT_PARAMS plotSettings = GetPlotSettings(); - switch( event.GetId() ) + switch( aID ) { case ID_GEN_PLOT_GERBER: plotSettings.SetFormat( PLOT_FORMAT_GERBER ); break; case ID_GEN_PLOT_DXF: plotSettings.SetFormat( PLOT_FORMAT_DXF ); break; case ID_GEN_PLOT_HPGL: plotSettings.SetFormat( PLOT_FORMAT_HPGL ); break; case ID_GEN_PLOT_PDF: plotSettings.SetFormat( PLOT_FORMAT_PDF ); break; case ID_GEN_PLOT_PS: plotSettings.SetFormat( PLOT_FORMAT_POST ); break; - case ID_GEN_PLOT_SVG: wxFAIL_MSG( "Must be handled by ExportSVG()" ); break; - case ID_GEN_PLOT: - default: // called with no specified plot type: keep the previous setup + case ID_GEN_PLOT: /* keep the previous setup */ break; + default: + wxFAIL_MSG( "ToPlotter(): unexpected plot type" ); break; break; } diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 8d7a016e68..0a47331cf0 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -288,7 +288,7 @@ public: * Function ToPlotter * Open a dialog frame to create plot and drill files relative to the current board. */ - void ToPlotter( wxCommandEvent& event ); + void ToPlotter( int aID ); /** * Function SVG_Print @@ -561,14 +561,6 @@ public: void PrepareLayerIndicator(); void OnSelectOptionToolbar( wxCommandEvent& event ); - void OnFlipPcbView( wxCommandEvent& event ); - - /** - * Function GenFootprintsPositionFile - * Calls DoGenFootprintsPositionFile to create a footprint position file - * See DoGenFootprintsPositionFile for options and file format - */ - void GenFootprintsPositionFile( wxCommandEvent& event ); /** * Function DoGenFootprintsPositionFile @@ -604,7 +596,6 @@ public: */ bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM ); - void InstallDrillFrame( wxCommandEvent& event ); void GenD356File( wxCommandEvent& event ); void OnFileHistory( wxCommandEvent& event ); @@ -801,13 +792,6 @@ public: */ void OnExportSTEP( wxCommandEvent& event ); - /** - * Function ExporttoSPECCTRA - * Ask for a filename and call ExportSpecctraFile to export the current BOARD - * to a specctra dsn file. - */ - void ExportToSpecctra( wxCommandEvent& event ); - /** * Function ExportSpecctraFile * will export the current BOARD to a specctra dsn file. @@ -817,15 +801,6 @@ public: */ bool ExportSpecctraFile( const wxString& aFullFilename ); - /** - * Function ImportSpecctraSession - * will import a specctra *.ses file and use it to relocate MODULEs and - * to replace all vias and tracks in an existing and loaded BOARD. - * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the - * specification. - */ - void ImportSpecctraSession( wxCommandEvent& event ); - /** * Function ImportSpecctraSession * will import a specctra *.ses file and use it to relocate MODULEs and @@ -835,18 +810,6 @@ public: */ bool ImportSpecctraSession( const wxString& aFullFilename ); - /** - * Function ImportSpecctraDesign - * will import a specctra *.dsn file and use it to replace an entire BOARD. - * The new board will not have any graphics, only components, tracks and - * vias. - * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the - * specification. - */ - void ImportSpecctraDesign( wxCommandEvent& event ); - - void Swap_Layers( wxCommandEvent& event ); - // Footprint editing (see also PCB_BASE_FRAME) void InstallFootprintPropertiesDialog( MODULE* Module ); diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index f56120f863..a7c5361342 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -109,11 +109,7 @@ enum pcbnew_ids ID_GEN_EXPORT_FILE_VRML, ID_GEN_EXPORT_FILE_STEP, ID_GEN_EXPORT_FILE_HYPERLYNX, - ID_GEN_EXPORT_SPECCTRA, ID_GEN_EXPORT_FILE_GENCADFORMAT, - ID_GEN_EXPORT_FILE_MODULE_REPORT, - ID_GEN_IMPORT_SPECCTRA_SESSION, - ID_GEN_IMPORT_SPECCTRA_DESIGN, ID_GEN_IMPORT_GRAPHICS_FILE, ID_TOOLBARH_PCB_ACTION_PLUGIN, @@ -121,14 +117,9 @@ enum pcbnew_ids ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, - ID_PCB_GEN_POS_MODULES_FILE, - ID_PCB_GEN_DRILL_FILE, - ID_PCB_GEN_D356_FILE, - ID_PCB_GEN_CMP_FILE, ID_PCB_GEN_BOM_FILE_FROM_BOARD, ID_PCB_3DSHAPELIB_WIZARD, - ID_BOARD_SETUP_DIALOG, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, diff --git a/pcbnew/specctra_import_export/specctra.h b/pcbnew/specctra_import_export/specctra.h index 1d2a60f586..6242863185 100644 --- a/pcbnew/specctra_import_export/specctra.h +++ b/pcbnew/specctra_import_export/specctra.h @@ -3935,12 +3935,10 @@ public: /** * Function FromBOARD - * adds the entire BOARD to the PCB but does not write it out. Note that - * the BOARD given to this function must have all the MODULEs on the component - * side of the BOARD. + * adds the entire BOARD to the PCB but does not write it out. Note that the BOARD given + * to this function must have all the MODULEs on the component side of the BOARD. * - * See void PCB_EDIT_FRAME::ExportToSpecctra( wxCommandEvent& event ) - * for how this can be done before calling this function. + * See PCB_EDIT_FRAME::ExportToSpecctra() for an example before calling this function. * * @param aBoard The BOARD to convert to a PCB. */ @@ -3948,9 +3946,9 @@ public: /** * Function FromSESSION - * adds the entire SESSION info to a BOARD but does not write it out. The - * the BOARD given to this function will have all its tracks and via's replaced, - * and all its components are subject to being moved. + * adds the entire SESSION info to a BOARD but does not write it out. The BOARD given to + * this function will have all its tracks and via's replaced, and all its components are + * subject to being moved. * * @param aBoard The BOARD to merge the SESSION information into. */ diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index bb5e98f4da..0f42a7d9ad 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -82,32 +82,6 @@ using namespace DSN; static const double safetyMargin = 0.1; -// see pcb_edit_frame.h -void PCB_EDIT_FRAME::ExportToSpecctra( wxCommandEvent& event ) -{ - wxString fullFileName; - wxString dsn_ext = SpecctraDsnFileExtension; - wxString mask = SpecctraDsnFileWildcard(); - wxFileName fn( GetBoard()->GetFileName() ); - - fn.SetExt( dsn_ext ); - - fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN File" ), - fn.GetPath(), - fn.GetFullName(), - dsn_ext, - mask, - this, - wxFD_SAVE | wxFD_OVERWRITE_PROMPT, - false ); - - if( fullFileName == wxEmptyString ) - return; - - ExportSpecctraFile( fullFileName ); -} - - bool PCB_EDIT_FRAME::ExportSpecctraFile( const wxString& aFullFilename ) { SPECCTRA_DB db; diff --git a/pcbnew/specctra_import_export/specctra_import.cpp b/pcbnew/specctra_import_export/specctra_import.cpp index 515b4c454a..0d7cb27a7c 100644 --- a/pcbnew/specctra_import_export/specctra_import.cpp +++ b/pcbnew/specctra_import_export/specctra_import.cpp @@ -44,52 +44,10 @@ #include #include #include - #include "specctra.h" - using namespace DSN; -void PCB_EDIT_FRAME::ImportSpecctraDesign( wxCommandEvent& event ) -{ - /* @todo write this someday - - if( !Clear_Pcb( true ) ) - return; - */ -} - - -void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event ) -{ - wxString fullFileName = GetBoard()->GetFileName(); - wxString path; - wxString name; - wxString ext; - - wxString sessionExt( wxT( ".ses" ) ); - wxString mask = wxT( "*" ) + sessionExt; - - wxFileName::SplitPath( fullFileName, &path, &name, &ext ); - name += sessionExt; - - fullFileName = EDA_FILE_SELECTOR( _( "Merge Specctra Session file:" ), - path, - name, - sessionExt, - mask, - this, - wxFD_OPEN, - false ); - - if( fullFileName == wxEmptyString ) - { - return; - } - - ImportSpecctraSession( fullFileName ); -} - bool PCB_EDIT_FRAME::ImportSpecctraSession( const wxString& fullFileName ) { @@ -108,10 +66,7 @@ bool PCB_EDIT_FRAME::ImportSpecctraSession( const wxString& fullFileName ) } catch( const IO_ERROR& ioe ) { - wxString msg = _( - "Board may be corrupted, do not save it.\n" - "Fix problem and try again" - ); + wxString msg = _( "Board may be corrupted, do not save it.\n Fix problem and try again" ); wxString extra = ioe.What(); diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 3cd038ff59..a28b9e9d1b 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -245,7 +245,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() m_mainToolBar->Add( ACTIONS::save ); KiScaledSeparator( m_mainToolBar, this ); - ADD_TOOL( ID_BOARD_SETUP_DIALOG, options_board_xpm, _( "Board setup" ) ); + m_mainToolBar->Add( PCB_ACTIONS::boardSetup ); KiScaledSeparator( m_mainToolBar, this ); m_mainToolBar->Add( ACTIONS::pageSettings ); diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 8476b5a0c8..fd6029155b 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -253,6 +253,7 @@ public: static TOOL_ACTION zoneDuplicate; // Global edit tool + static TOOL_ACTION boardSetup; static TOOL_ACTION editTracksAndVias; static TOOL_ACTION editTextAndGraphics; static TOOL_ACTION globalDeletions; @@ -263,6 +264,18 @@ public: static TOOL_ACTION changeFootprints; static TOOL_ACTION swapLayers; + static TOOL_ACTION importNetlist; + + static TOOL_ACTION importSpecctraSession; + static TOOL_ACTION exportSpecctraDSN; + + static TOOL_ACTION generateGerbers; + static TOOL_ACTION generateDrillFiles; + static TOOL_ACTION generatePosFile; + static TOOL_ACTION generateReportFile; + static TOOL_ACTION generateD356File; + static TOOL_ACTION generateBOM; + static TOOL_ACTION listNets; static TOOL_ACTION runDRC; diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 8316619416..8313030dd9 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -63,10 +63,65 @@ #include #include #include +#include +#include using namespace std::placeholders; +TOOL_ACTION PCB_ACTIONS::boardSetup( "pcbnew.EditorControl.boardSetup", + AS_GLOBAL, 0, + _( "Board Setup..." ), + _( "Edit board setup including layers, design rules and various defaults" ), + options_board_xpm ); + +TOOL_ACTION PCB_ACTIONS::importNetlist( "pcbnew.EditorControl.importNetlist", + AS_GLOBAL, 0, + _( "Netlist..." ), _( "Read netlist and update board connectivity" ), + netlist_xpm ); + +TOOL_ACTION PCB_ACTIONS::importSpecctraSession( "pcbnew.EditorControl.importSpecctraSession", + AS_GLOBAL, 0, + _( "Specctra Session..." ), _( "Import routed Specctra session (*.ses) file" ), + import_xpm ); + +TOOL_ACTION PCB_ACTIONS::exportSpecctraDSN( "pcbnew.EditorControl.exportSpecctraDSN", + AS_GLOBAL, 0, + _( "Specctra DSN..." ), _( "Export Specctra DSN routing info" ), + export_dsn_xpm ); + +TOOL_ACTION PCB_ACTIONS::generateGerbers( "pcbnew.EditorControl.generateGerbers", + AS_GLOBAL, 0, + _( "&Gerbers (.gbr)..." ), _( "Generate Gerbers for fabrication" ), + post_compo_xpm ); + +TOOL_ACTION PCB_ACTIONS::generateDrillFiles( "pcbnew.EditorControl.generateDrillFiles", + AS_GLOBAL, 0, + _( "&Drill Files (.drl)..." ), _( "Generate Excellon drill file(s)" ), + post_drill_xpm ); + +TOOL_ACTION PCB_ACTIONS::generatePosFile( "pcbnew.EditorControl.generatePosFile", + AS_GLOBAL, 0, + _( "Footprint &Positions (.pos)..." ), + _( "Generate footprint position file for pick and place" ), + post_compo_xpm ); + +TOOL_ACTION PCB_ACTIONS::generateReportFile( "pcbnew.EditorControl.generateReportFile", + AS_GLOBAL, 0, + _( "&Footprint Report (.rpt)..." ), + _( "Create report of all footprints from current board" ), + tools_xpm ); + +TOOL_ACTION PCB_ACTIONS::generateD356File( "pcbnew.EditorControl.generateD356File", + AS_GLOBAL, 0, + _( "IPC-D-356 Netlist File..." ), _( "Generate IPC-D-356 netlist file" ), + netlist_xpm ); + +TOOL_ACTION PCB_ACTIONS::generateBOM( "pcbnew.EditorControl.generateBOM", + AS_GLOBAL, 0, + _( "&BOM..." ), _( "Create bill of materials from current schematic" ), + bom_xpm ); + // Track & via size control TOOL_ACTION PCB_ACTIONS::trackWidthInc( "pcbnew.EditorControl.trackWidthInc", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_NEXT ), @@ -434,8 +489,78 @@ int PCB_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent ) int PCB_EDITOR_CONTROL::Plot( const TOOL_EVENT& aEvent ) { - wxCommandEvent evt( wxEVT_NULL, ID_GEN_PLOT ); - m_frame->ToPlotter( evt ); + m_frame->ToPlotter( ID_GEN_PLOT ); + return 0; +} + + +int PCB_EDITOR_CONTROL::BoardSetup( const TOOL_EVENT& aEvent ) +{ + frame()->DoShowBoardSetupDialog(); + return 0; +} + + +int PCB_EDITOR_CONTROL::ImportNetlist( const TOOL_EVENT& aEvent ) +{ + frame()->InstallNetlistFrame(); + return 0; +} + + +int PCB_EDITOR_CONTROL::ImportSpecctraSession( const TOOL_EVENT& aEvent ) +{ + wxString fullFileName = frame()->GetBoard()->GetFileName(); + wxString path; + wxString name; + wxString ext; + + wxFileName::SplitPath( fullFileName, &path, &name, &ext ); + name += wxT( ".ses" ); + + fullFileName = EDA_FILE_SELECTOR( _( "Merge Specctra Session file:" ), path, name, + wxT( ".ses" ), wxT( "*.ses" ), frame(), wxFD_OPEN, false ); + + if( !fullFileName.IsEmpty() ) + frame()->ImportSpecctraSession( fullFileName ); + + return 0; +} + + +int PCB_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent ) +{ + wxString fullFileName; + wxFileName fn( frame()->GetBoard()->GetFileName() ); + + fn.SetExt( SpecctraDsnFileExtension ); + + fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(), + SpecctraDsnFileExtension, SpecctraDsnFileWildcard(), + frame(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, false ); + + if( !fullFileName.IsEmpty() ) + frame()->ExportSpecctraFile( fullFileName ); + + return 0; +} + + +int PCB_EDITOR_CONTROL::GenerateFabFiles( const TOOL_EVENT& aEvent ) +{ + wxCommandEvent dummy; + + if( aEvent.IsAction( &PCB_ACTIONS::generateGerbers ) ) + m_frame->ToPlotter( ID_GEN_PLOT_GERBER ); + else if( aEvent.IsAction( &PCB_ACTIONS::generateReportFile ) ) + m_frame->GenFootprintsReport( dummy ); + else if( aEvent.IsAction( &PCB_ACTIONS::generateD356File ) ) + m_frame->GenD356File( dummy ); + else if( aEvent.IsAction( &PCB_ACTIONS::generateBOM ) ) + m_frame->RecreateBOMFileFromBoard( dummy ); + else + wxFAIL_MSG( "GenerateFabFiles(): unexpected request" ); + return 0; } @@ -472,7 +597,6 @@ int PCB_EDITOR_CONTROL::Find( const TOOL_EVENT& aEvent ) { DIALOG_FIND dlg( m_frame ); dlg.ShowModal(); - return 0; } @@ -1399,43 +1523,54 @@ int PCB_EDITOR_CONTROL::FlipPcbView( const TOOL_EVENT& aEvent ) void PCB_EDITOR_CONTROL::setTransitions() { - Go( &PCB_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::SaveCopyAs, ACTIONS::saveCopyAs.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::PageSettings, ACTIONS::pageSettings.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::SaveCopyAs, ACTIONS::saveCopyAs.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::PageSettings, ACTIONS::pageSettings.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::Find, ACTIONS::find.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::BoardSetup, PCB_ACTIONS::boardSetup.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ImportNetlist, PCB_ACTIONS::importNetlist.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ImportSpecctraSession, PCB_ACTIONS::importSpecctraSession.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ExportSpecctraDSN, PCB_ACTIONS::exportSpecctraDSN.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::GenerateDrillFiles, PCB_ACTIONS::generateDrillFiles.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateGerbers.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::GeneratePosFile, PCB_ACTIONS::generatePosFile.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateReportFile.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateD356File.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateBOM.MakeEvent() ); + + Go( &PCB_EDITOR_CONTROL::Find, ACTIONS::find.MakeEvent() ); // Track & via size control - Go( &PCB_EDITOR_CONTROL::TrackWidthInc, PCB_ACTIONS::trackWidthInc.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::TrackWidthDec, PCB_ACTIONS::trackWidthDec.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::ViaSizeInc, PCB_ACTIONS::viaSizeInc.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::ViaSizeDec, PCB_ACTIONS::viaSizeDec.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::TrackWidthInc, PCB_ACTIONS::trackWidthInc.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::TrackWidthDec, PCB_ACTIONS::trackWidthDec.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ViaSizeInc, PCB_ACTIONS::viaSizeInc.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ViaSizeDec, PCB_ACTIONS::viaSizeDec.MakeEvent() ); // Zone actions - Go( &PCB_EDITOR_CONTROL::ZoneMerge, PCB_ACTIONS::zoneMerge.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::ZoneDuplicate, PCB_ACTIONS::zoneDuplicate.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ZoneMerge, PCB_ACTIONS::zoneMerge.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ZoneDuplicate, PCB_ACTIONS::zoneDuplicate.MakeEvent() ); // Placing tools - Go( &PCB_EDITOR_CONTROL::PlaceTarget, PCB_ACTIONS::placeTarget.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::PlaceModule, PCB_ACTIONS::placeModule.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::PlaceTarget, PCB_ACTIONS::placeTarget.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::PlaceModule, PCB_ACTIONS::placeModule.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() ); // Other - Go( &PCB_EDITOR_CONTROL::ToggleLockSelected, PCB_ACTIONS::toggleLock.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::LockSelected, PCB_ACTIONS::lock.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::UnlockSelected, PCB_ACTIONS::unlock.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::SelectedEvent ); - Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::UnselectedEvent ); - Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::ClearedEvent ); - Go( &PCB_EDITOR_CONTROL::CrossProbeSchToPcb, PCB_ACTIONS::crossProbeSchToPcb.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetTool.MakeEvent() ); - Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetSelection.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ToggleLockSelected, PCB_ACTIONS::toggleLock.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::LockSelected, PCB_ACTIONS::lock.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::UnlockSelected, PCB_ACTIONS::unlock.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::SelectedEvent ); + Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::UnselectedEvent ); + Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::ClearedEvent ); + Go( &PCB_EDITOR_CONTROL::CrossProbeSchToPcb, PCB_ACTIONS::crossProbeSchToPcb.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetTool.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetSelection.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::LocalRatsnestTool, PCB_ACTIONS::localRatsnestTool.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::HideDynamicRatsnest, PCB_ACTIONS::hideDynamicRatsnest.MakeEvent() ); diff --git a/pcbnew/tools/pcb_editor_control.h b/pcbnew/tools/pcb_editor_control.h index 57b259e676..681fe2fbf4 100644 --- a/pcbnew/tools/pcb_editor_control.h +++ b/pcbnew/tools/pcb_editor_control.h @@ -58,6 +58,14 @@ public: int SaveCopyAs( const TOOL_EVENT& aEvent ); int PageSettings( const TOOL_EVENT& aEvent ); int Plot( const TOOL_EVENT& aEvent ); + + int BoardSetup( const TOOL_EVENT& aEvent ); + int ImportNetlist( const TOOL_EVENT& aEvent ); + int ImportSpecctraSession( const TOOL_EVENT& aEvent ); + int ExportSpecctraDSN( const TOOL_EVENT& aEvent ); + int GenerateDrillFiles( const TOOL_EVENT& aEvent ); + int GeneratePosFile( const TOOL_EVENT& aEvent ); + int GenerateFabFiles( const TOOL_EVENT& aEvent ); int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent ); int TogglePythonConsole( const TOOL_EVENT& aEvent );