27#include <wx/dataview.h>
31#include <wx/wupdlock.h>
61 m_pcbFrame( aParent ),
62 m_zoneInfo( aZoneInfo ),
64 m_priorityDragIndex( {} ),
65 m_needZoomGAL(
true ),
66 m_isFillingZones(
false ),
67 m_zoneFillComplete(
false )
70 m_sizerZoneOP->InsertSpacer( m_sizerZoneOP->GetItemCount(), 5 );
77 m_sizerProperties->Add( m_panelZoneProperties, 1, wxTOP | wxEXPAND, 5 );
80 m_sizerTop->Add( m_zoneViewer, 1, wxBOTTOM | wxLEFT | wxRIGHT | wxEXPAND, 5 );
88 m_viewZonesOverview->AppendIconTextColumn( v, k );
90 m_viewZonesOverview->AppendTextColumn( v, k );
93 m_modelZonesOverview =
new MODEL_ZONES_OVERVIEW( m_zonesContainer->GetManagedZones(), aParent->GetBoard(),
95 m_viewZonesOverview->AssociateModel( m_modelZonesOverview.get() );
97#if wxUSE_DRAG_AND_DROP
98 m_viewZonesOverview->EnableDragSource( wxDF_UNICODETEXT );
99 m_viewZonesOverview->EnableDropTarget( wxDF_UNICODETEXT );
101 int id = m_viewZonesOverview->GetId();
102 Bind( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &DIALOG_ZONE_MANAGER::OnBeginDrag,
this,
id );
103 Bind( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &DIALOG_ZONE_MANAGER::OnDropPossible,
this,
id );
104 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_modelZonesOverview->GetCount() )
119 SelectZoneTableItem( m_modelZonesOverview->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 )
217 wxWindowUpdateLocker updateLock(
this );
270#if wxUSE_DRAG_AND_DROP
272void DIALOG_ZONE_MANAGER::OnBeginDrag( wxDataViewEvent& aEvent )
274 wxTextDataObject* obj =
new wxTextDataObject;
275 obj->SetText(
"42" );
276 aEvent.SetDataObject( obj );
277 aEvent.SetDragFlags( wxDrag_AllowMove );
278 const wxDataViewItem it = aEvent.GetItem();
285void DIALOG_ZONE_MANAGER::OnDropPossible( wxDataViewEvent& aEvent )
287 aEvent.SetDropEffect( wxDragMove );
291void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent )
293 if( aEvent.GetDataFormat() != wxDF_UNICODETEXT )
302 const wxDataViewItem it = aEvent.GetItem();
313 if( rtn.has_value() )
381 auto commit = std::make_unique<BOARD_COMMIT>(
m_pcbFrame );
382 m_filler = std::make_unique<ZONE_FILLER>( board, commit.get() );
383 auto reporter = std::make_unique<WX_PROGRESS_REPORTER>(
this,
_(
"Fill All Zones" ), 5,
PR_CAN_ABORT );
384 m_filler->SetProgressReporter( reporter.get() );
399 gal->RedrawRatsnest();
400 gal->GetView()->UpdateItems();
402 int layer = gal->GetLayer();
405 ZONE* curr_zone = gal->GetZone();
406 gal->ActivateSelectedZone( curr_zone );
408 gal->OnLayerSelected( layer );
424 zone->SetZoneName( aEvent.GetString() );
432 unsigned count = aEvent.GetInt();
441 const wxObject* sender = aEvent.GetEventObject();
445 else if( aEvent.GetEventObject() ==
m_checkNet )
460 if( !selectedItem.IsOk() )
464 const std::optional<unsigned> new_index =
m_modelZonesOverview->MoveZoneIndex( selectedRow, aMove );
466 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()
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 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 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
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()
void OnUserConfirmChange() override
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.
static bool GetRepourOnClose()
static void SetRefillOnClose(bool aRepour)
Should all the zones be re-poured on dialog close.
void OnZoneSelectionChanged(ZONE *aZone)
Inform the subscriber about the zone selection change.
ZONE_SETTINGS handles zones parameters.
void CopyFrom(const ZONE_SETTINGS &aOther, bool aCopyFull=true)
Function CopyFrom copy settings from a different ZONE_SETTINGS object.
Handle a list of polygons defining a copper zone.
std::vector< ZONE * > ZONES