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 );
66 m_sizerProperties->Add( m_panelZoneProperties, 0, wxEXPAND, 5 );
69 m_sizerPreview->Add( m_zonePreviewNotebook, 1, wxBOTTOM | wxLEFT | wxRIGHT | wxEXPAND, 5 );
74 m_viewZonesOverview->AppendIconTextColumn( v, k, wxDATAVIEW_CELL_INERT, 140 );
76 m_viewZonesOverview->AppendTextColumn( v, k, wxDATAVIEW_CELL_INERT, 160 );
80 m_viewZonesOverview->AssociateModel( m_modelZonesOverview.get() );
82#if wxUSE_DRAG_AND_DROP
83 m_viewZonesOverview->EnableDragSource( wxDF_UNICODETEXT );
84 m_viewZonesOverview->EnableDropTarget( wxDF_UNICODETEXT );
86 int id = m_viewZonesOverview->GetId();
87 Bind( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &DIALOG_ZONE_MANAGER::OnBeginDrag,
this,
id );
88 Bind( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &DIALOG_ZONE_MANAGER::OnDropPossible,
this,
id );
89 Bind( wxEVT_DATAVIEW_ITEM_DROP, &DIALOG_ZONE_MANAGER::OnDrop,
this,
id );
97 Bind( wxEVT_BOOKCTRL_PAGE_CHANGED,
98 [
this]( wxNotebookEvent& aEvent )
102 m_zonePreviewNotebook->GetId() );
105 m_MainBoxSizer->Fit(
this );
106 finishDialogSettings();
127 long filterInsertPos =
m_filterCtrl->GetInsertionPoint();
149 if( textCtrlHasFocus )
161 if( aEvent.GetKeyCode() == WXK_DOWN || aEvent.GetKeyCode() == WXK_UP )
194 wxWindowUpdateLocker updateLock(
this );
234 std::map<PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>> filled_zone_to_restore;
235 ZONE* internal_zone = zone;
243 filled_zone_to_restore[layer] = fill;
248 for(
const auto& [ layer, fill ] : filled_zone_to_restore )
249 zone->SetFilledPolysList( layer, *fill );
256#if wxUSE_DRAG_AND_DROP
258void DIALOG_ZONE_MANAGER::OnBeginDrag( wxDataViewEvent& aEvent )
260 wxTextDataObject* obj =
new wxTextDataObject;
261 obj->SetText(
"42" );
262 aEvent.SetDataObject( obj );
263 aEvent.SetDragFlags( wxDrag_AllowMove );
264 const wxDataViewItem it = aEvent.GetItem();
271void DIALOG_ZONE_MANAGER::OnDropPossible( wxDataViewEvent& aEvent )
273 aEvent.SetDropEffect( wxDragMove );
277void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent )
279 if( aEvent.GetDataFormat() != wxDF_UNICODETEXT )
288 const wxDataViewItem it = aEvent.GetItem();
299 if( rtn.has_value() )
372 m_filler = std::make_unique<ZONE_FILLER>( board,
nullptr );
373 auto reporter = std::make_unique<WX_PROGRESS_REPORTER>(
this,
_(
"Fill All Zones" ), 5,
PR_CAN_ABORT );
374 m_filler->SetProgressReporter( reporter.get() );
389 const_cast<ZONES&
>( board->
Zones() ) = originalZones;
412 unsigned count = aEvent.GetInt();
421 const wxObject* sender = aEvent.GetEventObject();
425 else if( aEvent.GetEventObject() ==
m_checkNet )
440 if( !selectedItem.IsOk() )
444 const std::optional<unsigned> new_index =
m_modelZonesOverview->MoveZoneIndex( selectedRow, aMove );
446 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()
STD_BITMAP_BUTTON * m_btnMoveUp
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
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 OnTableChar(wxKeyEvent &event) override
void onDialogResize(wxSizeEvent &event) override
void OnMoveUpClick(wxCommandEvent &aEvent) override
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
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 OnZoneSelectionChanged(ZONE *aZone)
DIALOG_ZONE_MANAGER(PCB_BASE_FRAME *aParent)
void OnZonesTableRowCountChange(wxCommandEvent &aEvent)
void OnFilterCtrlSearch(wxCommandEvent &aEvent) override
void RunOnLayers(const std::function< void(PCB_LAYER_ID)> &aFunction) const
Execute a function on each layer of the LSET.
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.
const 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