diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 1f032f2c93..187b73a45a 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -59,6 +59,8 @@ set( PCBNEW_DIALOGS dialogs/dialog_edit_module_for_Modedit.cpp dialogs/dialog_edit_module_text.cpp dialogs/dialog_edit_module_text_base.cpp + dialogs/dialog_enum_pads.cpp + dialogs/dialog_enum_pads_base.cpp dialogs/dialog_exchange_modules_base.cpp dialogs/dialog_export_idf.cpp dialogs/dialog_export_idf_base.cpp diff --git a/pcbnew/dialogs/dialog_enum_pads.cpp b/pcbnew/dialogs/dialog_enum_pads.cpp new file mode 100644 index 0000000000..51f822047e --- /dev/null +++ b/pcbnew/dialogs/dialog_enum_pads.cpp @@ -0,0 +1,42 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2014 CERN + * @author Maciej Suminski + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "dialog_enum_pads.h" + +DIALOG_ENUM_PADS::DIALOG_ENUM_PADS( wxWindow* aParent ) : + DIALOG_ENUM_PADS_BASE( aParent ) +{ +} + + +int DIALOG_ENUM_PADS::GetStartNumber() const +{ + return m_padStartNum->GetValue(); +} + + +wxString DIALOG_ENUM_PADS::GetPrefix() const +{ + return m_padPrefix->GetValue(); +} diff --git a/pcbnew/dialogs/dialog_enum_pads.h b/pcbnew/dialogs/dialog_enum_pads.h new file mode 100644 index 0000000000..188c7328dc --- /dev/null +++ b/pcbnew/dialogs/dialog_enum_pads.h @@ -0,0 +1,49 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2014 CERN + * @author Maciej Suminski + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __dialog_enum_pads__ +#define __dialog_enum_pads__ + +/** +@file +Subclass of DIALOG_ENUM_PADS_BASE, which is generated by wxFormBuilder. +*/ + +#include "dialog_enum_pads_base.h" + +/** Implementing DIALOG_ENUM_PADS_BASE */ +class DIALOG_ENUM_PADS : public DIALOG_ENUM_PADS_BASE +{ +public: + /** Constructor */ + DIALOG_ENUM_PADS( wxWindow* parent ); + + ///> Returns the starting number that is going to be used for the first enumerated pad. + int GetStartNumber() const; + + ///> Returns common prefix for all enumerated pads. + wxString GetPrefix() const; +}; + +#endif // __dialog_enum_pads__ diff --git a/pcbnew/dialogs/dialog_enum_pads_base.cpp b/pcbnew/dialogs/dialog_enum_pads_base.cpp new file mode 100644 index 0000000000..af1ac745f3 --- /dev/null +++ b/pcbnew/dialogs/dialog_enum_pads_base.cpp @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 30 2013) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_enum_pads_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_ENUM_PADS_BASE::DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bPrefixSizer; + bPrefixSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_lblPadPrefix = new wxStaticText( this, wxID_ANY, _("Pad name prefix:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblPadPrefix->Wrap( -1 ); + bPrefixSizer->Add( m_lblPadPrefix, 1, wxALL, 5 ); + + m_padPrefix = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_padPrefix->SetMaxLength( 4 ); + bPrefixSizer->Add( m_padPrefix, 0, wxALL, 5 ); + + + bMainSizer->Add( bPrefixSizer, 1, wxEXPAND, 5 ); + + wxBoxSizer* bPadNumSizer; + bPadNumSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_lblPadStartNum = new wxStaticText( this, wxID_ANY, _("First pad number:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblPadStartNum->Wrap( -1 ); + bPadNumSizer->Add( m_lblPadStartNum, 1, wxALL, 5 ); + + m_padStartNum = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 999, 1 ); + bPadNumSizer->Add( m_padStartNum, 0, wxALL, 5 ); + + + bMainSizer->Add( bPadNumSizer, 1, wxEXPAND, 5 ); + + m_lblInfo = new wxStaticText( this, wxID_ANY, _("Pad names are restricted to 4 characters (including number)."), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblInfo->Wrap( 320 ); + bMainSizer->Add( m_lblInfo, 0, wxALL, 5 ); + + m_stdButtons = new wxStdDialogButtonSizer(); + m_stdButtonsOK = new wxButton( this, wxID_OK ); + m_stdButtons->AddButton( m_stdButtonsOK ); + m_stdButtonsCancel = new wxButton( this, wxID_CANCEL ); + m_stdButtons->AddButton( m_stdButtonsCancel ); + m_stdButtons->Realize(); + + bMainSizer->Add( m_stdButtons, 2, wxEXPAND, 5 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + + this->Centre( wxBOTH ); +} + +DIALOG_ENUM_PADS_BASE::~DIALOG_ENUM_PADS_BASE() +{ +} diff --git a/pcbnew/dialogs/dialog_enum_pads_base.fbp b/pcbnew/dialogs/dialog_enum_pads_base.fbp new file mode 100644 index 0000000000..f17006d1f9 --- /dev/null +++ b/pcbnew/dialogs/dialog_enum_pads_base.fbp @@ -0,0 +1,572 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_enum_pads_base + 1000 + none + 1 + DIALOG_ENUM_PADS_BASE + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_ENUM_PADS_BASE + + 340,240 + wxDEFAULT_DIALOG_STYLE + + Pad enumeration settings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bMainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bPrefixSizer + wxHORIZONTAL + none + + 5 + wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pad name prefix: + + 0 + + + 0 + + 1 + m_lblPadPrefix + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 4 + + 0 + + 1 + m_padPrefix + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bPadNumSizer + wxHORIZONTAL + none + + 5 + wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + First pad number: + + 0 + + + 0 + + 1 + m_lblPadStartNum + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 999 + + 0 + + 0 + + 0 + + 1 + m_padStartNum + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pad names are restricted to 4 characters (including number). + + 0 + + + 0 + + 1 + m_lblInfo + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + 320 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 2 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_stdButtons + protected + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_enum_pads_base.h b/pcbnew/dialogs/dialog_enum_pads_base.h new file mode 100644 index 0000000000..caed966dcd --- /dev/null +++ b/pcbnew/dialogs/dialog_enum_pads_base.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 30 2013) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_ENUM_PADS_BASE_H__ +#define __DIALOG_ENUM_PADS_BASE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_ENUM_PADS_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_ENUM_PADS_BASE : public wxDialog +{ + private: + + protected: + wxStaticText* m_lblPadPrefix; + wxTextCtrl* m_padPrefix; + wxStaticText* m_lblPadStartNum; + wxSpinCtrl* m_padStartNum; + wxStaticText* m_lblInfo; + wxStdDialogButtonSizer* m_stdButtons; + wxButton* m_stdButtonsOK; + wxButton* m_stdButtonsCancel; + + public: + + DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pad enumeration settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,240 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~DIALOG_ENUM_PADS_BASE(); + +}; + +#endif //__DIALOG_ENUM_PADS_BASE_H__ diff --git a/pcbnew/tools/module_tools.cpp b/pcbnew/tools/module_tools.cpp index 2a297052e0..447e249229 100644 --- a/pcbnew/tools/module_tools.cpp +++ b/pcbnew/tools/module_tools.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,7 @@ #include #include +#include MODULE_TOOLS::MODULE_TOOLS() : TOOL_INTERACTIVE( "pcbnew.ModuleEditor" ) @@ -240,9 +242,17 @@ int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent ) for( D_PAD* p = module->Pads(); p; p = p->Next() ) allPads.insert( p ); - // TODO display settings window - int padNumber = 1; - wxString padPrefix = ""; + DIALOG_ENUM_PADS settingsDlg( m_frame ); + + if( settingsDlg.ShowModal() == wxID_CANCEL ) + { + setTransitions(); + + return 0; + } + + int padNumber = settingsDlg.GetStartNumber(); + wxString padPrefix = settingsDlg.GetPrefix(); m_frame->DisplayToolMsg( _( "Hold left mouse button and move cursor over pads to enumerate them" ) );