From 2f6c5f315690ced8220b34178305ba2d077360cf Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 9 Jul 2014 10:34:00 +0200 Subject: [PATCH] Removed EDA_DRAW_FRAME::SetGalCanvasActive() [it may be misleading], added EDA_DRAW_PANEL_GAL::GetBackend(). --- common/draw_frame.cpp | 5 +---- common/draw_panel_gal.cpp | 9 +++------ include/class_draw_panel_gal.h | 11 ++++++++++- include/draw_frame.h | 1 - 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 182e54fb6f..0d8030953f 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -1033,10 +1033,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable ); m_auimgr.Update(); - SetGalCanvasActive( aEnable ); - - if( aEnable ) - GetGalCanvas()->SetFocus(); + m_galCanvasActive = aEnable; } //-----< BASE_SCREEN API moved here >-------------------------------------------- diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index 1b293c63ac..6966a635df 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -51,7 +51,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin wxWindow( aParentWindow, aWindowId, aPosition, aSize ) { m_gal = NULL; - m_currentGal = GAL_TYPE_NONE; + m_backend = GAL_TYPE_NONE; m_view = NULL; m_painter = NULL; m_eventDispatcher = NULL; @@ -92,8 +92,6 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin m_pendingRefresh = false; m_drawing = false; Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this ); - - this->SetFocus(); } @@ -204,7 +202,7 @@ void EDA_DRAW_PANEL_GAL::StopDrawing() void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType ) { // Do not do anything if the currently used GAL is correct - if( aGalType == m_currentGal && m_gal != NULL ) + if( aGalType == m_backend && m_gal != NULL ) return; // Prevent refreshing canvas during backend switch @@ -235,7 +233,7 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType ) if( m_view ) m_view->SetGAL( m_gal ); - m_currentGal = aGalType; + m_backend = aGalType; } @@ -244,7 +242,6 @@ void EDA_DRAW_PANEL_GAL::onEvent( wxEvent& aEvent ) if( !m_eventDispatcher ) { aEvent.Skip(); - return; } else { diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h index 16de3a139c..2fe0d3e094 100644 --- a/include/class_draw_panel_gal.h +++ b/include/class_draw_panel_gal.h @@ -68,6 +68,15 @@ public: */ void SwitchBackend( GalType aGalType ); + /** + * Function GetBackend + * Returns the type of backend currently used by GAL canvas. + */ + inline GalType GetBackend() const + { + return m_backend; + } + /** * Function GetGAL() * Returns a pointer to the GAL instance used in the panel. @@ -159,7 +168,7 @@ protected: KIGFX::WX_VIEW_CONTROLS* m_viewControls; /// Currently used GAL - GalType m_currentGal; + GalType m_backend; /// Processes and forwards events to tools TOOL_DISPATCHER* m_eventDispatcher; diff --git a/include/draw_frame.h b/include/draw_frame.h index 6608c4b634..829c9317b5 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -675,7 +675,6 @@ public: * @return True for GAL-based canvas, false for standard canvas. */ bool IsGalCanvasActive() const { return m_galCanvasActive; } - void SetGalCanvasActive( bool aState ) { m_galCanvasActive = aState; } /** * Function GetGalCanvas