Commit 37309e1a authored by charras's avatar charras
Browse files

Ugly but necessary fix to display toolbars in latest Linux version (tested...

Ugly but necessary fix to display toolbars in latest Linux version (tested with Ubuntu 9.10 updated)
parent 2c9dd508
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -4,6 +4,18 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.

2010-Jan-13 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
Minor bug fixes, compiler warning fixes and code cleaning.

* Fix debug asserts when passing NULL pointers to wxAuiPaneInfo.
* Fix Kicad main window sash sizer bug when using wxAui.
* Remove specctra_test from Visual Studio builds to prevent build errors.
* Add WIN32 to layer widget test so it will build properly on Visual Studio.
* Fixed compiler conversion warnings in PCBNew.
* Fixed worksheet print scaling in PCBNew.
* Minor code renaming.

2010-Jan-12 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++All
+34 −45
Original line number Diff line number Diff line
@@ -340,72 +340,61 @@ void WinEDA_DrawFrame::DisplayUnitsMsg()
 */
void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
{
    wxSize size;
    wxSize opt_size;
    wxSize Vtoolbar_size;
    wxSize Auxtoolbar_size;

    GetClientSize( &size.x, &size.y );
    m_FrameSize = size;
    m_FrameSize = GetClientSize( );

#if !defined(KICAD_AUIMANAGER)
    size.y -= m_MsgFrameHeight;
    wxSize clientSize = m_FrameSize;
    wxPoint clientPosition;
    int default_value = -1;
    
    // Ugly fix for a problem found in recent linux version
    // where default value is broken
#ifdef __WXGTK__
    if( GetToolBar() )  // use main tool bar dimension as default value
        default_value = GetToolBar()->GetSize().y;
#endif

    clientSize.y -= m_MsgFrameHeight;

    if( MsgPanel ) // Resize the message panel.
    {
        MsgPanel->SetSize( 0, size.y, size.x, m_MsgFrameHeight );
        MsgPanel->SetSize( 0, clientSize.y, clientSize.x, m_MsgFrameHeight );
    }

    if( m_AuxiliaryToolBar )        // Resize the auxilary horizontal tool bar.
    {
        Auxtoolbar_size.x = size.x;
        Auxtoolbar_size.y = m_AuxiliaryToolBar->GetSize().y;
        m_AuxiliaryToolBar->SetSize( Auxtoolbar_size );
        m_AuxiliaryToolBar->SetSize( clientSize.x, default_value);
        m_AuxiliaryToolBar->Move( 0, 0 );
        size.y -= Auxtoolbar_size.y;
        clientSize.y -= m_AuxiliaryToolBar->GetDimension();
        clientPosition.y = m_AuxiliaryToolBar->GetDimension();
    }

    if( m_VToolBar )                // Resize the main right vertial tool bar.
    if( m_VToolBar )                // Resize the main right vertical tool bar.
    {
        Vtoolbar_size.x = m_VToolBar->GetSize().x;
        Vtoolbar_size.y = size.y;
        m_VToolBar->SetSize( Vtoolbar_size );
        m_VToolBar->Move( size.x - Vtoolbar_size.x, Auxtoolbar_size.y );
        m_VToolBar->Refresh();
        m_VToolBar->SetSize(default_value, clientSize.y );
        clientSize.x -= m_VToolBar->GetDimension();
        m_VToolBar->Move( clientSize.x, clientPosition.y );
    }

    if( m_AuxVToolBar )             // Resize the auxiliary right vertical
                                    // toolbar.
    if( m_AuxVToolBar )             // Resize the auxiliary right vertical toolbar.
    {
        Vtoolbar_size.x += m_AuxVToolBar->GetSize().x;
        Vtoolbar_size.y  = size.y;
        m_AuxVToolBar->SetSize( m_AuxVToolBar->GetSize().x, Vtoolbar_size.y );
        m_AuxVToolBar->Move( size.x - Vtoolbar_size.x, Auxtoolbar_size.y );
        m_AuxVToolBar->Refresh();
        m_AuxVToolBar->SetSize( default_value, clientSize.y );
        clientSize.x -= m_AuxVToolBar->GetDimension();
        m_AuxVToolBar->Move( clientSize.x, clientPosition.y );
    }
    if( m_OptionsToolBar )
    {
        if( m_OptionsToolBar->m_Horizontal )
        {
            opt_size.x = 0;
            opt_size.y = m_OptionsToolBar->GetSize().y;
            m_OptionsToolBar->SetSize( Auxtoolbar_size.x, 0,
                                       size.x, opt_size.y );
        }
        else

    if( m_OptionsToolBar )          // Resize the main left vertical tool bar.
    {
            opt_size.x = m_OptionsToolBar->GetSize().x;
            opt_size.y = 0;
            m_OptionsToolBar->SetSize( 0, Auxtoolbar_size.y,
                                       opt_size.x, size.y );
        }
        m_OptionsToolBar->SetSize( default_value, clientSize.y );
        clientSize.x -= m_OptionsToolBar->GetDimension( );
        m_OptionsToolBar->Move( 0, clientPosition.y );
        clientPosition.x += m_OptionsToolBar->GetDimension( ); 
    }
    
    if( DrawPanel )
    {
        DrawPanel->SetSize( size.x - Vtoolbar_size.x - opt_size.x,
                            size.y - opt_size.y - 1 );
        DrawPanel->Move( opt_size.x, opt_size.y + Auxtoolbar_size.y + 1 );
        DrawPanel->SetSize( clientPosition.x, clientPosition.y,
                clientSize.x, clientSize.y );
    }
#endif
    SizeEv.Skip();
+2 −1
Original line number Diff line number Diff line
@@ -76,8 +76,9 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
    SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
                                   ColorRefs[g_DrawBgColor].m_Green,
                                   ColorRefs[g_DrawBgColor].m_Blue ) );
#if defined KICAD_USE_BUFFERED_DC || defined KICAD_USE_BUFFERED_PAINTDC
    SetBackgroundStyle( wxBG_STYLE_CUSTOM );

#endif
    EnableScrolling( TRUE, TRUE );
    m_ClipBox.SetSize( size );
    m_ClipBox.SetX( 0 );
+9 −2
Original line number Diff line number Diff line
@@ -23,13 +23,20 @@ WinEDA_Toolbar::WinEDA_Toolbar( id_toolbar type, wxWindow * parent,
#endif
{
    m_Parent = parent;
    Pnext = NULL;
    m_Ident = type;
    m_Horizontal = horizontal;
    m_Size = 24;

    SetToolBitmapSize(wxSize(16,16));
    SetMargins(0,0);
    SetToolSeparation(1);
    SetToolPacking(1);
}


int WinEDA_Toolbar::GetDimension( )
{
    if( m_Horizontal )
        return GetSize().y;
    else
        return GetSize().x;
}
+6 −4
Original line number Diff line number Diff line
@@ -659,14 +659,11 @@ class WinEDA_Toolbar : public wxToolBar
public:
    wxWindow*       m_Parent;
    id_toolbar      m_Ident;
    WinEDA_Toolbar* Pnext;
    bool            m_Horizontal;
    int             m_Size;
    bool            m_Horizontal;       // some auxilary TB are horizontal, others vertical

public:
    WinEDA_Toolbar( id_toolbar type, wxWindow* parent,
                    wxWindowID id, bool horizontal );
    WinEDA_Toolbar* Next() { return Pnext; }

#if defined(KICAD_AUITOOLBAR)
    bool GetToolState( int toolId ) { return GetToolToggled(toolId); };
@@ -686,6 +683,11 @@ public:
    void SetToolNormalBitmap( int id, const wxBitmap& bitmap ) {};
    void SetRows( int nRows ) {};
#endif
    
    /** Function GetDimension
     * @return the dimension of this toolbar (Height if horizontal, Width if vertical.
     */
    int GetDimension( );
};


Loading