Loading cvpcb/class_components_listbox.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ COMPONENTS_LISTBOX::~COMPONENTS_LISTBOX() BEGIN_EVENT_TABLE( COMPONENTS_LISTBOX, ITEMS_LISTBOX_BASE ) EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize ) EVT_CHAR( COMPONENTS_LISTBOX::OnChar ) EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST, COMPONENTS_LISTBOX::OnSelectComponent ) END_EVENT_TABLE() Loading @@ -72,14 +71,19 @@ void COMPONENTS_LISTBOX::SetString( unsigned linecount, const wxString& text ) linecount = m_ComponentList.Count() - 1; if( m_ComponentList.Count() > 0 ) { m_ComponentList[linecount] = text; UpdateWidth( linecount ); } } void COMPONENTS_LISTBOX::AppendLine( const wxString& text ) { m_ComponentList.Add( text ); SetItemCount( m_ComponentList.Count() ); int lines = m_ComponentList.Count(); SetItemCount( lines ); UpdateWidth( lines - 1 ); } Loading cvpcb/class_footprints_listbox.cpp +5 −14 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text ) linecount = count - 1; m_footprintList[linecount] = text; } UpdateWidth( linecount ); } Loading @@ -90,7 +91,9 @@ wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint() void FOOTPRINTS_LISTBOX::AppendLine( const wxString& text ) { m_footprintList.Add( text ); SetItemCount( m_footprintList.Count() ); int lines = m_footprintList.Count(); SetItemCount( lines ); UpdateWidth( lines - 1 ); } Loading Loading @@ -179,24 +182,12 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a SetItemCount( m_footprintList.GetCount() ); SetSelection( selection, true ); RefreshItems( 0L, m_footprintList.GetCount()-1 ); #if defined (__WXGTK__ ) //&& wxMINOR_VERSION == 8 // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // column parameter is -1. This was the only way to prevent GTK3 from // ellipsizing long strings down to a few characters. It still doesn't set // the scroll bars correctly (too short) but it's better than any of the // other alternatives. If someone knows how to fix this, please do. SetColumnWidth( -1, wxLIST_AUTOSIZE ); #else SetColumnWidth( 0, wxLIST_AUTOSIZE ); #endif UpdateWidth(); } } BEGIN_EVENT_TABLE( FOOTPRINTS_LISTBOX, ITEMS_LISTBOX_BASE ) EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize ) EVT_CHAR( FOOTPRINTS_LISTBOX::OnChar ) EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, FOOTPRINTS_LISTBOX::OnLeftClick ) EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, FOOTPRINTS_LISTBOX::OnLeftDClick ) Loading cvpcb/class_library_listbox.cpp +5 −13 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ void LIBRARY_LISTBOX::SetString( unsigned linecount, const wxString& text ) if( linecount >= count ) linecount = count - 1; m_libraryList[linecount] = text; UpdateWidth( linecount ); } } Loading @@ -87,7 +88,9 @@ wxString LIBRARY_LISTBOX::GetSelectedLibrary() void LIBRARY_LISTBOX::AppendLine( const wxString& text ) { m_libraryList.Add( text ); SetItemCount( m_libraryList.Count() ); int lines = m_libraryList.Count(); SetItemCount( lines ); UpdateWidth( lines - 1 ); } Loading Loading @@ -129,23 +132,12 @@ void LIBRARY_LISTBOX::SetLibraryList( const wxArrayString& aList ) if( m_libraryList.Count() ) { RefreshItems( 0L, m_libraryList.Count()-1 ); #if defined (__WXGTK__ ) && wxMINOR_VERSION == 8 // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // column parameter is -1. This was the only way to prevent GTK3 from // ellipsizing long strings down to a few characters. It still doesn't set // the scroll bars correctly (too short) but it's better than any of the // other alternatives. If someone knows how to fix this, please do. SetColumnWidth( -1, wxLIST_AUTOSIZE ); #else SetColumnWidth( 0, wxLIST_AUTOSIZE ); #endif UpdateWidth(); } } BEGIN_EVENT_TABLE( LIBRARY_LISTBOX, ITEMS_LISTBOX_BASE ) EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize ) EVT_CHAR( LIBRARY_LISTBOX::OnChar ) EVT_LIST_ITEM_SELECTED( ID_CVPCB_LIBRARY_LIST, LIBRARY_LISTBOX::OnSelectLibrary ) END_EVENT_TABLE() Loading cvpcb/cvframe.cpp +5 −11 Original line number Diff line number Diff line Loading @@ -445,6 +445,10 @@ bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, i UpdateTitle(); // Resize the components list box. This is needed in case the // contents have shrunk compared to the previous netlist. m_compListBox->UpdateWidth(); // OSX need it since some objects are "rebuild" just make aware AUI // Fixes #1258081 m_auimgr.Update(); Loading Loading @@ -949,17 +953,7 @@ void CVPCB_MAINFRAME::BuildCmpListBox() m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() ); m_compListBox->SetSelection( 0, true ); m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 ); #if defined (__WXGTK__ ) // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // column parameter is -1. This was the only way to prevent GTK3 from // ellipsizing long strings down to a few characters. It still doesn't set // the scroll bars correctly (too short) but it's better than any of the // other alternatives. If someone knows how to fix this, please do. m_compListBox->SetColumnWidth( -1, wxLIST_AUTOSIZE ); #else m_compListBox->SetColumnWidth( 0, wxLIST_AUTOSIZE ); #endif m_compListBox->UpdateWidth(); } } Loading cvpcb/cvstruct.h +15 −1 Original line number Diff line number Diff line Loading @@ -50,9 +50,23 @@ public: ~ITEMS_LISTBOX_BASE(); int GetSelection(); void OnSize( wxSizeEvent& event ); virtual CVPCB_MAINFRAME* GetParent() const; /* Function UpdateWidth * * Update the width of the column based on its contents. * * @param aLine is the line to calculate the width from. If positive, the * width will only be increased if needed. If negative, we start from * scratch and all lines are considered, i.e., the column may be shrunk. */ void UpdateWidth( int aLine = -1 ); private: void UpdateLineWidth( unsigned aLine ); int columnWidth; }; Loading Loading
cvpcb/class_components_listbox.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ COMPONENTS_LISTBOX::~COMPONENTS_LISTBOX() BEGIN_EVENT_TABLE( COMPONENTS_LISTBOX, ITEMS_LISTBOX_BASE ) EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize ) EVT_CHAR( COMPONENTS_LISTBOX::OnChar ) EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST, COMPONENTS_LISTBOX::OnSelectComponent ) END_EVENT_TABLE() Loading @@ -72,14 +71,19 @@ void COMPONENTS_LISTBOX::SetString( unsigned linecount, const wxString& text ) linecount = m_ComponentList.Count() - 1; if( m_ComponentList.Count() > 0 ) { m_ComponentList[linecount] = text; UpdateWidth( linecount ); } } void COMPONENTS_LISTBOX::AppendLine( const wxString& text ) { m_ComponentList.Add( text ); SetItemCount( m_ComponentList.Count() ); int lines = m_ComponentList.Count(); SetItemCount( lines ); UpdateWidth( lines - 1 ); } Loading
cvpcb/class_footprints_listbox.cpp +5 −14 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text ) linecount = count - 1; m_footprintList[linecount] = text; } UpdateWidth( linecount ); } Loading @@ -90,7 +91,9 @@ wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint() void FOOTPRINTS_LISTBOX::AppendLine( const wxString& text ) { m_footprintList.Add( text ); SetItemCount( m_footprintList.Count() ); int lines = m_footprintList.Count(); SetItemCount( lines ); UpdateWidth( lines - 1 ); } Loading Loading @@ -179,24 +182,12 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a SetItemCount( m_footprintList.GetCount() ); SetSelection( selection, true ); RefreshItems( 0L, m_footprintList.GetCount()-1 ); #if defined (__WXGTK__ ) //&& wxMINOR_VERSION == 8 // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // column parameter is -1. This was the only way to prevent GTK3 from // ellipsizing long strings down to a few characters. It still doesn't set // the scroll bars correctly (too short) but it's better than any of the // other alternatives. If someone knows how to fix this, please do. SetColumnWidth( -1, wxLIST_AUTOSIZE ); #else SetColumnWidth( 0, wxLIST_AUTOSIZE ); #endif UpdateWidth(); } } BEGIN_EVENT_TABLE( FOOTPRINTS_LISTBOX, ITEMS_LISTBOX_BASE ) EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize ) EVT_CHAR( FOOTPRINTS_LISTBOX::OnChar ) EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, FOOTPRINTS_LISTBOX::OnLeftClick ) EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, FOOTPRINTS_LISTBOX::OnLeftDClick ) Loading
cvpcb/class_library_listbox.cpp +5 −13 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ void LIBRARY_LISTBOX::SetString( unsigned linecount, const wxString& text ) if( linecount >= count ) linecount = count - 1; m_libraryList[linecount] = text; UpdateWidth( linecount ); } } Loading @@ -87,7 +88,9 @@ wxString LIBRARY_LISTBOX::GetSelectedLibrary() void LIBRARY_LISTBOX::AppendLine( const wxString& text ) { m_libraryList.Add( text ); SetItemCount( m_libraryList.Count() ); int lines = m_libraryList.Count(); SetItemCount( lines ); UpdateWidth( lines - 1 ); } Loading Loading @@ -129,23 +132,12 @@ void LIBRARY_LISTBOX::SetLibraryList( const wxArrayString& aList ) if( m_libraryList.Count() ) { RefreshItems( 0L, m_libraryList.Count()-1 ); #if defined (__WXGTK__ ) && wxMINOR_VERSION == 8 // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // column parameter is -1. This was the only way to prevent GTK3 from // ellipsizing long strings down to a few characters. It still doesn't set // the scroll bars correctly (too short) but it's better than any of the // other alternatives. If someone knows how to fix this, please do. SetColumnWidth( -1, wxLIST_AUTOSIZE ); #else SetColumnWidth( 0, wxLIST_AUTOSIZE ); #endif UpdateWidth(); } } BEGIN_EVENT_TABLE( LIBRARY_LISTBOX, ITEMS_LISTBOX_BASE ) EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize ) EVT_CHAR( LIBRARY_LISTBOX::OnChar ) EVT_LIST_ITEM_SELECTED( ID_CVPCB_LIBRARY_LIST, LIBRARY_LISTBOX::OnSelectLibrary ) END_EVENT_TABLE() Loading
cvpcb/cvframe.cpp +5 −11 Original line number Diff line number Diff line Loading @@ -445,6 +445,10 @@ bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, i UpdateTitle(); // Resize the components list box. This is needed in case the // contents have shrunk compared to the previous netlist. m_compListBox->UpdateWidth(); // OSX need it since some objects are "rebuild" just make aware AUI // Fixes #1258081 m_auimgr.Update(); Loading Loading @@ -949,17 +953,7 @@ void CVPCB_MAINFRAME::BuildCmpListBox() m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() ); m_compListBox->SetSelection( 0, true ); m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 ); #if defined (__WXGTK__ ) // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // column parameter is -1. This was the only way to prevent GTK3 from // ellipsizing long strings down to a few characters. It still doesn't set // the scroll bars correctly (too short) but it's better than any of the // other alternatives. If someone knows how to fix this, please do. m_compListBox->SetColumnWidth( -1, wxLIST_AUTOSIZE ); #else m_compListBox->SetColumnWidth( 0, wxLIST_AUTOSIZE ); #endif m_compListBox->UpdateWidth(); } } Loading
cvpcb/cvstruct.h +15 −1 Original line number Diff line number Diff line Loading @@ -50,9 +50,23 @@ public: ~ITEMS_LISTBOX_BASE(); int GetSelection(); void OnSize( wxSizeEvent& event ); virtual CVPCB_MAINFRAME* GetParent() const; /* Function UpdateWidth * * Update the width of the column based on its contents. * * @param aLine is the line to calculate the width from. If positive, the * width will only be increased if needed. If negative, we start from * scratch and all lines are considered, i.e., the column may be shrunk. */ void UpdateWidth( int aLine = -1 ); private: void UpdateLineWidth( unsigned aLine ); int columnWidth; }; Loading