fix some problems (not all) when using wxAUI.

others minor bugs fix.
This commit is contained in:
charras 2009-11-07 14:36:54 +00:00
parent 277b843a69
commit 4b61440eb1
8 changed files with 76 additions and 41 deletions

View File

@ -398,9 +398,9 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
GetClientSize( &size.x, &size.y ); GetClientSize( &size.x, &size.y );
m_FrameSize = size; m_FrameSize = size;
size.y -= m_MsgFrameHeight;
#if !defined(KICAD_AUIMANAGER) #if !defined(KICAD_AUIMANAGER)
size.y -= m_MsgFrameHeight;
if( MsgPanel ) // Positionnement en bas d'ecran if( MsgPanel ) // Positionnement en bas d'ecran
{ {
MsgPanel->SetSize( 0, size.y, size.x, m_MsgFrameHeight ); MsgPanel->SetSize( 0, size.y, size.x, m_MsgFrameHeight );

View File

@ -136,6 +136,12 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
if( m_FrameSize.y < FRAME_MIN_SIZE_Y ) if( m_FrameSize.y < FRAME_MIN_SIZE_Y )
m_FrameSize.y = FRAME_MIN_SIZE_Y; m_FrameSize.y = FRAME_MIN_SIZE_Y;
// Set minimal frame width and height
SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 );
// Framesize and position
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// create the status bar // create the status bar
static const int dims[3] = { -1, -1, 250 }; static const int dims[3] = { -1, -1, 250 };
@ -149,6 +155,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
BuildCmpListBox(); BuildCmpListBox();
BuildFOOTPRINTS_LISTBOX(); BuildFOOTPRINTS_LISTBOX();
#if !defined(KICAD_AUIMANAGER)
/* Create size constraints of the component list window display. */ /* Create size constraints of the component list window display. */
wxLayoutConstraints* linkpos = new wxLayoutConstraints; wxLayoutConstraints* linkpos = new wxLayoutConstraints;
linkpos->top.SameAs( this, wxTop ); linkpos->top.SameAs( this, wxTop );
@ -166,12 +173,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
linkpos->left.SameAs( m_ListCmp, wxRight ); linkpos->left.SameAs( m_ListCmp, wxRight );
if( m_FootprintList ) if( m_FootprintList )
m_FootprintList->SetConstraints( linkpos ); m_FootprintList->SetConstraints( linkpos );
#endif
// Set minimal frame width and height
SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 );
// Framesize and position
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
@ -184,20 +186,17 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
horiz.CloseButton( false ); horiz.CloseButton( false );
horiz.CaptionVisible( false ); horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false ); horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() ); wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
m_auimgr.AddPane( m_ListCmp,
wxAuiPaneInfo(horiz).Name( wxT( "m_ListCmp" ) ).CentrePane() );
m_auimgr.AddPane( m_FootprintList, m_auimgr.AddPane( m_FootprintList,
wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ). wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
Left().BestSize( m_FrameSize.x * 0.3, m_FrameSize.y * 0.9 ) ); Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) );
m_auimgr.AddPane( m_ListCmp,
wxAuiPaneInfo().Name( wxT( "m_ListCmp" ) ).CentrePane() );
m_auimgr.Update(); m_auimgr.Update();
#endif #endif
@ -588,6 +587,17 @@ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event )
*/ */
void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event ) void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event )
{ {
switch (event.GetId() )
{
case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST:
m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false );
break;
case ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST:
m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false );
break;
default:
break;
}
wxListEvent l_event; wxListEvent l_event;
OnSelectComponent( l_event ); OnSelectComponent( l_event );

View File

@ -25,7 +25,7 @@
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_BasePcbFrame ) BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DrawFrame::OnSize ) EVT_SIZE( WinEDA_DisplayFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay ) EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_DisplayFrame::Show3D_Frame ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_DisplayFrame::Show3D_Frame )
@ -59,8 +59,9 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
LoadSettings(); LoadSettings();
// Internalize grid id to a default value if not found in config or bad: // Internalize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) || if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) ) (m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000; m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
// Initialize some display options // Initialize some display options
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here
@ -71,6 +72,39 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateVToolbar(); ReCreateVToolbar();
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
if( m_VToolBar ) // Currently, no vertical right toolbar.
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
Show( TRUE ); Show( TRUE );
} }
@ -85,7 +119,6 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
( (WinEDA_CvpcbFrame*) wxGetApp().GetTopWindow() )->DrawFrame = NULL; ( (WinEDA_CvpcbFrame*) wxGetApp().GetTopWindow() )->DrawFrame = NULL;
} }
/* Called when the frame is closed /* Called when the frame is closed
* Save current settings (frame position and size * Save current settings (frame position and size
*/ */
@ -104,6 +137,8 @@ void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
void WinEDA_DisplayFrame::ReCreateVToolbar() void WinEDA_DisplayFrame::ReCreateVToolbar()
{ {
// Currently, no vertical right toolbar.
// So do nothing
} }

View File

@ -381,19 +381,21 @@ void WinEDA_BasePcbFrame::LoadSettings()
wxConfig* cfg = wxGetApp().m_EDA_Config; wxConfig* cfg = wxGetApp().m_EDA_Config;
WinEDA_DrawFrame::LoadSettings(); WinEDA_DrawFrame::LoadSettings();
// Ensure grid id is an existant grid id:
if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 ); cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 ); cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits, cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits, ( long )INCHES );
( long )INCHES );
cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true ); cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true ); //TODO: Will adding this line break tha pcbnew file compatibility? cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true ); cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED );
( long )FILLED );
if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH ) if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH )
m_DisplayModEdge = FILLED; m_DisplayModEdge = FILLED;
cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, ( long )FILLED );
( long )FILLED );
if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH ) if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH )
m_DisplayModText = FILLED; m_DisplayModText = FILLED;
} }
@ -416,7 +418,7 @@ void WinEDA_BasePcbFrame::SaveSettings()
cfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y ); cfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y );
cfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnits ); cfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnits );
cfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayPadFill ); cfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayPadFill );
cfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayViaFill ); //TODO: Will adding this line break tha pcbnew file compatibility? cfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayViaFill );
cfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum ); cfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum );
cfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayModEdge ); cfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayModEdge );
cfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayModText ); cfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayModText );

View File

@ -175,10 +175,6 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
ActiveScreen = GetScreen(); ActiveScreen = GetScreen();
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
LoadSettings(); LoadSettings();
// Initilialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnits, ID_POPUP_GRID_USER ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnits, ID_POPUP_GRID_USER );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
@ -400,10 +396,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
} }
if( m_SelGridBox ) if( m_SelGridBox )
{ m_SelGridBox->SetSelection( m_LastGridSizeId );
m_SelGridBox->SetSelection( ID_POPUP_GRID_LEVEL_1000 +
m_LastGridSizeId );
}
} }
DisplayUnitsMsg(); DisplayUnitsMsg();

View File

@ -319,8 +319,7 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
m_SelGridBox->Append( msg, (void*) &GetScreen()->m_GridList[i].m_Id ); m_SelGridBox->Append( msg, (void*) &GetScreen()->m_GridList[i].m_Id );
if( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId == if( m_LastGridSizeId == GetScreen()->m_GridList[i].m_Id )
GetScreen()->m_GridList[i].m_Id )
m_SelGridBox->SetSelection( i ); m_SelGridBox->SetSelection( i );
} }

View File

@ -665,8 +665,7 @@ an existing track use its width\notherwise, use current width setting" ),
m_SelGridBox->Append( msg, (void*) &GetScreen()->m_GridList[i].m_Id ); m_SelGridBox->Append( msg, (void*) &GetScreen()->m_GridList[i].m_Id );
if( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId == if( m_LastGridSizeId == GetScreen()->m_GridList[i].m_Id )
GetScreen()->m_GridList[i].m_Id )
m_SelGridBox->SetSelection( i ); m_SelGridBox->SetSelection( i );
} }

View File

@ -138,10 +138,7 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI()
} }
if( m_SelGridBox ) if( m_SelGridBox )
{ m_SelGridBox->SetSelection( m_LastGridSizeId );
m_SelGridBox->SetSelection( ID_POPUP_GRID_LEVEL_1000 +
m_LastGridSizeId );
}
m_TrackAndViasSizesList_Changed = false; m_TrackAndViasSizesList_Changed = false;
} }