Allow editing of library footprint from board reference.

This commit is contained in:
Jeff Young 2018-10-15 15:28:53 +01:00
parent 906c08afc6
commit 0585382986
9 changed files with 5629 additions and 5966 deletions

View File

@ -181,7 +181,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR()
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& )
void DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint( wxCommandEvent& )
{
if( m_footprint->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
{
@ -189,7 +189,13 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& )
m_frame->OnModify();
}
EndModal( PRM_EDITOR_WANT_MODEDIT );
EndModal( PRM_EDITOR_EDIT_BOARD_FOOTPRINT );
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::EditLibraryFootprint( wxCommandEvent& )
{
EndModal( PRM_EDITOR_EDIT_LIBRARY_FOOTPRINT );
}

View File

@ -30,10 +30,14 @@
#include <dialog_edit_footprint_for_BoardEditor_base.h>
#include <wx/valnum.h>
#include <text_mod_grid_table.h>
#include <class_module.h>
#include <widgets/unit_binder.h>
class PCB_EDIT_FRAME;
class PANEL_PREV_3D;
class DIALOG_FOOTPRINT_BOARD_EDITOR: public DIALOG_FOOTPRINT_BOARD_EDITOR_BASE
{
private:
@ -71,7 +75,8 @@ public:
PRM_EDITOR_WANT_UPDATE_FP,
PRM_EDITOR_WANT_EXCHANGE_FP,
PRM_EDITOR_EDIT_OK,
PRM_EDITOR_WANT_MODEDIT
PRM_EDITOR_EDIT_BOARD_FOOTPRINT,
PRM_EDITOR_EDIT_LIBRARY_FOOTPRINT
};
public:
@ -91,7 +96,8 @@ private:
void OnRemove3DModel( wxCommandEvent& ) override;
void OnAdd3DModel( wxCommandEvent& ) override;
void OnAdd3DRow( wxCommandEvent& ) override;
void GotoModuleEditor( wxCommandEvent& ) override;
void EditFootprint( wxCommandEvent& ) override;
void EditLibraryFootprint( wxCommandEvent& ) override;
void UpdateModule( wxCommandEvent& ) override;
void ExchangeModule( wxCommandEvent& ) override;
void ModuleOrientEvent( wxCommandEvent& ) override;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 2 2018)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -81,7 +81,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
wxBoxSizer* bButtonSize;
bButtonSize = new wxBoxSizer( wxHORIZONTAL );
m_bpAdd = new wxBitmapButton( sbSizerTexts->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpAdd = new wxBitmapButton( sbSizerTexts->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_bpAdd->SetMinSize( wxSize( 30,29 ) );
bButtonSize->Add( m_bpAdd, 0, wxRIGHT, 5 );
@ -89,7 +89,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
bButtonSize->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_bpDelete = new wxBitmapButton( sbSizerTexts->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpDelete = new wxBitmapButton( sbSizerTexts->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_bpDelete->SetMinSize( wxSize( 30,29 ) );
bButtonSize->Add( m_bpDelete, 0, wxRIGHT|wxLEFT, 5 );
@ -257,10 +257,16 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
m_buttonExchange = new wxButton( m_PanelGeneral, ID_MODULE_PROPERTIES_EXCHANGE, _("Change Footprint..."), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_buttonExchange, 0, wxEXPAND|wxALL, 5 );
m_buttonModuleEditor = new wxButton( m_PanelGeneral, ID_GOTO_MODULE_EDITOR, _("Footprint Editor..."), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonModuleEditor = new wxButton( m_PanelGeneral, ID_EDIT_FOOTPRINT, _("Edit Footprint..."), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_buttonModuleEditor, 0, wxEXPAND|wxALL, 5 );
bButtonsSizer->Add( 0, 15, 1, wxEXPAND, 5 );
m_button5 = new wxButton( m_PanelGeneral, ID_EDIT_LIBRARY_FOOTPRINT, _("Edit Library Footprint..."), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_button5, 0, wxALL|wxEXPAND, 5 );
bSizerRight->Add( bButtonsSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -440,12 +446,12 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
wxBoxSizer* bSizer3DButtons;
bSizer3DButtons = new wxBoxSizer( wxHORIZONTAL );
m_buttonAdd = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
m_buttonAdd = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_buttonAdd->SetMinSize( wxSize( 30,29 ) );
bSizer3DButtons->Add( m_buttonAdd, 0, wxTOP, 5 );
m_buttonBrowse = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
m_buttonBrowse = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_buttonBrowse->SetMinSize( wxSize( 30,29 ) );
bSizer3DButtons->Add( m_buttonBrowse, 0, wxALL, 5 );
@ -453,7 +459,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
bSizer3DButtons->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_buttonRemove = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
m_buttonRemove = new wxBitmapButton( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_buttonRemove->SetMinSize( wxSize( 30,29 ) );
bSizer3DButtons->Add( m_buttonRemove, 0, wxTOP|wxLEFT, 5 );
@ -537,7 +543,8 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
m_OrientValueCtrl->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnOtherOrientation ), NULL, this );
m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::UpdateModule ), NULL, this );
m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this );
m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this );
m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::EditFootprint ), NULL, this );
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::EditLibraryFootprint ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::On3DModelSelected ), NULL, this );
m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnAdd3DRow ), NULL, this );
@ -562,7 +569,8 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::~DIALOG_FOOTPRINT_BOARD_EDITOR_BASE()
m_OrientValueCtrl->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnOtherOrientation ), NULL, this );
m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::UpdateModule ), NULL, this );
m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this );
m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this );
m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::EditFootprint ), NULL, this );
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::EditLibraryFootprint ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::On3DModelSelected ), NULL, this );
m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnAdd3DRow ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 2 2018)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -21,10 +21,10 @@ class WX_GRID;
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
@ -44,7 +44,8 @@ class WX_GRID;
#define ID_NOTEBOOK 1000
#define ID_MODULE_PROPERTIES_UPDATE 1001
#define ID_MODULE_PROPERTIES_EXCHANGE 1002
#define ID_GOTO_MODULE_EDITOR 1003
#define ID_EDIT_FOOTPRINT 1003
#define ID_EDIT_LIBRARY_FOOTPRINT 1004
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE
@ -86,6 +87,7 @@ class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE : public DIALOG_SHIM
wxButton* m_buttonUpdate;
wxButton* m_buttonExchange;
wxButton* m_buttonModuleEditor;
wxButton* m_button5;
wxRadioBox* m_AttributsCtrl;
wxPanel* m_PanelClearances;
wxStaticText* m_staticTextInfo;
@ -130,7 +132,8 @@ class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE : public DIALOG_SHIM
virtual void OnOtherOrientation( wxKeyEvent& event ) { event.Skip(); }
virtual void UpdateModule( wxCommandEvent& event ) { event.Skip(); }
virtual void ExchangeModule( wxCommandEvent& event ) { event.Skip(); }
virtual void GotoModuleEditor( wxCommandEvent& event ) { event.Skip(); }
virtual void EditFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void EditLibraryFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void On3DModelCellChanged( wxGridEvent& event ) { event.Skip(); }
virtual void On3DModelSelected( wxGridEvent& event ) { event.Skip(); }
virtual void OnAdd3DRow( wxCommandEvent& event ) { event.Skip(); }

View File

@ -221,6 +221,8 @@ public:
*/
void LoadModuleFromBoard( wxCommandEvent& event );
void LoadModuleFromLibrary( LIB_ID aFPID );
/**
* Returns the adapter object that provides the stored data.
*/

View File

@ -177,13 +177,55 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
void FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard( wxCommandEvent& event )
{
if( ! Load_Module_From_BOARD( NULL ) )
Load_Module_From_BOARD( NULL );
}
void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID)
{
MODULE* module = LoadFootprint( aFPID );
if( !module )
return;
GetScreen()->ClearUndoRedoList();
GetScreen()->ClrModify();
if( !Clear_Pcb( true ) )
return;
SetCrossHairPosition( wxPoint( 0, 0 ) );
AddModuleToBoard( module );
if( GetBoard()->m_Modules )
{
GetBoard()->m_Modules->ClearFlags();
// if either m_Reference or m_Value are gone, reinstall them -
// otherwise you cannot see what you are doing on board
TEXTE_MODULE* ref = &GetBoard()->m_Modules->Reference();
TEXTE_MODULE* val = &GetBoard()->m_Modules->Value();
if( val && ref )
{
ref->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); // just in case ...
if( ref->GetLength() == 0 )
ref->SetText( wxT( "Ref**" ) );
val->SetType( TEXTE_MODULE::TEXT_is_VALUE ); // just in case ...
if( val->GetLength() == 0 )
val->SetText( wxT( "Val**" ) );
}
}
Zoom_Automatique( false );
Update3DView();
GetScreen()->ClrModify();
updateView();
m_canvas->Refresh();
m_treePane->GetLibTree()->Refresh();
}
@ -536,52 +578,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_MODEDIT_EDIT_MODULE:
{
LIB_ID partId = m_treePane->GetLibTree()->GetSelectedLibId();
MODULE* module = LoadFootprint( partId );
if( !module )
break;
if( !Clear_Pcb( true ) )
break;
SetCrossHairPosition( wxPoint( 0, 0 ) );
AddModuleToBoard( module );
if( GetBoard()->m_Modules )
{
GetBoard()->m_Modules->ClearFlags();
// if either m_Reference or m_Value are gone, reinstall them -
// otherwise you cannot see what you are doing on board
TEXTE_MODULE* ref = &GetBoard()->m_Modules->Reference();
TEXTE_MODULE* val = &GetBoard()->m_Modules->Value();
if( val && ref )
{
ref->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); // just in case ...
if( ref->GetLength() == 0 )
ref->SetText( wxT( "Ref**" ) );
val->SetType( TEXTE_MODULE::TEXT_is_VALUE ); // just in case ...
if( val->GetLength() == 0 )
val->SetText( wxT( "Val**" ) );
}
}
Zoom_Automatique( false );
Update3DView();
GetScreen()->ClrModify();
updateView();
m_canvas->Refresh();
m_treePane->GetLibTree()->Refresh();
}
LoadModuleFromLibrary( m_treePane->GetLibTree()->GetSelectedLibId() );
break;
case ID_MODEDIT_PAD_SETTINGS:

View File

@ -102,7 +102,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
if( ! frame->GetBoard() || ! frame->GetBoard()->m_Modules )
return false;
aModule = SelectFootprintFromBoard( frame->GetBoard());
aModule = SelectFootprintFromBoard( frame->GetBoard() );
}
if( aModule == NULL )
@ -149,6 +149,8 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
GetScreen()->ClearUndoRedoList();
GetScreen()->ClrModify();
Update3DView();
if( IsGalCanvasActive() )
updateView();
m_canvas->Refresh();

View File

@ -1278,7 +1278,7 @@ void PCB_EDIT_FRAME::InstallFootprintPropertiesDialog( MODULE* Module, wxDC* DC
m_canvas->Refresh();
#endif
if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_MODEDIT )
else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_EDIT_BOARD_FOOTPRINT )
{
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
@ -1289,12 +1289,23 @@ void PCB_EDIT_FRAME::InstallFootprintPropertiesDialog( MODULE* Module, wxDC* DC
editor->Raise(); // Iconize( false );
}
if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_UPDATE_FP )
else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_EDIT_LIBRARY_FOOTPRINT )
{
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
editor->LoadModuleFromLibrary( Module->GetFPID() );
SetCurItem( NULL );
editor->Show( true );
editor->Raise(); // Iconize( false );
}
else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_UPDATE_FP )
{
InstallExchangeModuleFrame( Module, true );
}
if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP )
else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP )
{
InstallExchangeModuleFrame( Module, false );
}