Loading pcbnew/class_footprint_wizard.cpp +8 −12 Original line number Original line Diff line number Diff line Loading @@ -36,12 +36,8 @@ void FOOTPRINT_WIZARD::register_wizard() FOOTPRINT_WIZARDS::register_wizard( this ); FOOTPRINT_WIZARDS::register_wizard( this ); } } /** * FOOTPRINT_WIZARD system wide static list */ std::vector<FOOTPRINT_WIZARD*> FOOTPRINT_WIZARDS::m_FootprintWizards; std::vector<FOOTPRINT_WIZARD*> FOOTPRINT_WIZARDS::m_FootprintWizards; FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( int aIndex ) FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( int aIndex ) { { return m_FootprintWizards[aIndex]; return m_FootprintWizards[aIndex]; Loading pcbnew/class_footprint_wizard.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -134,6 +134,9 @@ public: class FOOTPRINT_WIZARDS class FOOTPRINT_WIZARDS { { private: private: /** * FOOTPRINT_WIZARD system wide static list */ static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards; static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards; public: public: Loading pcbnew/footprint_wizard.cpp +62 −53 Original line number Original line Diff line number Diff line Loading @@ -38,7 +38,10 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_FOOTPRINT_WIZARD_PREVIOUS: case ID_FOOTPRINT_WIZARD_PREVIOUS: page = m_PageList->GetSelection() - 1; page = m_PageList->GetSelection() - 1; if (page<0) page=0; if( page<0 ) page = 0; m_PageList->SetSelection( page, true ); m_PageList->SetSelection( page, true ); break; break; Loading @@ -50,6 +53,7 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event ) } } } } /* Function OnLeftClick /* Function OnLeftClick * Captures a left click event in the dialog * Captures a left click event in the dialog * * Loading @@ -58,6 +62,7 @@ void FOOTPRINT_WIZARD_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { { } } /* Function OnRightClick /* Function OnRightClick * Captures a right click event in the dialog * Captures a right click event in the dialog * * Loading Loading @@ -86,6 +91,7 @@ void FOOTPRINT_WIZARD_FRAME::DisplayWizardInfos() SetTitle( msg ); SetTitle( msg ); } } void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() { { if( m_FootprintWizard == NULL ) if( m_FootprintWizard == NULL ) Loading @@ -95,6 +101,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() // Delete the current footprint // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll(); MODULE* m = m_FootprintWizard->GetModule(); MODULE* m = m_FootprintWizard->GetModule(); if( m ) if( m ) { { /* Here we should make a copy of the object before adding to board*/ /* Here we should make a copy of the object before adding to board*/ Loading @@ -107,9 +114,11 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() { { printf( "m_FootprintWizard->GetModule() returns NULL\n" ); printf( "m_FootprintWizard->GetModule() returns NULL\n" ); } } m_canvas->Refresh(); m_canvas->Refresh(); } } MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint() MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint() { { if( m_FootprintWizard ) if( m_FootprintWizard ) Loading @@ -122,6 +131,7 @@ MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint() } } } } void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() { { DIALOG_FOOTPRINT_WIZARD_LIST* selectWizard = DIALOG_FOOTPRINT_WIZARD_LIST* selectWizard = Loading @@ -142,23 +152,21 @@ void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() DisplayWizardInfos(); DisplayWizardInfos(); ReCreatePageList(); ReCreatePageList(); ReCreateParameterList(); ReCreateParameterList(); } } void FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard( wxCommandEvent& event ) void FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard( wxCommandEvent& event ) { { SelectFootprintWizard(); SelectFootprintWizard(); } } /** /** * Function SelectCurrentFootprint * Function SelectCurrentFootprint * Selects the current footprint name and display it * Selects the current footprint name and display it */ */ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) { { int page = m_PageList->GetSelection(); int page = m_PageList->GetSelection(); if( page<0 ) if( page<0 ) Loading @@ -176,21 +184,23 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) // unit convert it back from the user format // unit convert it back from the user format if( ptList[i]==wxT( "IU" ) ) if( ptList[i]==wxT( "IU" ) ) { { LOCALE_IO toggle; double dValue; double dValue; value.ToDouble( &dValue ); value.ToDouble( &dValue ); // convert from mils to inches where it's needed // convert from mils to inches where it's needed if (g_UserUnit==INCHES) dValue = dValue / 1000.0; if( g_UserUnit==INCHES ) dValue = dValue / 1000.0; dValue = From_User_Unit( g_UserUnit, dValue ); dValue = From_User_Unit( g_UserUnit, dValue ); value.Printf( wxT( "%lf" ), 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 value.Replace( wxT( "," ), wxT( "." ) ); arr.Add( value ); arr.Add( value ); } } Loading @@ -199,7 +209,6 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) ReloadFootprint(); ReloadFootprint(); DisplayWizardInfos(); DisplayWizardInfos(); } } Loading pcbnew/footprint_wizard_frame.cpp +105 −95 Original line number Original line Diff line number Diff line Loading @@ -79,7 +79,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME ) /* listbox events */ /* listbox events */ EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList ) EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList ) EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST, FOOTPRINT_WIZARD_FRAME::ParametersUpdated ) EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST, FOOTPRINT_WIZARD_FRAME::ParametersUpdated ) EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset ) EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset ) END_EVENT_TABLE() END_EVENT_TABLE() Loading Loading @@ -203,7 +204,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); ReCreatePageList(); ReCreatePageList(); DisplayWizardInfos(); DisplayWizardInfos(); Loading Loading @@ -259,6 +259,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow ); wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow ); pane.MinSize( wxSize( m_PageListSize.x, -1 ) ); pane.MinSize( wxSize( m_PageListSize.x, -1 ) ); } } wxAuiPaneInfo& pane = m_auimgr.GetPane( m_ParameterGridWindow ); wxAuiPaneInfo& pane = m_auimgr.GetPane( m_ParameterGridWindow ); pane.MinSize( wxSize( m_ParameterGridSize.x, -1 ) ); pane.MinSize( wxSize( m_ParameterGridSize.x, -1 ) ); Loading Loading @@ -292,12 +293,13 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME() void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event ) void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event ) { { wxCommandEvent fakeEvent; wxCommandEvent fakeEvent; ExportSelectedFootprint( fakeEvent ); ExportSelectedFootprint( fakeEvent ); } } void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent ) void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent ) { { SaveSettings(); SaveSettings(); if( m_Semaphore ) if( m_Semaphore ) Loading @@ -311,8 +313,6 @@ void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent ) { { Destroy(); Destroy(); } } } } Loading @@ -330,6 +330,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event ) switch( event.GetId() ) switch( event.GetId() ) { { case ID_FOOTPRINT_WIZARD_WINDOW: case ID_FOOTPRINT_WIZARD_WINDOW: if( m_PageListWindow ) if( m_PageListWindow ) { { wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow ); wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow ); Loading @@ -337,6 +338,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event ) pane.MinSize( m_PageListSize ); pane.MinSize( m_PageListSize ); m_auimgr.Update(); m_auimgr.Update(); } } break; break; case ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW: case ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW: Loading @@ -363,6 +365,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv ) SizeEv.Skip(); SizeEv.Skip(); } } /* Function OnSetRelativeOffset /* Function OnSetRelativeOffset * Updates the cursor position and the status bar * Updates the cursor position and the status bar * * Loading @@ -373,6 +376,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) UpdateStatusBar(); UpdateStatusBar(); } } /* Function ReCreatePageList /* Function ReCreatePageList * It recreates the list of pages for a new loaded wizard * It recreates the list of pages for a new loaded wizard * * Loading @@ -387,6 +391,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList() m_PageList->Clear(); m_PageList->Clear(); int max_page = m_FootprintWizard->GetNumParameterPages(); int max_page = m_FootprintWizard->GetNumParameterPages(); for( int i = 0; i<max_page; i++ ) for( int i = 0; i<max_page; i++ ) { { wxString name = m_FootprintWizard->GetParameterPageName( i ); wxString name = m_FootprintWizard->GetParameterPageName( i ); Loading @@ -401,6 +406,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList() m_canvas->Refresh(); m_canvas->Refresh(); } } /* Function ReCreateParameterList /* Function ReCreateParameterList * It creates the parameter grid for a certain wizard page of the current wizard * It creates the parameter grid for a certain wizard page of the current wizard * * Loading Loading @@ -449,9 +455,12 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() if( ptList[i]==wxT( "IU" ) ) if( ptList[i]==wxT( "IU" ) ) { { LOCALE_IO toggle; // We are handling internal units, so convert them to the current // We are handling internal units, so convert them to the current // system selected units and store into value. // system selected units and store into value. double dValue; double dValue; value.ToDouble( &dValue ); value.ToDouble( &dValue ); dValue = To_User_Unit( g_UserUnit, dValue ); dValue = To_User_Unit( g_UserUnit, dValue ); Loading @@ -467,7 +476,6 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() } } value.Printf( wxT( "%lf" ), dValue ); value.Printf( wxT( "%lf" ), dValue ); value.Replace( wxT( "," ), wxT( "." ) ); } } else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N { { Loading @@ -480,7 +488,6 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() } } m_ParameterGrid->AutoSizeColumns(); m_ParameterGrid->AutoSizeColumns(); } } Loading @@ -497,7 +504,6 @@ void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event ) } } #define PARTLIST_WIDTH_KEY wxT( "Partlist_width" ) #define PARTLIST_WIDTH_KEY wxT( "Partlist_width" ) #define PARAMLIST_WIDTH_KEY wxT( "Paramlist_width" ) #define PARAMLIST_WIDTH_KEY wxT( "Paramlist_width" ) Loading @@ -509,6 +515,7 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( ) EDA_DRAW_FRAME::LoadSettings(); EDA_DRAW_FRAME::LoadSettings(); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); cfg = wxGetApp().GetSettings(); cfg = wxGetApp().GetSettings(); m_PageListSize.x = 150; // default width of libs list m_PageListSize.x = 150; // default width of libs list Loading @@ -523,7 +530,6 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( ) if( m_ParameterGridSize.x > m_FrameSize.x / 2 ) if( m_ParameterGridSize.x > m_FrameSize.x / 2 ) m_ParameterGridSize.x = m_FrameSize.x / 2; m_ParameterGridSize.x = m_FrameSize.x / 2; } } Loading @@ -534,6 +540,7 @@ void FOOTPRINT_WIZARD_FRAME::SaveSettings() EDA_DRAW_FRAME::SaveSettings(); EDA_DRAW_FRAME::SaveSettings(); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); cfg = wxGetApp().GetSettings(); cfg = wxGetApp().GetSettings(); if( m_PageListSize.x ) if( m_PageListSize.x ) Loading @@ -552,12 +559,12 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event ) return; return; bool footprintWizardsChanged = false; bool footprintWizardsChanged = false; if( footprintWizardsChanged ) if( footprintWizardsChanged ) { { // If we are here, the library list has changed, rebuild it // If we are here, the library list has changed, rebuild it ReCreatePageList(); ReCreatePageList(); DisplayWizardInfos(); DisplayWizardInfos(); } } } } Loading @@ -570,6 +577,7 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition wxPoint pos = aPosition; wxPoint pos = aPosition; wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); cmd.SetEventObject( this ); pos = screen->GetNearestGridPosition( pos ); pos = screen->GetNearestGridPosition( pos ); Loading Loading @@ -675,6 +683,7 @@ void FOOTPRINT_WIZARD_FRAME::Show3D_Frame( wxCommandEvent& event ) m_Draw3DFrame->Show( true ); m_Draw3DFrame->Show( true ); } } /** /** * Function Update3D_Frame * Function Update3D_Frame * must be called after a footprint selection * must be called after a footprint selection Loading @@ -692,6 +701,7 @@ void FOOTPRINT_WIZARD_FRAME::Update3D_Frame( bool aForceReloadFootprint ) if( aForceReloadFootprint ) if( aForceReloadFootprint ) { { m_Draw3DFrame->ReloadRequest(); m_Draw3DFrame->ReloadRequest(); // Force 3D screen refresh immediately // Force 3D screen refresh immediately if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules ) m_Draw3DFrame->NewDisplay(); m_Draw3DFrame->NewDisplay(); Loading Loading @@ -747,6 +757,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar() HK_ZOOM_AUTO, IS_COMMENT ); HK_ZOOM_AUTO, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); KiBitmap( zoom_fit_in_page_xpm ), msg ); if( m_Semaphore ) if( m_Semaphore ) { { // The library browser is called from a "load component" command // The library browser is called from a "load component" command Loading @@ -767,5 +778,4 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar() void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar() void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar() { { } } pcbnew/footprint_wizard_frame.h +47 −49 Original line number Original line Diff line number Diff line Loading @@ -62,12 +62,10 @@ private: wxString m_configPath; // < subpath for configuration wxString m_configPath; // < subpath for configuration FOOTPRINT_WIZARD* m_FootprintWizard; FOOTPRINT_WIZARD* m_FootprintWizard; 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, Loading @@ -80,6 +78,7 @@ public: private: private: void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event ); /** /** * Function ExportSelectedFootprint(); * Function ExportSelectedFootprint(); * will let the caller exit from the wait loop, and get the built footprint * will let the caller exit from the wait loop, and get the built footprint Loading Loading @@ -170,7 +169,6 @@ private: void ParametersUpdated( wxGridEvent& event ); void ParametersUpdated( wxGridEvent& event ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); /** /** Loading Loading
pcbnew/class_footprint_wizard.cpp +8 −12 Original line number Original line Diff line number Diff line Loading @@ -36,12 +36,8 @@ void FOOTPRINT_WIZARD::register_wizard() FOOTPRINT_WIZARDS::register_wizard( this ); FOOTPRINT_WIZARDS::register_wizard( this ); } } /** * FOOTPRINT_WIZARD system wide static list */ std::vector<FOOTPRINT_WIZARD*> FOOTPRINT_WIZARDS::m_FootprintWizards; std::vector<FOOTPRINT_WIZARD*> FOOTPRINT_WIZARDS::m_FootprintWizards; FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( int aIndex ) FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( int aIndex ) { { return m_FootprintWizards[aIndex]; return m_FootprintWizards[aIndex]; Loading
pcbnew/class_footprint_wizard.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -134,6 +134,9 @@ public: class FOOTPRINT_WIZARDS class FOOTPRINT_WIZARDS { { private: private: /** * FOOTPRINT_WIZARD system wide static list */ static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards; static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards; public: public: Loading
pcbnew/footprint_wizard.cpp +62 −53 Original line number Original line Diff line number Diff line Loading @@ -38,7 +38,10 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_FOOTPRINT_WIZARD_PREVIOUS: case ID_FOOTPRINT_WIZARD_PREVIOUS: page = m_PageList->GetSelection() - 1; page = m_PageList->GetSelection() - 1; if (page<0) page=0; if( page<0 ) page = 0; m_PageList->SetSelection( page, true ); m_PageList->SetSelection( page, true ); break; break; Loading @@ -50,6 +53,7 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event ) } } } } /* Function OnLeftClick /* Function OnLeftClick * Captures a left click event in the dialog * Captures a left click event in the dialog * * Loading @@ -58,6 +62,7 @@ void FOOTPRINT_WIZARD_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { { } } /* Function OnRightClick /* Function OnRightClick * Captures a right click event in the dialog * Captures a right click event in the dialog * * Loading Loading @@ -86,6 +91,7 @@ void FOOTPRINT_WIZARD_FRAME::DisplayWizardInfos() SetTitle( msg ); SetTitle( msg ); } } void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() { { if( m_FootprintWizard == NULL ) if( m_FootprintWizard == NULL ) Loading @@ -95,6 +101,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() // Delete the current footprint // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll(); MODULE* m = m_FootprintWizard->GetModule(); MODULE* m = m_FootprintWizard->GetModule(); if( m ) if( m ) { { /* Here we should make a copy of the object before adding to board*/ /* Here we should make a copy of the object before adding to board*/ Loading @@ -107,9 +114,11 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() { { printf( "m_FootprintWizard->GetModule() returns NULL\n" ); printf( "m_FootprintWizard->GetModule() returns NULL\n" ); } } m_canvas->Refresh(); m_canvas->Refresh(); } } MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint() MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint() { { if( m_FootprintWizard ) if( m_FootprintWizard ) Loading @@ -122,6 +131,7 @@ MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint() } } } } void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() { { DIALOG_FOOTPRINT_WIZARD_LIST* selectWizard = DIALOG_FOOTPRINT_WIZARD_LIST* selectWizard = Loading @@ -142,23 +152,21 @@ void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() DisplayWizardInfos(); DisplayWizardInfos(); ReCreatePageList(); ReCreatePageList(); ReCreateParameterList(); ReCreateParameterList(); } } void FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard( wxCommandEvent& event ) void FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard( wxCommandEvent& event ) { { SelectFootprintWizard(); SelectFootprintWizard(); } } /** /** * Function SelectCurrentFootprint * Function SelectCurrentFootprint * Selects the current footprint name and display it * Selects the current footprint name and display it */ */ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) { { int page = m_PageList->GetSelection(); int page = m_PageList->GetSelection(); if( page<0 ) if( page<0 ) Loading @@ -176,21 +184,23 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) // unit convert it back from the user format // unit convert it back from the user format if( ptList[i]==wxT( "IU" ) ) if( ptList[i]==wxT( "IU" ) ) { { LOCALE_IO toggle; double dValue; double dValue; value.ToDouble( &dValue ); value.ToDouble( &dValue ); // convert from mils to inches where it's needed // convert from mils to inches where it's needed if (g_UserUnit==INCHES) dValue = dValue / 1000.0; if( g_UserUnit==INCHES ) dValue = dValue / 1000.0; dValue = From_User_Unit( g_UserUnit, dValue ); dValue = From_User_Unit( g_UserUnit, dValue ); value.Printf( wxT( "%lf" ), 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 value.Replace( wxT( "," ), wxT( "." ) ); arr.Add( value ); arr.Add( value ); } } Loading @@ -199,7 +209,6 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) ReloadFootprint(); ReloadFootprint(); DisplayWizardInfos(); DisplayWizardInfos(); } } Loading
pcbnew/footprint_wizard_frame.cpp +105 −95 Original line number Original line Diff line number Diff line Loading @@ -79,7 +79,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME ) /* listbox events */ /* listbox events */ EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList ) EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList ) EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST, FOOTPRINT_WIZARD_FRAME::ParametersUpdated ) EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST, FOOTPRINT_WIZARD_FRAME::ParametersUpdated ) EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset ) EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset ) END_EVENT_TABLE() END_EVENT_TABLE() Loading Loading @@ -203,7 +204,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); m_ParameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); ReCreatePageList(); ReCreatePageList(); DisplayWizardInfos(); DisplayWizardInfos(); Loading Loading @@ -259,6 +259,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow ); wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow ); pane.MinSize( wxSize( m_PageListSize.x, -1 ) ); pane.MinSize( wxSize( m_PageListSize.x, -1 ) ); } } wxAuiPaneInfo& pane = m_auimgr.GetPane( m_ParameterGridWindow ); wxAuiPaneInfo& pane = m_auimgr.GetPane( m_ParameterGridWindow ); pane.MinSize( wxSize( m_ParameterGridSize.x, -1 ) ); pane.MinSize( wxSize( m_ParameterGridSize.x, -1 ) ); Loading Loading @@ -292,12 +293,13 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME() void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event ) void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event ) { { wxCommandEvent fakeEvent; wxCommandEvent fakeEvent; ExportSelectedFootprint( fakeEvent ); ExportSelectedFootprint( fakeEvent ); } } void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent ) void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent ) { { SaveSettings(); SaveSettings(); if( m_Semaphore ) if( m_Semaphore ) Loading @@ -311,8 +313,6 @@ void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent ) { { Destroy(); Destroy(); } } } } Loading @@ -330,6 +330,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event ) switch( event.GetId() ) switch( event.GetId() ) { { case ID_FOOTPRINT_WIZARD_WINDOW: case ID_FOOTPRINT_WIZARD_WINDOW: if( m_PageListWindow ) if( m_PageListWindow ) { { wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow ); wxAuiPaneInfo& pane = m_auimgr.GetPane( m_PageListWindow ); Loading @@ -337,6 +338,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSashDrag( wxSashEvent& event ) pane.MinSize( m_PageListSize ); pane.MinSize( m_PageListSize ); m_auimgr.Update(); m_auimgr.Update(); } } break; break; case ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW: case ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW: Loading @@ -363,6 +365,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv ) SizeEv.Skip(); SizeEv.Skip(); } } /* Function OnSetRelativeOffset /* Function OnSetRelativeOffset * Updates the cursor position and the status bar * Updates the cursor position and the status bar * * Loading @@ -373,6 +376,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) UpdateStatusBar(); UpdateStatusBar(); } } /* Function ReCreatePageList /* Function ReCreatePageList * It recreates the list of pages for a new loaded wizard * It recreates the list of pages for a new loaded wizard * * Loading @@ -387,6 +391,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList() m_PageList->Clear(); m_PageList->Clear(); int max_page = m_FootprintWizard->GetNumParameterPages(); int max_page = m_FootprintWizard->GetNumParameterPages(); for( int i = 0; i<max_page; i++ ) for( int i = 0; i<max_page; i++ ) { { wxString name = m_FootprintWizard->GetParameterPageName( i ); wxString name = m_FootprintWizard->GetParameterPageName( i ); Loading @@ -401,6 +406,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList() m_canvas->Refresh(); m_canvas->Refresh(); } } /* Function ReCreateParameterList /* Function ReCreateParameterList * It creates the parameter grid for a certain wizard page of the current wizard * It creates the parameter grid for a certain wizard page of the current wizard * * Loading Loading @@ -449,9 +455,12 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() if( ptList[i]==wxT( "IU" ) ) if( ptList[i]==wxT( "IU" ) ) { { LOCALE_IO toggle; // We are handling internal units, so convert them to the current // We are handling internal units, so convert them to the current // system selected units and store into value. // system selected units and store into value. double dValue; double dValue; value.ToDouble( &dValue ); value.ToDouble( &dValue ); dValue = To_User_Unit( g_UserUnit, dValue ); dValue = To_User_Unit( g_UserUnit, dValue ); Loading @@ -467,7 +476,6 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() } } value.Printf( wxT( "%lf" ), dValue ); value.Printf( wxT( "%lf" ), dValue ); value.Replace( wxT( "," ), wxT( "." ) ); } } else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N { { Loading @@ -480,7 +488,6 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() } } m_ParameterGrid->AutoSizeColumns(); m_ParameterGrid->AutoSizeColumns(); } } Loading @@ -497,7 +504,6 @@ void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event ) } } #define PARTLIST_WIDTH_KEY wxT( "Partlist_width" ) #define PARTLIST_WIDTH_KEY wxT( "Partlist_width" ) #define PARAMLIST_WIDTH_KEY wxT( "Paramlist_width" ) #define PARAMLIST_WIDTH_KEY wxT( "Paramlist_width" ) Loading @@ -509,6 +515,7 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( ) EDA_DRAW_FRAME::LoadSettings(); EDA_DRAW_FRAME::LoadSettings(); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); cfg = wxGetApp().GetSettings(); cfg = wxGetApp().GetSettings(); m_PageListSize.x = 150; // default width of libs list m_PageListSize.x = 150; // default width of libs list Loading @@ -523,7 +530,6 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( ) if( m_ParameterGridSize.x > m_FrameSize.x / 2 ) if( m_ParameterGridSize.x > m_FrameSize.x / 2 ) m_ParameterGridSize.x = m_FrameSize.x / 2; m_ParameterGridSize.x = m_FrameSize.x / 2; } } Loading @@ -534,6 +540,7 @@ void FOOTPRINT_WIZARD_FRAME::SaveSettings() EDA_DRAW_FRAME::SaveSettings(); EDA_DRAW_FRAME::SaveSettings(); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); cfg = wxGetApp().GetSettings(); cfg = wxGetApp().GetSettings(); if( m_PageListSize.x ) if( m_PageListSize.x ) Loading @@ -552,12 +559,12 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event ) return; return; bool footprintWizardsChanged = false; bool footprintWizardsChanged = false; if( footprintWizardsChanged ) if( footprintWizardsChanged ) { { // If we are here, the library list has changed, rebuild it // If we are here, the library list has changed, rebuild it ReCreatePageList(); ReCreatePageList(); DisplayWizardInfos(); DisplayWizardInfos(); } } } } Loading @@ -570,6 +577,7 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition wxPoint pos = aPosition; wxPoint pos = aPosition; wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); cmd.SetEventObject( this ); pos = screen->GetNearestGridPosition( pos ); pos = screen->GetNearestGridPosition( pos ); Loading Loading @@ -675,6 +683,7 @@ void FOOTPRINT_WIZARD_FRAME::Show3D_Frame( wxCommandEvent& event ) m_Draw3DFrame->Show( true ); m_Draw3DFrame->Show( true ); } } /** /** * Function Update3D_Frame * Function Update3D_Frame * must be called after a footprint selection * must be called after a footprint selection Loading @@ -692,6 +701,7 @@ void FOOTPRINT_WIZARD_FRAME::Update3D_Frame( bool aForceReloadFootprint ) if( aForceReloadFootprint ) if( aForceReloadFootprint ) { { m_Draw3DFrame->ReloadRequest(); m_Draw3DFrame->ReloadRequest(); // Force 3D screen refresh immediately // Force 3D screen refresh immediately if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules ) m_Draw3DFrame->NewDisplay(); m_Draw3DFrame->NewDisplay(); Loading Loading @@ -747,6 +757,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar() HK_ZOOM_AUTO, IS_COMMENT ); HK_ZOOM_AUTO, IS_COMMENT ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); KiBitmap( zoom_fit_in_page_xpm ), msg ); if( m_Semaphore ) if( m_Semaphore ) { { // The library browser is called from a "load component" command // The library browser is called from a "load component" command Loading @@ -767,5 +778,4 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar() void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar() void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar() { { } }
pcbnew/footprint_wizard_frame.h +47 −49 Original line number Original line Diff line number Diff line Loading @@ -62,12 +62,10 @@ private: wxString m_configPath; // < subpath for configuration wxString m_configPath; // < subpath for configuration FOOTPRINT_WIZARD* m_FootprintWizard; FOOTPRINT_WIZARD* m_FootprintWizard; 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, Loading @@ -80,6 +78,7 @@ public: private: private: void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event ); /** /** * Function ExportSelectedFootprint(); * Function ExportSelectedFootprint(); * will let the caller exit from the wait loop, and get the built footprint * will let the caller exit from the wait loop, and get the built footprint Loading Loading @@ -170,7 +169,6 @@ private: void ParametersUpdated( wxGridEvent& event ); void ParametersUpdated( wxGridEvent& event ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); /** /** Loading