void FOOTPRINTS_LISTBOX::AppendLine( const wxString& text ) { m_footprintList.Add( text ); int lines = m_footprintList.Count(); SetItemCount( lines ); UpdateWidth( lines - 1 ); }
void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent, int aFilterType ) { wxArrayString newList; wxString msg; wxString oldSelection; if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() ) oldSelection = m_footprintList[ GetSelection() ]; for( unsigned ii = 0; ii < aList.GetCount(); ii++ ) { if( aFilterType == UNFILTERED ) { msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetFootprintName() ) ); newList.Add( msg ); continue; } if( (aFilterType & BY_LIBRARY) && !aLibName.IsEmpty() && !aList.GetItem( ii ).InLibrary( aLibName ) ) continue; if( (aFilterType & BY_COMPONENT) && aComponent && !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).GetFootprintName() ) ) continue; if( (aFilterType & BY_PIN_COUNT) && aComponent && aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() ) continue; msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetFootprintName() ) ); newList.Add( msg ); } if( newList == m_footprintList ) return; m_footprintList = newList; int selection = m_footprintList.Index( oldSelection ); if( selection == wxNOT_FOUND ) selection = 0; DeleteAllItems(); if( m_footprintList.GetCount() ) { SetItemCount( m_footprintList.GetCount() ); SetSelection( selection, true ); RefreshItems( 0L, m_footprintList.GetCount()-1 ); UpdateWidth(); } }
void CPictureSizeDlg::OnChangeWidth() { UpdateData(); UpdateWidth(); if(m_bPorportions) { m_dPicVecHeight = m_dPicVecWidth * (m_dOriginalPicVecHeight / m_dOriginalPicVecWidth); FillWidthAndHeight(); } }
void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent, const wxString &aFootPrintFilterPattern, int aFilterType ) { wxArrayString newList; wxString msg; wxString oldSelection; FOOTPRINT_FILTER filter( aList ); if( aFilterType & FILTERING_BY_COMPONENT_KEYWORD && aComponent ) filter.FilterByFootprintFilters( aComponent->GetFootprintFilters() ); if( aFilterType & FILTERING_BY_PIN_COUNT && aComponent ) filter.FilterByPinCount( aComponent->GetNetCount() ); if( aFilterType & FILTERING_BY_LIBRARY ) filter.FilterByLibrary( aLibName ); if( aFilterType & FILTERING_BY_NAME ) filter.FilterByPattern( aFootPrintFilterPattern ); if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() ) oldSelection = m_footprintList[ GetSelection() ]; for( auto& i: filter ) { msg.Printf( "%3d %s:%s", int( newList.GetCount() + 1 ), GetChars( i.GetNickname() ), GetChars( i.GetFootprintName() ) ); newList.Add( msg ); } if( newList == m_footprintList ) return; m_footprintList = newList; int selection = m_footprintList.Index( oldSelection ); if( selection == wxNOT_FOUND ) selection = 0; wxWindowUpdateLocker freeze( this ); DeleteAllItems(); if( m_footprintList.GetCount() ) { SetItemCount( m_footprintList.GetCount() ); SetSelection( selection, true ); RefreshItems( 0L, m_footprintList.GetCount()-1 ); UpdateWidth(); } }
void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text ) { unsigned count = m_footprintList.Count(); if( count > 0 ) { if( linecount >= count ) linecount = count - 1; m_footprintList[linecount] = text; } UpdateWidth( linecount ); }
void StringBrowser::InitPerspective (boolean scroll_to_top) { register Perspective* p = perspective; int old_top = p->height - p->cury - p->curheight; p->lx = p->curwidth = xmax+1; p->ly = p->curheight = ymax+1; p->sx = shape->hunits; p->sy = lineheight; p->height = Count() * lineheight; UpdateWidth(); if (scroll_to_top) { p->curx = 0; p->cury = p->height - p->curheight; } else { p->cury = p->height - p->curheight - old_top; } p->Update(); }
void StringBrowser::Remove (int index) { if (0 <= index && index < strcount) { display->Draw(output, canvas); register Perspective* p = perspective; char* string = String(index); if ( output != nil && p->width > columns * shape->hunits && p->width == output->GetFont()->Width(string) ) { UpdateWidth(); } Unselect(index); delete string; BufRemove(index, strbuf, strcount); p->height -= lineheight; p->cury -= lineheight; p->Update(); display->DeleteLinesAfter(index-1, 1); } }
void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent, const wxString &aFootPrintFilterPattern, int aFilterType ) { wxArrayString newList; wxString msg; wxString oldSelection; EDA_PATTERN_MATCH_WILDCARD patternFilter; patternFilter.SetPattern( aFootPrintFilterPattern.Lower() ); // Use case insensitive search if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() ) oldSelection = m_footprintList[ GetSelection() ]; for( unsigned ii = 0; ii < aList.GetCount(); ii++ ) { if( aFilterType == UNFILTERED_FP_LIST ) { msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetFootprintName() ) ); newList.Add( msg ); continue; } if( (aFilterType & FILTERING_BY_LIBRARY) && !aLibName.IsEmpty() && !aList.GetItem( ii ).InLibrary( aLibName ) ) continue; if( (aFilterType & FILTERING_BY_COMPONENT_KEYWORD) && aComponent && !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).GetFootprintName() ) ) continue; if( (aFilterType & FILTERING_BY_PIN_COUNT) && aComponent && aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() ) continue; // We can search (Using case insensitive search) in full FPID or only // in the fp name itself. // After tests, only in the fp name itself looks better. // However, the code to take in account the nickname is just commented, no removed. wxString currname = //aList.GetItem( ii ).GetNickname().Lower() + ":" + aList.GetItem( ii ).GetFootprintName().Lower(); if( (aFilterType & FILTERING_BY_NAME) && !aFootPrintFilterPattern.IsEmpty() && patternFilter.Find( currname ) == EDA_PATTERN_NOT_FOUND ) { continue; } msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetFootprintName() ) ); newList.Add( msg ); } if( newList == m_footprintList ) return; m_footprintList = newList; int selection = m_footprintList.Index( oldSelection ); if( selection == wxNOT_FOUND ) selection = 0; DeleteAllItems(); if( m_footprintList.GetCount() ) { SetItemCount( m_footprintList.GetCount() ); SetSelection( selection, true ); RefreshItems( 0L, m_footprintList.GetCount()-1 ); UpdateWidth(); } }