Commit 709dfcc1 authored by Maciej Suminski's avatar Maciej Suminski

Added settings dialog for Pad Enumeration tool.

parent 2bcbb675
...@@ -59,6 +59,8 @@ set( PCBNEW_DIALOGS ...@@ -59,6 +59,8 @@ set( PCBNEW_DIALOGS
dialogs/dialog_edit_module_for_Modedit.cpp dialogs/dialog_edit_module_for_Modedit.cpp
dialogs/dialog_edit_module_text.cpp dialogs/dialog_edit_module_text.cpp
dialogs/dialog_edit_module_text_base.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_exchange_modules_base.cpp
dialogs/dialog_export_idf.cpp dialogs/dialog_export_idf.cpp
dialogs/dialog_export_idf_base.cpp dialogs/dialog_export_idf_base.cpp
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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();
}
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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__
///////////////////////////////////////////////////////////////////////////
// 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()
{
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// 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 <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/spinctrl.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// 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__
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <collectors.h> #include <collectors.h>
#include <confirm.h> #include <confirm.h>
#include <dialogs/dialog_enum_pads.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <class_board.h> #include <class_board.h>
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <wx/defs.h>
MODULE_TOOLS::MODULE_TOOLS() : MODULE_TOOLS::MODULE_TOOLS() :
TOOL_INTERACTIVE( "pcbnew.ModuleEditor" ) TOOL_INTERACTIVE( "pcbnew.ModuleEditor" )
...@@ -240,9 +242,17 @@ int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent ) ...@@ -240,9 +242,17 @@ int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent )
for( D_PAD* p = module->Pads(); p; p = p->Next() ) for( D_PAD* p = module->Pads(); p; p = p->Next() )
allPads.insert( p ); allPads.insert( p );
// TODO display settings window DIALOG_ENUM_PADS settingsDlg( m_frame );
int padNumber = 1;
wxString padPrefix = ""; 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" ) ); m_frame->DisplayToolMsg( _( "Hold left mouse button and move cursor over pads to enumerate them" ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment