Commit 2f6c5f31 authored by Maciej Suminski's avatar Maciej Suminski

Removed EDA_DRAW_FRAME::SetGalCanvasActive() [it may be misleading], added...

Removed EDA_DRAW_FRAME::SetGalCanvasActive() [it may be misleading], added EDA_DRAW_PANEL_GAL::GetBackend().
parent 853abdac
...@@ -1033,10 +1033,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) ...@@ -1033,10 +1033,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable ); m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
m_auimgr.Update(); m_auimgr.Update();
SetGalCanvasActive( aEnable ); m_galCanvasActive = aEnable;
if( aEnable )
GetGalCanvas()->SetFocus();
} }
//-----< BASE_SCREEN API moved here >-------------------------------------------- //-----< BASE_SCREEN API moved here >--------------------------------------------
......
...@@ -51,7 +51,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin ...@@ -51,7 +51,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
wxWindow( aParentWindow, aWindowId, aPosition, aSize ) wxWindow( aParentWindow, aWindowId, aPosition, aSize )
{ {
m_gal = NULL; m_gal = NULL;
m_currentGal = GAL_TYPE_NONE; m_backend = GAL_TYPE_NONE;
m_view = NULL; m_view = NULL;
m_painter = NULL; m_painter = NULL;
m_eventDispatcher = NULL; m_eventDispatcher = NULL;
...@@ -92,8 +92,6 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin ...@@ -92,8 +92,6 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
m_pendingRefresh = false; m_pendingRefresh = false;
m_drawing = false; m_drawing = false;
Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this ); Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this );
this->SetFocus();
} }
...@@ -204,7 +202,7 @@ void EDA_DRAW_PANEL_GAL::StopDrawing() ...@@ -204,7 +202,7 @@ void EDA_DRAW_PANEL_GAL::StopDrawing()
void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType ) void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
{ {
// Do not do anything if the currently used GAL is correct // 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; return;
// Prevent refreshing canvas during backend switch // Prevent refreshing canvas during backend switch
...@@ -235,7 +233,7 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType ) ...@@ -235,7 +233,7 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
if( m_view ) if( m_view )
m_view->SetGAL( m_gal ); m_view->SetGAL( m_gal );
m_currentGal = aGalType; m_backend = aGalType;
} }
...@@ -244,7 +242,6 @@ void EDA_DRAW_PANEL_GAL::onEvent( wxEvent& aEvent ) ...@@ -244,7 +242,6 @@ void EDA_DRAW_PANEL_GAL::onEvent( wxEvent& aEvent )
if( !m_eventDispatcher ) if( !m_eventDispatcher )
{ {
aEvent.Skip(); aEvent.Skip();
return;
} }
else else
{ {
......
...@@ -68,6 +68,15 @@ public: ...@@ -68,6 +68,15 @@ public:
*/ */
void SwitchBackend( GalType aGalType ); 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() * Function GetGAL()
* Returns a pointer to the GAL instance used in the panel. * Returns a pointer to the GAL instance used in the panel.
...@@ -159,7 +168,7 @@ protected: ...@@ -159,7 +168,7 @@ protected:
KIGFX::WX_VIEW_CONTROLS* m_viewControls; KIGFX::WX_VIEW_CONTROLS* m_viewControls;
/// Currently used GAL /// Currently used GAL
GalType m_currentGal; GalType m_backend;
/// Processes and forwards events to tools /// Processes and forwards events to tools
TOOL_DISPATCHER* m_eventDispatcher; TOOL_DISPATCHER* m_eventDispatcher;
......
...@@ -675,7 +675,6 @@ public: ...@@ -675,7 +675,6 @@ public:
* @return True for GAL-based canvas, false for standard canvas. * @return True for GAL-based canvas, false for standard canvas.
*/ */
bool IsGalCanvasActive() const { return m_galCanvasActive; } bool IsGalCanvasActive() const { return m_galCanvasActive; }
void SetGalCanvasActive( bool aState ) { m_galCanvasActive = aState; }
/** /**
* Function GetGalCanvas * Function GetGalCanvas
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment