Fix shadowed/conflicting enum values.

This commit is contained in:
Alex Shvartzkop 2024-06-21 16:16:03 +03:00
parent 904055912b
commit ece46223c9
10 changed files with 34 additions and 34 deletions

View File

@ -130,7 +130,7 @@ bool LIB_TREE_NODE::Compare( LIB_TREE_NODE const& aNode1, LIB_TREE_NODE const& a
LIB_TREE_NODE::LIB_TREE_NODE() LIB_TREE_NODE::LIB_TREE_NODE()
: m_Parent( nullptr ), : m_Parent( nullptr ),
m_Type( INVALID ), m_Type( TYPE::INVALID ),
m_IntrinsicRank( 0 ), m_IntrinsicRank( 0 ),
m_Score( 0 ), m_Score( 0 ),
m_Pinned( false ), m_Pinned( false ),
@ -154,7 +154,7 @@ LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* a
} }
m_Parent = aParent; m_Parent = aParent;
m_Type = UNIT; m_Type = TYPE::UNIT;
m_Unit = aUnit; m_Unit = aUnit;
m_LibId = aParent->m_LibId; m_LibId = aParent->m_LibId;
@ -189,7 +189,7 @@ void LIB_TREE_NODE_UNIT::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxSt
LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem ) LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem )
{ {
m_Type = ITEM; m_Type = TYPE::ITEM;
m_Parent = aParent; m_Parent = aParent;
m_LibId.SetLibNickname( aItem->GetLibNickname() ); m_LibId.SetLibNickname( aItem->GetLibNickname() );
@ -277,7 +277,7 @@ void LIB_TREE_NODE_ITEM::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxSt
LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY( LIB_TREE_NODE* aParent, wxString const& aName, LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY( LIB_TREE_NODE* aParent, wxString const& aName,
wxString const& aDesc ) wxString const& aDesc )
{ {
m_Type = LIBRARY; m_Type = TYPE::LIBRARY;
m_Name = aName; m_Name = aName;
m_Desc = aDesc; m_Desc = aDesc;
m_Parent = aParent; m_Parent = aParent;
@ -343,7 +343,7 @@ void LIB_TREE_NODE_LIBRARY::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const w
LIB_TREE_NODE_ROOT::LIB_TREE_NODE_ROOT() LIB_TREE_NODE_ROOT::LIB_TREE_NODE_ROOT()
{ {
m_Type = ROOT; m_Type = TYPE::ROOT;
} }

View File

@ -468,7 +468,7 @@ int LIB_TREE_MODEL_ADAPTER::GetUnitFor( const wxDataViewItem& aSelection ) const
LIB_TREE_NODE::TYPE LIB_TREE_MODEL_ADAPTER::GetTypeFor( const wxDataViewItem& aSelection ) const LIB_TREE_NODE::TYPE LIB_TREE_MODEL_ADAPTER::GetTypeFor( const wxDataViewItem& aSelection ) const
{ {
const LIB_TREE_NODE* node = ToNode( aSelection ); const LIB_TREE_NODE* node = ToNode( aSelection );
return node ? node->m_Type : LIB_TREE_NODE::INVALID; return node ? node->m_Type : LIB_TREE_NODE::TYPE::INVALID;
} }
@ -526,7 +526,7 @@ unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem,
unsigned int count = 0; unsigned int count = 0;
if( node->m_Type == LIB_TREE_NODE::TYPE::ROOT if( node->m_Type == LIB_TREE_NODE::TYPE::ROOT
|| node->m_Type == LIB_TREE_NODE::LIBRARY || node->m_Type == LIB_TREE_NODE::TYPE::LIBRARY
|| ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::ITEM ) ) || ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::ITEM ) )
{ {
for( std::unique_ptr<LIB_TREE_NODE> const& child: node->m_Children ) for( std::unique_ptr<LIB_TREE_NODE> const& child: node->m_Children )
@ -701,7 +701,7 @@ bool LIB_TREE_MODEL_ADAPTER::GetAttr( const wxDataViewItem& aItem,
LIB_TREE_NODE* node = ToNode( aItem ); LIB_TREE_NODE* node = ToNode( aItem );
wxCHECK( node, false ); wxCHECK( node, false );
if( node->m_Type == LIB_TREE_NODE::ITEM ) if( node->m_Type == LIB_TREE_NODE::TYPE::ITEM )
{ {
if( !node->m_IsRoot && aCol == 0 ) if( !node->m_IsRoot && aCol == 0 )
{ {
@ -762,7 +762,7 @@ const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
if( n->m_Name.StartsWith( "-- " ) ) if( n->m_Name.StartsWith( "-- " ) )
return -1; // Skip this node and its children return -1; // Skip this node and its children
if( n->m_Type == LIB_TREE_NODE::ITEM if( n->m_Type == LIB_TREE_NODE::TYPE::ITEM
&& ( n->m_Children.empty() || !m_preselect_unit ) && ( n->m_Children.empty() || !m_preselect_unit )
&& m_preselect_lib_id == n->m_LibId ) && m_preselect_lib_id == n->m_LibId )
{ {
@ -770,7 +770,7 @@ const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
m_widget->ExpandAncestors( ToItem( n ) ); m_widget->ExpandAncestors( ToItem( n ) );
return 0; return 0;
} }
else if( n->m_Type == LIB_TREE_NODE::UNIT else if( n->m_Type == LIB_TREE_NODE::TYPE::UNIT
&& ( m_preselect_unit && m_preselect_unit == n->m_Unit ) && ( m_preselect_unit && m_preselect_unit == n->m_Unit )
&& m_preselect_lib_id == n->m_Parent->m_LibId ) && m_preselect_lib_id == n->m_Parent->m_LibId )
{ {

View File

@ -44,14 +44,14 @@ void LIBRARY_EDITOR_CONTROL::AddContextMenuItems( CONDITIONAL_MENU* aMenu )
{ {
LIB_TREE* libTree = m_frame->GetLibTree(); LIB_TREE* libTree = m_frame->GetLibTree();
LIB_TREE_NODE* current = libTree ? libTree->GetCurrentTreeNode() : nullptr; LIB_TREE_NODE* current = libTree ? libTree->GetCurrentTreeNode() : nullptr;
return current && current->m_Type == LIB_TREE_NODE::LIBRARY && current->m_Pinned; return current && current->m_Type == LIB_TREE_NODE::TYPE::LIBRARY && current->m_Pinned;
}; };
auto unpinnedLibSelectedCondition = auto unpinnedLibSelectedCondition =
[this](const SELECTION& aSel ) [this](const SELECTION& aSel )
{ {
LIB_TREE* libTree = m_frame->GetLibTree(); LIB_TREE* libTree = m_frame->GetLibTree();
LIB_TREE_NODE* current = libTree ? libTree->GetCurrentTreeNode() : nullptr; LIB_TREE_NODE* current = libTree ? libTree->GetCurrentTreeNode() : nullptr;
return current && current->m_Type == LIB_TREE_NODE::LIBRARY && !current->m_Pinned; return current && current->m_Type == LIB_TREE_NODE::TYPE::LIBRARY && !current->m_Pinned;
}; };
aMenu->AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition, 1 ); aMenu->AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition, 1 );

View File

@ -635,7 +635,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
if( !sel.IsOk() ) if( !sel.IsOk() )
sel = m_adapter->GetCurrentDataViewItem(); sel = m_adapter->GetCurrentDataViewItem();
LIB_TREE_NODE::TYPE type = sel.IsOk() ? m_adapter->GetTypeFor( sel ) : LIB_TREE_NODE::INVALID; LIB_TREE_NODE::TYPE type = sel.IsOk() ? m_adapter->GetTypeFor( sel ) : LIB_TREE_NODE::TYPE::INVALID;
switch( aKeyStroke.GetKeyCode() ) switch( aKeyStroke.GetKeyCode() )
{ {
@ -652,7 +652,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
case WXK_ADD: case WXK_ADD:
updateRecentSearchMenu(); updateRecentSearchMenu();
if( type == LIB_TREE_NODE::LIBRARY ) if( type == LIB_TREE_NODE::TYPE::LIBRARY )
m_tree_ctrl->Expand( sel ); m_tree_ctrl->Expand( sel );
break; break;
@ -660,7 +660,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
case WXK_SUBTRACT: case WXK_SUBTRACT:
updateRecentSearchMenu(); updateRecentSearchMenu();
if( type == LIB_TREE_NODE::LIBRARY ) if( type == LIB_TREE_NODE::TYPE::LIBRARY )
m_tree_ctrl->Collapse( sel ); m_tree_ctrl->Collapse( sel );
break; break;
@ -671,7 +671,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
if( GetSelectedLibId().IsValid() ) if( GetSelectedLibId().IsValid() )
postSelectEvent(); postSelectEvent();
else if( type == LIB_TREE_NODE::LIBRARY ) else if( type == LIB_TREE_NODE::TYPE::LIBRARY )
toggleExpand( sel ); toggleExpand( sel );
break; break;
@ -954,7 +954,7 @@ void LIB_TREE::onItemContextMenu( wxDataViewEvent& aEvent )
{ {
LIB_TREE_NODE* current = GetCurrentTreeNode(); LIB_TREE_NODE* current = GetCurrentTreeNode();
if( current && current->m_Type == LIB_TREE_NODE::LIBRARY ) if( current && current->m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
{ {
ACTION_MENU menu( true, nullptr ); ACTION_MENU menu( true, nullptr );

View File

@ -49,7 +49,7 @@ public:
bool m_valid; bool m_valid;
}; };
enum KIBIS_WAVEFORM_TYPE enum class KIBIS_WAVEFORM_TYPE
{ {
NONE = 0, // Used for three state NONE = 0, // Used for three state
PRBS, PRBS,

View File

@ -63,7 +63,7 @@ TOOL_INTERACTIVE* SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool()
bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const
{ {
const LIB_TREE_NODE* node = ToNode( aItem ); const LIB_TREE_NODE* node = ToNode( aItem );
return node ? node->m_Type == LIB_TREE_NODE::LIBRARY : true; return node ? node->m_Type == LIB_TREE_NODE::TYPE::LIBRARY : true;
} }
@ -244,12 +244,12 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie
aVariant = UnescapeString( node->m_Name ); aVariant = UnescapeString( node->m_Name );
// mark modified items with an asterisk // mark modified items with an asterisk
if( node->m_Type == LIB_TREE_NODE::LIBRARY ) if( node->m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
{ {
if( m_libMgr->IsLibraryModified( node->m_Name ) ) if( m_libMgr->IsLibraryModified( node->m_Name ) )
aVariant = aVariant.GetString() + " *"; aVariant = aVariant.GetString() + " *";
} }
else if( node->m_Type == LIB_TREE_NODE::ITEM ) else if( node->m_Type == LIB_TREE_NODE::TYPE::ITEM )
{ {
if( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) ) if( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) )
aVariant = aVariant.GetString() + " *"; aVariant = aVariant.GetString() + " *";
@ -260,7 +260,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie
default: default:
if( m_colIdxMap.count( aCol ) ) if( m_colIdxMap.count( aCol ) )
{ {
if( node->m_Type == LIB_TREE_NODE::LIBRARY ) if( node->m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
{ {
LIB_SYMBOL_LIBRARY_MANAGER& libMgr = m_frame->GetLibManager(); LIB_SYMBOL_LIBRARY_MANAGER& libMgr = m_frame->GetLibManager();
SYMBOL_LIB_TABLE_ROW* lib = libMgr.GetLibrary( node->m_LibId.GetLibNickname() ); SYMBOL_LIB_TABLE_ROW* lib = libMgr.GetLibrary( node->m_LibId.GetLibNickname() );
@ -307,7 +307,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
wxCHECK( node, false ); wxCHECK( node, false );
// Mark both columns of unloaded libraries using grey text color (to look disabled) // Mark both columns of unloaded libraries using grey text color (to look disabled)
if( node->m_Type == LIB_TREE_NODE::LIBRARY && !m_libMgr->IsLibraryLoaded( node->m_Name ) ) if( node->m_Type == LIB_TREE_NODE::TYPE::LIBRARY && !m_libMgr->IsLibraryLoaded( node->m_Name ) )
{ {
aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
return true; return true;
@ -321,7 +321,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
switch( node->m_Type ) switch( node->m_Type )
{ {
case LIB_TREE_NODE::LIBRARY: case LIB_TREE_NODE::TYPE::LIBRARY:
// mark modified libs with bold font // mark modified libs with bold font
aAttr.SetBold( m_libMgr->IsLibraryModified( node->m_Name ) ); aAttr.SetBold( m_libMgr->IsLibraryModified( node->m_Name ) );
@ -336,7 +336,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
} }
break; break;
case LIB_TREE_NODE::ITEM: case LIB_TREE_NODE::TYPE::ITEM:
// mark modified part with bold font // mark modified part with bold font
aAttr.SetBold( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) ); aAttr.SetBold( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) );
@ -364,7 +364,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem
LIB_TREE_NODE* node = ToNode( aItem ); LIB_TREE_NODE* node = ToNode( aItem );
wxCHECK( node, false ); wxCHECK( node, false );
return node->m_Type == LIB_TREE_NODE::ITEM && node->m_LibId != m_frame->GetTargetLibId(); return node->m_Type == LIB_TREE_NODE::TYPE::ITEM && node->m_LibId != m_frame->GetTargetLibId();
} }

View File

@ -29,7 +29,7 @@
*/ */
enum KIFACE_ADDR_ID : int enum KIFACE_ADDR_ID : int
{ {
INVALID, KIFACE_ID_INVALID,
/** /**
* Return a pointer to the global instance of FOOTPRINT_LIST from pcbnew. * Return a pointer to the global instance of FOOTPRINT_LIST from pcbnew.

View File

@ -111,7 +111,7 @@ public:
LIB_TREE_NODE(); LIB_TREE_NODE();
virtual ~LIB_TREE_NODE() {} virtual ~LIB_TREE_NODE() {}
enum TYPE enum class TYPE
{ {
ROOT, ROOT,
LIBRARY, LIBRARY,

View File

@ -51,7 +51,7 @@ public:
///< Flags to select extra widgets and options ///< Flags to select extra widgets and options
enum FLAGS enum FLAGS
{ {
NONE = 0x00, FLAGS_NONE = 0x00,
SEARCH = 0x01, SEARCH = 0x01,
FILTERS = 0x02, FILTERS = 0x02,
DETAILS = 0x04, DETAILS = 0x04,

View File

@ -64,7 +64,7 @@ TOOL_INTERACTIVE* FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool()
bool FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const bool FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const
{ {
const LIB_TREE_NODE* node = ToNode( aItem ); const LIB_TREE_NODE* node = ToNode( aItem );
return node ? node->m_Type == LIB_TREE_NODE::LIBRARY : true; return node ? node->m_Type == LIB_TREE_NODE::TYPE::LIBRARY : true;
} }
@ -229,7 +229,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte
{ {
node->m_Desc = m_frame->GetBoard()->GetFirstFootprint()->GetLibDescription(); node->m_Desc = m_frame->GetBoard()->GetFirstFootprint()->GetLibDescription();
} }
else if( node->m_Type == LIB_TREE_NODE::LIBRARY ) else if( node->m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
{ {
try try
{ {
@ -277,7 +277,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign
switch( node->m_Type ) switch( node->m_Type )
{ {
case LIB_TREE_NODE::LIBRARY: case LIB_TREE_NODE::TYPE::LIBRARY:
if( node->m_Name == m_frame->GetLoadedFPID().GetLibNickname().wx_str() ) if( node->m_Name == m_frame->GetLoadedFPID().GetLibNickname().wx_str() )
{ {
// mark the current library if it's collapsed // mark the current library if it's collapsed
@ -293,7 +293,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign
} }
break; break;
case LIB_TREE_NODE::ITEM: case LIB_TREE_NODE::TYPE::ITEM:
if( node->m_LibId == m_frame->GetLoadedFPID() ) if( node->m_LibId == m_frame->GetLoadedFPID() )
{ {
// mark the current (on-canvas) part // mark the current (on-canvas) part
@ -319,7 +319,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem )
LIB_TREE_NODE* node = ToNode( aItem ); LIB_TREE_NODE* node = ToNode( aItem );
wxCHECK( node, false ); wxCHECK( node, false );
return node->m_Type == LIB_TREE_NODE::ITEM && node->m_LibId != m_frame->GetLoadedFPID(); return node->m_Type == LIB_TREE_NODE::TYPE::ITEM && node->m_LibId != m_frame->GetLoadedFPID();
} }