diff --git a/eeschema/dialogs/dialog_erc_base.cpp b/eeschema/dialogs/dialog_erc_base.cpp index fc37976a63..c1ef861b2c 100644 --- a/eeschema/dialogs/dialog_erc_base.cpp +++ b/eeschema/dialogs/dialog_erc_base.cpp @@ -110,7 +110,7 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin wxBoxSizer* m_panelMatrixSizer; m_panelMatrixSizer = new wxBoxSizer( wxVERTICAL ); - m_ResetOptButton = new wxButton( m_PanelERCOptions, ID_RESET_MATRIX, _("Reset"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ResetOptButton = new wxButton( m_PanelERCOptions, ID_RESET_MATRIX, _("Initialize to Default"), wxDefaultPosition, wxDefaultSize, 0 ); m_panelMatrixSizer->Add( m_ResetOptButton, 0, wxALIGN_RIGHT|wxTOP|wxRIGHT|wxLEFT, 5 ); m_matrixPanel = new wxPanel( m_PanelERCOptions, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); diff --git a/eeschema/dialogs/dialog_erc_base.fbp b/eeschema/dialogs/dialog_erc_base.fbp index 4d0702bc38..aa6589a1e8 100644 --- a/eeschema/dialogs/dialog_erc_base.fbp +++ b/eeschema/dialogs/dialog_erc_base.fbp @@ -1653,7 +1653,7 @@ 0 0 ID_RESET_MATRIX - Reset + Initialize to Default 0 diff --git a/pcbnew/dialogs/dialog_layers_setup.cpp b/pcbnew/dialogs/dialog_layers_setup.cpp index 6933b7387a..96585a3d9b 100644 --- a/pcbnew/dialogs/dialog_layers_setup.cpp +++ b/pcbnew/dialogs/dialog_layers_setup.cpp @@ -39,7 +39,7 @@ // some define to choose how copper layers widgets are shown // if defined, display only active copper layers -// if not displays always 1=the full set (16 layers) +// if not displays always 1=the full set (32 copper layers) #define HIDE_INACTIVE_LAYERS // if defined, use the layer manager copper layers order (from FRONT to BACK) @@ -405,7 +405,6 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames() if( ctl ) { wxString lname = m_pcb->GetLayerName( layer ); - //D(printf("layerName[%d]=%s\n", layer, TO_UTF8( lname ) );) if( ctl->IsKindOf( CLASSINFO(wxTextCtrl) ) ) @@ -423,7 +422,6 @@ void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LSET enabledLayers ) for( LSEQ seq = dlg_layers(); seq; ++seq ) { LAYER_ID layer = *seq; - setLayerCheckBox( layer, enabledLayers[layer] ); } } @@ -614,11 +612,8 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event ) if( m_enabledLayers[layer] ) { name = getLayerName( layer ); - m_pcb->SetLayerName( layer, name ); - LAYER_T t = (LAYER_T) getLayerTypeIndex( layer ); - m_pcb->SetLayerType( layer, t ); } } @@ -695,7 +690,10 @@ bool DIALOG_LAYERS_SETUP::testLayerNames() // 4) cannot be 'signal' // 5) must be unique. // 6) cannot have illegal chars in filenames ( some filenames are built from layer names ) - static const wxString badchars( wxT("%$\" /\\") ); + // like : % $ \ " / : + + wxString badchars = wxFileName::GetForbiddenChars(wxPATH_DOS); + badchars.Append( '%' ); if( !name ) { diff --git a/pcbnew/dialogs/dialog_move_exact.cpp b/pcbnew/dialogs/dialog_move_exact.cpp index 2f528a97b3..e4c3ac4fea 100644 --- a/pcbnew/dialogs/dialog_move_exact.cpp +++ b/pcbnew/dialogs/dialog_move_exact.cpp @@ -170,12 +170,6 @@ void DIALOG_MOVE_EXACT::OnClear( wxCommandEvent& event ) } -void DIALOG_MOVE_EXACT::OnCancelClick( wxCommandEvent& event ) -{ - EndModal( wxID_ABORT ); -} - - void DIALOG_MOVE_EXACT::OnOkClick( wxCommandEvent& event ) { m_rotation = DoubleValueFromString( DEGREES, m_rotEntry->GetValue() ); @@ -191,7 +185,7 @@ void DIALOG_MOVE_EXACT::OnOkClick( wxCommandEvent& event ) m_yEntry->GetValue().ToDouble( &m_options.entry2 ); m_rotEntry->GetValue().ToDouble( &m_options.entryRotation ); - EndModal( wxID_OK ); + event.Skip(); } } diff --git a/pcbnew/dialogs/dialog_move_exact.fbp b/pcbnew/dialogs/dialog_move_exact.fbp index 6aa0c3ef4d..f26f053996 100644 --- a/pcbnew/dialogs/dialog_move_exact.fbp +++ b/pcbnew/dialogs/dialog_move_exact.fbp @@ -183,7 +183,7 @@ 5 - wxEXPAND + wxEXPAND|wxTOP|wxBOTTOM 1 4 @@ -456,9 +456,9 @@ 5 - wxALL|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -469,7 +469,6 @@ - Load From Art Provider; wxART_DELETE; wxART_BUTTON 1 0 @@ -478,20 +477,17 @@ 1 0 0 - Dock 0 Left 1 1 - 0 0 - - wxID_CLEAR - Clear + wxID_ANY + Reset 0 @@ -507,10 +503,9 @@ 1 Resizable - 1 - wxBU_AUTODRAW + wxBU_EXACTFIT 0 @@ -806,9 +801,9 @@ 5 - wxALL|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -819,7 +814,6 @@ - Load From Art Provider; wxART_DELETE; wxART_BUTTON 1 0 @@ -828,20 +822,17 @@ 1 0 0 - Dock 0 Left 1 1 - 0 0 - - wxID_CLEAR - Clear + wxID_ANY + Reset 0 @@ -857,10 +848,9 @@ 1 Resizable - 1 - wxBU_AUTODRAW + wxBU_EXACTFIT 0 @@ -1156,9 +1146,9 @@ 5 - wxALL|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -1169,7 +1159,6 @@ - Load From Art Provider; wxART_DELETE; wxART_BUTTON 1 0 @@ -1178,20 +1167,17 @@ 1 0 0 - Dock 0 Left 1 1 - 0 0 - - wxID_CLEAR - Clear + wxID_ANY + Reset 0 @@ -1207,10 +1193,9 @@ 1 Resizable - 1 - wxBU_AUTODRAW + wxBU_EXACTFIT 0 @@ -1347,7 +1332,7 @@ m_stdButtons protected - OnCancelClick + diff --git a/pcbnew/dialogs/dialog_move_exact.h b/pcbnew/dialogs/dialog_move_exact.h index 812e0d3187..ffd5bc5d8d 100644 --- a/pcbnew/dialogs/dialog_move_exact.h +++ b/pcbnew/dialogs/dialog_move_exact.h @@ -52,7 +52,6 @@ private: void OnPolarChanged( wxCommandEvent& event ); void OnClear( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event ); /** diff --git a/pcbnew/dialogs/dialog_move_exact_base.cpp b/pcbnew/dialogs/dialog_move_exact_base.cpp index 64fe00c493..c7d237fb7a 100644 --- a/pcbnew/dialogs/dialog_move_exact_base.cpp +++ b/pcbnew/dialogs/dialog_move_exact_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -36,8 +36,8 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id, m_xUnit->Wrap( -1 ); fgSizer2->Add( m_xUnit, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 ); - m_clearX = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); - fgSizer2->Add( m_clearX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_clearX = new wxButton( this, wxID_ANY, _("Reset"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + fgSizer2->Add( m_clearX, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_yLabel = new wxStaticText( this, wxID_ANY, _("y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_yLabel->Wrap( -1 ); @@ -50,8 +50,8 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id, m_yUnit->Wrap( -1 ); fgSizer2->Add( m_yUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_clearY = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); - fgSizer2->Add( m_clearY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_clearY = new wxButton( this, wxID_ANY, _("Reset"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + fgSizer2->Add( m_clearY, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_rotLabel = new wxStaticText( this, wxID_ANY, _("Item rotation:"), wxDefaultPosition, wxDefaultSize, 0 ); m_rotLabel->Wrap( -1 ); @@ -64,11 +64,11 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id, m_rotUnit->Wrap( -1 ); fgSizer2->Add( m_rotUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_clearRot = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); - fgSizer2->Add( m_clearRot, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_clearRot = new wxButton( this, wxID_ANY, _("Reset"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + fgSizer2->Add( m_clearRot, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - bMainSizer->Add( fgSizer2, 1, wxEXPAND, 5 ); + bMainSizer->Add( fgSizer2, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); @@ -96,7 +96,6 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id, m_clearY->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnClear ), NULL, this ); m_rotEntry->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_MOVE_EXACT_BASE::OnTextFocusLost ), NULL, this ); m_clearRot->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnClear ), NULL, this ); - m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnCancelClick ), NULL, this ); m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnOkClick ), NULL, this ); } @@ -111,7 +110,6 @@ DIALOG_MOVE_EXACT_BASE::~DIALOG_MOVE_EXACT_BASE() m_clearY->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnClear ), NULL, this ); m_rotEntry->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_MOVE_EXACT_BASE::OnTextFocusLost ), NULL, this ); m_clearRot->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnClear ), NULL, this ); - m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnCancelClick ), NULL, this ); m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnOkClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_move_exact_base.h b/pcbnew/dialogs/dialog_move_exact_base.h index d38a75ca71..ecb32212cb 100644 --- a/pcbnew/dialogs/dialog_move_exact_base.h +++ b/pcbnew/dialogs/dialog_move_exact_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -22,10 +22,6 @@ class DIALOG_SHIM; #include #include #include -#include -#include -#include -#include #include #include #include @@ -46,15 +42,15 @@ class DIALOG_MOVE_EXACT_BASE : public DIALOG_SHIM wxStaticText* m_xLabel; wxTextCtrl* m_xEntry; wxStaticText* m_xUnit; - wxBitmapButton* m_clearX; + wxButton* m_clearX; wxStaticText* m_yLabel; wxTextCtrl* m_yEntry; wxStaticText* m_yUnit; - wxBitmapButton* m_clearY; + wxButton* m_clearY; wxStaticText* m_rotLabel; wxTextCtrl* m_rotEntry; wxStaticText* m_rotUnit; - wxBitmapButton* m_clearRot; + wxButton* m_clearRot; wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_stdButtons; wxButton* m_stdButtonsOK; @@ -65,7 +61,6 @@ class DIALOG_MOVE_EXACT_BASE : public DIALOG_SHIM virtual void OnPolarChanged( wxCommandEvent& event ) { event.Skip(); } virtual void OnTextFocusLost( wxFocusEvent& event ) { event.Skip(); } virtual void OnClear( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index d22003deed..a488562944 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -790,11 +790,12 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) // Use Gerber Extensions based on layer number // (See http://en.wikipedia.org/wiki/Gerber_File) if( m_plotOpts.GetFormat() == PLOT_FORMAT_GERBER && m_useGerberExtensions->GetValue() ) - file_ext = GetGerberExtension( layer ); + file_ext = GetGerberProtelExtension( layer ); - // Create file name (from the English layer name for non copper layers). + // Create file name (from the English default layer name for non copper layers). BuildPlotFileName( &fn, outputDir.GetPath(), - m_board->GetStandardLayerName( layer ), +// m_board->GetStandardLayerName( layer ), + m_board->GetLayerName( layer ), file_ext ); LOCALE_IO toggle; diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 310cff87a5..2938910afe 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -45,7 +45,7 @@ #include -const wxString GetGerberExtension( LAYER_NUM aLayer ) +const wxString GetGerberProtelExtension( LAYER_NUM aLayer ) { if( IsCopperLayer( aLayer ) ) { @@ -286,28 +286,32 @@ void AddGerberX2Attribute( PLOTTER * aPlotter, } -void BuildPlotFileName( wxFileName* aFilename, - const wxString& aOutputDir, - const wxString& aSuffix, - const wxString& aExtension ) +void BuildPlotFileName( wxFileName* aFilename, const wxString& aOutputDir, + const wxString& aSuffix, const wxString& aExtension ) { + // aFilename contains the base filename only (without path and extension) + // when calling this function. + // It is expected to be a valid filename (this is usually the board filename) aFilename->SetPath( aOutputDir ); // Set the file extension aFilename->SetExt( aExtension ); - /* remove leading and trailing spaces if any from the suffix, if - something survives add it to the name; - also the suffix can contain some not allowed chars in filename (/ \ .), - so change them to underscore - */ + // remove leading and trailing spaces if any from the suffix, if + // something survives add it to the name; + // also the suffix can contain some not allowed chars in filename (/ \ . :), + // so change them to underscore + // Remember it can be called from a python script, so the illegal chars + // have to be filtered here. wxString suffix = aSuffix; suffix.Trim( true ); suffix.Trim( false ); - suffix.Replace( wxT("."), wxT("_") ); - suffix.Replace( wxT("/"), wxT("_") ); - suffix.Replace( wxT("\\"), wxT("_") ); + wxString badchars = wxFileName::GetForbiddenChars(wxPATH_DOS); + badchars.Append( '%' ); + + for( unsigned ii = 0; ii < badchars.Len(); ii++ ) + suffix.Replace( badchars[ii], wxT("_") ); if( !suffix.IsEmpty() ) aFilename->SetName( aFilename->GetName() + wxT( "-" ) + suffix ); @@ -368,9 +372,18 @@ bool PLOT_CONTROLLER::OpenPlotfile( const wxString &aSuffix, if( EnsureFileDirectoryExists( &outputDir, boardFilename ) ) { wxFileName fn( boardFilename ); - BuildPlotFileName( &fn, outputDirName, aSuffix, GetDefaultPlotExtension( aFormat ) ); + wxString fileExt = GetDefaultPlotExtension( aFormat ); - m_plotter = StartPlotBoard( m_board, &GetPlotOptions(), ToLAYER_ID( GetLayer() ), fn.GetFullPath(), aSheetDesc ); + // Gerber format can use specific file ext, depending on layers + // (now not a good practice, because the official file ext is .gbr) + if( GetPlotOptions().GetFormat() == PLOT_FORMAT_GERBER && + GetPlotOptions().GetUseGerberExtensions() ) + fileExt = GetGerberProtelExtension( GetLayer() ); + + BuildPlotFileName( &fn, outputDirName, aSuffix, fileExt ); + + m_plotter = StartPlotBoard( m_board, &GetPlotOptions(), ToLAYER_ID( GetLayer() ), + fn.GetFullPath(), aSheetDesc ); } return( m_plotter != NULL ); diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index b71b5bdb30..1570ac2248 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -246,10 +246,12 @@ void BuildPlotFileName( wxFileName* aFilename, /** - * Function GetGerberExtension + * Function GetGerberProtelExtension * @return the appropriate Gerber file extension for \a aLayer + * used by Protel, and still sometimes in use (although the + * official Gerber Ext is now .gbr) */ -const wxString GetGerberExtension( LAYER_NUM aLayer ); +const wxString GetGerberProtelExtension( LAYER_NUM aLayer ); /** * Function GetGerberFileFunctionAttribute