Fixed button sizing for launcher panel

- Increased expansion so bitmaps are fully visible
This commit is contained in:
Oliver Walters 2017-06-04 12:59:59 +10:00 committed by Wayne Stambaugh
parent ac9a64a173
commit 29557e4d9e
3 changed files with 14 additions and 5 deletions

View File

@ -36,7 +36,7 @@
const int BUTTON_SEPARATION = 5;
// Buttons are larger than images by this amount
const int BUTTON_EXPANSION = 5;
const int BUTTON_EXPANSION = 6;
LAUNCHER_PANEL::LAUNCHER_PANEL( wxWindow* parent ) :
wxPanel( parent, wxID_ANY )
@ -51,6 +51,11 @@ int LAUNCHER_PANEL::GetPanelHeight() const
return m_height + 2 * BUTTON_SEPARATION;
}
int LAUNCHER_PANEL::GetPanelWidth() const
{
return m_width + BUTTON_SEPARATION;
}
/**
* Add application launcher buttons
* e.g. Eeschema, CvPcb, Pcbnew, GerbView
@ -106,12 +111,14 @@ void LAUNCHER_PANEL::CreateCommandToolbar()
*/
void LAUNCHER_PANEL::AddButton( wxWindowID aId, const wxBitmap& aBitmap, wxString aToolTip )
{
wxSize buttSize( aBitmap.GetWidth() + BUTTON_EXPANSION,
aBitmap.GetHeight() + BUTTON_EXPANSION );
wxSize buttSize( aBitmap.GetWidth() + 2 * BUTTON_EXPANSION,
aBitmap.GetHeight() + 2 * BUTTON_EXPANSION );
if( m_height < buttSize.y )
m_height = buttSize.y;
m_width += buttSize.x + BUTTON_SEPARATION;
auto btn = new wxBitmapButton( this, aId, aBitmap, wxDefaultPosition, buttSize );
btn->SetToolTip( aToolTip );

View File

@ -313,11 +313,13 @@ private:
wxBoxSizer* m_buttonSizer;
int m_height = 0;
int m_width = 0;
public: LAUNCHER_PANEL( wxWindow* parent );
~LAUNCHER_PANEL() { };
int GetPanelHeight() const;
int GetPanelWidth() const;
private:

View File

@ -102,13 +102,13 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
m_auimgr.AddPane( m_Launcher, wxTOP );
m_auimgr.GetPane( m_Launcher).CaptionVisible( false ).PaneBorder(false)
.MinSize( wxSize( 100, m_Launcher->GetPanelHeight() ) )
.MinSize( wxSize( m_Launcher->GetPanelWidth(), m_Launcher->GetPanelHeight() ) )
.Resizable( false );
m_auimgr.AddPane( m_MessagesBox,
wxAuiPaneInfo().Name( wxT( "m_MessagesBox" ) ).CentrePane().Layer( 2 ) );
m_auimgr.GetPane( m_LeftWin ).MinSize( wxSize( 80, -1) );
m_auimgr.GetPane( m_LeftWin ).MinSize( wxSize( 150, -1) );
m_auimgr.GetPane( m_LeftWin ).BestSize(wxSize(m_leftWinWidth, -1) );
m_auimgr.Update();