27#include <wx/dataview.h>
60 m_pcbFrame( aParent ),
61 m_zoneInfo( aZoneInfo ),
63 m_priorityDragIndex( {} ),
64 m_needZoomGAL(
true ),
65 m_isFillingZones(
false ),
66 m_zoneFillComplete(
false )
69 m_sizerZoneOP->InsertSpacer( m_sizerZoneOP->GetItemCount(), 5 );
76 m_sizerProperties->Add( m_panelZoneProperties, 1, wxTOP | wxEXPAND, 5 );
79 m_sizerTop->Add( m_zoneViewer, 1, wxBOTTOM | wxLEFT | wxEXPAND, 10 );
87 m_viewZonesOverview->AppendIconTextColumn( v, k );
89 m_viewZonesOverview->AppendTextColumn( v, k );
93 aParent->GetBoard(), aParent,
this );
94 m_viewZonesOverview->AssociateModel( m_modelZoneOverviewTable.get() );
96#if wxUSE_DRAG_AND_DROP
97 m_viewZonesOverview->EnableDragSource( wxDF_UNICODETEXT );
98 m_viewZonesOverview->EnableDropTarget( wxDF_UNICODETEXT );
100 int id = m_viewZonesOverview->GetId();
101 Bind( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &DIALOG_ZONE_MANAGER::OnBeginDrag,
this,
id );
102 Bind( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &DIALOG_ZONE_MANAGER::OnDropPossible,
this,
id );
103 Bind( wxEVT_DATAVIEW_ITEM_DROP, &DIALOG_ZONE_MANAGER::OnDrop,
this,
id );
111 Bind( wxEVT_BOOKCTRL_PAGE_CHANGED,
112 [
this]( wxNotebookEvent& aEvent )
116 m_zoneViewer->GetId() );
118 if( m_modelZoneOverviewTable->GetCount() )
119 SelectZoneTableItem( m_modelZoneOverviewTable->GetItem( 0 ) );
122 m_MainBoxSizer->Fit(
this );
123 finishDialogSettings();
136 canvas->ZoomFitScreen();
143 long filterInsertPos =
m_filterCtrl->GetInsertionPoint();
165 if( textCtrlHasFocus )
177 if( aEvent.GetKeyCode() == WXK_DOWN || aEvent.GetKeyCode() == WXK_UP )
220 i->OnZoneSelectionChanged( zone );
255 zone_management->OnUserConfirmChange();
274#if wxUSE_DRAG_AND_DROP
276void DIALOG_ZONE_MANAGER::OnBeginDrag( wxDataViewEvent& aEvent )
278 wxTextDataObject* obj =
new wxTextDataObject;
279 obj->SetText(
"42" );
280 aEvent.SetDataObject( obj );
281 aEvent.SetDragFlags( wxDrag_AllowMove );
282 const wxDataViewItem it = aEvent.GetItem();
289void DIALOG_ZONE_MANAGER::OnDropPossible( wxDataViewEvent& aEvent )
291 aEvent.SetDropEffect( wxDragMove );
295void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent )
297 if( aEvent.GetDataFormat() != wxDF_UNICODETEXT )
306 const wxDataViewItem it = aEvent.GetItem();
315 const std::optional<unsigned> rtn =
318 if( rtn.has_value() )
386 auto commit = std::make_unique<BOARD_COMMIT>(
m_pcbFrame );
387 m_filler = std::make_unique<ZONE_FILLER>( board, commit.get() );
388 auto reporter = std::make_unique<WX_PROGRESS_REPORTER>(
this,
_(
"Fill All Zones" ), 5 );
389 m_filler->SetProgressReporter( reporter.get() );
404 gal->RedrawRatsnest();
405 gal->GetView()->UpdateItems();
407 int layer = gal->GetLayer();
408 gal->ActivateSelectedZone(
410 gal->OnLayerSelected( layer );
426 zone->SetZoneName( aEvent.GetString() );
435 unsigned count = aEvent.GetInt();
444 const wxObject* sender = aEvent.GetEventObject();
450 else if( aEvent.GetEventObject() ==
m_checkNet )
470 if( !selectedItem.IsOk() )
474 const std::optional<unsigned> new_index =
477 if( new_index.has_value() )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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()
Class DIALOG_ZONE_MANAGER_BASE.
wxCheckBox * m_checkRepour
STD_BITMAP_BUTTON * m_btnMoveUp
wxSearchCtrl * m_filterCtrl
wxDataViewCtrl * m_viewZonesOverview
STD_BITMAP_BUTTON * m_btnMoveDown
void OnZoneNameUpdate(wxCommandEvent &aEvent)
PANE_ZONE_VIEWER * m_zoneViewer
void OnViewZonesOverviewOnLeftUp(wxMouseEvent &aEvent) override
~DIALOG_ZONE_MANAGER() override
void PostProcessZoneViewSelectionChange(wxDataViewItem const &item)
void GenericProcessChar(wxKeyEvent &event)
PCB_BASE_FRAME * m_pcbFrame
PANEL_ZONE_PROPERTIES * m_panelZoneProperties
void OnMoveDownClick(wxCommandEvent &aEvent) override
std::unique_ptr< ZONE_FILLER > m_filler
void OnRepourCheck(wxCommandEvent &aEvent) override
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)
void OnDataViewCtrlSelectionChanged(wxDataViewEvent &event) override
std::optional< unsigned > m_priorityDragIndex
DIALOG_ZONE_MANAGER(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aZoneInfo)
void OnTableCharHook(wxKeyEvent &event) override
void OnIdle(wxIdleEvent &aEvent)
void OnOk(wxCommandEvent &aEvt)
void OnCheckBoxClicked(wxCommandEvent &aEvent)
void OnFilterCtrlTextChange(wxCommandEvent &aEvent) override
ZONE_SETTINGS * m_zoneInfo
void SelectZoneTableItem(wxDataViewItem const &aItem)
void OnFilterCtrlCancel(wxCommandEvent &aEvent) override
wxObjectDataPtr< MODEL_ZONES_OVERVIEW_TABLE > m_modelZoneOverviewTable
void OnFilterCtrlEnter(wxCommandEvent &aEvent) override
void OnZoneSelectionChanged(ZONE *aZone)
void OnZonesTableRowCountChange(wxCommandEvent &aEvent)
std::unique_ptr< ZONES_CONTAINER > m_zonesContainer
void OnFilterCtrlSearch(wxCommandEvent &aEvent) override
static std::map< int, wxString > GetColumnNames()
bool TransferZoneSettingsFromWindow()
std::shared_ptr< ZONE_SETTINGS > GetZoneSettings() const
void ActivateSelectedZone(ZONE *new_zone) override
PANEL_ZONE_GAL * GetZoneGAL() const
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Classes need post progress after user click OK.
static bool GetRepourOnClose()
static void SetRefillOnClose(bool aRepour)
Should all the zones be re-poured on dialog close.
Subscriber who is interested in the zone selection change.
ZONE_SETTINGS handles zones parameters.
Handle a list of polygons defining a copper zone.
std::vector< ZONE * > ZONES