Reduce some eda_item.h usage in headers

This commit is contained in:
Marek Roszko 2021-06-06 10:41:02 -04:00
parent ad111a513d
commit fcb21038cb
6 changed files with 40 additions and 30 deletions

View File

@ -29,6 +29,7 @@
#include <marker_base.h> #include <marker_base.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
#include <rc_item.h> #include <rc_item.h>
#include <eda_item.h>
#include <base_units.h> #include <base_units.h>
#define WX_DATAVIEW_WINDOW_PADDING 6 #define WX_DATAVIEW_WINDOW_PADDING 6
@ -51,6 +52,30 @@ wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos )
} }
void RC_ITEM::AddItem( EDA_ITEM* aItem )
{
m_ids.push_back( aItem->m_Uuid );
}
void RC_ITEM::SetItems( const EDA_ITEM* aItem, const EDA_ITEM* bItem,
const EDA_ITEM* cItem, const EDA_ITEM* dItem )
{
m_ids.clear();
m_ids.push_back( aItem->m_Uuid );
if( bItem )
m_ids.push_back( bItem->m_Uuid );
if( cItem )
m_ids.push_back( cItem->m_Uuid );
if( dItem )
m_ids.push_back( dItem->m_Uuid );
}
wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity, wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
const std::map<KIID, EDA_ITEM*>& aItemMap ) const const std::map<KIID, EDA_ITEM*>& aItemMap ) const
{ {

View File

@ -26,9 +26,6 @@
#define SCH_PREVIEW_PANEL_H #define SCH_PREVIEW_PANEL_H
#include <class_draw_panel_gal.h> #include <class_draw_panel_gal.h>
#include <eda_item.h>
#include <gr_basic.h>
#include <eda_rect.h>
namespace KIGFX { namespace KIGFX {

View File

@ -31,6 +31,7 @@
#include <wx/filefn.h> #include <wx/filefn.h>
#include <eda_item.h>
#include <eda_rect.h> #include <eda_rect.h>
#include <id.h> #include <id.h>
#include <kicad_string.h> #include <kicad_string.h>
@ -135,6 +136,12 @@ bool SCH_SCREEN::HasItems( KICAD_T aItemType ) const
} }
bool SCH_SCREEN::ClassOf( const EDA_ITEM* aItem )
{
return aItem && SCH_SCREEN_T == aItem->Type();
}
void SCH_SCREEN::Append( SCH_ITEM* aItem ) void SCH_SCREEN::Append( SCH_ITEM* aItem )
{ {
if( aItem->Type() != SCH_SHEET_PIN_T && aItem->Type() != SCH_FIELD_T ) if( aItem->Type() != SCH_SHEET_PIN_T && aItem->Type() != SCH_FIELD_T )

View File

@ -35,7 +35,6 @@
#include <wx/string.h> #include <wx/string.h>
#include <base_screen.h> #include <base_screen.h>
#include <eda_item.h>
#include <core/typeinfo.h> #include <core/typeinfo.h>
#include <kiid.h> #include <kiid.h>
#include <kiway_holder.h> #include <kiway_holder.h>
@ -53,7 +52,7 @@
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
class BUS_ALIAS; class BUS_ALIAS;
class EDA_ITEM;
class LIB_PART; class LIB_PART;
class LIB_PIN; class LIB_PIN;
class SCH_COMPONENT; class SCH_COMPONENT;
@ -112,10 +111,7 @@ public:
bool HasSheets() const { return HasItems( SCH_SHEET_T ); } bool HasSheets() const { return HasItems( SCH_SHEET_T ); }
static inline bool ClassOf( const EDA_ITEM* aItem ) static bool ClassOf( const EDA_ITEM* aItem );
{
return aItem && SCH_SCREEN_T == aItem->Type();
}
virtual wxString GetClass() const override virtual wxString GetClass() const override
{ {

View File

@ -31,7 +31,6 @@
#ifndef CLASS_DRAWSHEET_PATH_H #ifndef CLASS_DRAWSHEET_PATH_H
#define CLASS_DRAWSHEET_PATH_H #define CLASS_DRAWSHEET_PATH_H
#include <eda_item.h>
#include <erc_item.h> #include <erc_item.h>
#include <map> #include <map>
@ -104,6 +103,7 @@ struct SCH_SHEET_INSTANCE
class wxFindReplaceData; class wxFindReplaceData;
class EDA_ITEM;
class SCH_SHEET; class SCH_SHEET;
class SCH_SCREEN; class SCH_SCREEN;
class SCH_MARKER; class SCH_MARKER;

View File

@ -25,12 +25,14 @@
#define RC_ITEM_H #define RC_ITEM_H
#include <wx/dataview.h> #include <wx/dataview.h>
#include <eda_item.h> #include <kiid.h>
#include <reporter.h> #include <reporter.h>
class MARKER_BASE; class MARKER_BASE;
class EDA_BASE_FRAME; class EDA_BASE_FRAME;
class RC_ITEM; class RC_ITEM;
class EDA_ITEM;
class EDA_DRAW_FRAME;
/** /**
@ -99,27 +101,10 @@ public:
m_ids = aIds; m_ids = aIds;
} }
void AddItem( EDA_ITEM* aItem ) void AddItem( EDA_ITEM* aItem );
{
m_ids.push_back( aItem->m_Uuid );
}
void SetItems( const EDA_ITEM* aItem, const EDA_ITEM* bItem = nullptr, void SetItems( const EDA_ITEM* aItem, const EDA_ITEM* bItem = nullptr,
const EDA_ITEM* cItem = nullptr, const EDA_ITEM* dItem = nullptr ) const EDA_ITEM* cItem = nullptr, const EDA_ITEM* dItem = nullptr );
{
m_ids.clear();
m_ids.push_back( aItem->m_Uuid );
if( bItem )
m_ids.push_back( bItem->m_Uuid );
if( cItem )
m_ids.push_back( cItem->m_Uuid );
if( dItem )
m_ids.push_back( dItem->m_Uuid );
}
void SetItems( const KIID& aItem, const KIID& bItem = niluuid, const KIID& cItem = niluuid, void SetItems( const KIID& aItem, const KIID& bItem = niluuid, const KIID& cItem = niluuid,
const KIID& dItem = niluuid ) const KIID& dItem = niluuid )