27#include <wx/dataview.h>
31#include <wx/wupdlock.h>
55 m_isFillingZones(
false ),
56 m_zoneFillComplete(
false )
59 m_sizerZoneOP->InsertSpacer( m_sizerZoneOP->GetItemCount(), 5 );
68 m_sizerProperties->Add( m_panelZoneProperties, 0, wxEXPAND, 5 );
71 m_sizerPreview->Add( m_zonePreviewNotebook, 1, wxBOTTOM | wxLEFT | wxRIGHT | wxEXPAND, 5 );
76 m_viewZonesOverview->AppendIconTextColumn( v, k, wxDATAVIEW_CELL_INERT, 140 );
78 m_viewZonesOverview->AppendTextColumn( v, k, wxDATAVIEW_CELL_INERT, 160 );
82 m_viewZonesOverview->AssociateModel( m_modelZonesOverview.get() );
83 m_viewZonesOverview->SetLayoutDirection( wxLayout_LeftToRight );
85#if wxUSE_DRAG_AND_DROP
86 m_viewZonesOverview->EnableDragSource( wxDF_UNICODETEXT );
87 m_viewZonesOverview->EnableDropTarget( wxDF_UNICODETEXT );
89 int id = m_viewZonesOverview->GetId();
90 Bind( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &DIALOG_ZONE_MANAGER::OnBeginDrag,
this,
id );
91 Bind( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &DIALOG_ZONE_MANAGER::OnDropPossible,
this,
id );
92 Bind( wxEVT_DATAVIEW_ITEM_DROP, &DIALOG_ZONE_MANAGER::OnDrop,
this,
id );
101 Bind( wxEVT_BOOKCTRL_PAGE_CHANGED,
102 [
this]( wxNotebookEvent& aEvent )
106 m_zonePreviewNotebook->GetId() );
109 m_MainBoxSizer->Fit(
this );
110 finishDialogSettings();
126 usedLayers |= zone->GetLayerSet();
131 reinterpret_cast<void*
>(
static_cast<intptr_t
>( layer ) ) );
149 long filterInsertPos =
m_filterCtrl->GetInsertionPoint();
172 if( textCtrlHasFocus )
188 if( aEvent.GetKeyCode() == WXK_UP )
192 else if( aEvent.GetKeyCode() == WXK_DOWN )
211 unsigned currentRow = 0;
216 int newRow = (int) currentRow + aDirection;
217 newRow = std::max( 0, std::min( newRow, (
int) count - 1 ) );
219 if( !current.IsOk() || (
unsigned) newRow != currentRow )
252 wxWindowUpdateLocker updateLock(
this );
292 std::map<PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>> filled_zone_to_restore;
293 ZONE* internal_zone = zone;
301 filled_zone_to_restore[layer] = fill;
306 for(
const auto& [ layer, fill ] : filled_zone_to_restore )
307 zone->SetFilledPolysList( layer, *fill );
314#if wxUSE_DRAG_AND_DROP
316void DIALOG_ZONE_MANAGER::OnBeginDrag( wxDataViewEvent& aEvent )
318 wxTextDataObject* obj =
new wxTextDataObject;
319 obj->SetText(
"42" );
320 aEvent.SetDataObject( obj );
321 aEvent.SetDragFlags( wxDrag_AllowMove );
322 const wxDataViewItem it = aEvent.GetItem();
329void DIALOG_ZONE_MANAGER::OnDropPossible( wxDataViewEvent& aEvent )
331 aEvent.SetDropEffect( wxDragMove );
335void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent )
337 if( aEvent.GetDataFormat() != wxDF_UNICODETEXT )
346 const wxDataViewItem it = aEvent.GetItem();
357 if( rtn.has_value() )
469 m_filler = std::make_unique<ZONE_FILLER>( board,
nullptr );
470 auto reporter = std::make_unique<WX_PROGRESS_REPORTER>(
this,
_(
"Fill All Zones" ), 5,
PR_CAN_ABORT );
471 m_filler->SetProgressReporter( reporter.get() );
486 const_cast<ZONES&
>( board->
Zones() ) = originalZones;
509 unsigned count = aEvent.GetInt();
512 btn->Enable( count > 1 );
518 const wxObject* sender = aEvent.GetEventObject();
522 else if( aEvent.GetEventObject() ==
m_checkNet )
537 if( !selectedItem.IsOk() )
541 const std::optional<unsigned> new_index =
m_modelZonesOverview->MoveZoneIndex( selectedRow, aMove );
543 if( new_index.has_value() )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Information pertinent to a Pcbnew printed circuit board.
const ZONES & Zones() const
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void IncrementTimeStamp()
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
STD_BITMAP_BUTTON * m_btnMoveUp
STD_BITMAP_BUTTON * m_btnMoveTop
DIALOG_ZONE_MANAGER_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Zone Manager"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxSearchCtrl * m_filterCtrl
wxDataViewCtrl * m_viewZonesOverview
STD_BITMAP_BUTTON * m_btnMoveDown
STD_BITMAP_BUTTON * m_btnMoveBottom
void OnZoneNameUpdate(wxCommandEvent &aEvent)
void OnViewZonesOverviewOnLeftUp(wxMouseEvent &aEvent) override
~DIALOG_ZONE_MANAGER() override
void GenericProcessChar(wxKeyEvent &event)
PCB_BASE_FRAME * m_pcbFrame
wxObjectDataPtr< MODEL_ZONES_OVERVIEW > m_modelZonesOverview
PANEL_ZONE_PROPERTIES * m_panelZoneProperties
void OnMoveDownClick(wxCommandEvent &aEvent) override
void PostProcessZoneViewSelChange(wxDataViewItem const &aItem)
std::unique_ptr< ZONE_FILLER > m_filler
void OnMoveTopClick(wxCommandEvent &aEvent) override
void OnTableChar(wxKeyEvent &event) override
void onDialogResize(wxSizeEvent &event) override
void OnMoveUpClick(wxCommandEvent &aEvent) override
void OnDialogCharHook(wxKeyEvent &aEvent)
void OnUpdateDisplayedZonesClick(wxCommandEvent &aEvent) override
void MoveSelectedZonePriority(ZONE_INDEX_MOVEMENT aMove)
ZONE_SETTINGS_BAG m_zoneSettingsBag
void OnDataViewCtrlSelectionChanged(wxDataViewEvent &event) override
std::optional< unsigned > m_priorityDragIndex
void OnTableCharHook(wxKeyEvent &event) override
void OnIdle(wxIdleEvent &aEvent)
void OnZoneNetUpdate(wxCommandEvent &aEvent)
void OnCheckBoxClicked(wxCommandEvent &aEvent)
void OnFilterCtrlTextChange(wxCommandEvent &aEvent) override
void NavigateZoneSelection(int aDirection)
bool TransferDataToWindow() override
ZONE_PREVIEW_NOTEBOOK * m_zonePreviewNotebook
void SelectZoneTableItem(wxDataViewItem const &aItem)
void OnOk(wxCommandEvent &aEvt) override
void OnFilterCtrlCancel(wxCommandEvent &aEvent) override
void OnFilterCtrlEnter(wxCommandEvent &aEvent) override
void OnMoveBottomClick(wxCommandEvent &aEvent) override
void OnZoneSelectionChanged(ZONE *aZone)
DIALOG_ZONE_MANAGER(PCB_BASE_FRAME *aParent)
void OnZonesTableRowCountChange(wxCommandEvent &aEvent)
void OnLayerFilterChanged(wxCommandEvent &aEvent) override
void OnFilterCtrlSearch(wxCommandEvent &aEvent) override
LSET is a set of PCB_LAYER_IDs.
void RunOnLayers(const std::function< void(PCB_LAYER_ID)> &aFunction) const
Execute a function on each layer of the LSET.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static std::map< int, wxString > GetColumnNames()
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Handle a list of polygons defining a copper zone.
std::shared_ptr< SHAPE_POLY_SET > GetFilledPolysList(PCB_LAYER_ID aLayer) 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:
std::vector< ZONE * > ZONES