fixed somes issues with wxWidgets 2.9.1

This commit is contained in:
jean-pierre charras 2010-07-27 14:47:08 +02:00
parent 68d652cd63
commit 141d5b5f3c
7 changed files with 61 additions and 35 deletions

View File

@ -164,7 +164,7 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 ); iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 );
BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap, BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap,
wxDefaultPosition, wxSize( w, h ) ); wxDefaultPosition, wxSize( w+8, h+6 ) );
FlexColumnBoxSizer->Add( BitmapButton, 0, FlexColumnBoxSizer->Add( BitmapButton, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxBOTTOM, 5 ); wxLEFT | wxBOTTOM, 5 );

View File

@ -199,7 +199,7 @@ void WinEDA_SetColorsFrame::CreateControls()
BitmapButton = BitmapButton =
new wxBitmapButton( this, butt_ID, ButtBitmap, wxDefaultPosition, new wxBitmapButton( this, butt_ID, ButtBitmap, wxDefaultPosition,
wxSize( BUTT_SIZE_X, BUTT_SIZE_Y ) ); wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) );
RowBoxSizer->Add( BitmapButton, RowBoxSizer->Add( BitmapButton,
0, 0,
wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM,

View File

@ -38,8 +38,8 @@ enum col_sel_id {
#endif #endif
// Specify the width and height of every (color-displaying / bitmap) button // Specify the width and height of every (color-displaying / bitmap) button
const int BUTT_SIZE_X = 30; const int BUTT_SIZE_X = 16;
const int BUTT_SIZE_Y = 20; const int BUTT_SIZE_Y = 16;
// Macro utile : // Macro utile :
#define ADR( numlayer ) & (g_LayerDescr.LayerColor[numlayer]) #define ADR( numlayer ) & (g_LayerDescr.LayerColor[numlayer])

View File

@ -131,10 +131,13 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
m_show_layer_manager_tools = true; m_show_layer_manager_tools = true;
m_Draw_Axis = true; // true to show X and Y axis on screen m_Draw_Axis = true; // true to show X and Y axis on screen
m_Draw_Sheet_Ref = FALSE; // TRUE for reference drawings. m_Draw_Sheet_Ref = false; // true for reference drawings.
m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
m_SelLayerBox = NULL;
m_SelLayerTool = NULL;
if( DrawPanel ) if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE; DrawPanel->m_Block_Enable = true;
// Give an icon // Give an icon
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -238,7 +241,8 @@ void WinEDA_GerberFrame::OnCloseWindow( wxCloseEvent& Event )
*/ */
void WinEDA_GerberFrame::SetToolbars() void WinEDA_GerberFrame::SetToolbars()
{ {
int layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen();
int layer = screen->m_Active_Layer;
GERBER* gerber = g_GERBER_List[layer]; GERBER* gerber = g_GERBER_List[layer];
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
@ -246,40 +250,41 @@ void WinEDA_GerberFrame::SetToolbars()
if( GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) if( GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
{ {
m_HToolBar->EnableTool( wxID_CUT, TRUE ); m_HToolBar->EnableTool( wxID_CUT, true );
m_HToolBar->EnableTool( wxID_COPY, TRUE ); m_HToolBar->EnableTool( wxID_COPY, true );
} }
else else
{ {
m_HToolBar->EnableTool( wxID_CUT, FALSE ); m_HToolBar->EnableTool( wxID_CUT, false );
m_HToolBar->EnableTool( wxID_COPY, FALSE ); m_HToolBar->EnableTool( wxID_COPY, false );
} }
if( m_SelLayerBox->GetSelection() != if( m_SelLayerBox && (m_SelLayerBox->GetSelection() != screen->m_Active_Layer) )
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer )
{ {
m_SelLayerBox->SetSelection( m_SelLayerBox->SetSelection( screen->m_Active_Layer );
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
} }
if( gerber ) if( m_SelLayerTool )
{ {
int sel_index; if( gerber )
m_SelLayerTool->Enable( TRUE );
if( gerber->m_Selected_Tool < FIRST_DCODE ) // No tool selected
sel_index = 0;
else
sel_index = gerber->m_Selected_Tool - FIRST_DCODE + 1;
if( sel_index != m_SelLayerTool->GetSelection() )
{ {
m_SelLayerTool->SetSelection( sel_index ); int sel_index;
m_SelLayerTool->Enable( true );
if( gerber->m_Selected_Tool < FIRST_DCODE ) // No tool selected
sel_index = 0;
else
sel_index = gerber->m_Selected_Tool - FIRST_DCODE + 1;
if( sel_index != m_SelLayerTool->GetSelection() )
{
m_SelLayerTool->SetSelection( sel_index );
}
}
else
{
m_SelLayerTool->SetSelection( 0 );
m_SelLayerTool->Enable( false );
} }
}
else
{
m_SelLayerTool->SetSelection( 0 );
m_SelLayerTool->Enable( FALSE );
} }
if( m_OptionsToolBar ) if( m_OptionsToolBar )
@ -287,9 +292,9 @@ void WinEDA_GerberFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UserUnit == g_UserUnit ==
MILLIMETRES ? TRUE : FALSE ); MILLIMETRES ? true : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UserUnit == INCHES ? TRUE : FALSE ); g_UserUnit == INCHES ? true : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );

View File

@ -105,7 +105,6 @@ bool WinEDA_App::OnInit()
* main frame in order to display the * main frame in order to display the
* real hotkeys in menus or tool tips * real hotkeys in menus or tool tips
*/ */
frame = new WinEDA_GerberFrame( NULL, wxT( "GerbView" ), frame = new WinEDA_GerberFrame( NULL, wxT( "GerbView" ),
wxPoint( 0, 0 ), wxPoint( 0, 0 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );

View File

@ -3,6 +3,8 @@
/***************************************************/ /***************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "wx/wupdlock.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "macros.h" #include "macros.h"
@ -16,6 +18,8 @@
void WinEDA_GerberFrame::ReCreateMenuBar( void ) void WinEDA_GerberFrame::ReCreateMenuBar( void )
{ {
wxWindowUpdateLocker dummy(this);
wxMenuBar *menuBar = GetMenuBar(); wxMenuBar *menuBar = GetMenuBar();
/* Destroy the existing menu bar so it can be rebuilt. This allows /* Destroy the existing menu bar so it can be rebuilt. This allows
@ -143,6 +147,10 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
// we create m_SelLayerTool that have a lot of items,
// so create a wxWindowUpdateLocker is a good idea
wxWindowUpdateLocker dummy(this);
if( GetScreen() ) if( GetScreen() )
{ {
layer = GetScreen()->m_Active_Layer; layer = GetScreen()->m_Active_Layer;
@ -214,11 +222,12 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
ID_TOOLBARH_GERBVIEW_SELECT_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), wxDefaultPosition, wxSize( 150, -1 ),
choices ); choices );
m_SelLayerBox->SetSelection( getActiveLayer() );
m_HToolBar->AddControl( m_SelLayerBox ); m_HToolBar->AddControl( m_SelLayerBox );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
choices.Clear(); choices.Clear();
choices.Alloc(MAX_TOOLS+1);
choices.Add( _( "No tool" ) ); choices.Add( _( "No tool" ) );
for( ii = 0; ii < MAX_TOOLS; ii++ ) for( ii = 0; ii < MAX_TOOLS; ii++ )
@ -227,7 +236,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
msg = _( "Tool " ); msg << ii + FIRST_DCODE; msg = _( "Tool " ); msg << ii + FIRST_DCODE;
choices.Add( msg ); choices.Add( msg );
} }
m_SelLayerTool = new WinEDAChoiceBox( m_HToolBar, m_SelLayerTool = new WinEDAChoiceBox( m_HToolBar,
ID_TOOLBARH_GERBER_SELECT_TOOL, ID_TOOLBARH_GERBER_SELECT_TOOL,
wxDefaultPosition, wxSize( 150, -1 ), wxDefaultPosition, wxSize( 150, -1 ),
@ -250,6 +258,8 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
if( m_VToolBar ) if( m_VToolBar )
return; return;
wxWindowUpdateLocker dummy(this);
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE ); m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
// Set up toolbar // Set up toolbar
@ -274,6 +284,8 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
wxWindowUpdateLocker dummy(this);
// creation of tool bar options // creation of tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
ID_OPT_TOOLBAR, FALSE ); ID_OPT_TOOLBAR, FALSE );

View File

@ -3,6 +3,7 @@
/***************************************/ /***************************************/
#include "fctsys.h" #include "fctsys.h"
#include "wx/wupdlock.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
@ -180,6 +181,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
return; return;
} }
wxWindowUpdateLocker dummy(this);
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
m_HToolBar->SetRows( 1 ); m_HToolBar->SetRows( 1 );
@ -295,6 +297,8 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
wxWindowUpdateLocker dummy(this);
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
ID_OPT_TOOLBAR, FALSE ); ID_OPT_TOOLBAR, FALSE );
@ -396,6 +400,8 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
if( m_VToolBar ) if( m_VToolBar )
return; return;
wxWindowUpdateLocker dummy(this);
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE ); m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
// Set up toolbar // Set up toolbar
@ -481,6 +487,8 @@ void WinEDA_PcbFrame::ReCreateMicrowaveVToolbar()
if( m_AuxVToolBar ) if( m_AuxVToolBar )
return; return;
wxWindowUpdateLocker dummy(this);
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this,
ID_MICROWAVE_V_TOOLBAR, FALSE ); ID_MICROWAVE_V_TOOLBAR, FALSE );
@ -528,6 +536,8 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
size_t i; size_t i;
wxString msg; wxString msg;
wxWindowUpdateLocker dummy(this);
if( m_AuxiliaryToolBar == NULL ) if( m_AuxiliaryToolBar == NULL )
{ {
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this, m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,