Commit 42b1020d authored by dickelbeck's avatar dickelbeck
Browse files

MsgPanel is sized dynamically based on system gui font size

parent 896c6975
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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();

+8 −0
Original line number Diff line number Diff line
@@ -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
+3 −1
Original line number Diff line number Diff line
@@ -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 */
+26 −14
Original line number Diff line number Diff line
@@ -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;
+3 −1
Original line number Diff line number Diff line
@@ -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();

Loading