Fixes related to exchage footprint dialog:

* The exchange dialog can be now called from the footprint popup menu.
* It can be (as before) called from the footprint properties menu, but in this case, the footprint properties menu is closed before calling the exchange menu.
* Changes in exchange dialog to avoid truncation of long FPIDs
* Changes in exchange dialog to make some texts translatable (Previously, the same English sentence was used in very different contexts)
This commit is contained in:
jean-pierre charras 2015-08-20 20:13:18 +02:00
parent 2b70aeafba
commit 2605ab0984
10 changed files with 770 additions and 642 deletions

View File

@ -190,7 +190,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
void DIALOG_MODULE_BOARD_EDITOR::OnCancelClick( wxCommandEvent& event )
{
ENDQUASIMODAL( -1 );
EndModal( PRM_EDITOR_ABORT );
}
@ -202,17 +202,13 @@ void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event )
m_Parent->OnModify();
}
ENDQUASIMODAL( 2 );
EndModal( PRM_EDITOR_WANT_MODEDIT );
}
void DIALOG_MODULE_BOARD_EDITOR::ExchangeModule( wxCommandEvent& event )
{
m_Parent->InstallExchangeModuleFrame( m_CurrentModule );
// Warning: m_CurrentModule was deleted by exchange module
m_Parent->SetCurItem( NULL );
ENDQUASIMODAL( 0 );
EndModal( PRM_EDITOR_WANT_EXCHANGE_FP );
}
@ -694,7 +690,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
m_Parent->OnModify();
ENDQUASIMODAL( 1 );
EndModal( PRM_EDITOR_EDIT_OK );
if( m_DC )
{

View File

@ -27,7 +27,6 @@
class DIALOG_MODULE_BOARD_EDITOR: public DIALOG_MODULE_BOARD_EDITOR_BASE
{
private:
PCB_EDIT_FRAME * m_Parent;
wxDC * m_DC;
MODULE* m_CurrentModule;
@ -41,7 +40,17 @@ private:
static size_t m_page; // remember the last open page during session
public:
// The dialog can be closed for several reasons.
// they are listed here:
enum FP_PRM_EDITOR_RETVALUE
{
PRM_EDITOR_ABORT,
PRM_EDITOR_WANT_EXCHANGE_FP,
PRM_EDITOR_EDIT_OK,
PRM_EDITOR_WANT_MODEDIT
};
public:
// Constructor and destructor
DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, MODULE* aModule, wxDC* aDC );
~DIALOG_MODULE_BOARD_EDITOR();

View File

@ -22,39 +22,23 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Current footprint"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
bLeftSizer->Add( m_staticText6, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTextCmpVal = new wxStaticText( this, wxID_ANY, _("Component value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCmpVal->Wrap( -1 );
bLeftSizer->Add( m_staticTextCmpVal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OldModule = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
m_OldModule->SetMaxLength( 0 );
bLeftSizer->Add( m_OldModule, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_CmpValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
m_CmpValue->SetMaxLength( 0 );
bLeftSizer->Add( m_CmpValue, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Current value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
bLeftSizer->Add( m_staticText7, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTexCmpRef = new wxStaticText( this, wxID_ANY, _("Component reference"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTexCmpRef->Wrap( -1 );
bLeftSizer->Add( m_staticTexCmpRef, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CurrValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
m_CurrValue->SetMaxLength( 0 );
bLeftSizer->Add( m_CurrValue, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Current reference"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
bLeftSizer->Add( m_staticText5, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CurrReference = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bLeftSizer->Add( m_CurrReference, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText8 = new wxStaticText( this, wxID_ANY, _("New footprint"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
bLeftSizer->Add( m_staticText8, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_NewModule = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_NewModule->SetMaxLength( 0 );
bLeftSizer->Add( m_NewModule, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_CmpReference = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bLeftSizer->Add( m_CmpReference, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bUpperSizer->Add( bLeftSizer, 1, 0, 5 );
bUpperSizer->Add( bLeftSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bMiddleSizer;
bMiddleSizer = new wxBoxSizer( wxVERTICAL );
@ -66,17 +50,11 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi
bMiddleSizer->Add( m_Selection, 0, wxALL, 5 );
bUpperSizer->Add( bMiddleSizer, 0, wxALL, 5 );
bUpperSizer->Add( bMiddleSizer, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_OKbutton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_OKbutton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_Quitbutton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_Quitbutton, 0, wxALL|wxEXPAND, 5 );
m_buttonCmpList = new wxButton( this, wxID_ANY, _("Export Footprint Association File"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonCmpList, 0, wxALL|wxEXPAND, 5 );
@ -92,37 +70,67 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi
bMainSizer->Add( bUpperSizer, 0, wxALL|wxEXPAND, 5 );
m_staticTextCurrFPID = new wxStaticText( this, wxID_ANY, _("Current footprint name (FPID)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCurrFPID->Wrap( -1 );
bMainSizer->Add( m_staticTextCurrFPID, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CurrentFootprintFPID = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
m_CurrentFootprintFPID->SetMaxLength( 0 );
bMainSizer->Add( m_CurrentFootprintFPID, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextNewFPID = new wxStaticText( this, wxID_ANY, _("New footprint name (FPID)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextNewFPID->Wrap( -1 );
bMainSizer->Add( m_staticTextNewFPID, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_NewFootprintFPID = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_NewFootprintFPID->SetMaxLength( 0 );
bMainSizer->Add( m_NewFootprintFPID, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextMsg->Wrap( -1 );
bMainSizer->Add( m_staticTextMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_WinMessages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_WinMessages->SetMinSize( wxSize( -1,75 ) );
m_WinMessages->SetMinSize( wxSize( -1,150 ) );
bMainSizer->Add( m_WinMessages, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerButts;
bSizerButts = new wxBoxSizer( wxHORIZONTAL );
m_Applybutton = new wxButton( this, wxID_OK, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButts->Add( m_Applybutton, 0, wxEXPAND|wxALL, 5 );
m_Quitbutton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButts->Add( m_Quitbutton, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bSizerButts, 0, wxALIGN_RIGHT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_Selection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnSelectionClicked ), NULL, this );
m_OKbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this );
m_Quitbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this );
m_buttonCmpList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::RebuildCmpList ), NULL, this );
m_Browsebutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::BrowseAndSelectFootprint ), NULL, this );
m_buttonFPViewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this );
m_Applybutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this );
m_Quitbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this );
}
DIALOG_EXCHANGE_MODULE_BASE::~DIALOG_EXCHANGE_MODULE_BASE()
{
// Disconnect Events
m_Selection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnSelectionClicked ), NULL, this );
m_OKbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this );
m_Quitbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this );
m_buttonCmpList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::RebuildCmpList ), NULL, this );
m_Browsebutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::BrowseAndSelectFootprint ), NULL, this );
m_buttonFPViewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this );
m_Applybutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this );
m_Quitbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@ class DIALOG_SHIM;
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -38,35 +39,36 @@ class DIALOG_EXCHANGE_MODULE_BASE : public DIALOG_SHIM
private:
protected:
wxStaticText* m_staticText6;
wxTextCtrl* m_OldModule;
wxStaticText* m_staticText7;
wxTextCtrl* m_CurrValue;
wxStaticText* m_staticText5;
wxTextCtrl* m_CurrReference;
wxStaticText* m_staticText8;
wxTextCtrl* m_NewModule;
wxStaticText* m_staticTextCmpVal;
wxTextCtrl* m_CmpValue;
wxStaticText* m_staticTexCmpRef;
wxTextCtrl* m_CmpReference;
wxRadioBox* m_Selection;
wxButton* m_OKbutton;
wxButton* m_Quitbutton;
wxButton* m_buttonCmpList;
wxButton* m_Browsebutton;
wxButton* m_buttonFPViewer;
wxStaticText* m_staticTextCurrFPID;
wxTextCtrl* m_CurrentFootprintFPID;
wxStaticText* m_staticTextNewFPID;
wxTextCtrl* m_NewFootprintFPID;
wxStaticText* m_staticTextMsg;
wxTextCtrl* m_WinMessages;
wxStaticLine* m_staticline1;
wxButton* m_Applybutton;
wxButton* m_Quitbutton;
// Virtual event handlers, overide them in your derived class
virtual void OnSelectionClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
virtual void RebuildCmpList( wxCommandEvent& event ) { event.Skip(); }
virtual void BrowseAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void ViewAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Change Footprint"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Change Footprint"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 555,449 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXCHANGE_MODULE_BASE();
};

View File

@ -831,6 +831,16 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Change_Side_Module( (MODULE*) GetCurItem(), &dc );
break;
case ID_POPUP_PCB_EXCHANGE_FOOTPRINTS:
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
break;
InstallExchangeModuleFrame( (MODULE*) GetCurItem() );
// Warning: the current item can be deleted by exchange module
SetCurItem( NULL );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_EDIT_MODULE_PRMS:
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != PCB_MODULE_T )

View File

@ -51,29 +51,30 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
if( Module == NULL )
return;
#ifndef __WXMAC__
DIALOG_MODULE_BOARD_EDITOR* dialog = new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC );
#else
#ifdef __WXMAC__
// avoid Avoid "writes" in the dialog, creates errors with WxOverlay and NSView & Modal
// Raising an Exception - Fixes #764678
DIALOG_MODULE_BOARD_EDITOR* dialog = new DIALOG_MODULE_BOARD_EDITOR( this, Module, NULL );
DC = NULL;
#endif
int retvalue = dialog->SHOWQUASIMODAL(); /* retvalue =
* -1 if abort,
* 0 if exchange module,
* 1 for normal edition
* and 2 for a goto editor command
DIALOG_MODULE_BOARD_EDITOR* dlg = new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC );
int retvalue = dlg->ShowModal();
/* retvalue =
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_ABORT if abort,
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_EXCHANGE_FP if exchange module,
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_EDIT_OK for normal edition
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_MODEDIT for a goto editor command
*/
dialog->Destroy();
dlg->Destroy();
#ifdef __WXMAC__
// If something edited, push a refresh request
if( retvalue == 0 || retvalue == 1 )
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_EDIT_OK )
m_canvas->Refresh();
#endif
if( retvalue == 2 )
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_MODEDIT )
{
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
@ -83,6 +84,13 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
editor->Show( true );
editor->Raise(); // Iconize( false );
}
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP )
{
InstallExchangeModuleFrame( Module );
// Warning: the current item can be deleted by exchange module
SetCurItem( NULL );
}
}

View File

@ -808,21 +808,6 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
msg, KiBitmap( move_module_xpm ) );
msg = AddHotkeyName( _( "Duplicate Footprint" ), g_Board_Editor_Hokeys_Descr,
HK_DUPLICATE_ITEM );
AddMenuItem( menu, ID_POPUP_PCB_DUPLICATE_ITEM,
msg, KiBitmap( duplicate_module_xpm ) );
msg = AddHotkeyName( _("Move Footprint Exactly" ), g_Board_Editor_Hokeys_Descr,
HK_MOVE_ITEM_EXACT );
AddMenuItem( menu, ID_POPUP_PCB_MOVE_EXACT,
msg, KiBitmap( move_module_xpm ) );
msg = AddHotkeyName( _("Create Footprint Array" ), g_Board_Editor_Hokeys_Descr,
HK_CREATE_ARRAY );
AddMenuItem( menu, ID_POPUP_PCB_CREATE_ARRAY,
msg, KiBitmap( array_module_xpm ) );
msg = AddHotkeyName( _( "Drag" ), g_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST,
msg, KiBitmap( drag_module_xpm ) );
@ -855,6 +840,26 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
g_Board_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE,
msg, KiBitmap( delete_module_xpm ) );
sub_menu_footprint->AppendSeparator();
msg = AddHotkeyName( _("Move Footprint Exactly" ), g_Board_Editor_Hokeys_Descr,
HK_MOVE_ITEM_EXACT );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_MOVE_EXACT,
msg, KiBitmap( move_module_xpm ) );
msg = AddHotkeyName( _( "Duplicate Footprint" ), g_Board_Editor_Hokeys_Descr,
HK_DUPLICATE_ITEM );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DUPLICATE_ITEM,
msg, KiBitmap( duplicate_module_xpm ) );
msg = AddHotkeyName( _("Create Footprint Array" ), g_Board_Editor_Hokeys_Descr,
HK_CREATE_ARRAY );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_CREATE_ARRAY,
msg, KiBitmap( array_module_xpm ) );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EXCHANGE_FOOTPRINTS,
_( "Exchange Footprint(s)" ), KiBitmap( import_module_xpm ) );
}
}

View File

@ -61,6 +61,7 @@ enum pcbnew_ids
ID_POPUP_PCB_DELETE_MODULE,
ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE,
ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE,
ID_POPUP_PCB_EXCHANGE_FOOTPRINTS,
ID_POPUP_PCB_EDIT_PAD,
ID_POPUP_PCB_EDIT_MORE_PAD,

View File

@ -91,6 +91,7 @@ DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* parent, MODULE*
init();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Center();
}
@ -114,17 +115,17 @@ void DIALOG_EXCHANGE_MODULE::init()
{
SetFocus();
m_OldModule->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
m_NewModule->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
m_CurrValue->AppendText( m_currentModule->GetValue() );
m_CurrReference->AppendText( m_currentModule->GetReference() );
m_CurrentFootprintFPID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
m_NewFootprintFPID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
m_CmpValue->AppendText( m_currentModule->GetValue() );
m_CmpReference->AppendText( m_currentModule->GetReference() );
m_Selection->SetString( 0, wxString::Format(
_("Change footprint of '%s'" ),
GetChars( m_currentModule->GetReference() ) ) );
wxString fpname = m_OldModule->GetValue().AfterLast(':');
wxString fpname = m_CurrentFootprintFPID->GetValue().AfterLast(':');
if( fpname.IsEmpty() ) // Happens for old fp names
fpname = m_OldModule->GetValue();
fpname = m_CurrentFootprintFPID->GetValue();
m_Selection->SetString( 1, wxString::Format(
_("Change footprints '%s'" ),
@ -192,7 +193,7 @@ void DIALOG_EXCHANGE_MODULE::OnSelectionClicked( wxCommandEvent& event )
break;
}
m_NewModule->Enable( enable );
m_NewFootprintFPID->Enable( enable );
m_Browsebutton->Enable( enable );
}
@ -234,7 +235,7 @@ void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event )
*/
bool DIALOG_EXCHANGE_MODULE::changeCurrentFootprint()
{
wxString newmodulename = m_NewModule->GetValue();
wxString newmodulename = m_NewFootprintFPID->GetValue();
if( newmodulename == wxEmptyString )
return false;
@ -260,7 +261,7 @@ bool DIALOG_EXCHANGE_MODULE::changeSameFootprints( bool aUseValue )
MODULE* Module;
MODULE* PtBack;
bool change = false;
wxString newmodulename = m_NewModule->GetValue();
wxString newmodulename = m_NewFootprintFPID->GetValue();
wxString value;
FPID lib_reference;
bool check_module_value = false;
@ -483,9 +484,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
}
/*
* Displays the list of modules in library name and select a footprint.
*/
// Displays the list of available footprints in library name and select a footprint.
void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event )
{
wxString newname;
@ -494,13 +493,11 @@ void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event )
Prj().PcbFootprintLibs() );
if( newname != wxEmptyString )
m_NewModule->SetValue( newname );
m_NewFootprintFPID->SetValue( newname );
}
/*
* Displays the footprint viewer to select a footprint.
*/
// Runs the footprint viewer to select a footprint.
void DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint( wxCommandEvent& event )
{
wxString newname;
@ -509,7 +506,7 @@ void DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint( wxCommandEvent& event )
if( frame->ShowModal( &newname, this ) )
{
m_NewModule->SetValue( newname );
m_NewFootprintFPID->SetValue( newname );
}
frame->Destroy();