26#include <wx/dcmemory.h>
28#include <wx/variant.h>
38 [&](
ZONE*
const& l,
ZONE*
const& r )
41 unsigned lPriority = m_zoneSettingsBag.GetZonePriority( l );
42 unsigned rPriority = m_zoneSettingsBag.GetZonePriority( r );
44 if( lPriority != rPriority )
45 return lPriority > rPriority;
47 return l->HigherPriority( r );
54 wxCommandEvent rowCountChange( EVT_ZONES_OVERVIEW_COUNT_CHANGE );
56 wxPostEvent(
m_parent, rowCountChange );
62 wxBitmap bitmap( aSize );
67 iconDC.SelectObject( bitmap );
68 brush.SetStyle( wxBRUSHSTYLE_SOLID );
69 const int layer_cout = layers.size();
70 std::vector<PCB_LAYER_ID> layersToDraw;
74 for(
const PCB_LAYER_ID& i : { layers[0], layers[1], layers[layer_cout - 1], layers[layer_cout - 2] } )
75 layersToDraw.push_back( i );
79 layersToDraw = layers;
82 const int step =
static_cast<int>( aSize.y / layersToDraw.size() );
84 for(
size_t i = 0; i < layersToDraw.size(); ++i )
89 iconDC.SetBrush( brush );
91 iconDC.DrawRectangle( 0, i * step, aSize.x, step );
131 wxArrayString layers;
134 layers.Add(
m_frame->GetBoard()->GetLayerName( layer ) );
136 aVariant << wxDataViewIconText( wxJoin( layers,
',' ),
183 unsigned int aRow = GetRow( aItem );
226 unsigned cur = aIndex;
242 unsigned cur = aIndex;
243 const unsigned last =
GetCount() - 1;
257 return std::optional<unsigned>{};
263 for(
const unsigned i : { aDragIndex, aDropIndex } )
269 if( aDragIndex == aDropIndex )
275 for(
const unsigned int row : { aDragIndex, aDropIndex } )
287 wxString lowerFilterText = aFilterText.Strip( wxString::both ).Lower();
289 if( lowerFilterText.empty() )
300 if( (
m_sortByName && zone->GetZoneName().Lower().Contains( lowerFilterText ) )
301 || (
m_sortByNet && zone->GetNetname().Lower().Contains( lowerFilterText ) ) )
NETINFO_ITEM * GetNet() const
Return NETINFO_ITEM object for a given item.
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
A color representation with 4 components: red, green, blue, alpha.
wxColour ToColour() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
bool SetValueByRow(const wxVariant &aVariant, unsigned aRow, unsigned aCol) override
void EnableFitterByNet(bool aEnable)
void GetValueByRow(wxVariant &aVariant, unsigned aRow, unsigned aCol) const override
std::optional< unsigned > SwapZonePriority(unsigned aDragIndex, unsigned aDropIndex)
Swap two zone while drag && drop.
MODEL_ZONES_OVERVIEW(wxWindow *aParent, PCB_BASE_FRAME *aFrame, ZONE_SETTINGS_BAG &aZoneSettingsBag)
wxDataViewItem ClearFilter(wxDataViewItem aSelection)
Clear up the filter.
void SetLayerFilter(PCB_LAYER_ID aLayer)
ZONE * GetZone(wxDataViewItem const &item) const
PCB_LAYER_ID m_layerFilter
wxDataViewItem GetItemByZone(ZONE *) const
std::vector< ZONE * > m_filteredZones
std::optional< unsigned > MoveZoneIndex(unsigned aIndex, ZONE_INDEX_MOVEMENT aMovement)
Move selected zone up/down.
void EnableFitterByName(bool aEnable)
unsigned int GetCount() const override
wxDataViewItem ApplyFilter(wxString const &aFilterText, wxDataViewItem aSelection)
Filter the zones by the filter text.
ZONE_SETTINGS_BAG & m_zoneSettingsBag
const wxString & GetNetname() const
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Handle a list of polygons defining a copper zone.
const wxString & GetZoneName() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
PCB_LAYER_ID
A quick note on layer IDs:
wxDEFINE_EVENT(EVT_ZONES_OVERVIEW_COUNT_CHANGE, wxCommandEvent)
static wxBitmap MakeBitmapForLayers(LSEQ const &layers, COLOR_SETTINGS const &settings, const wxSize &aSize)