Commit 517ca83f authored by Dick Hollenbeck's avatar Dick Hollenbeck

Hide m_galCanvas and m_galCanvasActive behind accessors. Fix DLIST concatonation API corner case.

parent 9be908ce
...@@ -62,7 +62,6 @@ PCBNew ...@@ -62,7 +62,6 @@ PCBNew
Dick's Final TODO List: Dick's Final TODO List:
====================== ======================
*) Apply Fabrizio and Alexander's linux desktop patches after unifying them.
*) Get licensing cleaned up. *) Get licensing cleaned up.
*) Re-arrange the repo architecture. *) Re-arrange the repo architecture.
*) DLL-ization of pcbnew & eeschema *) DLL-ization of pcbnew & eeschema
......
...@@ -87,13 +87,13 @@ void DHEAD::append( EDA_ITEM* aNewElement ) ...@@ -87,13 +87,13 @@ void DHEAD::append( EDA_ITEM* aNewElement )
void DHEAD::append( DHEAD& aList ) void DHEAD::append( DHEAD& aList )
{ {
wxCHECK_RET( aList.GetCount() != 0, wxT( "Attempt to append empty list." ) ); if( aList.first )
{
// Change the item's list to me. // Change the item's list to me.
for( EDA_ITEM* item = aList.first; item != NULL; item = item->Next() ) for( EDA_ITEM* item = aList.first; item; item = item->Next() )
item->SetList( this ); item->SetList( this );
if( first ) // list is not empty, set last item's next to the first item in aList if( first ) // this list is not empty, set last item's next to the first item in aList
{ {
wxCHECK_RET( last != NULL, wxT( "Last list element not set." ) ); wxCHECK_RET( last != NULL, wxT( "Last list element not set." ) );
...@@ -101,7 +101,7 @@ void DHEAD::append( DHEAD& aList ) ...@@ -101,7 +101,7 @@ void DHEAD::append( DHEAD& aList )
aList.first->SetBack( last ); aList.first->SetBack( last );
last = aList.last; last = aList.last;
} }
else // list is empty, first and last are same as aList else // this list is empty, first and last are same as aList
{ {
first = aList.first; first = aList.first;
last = aList.last; last = aList.last;
...@@ -112,6 +112,7 @@ void DHEAD::append( DHEAD& aList ) ...@@ -112,6 +112,7 @@ void DHEAD::append( DHEAD& aList )
aList.count = 0; aList.count = 0;
aList.first = NULL; aList.first = NULL;
aList.last = NULL; aList.last = NULL;
}
} }
......
...@@ -228,10 +228,10 @@ void EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent() ...@@ -228,10 +228,10 @@ void EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent()
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent ) void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
{ {
SetGridVisibility( !IsGridVisible() ); SetGridVisibility( !IsGridVisible() );
if( m_galCanvasActive ) if( IsGalCanvasActive() )
{ {
m_galCanvas->GetGAL()->SetGridVisibility( IsGridVisible() ); GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
m_galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
} }
m_canvas->Refresh(); m_canvas->Refresh();
...@@ -387,11 +387,11 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) ...@@ -387,11 +387,11 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
screen->SetGrid( id ); screen->SetGrid( id );
SetCrossHairPosition( RefPos( true ) ); SetCrossHairPosition( RefPos( true ) );
if( m_galCanvasActive ) if( IsGalCanvasActive() )
{ {
m_galCanvas->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x, GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x,
screen->GetGrid().m_Size.y ) ); screen->GetGrid().m_Size.y ) );
m_galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
} }
m_canvas->Refresh(); m_canvas->Refresh();
...@@ -422,17 +422,17 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event ) ...@@ -422,17 +422,17 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
GetScreen()->SetZoom( selectedZoom ); GetScreen()->SetZoom( selectedZoom );
if( m_galCanvasActive ) if( IsGalCanvasActive() )
{ {
// Apply computed view settings to GAL // Apply computed view settings to GAL
KIGFX::VIEW* view = m_galCanvas->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
KIGFX::GAL* gal = m_galCanvas->GetGAL(); KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
double zoom = 1.0 / ( zoomFactor * GetZoom() ); double zoom = 1.0 / ( zoomFactor * GetZoom() );
view->SetScale( zoom ); view->SetScale( zoom );
m_galCanvas->Refresh(); GetGalCanvas()->Refresh();
} }
else else
RedrawScreen( GetScrollCenterPosition(), false ); RedrawScreen( GetScrollCenterPosition(), false );
...@@ -954,8 +954,8 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU ) ...@@ -954,8 +954,8 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
{ {
KIGFX::VIEW* view = m_galCanvas->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
KIGFX::GAL* gal = m_galCanvas->GetGAL(); KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
...@@ -965,7 +965,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) ...@@ -965,7 +965,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
// Switch to GAL rendering // Switch to GAL rendering
if( !m_galCanvasActive ) if( !IsGalCanvasActive() )
{ {
// Set up viewport // Set up viewport
double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() ); double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
...@@ -981,7 +981,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) ...@@ -981,7 +981,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
else else
{ {
// Switch to standard rendering // Switch to standard rendering
if( m_galCanvasActive ) if( IsGalCanvasActive() )
{ {
// Change view settings only if GAL was active previously // Change view settings only if GAL was active previously
double zoom = 1.0 / ( zoomFactor * view->GetScale() ); double zoom = 1.0 / ( zoomFactor * view->GetScale() );
...@@ -993,17 +993,17 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) ...@@ -993,17 +993,17 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
} }
m_canvas->SetEvtHandlerEnabled( !aEnable ); m_canvas->SetEvtHandlerEnabled( !aEnable );
m_galCanvas->SetEvtHandlerEnabled( aEnable ); GetGalCanvas()->SetEvtHandlerEnabled( aEnable );
// Switch panes // Switch panes
m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable ); m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable ); m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
m_auimgr.Update(); m_auimgr.Update();
m_galCanvasActive = aEnable; SetGalCanvasActive( aEnable );
if( aEnable ) if( aEnable )
m_galCanvas->SetFocus(); GetGalCanvas()->SetFocus();
} }
//-----< BASE_SCREEN API moved here >-------------------------------------------- //-----< BASE_SCREEN API moved here >--------------------------------------------
......
...@@ -84,7 +84,7 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) ...@@ -84,7 +84,7 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
if( screen->m_FirstRedraw ) if( screen->m_FirstRedraw )
SetCrossHairPosition( GetScrollCenterPosition() ); SetCrossHairPosition( GetScrollCenterPosition() );
if( !m_galCanvasActive ) if( !IsGalCanvasActive() )
RedrawScreen( GetScrollCenterPosition(), aWarpPointer ); RedrawScreen( GetScrollCenterPosition(), aWarpPointer );
} }
...@@ -194,18 +194,18 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) ...@@ -194,18 +194,18 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
RedrawScreen( center, true ); RedrawScreen( center, true );
} }
if( m_galCanvasActive ) if( IsGalCanvasActive() )
{ {
// Apply computed view settings to GAL // Apply computed view settings to GAL
KIGFX::VIEW* view = m_galCanvas->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
KIGFX::GAL* gal = m_galCanvas->GetGAL(); KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
double zoom = 1.0 / ( zoomFactor * GetZoom() ); double zoom = 1.0 / ( zoomFactor * GetZoom() );
view->SetScale( zoom ); view->SetScale( zoom );
view->SetCenter( VECTOR2D( center ) ); view->SetCenter( VECTOR2D( center ) );
m_galCanvas->Refresh(); GetGalCanvas()->Refresh();
} }
UpdateStatusBar(); UpdateStatusBar();
......
...@@ -393,21 +393,21 @@ class EDA_DRAW_FRAME : public EDA_BASE_FRAME ...@@ -393,21 +393,21 @@ class EDA_DRAW_FRAME : public EDA_BASE_FRAME
int m_toolId; int m_toolId;
BASE_SCREEN* m_currentScreen; ///< current used SCREEN BASE_SCREEN* m_currentScreen; ///< current used SCREEN
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid. bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
bool m_galCanvasActive; ///< whether to use new GAL engine
EDA_DRAW_PANEL_GAL* m_galCanvas;
protected: protected:
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList; EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
int m_LastGridSizeId; int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid bool m_DrawGrid; // hide/Show grid
bool m_galCanvasActive; // whether to use new GAL engine
EDA_COLOR_T m_GridColor; // Grid color EDA_COLOR_T m_GridColor; // Grid color
/// The area to draw on. /// The area to draw on.
EDA_DRAW_PANEL* m_canvas; EDA_DRAW_PANEL* m_canvas;
/// New type of area (GAL-based) to draw on.
EDA_DRAW_PANEL_GAL* m_galCanvas;
/// Tool ID of previously active draw tool bar button. /// Tool ID of previously active draw tool bar button.
int m_lastDrawToolId; int m_lastDrawToolId;
...@@ -979,20 +979,22 @@ public: ...@@ -979,20 +979,22 @@ public:
virtual void UseGalCanvas( bool aEnable ); virtual void UseGalCanvas( bool aEnable );
/** /**
* Function IsNewCanvasActive * Function IsGalCanvasActive
* is used to check which canvas (GAL-based or standard) is currently in use. * is used to check which canvas (GAL-based or standard) is currently in use.
* *
* @return True for GAL-based canvas, false for standard canvas. * @return True for GAL-based canvas, false for standard canvas.
*/ */
bool IsGalCanvasActive() { return m_galCanvasActive; } bool IsGalCanvasActive() const { return m_galCanvasActive; }
void SetGalCanvasActive( bool aState ) { m_galCanvasActive = aState; }
/** /**
* Function GetCalCanvas * Function GetGalCanvas
* returns a pointer to GAL-based canvas of given EDA draw frame. * returns a pointer to GAL-based canvas of given EDA draw frame.
* *
* @return Pointer to GAL-based canvas. * @return Pointer to GAL-based canvas.
*/ */
EDA_DRAW_PANEL_GAL* GetGalCanvas() { return m_galCanvas; } EDA_DRAW_PANEL_GAL* GetGalCanvas() const { return m_galCanvas; }
void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -152,10 +152,12 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType, ...@@ -152,10 +152,12 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
m_FastGrid1 = 0; m_FastGrid1 = 0;
m_FastGrid2 = 0; m_FastGrid2 = 0;
m_galCanvas = new EDA_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, SetGalCanvas( new EDA_DRAW_PANEL_GAL(
EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ); this, -1, wxPoint( 0, 0 ), m_FrameSize,
EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) );
// Hide by default, it has to be explicitly shown // Hide by default, it has to be explicitly shown
m_galCanvas->Hide(); GetGalCanvas()->Hide();
m_auxiliaryToolBar = NULL; m_auxiliaryToolBar = NULL;
} }
...@@ -166,7 +168,7 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME() ...@@ -166,7 +168,7 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME()
delete m_Collector; delete m_Collector;
delete m_Pcb; // is already NULL for FOOTPRINT_EDIT_FRAME delete m_Pcb; // is already NULL for FOOTPRINT_EDIT_FRAME
delete m_galCanvas; delete GetGalCanvas();
} }
...@@ -437,11 +439,11 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent ) ...@@ -437,11 +439,11 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
// Apply new display options to the GAL canvas // Apply new display options to the GAL canvas
KIGFX::PCB_PAINTER* painter = KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( m_galCanvas->GetView()->GetPainter() ); static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() ); static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt ); settings->LoadDisplayOptions( DisplayOpt );
m_galCanvas->GetView()->RecacheAllItems( true ); GetGalCanvas()->GetView()->RecacheAllItems( true );
m_canvas->Refresh(); m_canvas->Refresh();
} }
...@@ -764,7 +766,7 @@ void PCB_BASE_FRAME::LoadSettings() ...@@ -764,7 +766,7 @@ void PCB_BASE_FRAME::LoadSettings()
m_DisplayModText = FILLED; m_DisplayModText = FILLED;
// Apply display settings for GAL // Apply display settings for GAL
KIGFX::VIEW* view = m_galCanvas->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
// Set rendering order and properties of layers // Set rendering order and properties of layers
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i ) for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i )
......
...@@ -404,25 +404,27 @@ void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool is ...@@ -404,25 +404,27 @@ void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool is
myframe->GetCanvas()->Refresh(); myframe->GetCanvas()->Refresh();
} }
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor ) void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
{ {
myframe->GetBoard()->SetVisibleElementColor( aId, aColor ); myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
myframe->GetCanvas()->Refresh(); myframe->GetCanvas()->Refresh();
} }
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{ {
BOARD* brd = myframe->GetBoard(); BOARD* brd = myframe->GetBoard();
brd->SetElementVisibility( aId, isEnabled ); brd->SetElementVisibility( aId, isEnabled );
EDA_DRAW_PANEL_GAL *galCanvas = myframe->GetGalCanvas(); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas ) if( galCanvas )
{ {
KIGFX::VIEW* view = galCanvas->GetView(); KIGFX::VIEW* view = galCanvas->GetView();
view->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled ); view->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled );
} }
if( myframe->IsGalCanvasActive() ) if( galCanvas && myframe->IsGalCanvasActive() )
galCanvas->Refresh(); galCanvas->Refresh();
else else
myframe->GetCanvas()->Refresh(); myframe->GetCanvas()->Refresh();
......
...@@ -153,7 +153,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -153,7 +153,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
int id = event.GetId(); int id = event.GetId();
bool state = event.IsChecked(); bool state = event.IsChecked();
KIGFX::PCB_PAINTER* painter = KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( m_galCanvas->GetView()->GetPainter() ); static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() ); static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
bool recache = false; bool recache = false;
...@@ -259,9 +259,9 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -259,9 +259,9 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
// Apply new display options to the GAL canvas // Apply new display options to the GAL canvas
settings->LoadDisplayOptions( DisplayOpt ); settings->LoadDisplayOptions( DisplayOpt );
m_galCanvas->GetView()->RecacheAllItems( true ); GetGalCanvas()->GetView()->RecacheAllItems( true );
} }
if( IsGalCanvasActive() ) if( IsGalCanvasActive() )
m_galCanvas->Refresh(); GetGalCanvas()->Refresh();
} }
...@@ -335,14 +335,14 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, ...@@ -335,14 +335,14 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
SetBoard( new BOARD() ); SetBoard( new BOARD() );
if( m_galCanvas ) if( GetGalCanvas() )
{ {
ViewReloadBoard( m_Pcb ); ViewReloadBoard( m_Pcb );
// update the tool manager with the new board and its view. // update the tool manager with the new board and its view.
if( m_toolManager ) if( m_toolManager )
m_toolManager->SetEnvironment( m_Pcb, m_galCanvas->GetView(), m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
m_galCanvas->GetViewControls(), this ); GetGalCanvas()->GetViewControls(), this );
} }
// Create the PCB_LAYER_WIDGET *after* SetBoard(): // Create the PCB_LAYER_WIDGET *after* SetBoard():
...@@ -356,7 +356,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, ...@@ -356,7 +356,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
if( screenHeight <= 900 ) if( screenHeight <= 900 )
pointSize = (pointSize * 8) / 10; pointSize = (pointSize * 8) / 10;
m_Layers = new PCB_LAYER_WIDGET( this, m_galCanvas, pointSize ); m_Layers = new PCB_LAYER_WIDGET( this, GetGalCanvas(), pointSize );
m_drc = new DRC( this ); // these 2 objects point to each other m_drc = new DRC( this ); // these 2 objects point to each other
...@@ -454,8 +454,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, ...@@ -454,8 +454,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_auimgr.AddPane( m_canvas, m_auimgr.AddPane( m_canvas,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( m_galCanvas ) if( GetGalCanvas() )
m_auimgr.AddPane( (wxWindow*) m_galCanvas, m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() ); wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
if( m_messagePanel ) if( m_messagePanel )
...@@ -538,21 +538,21 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard ) ...@@ -538,21 +538,21 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
{ {
PCB_BASE_FRAME::SetBoard( aBoard ); PCB_BASE_FRAME::SetBoard( aBoard );
if( m_galCanvas ) if( GetGalCanvas() )
{ {
ViewReloadBoard( aBoard ); ViewReloadBoard( aBoard );
// update the tool manager with the new board and its view. // update the tool manager with the new board and its view.
if( m_toolManager ) if( m_toolManager )
m_toolManager->SetEnvironment( aBoard, m_galCanvas->GetView(), m_toolManager->SetEnvironment( aBoard, GetGalCanvas()->GetView(),
m_galCanvas->GetViewControls(), this ); GetGalCanvas()->GetViewControls(), this );
} }
} }
void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
{ {
KIGFX::VIEW* view = m_galCanvas->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->Clear(); view->Clear();
// All of PCB drawing elements should be added to the VIEW // All of PCB drawing elements should be added to the VIEW
...@@ -629,8 +629,8 @@ void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const ...@@ -629,8 +629,8 @@ void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
view->SetPanBoundary( worksheet->ViewBBox() ); view->SetPanBoundary( worksheet->ViewBBox() );
view->RecacheAllItems( true ); view->RecacheAllItems( true );
if( m_galCanvasActive ) if( IsGalCanvasActive() )
m_galCanvas->Refresh(); GetGalCanvas()->Refresh();
} }
...@@ -668,7 +668,7 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event ) ...@@ -668,7 +668,7 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
m_canvas->SetAbortRequest( true ); m_canvas->SetAbortRequest( true );
m_galCanvas->StopDrawing(); GetGalCanvas()->StopDrawing();
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
{ {
...@@ -750,8 +750,8 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable ) ...@@ -750,8 +750,8 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
{ {
EDA_DRAW_FRAME::UseGalCanvas( aEnable ); EDA_DRAW_FRAME::UseGalCanvas( aEnable );
m_toolManager->SetEnvironment( m_Pcb, m_galCanvas->GetView(), m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
m_galCanvas->GetViewControls(), this ); GetGalCanvas()->GetViewControls(), this );
ViewReloadBoard( m_Pcb ); ViewReloadBoard( m_Pcb );
} }
...@@ -768,12 +768,12 @@ void PCB_EDIT_FRAME::SwitchCanvas( wxCommandEvent& aEvent ) ...@@ -768,12 +768,12 @@ void PCB_EDIT_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
break; break;
case ID_MENU_CANVAS_CAIRO: case ID_MENU_CANVAS_CAIRO:
m_galCanvas->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
UseGalCanvas( true ); UseGalCanvas( true );
break; break;
case ID_MENU_CANVAS_OPENGL: case ID_MENU_CANVAS_OPENGL:
m_galCanvas->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ); GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
UseGalCanvas( true ); UseGalCanvas( true );
break; break;
} }
...@@ -902,7 +902,7 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void ) ...@@ -902,7 +902,7 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void )
void PCB_EDIT_FRAME::setHighContrastLayer( LAYER_NUM aLayer ) void PCB_EDIT_FRAME::setHighContrastLayer( LAYER_NUM aLayer )
{ {
// Set display settings for high contrast mode // Set display settings for high contrast mode
KIGFX::VIEW* view = m_galCanvas->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
KIGFX::RENDER_SETTINGS* rSettings = view->GetPainter()->GetSettings(); KIGFX::RENDER_SETTINGS* rSettings = view->GetPainter()->GetSettings();
setTopLayer( aLayer ); setTopLayer( aLayer );
...@@ -945,7 +945,7 @@ void PCB_EDIT_FRAME::setHighContrastLayer( LAYER_NUM aLayer ) ...@@ -945,7 +945,7 @@ void PCB_EDIT_FRAME::setHighContrastLayer( LAYER_NUM aLayer )
void PCB_EDIT_FRAME::setTopLayer( LAYER_NUM aLayer ) void PCB_EDIT_FRAME::setTopLayer( LAYER_NUM aLayer )
{ {
// Set display settings for high contrast mode // Set display settings for high contrast mode
KIGFX::VIEW* view = m_galCanvas->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->ClearTopLayers(); view->ClearTopLayers();
view->SetTopLayer( aLayer ); view->SetTopLayer( aLayer );
...@@ -993,8 +993,8 @@ void PCB_EDIT_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate ...@@ -993,8 +993,8 @@ void PCB_EDIT_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate
if( doLayerWidgetUpdate ) if( doLayerWidgetUpdate )
syncLayerWidgetLayer(); syncLayerWidgetLayer();
if( m_galCanvasActive ) if( IsGalCanvasActive() )
m_galCanvas->Refresh(); GetGalCanvas()->Refresh();
} }
...@@ -1015,7 +1015,7 @@ void PCB_EDIT_FRAME::syncLayerVisibilities() ...@@ -1015,7 +1015,7 @@ void PCB_EDIT_FRAME::syncLayerVisibilities()
{ {
m_Layers->SyncLayerVisibilities(); m_Layers->SyncLayerVisibilities();
KIGFX::VIEW* view = m_galCanvas->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
// Load layer & elements visibility settings // Load layer & elements visibility settings
for( LAYER_NUM i = 0; i < NB_LAYERS; ++i ) for( LAYER_NUM i = 0; i < NB_LAYERS; ++i )
{ {
......
...@@ -44,7 +44,7 @@ void PCB_EDIT_FRAME::setupTools() ...@@ -44,7 +44,7 @@ void PCB_EDIT_FRAME::setupTools()
// Create the manager and dispatcher & route draw panel events to the dispatcher // Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER; m_toolManager = new TOOL_MANAGER;
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, this ); m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, this );
m_galCanvas->SetEventDispatcher( m_toolDispatcher ); GetGalCanvas()->SetEventDispatcher( m_toolDispatcher );
// Register tool actions // Register tool actions
m_toolManager->RegisterAction( &COMMON_ACTIONS::moveActivate ); m_toolManager->RegisterAction( &COMMON_ACTIONS::moveActivate );
......
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