27#include <wx/dataview.h>
31#include <wx/wupdlock.h>
56 m_needZoomGAL(
true ),
57 m_isFillingZones(
false ),
58 m_zoneFillComplete(
false )
61 m_sizerZoneOP->InsertSpacer( m_sizerZoneOP->GetItemCount(), 5 );
68 m_sizerProperties->Add( m_panelZoneProperties, 0, wxEXPAND, 5 );
71 m_sizerPreview->Add( m_zonePreviewNotebook, 1, wxALL | wxEXPAND, 5 );
76 m_viewZonesOverview->AppendIconTextColumn( v, k, wxDATAVIEW_CELL_INERT, 140 );
78 m_viewZonesOverview->AppendTextColumn( v, k, wxDATAVIEW_CELL_INERT, 160 );
81 m_modelZonesOverview =
new MODEL_ZONES_OVERVIEW( m_zoneSettingsBag.GetManagedZones(), aParent->GetBoard(),
83 m_viewZonesOverview->AssociateModel( m_modelZonesOverview.get() );
85#if wxUSE_DRAG_AND_DROP
86 m_viewZonesOverview->EnableDragSource( wxDF_UNICODETEXT );
87 m_viewZonesOverview->EnableDropTarget( wxDF_UNICODETEXT );
89 int id = m_viewZonesOverview->GetId();
90 Bind( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &DIALOG_ZONE_MANAGER::OnBeginDrag,
this,
id );
91 Bind( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &DIALOG_ZONE_MANAGER::OnDropPossible,
this,
id );
92 Bind( wxEVT_DATAVIEW_ITEM_DROP, &DIALOG_ZONE_MANAGER::OnDrop,
this,
id );
100 Bind( wxEVT_BOOKCTRL_PAGE_CHANGED,
101 [
this]( wxNotebookEvent& aEvent )
105 m_zonePreviewNotebook->GetId() );
107 if( m_modelZonesOverview->GetCount() )
108 SelectZoneTableItem( m_modelZonesOverview->GetItem( 0 ) );
111 m_MainBoxSizer->Fit(
this );
112 finishDialogSettings();
131 long filterInsertPos =
m_filterCtrl->GetInsertionPoint();
153 if( textCtrlHasFocus )
165 if( aEvent.GetKeyCode() == WXK_DOWN || aEvent.GetKeyCode() == WXK_UP )
205 wxWindowUpdateLocker updateLock(
this );
252#if wxUSE_DRAG_AND_DROP
254void DIALOG_ZONE_MANAGER::OnBeginDrag( wxDataViewEvent& aEvent )
256 wxTextDataObject* obj =
new wxTextDataObject;
257 obj->SetText(
"42" );
258 aEvent.SetDataObject( obj );
259 aEvent.SetDragFlags( wxDrag_AllowMove );
260 const wxDataViewItem it = aEvent.GetItem();
267void DIALOG_ZONE_MANAGER::OnDropPossible( wxDataViewEvent& aEvent )
269 aEvent.SetDropEffect( wxDragMove );
273void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent )
275 if( aEvent.GetDataFormat() != wxDF_UNICODETEXT )
284 const wxDataViewItem it = aEvent.GetItem();
295 if( rtn.has_value() )
363 auto commit = std::make_unique<BOARD_COMMIT>(
m_pcbFrame );
364 m_filler = std::make_unique<ZONE_FILLER>( board, commit.get() );
365 auto reporter = std::make_unique<WX_PROGRESS_REPORTER>(
this,
_(
"Fill All Zones" ), 5,
PR_CAN_ABORT );
366 m_filler->SetProgressReporter( reporter.get() );
394 zone->SetZoneName( aEvent.GetString() );
404 zone->SetNetCode( aEvent.GetId() );
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
DIALOG_ZONE_MANAGER(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aZoneInfo)
void OnTableCharHook(wxKeyEvent &event) override
void OnIdle(wxIdleEvent &aEvent)
void OnZoneNetUpdate(wxCommandEvent &aEvent)
void OnCheckBoxClicked(wxCommandEvent &aEvent)
void OnFilterCtrlTextChange(wxCommandEvent &aEvent) override
ZONE_SETTINGS * m_zoneInfo
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)
void OnZonesTableRowCountChange(wxCommandEvent &aEvent)
void OnFilterCtrlSearch(wxCommandEvent &aEvent) override
static std::map< int, wxString > GetColumnNames()
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
ZONE_SETTINGS handles zones parameters.
Handle a list of polygons defining a copper zone.
std::vector< ZONE * > ZONES