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 );
110 Bind( wxEVT_BOOKCTRL_PAGE_CHANGED,
111 [
this]( wxNotebookEvent& aEvent )
115 m_zoneViewer->GetId() );
117 if( m_modelZoneOverviewTable->GetCount() )
118 SelectZoneTableItem( m_modelZoneOverviewTable->GetItem( 0 ) );
121 m_MainBoxSizer->Fit(
this );
122 finishDialogSettings();
135 canvas->ZoomFitScreen();
142 long filterInsertPos =
m_filterCtrl->GetInsertionPoint();
164 if( textCtrlHasFocus )
176 if( aEvent.GetKeyCode() == WXK_DOWN || aEvent.GetKeyCode() == WXK_UP )
221 i->OnZoneSelectionChanged( zone );
257 zone_management->OnUserConfirmChange();
276#if wxUSE_DRAG_AND_DROP
278void DIALOG_ZONE_MANAGER::OnBeginDrag( wxDataViewEvent& aEvent )
280 wxTextDataObject* obj =
new wxTextDataObject;
281 obj->SetText(
"42" );
282 aEvent.SetDataObject( obj );
283 aEvent.SetDragFlags( wxDrag_AllowMove );
284 const wxDataViewItem it = aEvent.GetItem();
291void DIALOG_ZONE_MANAGER::OnDropPossible( wxDataViewEvent& aEvent )
293 aEvent.SetDropEffect( wxDragMove );
297void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent )
299 if( aEvent.GetDataFormat() != wxDF_UNICODETEXT )
308 const wxDataViewItem it = aEvent.GetItem();
317 const std::optional<unsigned> rtn =
320 if( rtn.has_value() )
388 auto commit = std::make_unique<BOARD_COMMIT>(
m_pcbFrame );
389 m_filler = std::make_unique<ZONE_FILLER>( board, commit.get() );
390 auto reporter = std::make_unique<WX_PROGRESS_REPORTER>(
this,
_(
"Fill All Zones" ), 5 );
391 m_filler->SetProgressReporter( reporter.get() );
406 gal->RedrawRatsnest();
407 gal->GetView()->UpdateItems();
409 int layer = gal->GetLayer();
412 ZONE* curr_zone = gal->GetZone();
413 gal->ActivateSelectedZone( curr_zone );
415 gal->OnLayerSelected( layer );
431 zone->SetZoneName( aEvent.GetString() );
440 unsigned count = aEvent.GetInt();
449 const wxObject* sender = aEvent.GetEventObject();
455 else if( aEvent.GetEventObject() ==
m_checkNet )
475 if( !selectedItem.IsOk() )
479 const std::optional<unsigned> new_index =
482 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 OnCheckBoxClicked(wxCommandEvent &aEvent)
void OnFilterCtrlTextChange(wxCommandEvent &aEvent) override
ZONE_SETTINGS * m_zoneInfo
void SelectZoneTableItem(wxDataViewItem const &aItem)
void OnOk(wxCommandEvent &aEvt) override
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