Ugly but necessary fix to display toolbars in latest Linux version (tested with Ubuntu 9.10 updated)

This commit is contained in:
charras 2010-01-14 20:20:59 +00:00
parent 2c9dd50851
commit 37309e1aac
7 changed files with 73 additions and 56 deletions

View File

@ -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

View File

@ -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();
}
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
{
opt_size.x = m_OptionsToolBar->GetSize().x;
opt_size.y = 0;
m_OptionsToolBar->SetSize( 0, Auxtoolbar_size.y,
opt_size.x, size.y );
}
m_AuxVToolBar->SetSize( default_value, clientSize.y );
clientSize.x -= m_AuxVToolBar->GetDimension();
m_AuxVToolBar->Move( clientSize.x, clientPosition.y );
}
if( m_OptionsToolBar ) // Resize the main left vertical tool bar.
{
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();

View File

@ -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 );

View File

@ -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;
}

View File

@ -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( );
};

View File

@ -109,8 +109,14 @@ int WinEDA_BasePcbFrame::BestZoom( void )
dy = m_Pcb->m_BoundaryBox.GetHeight();
size = DrawPanel->GetClientSize();
ii = ( dx + (size.x / 2) ) / size.x;
jj = ( dy + (size.y / 2) ) / size.y;
if( size.x )
ii = ( dx + (size.x / 2) ) / size.x;
else
ii = 31;
if ( size.y )
jj = ( dy + (size.y / 2) ) / size.y;
else
jj = 31;
bestzoom = MAX( ii, jj ) + 1;
GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre();

View File

@ -93,7 +93,7 @@ bool WinEDA_App::OnInit()
if( fn.GetExt() != BoardFileExtension )
{
wxLogDebug( wxT( "PcbNew file <%s> has the wrong extension. \
wxLogDebug( wxT( "PcbNew file <%s> has the wrong extension.\
Changing extension to .brd." ),
GetChars( fn.GetFullPath() ) );
fn.SetExt( BoardFileExtension );