27#include <wx/dataview.h>
31#include <wx/wupdlock.h>
55 m_needZoomGAL(
true ),
56 m_isFillingZones(
false ),
57 m_zoneFillComplete(
false )
60 m_sizerZoneOP->InsertSpacer( m_sizerZoneOP->GetItemCount(), 5 );
67 m_sizerProperties->Add( m_panelZoneProperties, 0, wxEXPAND, 5 );
70 m_sizerPreview->Add( m_zonePreviewNotebook, 1, wxALL | wxEXPAND, 5 );
75 m_viewZonesOverview->AppendIconTextColumn( v, k, wxDATAVIEW_CELL_INERT, 140 );
77 m_viewZonesOverview->AppendTextColumn( v, k, wxDATAVIEW_CELL_INERT, 160 );
81 m_viewZonesOverview->AssociateModel( m_modelZonesOverview.get() );
83#if wxUSE_DRAG_AND_DROP
84 m_viewZonesOverview->EnableDragSource( wxDF_UNICODETEXT );
85 m_viewZonesOverview->EnableDropTarget( wxDF_UNICODETEXT );
87 int id = m_viewZonesOverview->GetId();
88 Bind( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &DIALOG_ZONE_MANAGER::OnBeginDrag,
this,
id );
89 Bind( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &DIALOG_ZONE_MANAGER::OnDropPossible,
this,
id );
90 Bind( wxEVT_DATAVIEW_ITEM_DROP, &DIALOG_ZONE_MANAGER::OnDrop,
this,
id );
98 Bind( wxEVT_BOOKCTRL_PAGE_CHANGED,
99 [
this]( wxNotebookEvent& aEvent )
103 m_zonePreviewNotebook->GetId() );
106 m_MainBoxSizer->Fit(
this );
107 finishDialogSettings();
137 long filterInsertPos =
m_filterCtrl->GetInsertionPoint();
159 if( textCtrlHasFocus )
171 if( aEvent.GetKeyCode() == WXK_DOWN || aEvent.GetKeyCode() == WXK_UP )
211 wxWindowUpdateLocker updateLock(
this );
251 std::map<PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>> filled_zone_to_restore;
252 ZONE* internal_zone = zone;
260 filled_zone_to_restore[layer] = fill;
265 for(
const auto& [ layer, fill ] : filled_zone_to_restore )
266 zone->SetFilledPolysList( layer, *fill );
273#if wxUSE_DRAG_AND_DROP
275void DIALOG_ZONE_MANAGER::OnBeginDrag( wxDataViewEvent& aEvent )
277 wxTextDataObject* obj =
new wxTextDataObject;
278 obj->SetText(
"42" );
279 aEvent.SetDataObject( obj );
280 aEvent.SetDragFlags( wxDrag_AllowMove );
281 const wxDataViewItem it = aEvent.GetItem();
288void DIALOG_ZONE_MANAGER::OnDropPossible( wxDataViewEvent& aEvent )
290 aEvent.SetDropEffect( wxDragMove );
294void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent )
296 if( aEvent.GetDataFormat() != wxDF_UNICODETEXT )
305 const wxDataViewItem it = aEvent.GetItem();
316 if( rtn.has_value() )
383 auto commit = std::make_unique<BOARD_COMMIT>(
m_pcbFrame );
384 m_filler = std::make_unique<ZONE_FILLER>( board, commit.get() );
385 auto reporter = std::make_unique<WX_PROGRESS_REPORTER>(
this,
_(
"Fill All Zones" ), 5,
PR_CAN_ABORT );
386 m_filler->SetProgressReporter( reporter.get() );
426 unsigned count = aEvent.GetInt();
435 const wxObject* sender = aEvent.GetEventObject();
439 else if( aEvent.GetEventObject() ==
m_checkNet )
454 if( !selectedItem.IsOk() )
458 const std::optional<unsigned> new_index =
m_modelZonesOverview->MoveZoneIndex( selectedRow, aMove );
460 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