Remove dead code, and some formatting cleanup.
This commit is contained in:
parent
5419055acb
commit
63c83b3aed
|
@ -46,24 +46,6 @@ LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ToNode( wxDataViewItem aItem )
|
|||
}
|
||||
|
||||
|
||||
unsigned int LIB_TREE_MODEL_ADAPTER::IntoArray( const LIB_TREE_NODE& aNode,
|
||||
wxDataViewItemArray& aChildren )
|
||||
{
|
||||
unsigned int n = 0;
|
||||
|
||||
for( std::unique_ptr<LIB_TREE_NODE> const& child: aNode.m_Children )
|
||||
{
|
||||
if( child->m_Score > 0 )
|
||||
{
|
||||
aChildren.Add( ToItem( &*child ) );
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent,
|
||||
const wxString& aPinnedKey ) :
|
||||
m_parent( aParent ),
|
||||
|
@ -221,14 +203,13 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( const wxString& aSearch, bool a
|
|||
wxDataViewItem item = ToItem( firstMatch );
|
||||
m_widget->Select( item );
|
||||
|
||||
// Make sure the *parent* item is visible. The selected item is the
|
||||
// first (shown) child of the parent. So it's always right below the parent,
|
||||
// and this way the user can also see what library the selected part belongs to,
|
||||
// without having a case where the selection is off the screen (unless the
|
||||
// window is a single row high, which is unlikely)
|
||||
// Make sure the *parent* item is visible. The selected item is the first (shown) child
|
||||
// of the parent. So it's always right below the parent, and this way the user can also
|
||||
// see what library the selected part belongs to, without having a case where the selection
|
||||
// is off the screen (unless the window is a single row high, which is unlikely).
|
||||
//
|
||||
// This also happens to circumvent https://bugs.launchpad.net/kicad/+bug/1804400
|
||||
// which appears to be a GTK+3 bug.
|
||||
// This also happens to circumvent https://bugs.launchpad.net/kicad/+bug/1804400 which
|
||||
// appears to be a GTK+3 bug.
|
||||
{
|
||||
wxDataViewItem parent = GetParent( item );
|
||||
|
||||
|
@ -352,13 +333,7 @@ void LIB_TREE_MODEL_ADAPTER::SetShownColumns( const std::vector<wxString>& aColu
|
|||
LIB_ID LIB_TREE_MODEL_ADAPTER::GetAliasFor( const wxDataViewItem& aSelection ) const
|
||||
{
|
||||
const LIB_TREE_NODE* node = ToNode( aSelection );
|
||||
|
||||
LIB_ID emptyId;
|
||||
|
||||
if( !node )
|
||||
return emptyId;
|
||||
|
||||
return node->m_LibId;
|
||||
return node ? node->m_LibId : LIB_ID();
|
||||
}
|
||||
|
||||
|
||||
|
@ -427,18 +402,23 @@ unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem,
|
|||
wxDataViewItemArray& aChildren ) const
|
||||
{
|
||||
const LIB_TREE_NODE* node = ( aItem.IsOk() ? ToNode( aItem ) : &m_tree );
|
||||
unsigned int count = 0;
|
||||
|
||||
if( node->m_Type == LIB_TREE_NODE::TYPE::ROOT
|
||||
|| node->m_Type == LIB_TREE_NODE::LIB
|
||||
|| ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::LIBID ) )
|
||||
{
|
||||
return IntoArray( *node, aChildren );
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
for( std::unique_ptr<LIB_TREE_NODE> const& child: node->m_Children )
|
||||
{
|
||||
if( child->m_Score > 0 )
|
||||
{
|
||||
aChildren.Add( ToItem( &*child ) );
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
@ -469,12 +449,6 @@ void LIB_TREE_MODEL_ADAPTER::FinishTreeInitialization()
|
|||
}
|
||||
|
||||
|
||||
void LIB_TREE_MODEL_ADAPTER::OnSize( wxSizeEvent& aEvent )
|
||||
{
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void LIB_TREE_MODEL_ADAPTER::RefreshTree()
|
||||
{
|
||||
// Yes, this is an enormous hack. But it works on all platforms, it doesn't suffer
|
||||
|
@ -561,7 +535,7 @@ void LIB_TREE_MODEL_ADAPTER::GetValue( wxVariant& aVariant,
|
|||
}
|
||||
|
||||
LIB_TREE_NODE* node = ToNode( aItem );
|
||||
wxASSERT( node );
|
||||
wxCHECK( node, /* void */ );
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
|
@ -599,24 +573,19 @@ bool LIB_TREE_MODEL_ADAPTER::GetAttr( const wxDataViewItem& aItem,
|
|||
return false;
|
||||
|
||||
LIB_TREE_NODE* node = ToNode( aItem );
|
||||
wxASSERT( node );
|
||||
wxCHECK( node, false );
|
||||
|
||||
if( node->m_Type != LIB_TREE_NODE::LIBID )
|
||||
if( node->m_Type == LIB_TREE_NODE::LIBID )
|
||||
{
|
||||
// Currently only aliases are formatted at all
|
||||
return false;
|
||||
if( !node->m_IsRoot && aCol == 0 )
|
||||
{
|
||||
// Names of non-root aliases are italicized
|
||||
aAttr.SetItalic( true );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !node->m_IsRoot && aCol == 0 )
|
||||
{
|
||||
// Names of non-root aliases are italicized
|
||||
aAttr.SetItalic( true );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -175,7 +175,6 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, const wxString& aRecentSearchesKey, LIB_T
|
|||
|
||||
SetSizer( sizer );
|
||||
|
||||
m_tree_ctrl->Bind( wxEVT_SIZE, &LIB_TREE::onSize, this );
|
||||
m_tree_ctrl->Bind( wxEVT_DATAVIEW_ITEM_ACTIVATED, &LIB_TREE::onTreeActivate, this );
|
||||
m_tree_ctrl->Bind( wxEVT_DATAVIEW_SELECTION_CHANGED, &LIB_TREE::onTreeSelect, this );
|
||||
m_tree_ctrl->Bind( wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, &LIB_TREE::onItemContextMenu, this );
|
||||
|
@ -376,9 +375,7 @@ wxWindow* LIB_TREE::GetFocusTarget()
|
|||
void LIB_TREE::FocusSearchFieldIfExists()
|
||||
{
|
||||
if( m_query_ctrl )
|
||||
{
|
||||
m_query_ctrl->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -642,12 +639,6 @@ void LIB_TREE::onTreeActivate( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void LIB_TREE::onSize( wxSizeEvent& aEvent )
|
||||
{
|
||||
m_adapter->OnSize( aEvent );
|
||||
}
|
||||
|
||||
|
||||
void LIB_TREE::onDetailsLink( wxHtmlLinkEvent& aEvent )
|
||||
{
|
||||
const wxHtmlLinkInfo& info = aEvent.GetLinkInfo();
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
#include <sch_sheet.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <sch_reference_list.h>
|
||||
#include <schematic.h>
|
||||
#include <reporter.h>
|
||||
#include <string_utils.h>
|
||||
#include <netlist_exporters/netlist_exporter_kicad.h>
|
||||
#include <project/project_file.h>
|
||||
|
@ -39,7 +37,6 @@
|
|||
#include <tools/ee_actions.h>
|
||||
#include <tools/sch_editor_control.h>
|
||||
#include <advanced_config.h>
|
||||
#include <netclass.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wxString* aReference,
|
||||
|
@ -47,8 +44,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||
const wxString& aSearchText )
|
||||
{
|
||||
SCH_SHEET_PATH* sheetWithSymbolFound = nullptr;
|
||||
SCH_SYMBOL* symbol = nullptr;
|
||||
VECTOR2I pos;
|
||||
SCH_SYMBOL* symbol = nullptr;
|
||||
SCH_PIN* pin = nullptr;
|
||||
SCH_SHEET_LIST sheetList;
|
||||
SCH_ITEM* foundItem = nullptr;
|
||||
|
@ -86,8 +82,6 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||
|
||||
if( aSearchType == HIGHLIGHT_PIN )
|
||||
{
|
||||
// temporary: will be changed if the pin is found.
|
||||
pos = symbol->GetPosition();
|
||||
pin = symbol->GetPin( aSearchText );
|
||||
|
||||
// Ensure we have found the right unit in case of multi-units symbol
|
||||
|
@ -102,14 +96,12 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||
}
|
||||
|
||||
// Get pin position in true schematic coordinate
|
||||
pos = pin->GetPosition();
|
||||
foundItem = pin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = symbol->GetPosition();
|
||||
foundItem = symbol;
|
||||
break;
|
||||
}
|
||||
|
@ -122,7 +114,6 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||
|
||||
CROSS_PROBING_SETTINGS& crossProbingSettings = m_frame->eeconfig()->m_CrossProbing;
|
||||
|
||||
|
||||
if( symbol )
|
||||
{
|
||||
if( *sheetWithSymbolFound != m_frame->GetCurrentSheet() )
|
||||
|
@ -176,7 +167,6 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||
}
|
||||
|
||||
m_frame->SetStatusText( msg );
|
||||
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
|
||||
return foundItem;
|
||||
|
@ -308,11 +298,9 @@ void SCH_EDIT_FRAME::SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems,
|
|||
case SCH_SYMBOL_T:
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
wxString ref = symbol->GetField( REFERENCE_FIELD )->GetText();
|
||||
wxString ref = symbol->GetField( REFERENCE_FIELD )->GetText();
|
||||
|
||||
parts.push_back( wxT( "F" ) + EscapeString( ref, CTX_IPC ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -320,11 +308,9 @@ void SCH_EDIT_FRAME::SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems,
|
|||
{
|
||||
// For cross probing, we need the full path of the sheet, because
|
||||
// we search by the footprint path prefix in the PCB editor
|
||||
|
||||
wxString full_path = GetCurrentSheet().PathAsString() + item->m_Uuid.AsString();
|
||||
|
||||
parts.push_back( wxT( "S" ) + full_path );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -332,23 +318,20 @@ void SCH_EDIT_FRAME::SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems,
|
|||
{
|
||||
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
|
||||
SCH_SYMBOL* symbol = pin->GetParentSymbol();
|
||||
|
||||
wxString ref = symbol->GetField( REFERENCE_FIELD )->GetText();
|
||||
wxString ref = symbol->GetField( REFERENCE_FIELD )->GetText();
|
||||
|
||||
parts.push_back( wxT( "P" ) + EscapeString( ref, CTX_IPC ) + wxT( "/" )
|
||||
+ EscapeString( pin->GetShownNumber(), CTX_IPC ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( parts.empty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string command = "$SELECT: 0,";
|
||||
|
||||
|
|
|
@ -226,7 +226,6 @@ public:
|
|||
*/
|
||||
void FinishTreeInitialization();
|
||||
|
||||
void OnSize( wxSizeEvent& aEvent );
|
||||
/**
|
||||
* Return the alias for the given item.
|
||||
*
|
||||
|
@ -324,11 +323,6 @@ protected:
|
|||
*/
|
||||
static LIB_TREE_NODE* ToNode( wxDataViewItem aItem );
|
||||
|
||||
/**
|
||||
* Convert SYM_TREE_NODE's children to wxDataViewItemArray.
|
||||
*/
|
||||
static unsigned int IntoArray( const LIB_TREE_NODE& aNode, wxDataViewItemArray& aChildren );
|
||||
|
||||
/**
|
||||
* Create the adapter.
|
||||
*
|
||||
|
|
|
@ -211,7 +211,6 @@ protected:
|
|||
void onTreeSelect( wxDataViewEvent& aEvent );
|
||||
void onTreeActivate( wxDataViewEvent& aEvent );
|
||||
void onTreeCharHook( wxKeyEvent& aEvent );
|
||||
void onSize( wxSizeEvent& aEvent );
|
||||
|
||||
void onDetailsLink( wxHtmlLinkEvent& aEvent );
|
||||
void onPreselect( wxCommandEvent& aEvent );
|
||||
|
|
Loading…
Reference in New Issue