From a2bc4260ef23afbf4cce6c922e8bd4aabe02aae7 Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Mon, 27 Aug 2018 13:37:11 +0200 Subject: [PATCH] Modify style of the action plugin panel to follow common style and fix of an assert: * m_grid->DeleteRows does not like to get a numRows of zero --- .../dialogs/panel_pcbnew_action_plugins.cpp | 7 ++-- .../panel_pcbnew_action_plugins_base.cpp | 23 ++++++----- .../panel_pcbnew_action_plugins_base.fbp | 38 ++++++++++++------- .../panel_pcbnew_action_plugins_base.h | 2 +- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp b/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp index 3887fe9b2f..d9e1d93aa3 100644 --- a/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp +++ b/pcbnew/dialogs/panel_pcbnew_action_plugins.cpp @@ -35,8 +35,8 @@ PANEL_PCBNEW_ACTION_PLUGINS::PANEL_PCBNEW_ACTION_PLUGINS( PCB_EDIT_FRAME* aFrame m_genericIcon = KiBitmap( hammer_xpm ); m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) ); - m_moveUpButton->SetBitmap( KiBitmap( up_xpm ) ); - m_moveDownButton->SetBitmap( KiBitmap( down_xpm ) ); + m_moveUpButton->SetBitmap( KiBitmap( small_up_xpm ) ); + m_moveDownButton->SetBitmap( KiBitmap( small_down_xpm ) ); m_reloadButton->SetBitmap( KiBitmap( refresh_xpm ) ); } @@ -155,7 +155,8 @@ bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataFromWindow() bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataToWindow() { m_grid->Freeze(); - m_grid->DeleteRows( 0, m_grid->GetNumberRows() ); + if( m_grid->GetNumberRows() != 0 ) + m_grid->DeleteRows( 0, m_grid->GetNumberRows() ); const auto& orderedPlugins = m_frame->GetOrderedActionPlugins(); m_grid->AppendRows( orderedPlugins.size() ); diff --git a/pcbnew/dialogs/panel_pcbnew_action_plugins_base.cpp b/pcbnew/dialogs/panel_pcbnew_action_plugins_base.cpp index d8f8909046..98fae006b4 100644 --- a/pcbnew/dialogs/panel_pcbnew_action_plugins_base.cpp +++ b/pcbnew/dialogs/panel_pcbnew_action_plugins_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 11 2018) +// C++ code generated with wxFormBuilder (version Jul 14 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -14,7 +14,7 @@ PANEL_PCBNEW_ACTION_PLUGINS_BASE::PANEL_PCBNEW_ACTION_PLUGINS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) { wxBoxSizer* bPanelSizer; - bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); + bPanelSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bGridSizer; bGridSizer = new wxBoxSizer( wxVERTICAL ); @@ -56,25 +56,28 @@ PANEL_PCBNEW_ACTION_PLUGINS_BASE::PANEL_PCBNEW_ACTION_PLUGINS_BASE( wxWindow* pa bPanelSizer->Add( bGridSizer, 1, wxALIGN_LEFT|wxEXPAND|wxLEFT, 0 ); wxBoxSizer* bButtonsSizer; - bButtonsSizer = new wxBoxSizer( wxVERTICAL ); + bButtonsSizer = new wxBoxSizer( wxHORIZONTAL ); m_moveUpButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_moveUpButton->SetMinSize( wxSize( 32,32 ) ); + m_moveUpButton->SetMinSize( wxSize( 30,30 ) ); - bButtonsSizer->Add( m_moveUpButton, 0, wxALIGN_TOP|wxALL, 5 ); + bButtonsSizer->Add( m_moveUpButton, 0, wxLEFT|wxRIGHT, 5 ); m_moveDownButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_moveDownButton->SetMinSize( wxSize( 32,32 ) ); + m_moveDownButton->SetMinSize( wxSize( 30,30 ) ); - bButtonsSizer->Add( m_moveDownButton, 0, wxALL, 5 ); + bButtonsSizer->Add( m_moveDownButton, 0, wxRIGHT, 5 ); + + + bButtonsSizer->Add( 0, 0, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); m_reloadButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_reloadButton->SetMinSize( wxSize( 32,32 ) ); + m_reloadButton->SetMinSize( wxSize( 30,30 ) ); - bButtonsSizer->Add( m_reloadButton, 0, wxALL, 5 ); + bButtonsSizer->Add( m_reloadButton, 0, wxLEFT|wxRIGHT, 5 ); - bPanelSizer->Add( bButtonsSizer, 0, wxALIGN_RIGHT|wxALIGN_TOP, 0 ); + bPanelSizer->Add( bButtonsSizer, 0, wxEXPAND, 0 ); this->SetSizer( bPanelSizer ); diff --git a/pcbnew/dialogs/panel_pcbnew_action_plugins_base.fbp b/pcbnew/dialogs/panel_pcbnew_action_plugins_base.fbp index 6c91f1fd1f..2f67cd812e 100644 --- a/pcbnew/dialogs/panel_pcbnew_action_plugins_base.fbp +++ b/pcbnew/dialogs/panel_pcbnew_action_plugins_base.fbp @@ -89,7 +89,7 @@ bPanelSizer - wxHORIZONTAL + wxVERTICAL none 0 @@ -100,11 +100,11 @@ bGridSizer wxVERTICAL none - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -254,16 +254,16 @@ 0 - wxALIGN_RIGHT|wxALIGN_TOP + wxEXPAND 0 bButtonsSizer - wxVERTICAL + wxHORIZONTAL none 5 - wxALIGN_TOP|wxALL + wxLEFT|wxRIGHT 0 1 @@ -306,7 +306,7 @@ 0 - 32,32 + 30,30 1 m_moveUpButton 1 @@ -364,11 +364,11 @@ - + 5 - wxALL + wxRIGHT 0 - + 1 1 1 @@ -409,7 +409,7 @@ 0 - 32,32 + 30,30 1 m_moveDownButton 1 @@ -469,9 +469,19 @@ 5 - wxALL + wxEXPAND|wxLEFT|wxRIGHT 0 - + + 0 + protected + 0 + + + + 5 + wxLEFT|wxRIGHT + 0 + 1 1 1 @@ -512,7 +522,7 @@ 0 - 32,32 + 30,30 1 m_reloadButton 1 diff --git a/pcbnew/dialogs/panel_pcbnew_action_plugins_base.h b/pcbnew/dialogs/panel_pcbnew_action_plugins_base.h index 8766d0c95e..f6ab930964 100644 --- a/pcbnew/dialogs/panel_pcbnew_action_plugins_base.h +++ b/pcbnew/dialogs/panel_pcbnew_action_plugins_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 11 2018) +// C++ code generated with wxFormBuilder (version Jul 14 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE!