Loading cvpcb/class_DisplayFootprintsFrame.cpp +3 −8 Original line number Diff line number Diff line Loading @@ -70,15 +70,13 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode ) END_EVENT_TABLE() #define DISPLAY_FOOTPRINTS_FRAME_NAME wxT( "CmpFrame" ) DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ) : PCB_BASE_FRAME( aKiway, aParent, CVPCB_DISPLAY_FRAME_TYPE, _( "Module" ), PCB_BASE_FRAME( aKiway, aParent, CVPCB_DISPLAY_FRAME_TYPE, _( "Footprint Viewer" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, DISPLAY_FOOTPRINTS_FRAME_NAME ) KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME ) { m_FrameName = DISPLAY_FOOTPRINTS_FRAME_NAME; m_FrameName = FOOTPRINTVIEWER_FRAME_NAME; m_showAxis = true; // true to draw axis. // Give an icon Loading Loading @@ -147,9 +145,6 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME() { delete GetScreen(); SetScreen( NULL ); // Be sure there is no double deletion // a crash would be better than this uncommented: // ( (CVPCB_MAINFRAME*) Pgm().GetTopWindow() )->m_DisplayFootprintFrame = NULL; } Loading cvpcb/class_DisplayFootprintsFrame.h +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #include <wxBasePcbFrame.h> // The name (for wxWidgets) of the footprint viewer frame #define FOOTPRINTVIEWER_FRAME_NAME wxT( "FootprintViewerFrame" ) class CVPCB_MAINFRAME; Loading cvpcb/class_footprints_listbox.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event ) return; // If the footprint view window is displayed, update the footprint. if( GetParent()->m_DisplayFootprintFrame ) if( GetParent()->GetFpViewerFrame() ) GetParent()->CreateScreenCmp(); GetParent()->DisplayStatus(); Loading cvpcb/cvframe.cpp +24 −14 Original line number Diff line number Diff line Loading @@ -114,7 +114,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : m_ListCmp = NULL; m_FootprintList = NULL; m_LibraryList = NULL; m_DisplayFootprintFrame = NULL; m_mainToolBar = NULL; m_modified = false; m_isEESchemaNetlist = false; Loading Loading @@ -315,8 +314,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) } // Close module display frame if( m_DisplayFootprintFrame ) m_DisplayFootprintFrame->Close( true ); if( GetFpViewerFrame() ) GetFpViewerFrame()->Close( true ); m_modified = false; Loading Loading @@ -562,7 +561,7 @@ void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event ) void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event ) { CreateScreenCmp(); m_DisplayFootprintFrame->RedrawScreen( wxPoint( 0, 0 ), false ); GetFpViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false ); } Loading Loading @@ -601,6 +600,8 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter ); // Tell AuiMgr that objects are changed ! if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized // (could be not the case when starting CvPcb m_auimgr.Update(); if( component == NULL ) Loading Loading @@ -640,7 +641,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) if ( ii >= 0 ) m_FootprintList->SetSelection( ii, false ); if( m_DisplayFootprintFrame ) if( GetFpViewerFrame() ) { CreateScreenCmp(); } Loading Loading @@ -919,15 +920,17 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName ) void CVPCB_MAINFRAME::CreateScreenCmp() { if( !m_DisplayFootprintFrame ) DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFpViewerFrame(); if( !fpframe ) { m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this ); m_DisplayFootprintFrame->Show( true ); fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this ); fpframe->Show( true ); } else { if( m_DisplayFootprintFrame->IsIconized() ) m_DisplayFootprintFrame->Iconize( false ); if( fpframe->IsIconized() ) fpframe->Iconize( false ); // The display footprint window might be buried under some other // windows, so CreateScreenCmp() on an existing window would not Loading @@ -935,11 +938,11 @@ void CVPCB_MAINFRAME::CreateScreenCmp() // So we want to put it to front, second after our CVPCB_MAINFRAME. // We do this by a little dance of bringing it to front then the main // frame back. m_DisplayFootprintFrame->Raise(); // Make sure that is visible. fpframe->Raise(); // Make sure that is visible. Raise(); // .. but still we want the focus. } m_DisplayFootprintFrame->InitDisplay(); fpframe->InitDisplay(); } Loading Loading @@ -1049,3 +1052,10 @@ COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent() return NULL; } DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFpViewerFrame() { // returns the Footprint Viewer frame, if exists, or NULL return (DISPLAY_FOOTPRINTS_FRAME*) wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ); } cvpcb/cvpcb_mainframe.h +5 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,6 @@ public: FOOTPRINTS_LISTBOX* m_FootprintList; LIBRARY_LISTBOX* m_LibraryList; COMPONENTS_LISTBOX* m_ListCmp; DISPLAY_FOOTPRINTS_FRAME* m_DisplayFootprintFrame; wxAuiToolBar* m_mainToolBar; wxFileName m_NetlistFileName; wxArrayString m_ModuleLibNames; Loading Loading @@ -95,6 +94,11 @@ public: */ FP_LIB_TABLE* FootprintLibs() const; /** * @return a pointer on the Footprint Viewer frame, if exists, or NULL */ DISPLAY_FOOTPRINTS_FRAME* GetFpViewerFrame(); /** * Function OnSelectComponent * Called when clicking on a component in component list window Loading Loading
cvpcb/class_DisplayFootprintsFrame.cpp +3 −8 Original line number Diff line number Diff line Loading @@ -70,15 +70,13 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode ) END_EVENT_TABLE() #define DISPLAY_FOOTPRINTS_FRAME_NAME wxT( "CmpFrame" ) DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ) : PCB_BASE_FRAME( aKiway, aParent, CVPCB_DISPLAY_FRAME_TYPE, _( "Module" ), PCB_BASE_FRAME( aKiway, aParent, CVPCB_DISPLAY_FRAME_TYPE, _( "Footprint Viewer" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, DISPLAY_FOOTPRINTS_FRAME_NAME ) KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME ) { m_FrameName = DISPLAY_FOOTPRINTS_FRAME_NAME; m_FrameName = FOOTPRINTVIEWER_FRAME_NAME; m_showAxis = true; // true to draw axis. // Give an icon Loading Loading @@ -147,9 +145,6 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME() { delete GetScreen(); SetScreen( NULL ); // Be sure there is no double deletion // a crash would be better than this uncommented: // ( (CVPCB_MAINFRAME*) Pgm().GetTopWindow() )->m_DisplayFootprintFrame = NULL; } Loading
cvpcb/class_DisplayFootprintsFrame.h +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #include <wxBasePcbFrame.h> // The name (for wxWidgets) of the footprint viewer frame #define FOOTPRINTVIEWER_FRAME_NAME wxT( "FootprintViewerFrame" ) class CVPCB_MAINFRAME; Loading
cvpcb/class_footprints_listbox.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event ) return; // If the footprint view window is displayed, update the footprint. if( GetParent()->m_DisplayFootprintFrame ) if( GetParent()->GetFpViewerFrame() ) GetParent()->CreateScreenCmp(); GetParent()->DisplayStatus(); Loading
cvpcb/cvframe.cpp +24 −14 Original line number Diff line number Diff line Loading @@ -114,7 +114,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : m_ListCmp = NULL; m_FootprintList = NULL; m_LibraryList = NULL; m_DisplayFootprintFrame = NULL; m_mainToolBar = NULL; m_modified = false; m_isEESchemaNetlist = false; Loading Loading @@ -315,8 +314,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) } // Close module display frame if( m_DisplayFootprintFrame ) m_DisplayFootprintFrame->Close( true ); if( GetFpViewerFrame() ) GetFpViewerFrame()->Close( true ); m_modified = false; Loading Loading @@ -562,7 +561,7 @@ void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event ) void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event ) { CreateScreenCmp(); m_DisplayFootprintFrame->RedrawScreen( wxPoint( 0, 0 ), false ); GetFpViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false ); } Loading Loading @@ -601,6 +600,8 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter ); // Tell AuiMgr that objects are changed ! if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized // (could be not the case when starting CvPcb m_auimgr.Update(); if( component == NULL ) Loading Loading @@ -640,7 +641,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) if ( ii >= 0 ) m_FootprintList->SetSelection( ii, false ); if( m_DisplayFootprintFrame ) if( GetFpViewerFrame() ) { CreateScreenCmp(); } Loading Loading @@ -919,15 +920,17 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName ) void CVPCB_MAINFRAME::CreateScreenCmp() { if( !m_DisplayFootprintFrame ) DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFpViewerFrame(); if( !fpframe ) { m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this ); m_DisplayFootprintFrame->Show( true ); fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this ); fpframe->Show( true ); } else { if( m_DisplayFootprintFrame->IsIconized() ) m_DisplayFootprintFrame->Iconize( false ); if( fpframe->IsIconized() ) fpframe->Iconize( false ); // The display footprint window might be buried under some other // windows, so CreateScreenCmp() on an existing window would not Loading @@ -935,11 +938,11 @@ void CVPCB_MAINFRAME::CreateScreenCmp() // So we want to put it to front, second after our CVPCB_MAINFRAME. // We do this by a little dance of bringing it to front then the main // frame back. m_DisplayFootprintFrame->Raise(); // Make sure that is visible. fpframe->Raise(); // Make sure that is visible. Raise(); // .. but still we want the focus. } m_DisplayFootprintFrame->InitDisplay(); fpframe->InitDisplay(); } Loading Loading @@ -1049,3 +1052,10 @@ COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent() return NULL; } DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFpViewerFrame() { // returns the Footprint Viewer frame, if exists, or NULL return (DISPLAY_FOOTPRINTS_FRAME*) wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ); }
cvpcb/cvpcb_mainframe.h +5 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,6 @@ public: FOOTPRINTS_LISTBOX* m_FootprintList; LIBRARY_LISTBOX* m_LibraryList; COMPONENTS_LISTBOX* m_ListCmp; DISPLAY_FOOTPRINTS_FRAME* m_DisplayFootprintFrame; wxAuiToolBar* m_mainToolBar; wxFileName m_NetlistFileName; wxArrayString m_ModuleLibNames; Loading Loading @@ -95,6 +94,11 @@ public: */ FP_LIB_TABLE* FootprintLibs() const; /** * @return a pointer on the Footprint Viewer frame, if exists, or NULL */ DISPLAY_FOOTPRINTS_FRAME* GetFpViewerFrame(); /** * Function OnSelectComponent * Called when clicking on a component in component list window Loading