MsgPanel is sized dynamically based on system gui font size
This commit is contained in:
parent
896c69757d
commit
42b1020dc3
|
@ -67,9 +67,11 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
|
|||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
// Create the status line
|
||||
int dims[5] = { -1, 100, 100, 100, 140 };
|
||||
static const int dims[5] = { -1, 100, 100, 100, 140 };
|
||||
|
||||
CreateStatusBar( 5 );
|
||||
SetStatusWidths( 5, dims );
|
||||
|
||||
ReCreateMenuBar();
|
||||
ReCreateHToolbar();
|
||||
|
||||
|
|
|
@ -4,6 +4,14 @@ KiCad ChangeLog 2009
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2009-Aug-6 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
++pcbnew
|
||||
MsgPanel is dynamically sized based on system gui font. Before this fix
|
||||
the window height was hardcoded and was too small on systems with large
|
||||
fonts. See WinEDA_MsgPanel::GetRequiredHeight();
|
||||
|
||||
|
||||
2009-aug-08 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||
================================================================================
|
||||
++pcbnew
|
||||
|
|
|
@ -40,10 +40,12 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father,
|
|||
m_Ident = idtype;
|
||||
m_HToolBar = NULL;
|
||||
m_FrameIsActive = TRUE;
|
||||
m_MsgFrameHeight = MSG_PANEL_DEFAULT_HEIGHT;
|
||||
|
||||
m_MsgFrameHeight = WinEDA_MsgPanel::GetRequiredHeight();
|
||||
|
||||
minsize.x = 470;
|
||||
minsize.y = 350 + m_MsgFrameHeight;
|
||||
|
||||
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
|
||||
|
||||
/* Verification des parametres de creation */
|
||||
|
|
|
@ -30,6 +30,8 @@ WinEDA_MsgPanel::WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id,
|
|||
SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
|
||||
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
|
||||
m_last_x = 0;
|
||||
|
||||
m_fontSize = computeFontSize();
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,6 +40,27 @@ WinEDA_MsgPanel::~WinEDA_MsgPanel()
|
|||
}
|
||||
|
||||
|
||||
wxSize WinEDA_MsgPanel::computeFontSize()
|
||||
{
|
||||
// Get size of the wxSYS_DEFAULT_GUI_FONT
|
||||
wxSize fontSizeInPixels;
|
||||
|
||||
wxScreenDC dc;
|
||||
|
||||
dc.SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
|
||||
dc.GetTextExtent( wxT( "W" ), &fontSizeInPixels.x, &fontSizeInPixels.y );
|
||||
|
||||
return fontSizeInPixels;
|
||||
}
|
||||
|
||||
|
||||
int WinEDA_MsgPanel::GetRequiredHeight()
|
||||
{
|
||||
// make space for two rows of text plus a number of pixels between them.
|
||||
return 2 * computeFontSize().y + 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************/
|
||||
void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event )
|
||||
/*************************************************/
|
||||
|
@ -78,20 +101,9 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
|
|||
wxPoint pos;
|
||||
wxSize drawSize = GetClientSize();
|
||||
|
||||
|
||||
// Get size of the font
|
||||
wxSize fontSizeInPixels;
|
||||
{
|
||||
wxClientDC dc( this );
|
||||
|
||||
dc.SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
|
||||
dc.GetTextExtent( wxT( "W" ), &fontSizeInPixels.x, &fontSizeInPixels.y );
|
||||
|
||||
} // destroy wxClientDC ASAP
|
||||
|
||||
if( pos_X >= 0 )
|
||||
{
|
||||
m_last_x = pos.x = pos_X * (fontSizeInPixels.x + 2);
|
||||
m_last_x = pos.x = pos_X * (m_fontSize.x + 2);
|
||||
}
|
||||
else
|
||||
pos.x = m_last_x;
|
||||
|
@ -100,8 +112,8 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
|
|||
|
||||
item.m_X = pos.x;
|
||||
|
||||
item.m_UpperY = (drawSize.y / 2) - fontSizeInPixels.y;
|
||||
item.m_LowerY = drawSize.y - fontSizeInPixels.y;
|
||||
item.m_UpperY = (drawSize.y / 2) - m_fontSize.y;
|
||||
item.m_LowerY = drawSize.y - m_fontSize.y;
|
||||
|
||||
item.m_UpperText = texte_H;
|
||||
item.m_LowerText = texte_L;
|
||||
|
|
|
@ -144,9 +144,11 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
|
|||
m_FrameSize.y = FRAME_MIN_SIZE_Y;
|
||||
|
||||
// create the status bar
|
||||
int dims[3] = { -1, -1, 250 };
|
||||
static const int dims[3] = { -1, -1, 250 };
|
||||
|
||||
CreateStatusBar( 3 );
|
||||
SetStatusWidths( 3, dims );
|
||||
|
||||
ReCreateMenuBar();
|
||||
ReCreateHToolbar();
|
||||
|
||||
|
|
|
@ -80,8 +80,6 @@ enum id_toolbar {
|
|||
/* Classes for basic main frames used in kicad */
|
||||
/***********************************************/
|
||||
|
||||
#define MSG_PANEL_DEFAULT_HEIGHT ( 28 ) // height of the infos display window
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* Basic frame for kicad, eeschema, pcbnew and gerbview. */
|
||||
|
@ -350,12 +348,20 @@ class WinEDA_MsgPanel : public wxPanel
|
|||
protected:
|
||||
std::vector<MsgItem> m_Items;
|
||||
int m_last_x; ///< the last used x coordinate
|
||||
wxSize m_fontSize;
|
||||
|
||||
|
||||
void showItem( wxDC& dc, const MsgItem& aItem );
|
||||
|
||||
void erase( wxDC* DC );
|
||||
|
||||
/**
|
||||
* Function getFontSize
|
||||
* computes the height and width of a 'W' in the system font.
|
||||
*/
|
||||
static wxSize computeFontSize();
|
||||
|
||||
|
||||
public:
|
||||
WinEDA_DrawFrame* m_Parent;
|
||||
int m_BgColor; // couleur de fond
|
||||
|
@ -366,6 +372,14 @@ public:
|
|||
WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size );
|
||||
~WinEDA_MsgPanel();
|
||||
|
||||
|
||||
/**
|
||||
* Function GetRequiredHeight
|
||||
* returns the required height (in pixels) of a WinEDA_MsgPanel. This takes
|
||||
* into consideration the system gui font, wxSYS_DEFAULT_GUI_FONT.
|
||||
*/
|
||||
static int GetRequiredHeight();
|
||||
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void EraseMsgBox();
|
||||
void Affiche_1_Parametre( int pos_X, const wxString& texte_H,
|
||||
|
|
|
@ -48,7 +48,8 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
|
|||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
// Create the status line (bottom of the frame
|
||||
int dims[3] = { -1, -1, 100 };
|
||||
static const int dims[3] = { -1, -1, 100 };
|
||||
|
||||
CreateStatusBar( 3 );
|
||||
SetStatusWidths( 3, dims );
|
||||
|
||||
|
|
Loading…
Reference in New Issue