diff --git a/pcbnew/tools/global_edit_tool.cpp b/pcbnew/tools/global_edit_tool.cpp index b00b758ca1..644a1439cf 100644 --- a/pcbnew/tools/global_edit_tool.cpp +++ b/pcbnew/tools/global_edit_tool.cpp @@ -21,10 +21,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #include -#include -#include #include #include #include @@ -33,10 +32,9 @@ #include #include #include -#include #include -#include #include +#include GLOBAL_EDIT_TOOL::GLOBAL_EDIT_TOOL() : @@ -230,15 +228,19 @@ int GLOBAL_EDIT_TOOL::RemoveUnusedPads( const TOOL_EVENT& aEvent ) int GLOBAL_EDIT_TOOL::ZonesManager( const TOOL_EVENT& aEvent ) { PCB_EDIT_FRAME* editFrame = getEditFrame(); - - BOARD_COMMIT commit( editFrame ); - BOARD* board = editFrame->GetBoard(); + BOARD_COMMIT commit( editFrame ); + BOARD* board = editFrame->GetBoard(); for( ZONE* zone : board->Zones() ) commit.Modify( zone ); - ZONE_SETTINGS zoneInfo = board->GetDesignSettings().GetDefaultZoneSettings(); - int dialogResult = InvokeZonesManager( editFrame, &zoneInfo ); + ZONE_SETTINGS zoneInfo = board->GetDesignSettings().GetDefaultZoneSettings(); + DIALOG_ZONE_MANAGER dlg( editFrame, &zoneInfo ); + + int dialogResult = dlg.ShowQuasiModal(); + + if( dialogResult == wxID_OK && ZONE_MANAGER_PREFERENCE::GetRepourOnClose() ) + dialogResult = ZONE_MANAGER_REPOUR; if( dialogResult == wxID_CANCEL ) return 0; diff --git a/pcbnew/zone_manager/board_edges_bounding_item.cpp b/pcbnew/zone_manager/board_edges_bounding_item.cpp index e3856c7f4d..e349c3c9b8 100644 --- a/pcbnew/zone_manager/board_edges_bounding_item.cpp +++ b/pcbnew/zone_manager/board_edges_bounding_item.cpp @@ -26,19 +26,18 @@ #include "layer_ids.h" -BOARD_EDGES_BOUNDING_ITEM::BOARD_EDGES_BOUNDING_ITEM( BOX2I box ) : m_box( std::move( box ) ) +BOARD_EDGES_BOUNDING_ITEM::BOARD_EDGES_BOUNDING_ITEM( BOX2I box ) : + m_box( std::move( box ) ) { } -BOARD_EDGES_BOUNDING_ITEM::~BOARD_EDGES_BOUNDING_ITEM() -{ -} const BOX2I BOARD_EDGES_BOUNDING_ITEM::ViewBBox() const { return m_box; } + void BOARD_EDGES_BOUNDING_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const { // Basic fallback diff --git a/pcbnew/zone_manager/board_edges_bounding_item.h b/pcbnew/zone_manager/board_edges_bounding_item.h index c80dbc052a..3229cf6308 100644 --- a/pcbnew/zone_manager/board_edges_bounding_item.h +++ b/pcbnew/zone_manager/board_edges_bounding_item.h @@ -30,13 +30,12 @@ class BOARD_EDGES_BOUNDING_ITEM : public KIGFX::VIEW_ITEM { public: BOARD_EDGES_BOUNDING_ITEM( BOX2I aBox ); - ~BOARD_EDGES_BOUNDING_ITEM() override; + ~BOARD_EDGES_BOUNDING_ITEM() override {}; const BOX2I ViewBBox() const override; void ViewGetLayers( int aLayers[], int& aCount ) const override; - private: BOX2I m_box; }; diff --git a/pcbnew/zone_manager/dialog_zone_manager.cpp b/pcbnew/zone_manager/dialog_zone_manager.cpp index 4e3d94f391..bb85282f1e 100644 --- a/pcbnew/zone_manager/dialog_zone_manager.cpp +++ b/pcbnew/zone_manager/dialog_zone_manager.cpp @@ -28,23 +28,17 @@ #include #include #include -#include #include -#include #include #include #include -#include #include -#include +#include #include #include #include -#include #include -#include #include -#include #include #include "dialog_zone_manager_base.h" @@ -61,14 +55,89 @@ #include "zone_manager_preference.h" -inline void DIALOG_ZONE_MANAGER::FitCanvasToScreen() +DIALOG_ZONE_MANAGER::DIALOG_ZONE_MANAGER( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aZoneInfo ) : + DIALOG_ZONE_MANAGER_BASE( aParent ), + m_pcbFrame( aParent ), + m_zoneInfo( aZoneInfo ), + m_zonesContainer( std::make_unique( aParent->GetBoard() ) ), + m_priorityDragIndex( {} ), + m_needZoomGAL( true ), + m_isFillingZones( false ), + m_zoneFillComplete( false ) +{ +#ifdef __APPLE__ + m_sizerZoneOP->InsertSpacer( m_sizerZoneOP->GetItemCount(), 5 ); +#endif + + m_btnMoveUp->SetBitmap( KiBitmapBundle( BITMAPS::small_up ) ); + m_btnMoveDown->SetBitmap( KiBitmapBundle( BITMAPS::small_down ) ); + + m_panelZoneProperties = new PANEL_ZONE_PROPERTIES( this, aParent, *m_zonesContainer ); + m_sizerProperties->Add( m_panelZoneProperties, 1, wxTOP | wxEXPAND, 5 ); + + m_zoneViewer = new PANE_ZONE_VIEWER( this, aParent ); + m_sizerTop->Add( m_zoneViewer, 1, wxBOTTOM | wxLEFT | wxEXPAND, 10 ); + + m_checkRepour->SetValue( ZONE_MANAGER_PREFERENCE::GetRepourOnClose() ); + m_zoneViewer->SetId( ZONE_VIEWER ); + + for( const auto& [k, v] : MODEL_ZONES_OVERVIEW_TABLE::GetColumnNames() ) + { + if( k == MODEL_ZONES_OVERVIEW_TABLE::LAYERS ) + m_viewZonesOverview->AppendIconTextColumn( v, k ); + else + m_viewZonesOverview->AppendTextColumn( v, k ); + } + + m_modelZoneOverviewTable = new MODEL_ZONES_OVERVIEW_TABLE( m_zonesContainer->GetZonesPriorityContainers(), + aParent->GetBoard(), aParent, this ); + m_viewZonesOverview->AssociateModel( m_modelZoneOverviewTable.get() ); + +#if wxUSE_DRAG_AND_DROP + m_viewZonesOverview->EnableDragSource( wxDF_UNICODETEXT ); + m_viewZonesOverview->EnableDropTarget( wxDF_UNICODETEXT ); + + Bind( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &DIALOG_ZONE_MANAGER::OnBeginDrag, this, + VIEW_ZONE_TABLE ); + Bind( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &DIALOG_ZONE_MANAGER::OnDropPossible, this, + VIEW_ZONE_TABLE ); + Bind( wxEVT_DATAVIEW_ITEM_DROP, &DIALOG_ZONE_MANAGER::OnDrop, this, VIEW_ZONE_TABLE ); +#endif // wxUSE_DRAG_AND_DROP + + Bind( wxEVT_BUTTON, &DIALOG_ZONE_MANAGER::OnOk, this, wxID_OK ); + Bind( EVT_ZONE_NAME_UPDATE, &DIALOG_ZONE_MANAGER::OnZoneNameUpdate, this ); + Bind( EVT_ZONES_OVERVIEW_COUNT_CHANGE, &DIALOG_ZONE_MANAGER::OnZonesTableRowCountChange, this ); + Bind( wxEVT_CHECKBOX, &DIALOG_ZONE_MANAGER::OnCheckBoxClicked, this ); + Bind( wxEVT_IDLE, &DIALOG_ZONE_MANAGER::OnIdle, this ); + Bind( wxEVT_BOOKCTRL_PAGE_CHANGED, + [this]( wxNotebookEvent& aEvent ) + { + Layout(); + }, + ZONE_VIEWER ); + + if( m_modelZoneOverviewTable->GetCount() ) + SelectZoneTableItem( m_modelZoneOverviewTable->GetItem( 0 ) ); + + Layout(); + m_MainBoxSizer->Fit( this ); + + //NOTE - Works on Windows and MacOS , need further handling in IDLE on Ubuntu + FitCanvasToScreen(); +} + + +DIALOG_ZONE_MANAGER::~DIALOG_ZONE_MANAGER() = default; + + +void DIALOG_ZONE_MANAGER::FitCanvasToScreen() { if( PANEL_ZONE_GAL* canvas = m_zoneViewer->GetZoneGAL() ) canvas->ZoomFitScreen(); } -inline void DIALOG_ZONE_MANAGER::PostProcessZoneViewSelectionChange( wxDataViewItem const& aItem ) +void DIALOG_ZONE_MANAGER::PostProcessZoneViewSelectionChange( wxDataViewItem const& aItem ) { bool textCtrlHasFocus = m_filterCtrl->HasFocus(); long filterInsertPos = m_filterCtrl->GetInsertionPoint(); @@ -101,14 +170,12 @@ inline void DIALOG_ZONE_MANAGER::PostProcessZoneViewSelectionChange( wxDataViewI } -inline void DIALOG_ZONE_MANAGER::GenericProcessChar( wxKeyEvent& aEvent ) +void DIALOG_ZONE_MANAGER::GenericProcessChar( wxKeyEvent& aEvent ) { aEvent.Skip(); if( aEvent.GetKeyCode() == WXK_DOWN || aEvent.GetKeyCode() == WXK_UP ) - { - Bind( wxEVT_IDLE, &DIALOG_ZONE_MANAGER::OnIDle, this ); - } + Bind( wxEVT_IDLE, &DIALOG_ZONE_MANAGER::OnIdle, this ); } @@ -124,11 +191,11 @@ void DIALOG_ZONE_MANAGER::OnTableCharHook( wxKeyEvent& aEvent ) } -void DIALOG_ZONE_MANAGER::OnIDle( wxIdleEvent& aEvent ) +void DIALOG_ZONE_MANAGER::OnIdle( wxIdleEvent& aEvent ) { WXUNUSED( aEvent ) m_viewZonesOverview->SetFocus(); - Unbind( wxEVT_IDLE, &DIALOG_ZONE_MANAGER::OnIDle, this ); + Unbind( wxEVT_IDLE, &DIALOG_ZONE_MANAGER::OnIdle, this ); if( !m_needZoomGAL ) return; @@ -138,94 +205,6 @@ void DIALOG_ZONE_MANAGER::OnIDle( wxIdleEvent& aEvent ) } -DIALOG_ZONE_MANAGER::DIALOG_ZONE_MANAGER( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aZoneInfo ) : - DIALOG_ZONE_MANAGER_BASE( aParent ), m_pcbFrame( aParent ), m_zoneInfo( aZoneInfo ), - m_zonesContainer( std::make_unique( aParent->GetBoard() ) ), - m_panelZoneProperties( new PANEL_ZONE_PROPERTIES( this, aParent, *m_zonesContainer ) ), - m_modelZoneOverviewTable( - new MODEL_ZONES_OVERVIEW_TABLE( m_zonesContainer->GetZonesPriorityContainers(), - aParent->GetBoard(), aParent, this ) ), - m_zoneViewer( new PANE_ZONE_VIEWER( this, aParent ) ), m_priorityDragIndex( {} ), - m_needZoomGAL( true ), m_isFillingZones( false ), m_zoneFillComplete( false ) -{ -#ifdef __APPLE__ - m_sizerZoneOP->InsertSpacer( m_sizerZoneOP->GetItemCount(), 5 ); -#endif - - m_btnMoveUp->SetBitmap( KiBitmapBundle( BITMAPS::small_up ) ); - m_btnMoveDown->SetBitmap( KiBitmapBundle( BITMAPS::small_down ) ); - m_sizerProperties->Add( m_panelZoneProperties, 1, wxALL | wxEXPAND ); - m_sizerTop->Add( m_zoneViewer, 1, wxBOTTOM | wxTOP | wxRIGHT | wxEXPAND, 5 ); - m_checkRepour->SetValue( ZONE_MANAGER_PREFERENCE::GetRepourOnClose() ); - m_zoneViewer->SetId( ZONE_VIEWER ); - - for( const auto& [k, v] : MODEL_ZONES_OVERVIEW_TABLE::GetColumnNames() ) - { - if( k == MODEL_ZONES_OVERVIEW_TABLE::LAYERS ) - m_viewZonesOverview->AppendIconTextColumn( v, k ); - else - m_viewZonesOverview->AppendTextColumn( v, k ); - } - - m_viewZonesOverview->AssociateModel( m_modelZoneOverviewTable.get() ); - -#if wxUSE_DRAG_AND_DROP - - m_viewZonesOverview->EnableDragSource( wxDF_UNICODETEXT ); - m_viewZonesOverview->EnableDropTarget( wxDF_UNICODETEXT ); - - Bind( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &DIALOG_ZONE_MANAGER::OnBeginDrag, this, - VIEW_ZONE_TABLE ); - Bind( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &DIALOG_ZONE_MANAGER::OnDropPossible, this, - VIEW_ZONE_TABLE ); - Bind( wxEVT_DATAVIEW_ITEM_DROP, &DIALOG_ZONE_MANAGER::OnDrop, this, VIEW_ZONE_TABLE ); - -#endif // wxUSE_DRAG_AND_DROP - - Bind( wxEVT_BUTTON, &DIALOG_ZONE_MANAGER::OnOk, this, wxID_OK ); - Bind( EVT_ZONE_NAME_UPDATE, &DIALOG_ZONE_MANAGER::OnZoneNameUpdate, this ); - Bind( EVT_ZONES_OVERVIEW_COUNT_CHANGE, &DIALOG_ZONE_MANAGER::OnZonesTableRowCountChange, this ); - Bind( wxEVT_CHECKBOX, &DIALOG_ZONE_MANAGER::OnCheckBoxClicked, this ); - Bind( wxEVT_IDLE, &DIALOG_ZONE_MANAGER::OnIDle, this ); - Bind( wxEVT_BUTTON, &DIALOG_ZONE_MANAGER::OnMoveUpClick, this, BTN_MOVE_UP ); - Bind( wxEVT_BUTTON, &DIALOG_ZONE_MANAGER::OnMoveDownClick, this, BTN_MOVE_DOWN ); - Bind( - wxEVT_BOOKCTRL_PAGE_CHANGED, - [this]( wxNotebookEvent& aEvent ) - { - Layout(); - }, - ZONE_VIEWER ); - - bool foundZone = m_modelZoneOverviewTable->GetCount(); - - if( foundZone ) - SelectZoneTableItem( m_modelZoneOverviewTable->GetItem( 0 ) ); - - Layout(); - m_MainBoxSizer->Fit( this ); - - //NOTE - Works on Windows and MacOS , need further handling in IDLE on Ubuntu - FitCanvasToScreen(); -} - - -DIALOG_ZONE_MANAGER::~DIALOG_ZONE_MANAGER() = default; - - -int InvokeZonesManager( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aZoneInfo ) -{ - DIALOG_ZONE_MANAGER dlg( aCaller, aZoneInfo ); - - const int res = dlg.ShowQuasiModal(); - - if( res == wxID_OK && ZONE_MANAGER_PREFERENCE::GetRepourOnClose() ) - return ZONE_MANAGER_REPOUR; - - return res; -} - - void DIALOG_ZONE_MANAGER::onDialogResize( wxSizeEvent& event ) { event.Skip(); @@ -247,7 +226,7 @@ void DIALOG_ZONE_MANAGER::OnZoneSelectionChanged( ZONE* zone ) void DIALOG_ZONE_MANAGER::OnViewZonesOverviewOnLeftUp( wxMouseEvent& aEvent ) { - Bind( wxEVT_IDLE, &DIALOG_ZONE_MANAGER::OnIDle, this ); + Bind( wxEVT_IDLE, &DIALOG_ZONE_MANAGER::OnIdle, this ); } @@ -286,6 +265,12 @@ void DIALOG_ZONE_MANAGER::OnOk( wxCommandEvent& aEvt ) } +void DIALOG_ZONE_MANAGER::OnRepourCheck( wxCommandEvent& aEvent ) +{ + ZONE_MANAGER_PREFERENCE::SetRefillOnClose( m_checkRepour->IsChecked() ); +} + + #if wxUSE_DRAG_AND_DROP void DIALOG_ZONE_MANAGER::OnBeginDrag( wxDataViewEvent& aEvent ) @@ -307,12 +292,6 @@ void DIALOG_ZONE_MANAGER::OnDropPossible( wxDataViewEvent& aEvent ) } -void DIALOG_ZONE_MANAGER::OnRepourCheck( wxCommandEvent& aEvent ) -{ - ZONE_MANAGER_PREFERENCE::SetRepourOnClose( m_checkRepour->IsChecked() ); -} - - void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent ) { if( aEvent.GetDataFormat() != wxDF_UNICODETEXT ) @@ -349,14 +328,12 @@ void DIALOG_ZONE_MANAGER::OnDrop( wxDataViewEvent& aEvent ) void DIALOG_ZONE_MANAGER::OnMoveUpClick( wxCommandEvent& aEvent ) { - WXUNUSED( aEvent ); MoveSelectedZonePriority( ZONE_INDEX_MOVEMENT::MOVE_UP ); } void DIALOG_ZONE_MANAGER::OnMoveDownClick( wxCommandEvent& aEvent ) { - WXUNUSED( aEvent ); MoveSelectedZonePriority( ZONE_INDEX_MOVEMENT::MOVE_DOWN ); } @@ -422,7 +399,7 @@ void DIALOG_ZONE_MANAGER::OnButtonApplyClick( wxCommandEvent& aEvent ) board->BuildConnectivity(); const_cast( board->Zones() ) = m_zonesContainer->GetOriginalZoneList(); - if( auto gal = m_zoneViewer->GetZoneGAL() ) + if( PANEL_ZONE_GAL* gal = m_zoneViewer->GetZoneGAL() ) { gal->RedrawRatsnest(); gal->GetView()->UpdateItems(); diff --git a/pcbnew/zone_manager/dialog_zone_manager.h b/pcbnew/zone_manager/dialog_zone_manager.h index 104775d947..6466644b95 100644 --- a/pcbnew/zone_manager/dialog_zone_manager.h +++ b/pcbnew/zone_manager/dialog_zone_manager.h @@ -55,6 +55,7 @@ class ZONE_FILLER; class COMMIT; class PANEL_ZONE_GAL; enum class ZONE_INDEX_MOVEMENT; + class DIALOG_ZONE_MANAGER : public DIALOG_ZONE_MANAGER_BASE { enum @@ -76,58 +77,41 @@ protected: void OnViewZonesOverviewOnLeftUp( wxMouseEvent& aEvent ) override; void onDialogResize( wxSizeEvent& event ) override; - void OnOk( wxCommandEvent& aEvt ); - #if wxUSE_DRAG_AND_DROP - void OnBeginDrag( wxDataViewEvent& aEvent ); - void OnDropPossible( wxDataViewEvent& aEvent ); - void OnDrop( wxDataViewEvent& aEvent ); - #endif // wxUSE_DRAG_AND_DROP void OnZoneNameUpdate( wxCommandEvent& aEvent ); - void OnZonesTableRowCountChange( wxCommandEvent& aEvent ); - void OnCheckBoxClicked( wxCommandEvent& aEvent ); void MoveSelectedZonePriority( ZONE_INDEX_MOVEMENT aMove ); - void OnMoveUpClick( wxCommandEvent& aEvent ); - - void OnMoveDownClick( wxCommandEvent& aEvent ); - + void OnMoveUpClick( wxCommandEvent& aEvent ) override; + void OnMoveDownClick( wxCommandEvent& aEvent ) override; void OnFilterCtrlCancel( wxCommandEvent& aEvent ) override; - void OnFilterCtrlSearch( wxCommandEvent& aEvent ) override; - void OnFilterCtrlTextChange( wxCommandEvent& aEvent ) override; - void OnFilterCtrlEnter( wxCommandEvent& aEvent ) override; - void OnRepourCheck( wxCommandEvent& aEvent ) override; - void OnButtonApplyClick( wxCommandEvent& aEvent ) override; void PostProcessZoneViewSelectionChange( wxDataViewItem const& item ); void OnTableChar( wxKeyEvent& event ) override; - void OnTableCharHook( wxKeyEvent& event ) override; private: void GenericProcessChar( wxKeyEvent& event ); - void OnIDle( wxIdleEvent& aEvent ); + void OnIdle( wxIdleEvent& aEvent ); void FitCanvasToScreen(); - private: PCB_BASE_FRAME* m_pcbFrame; ZONE_SETTINGS* m_zoneInfo; diff --git a/pcbnew/zone_manager/dialog_zone_manager_base.cpp b/pcbnew/zone_manager/dialog_zone_manager_base.cpp index 0e86dca615..47ebbb6990 100644 --- a/pcbnew/zone_manager/dialog_zone_manager_base.cpp +++ b/pcbnew/zone_manager/dialog_zone_manager_base.cpp @@ -1,10 +1,12 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "widgets/std_bitmap_button.h" + #include "dialog_zone_manager_base.h" /////////////////////////////////////////////////////////////////////////// @@ -15,74 +17,73 @@ DIALOG_ZONE_MANAGER_BASE::DIALOG_ZONE_MANAGER_BASE( wxWindow* parent, wxWindowID m_MainBoxSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizer12; - bSizer12 = new wxBoxSizer( wxVERTICAL ); - m_sizerTop = new wxBoxSizer( wxHORIZONTAL ); - wxBoxSizer* bSizer7; - bSizer7 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* leftColumn; + leftColumn = new wxBoxSizer( wxVERTICAL ); - m_viewZonesOverview = new wxDataViewCtrl( this, VIEW_ZONE_TABLE, wxDefaultPosition, wxSize( -1,240 ), wxDV_HORIZ_RULES|wxDV_ROW_LINES|wxDV_SINGLE|wxDV_VERT_RULES ); - m_viewZonesOverview->SetMinSize( wxSize( -1,240 ) ); - - bSizer7->Add( m_viewZonesOverview, 1, wxALL|wxEXPAND, 0 ); - - m_sizerZoneOP = new wxBoxSizer( wxHORIZONTAL ); - - m_btnMoveUp = new STD_BITMAP_BUTTON( this, BTN_MOVE_UP, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - m_btnMoveUp->SetToolTip( _("Top zone has the highest priority. When a zone is inside another zone, if its priority is higher, its outlines are removed from the other zone.") ); - - m_sizerZoneOP->Add( m_btnMoveUp, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_btnMoveDown = new STD_BITMAP_BUTTON( this, BTN_MOVE_DOWN, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - m_btnMoveDown->SetToolTip( _("Top zone has the highest priority. When a zone is inside another zone, if its priority is higher, its outlines are removed from the other zone.") ); - - m_sizerZoneOP->Add( m_btnMoveDown, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - - m_sizerZoneOP->Add( 0, 0, 0, wxEXPAND, 5 ); - - m_checkName = new wxCheckBox( this, CHECK_NAME, _("Name"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkName->SetValue(true); - m_sizerZoneOP->Add( m_checkName, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_checkNet = new wxCheckBox( this, CHECK_NET, _("Net"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkNet->SetValue(true); - m_sizerZoneOP->Add( m_checkNet, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + wxBoxSizer* searchSizer; + searchSizer = new wxBoxSizer( wxHORIZONTAL ); m_filterCtrl = new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); #ifndef __WXMAC__ m_filterCtrl->ShowSearchButton( true ); #endif m_filterCtrl->ShowCancelButton( true ); - m_sizerZoneOP->Add( m_filterCtrl, 1, wxEXPAND, 5 ); + searchSizer->Add( m_filterCtrl, 1, wxEXPAND|wxBOTTOM, 1 ); - bSizer7->Add( m_sizerZoneOP, 0, wxEXPAND|wxLEFT|wxTOP, 5 ); + searchSizer->Add( 10, 0, 0, wxEXPAND, 5 ); + + m_checkName = new wxCheckBox( this, CHECK_NAME, _("Name"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkName->SetValue(true); + searchSizer->Add( m_checkName, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_checkNet = new wxCheckBox( this, CHECK_NET, _("Net"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkNet->SetValue(true); + searchSizer->Add( m_checkNet, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_sizerTop->Add( bSizer7, 1, wxALL|wxEXPAND, 5 ); + leftColumn->Add( searchSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 3 ); + + m_viewZonesOverview = new wxDataViewCtrl( this, VIEW_ZONE_TABLE, wxDefaultPosition, wxSize( -1,240 ), wxDV_HORIZ_RULES|wxDV_SINGLE|wxDV_VERT_RULES ); + m_viewZonesOverview->SetMinSize( wxSize( -1,240 ) ); + + leftColumn->Add( m_viewZonesOverview, 1, wxEXPAND, 0 ); + + m_sizerZoneOP = new wxBoxSizer( wxHORIZONTAL ); + + m_btnMoveUp = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + m_btnMoveUp->SetToolTip( _("Top zone has the highest priority. When a zone is inside another zone, if its priority is higher, its outlines are removed from the other zone.") ); + + m_sizerZoneOP->Add( m_btnMoveUp, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_btnMoveDown = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + m_btnMoveDown->SetToolTip( _("Top zone has the highest priority. When a zone is inside another zone, if its priority is higher, its outlines are removed from the other zone.") ); + + m_sizerZoneOP->Add( m_btnMoveDown, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - bSizer12->Add( m_sizerTop, 1, wxEXPAND, 5 ); - - m_sizerProperties = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Properties") ), wxVERTICAL ); + leftColumn->Add( m_sizerZoneOP, 0, wxEXPAND|wxTOP, 5 ); - bSizer12->Add( m_sizerProperties, 0, wxALL|wxEXPAND, 5 ); + m_sizerTop->Add( leftColumn, 1, wxEXPAND|wxTOP|wxRIGHT, 5 ); - m_MainBoxSizer->Add( bSizer12, 1, wxEXPAND, 0 ); + m_MainBoxSizer->Add( m_sizerTop, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); - wxBoxSizer* bSizer61; - bSizer61 = new wxBoxSizer( wxHORIZONTAL ); - - m_checkRepour = new wxCheckBox( this, wxID_ANY, _("Repour"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer61->Add( m_checkRepour, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 ); + m_sizerProperties = new wxBoxSizer( wxVERTICAL ); - bSizer61->Add( 0, 0, 1, wxEXPAND, 5 ); + m_MainBoxSizer->Add( m_sizerProperties, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_sizerBottom = new wxBoxSizer( wxHORIZONTAL ); + + m_checkRepour = new wxCheckBox( this, wxID_ANY, _("Refill zones"), wxDefaultPosition, wxDefaultSize, 0 ); + m_sizerBottom->Add( m_checkRepour, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 ); + + + m_sizerBottom->Add( 25, 0, 1, wxEXPAND, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); @@ -93,10 +94,10 @@ DIALOG_ZONE_MANAGER_BASE::DIALOG_ZONE_MANAGER_BASE( wxWindow* parent, wxWindowID m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - bSizer61->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); + m_sizerBottom->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); - m_MainBoxSizer->Add( bSizer61, 0, wxEXPAND, 5 ); + m_MainBoxSizer->Add( m_sizerBottom, 0, wxEXPAND, 5 ); this->SetSizer( m_MainBoxSizer ); @@ -105,14 +106,16 @@ DIALOG_ZONE_MANAGER_BASE::DIALOG_ZONE_MANAGER_BASE( wxWindow* parent, wxWindowID // Connect Events this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_ZONE_MANAGER_BASE::onDialogResize ) ); - m_viewZonesOverview->Connect( wxEVT_CHAR, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableChar ), NULL, this ); - m_viewZonesOverview->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableCharHook ), NULL, this ); - m_viewZonesOverview->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ZONE_MANAGER_BASE::OnDataViewCtrlSelectionChanged ), NULL, this ); - m_viewZonesOverview->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_ZONE_MANAGER_BASE::OnViewZonesOverviewOnLeftUp ), NULL, this ); m_filterCtrl->Connect( wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnFilterCtrlCancel ), NULL, this ); m_filterCtrl->Connect( wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnFilterCtrlSearch ), NULL, this ); m_filterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnFilterCtrlTextChange ), NULL, this ); m_filterCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnFilterCtrlEnter ), NULL, this ); + m_viewZonesOverview->Connect( wxEVT_CHAR, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableChar ), NULL, this ); + m_viewZonesOverview->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableCharHook ), NULL, this ); + m_viewZonesOverview->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ZONE_MANAGER_BASE::OnDataViewCtrlSelectionChanged ), NULL, this ); + m_viewZonesOverview->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_ZONE_MANAGER_BASE::OnViewZonesOverviewOnLeftUp ), NULL, this ); + m_btnMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnMoveUpClick ), NULL, this ); + m_btnMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnMoveDownClick ), NULL, this ); m_checkRepour->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnRepourCheck ), NULL, this ); m_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnButtonApplyClick ), NULL, this ); } @@ -121,14 +124,16 @@ DIALOG_ZONE_MANAGER_BASE::~DIALOG_ZONE_MANAGER_BASE() { // Disconnect Events this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_ZONE_MANAGER_BASE::onDialogResize ) ); - m_viewZonesOverview->Disconnect( wxEVT_CHAR, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableChar ), NULL, this ); - m_viewZonesOverview->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableCharHook ), NULL, this ); - m_viewZonesOverview->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ZONE_MANAGER_BASE::OnDataViewCtrlSelectionChanged ), NULL, this ); - m_viewZonesOverview->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_ZONE_MANAGER_BASE::OnViewZonesOverviewOnLeftUp ), NULL, this ); m_filterCtrl->Disconnect( wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnFilterCtrlCancel ), NULL, this ); m_filterCtrl->Disconnect( wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnFilterCtrlSearch ), NULL, this ); m_filterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnFilterCtrlTextChange ), NULL, this ); m_filterCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnFilterCtrlEnter ), NULL, this ); + m_viewZonesOverview->Disconnect( wxEVT_CHAR, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableChar ), NULL, this ); + m_viewZonesOverview->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableCharHook ), NULL, this ); + m_viewZonesOverview->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ZONE_MANAGER_BASE::OnDataViewCtrlSelectionChanged ), NULL, this ); + m_viewZonesOverview->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_ZONE_MANAGER_BASE::OnViewZonesOverviewOnLeftUp ), NULL, this ); + m_btnMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnMoveUpClick ), NULL, this ); + m_btnMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnMoveDownClick ), NULL, this ); m_checkRepour->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnRepourCheck ), NULL, this ); m_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ZONE_MANAGER_BASE::OnButtonApplyClick ), NULL, this ); diff --git a/pcbnew/zone_manager/dialog_zone_manager_base.fbp b/pcbnew/zone_manager/dialog_zone_manager_base.fbp index 27a24b2ef5..fd7cf04b4e 100644 --- a/pcbnew/zone_manager/dialog_zone_manager_base.fbp +++ b/pcbnew/zone_manager/dialog_zone_manager_base.fbp @@ -64,429 +64,450 @@ wxVERTICAL protected - 0 - wxEXPAND + 10 + wxEXPAND|wxRIGHT|wxLEFT 1 - bSizer12 - wxVERTICAL - none + m_sizerTop + wxHORIZONTAL + protected 5 - wxEXPAND + wxEXPAND|wxTOP|wxRIGHT 1 - m_sizerTop - wxHORIZONTAL - protected + leftColumn + wxVERTICAL + none - 5 - wxALL|wxEXPAND - 1 + 3 + wxEXPAND|wxTOP|wxBOTTOM + 0 - bSizer7 - wxVERTICAL + searchSizer + wxHORIZONTAL none - 0 - wxALL|wxEXPAND + 1 + wxEXPAND|wxBOTTOM 1 - + + 1 + 1 + 1 + 1 + + + + + + 1 + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 0 1 + 1 + 0 0 - VIEW_ZONE_TABLE + wxID_ANY + + 0 - -1,240 - m_viewZonesOverview + + 0 + + 1 + m_filterCtrl + 1 + + protected + 1 - -1,240 - wxDV_HORIZ_RULES|wxDV_ROW_LINES|wxDV_SINGLE|wxDV_VERT_RULES + Resizable + 1 + 1 + + wxTE_PROCESS_ENTER ; ; forward_declare + 0 + + wxFILTER_NONE + wxDefaultValidator + + - OnTableChar - OnTableCharHook - OnDataViewCtrlSelectionChanged - OnViewZonesOverviewOnLeftUp + OnFilterCtrlCancel + OnFilterCtrlSearch + OnFilterCtrlTextChange + OnFilterCtrlEnter 5 - wxEXPAND|wxLEFT|wxTOP + wxEXPAND 0 - - - m_sizerZoneOP - wxHORIZONTAL + + 0 protected - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - STD_BITMAP_BUTTON - 1 - m_btnMoveUp = new STD_BITMAP_BUTTON( this, BTN_MOVE_UP, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - - 1 - - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - BTN_MOVE_UP - #include "widgets/std_bitmap_button.h" - - 0 - - - 0 - - 1 - m_btnMoveUp - 1 - - - protected - 1 - - Resizable - - 1 - - ; ; forward_declare - 0 - Top zone has the highest priority. When a zone is inside another zone, if its priority is higher, its outlines are removed from the other zone. - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - STD_BITMAP_BUTTON - 1 - m_btnMoveDown = new STD_BITMAP_BUTTON( this, BTN_MOVE_DOWN, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - - 1 - - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - BTN_MOVE_DOWN - #include "widgets/std_bitmap_button.h" - - 0 - - - 0 - - 1 - m_btnMoveDown - 1 - - - protected - 1 - - Resizable - - 1 - - ; ; forward_declare - 0 - Top zone has the highest priority. When a zone is inside another zone, if its priority is higher, its outlines are removed from the other zone. - - - - - - - 5 - wxEXPAND - 0 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - CHECK_NAME - Name - - 0 - - - 0 - - 1 - m_checkName - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - CHECK_NET - Net - - 0 - - - 0 - - 1 - m_checkNet - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - 1 - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_filterCtrl - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxTE_PROCESS_ENTER - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnFilterCtrlCancel - OnFilterCtrlSearch - OnFilterCtrlTextChange - OnFilterCtrlEnter - - + 10 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + CHECK_NAME + Name + + 0 + + + 0 + + 1 + m_checkName + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + CHECK_NET + Net + + 0 + + + 0 + + 1 + m_checkNet + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 0 + wxEXPAND + 1 + + + + 1 + 0 + 1 + + + 0 + VIEW_ZONE_TABLE + + -1,240 + m_viewZonesOverview + protected + + -1,240 + wxDV_HORIZ_RULES|wxDV_SINGLE|wxDV_VERT_RULES + ; ; forward_declare + + + + + OnTableChar + OnTableCharHook + OnDataViewCtrlSelectionChanged + OnViewZonesOverviewOnLeftUp + + + + 5 + wxEXPAND|wxTOP + 0 + + + m_sizerZoneOP + wxHORIZONTAL + protected + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Move Up + + 0 + + 0 + + + 0 + + 1 + m_btnMoveUp + 1 + + + protected + 1 + + + + Resizable + 1 + + + STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare + 0 + Top zone has the highest priority. When a zone is inside another zone, if its priority is higher, its outlines are removed from the other zone. + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMoveUpClick + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Move Down + + 0 + + 0 + + + 0 + + 1 + m_btnMoveDown + 1 + + + protected + 1 + + + + Resizable + 1 + + + STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare + 0 + Top zone has the highest priority. When a zone is inside another zone, if its priority is higher, its outlines are removed from the other zone. + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMoveDownClick - - 5 - wxALL|wxEXPAND - 0 - - wxID_ANY - Properties - - m_sizerProperties - wxVERTICAL - 1 - protected - - + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + + m_sizerProperties + wxVERTICAL + protected @@ -495,9 +516,9 @@ 0 - bSizer61 + m_sizerBottom wxHORIZONTAL - none + protected 10 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -532,7 +553,7 @@ 0 0 wxID_ANY - Repour + Refill zones 0 @@ -571,7 +592,7 @@ 0 protected - 0 + 25 diff --git a/pcbnew/zone_manager/dialog_zone_manager_base.h b/pcbnew/zone_manager/dialog_zone_manager_base.h index f860f4aed1..30b160fc73 100644 --- a/pcbnew/zone_manager/dialog_zone_manager_base.h +++ b/pcbnew/zone_manager/dialog_zone_manager_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -10,18 +10,22 @@ #include #include #include +class STD_BITMAP_BUTTON; + #include "dialog_shim.h" -#include +#include +#include #include #include #include #include -#include -#include "widgets/std_bitmap_button.h" #include -#include #include -#include +#include +#include +#include +#include +#include #include #include @@ -38,23 +42,22 @@ class DIALOG_ZONE_MANAGER_BASE : public DIALOG_SHIM enum { ID_DIALOG_COPPER_ZONE_BASE = 1000, - VIEW_ZONE_TABLE, - BTN_MOVE_UP, - BTN_MOVE_DOWN, CHECK_NAME, - CHECK_NET + CHECK_NET, + VIEW_ZONE_TABLE }; wxBoxSizer* m_MainBoxSizer; wxBoxSizer* m_sizerTop; + wxSearchCtrl* m_filterCtrl; + wxCheckBox* m_checkName; + wxCheckBox* m_checkNet; wxDataViewCtrl* m_viewZonesOverview; wxBoxSizer* m_sizerZoneOP; STD_BITMAP_BUTTON* m_btnMoveUp; STD_BITMAP_BUTTON* m_btnMoveDown; - wxCheckBox* m_checkName; - wxCheckBox* m_checkNet; - wxSearchCtrl* m_filterCtrl; - wxStaticBoxSizer* m_sizerProperties; + wxBoxSizer* m_sizerProperties; + wxBoxSizer* m_sizerBottom; wxCheckBox* m_checkRepour; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; @@ -63,14 +66,16 @@ class DIALOG_ZONE_MANAGER_BASE : public DIALOG_SHIM // Virtual event handlers, override them in your derived class virtual void onDialogResize( wxSizeEvent& event ) { event.Skip(); } - virtual void OnTableChar( wxKeyEvent& event ) { event.Skip(); } - virtual void OnTableCharHook( wxKeyEvent& event ) { event.Skip(); } - virtual void OnDataViewCtrlSelectionChanged( wxDataViewEvent& event ) { event.Skip(); } - virtual void OnViewZonesOverviewOnLeftUp( wxMouseEvent& event ) { event.Skip(); } virtual void OnFilterCtrlCancel( wxCommandEvent& event ) { event.Skip(); } virtual void OnFilterCtrlSearch( wxCommandEvent& event ) { event.Skip(); } virtual void OnFilterCtrlTextChange( wxCommandEvent& event ) { event.Skip(); } virtual void OnFilterCtrlEnter( wxCommandEvent& event ) { event.Skip(); } + virtual void OnTableChar( wxKeyEvent& event ) { event.Skip(); } + virtual void OnTableCharHook( wxKeyEvent& event ) { event.Skip(); } + virtual void OnDataViewCtrlSelectionChanged( wxDataViewEvent& event ) { event.Skip(); } + virtual void OnViewZonesOverviewOnLeftUp( wxMouseEvent& event ) { event.Skip(); } + virtual void OnMoveUpClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMoveDownClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnRepourCheck( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonApplyClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/zone_manager/model_zones_overview_table.cpp b/pcbnew/zone_manager/model_zones_overview_table.cpp index 807d7da8a1..b30664b2c4 100644 --- a/pcbnew/zone_manager/model_zones_overview_table.cpp +++ b/pcbnew/zone_manager/model_zones_overview_table.cpp @@ -36,7 +36,7 @@ wxDEFINE_EVENT( EVT_ZONES_OVERVIEW_COUNT_CHANGE, wxCommandEvent ); -inline void MODEL_ZONES_OVERVIEW_TABLE::SortZoneContainers() +void MODEL_ZONES_OVERVIEW_TABLE::SortZoneContainers() { std::sort( m_filteredZoneContainers.begin(), m_filteredZoneContainers.end(), []( std::shared_ptr const& l, @@ -48,13 +48,15 @@ inline void MODEL_ZONES_OVERVIEW_TABLE::SortZoneContainers() } ); } -inline void MODEL_ZONES_OVERVIEW_TABLE::OnRowCountChange() + +void MODEL_ZONES_OVERVIEW_TABLE::OnRowCountChange() { wxCommandEvent rowCountChange( EVT_ZONES_OVERVIEW_COUNT_CHANGE ); rowCountChange.SetInt( GetCount() ); wxPostEvent( m_dialog, rowCountChange ); } + static wxBitmap MakeBitmapForLayers( LSEQ const& layers, COLOR_SETTINGS const& settings, const wxSize& aSize ) { @@ -99,14 +101,20 @@ MODEL_ZONES_OVERVIEW_TABLE::MODEL_ZONES_OVERVIEW_TABLE( ZONE_PRIORITY_CONTAINER_ BOARD* a_pcb, PCB_BASE_FRAME* aPCB_FRAME, wxWindow* a_dialog ) : m_allZoneContainers( aZones ), - m_filteredZoneContainers( std::move( aZones ) ), m_pcb( a_pcb ), m_PCB_FRAME( aPCB_FRAME ), - m_dialog( a_dialog ), m_sortByName( true ), m_sortByNet( true ) + m_filteredZoneContainers( std::move( aZones ) ), + m_pcb( a_pcb ), + m_PCB_FRAME( aPCB_FRAME ), + m_dialog( a_dialog ), + m_sortByName( true ), + m_sortByNet( true ) { Reset( m_filteredZoneContainers.size() ); } + MODEL_ZONES_OVERVIEW_TABLE::~MODEL_ZONES_OVERVIEW_TABLE() = default; + void MODEL_ZONES_OVERVIEW_TABLE::GetValueByRow( wxVariant& aVariant, unsigned aRow, unsigned aCol ) const { @@ -117,8 +125,14 @@ void MODEL_ZONES_OVERVIEW_TABLE::GetValueByRow( wxVariant& aVariant, unsigned aR switch( aCol ) { - case NAME: aVariant = cur.GetZoneName(); break; - case NET: aVariant = cur.GetNet()->GetNetname(); break; + case NAME: + aVariant = cur.GetZoneName(); + break; + + case NET: + aVariant = cur.GetNet()->GetNetname(); + break; + case LAYERS: { wxArrayString layers; @@ -131,49 +145,54 @@ void MODEL_ZONES_OVERVIEW_TABLE::GetValueByRow( wxVariant& aVariant, unsigned aR MakeBitmapForLayers( cur.GetLayerSet().Seq(), *m_PCB_FRAME->GetColorSettings(), { LAYER_BAR_WIDTH, ZONE_MANAGER_PREFERENCE::LAYER_ICON_SIZE::HEIGHT } ) ); + break; } - break; - default: break; + + default: + break; } } + void MODEL_ZONES_OVERVIEW_TABLE::EnableFitterByName( bool aEnable ) { m_sortByName = aEnable; } + void MODEL_ZONES_OVERVIEW_TABLE::EnableFitterByNet( bool aEnable ) { m_sortByNet = aEnable; } + bool MODEL_ZONES_OVERVIEW_TABLE::SetValueByRow( const wxVariant& aVariant, unsigned aRow, unsigned aCol ) { - WXUNUSED( aVariant ) - WXUNUSED( aRow ) - WXUNUSED( aCol ) return {}; } + unsigned int MODEL_ZONES_OVERVIEW_TABLE::GetCount() const { return m_filteredZoneContainers.size(); } + ZONE* MODEL_ZONES_OVERVIEW_TABLE::GetZone( wxDataViewItem const& aItem ) const { if( !aItem.IsOk() ) - return {}; + return nullptr; unsigned int aRow = GetRow( aItem ); if( aRow + 1 > GetCount() ) - return {}; + return nullptr; return &m_filteredZoneContainers[aRow]->GetZone(); } + wxDataViewItem MODEL_ZONES_OVERVIEW_TABLE::GetItemByZone( ZONE* aZone ) const { if( !aZone ) @@ -195,19 +214,22 @@ std::optional MODEL_ZONES_OVERVIEW_TABLE::MoveZoneIndex( unsigned switch( aMovement ) { case ZONE_INDEX_MOVEMENT::MOVE_UP: - { - return aIndex >= 1 && GetCount() > 1 ? SwapZonePriority( aIndex, aIndex - 1 ) - : std::optional{}; - } + if( aIndex >= 1 && GetCount() > 1 ) + return SwapZonePriority( aIndex, aIndex - 1 ); + + break; + case ZONE_INDEX_MOVEMENT::MOVE_DOWN: - { - return aIndex + 1 < GetCount() ? SwapZonePriority( aIndex, aIndex + 1 ) - : std::optional{}; + if( aIndex + 1 < GetCount() ) + return SwapZonePriority( aIndex, aIndex + 1 ); + + break; } - } - return {}; + + return std::optional{}; } + std::optional MODEL_ZONES_OVERVIEW_TABLE::SwapZonePriority( unsigned aDragIndex, unsigned aDropIndex ) { @@ -255,12 +277,14 @@ wxDataViewItem MODEL_ZONES_OVERVIEW_TABLE::ApplyFilter( wxString const& aFilterT m_filteredZoneContainers.push_back( container ); } } + SortZoneContainers(); Reset( GetCount() ); OnRowCountChange(); return GetItemByZone( selected_zone ); } + wxDataViewItem MODEL_ZONES_OVERVIEW_TABLE::ClearFilter( wxDataViewItem aSelection ) { if( !GetAllZonesCount() ) diff --git a/pcbnew/zone_manager/model_zones_overview_table.h b/pcbnew/zone_manager/model_zones_overview_table.h index b5d404da80..4af0559399 100644 --- a/pcbnew/zone_manager/model_zones_overview_table.h +++ b/pcbnew/zone_manager/model_zones_overview_table.h @@ -43,12 +43,14 @@ wxDECLARE_EVENT( EVT_ZONES_OVERVIEW_COUNT_CHANGE, wxCommandEvent ); using ZONE_PRIORITY_CONTAINER_LIST = std::vector>; + enum class ZONE_INDEX_MOVEMENT { MOVE_UP, MOVE_DOWN }; + class MODEL_ZONES_OVERVIEW_TABLE : public wxDataViewVirtualListModel { public: @@ -64,10 +66,7 @@ public: enum WIDTH_SETTING { NAME_WIDTH = 128, - LAYER_BAR_WIDTH = 16, - //NOTE - Prevent the hor scroll bar - RESERVED = 10, - MINIMAL_WIDTH = NAME_WIDTH + LAYER_BAR_WIDTH + RESERVED + LAYER_BAR_WIDTH = 16 }; @@ -75,9 +74,9 @@ public: { //NOTE - Build the column name dynamicly in case the display language changed const std::map ColNames = std::map{ - std::make_pair( NAME, _( "Name" ) ), std::make_pair( NET, _( "Net" ) ), + std::make_pair( NAME, _( "Name" ) ), + std::make_pair( NET, _( "Net" ) ), std::make_pair( LAYERS, _( "Layers" ) ) - }; return ColNames; } @@ -140,7 +139,6 @@ private: void OnRowCountChange(); - private: ZONE_PRIORITY_CONTAINER_LIST m_allZoneContainers; ZONE_PRIORITY_CONTAINER_LIST m_filteredZoneContainers; diff --git a/pcbnew/zone_manager/panel_zone_properties.cpp b/pcbnew/zone_manager/panel_zone_properties.cpp index 6df89e105e..a7d51efb9b 100644 --- a/pcbnew/zone_manager/panel_zone_properties.cpp +++ b/pcbnew/zone_manager/panel_zone_properties.cpp @@ -24,7 +24,6 @@ */ #include "panel_zone_properties.h" -#include "zone_manager/panel_zone_properties_base.h" #include "zone_manager/zones_container.h" #include @@ -33,13 +32,9 @@ #include #include #include -#include #include -#include #include -#include #include -#include #include #include @@ -49,7 +44,8 @@ wxDEFINE_EVENT( EVT_ZONE_NAME_UPDATE, wxCommandEvent ); PANEL_ZONE_PROPERTIES::PANEL_ZONE_PROPERTIES( wxWindow* aParent, PCB_BASE_FRAME* aPCB_FRAME, ZONES_CONTAINER& aZoneContainer ) : PANEL_ZONE_PROPERTIES_BASE( aParent ), - m_ZoneContainer( aZoneContainer ), m_PCB_Frame( aPCB_FRAME ), + m_ZoneContainer( aZoneContainer ), + m_PCB_Frame( aPCB_FRAME ), m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ), m_outlineHatchPitch( aPCB_FRAME, m_stBorderHatchPitchText, m_outlineHatchPitchCtrl, m_outlineHatchUnits ), @@ -97,6 +93,7 @@ bool PANEL_ZONE_PROPERTIES::TransferZoneSettingsToWindow() { if( !m_settings ) return false; + m_cbLocked->SetValue( m_settings->m_Locked ); m_cornerSmoothingChoice->SetSelection( m_settings->GetCornerSmoothingType() ); m_cornerRadius.SetValue( m_settings->GetCornerRadius() ); @@ -210,6 +207,7 @@ bool PANEL_ZONE_PROPERTIES::TransferZoneSettingsFromWindow() { if( !m_settings ) return false; + if( m_GridStyleCtrl->GetSelection() > 0 ) m_settings->m_FillMode = ZONE_FILL_MODE::HATCH_PATTERN; else @@ -217,9 +215,10 @@ bool PANEL_ZONE_PROPERTIES::TransferZoneSettingsFromWindow() if( !AcceptOptions() ) return false; + m_settings->m_HatchOrientation = m_gridStyleRotation.GetAngleValue(); - m_settings->m_HatchThickness = m_gridStyleThickness.GetValue(); - m_settings->m_HatchGap = m_gridStyleGap.GetValue(); + m_settings->m_HatchThickness = m_gridStyleThickness.GetIntValue(); + m_settings->m_HatchGap = m_gridStyleGap.GetIntValue(); m_settings->m_HatchSmoothingLevel = m_spinCtrlSmoothLevel->GetValue(); m_settings->m_HatchSmoothingValue = m_spinCtrlSmoothValue->GetValue(); @@ -245,7 +244,7 @@ bool PANEL_ZONE_PROPERTIES::AcceptOptions( bool aUseExportableSetupOnly ) if( m_settings->m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN ) { - int minThickness = m_minThickness.GetValue(); + int minThickness = m_minThickness.GetIntValue(); if( !m_gridStyleThickness.Validate( minThickness, INT_MAX ) ) return false; @@ -273,17 +272,17 @@ bool PANEL_ZONE_PROPERTIES::AcceptOptions( bool aUseExportableSetupOnly ) pcbIUScale.mmToIU( ZONE_BORDER_HATCH_MAXDIST_MM ) ) ) return false; - m_settings->m_BorderHatchPitch = m_outlineHatchPitch.GetValue(); + m_settings->m_BorderHatchPitch = m_outlineHatchPitch.GetIntValue(); - m_settings->m_ZoneClearance = m_clearance.GetValue(); - m_settings->m_ZoneMinThickness = m_minThickness.GetValue(); + m_settings->m_ZoneClearance = m_clearance.GetIntValue(); + m_settings->m_ZoneMinThickness = m_minThickness.GetIntValue(); m_settings->SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() ); - m_settings->SetCornerRadius( m_settings->GetCornerSmoothingType() - == ZONE_SETTINGS::SMOOTHING_NONE - ? 0 - : m_cornerRadius.GetValue() ); + if( m_settings->GetCornerSmoothingType() == ZONE_SETTINGS::SMOOTHING_NONE ) + m_settings->SetCornerRadius( 0 ); + else + m_settings->SetCornerRadius( m_cornerRadius.GetIntValue() ); m_settings->m_Locked = m_cbLocked->GetValue(); diff --git a/pcbnew/zone_manager/panel_zone_properties_base.cpp b/pcbnew/zone_manager/panel_zone_properties_base.cpp index 5963c30bd8..97da354a4c 100644 --- a/pcbnew/zone_manager/panel_zone_properties_base.cpp +++ b/pcbnew/zone_manager/panel_zone_properties_base.cpp @@ -197,7 +197,7 @@ PANEL_ZONE_PROPERTIES_BASE::PANEL_ZONE_PROPERTIES_BASE( wxWindow* parent, wxWind bMiddleColumn->Add( sbSizer5, 1, wxEXPAND|wxRIGHT, 5 ); - bSizerMiddle->Add( bMiddleColumn, 1, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + bSizerMiddle->Add( bMiddleColumn, 1, wxEXPAND|wxALL, 5 ); wxStaticBoxSizer* sbSizerZoneStyle; sbSizerZoneStyle = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fill") ), wxVERTICAL ); diff --git a/pcbnew/zone_manager/panel_zone_properties_base.fbp b/pcbnew/zone_manager/panel_zone_properties_base.fbp index 87057f55f6..be18b4a85f 100644 --- a/pcbnew/zone_manager/panel_zone_properties_base.fbp +++ b/pcbnew/zone_manager/panel_zone_properties_base.fbp @@ -1055,7 +1055,7 @@ 5 - wxBOTTOM|wxEXPAND|wxTOP + wxEXPAND|wxALL 1 diff --git a/pcbnew/zone_manager/zone_manager_preference.cpp b/pcbnew/zone_manager/zone_manager_preference.cpp index b3cc483c8b..d6fcd231ce 100644 --- a/pcbnew/zone_manager/zone_manager_preference.cpp +++ b/pcbnew/zone_manager/zone_manager_preference.cpp @@ -27,13 +27,15 @@ //NOTE - Is recording in the setting file needed ? -static bool RepourOnClose = false; +static bool s_refillOnClose = false; + bool ZONE_MANAGER_PREFERENCE::GetRepourOnClose() { - return RepourOnClose; + return s_refillOnClose; } + wxColour ZONE_MANAGER_PREFERENCE::GetCanvasBackgroundColor() { if( KIPLATFORM::UI::IsDarkTheme() ) @@ -42,6 +44,7 @@ wxColour ZONE_MANAGER_PREFERENCE::GetCanvasBackgroundColor() return wxColour( 238, 243, 243 ); } + wxColour ZONE_MANAGER_PREFERENCE::GetBoundBoundingFillColor() { if( KIPLATFORM::UI::IsDarkTheme() ) @@ -49,7 +52,9 @@ wxColour ZONE_MANAGER_PREFERENCE::GetBoundBoundingFillColor() return wxColour( 84, 84, 84, 40 ); } -void ZONE_MANAGER_PREFERENCE::SetRepourOnClose( bool aRepour ) + + +void ZONE_MANAGER_PREFERENCE::SetRefillOnClose( bool aRepour ) { - RepourOnClose = aRepour; + s_refillOnClose = aRepour; } diff --git a/pcbnew/zone_manager/zone_manager_preference.h b/pcbnew/zone_manager/zone_manager_preference.h index 6a4aa5eeba..2a52f5b4d8 100644 --- a/pcbnew/zone_manager/zone_manager_preference.h +++ b/pcbnew/zone_manager/zone_manager_preference.h @@ -45,7 +45,7 @@ public: * @brief Should all the zones be re-poured on dialog close * */ - static void SetRepourOnClose( bool aRepour ); + static void SetRefillOnClose( bool aRepour ); static bool GetRepourOnClose(); }; diff --git a/pcbnew/zone_manager/zone_priority_container.h b/pcbnew/zone_manager/zone_priority_container.h index 2aabfe0f0f..a053b97729 100644 --- a/pcbnew/zone_manager/zone_priority_container.h +++ b/pcbnew/zone_manager/zone_priority_container.h @@ -40,29 +40,26 @@ class ZONE_PRIORITY_CONTAINER : public ZONE_MANAGEMENT_BASE public: ZONE_PRIORITY_CONTAINER( std::shared_ptr aZone, unsigned aInitialIndex ) : - m_zone( std::move( aZone ) ), m_initialPriority( aInitialIndex ), + m_zone( std::move( aZone ) ), + m_initialPriority( aInitialIndex ), m_currentPriority( aInitialIndex ) { } + ZONE_PRIORITY_CONTAINER() = delete; ~ZONE_PRIORITY_CONTAINER() override = default; bool PriorityChanged() const { return m_initialPriority != m_currentPriority; } - void SetCurrentPriority( unsigned aPriority ) { m_currentPriority = aPriority; } - unsigned GetCurrentPriority() const { return m_currentPriority; } - unsigned GetInitialPriority() const { return m_initialPriority; } - void OnUserConfirmChange() override { m_zone->SetAssignedPriority( m_currentPriority ); } ZONE const& GetZone() const { return *m_zone; } ZONE& GetZone() { return *m_zone; } - private: std::shared_ptr m_zone; const unsigned m_initialPriority; diff --git a/pcbnew/zone_manager/zone_selection_change_notifier.h b/pcbnew/zone_manager/zone_selection_change_notifier.h index d6f9807416..b9d01e7457 100644 --- a/pcbnew/zone_manager/zone_selection_change_notifier.h +++ b/pcbnew/zone_manager/zone_selection_change_notifier.h @@ -56,7 +56,6 @@ public: protected: virtual void ActivateSelectedZone( ZONE* new_zone ) = 0; - private: ZONE* m_zone{}; }; diff --git a/pcbnew/zone_manager/zones_container.cpp b/pcbnew/zone_manager/zones_container.cpp index 010aec3f9c..b22d77a572 100644 --- a/pcbnew/zone_manager/zones_container.cpp +++ b/pcbnew/zone_manager/zones_container.cpp @@ -42,7 +42,7 @@ ZONES_CONTAINER::ZONES_CONTAINER( BOARD* aBoard ) : m_originalZoneList( aBoard-> { std::shared_ptr zone_clone = std::shared_ptr( static_cast( zone->Clone() ) ); - m_zonesColoneMap.try_emplace( zone, zone_clone ); + m_zonesCloneMap.try_emplace( zone, zone_clone ); m_clonedZoneList.push_back( zone_clone.get() ); clonedZones.push_back( std::move( zone_clone ) ); } @@ -84,10 +84,8 @@ void ZONES_CONTAINER::OnUserConfirmChange() FlushZoneSettingsChange(); FlushPriorityChange(); - for( auto& [c, v] : m_zonesColoneMap ) - { - *c = *v; - } + for( auto& [ zone, zoneClone ] : m_zonesCloneMap ) + *zone = *zoneClone; } void ZONES_CONTAINER::FlushZoneSettingsChange() @@ -115,9 +113,7 @@ bool ZONES_CONTAINER::FlushPriorityChange() if( priorityChanged ) { for( std::shared_ptr& c : m_zonesPriorityContainer ) - { c->OnUserConfirmChange(); - } } return priorityChanged; diff --git a/pcbnew/zone_manager/zones_container.h b/pcbnew/zone_manager/zones_container.h index 396a3542dd..53288195f2 100644 --- a/pcbnew/zone_manager/zones_container.h +++ b/pcbnew/zone_manager/zones_container.h @@ -73,7 +73,7 @@ public: void OnUserConfirmChange() override; private: - std::unordered_map> m_zonesColoneMap; + std::unordered_map> m_zonesCloneMap; std::unordered_map> m_zoneSettings; std::vector> m_zonesPriorityContainer; std::vector m_clonedZoneList; diff --git a/pcbnew/zones.h b/pcbnew/zones.h index 8fc254f9ac..9bee79e44d 100644 --- a/pcbnew/zones.h +++ b/pcbnew/zones.h @@ -107,14 +107,4 @@ int InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings, int InvokeRuleAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings, CONVERT_SETTINGS* aConvertSettings = nullptr ); -/** - * Function InvokeZonesManager - * invokes up a modal dialog window for zones manager. - * - * @param aCaller is the PCB_BASE_FRAME calling parent window for the modal dialog, - * and it gives access to the BOARD through PCB_BASE_FRAME::GetBoard(). - * @return int - tells if user aborted, or edited the zones - */ -int InvokeZonesManager( PCB_BASE_FRAME* aCall, ZONE_SETTINGS* aSettings ); - #endif // ZONES_H_