Commit e89db97d authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: footprint wizard dialogs: minor fixes, and fixes a not working...

Pcbnew: footprint wizard dialogs: minor fixes, and fixes a not working parmeters dialog under Windows, due to an incorrect Printf format.
parent c99243ff
...@@ -68,5 +68,10 @@ FOOTPRINT_WIZARD* DIALOG_FOOTPRINT_WIZARD_LIST::GetWizard() ...@@ -68,5 +68,10 @@ FOOTPRINT_WIZARD* DIALOG_FOOTPRINT_WIZARD_LIST::GetWizard()
void DIALOG_FOOTPRINT_WIZARD_LIST::OnOpenButtonClick( wxCommandEvent& event ) void DIALOG_FOOTPRINT_WIZARD_LIST::OnOpenButtonClick( wxCommandEvent& event )
{ {
Close(true); EndModal( wxID_OK );
}
void DIALOG_FOOTPRINT_WIZARD_LIST::OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
} }
...@@ -236,90 +236,28 @@ ...@@ -236,90 +236,28 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER|wxALL</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxStdDialogButtonSizer" expanded="1">
<property name="BottomDockable">1</property> <property name="Apply">0</property>
<property name="LeftDockable">1</property> <property name="Cancel">1</property>
<property name="RightDockable">1</property> <property name="ContextHelp">0</property>
<property name="TopDockable">1</property> <property name="Help">0</property>
<property name="aui_layer"></property> <property name="No">0</property>
<property name="aui_name"></property> <property name="OK">1</property>
<property name="aui_position"></property> <property name="Save">0</property>
<property name="aui_row"></property> <property name="Yes">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Open</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="name">m_sdbSizer</property>
<property name="name">m_btOpen</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pin_button">1</property> <event name="OnApplyButtonClick"></event>
<property name="pos"></property> <event name="OnCancelButtonClick">OnCancelClick</event>
<property name="resize">Resizable</property> <event name="OnContextHelpButtonClick"></event>
<property name="show">1</property> <event name="OnHelpButtonClick"></event>
<property name="size"></property> <event name="OnNoButtonClick"></event>
<property name="style"></property> <event name="OnOKButtonClick">OnOpenButtonClick</event>
<property name="subclass"></property> <event name="OnSaveButtonClick"></event>
<property name="toolbar_pane">0</property> <event name="OnYesButtonClick"></event>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOpenButtonClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
</object> </object>
......
...@@ -16,13 +16,13 @@ private: ...@@ -16,13 +16,13 @@ private:
public: public:
DIALOG_FOOTPRINT_WIZARD_LIST(wxWindow * parent ); DIALOG_FOOTPRINT_WIZARD_LIST(wxWindow * parent );
FOOTPRINT_WIZARD* GetWizard(); FOOTPRINT_WIZARD* GetWizard();
private: private:
void OnCellWizardClick( wxGridEvent& event ); void OnCellWizardClick( wxGridEvent& event );
void OnOpenButtonClick( wxCommandEvent& event ); void OnOpenButtonClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
}; };
#endif // _DIALOG_FOOTPRINT_WIZARD_LIST_H_ #endif // _DIALOG_FOOTPRINT_WIZARD_LIST_H_
...@@ -51,9 +51,14 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* ...@@ -51,9 +51,14 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
bSizerMain->Add( m_footprintWizardsGrid, 1, wxALL|wxEXPAND, 5 ); bSizerMain->Add( m_footprintWizardsGrid, 1, wxALL|wxEXPAND, 5 );
m_btOpen = new wxButton( this, wxID_ANY, _("Open"), wxDefaultPosition, wxDefaultSize, 0 ); m_sdbSizer = new wxStdDialogButtonSizer();
m_btOpen->SetDefault(); m_sdbSizerOK = new wxButton( this, wxID_OK );
bSizerMain->Add( m_btOpen, 0, wxALIGN_CENTER|wxALL, 5 ); m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND, 5 );
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
...@@ -63,13 +68,15 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* ...@@ -63,13 +68,15 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
// Connect Events // Connect Events
m_footprintWizardsGrid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellWizardClick ), NULL, this ); m_footprintWizardsGrid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellWizardClick ), NULL, this );
m_btOpen->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnOpenButtonClick ), NULL, this ); m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnOpenButtonClick ), NULL, this );
} }
DIALOG_FOOTPRINT_WIZARD_LIST_BASE::~DIALOG_FOOTPRINT_WIZARD_LIST_BASE() DIALOG_FOOTPRINT_WIZARD_LIST_BASE::~DIALOG_FOOTPRINT_WIZARD_LIST_BASE()
{ {
// Disconnect Events // Disconnect Events
m_footprintWizardsGrid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellWizardClick ), NULL, this ); m_footprintWizardsGrid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellWizardClick ), NULL, this );
m_btOpen->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnOpenButtonClick ), NULL, this ); m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnOpenButtonClick ), NULL, this );
} }
...@@ -20,8 +20,8 @@ class DIALOG_SHIM; ...@@ -20,8 +20,8 @@ class DIALOG_SHIM;
#include <wx/font.h> #include <wx/font.h>
#include <wx/grid.h> #include <wx/grid.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/button.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -36,10 +36,13 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM ...@@ -36,10 +36,13 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM
protected: protected:
wxGrid* m_footprintWizardsGrid; wxGrid* m_footprintWizardsGrid;
wxButton* m_btOpen; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCellWizardClick( wxGridEvent& event ) { event.Skip(); } virtual void OnCellWizardClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOpenButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOpenButtonClick( wxCommandEvent& event ) { event.Skip(); }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 30 2013) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -114,14 +114,14 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con ...@@ -114,14 +114,14 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
m_staticTextGrid1->Wrap( -1 ); m_staticTextGrid1->Wrap( -1 );
fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP, 5 ); fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP, 5 );
m_comboBoxGrid1 = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_comboBoxGrid1 = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
fgSizer3->Add( m_comboBoxGrid1, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); fgSizer3->Add( m_comboBoxGrid1, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
m_staticTextGrid2 = new wxStaticText( this, wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGrid2 = new wxStaticText( this, wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrid2->Wrap( -1 ); m_staticTextGrid2->Wrap( -1 );
fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 );
m_comboBoxGrid2 = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_comboBoxGrid2 = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
fgSizer3->Add( m_comboBoxGrid2, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); fgSizer3->Add( m_comboBoxGrid2, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
......
...@@ -1375,7 +1375,7 @@ ...@@ -1375,7 +1375,7 @@
<property name="selection">-1</property> <property name="selection">-1</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style">wxCB_READONLY</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
...@@ -1549,7 +1549,7 @@ ...@@ -1549,7 +1549,7 @@
<property name="selection">-1</property> <property name="selection">-1</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style">wxCB_READONLY</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 30 2013) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
......
...@@ -34,6 +34,7 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -34,6 +34,7 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
case ID_FOOTPRINT_WIZARD_NEXT: case ID_FOOTPRINT_WIZARD_NEXT:
m_PageList->SetSelection( m_PageList->GetSelection() + 1, true ); m_PageList->SetSelection( m_PageList->GetSelection() + 1, true );
ClickOnPageList( event );
break; break;
case ID_FOOTPRINT_WIZARD_PREVIOUS: case ID_FOOTPRINT_WIZARD_PREVIOUS:
...@@ -43,6 +44,7 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -43,6 +44,7 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event )
page = 0; page = 0;
m_PageList->SetSelection( page, true ); m_PageList->SetSelection( page, true );
ClickOnPageList( event );
break; break;
default: default:
...@@ -102,19 +104,20 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() ...@@ -102,19 +104,20 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
SetCurItem( NULL ); SetCurItem( NULL );
// Delete the current footprint // Delete the current footprint
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
MODULE* m = footprintWizard->GetModule();
if( m ) // Creates the module
MODULE* module = footprintWizard->GetModule();
if( module )
{ {
/* Here we should make a copy of the object before adding to board*/ // Add the object to board
m->SetParent( (EDA_ITEM*) GetBoard() ); module->SetParent( (EDA_ITEM*) GetBoard() );
GetBoard()->m_Modules.Append( m ); GetBoard()->m_Modules.Append( module );
wxPoint p( 0, 0 ); module->SetPosition( wxPoint( 0, 0 ) );
m->SetPosition( p );
} }
else else
{ {
printf( "footprintWizard->GetModule() returns NULL\n" ); D(printf( "footprintWizard->GetModule() returns NULL\n" );)
} }
m_canvas->Refresh(); m_canvas->Refresh();
...@@ -142,14 +145,12 @@ MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint() ...@@ -142,14 +145,12 @@ MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint()
{ {
FOOTPRINT_WIZARD* footprintWizard = FOOTPRINT_WIZARDS::GetWizard( m_wizardName ); FOOTPRINT_WIZARD* footprintWizard = FOOTPRINT_WIZARDS::GetWizard( m_wizardName );
if( footprintWizard ) if( footprintWizard && m_exportRequest )
{ {
return footprintWizard->GetModule(); return footprintWizard->GetModule();
} }
else
{ return NULL;
return NULL;
}
} }
...@@ -158,7 +159,8 @@ void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() ...@@ -158,7 +159,8 @@ void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
DIALOG_FOOTPRINT_WIZARD_LIST* selectWizard = DIALOG_FOOTPRINT_WIZARD_LIST* selectWizard =
new DIALOG_FOOTPRINT_WIZARD_LIST( this ); new DIALOG_FOOTPRINT_WIZARD_LIST( this );
selectWizard->ShowModal(); if( selectWizard->ShowModal() != wxID_OK )
return;
FOOTPRINT_WIZARD* footprintWizard = selectWizard->GetWizard(); FOOTPRINT_WIZARD* footprintWizard = selectWizard->GetWizard();
...@@ -225,14 +227,11 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) ...@@ -225,14 +227,11 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
dValue = dValue / 1000.0; dValue = dValue / 1000.0;
dValue = From_User_Unit( g_UserUnit, dValue ); dValue = From_User_Unit( g_UserUnit, dValue );
value.Printf( wxT( "%f" ), dValue );
value.Printf( wxT( "%lf" ), dValue );
} }
// If our locale is set to use , for decimal point, just change it // If our locale is set to use , for decimal point, just change it
// to be scripting compatible // to be scripting compatible
arr.Add( value ); arr.Add( value );
} }
......
...@@ -127,11 +127,12 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, ...@@ -127,11 +127,12 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
m_showAxis = true; // true to draw axis. m_showAxis = true; // true to draw axis.
// Give an icon // Give an icon
#if 1
// Disabled for now, it raises an assert error in wxwidgets // Disabled for now, it raises an assert error in wxwidgets
// wxIcon icon; wxIcon icon;
// icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) ); icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) );
// SetIcon( icon ); SetIcon( icon );
#endif
m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr; m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr;
m_PageList = NULL; m_PageList = NULL;
...@@ -140,6 +141,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, ...@@ -140,6 +141,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
m_ParameterGridWindow = NULL; m_ParameterGridWindow = NULL;
m_Semaphore = semaphore; m_Semaphore = semaphore;
m_wizardName.Empty(); m_wizardName.Empty();
m_exportRequest = false;
if( m_Semaphore ) if( m_Semaphore )
SetModalMode( true ); SetModalMode( true );
...@@ -199,11 +201,11 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, ...@@ -199,11 +201,11 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
// Columns // Columns
m_ParameterGrid->AutoSizeColumns(); m_ParameterGrid->AutoSizeColumns();
m_ParameterGrid->SetColLabelSize( 20 );
m_ParameterGrid->SetColLabelValue( 0, _( "Parameter" ) ); m_ParameterGrid->SetColLabelValue( 0, _( "Parameter" ) );
m_ParameterGrid->SetColLabelValue( 1, _( "Value" ) ); m_ParameterGrid->SetColLabelValue( 1, _( "Value" ) );
m_ParameterGrid->SetColLabelValue( 2, _( "Units" ) ); m_ParameterGrid->SetColLabelValue( 2, _( "Units" ) );
m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
m_ParameterGrid->AutoSizeColumns();
ReCreatePageList(); ReCreatePageList();
...@@ -293,14 +295,6 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME() ...@@ -293,14 +295,6 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME()
* *
*/ */
void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event ) void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
wxCommandEvent fakeEvent;
ExportSelectedFootprint( fakeEvent );
}
void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
{ {
SaveSettings(); SaveSettings();
...@@ -318,6 +312,13 @@ void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent ) ...@@ -318,6 +312,13 @@ void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
} }
void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
{
m_exportRequest = true;
Close();
}
/* Function OnSashDrag /* Function OnSashDrag
* handles the horizontal separator (sash) drag, updating the pagelist or parameter list * handles the horizontal separator (sash) drag, updating the pagelist or parameter list
*/ */
...@@ -450,10 +451,9 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() ...@@ -450,10 +451,9 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
m_ParameterGrid->DeleteRows( 0, m_ParameterGrid->GetNumberRows() ); m_ParameterGrid->DeleteRows( 0, m_ParameterGrid->GetNumberRows() );
m_ParameterGrid->AppendRows( fpList.size() ); m_ParameterGrid->AppendRows( fpList.size() );
wxString name, value, units;
for( unsigned int i = 0; i<fpList.size(); i++ ) for( unsigned int i = 0; i<fpList.size(); i++ )
{ {
wxString name, value, units;
name = fpList[i]; name = fpList[i];
value = fvList[i]; value = fvList[i];
...@@ -482,7 +482,8 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() ...@@ -482,7 +482,8 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
units = wxT( "mm" ); units = wxT( "mm" );
} }
value.Printf( wxT( "%lf" ), dValue ); std::string s = Double2Str( dValue );
value = FROM_UTF8( s.c_str() );
} }
else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N
{ {
...@@ -733,11 +734,11 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar() ...@@ -733,11 +734,11 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString, m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString,
KiBitmap( lib_previous_xpm ), KiBitmap( lib_previous_xpm ),
_( "Display previous page" ) ); _( "Select previous editable item" ) );
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_NEXT, wxEmptyString, m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_NEXT, wxEmptyString,
KiBitmap( lib_next_xpm ), KiBitmap( lib_next_xpm ),
_( "Display next page" ) ); _( "Select next editable item" ) );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, wxEmptyString, m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, wxEmptyString,
......
...@@ -47,7 +47,6 @@ class FOOTPRINT_EDIT_FRAME; ...@@ -47,7 +47,6 @@ class FOOTPRINT_EDIT_FRAME;
class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_FRAME class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_FRAME
{ {
private: private:
wxSashLayoutWindow* m_PageListWindow; // < List of libraries (for selection ) wxSashLayoutWindow* m_PageListWindow; // < List of libraries (for selection )
wxListBox* m_PageList; // < The list of pages wxListBox* m_PageList; // < The list of pages
wxSize m_PageListSize; // < size of the window wxSize m_PageListSize; // < size of the window
...@@ -55,15 +54,18 @@ private: ...@@ -55,15 +54,18 @@ private:
wxSashLayoutWindow* m_ParameterGridWindow; // < List of components in the selected library wxSashLayoutWindow* m_ParameterGridWindow; // < List of components in the selected library
wxGrid* m_ParameterGrid; // < The list of parameters wxGrid* m_ParameterGrid; // < The list of parameters
wxSize m_ParameterGridSize; // < size of the window wxSize m_ParameterGridSize; // < size of the window
// Flags // Flags
wxSemaphore* m_Semaphore; // < != NULL if the frame must emulate a modal dialog wxSemaphore* m_Semaphore; // < != NULL if the frame must emulate a modal dialog
wxString m_configPath; // < subpath for configuration wxString m_configPath; // < subpath for configuration
bool m_exportRequest; // < true if the current footprint should be exported
protected: protected:
wxString m_wizardName; // < name of the current wizard wxString m_wizardName; // < name of the current wizard
wxString m_wizardDescription; // < description of the wizard wxString m_wizardDescription; // < description of the wizard
wxString m_wizardStatus; // < current wizard status wxString m_wizardStatus; // < current wizard status
public: public:
FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
wxSemaphore* semaphore = NULL, wxSemaphore* semaphore = NULL,
......
...@@ -311,11 +311,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -311,11 +311,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_NEW_MODULE_FROM_WIZARD: case ID_MODEDIT_NEW_MODULE_FROM_WIZARD:
{ {
Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
SetCrossHairPosition( wxPoint( 0, 0 ) );
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore, FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT ); KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
...@@ -328,11 +323,17 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -328,11 +323,17 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
wxMilliSleep( 50 ); wxMilliSleep( 50 );
} }
// Creates the new footprint from python script wizard
MODULE* module = wizard->GetBuiltFootprint(); MODULE* module = wizard->GetBuiltFootprint();
if( module ) // i.e. if create module command not aborted if( module ) // i.e. if create module command not aborted
{ {
// Here we should make a copy of the object before adding to board Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
SetCrossHairPosition( wxPoint( 0, 0 ) );
// Add the new object to board
module->SetParent( (EDA_ITEM*)GetBoard() ); module->SetParent( (EDA_ITEM*)GetBoard() );
GetBoard()->m_Modules.Append( module ); GetBoard()->m_Modules.Append( module );
...@@ -342,9 +343,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -342,9 +343,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
GetBoard()->BuildListOfNets(); GetBoard()->BuildListOfNets();
redraw = true; redraw = true;
module->SetPosition( wxPoint( 0, 0 ) ); module->SetPosition( wxPoint( 0, 0 ) );
module->ClearFlags();
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
} }
wizard->Destroy(); wizard->Destroy();
......
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