Loading common/drawframe.cpp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -118,6 +118,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent, m_snapToGrid = true; m_snapToGrid = true; m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE); CreateStatusBar( 6 ); CreateStatusBar( 6 ); // set the size of the status bar subwindows: // set the size of the status bar subwindows: Loading pcbnew/modview_frame.cpp +68 −81 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,7 @@ static wxAcceleratorEntry accels[] = #define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" ) #define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" ) FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, FP_LIB_TABLE* aTable, FP_LIB_TABLE* aTable, wxSemaphore* aSemaphore, wxSemaphore* aSemaphore, Loading @@ -137,14 +138,12 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, SetIcon( icon ); SetIcon( icon ); m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr; m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr; m_FootprintList = NULL; m_footprintList = NULL; m_LibList = NULL; m_libList = NULL; m_LibListWindow = NULL; m_semaphore = aSemaphore; m_FootprintListWindow = NULL; m_Semaphore = aSemaphore; m_selectedFootprintName.Empty(); m_selectedFootprintName.Empty(); if( m_Semaphore ) if( m_semaphore ) SetModalMode( true ); SetModalMode( true ); SetBoard( new BOARD() ); SetBoard( new BOARD() ); Loading @@ -160,33 +159,17 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, ReCreateHToolbar(); ReCreateHToolbar(); ReCreateVToolbar(); ReCreateVToolbar(); wxSize initialSashSize( 100, -1 ); wxSize minsize(100,-1); // Creates the library and footprint list // Creates the libraries window display m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST, m_LibListWindow = wxDefaultPosition, minsize, new wxSashLayoutWindow( this, ID_MODVIEW_LIBWINDOW, wxDefaultPosition, initialSashSize, wxCLIP_CHILDREN | wxSW_3D, wxT( "LibWindow" ) ); m_LibListWindow->SetOrientation( wxLAYOUT_VERTICAL ); m_LibListWindow->SetAlignment( wxLAYOUT_LEFT ); m_LibListWindow->SetSashVisible( wxSASH_RIGHT, true ); m_LibListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE ); m_LibList = new wxListBox( m_LibListWindow, ID_MODVIEW_LIB_LIST, wxDefaultPosition, initialSashSize, 0, NULL, wxLB_HSCROLL ); 0, NULL, wxLB_HSCROLL ); m_libList->SetMinSize( minsize ); // Creates the footprint window display m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST, m_FootprintListWindow = new wxSashLayoutWindow( this, ID_MODVIEW_FOOTPRINT_WINDOW, wxDefaultPosition, minsize, wxDefaultPosition, initialSashSize, wxCLIP_CHILDREN | wxSW_3D, wxT( "CmpWindow" ) ); m_FootprintListWindow->SetOrientation( wxLAYOUT_VERTICAL ); m_FootprintListWindow->SetSashVisible( wxSASH_RIGHT, true ); m_FootprintListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE ); m_FootprintList = new wxListBox( m_FootprintListWindow, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, initialSashSize, 0, NULL, wxLB_HSCROLL ); 0, NULL, wxLB_HSCROLL ); m_footprintList->SetMinSize( minsize ); ReCreateLibraryList(); ReCreateLibraryList(); DisplayLibInfos(); DisplayLibInfos(); Loading @@ -211,7 +194,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, // most likely due to the fact that the other windows are not dockable and are preventing the // most likely due to the fact that the other windows are not dockable and are preventing the // tool bar from docking on the right and left. // tool bar from docking on the right and left. wxAuiPaneInfo toolbarPaneInfo; wxAuiPaneInfo toolbarPaneInfo; toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top().CloseButton( false ); toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top() .CloseButton( false ); EDA_PANEINFO info; EDA_PANEINFO info; info.InfoToolbarPane(); info.InfoToolbarPane(); Loading @@ -223,40 +207,43 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, m_auimgr.AddPane( m_mainToolBar, toolbarPaneInfo ); m_auimgr.AddPane( m_mainToolBar, toolbarPaneInfo ); // Manage the list of libraries, left pane. // Manage the list of libraries, left pane. if( m_LibListWindow ) m_auimgr.AddPane( m_libList, m_auimgr.AddPane( m_LibListWindow, wxAuiPaneInfo( info ).Name( wxT( "m_LibList" ) ). wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ) Left().Row( 1 ) ); .Left().Row( 1 ) ); // Manage the list of footprints, center pane. // Manage the list of footprints, center pane. m_auimgr.AddPane( m_FootprintListWindow, m_auimgr.AddPane( m_footprintList, wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ).Centre().Row( 1 ) ); wxAuiPaneInfo( info ).Name( wxT( "m_footprintList" ) ) .Left().Row( 2 ) ); // Manage the draw panel, right pane. // Manage the draw panel, right pane. m_auimgr.AddPane( m_canvas, m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Right().Row( 1 ).CloseButton( false ) ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre().Row( 1 ).CloseButton( false ) ); // Manage the message panel, bottom pane. // Manage the message panel, bottom pane. m_auimgr.AddPane( m_messagePanel, m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() ); /* Now the minimum windows are fixed, set library list if( !m_perspective.IsEmpty() ) * and component list of the previous values from last viewlib use */ if( m_LibListWindow ) { { wxAuiPaneInfo& pane = m_auimgr.GetPane( m_LibListWindow ); // Restore last saved sizes, pos and other params pane.MinSize( wxSize( 30, -1 ) ); // However m_mainToolBar size cannot be set to its last saved size // because the actual size change depending on the way modview was called: // the tool to export the current footprint exist or not. // and the saved size is not always OK // the trick is to get the default toolbar size, and set the size after // calling LoadPerspective wxSize tbsize = m_mainToolBar->GetSize(); m_auimgr.LoadPerspective( m_perspective, false ); m_auimgr.GetPane( m_mainToolBar ).BestSize( tbsize ); } } if( m_FootprintListWindow ) // Set min size (overwrite params read in LoadPerspective(), is any) { m_auimgr.GetPane( m_libList ).MinSize( minsize ); wxAuiPaneInfo& pane = m_auimgr.GetPane( m_FootprintListWindow ); m_auimgr.GetPane( m_footprintList ).MinSize( minsize ); pane.MinSize( wxSize( 30, -1 ) ); } if( !m_perspective.IsEmpty() ) // after changing something to the aui manager, m_auimgr.LoadPerspective( m_perspective ); // call Update()() to reflect the changes else m_auimgr.Update(); m_auimgr.Update(); // Now Drawpanel is sized, we can use BestZoom to show the component (if any) // Now Drawpanel is sized, we can use BestZoom to show the component (if any) Loading Loading @@ -294,9 +281,9 @@ FOOTPRINT_VIEWER_FRAME* FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer() void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event ) void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event ) { { if( m_Semaphore ) if( m_semaphore ) { { m_Semaphore->Post(); m_semaphore->Post(); SetModalMode( false ); SetModalMode( false ); // This window will be destroyed by the calling function, // This window will be destroyed by the calling function, // to avoid side effects // to avoid side effects Loading Loading @@ -324,22 +311,22 @@ void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList() void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList() { { if( m_LibList == NULL ) if( m_libList == NULL ) return; return; m_LibList->Clear(); m_libList->Clear(); std::vector< wxString > libName = m_footprintLibTable->GetLogicalLibs(); std::vector< wxString > libName = m_footprintLibTable->GetLogicalLibs(); for( unsigned ii = 0; ii < libName.size(); ii++ ) for( unsigned ii = 0; ii < libName.size(); ii++ ) m_LibList->Append( libName[ii] ); m_libList->Append( libName[ii] ); // Search for a previous selection: // Search for a previous selection: int index = m_LibList->FindString( m_libraryName ); int index = m_libList->FindString( m_libraryName ); if( index != wxNOT_FOUND ) if( index != wxNOT_FOUND ) { { m_LibList->SetSelection( index, true ); m_libList->SetSelection( index, true ); } } else else { { Loading @@ -358,10 +345,10 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList() void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() { { if( m_FootprintList == NULL ) if( m_footprintList == NULL ) return; return; m_FootprintList->Clear(); m_footprintList->Clear(); if( m_libraryName.IsEmpty() ) if( m_libraryName.IsEmpty() ) { { Loading @@ -387,25 +374,25 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() fpList.Add( footprint.GetFootprintName() ); fpList.Add( footprint.GetFootprintName() ); } } m_FootprintList->Append( fpList ); m_footprintList->Append( fpList ); int index = m_FootprintList->FindString( m_footprintName ); int index = m_footprintList->FindString( m_footprintName ); if( index == wxNOT_FOUND ) if( index == wxNOT_FOUND ) m_footprintName = wxEmptyString; m_footprintName = wxEmptyString; else else m_FootprintList->SetSelection( index, true ); m_footprintList->SetSelection( index, true ); } } void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event ) { { int ii = m_LibList->GetSelection(); int ii = m_libList->GetSelection(); if( ii < 0 ) if( ii < 0 ) return; return; wxString name = m_LibList->GetString( ii ); wxString name = m_libList->GetString( ii ); if( m_libraryName == name ) if( m_libraryName == name ) return; return; Loading @@ -420,15 +407,15 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) { { if( m_FootprintList->GetCount() == 0 ) if( m_footprintList->GetCount() == 0 ) return; return; int ii = m_FootprintList->GetSelection(); int ii = m_footprintList->GetSelection(); if( ii < 0 ) if( ii < 0 ) return; return; wxString name = m_FootprintList->GetString( ii ); wxString name = m_footprintList->GetString( ii ); if( m_footprintName.CmpNoCase( name ) != 0 ) if( m_footprintName.CmpNoCase( name ) != 0 ) { { Loading Loading @@ -463,7 +450,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event ) { { if( m_Semaphore ) if( m_semaphore ) { { ExportSelectedFootprint( event ); ExportSelectedFootprint( event ); // Prevent the double click from being as a single mouse button release // Prevent the double click from being as a single mouse button release Loading @@ -478,10 +465,10 @@ void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event ) { { int ii = m_FootprintList->GetSelection(); int ii = m_footprintList->GetSelection(); if( ii >= 0 ) if( ii >= 0 ) m_selectedFootprintName = m_FootprintList->GetString( ii ); m_selectedFootprintName = m_footprintList->GetString( ii ); else else m_selectedFootprintName.Empty(); m_selectedFootprintName.Empty(); Loading Loading @@ -524,13 +511,13 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event ) // Ensure we have the right library list: // Ensure we have the right library list: std::vector< wxString > libNicknames = m_footprintLibTable->GetLogicalLibs(); std::vector< wxString > libNicknames = m_footprintLibTable->GetLogicalLibs(); if( libNicknames.size() == m_LibList->GetCount() ) if( libNicknames.size() == m_libList->GetCount() ) { { unsigned ii; unsigned ii; for( ii = 0; ii < libNicknames.size(); ii++ ) for( ii = 0; ii < libNicknames.size(); ii++ ) { { if( libNicknames[ii] != m_LibList->GetString( ii ) ) if( libNicknames[ii] != m_libList->GetString( ii ) ) break; break; } } Loading Loading @@ -767,10 +754,10 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event ) DisplayLibInfos(); DisplayLibInfos(); ReCreateFootprintList(); ReCreateFootprintList(); int id = m_LibList->FindString( m_libraryName ); int id = m_libList->FindString( m_libraryName ); if( id >= 0 ) if( id >= 0 ) m_LibList->SetSelection( id ); m_libList->SetSelection( id ); } } Loading Loading @@ -800,7 +787,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event ) Zoom_Automatique( false ); Zoom_Automatique( false ); m_canvas->Refresh(); m_canvas->Refresh(); Update3D_Frame(); Update3D_Frame(); m_FootprintList->SetStringSelection( m_footprintName ); m_footprintList->SetStringSelection( m_footprintName ); } } } } Loading @@ -817,11 +804,11 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) if( m_libraryName.IsEmpty() ) if( m_libraryName.IsEmpty() ) return; return; int selection = m_FootprintList->FindString( m_footprintName ); int selection = m_footprintList->FindString( m_footprintName ); if( aMode == NEXT_PART ) if( aMode == NEXT_PART ) { { if( selection != wxNOT_FOUND && selection < (int)m_FootprintList->GetCount()-1 ) if( selection != wxNOT_FOUND && selection < (int)m_footprintList->GetCount()-1 ) selection++; selection++; } } Loading @@ -833,8 +820,8 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) { { m_FootprintList->SetSelection( selection ); m_footprintList->SetSelection( selection ); m_footprintName = m_FootprintList->GetString( selection ); m_footprintName = m_footprintList->GetString( selection ); SetCurItem( NULL ); SetCurItem( NULL ); // Delete the current footprint // Delete the current footprint Loading pcbnew/modview_frame.h +3 −8 Original line number Original line Diff line number Diff line Loading @@ -44,16 +44,11 @@ class FP_LIB_TABLE; class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME { { private: private: // List of libraries (for selection ) wxListBox* m_libList; // The list of libs names wxSashLayoutWindow* m_LibListWindow; wxListBox* m_footprintList; // The list of footprint names wxListBox* m_LibList; // The list of libs names // List of components in the selected library wxSashLayoutWindow* m_FootprintListWindow; wxListBox* m_FootprintList; // The list of footprint names // Flags // Flags wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog wxSemaphore* m_semaphore; // != NULL if the frame emulates a modal dialog wxString m_configPath; // subpath for configuration wxString m_configPath; // subpath for configuration protected: protected: Loading pcbnew/tool_modview.cpp +6 −12 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,9 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() if( m_mainToolBar == NULL ) if( m_mainToolBar == NULL ) { { m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW ); wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW ); // Set up toolbar // Set up toolbar m_mainToolBar->AddTool( ID_MODVIEW_SELECT_LIB, wxEmptyString, m_mainToolBar->AddTool( ID_MODVIEW_SELECT_LIB, wxEmptyString, Loading Loading @@ -93,22 +95,14 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() 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 ) // Enable this tool only if the library browser is called from // a "load component" command if( m_semaphore ) { { // The library browser is called from a "load component" command m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator(); /* this ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD control is broken it does not lead to a fetched footprint on linux, either 3.0 nor 2.8 wx: and I really don't like the drop down menu here: whoever broke it, please fix it: m_mainToolBar->AddTool( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD, wxEmptyString, KiBitmap( export_footprint_names_xpm ), KiBitmap( export_footprint_names_xpm ), _( "Insert footprint in board" ) ); _( "Insert footprint in board" ) ); */ } } // after adding the buttons to the toolbar, must call Realize() to // after adding the buttons to the toolbar, must call Realize() to Loading Loading
common/drawframe.cpp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -118,6 +118,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent, m_snapToGrid = true; m_snapToGrid = true; m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE); CreateStatusBar( 6 ); CreateStatusBar( 6 ); // set the size of the status bar subwindows: // set the size of the status bar subwindows: Loading
pcbnew/modview_frame.cpp +68 −81 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,7 @@ static wxAcceleratorEntry accels[] = #define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" ) #define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" ) FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, FP_LIB_TABLE* aTable, FP_LIB_TABLE* aTable, wxSemaphore* aSemaphore, wxSemaphore* aSemaphore, Loading @@ -137,14 +138,12 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, SetIcon( icon ); SetIcon( icon ); m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr; m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr; m_FootprintList = NULL; m_footprintList = NULL; m_LibList = NULL; m_libList = NULL; m_LibListWindow = NULL; m_semaphore = aSemaphore; m_FootprintListWindow = NULL; m_Semaphore = aSemaphore; m_selectedFootprintName.Empty(); m_selectedFootprintName.Empty(); if( m_Semaphore ) if( m_semaphore ) SetModalMode( true ); SetModalMode( true ); SetBoard( new BOARD() ); SetBoard( new BOARD() ); Loading @@ -160,33 +159,17 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, ReCreateHToolbar(); ReCreateHToolbar(); ReCreateVToolbar(); ReCreateVToolbar(); wxSize initialSashSize( 100, -1 ); wxSize minsize(100,-1); // Creates the library and footprint list // Creates the libraries window display m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST, m_LibListWindow = wxDefaultPosition, minsize, new wxSashLayoutWindow( this, ID_MODVIEW_LIBWINDOW, wxDefaultPosition, initialSashSize, wxCLIP_CHILDREN | wxSW_3D, wxT( "LibWindow" ) ); m_LibListWindow->SetOrientation( wxLAYOUT_VERTICAL ); m_LibListWindow->SetAlignment( wxLAYOUT_LEFT ); m_LibListWindow->SetSashVisible( wxSASH_RIGHT, true ); m_LibListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE ); m_LibList = new wxListBox( m_LibListWindow, ID_MODVIEW_LIB_LIST, wxDefaultPosition, initialSashSize, 0, NULL, wxLB_HSCROLL ); 0, NULL, wxLB_HSCROLL ); m_libList->SetMinSize( minsize ); // Creates the footprint window display m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST, m_FootprintListWindow = new wxSashLayoutWindow( this, ID_MODVIEW_FOOTPRINT_WINDOW, wxDefaultPosition, minsize, wxDefaultPosition, initialSashSize, wxCLIP_CHILDREN | wxSW_3D, wxT( "CmpWindow" ) ); m_FootprintListWindow->SetOrientation( wxLAYOUT_VERTICAL ); m_FootprintListWindow->SetSashVisible( wxSASH_RIGHT, true ); m_FootprintListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE ); m_FootprintList = new wxListBox( m_FootprintListWindow, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, initialSashSize, 0, NULL, wxLB_HSCROLL ); 0, NULL, wxLB_HSCROLL ); m_footprintList->SetMinSize( minsize ); ReCreateLibraryList(); ReCreateLibraryList(); DisplayLibInfos(); DisplayLibInfos(); Loading @@ -211,7 +194,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, // most likely due to the fact that the other windows are not dockable and are preventing the // most likely due to the fact that the other windows are not dockable and are preventing the // tool bar from docking on the right and left. // tool bar from docking on the right and left. wxAuiPaneInfo toolbarPaneInfo; wxAuiPaneInfo toolbarPaneInfo; toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top().CloseButton( false ); toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top() .CloseButton( false ); EDA_PANEINFO info; EDA_PANEINFO info; info.InfoToolbarPane(); info.InfoToolbarPane(); Loading @@ -223,40 +207,43 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent, m_auimgr.AddPane( m_mainToolBar, toolbarPaneInfo ); m_auimgr.AddPane( m_mainToolBar, toolbarPaneInfo ); // Manage the list of libraries, left pane. // Manage the list of libraries, left pane. if( m_LibListWindow ) m_auimgr.AddPane( m_libList, m_auimgr.AddPane( m_LibListWindow, wxAuiPaneInfo( info ).Name( wxT( "m_LibList" ) ). wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ) Left().Row( 1 ) ); .Left().Row( 1 ) ); // Manage the list of footprints, center pane. // Manage the list of footprints, center pane. m_auimgr.AddPane( m_FootprintListWindow, m_auimgr.AddPane( m_footprintList, wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ).Centre().Row( 1 ) ); wxAuiPaneInfo( info ).Name( wxT( "m_footprintList" ) ) .Left().Row( 2 ) ); // Manage the draw panel, right pane. // Manage the draw panel, right pane. m_auimgr.AddPane( m_canvas, m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Right().Row( 1 ).CloseButton( false ) ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre().Row( 1 ).CloseButton( false ) ); // Manage the message panel, bottom pane. // Manage the message panel, bottom pane. m_auimgr.AddPane( m_messagePanel, m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() ); /* Now the minimum windows are fixed, set library list if( !m_perspective.IsEmpty() ) * and component list of the previous values from last viewlib use */ if( m_LibListWindow ) { { wxAuiPaneInfo& pane = m_auimgr.GetPane( m_LibListWindow ); // Restore last saved sizes, pos and other params pane.MinSize( wxSize( 30, -1 ) ); // However m_mainToolBar size cannot be set to its last saved size // because the actual size change depending on the way modview was called: // the tool to export the current footprint exist or not. // and the saved size is not always OK // the trick is to get the default toolbar size, and set the size after // calling LoadPerspective wxSize tbsize = m_mainToolBar->GetSize(); m_auimgr.LoadPerspective( m_perspective, false ); m_auimgr.GetPane( m_mainToolBar ).BestSize( tbsize ); } } if( m_FootprintListWindow ) // Set min size (overwrite params read in LoadPerspective(), is any) { m_auimgr.GetPane( m_libList ).MinSize( minsize ); wxAuiPaneInfo& pane = m_auimgr.GetPane( m_FootprintListWindow ); m_auimgr.GetPane( m_footprintList ).MinSize( minsize ); pane.MinSize( wxSize( 30, -1 ) ); } if( !m_perspective.IsEmpty() ) // after changing something to the aui manager, m_auimgr.LoadPerspective( m_perspective ); // call Update()() to reflect the changes else m_auimgr.Update(); m_auimgr.Update(); // Now Drawpanel is sized, we can use BestZoom to show the component (if any) // Now Drawpanel is sized, we can use BestZoom to show the component (if any) Loading Loading @@ -294,9 +281,9 @@ FOOTPRINT_VIEWER_FRAME* FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer() void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event ) void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event ) { { if( m_Semaphore ) if( m_semaphore ) { { m_Semaphore->Post(); m_semaphore->Post(); SetModalMode( false ); SetModalMode( false ); // This window will be destroyed by the calling function, // This window will be destroyed by the calling function, // to avoid side effects // to avoid side effects Loading Loading @@ -324,22 +311,22 @@ void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList() void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList() { { if( m_LibList == NULL ) if( m_libList == NULL ) return; return; m_LibList->Clear(); m_libList->Clear(); std::vector< wxString > libName = m_footprintLibTable->GetLogicalLibs(); std::vector< wxString > libName = m_footprintLibTable->GetLogicalLibs(); for( unsigned ii = 0; ii < libName.size(); ii++ ) for( unsigned ii = 0; ii < libName.size(); ii++ ) m_LibList->Append( libName[ii] ); m_libList->Append( libName[ii] ); // Search for a previous selection: // Search for a previous selection: int index = m_LibList->FindString( m_libraryName ); int index = m_libList->FindString( m_libraryName ); if( index != wxNOT_FOUND ) if( index != wxNOT_FOUND ) { { m_LibList->SetSelection( index, true ); m_libList->SetSelection( index, true ); } } else else { { Loading @@ -358,10 +345,10 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList() void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() { { if( m_FootprintList == NULL ) if( m_footprintList == NULL ) return; return; m_FootprintList->Clear(); m_footprintList->Clear(); if( m_libraryName.IsEmpty() ) if( m_libraryName.IsEmpty() ) { { Loading @@ -387,25 +374,25 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() fpList.Add( footprint.GetFootprintName() ); fpList.Add( footprint.GetFootprintName() ); } } m_FootprintList->Append( fpList ); m_footprintList->Append( fpList ); int index = m_FootprintList->FindString( m_footprintName ); int index = m_footprintList->FindString( m_footprintName ); if( index == wxNOT_FOUND ) if( index == wxNOT_FOUND ) m_footprintName = wxEmptyString; m_footprintName = wxEmptyString; else else m_FootprintList->SetSelection( index, true ); m_footprintList->SetSelection( index, true ); } } void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event ) { { int ii = m_LibList->GetSelection(); int ii = m_libList->GetSelection(); if( ii < 0 ) if( ii < 0 ) return; return; wxString name = m_LibList->GetString( ii ); wxString name = m_libList->GetString( ii ); if( m_libraryName == name ) if( m_libraryName == name ) return; return; Loading @@ -420,15 +407,15 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) { { if( m_FootprintList->GetCount() == 0 ) if( m_footprintList->GetCount() == 0 ) return; return; int ii = m_FootprintList->GetSelection(); int ii = m_footprintList->GetSelection(); if( ii < 0 ) if( ii < 0 ) return; return; wxString name = m_FootprintList->GetString( ii ); wxString name = m_footprintList->GetString( ii ); if( m_footprintName.CmpNoCase( name ) != 0 ) if( m_footprintName.CmpNoCase( name ) != 0 ) { { Loading Loading @@ -463,7 +450,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event ) { { if( m_Semaphore ) if( m_semaphore ) { { ExportSelectedFootprint( event ); ExportSelectedFootprint( event ); // Prevent the double click from being as a single mouse button release // Prevent the double click from being as a single mouse button release Loading @@ -478,10 +465,10 @@ void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event ) { { int ii = m_FootprintList->GetSelection(); int ii = m_footprintList->GetSelection(); if( ii >= 0 ) if( ii >= 0 ) m_selectedFootprintName = m_FootprintList->GetString( ii ); m_selectedFootprintName = m_footprintList->GetString( ii ); else else m_selectedFootprintName.Empty(); m_selectedFootprintName.Empty(); Loading Loading @@ -524,13 +511,13 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event ) // Ensure we have the right library list: // Ensure we have the right library list: std::vector< wxString > libNicknames = m_footprintLibTable->GetLogicalLibs(); std::vector< wxString > libNicknames = m_footprintLibTable->GetLogicalLibs(); if( libNicknames.size() == m_LibList->GetCount() ) if( libNicknames.size() == m_libList->GetCount() ) { { unsigned ii; unsigned ii; for( ii = 0; ii < libNicknames.size(); ii++ ) for( ii = 0; ii < libNicknames.size(); ii++ ) { { if( libNicknames[ii] != m_LibList->GetString( ii ) ) if( libNicknames[ii] != m_libList->GetString( ii ) ) break; break; } } Loading Loading @@ -767,10 +754,10 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event ) DisplayLibInfos(); DisplayLibInfos(); ReCreateFootprintList(); ReCreateFootprintList(); int id = m_LibList->FindString( m_libraryName ); int id = m_libList->FindString( m_libraryName ); if( id >= 0 ) if( id >= 0 ) m_LibList->SetSelection( id ); m_libList->SetSelection( id ); } } Loading Loading @@ -800,7 +787,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event ) Zoom_Automatique( false ); Zoom_Automatique( false ); m_canvas->Refresh(); m_canvas->Refresh(); Update3D_Frame(); Update3D_Frame(); m_FootprintList->SetStringSelection( m_footprintName ); m_footprintList->SetStringSelection( m_footprintName ); } } } } Loading @@ -817,11 +804,11 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) if( m_libraryName.IsEmpty() ) if( m_libraryName.IsEmpty() ) return; return; int selection = m_FootprintList->FindString( m_footprintName ); int selection = m_footprintList->FindString( m_footprintName ); if( aMode == NEXT_PART ) if( aMode == NEXT_PART ) { { if( selection != wxNOT_FOUND && selection < (int)m_FootprintList->GetCount()-1 ) if( selection != wxNOT_FOUND && selection < (int)m_footprintList->GetCount()-1 ) selection++; selection++; } } Loading @@ -833,8 +820,8 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) { { m_FootprintList->SetSelection( selection ); m_footprintList->SetSelection( selection ); m_footprintName = m_FootprintList->GetString( selection ); m_footprintName = m_footprintList->GetString( selection ); SetCurItem( NULL ); SetCurItem( NULL ); // Delete the current footprint // Delete the current footprint Loading
pcbnew/modview_frame.h +3 −8 Original line number Original line Diff line number Diff line Loading @@ -44,16 +44,11 @@ class FP_LIB_TABLE; class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME { { private: private: // List of libraries (for selection ) wxListBox* m_libList; // The list of libs names wxSashLayoutWindow* m_LibListWindow; wxListBox* m_footprintList; // The list of footprint names wxListBox* m_LibList; // The list of libs names // List of components in the selected library wxSashLayoutWindow* m_FootprintListWindow; wxListBox* m_FootprintList; // The list of footprint names // Flags // Flags wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog wxSemaphore* m_semaphore; // != NULL if the frame emulates a modal dialog wxString m_configPath; // subpath for configuration wxString m_configPath; // subpath for configuration protected: protected: Loading
pcbnew/tool_modview.cpp +6 −12 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,9 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() if( m_mainToolBar == NULL ) if( m_mainToolBar == NULL ) { { m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW ); wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW ); // Set up toolbar // Set up toolbar m_mainToolBar->AddTool( ID_MODVIEW_SELECT_LIB, wxEmptyString, m_mainToolBar->AddTool( ID_MODVIEW_SELECT_LIB, wxEmptyString, Loading Loading @@ -93,22 +95,14 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() 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 ) // Enable this tool only if the library browser is called from // a "load component" command if( m_semaphore ) { { // The library browser is called from a "load component" command m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator(); /* this ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD control is broken it does not lead to a fetched footprint on linux, either 3.0 nor 2.8 wx: and I really don't like the drop down menu here: whoever broke it, please fix it: m_mainToolBar->AddTool( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD, wxEmptyString, KiBitmap( export_footprint_names_xpm ), KiBitmap( export_footprint_names_xpm ), _( "Insert footprint in board" ) ); _( "Insert footprint in board" ) ); */ } } // after adding the buttons to the toolbar, must call Realize() to // after adding the buttons to the toolbar, must call Realize() to Loading