From 4b61440eb11b59c79c2403d955e1e1c2382bdc35 Mon Sep 17 00:00:00 2001 From: charras Date: Sat, 7 Nov 2009 14:36:54 +0000 Subject: [PATCH] fix some problems (not all) when using wxAUI. others minor bugs fix. --- common/drawframe.cpp | 2 +- cvpcb/cvframe.cpp | 36 +++++++++++++------- cvpcb/displayframe.cpp | 41 +++++++++++++++++++++-- pcbnew/basepcbframe.cpp | 18 +++++----- pcbnew/moduleframe.cpp | 9 +---- pcbnew/tool_modedit.cpp | 3 +- pcbnew/tool_pcb.cpp | 3 +- pcbnew/toolbars_update_user_interface.cpp | 5 +-- 8 files changed, 76 insertions(+), 41 deletions(-) diff --git a/common/drawframe.cpp b/common/drawframe.cpp index d03109a948..99e6cb8f56 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -398,9 +398,9 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) GetClientSize( &size.x, &size.y ); m_FrameSize = size; - size.y -= m_MsgFrameHeight; #if !defined(KICAD_AUIMANAGER) + size.y -= m_MsgFrameHeight; if( MsgPanel ) // Positionnement en bas d'ecran { MsgPanel->SetSize( 0, size.y, size.x, m_MsgFrameHeight ); diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 388fc0a103..e094773260 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -136,6 +136,12 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, if( 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 static const int dims[3] = { -1, -1, 250 }; @@ -149,6 +155,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, BuildCmpListBox(); BuildFOOTPRINTS_LISTBOX(); +#if !defined(KICAD_AUIMANAGER) /* Create size constraints of the component list window display. */ wxLayoutConstraints* linkpos = new wxLayoutConstraints; linkpos->top.SameAs( this, wxTop ); @@ -166,12 +173,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, linkpos->left.SameAs( m_ListCmp, wxRight ); if( m_FootprintList ) m_FootprintList->SetConstraints( linkpos ); - - // 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 ); +#endif #if defined(KICAD_AUIMANAGER) m_auimgr.SetManagedWindow( this ); @@ -184,20 +186,17 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, 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() ); + m_auimgr.AddPane( m_ListCmp, + wxAuiPaneInfo(horiz).Name( wxT( "m_ListCmp" ) ).CentrePane() ); + m_auimgr.AddPane( m_FootprintList, wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ). - Left().BestSize( m_FrameSize.x * 0.3, m_FrameSize.y * 0.9 ) ); - - m_auimgr.AddPane( m_ListCmp, - wxAuiPaneInfo().Name( wxT( "m_ListCmp" ) ).CentrePane() ); + Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) ); m_auimgr.Update(); #endif @@ -588,6 +587,17 @@ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& 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; OnSelectComponent( l_event ); diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index 79030bad77..f412d1a3ad 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -25,7 +25,7 @@ BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_BasePcbFrame ) 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( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_DisplayFrame::Show3D_Frame ) @@ -59,8 +59,9 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father, LoadSettings(); // Internalize 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_USER - 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 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 ); ReCreateHToolbar(); 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 ); } @@ -85,7 +119,6 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame() ( (WinEDA_CvpcbFrame*) wxGetApp().GetTopWindow() )->DrawFrame = NULL; } - /* Called when the frame is closed * Save current settings (frame position and size */ @@ -104,6 +137,8 @@ void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event ) void WinEDA_DisplayFrame::ReCreateVToolbar() { + // Currently, no vertical right toolbar. + // So do nothing } diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 262cac5abc..3a981bbeb6 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -381,19 +381,21 @@ void WinEDA_BasePcbFrame::LoadSettings() wxConfig* cfg = wxGetApp().m_EDA_Config; 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 + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 ); - cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits, - ( long )INCHES ); + cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits, ( long )INCHES ); 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 + DisplayModuleEdgeEntry, &m_DisplayModEdge, - ( long )FILLED ); + cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED ); if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH ) m_DisplayModEdge = FILLED; - cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, - ( long )FILLED ); + cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, ( long )FILLED ); if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH ) m_DisplayModText = FILLED; } @@ -416,7 +418,7 @@ void WinEDA_BasePcbFrame::SaveSettings() cfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y ); cfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnits ); 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 + DisplayModuleEdgeEntry, ( long )m_DisplayModEdge ); cfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayModText ); diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 6f02ce1fe4..cbdc73c4dd 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -175,10 +175,6 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, ActiveScreen = GetScreen(); GetScreen()->SetCurItem( NULL ); 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()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); @@ -400,10 +396,7 @@ void WinEDA_ModuleEditFrame::SetToolbars() } if( m_SelGridBox ) - { - m_SelGridBox->SetSelection( ID_POPUP_GRID_LEVEL_1000 + - m_LastGridSizeId ); - } + m_SelGridBox->SetSelection( m_LastGridSizeId ); } DisplayUnitsMsg(); diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index 485a06c680..a1b42ee00c 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -319,8 +319,7 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() m_SelGridBox->Append( msg, (void*) &GetScreen()->m_GridList[i].m_Id ); - if( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId == - GetScreen()->m_GridList[i].m_Id ) + if( m_LastGridSizeId == GetScreen()->m_GridList[i].m_Id ) m_SelGridBox->SetSelection( i ); } diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 9a05a7ccda..c3b4fdd2df 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -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 ); - if( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId == - GetScreen()->m_GridList[i].m_Id ) + if( m_LastGridSizeId == GetScreen()->m_GridList[i].m_Id ) m_SelGridBox->SetSelection( i ); } diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 2fb84b38e9..d8e4c078de 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -138,10 +138,7 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI() } if( m_SelGridBox ) - { - m_SelGridBox->SetSelection( ID_POPUP_GRID_LEVEL_1000 + - m_LastGridSizeId ); - } + m_SelGridBox->SetSelection( m_LastGridSizeId ); m_TrackAndViasSizesList_Changed = false; }