diff --git a/common/block_commande.cpp b/common/block_commande.cpp index 01cd53d661..48a012d559 100644 --- a/common/block_commande.cpp +++ b/common/block_commande.cpp @@ -228,11 +228,11 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo case BLOCK_MIRROR_X: case BLOCK_MIRROR_Y: /* mirror */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ - Block->InitData( DrawPanel, startpos ); + Block->InitData( m_canvas, startpos ); break; case BLOCK_PASTE: - Block->InitData( DrawPanel, startpos ); + Block->InitData( m_canvas, startpos ); Block->m_BlockLastCursorPosition.x = 0; Block->m_BlockLastCursorPosition.y = 0; InitBlockPasteInfos(); @@ -241,11 +241,11 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo { DisplayError( this, wxT( "No Block to paste" ), 20 ); GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; return true; } - if( !DrawPanel->IsMouseCaptured() ) + if( !m_canvas->IsMouseCaptured() ) { Block->m_ItemsSelection.ClearItemsList(); DisplayError( this, @@ -254,7 +254,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo } Block->m_State = STATE_BLOCK_MOVE; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, startpos, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, startpos, false ); break; default: diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index ea4eb62c9c..2a28c30390 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -25,9 +25,9 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event ) if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD ) { if( GetScreen()->IsBlockActive() ) - DrawPanel->SetCursor( wxCursor( DrawPanel->GetDefaultCursor() ) ); + m_canvas->SetCursor( wxCursor( m_canvas->GetDefaultCursor() ) ); - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); } } @@ -48,7 +48,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) int ClipboardSizeX, ClipboardSizeY; bool DrawBlock = false; wxRect DrawArea; - BASE_SCREEN* screen = aFrame->DrawPanel->GetScreen(); + BASE_SCREEN* screen = aFrame->GetCanvas()->GetScreen(); /* scale is the ratio resolution/internal units */ float scale = 82.0 / aFrame->GetInternalUnits(); @@ -73,7 +73,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) wxMetafileDC dc; - EDA_RECT tmp = aFrame->DrawPanel->m_ClipBox; + EDA_RECT tmp = aFrame->GetCanvas()->m_ClipBox; GRResetPenAndBrush( &dc ); const bool plotBlackAndWhite = false; GRForceBlackPen( plotBlackAndWhite ); @@ -81,10 +81,10 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) dc.SetUserScale( scale, scale ); ClipboardSizeX = dc.MaxX() + 10; ClipboardSizeY = dc.MaxY() + 10; - aFrame->DrawPanel->m_ClipBox.SetX( 0 ); - aFrame->DrawPanel->m_ClipBox.SetY( 0 ); - aFrame->DrawPanel->m_ClipBox.SetWidth( 0x7FFFFF0 ); - aFrame->DrawPanel->m_ClipBox.SetHeight( 0x7FFFFF0 ); + aFrame->GetCanvas()->m_ClipBox.SetX( 0 ); + aFrame->GetCanvas()->m_ClipBox.SetY( 0 ); + aFrame->GetCanvas()->m_ClipBox.SetWidth( 0x7FFFFF0 ); + aFrame->GetCanvas()->m_ClipBox.SetHeight( 0x7FFFFF0 ); if( DrawBlock ) { @@ -94,7 +94,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) const int maskLayer = 0xFFFFFFFF; aFrame->PrintPage( &dc, maskLayer, false ); screen->m_IsPrinting = false; - aFrame->DrawPanel->m_ClipBox = tmp; + aFrame->GetCanvas()->m_ClipBox = tmp; wxMetafile* mf = dc.Close(); if( mf ) diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 62acefc5bc..7ebc275b81 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -37,8 +37,8 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event ) DIALOG_PAGES_SETTINGS frame( this ); int diag = frame.ShowModal(); - if( DrawPanel && diag ) - DrawPanel->Refresh(); + if( m_canvas && diag ) + m_canvas->Refresh(); } @@ -261,7 +261,7 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) #endif m_Screen->SetModify(); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } diff --git a/common/drawframe.cpp b/common/drawframe.cpp index fc71d3c5fd..a92b9c12cc 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -94,7 +94,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti m_zoomSelectBox = NULL; m_HotkeysZoomAndGridList = NULL; - DrawPanel = NULL; + m_canvas = NULL; m_messagePanel = NULL; m_currentScreen = NULL; m_toolId = ID_NO_TOOL_SELECTED; @@ -142,7 +142,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti m_FramePos.x = m_FramePos.y = 0; m_FrameSize.y -= m_MsgFrameHeight; - DrawPanel = new EDA_DRAW_PANEL( this, -1, wxPoint( 0, 0 ), m_FrameSize ); + m_canvas = new EDA_DRAW_PANEL( this, -1, wxPoint( 0, 0 ), m_FrameSize ); m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ), wxSize( m_FrameSize.x, m_MsgFrameHeight ) ); @@ -182,8 +182,8 @@ void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event ) { m_FrameIsActive = event.GetActive(); - if( DrawPanel ) - DrawPanel->m_CanStartBlock = -1; + if( m_canvas ) + m_canvas->m_CanStartBlock = -1; event.Skip(); // required under wxMAC } @@ -191,8 +191,8 @@ void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event ) void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event ) { - if( DrawPanel ) - DrawPanel->m_CanStartBlock = -1; + if( m_canvas ) + m_canvas->m_CanStartBlock = -1; event.Skip(); } @@ -201,7 +201,7 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event ) void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent ) { SetGridVisibility( !IsGridVisible() ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -222,10 +222,10 @@ void EDA_DRAW_FRAME::OnSelectUnits( wxCommandEvent& aEvent ) void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent ) { - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); - DrawPanel->CrossHairOff( &dc ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); + m_canvas->CrossHairOff( &dc ); m_cursorShape = !m_cursorShape; - DrawPanel->CrossHairOn( &dc ); + m_canvas->CrossHairOn( &dc ); } @@ -445,9 +445,9 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg ) // Keep default cursor in toolbars SetCursor( wxNullCursor ); - // Change DrawPanel cursor if requested. - if( DrawPanel && aCursor >= 0 ) - DrawPanel->SetCurrentCursor( aCursor ); + // Change m_canvas cursor if requested. + if( m_canvas && aCursor >= 0 ) + m_canvas->SetCurrentCursor( aCursor ); DisplayToolMsg( aToolMsg ); @@ -486,7 +486,7 @@ int EDA_DRAW_FRAME::ReturnBlockCommand( int key ) void EDA_DRAW_FRAME::InitBlockPasteInfos() { GetScreen()->m_BlockLocate.ClearItemsList(); - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; } @@ -508,7 +508,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) BASE_SCREEN* screen = GetScreen(); bool noRefresh = true; - if( screen == NULL || DrawPanel == NULL ) + if( screen == NULL || m_canvas == NULL ) return; double scalar = screen->GetScalingFactor(); @@ -518,7 +518,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) // Calculate the portion of the drawing that can be displayed in the // client area at the current zoom level. - clientSize = DrawPanel->GetClientSize(); + clientSize = m_canvas->GetClientSize(); // The logical size of the client window. logicalClientSize.x = wxRound( (double) clientSize.x / scalar ); @@ -694,12 +694,12 @@ SetScrollbars(%d, %d, %d, %d, %d, %d)" ), screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y, screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y ); - DrawPanel->SetScrollbars( screen->m_ScrollPixelsPerUnitX, - screen->m_ScrollPixelsPerUnitY, - screen->m_ScrollbarNumber.x, - screen->m_ScrollbarNumber.y, - screen->m_ScrollbarPos.x, - screen->m_ScrollbarPos.y, noRefresh ); + m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX, + screen->m_ScrollPixelsPerUnitY, + screen->m_ScrollbarNumber.x, + screen->m_ScrollbarNumber.y, + screen->m_ScrollbarPos.x, + screen->m_ScrollbarPos.y, noRefresh ); } diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 03a03f6244..46c34a8ef8 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -204,7 +204,7 @@ static int overbar_position( int size_v, int thickness ) /** * Function DrawGraphicText * Draw a graphic text (like module texts) - * @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas + * @param aPanel = the current m_canvas. NULL if draw within a 3D GL Canvas * @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas * @param aPos = text position (according to h_justify, v_justify) * @param aColor (enum EDA_Colors) = text color diff --git a/common/sch_item_struct.cpp b/common/sch_item_struct.cpp index e39b4f9bad..e6cff77782 100644 --- a/common/sch_item_struct.cpp +++ b/common/sch_item_struct.cpp @@ -100,13 +100,13 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC ) m_Flags = 0; screen->SetModify(); screen->SetCurItem( NULL ); - aFrame->DrawPanel->SetMouseCapture( NULL, NULL ); - aFrame->DrawPanel->EndMouseCapture(); + aFrame->GetCanvas()->SetMouseCapture( NULL, NULL ); + aFrame->GetCanvas()->EndMouseCapture(); if( aDC ) { - EDA_CROSS_HAIR_MANAGER( aFrame->DrawPanel, aDC ); // Erase schematic cursor - Draw( aFrame->DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + EDA_CROSS_HAIR_MANAGER( aFrame->GetCanvas(), aDC ); // Erase schematic cursor + Draw( aFrame->GetCanvas(), aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); } } diff --git a/common/worksheet.cpp b/common/worksheet.cpp index f37ab1ba5f..9ea4736678 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -1028,7 +1028,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( !screen->m_IsPrinting & g_ShowPageLimits ) { GRSetDrawMode( DC, GR_COPY ); - GRRect( &DrawPanel->m_ClipBox, DC, 0, 0, + GRRect( &m_canvas->m_ClipBox, DC, 0, 0, Sheet->m_Size.x * scale, Sheet->m_Size.y * scale, width, g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY ); } @@ -1041,13 +1041,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */ #if defined(KICAD_GOST) - GRRect( &DrawPanel->m_ClipBox, DC, refx * scale, refy * scale, + GRRect( &m_canvas->m_ClipBox, DC, refx * scale, refy * scale, xg * scale, yg * scale, width, Color ); #else for( ii = 0; ii < 2; ii++ ) { - GRRect( &DrawPanel->m_ClipBox, DC, refx * scale, refy * scale, + GRRect( &m_canvas->m_ClipBox, DC, refx * scale, refy * scale, xg * scale, yg * scale, width, Color ); refx += GRID_REF_W; refy += GRID_REF_W; @@ -1073,7 +1073,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid case WS_PODPIS_LU: if( WsItem->m_Legende ) msg = WsItem->m_Legende; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_VERT, size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width, false, false ); @@ -1082,7 +1082,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid case WS_SEGMENT_LU: xg = Sheet->m_LeftMargin - WsItem->m_Endx; yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy; - GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y, + GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } @@ -1099,7 +1099,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid case WS_SEGMENT_LT: xg = Sheet->m_LeftMargin + WsItem->m_Endx; yg = Sheet->m_BottomMargin + WsItem->m_Endy; - GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y, + GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } @@ -1117,10 +1117,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid Line.Printf( wxT( "%d" ), jj ); if( ii < xg - PAS_REF / 2 ) { - GRLine( &DrawPanel->m_ClipBox, DC, ii * scale, refy * scale, + GRLine( &m_canvas->m_ClipBox, DC, ii * scale, refy * scale, ii * scale, ( refy + GRID_REF_W ) * scale, width, Color ); } - DrawGraphicText( DrawPanel, DC, + DrawGraphicText( m_canvas, DC, wxPoint( ( ii - gxpas / 2 ) * scale, ( refy + GRID_REF_W / 2 ) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, @@ -1128,10 +1128,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid width, false, false ); if( ii < xg - PAS_REF / 2 ) { - GRLine( &DrawPanel->m_ClipBox, DC, ii * scale, yg * scale, + GRLine( &m_canvas->m_ClipBox, DC, ii * scale, yg * scale, ii * scale, ( yg - GRID_REF_W ) * scale, width, Color ); } - DrawGraphicText( DrawPanel, DC, + DrawGraphicText( m_canvas, DC, wxPoint( ( ii - gxpas / 2 ) * scale, ( yg - GRID_REF_W / 2) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, @@ -1149,10 +1149,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid Line.Printf( wxT( "%c" ), 'a' + jj - 26 ); if( ii < yg - PAS_REF / 2 ) { - GRLine( &DrawPanel->m_ClipBox, DC, refx * scale, ii * scale, + GRLine( &m_canvas->m_ClipBox, DC, refx * scale, ii * scale, ( refx + GRID_REF_W ) * scale, ii * scale, width, Color ); } - DrawGraphicText( DrawPanel, DC, + DrawGraphicText( m_canvas, DC, wxPoint( ( refx + GRID_REF_W / 2 ) * scale, ( ii - gypas / 2 ) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, @@ -1160,10 +1160,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid width, false, false ); if( ii < yg - PAS_REF / 2 ) { - GRLine( &DrawPanel->m_ClipBox, DC, xg * scale, ii * scale, + GRLine( &m_canvas->m_ClipBox, DC, xg * scale, ii * scale, ( xg - GRID_REF_W ) * scale, ii * scale, width, Color ); } - DrawGraphicText( DrawPanel, DC, + DrawGraphicText( m_canvas, DC, wxPoint( ( xg - GRID_REF_W / 2 ) * scale, ( ii - gxpas / 2 ) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, @@ -1197,7 +1197,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid case WS_PODPIS: if( WsItem->m_Legende ) msg = WsItem->m_Legende; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1211,7 +1211,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = WsItem->m_Legende; if( screen->m_NumberOfScreen > 1 ) msg << screen->m_ScreenNumber; - DrawGraphicText( DrawPanel, DC, pos, Color, msg, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; @@ -1220,7 +1220,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << screen->m_NumberOfScreen; - DrawGraphicText( DrawPanel, DC, pos, Color, msg, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; @@ -1229,7 +1229,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = screen->m_Company; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size1_5, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, @@ -1241,7 +1241,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = screen->m_Title; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size1_5, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, @@ -1253,14 +1253,14 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = screen->m_Commentaire1; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size3, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); pos.x = (Sheet->m_LeftMargin + 1260) * scale; pos.y = (Sheet->m_TopMargin + 270) * scale; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, 1800, size2, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, @@ -1272,7 +1272,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = screen->m_Commentaire2; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1283,7 +1283,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = screen->m_Commentaire3; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1294,7 +1294,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = screen->m_Commentaire4; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1312,7 +1312,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid Sheet->m_RightMargin - WsItem->m_Endx; yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy; - GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y, + GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } @@ -1332,14 +1332,14 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = screen->m_Commentaire1; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size3, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); pos.x = (Sheet->m_LeftMargin + 1260) * scale; pos.y = (Sheet->m_TopMargin + 270) * scale; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, 1800, size2, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, @@ -1350,7 +1350,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid case WS_PODPIS_D: if( WsItem->m_Legende ) msg = WsItem->m_Legende; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, @@ -1361,7 +1361,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << screen->m_ScreenNumber; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1375,7 +1375,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid Sheet->m_RightMargin - WsItem->m_Endx; yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy; - GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y, + GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } @@ -1397,7 +1397,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += screen->m_Date; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true ); @@ -1407,7 +1407,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += screen->m_Revision; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), @@ -1419,7 +1419,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = WsItem->m_Legende; msg += g_ProductName + wxGetApp().GetAppName(); msg += wxT( " " ) + GetBuildVersion(); - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1429,7 +1429,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += Sheet->m_Name; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1440,7 +1440,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << screen->m_ScreenNumber << wxT( "/" ) << screen->m_NumberOfScreen; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1455,7 +1455,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg = WsItem->m_Legende; msg << fname << wxT( "." ) << fext; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1466,7 +1466,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetScreenDesc(); - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1479,7 +1479,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg += screen->m_Company; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), @@ -1492,7 +1492,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += screen->m_Title; - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), @@ -1505,7 +1505,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg += screen->m_Commentaire1; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1519,7 +1519,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg += screen->m_Commentaire2; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1533,7 +1533,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg += screen->m_Commentaire3; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1547,7 +1547,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid msg += screen->m_Commentaire4; if( !msg.IsEmpty() ) { - DrawGraphicText( DrawPanel, DC, pos, Color, + DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); @@ -1570,7 +1570,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid GRID_REF_W - Sheet->m_RightMargin - WsItem->m_Endx; yg = Sheet->m_Size.y - GRID_REF_W - Sheet->m_BottomMargin - WsItem->m_Endy; - GRLine( &DrawPanel->m_ClipBox, DC, pos.x, pos.y, + GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } diff --git a/common/zoom.cpp b/common/zoom.cpp index 3938a8a736..12d1a4006e 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -22,10 +22,10 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe // Move the mouse cursor to the on grid graphic cursor position if( aWarpPointer ) - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); - DrawPanel->Refresh(); - DrawPanel->Update(); + m_canvas->Refresh(); + m_canvas->Update(); } @@ -55,7 +55,7 @@ void EDA_DRAW_FRAME::Window_Zoom( EDA_RECT& Rect ) /* Compute the best zoom */ Rect.Normalize(); - size = DrawPanel->GetClientSize(); + size = m_canvas->GetClientSize(); // Use ceil to at least show the full rect scalex = (double) Rect.GetSize().x / size.x; @@ -73,7 +73,7 @@ void EDA_DRAW_FRAME::Window_Zoom( EDA_RECT& Rect ) */ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) { - if( DrawPanel == NULL ) + if( m_canvas == NULL ) return; int i; @@ -105,7 +105,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) break; case ID_ZOOM_REDRAW: - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_POPUP_ZOOM_CENTER: @@ -121,7 +121,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) break; case ID_POPUP_CANCEL: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; default: @@ -149,7 +149,7 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu ) int maxZoomIds; int zoom; wxString msg; - BASE_SCREEN * screen = DrawPanel->GetScreen(); + BASE_SCREEN * screen = m_canvas->GetScreen(); msg = AddHotkeyName( _( "Center" ), m_HotkeysZoomAndGridList, HK_ZOOM_CENTER ); AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) ); diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 459650f36c..63d77aee33 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -128,7 +128,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() ); - m_auimgr.AddPane( DrawPanel, + m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() ); m_auimgr.AddPane( m_messagePanel, @@ -313,7 +313,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) if( m_DisplayModText > 2 ) m_DisplayModText = 0; - DrawPanel->Refresh( ); + m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: @@ -322,7 +322,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) if( m_DisplayModEdge > 2 ) m_DisplayModEdge = 0; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; default: @@ -381,25 +381,25 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi case WXK_NUMPAD8: /* cursor moved up */ case WXK_UP: pos.y -= wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD2: /* cursor moved down */ case WXK_DOWN: pos.y += wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD4: /* cursor moved left */ case WXK_LEFT: pos.x -= wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD6: /* cursor moved right */ case WXK_RIGHT: pos.x += wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; } @@ -409,13 +409,13 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi { pos = screen->GetCrossHairPosition(); screen->SetCrossHairPosition( oldpos ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); screen->SetCrossHairPosition( pos ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, 0 ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, 0 ); } } diff --git a/cvpcb/dialogs/dialog_display_options.cpp b/cvpcb/dialogs/dialog_display_options.cpp index a425efd361..438927ae5e 100644 --- a/cvpcb/dialogs/dialog_display_options.cpp +++ b/cvpcb/dialogs/dialog_display_options.cpp @@ -68,7 +68,7 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index ae7d7d28e3..40a79aa167 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -83,7 +83,8 @@ void CVPCB_MAINFRAME::CreateScreenCmp() m_DisplayFootprintFrame->GetBoard()->m_Modules.PushBack( mod ); m_DisplayFootprintFrame->Zoom_Automatique( false ); - m_DisplayFootprintFrame->DrawPanel->Refresh(); + m_DisplayFootprintFrame->GetCanvas()->Refresh(); + // Display new cursor coordinates and zoom value: m_DisplayFootprintFrame->UpdateStatusBar(); @@ -115,15 +116,15 @@ void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) if( !GetBoard() ) return; - DrawPanel->DrawBackGround( DC ); - GetBoard()->Draw( DrawPanel, DC, GR_COPY ); + m_canvas->DrawBackGround( DC ); + GetBoard()->Draw( m_canvas, DC, GR_COPY ); MODULE* Module = GetBoard()->m_Modules; if ( Module ) Module->DisplayInfo( this ); - DrawPanel->DrawCrossHair( DC ); + m_canvas->DrawCrossHair( DC ); } diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index 6bb9d7d4ff..f0a2a1d9fe 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -148,7 +148,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, m_CurrentSheet->UpdateAllScreenReferences(); SetSheetNumberAndCount(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 3c01f567c9..0b7f5f42ff 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -105,7 +105,7 @@ void SCH_EDIT_FRAME::InitBlockPasteInfos() BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; block->m_ItemsSelection.CopyList( m_blockItems.m_ItemsSelection ); - DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; } @@ -113,7 +113,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) { BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; - if( !DrawPanel->IsMouseCaptured() ) + if( !m_canvas->IsMouseCaptured() ) { DisplayError( this, wxT( "HandleBlockPLace() : m_mouseCaptureCallback = NULL" ) ); } @@ -138,8 +138,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_MIRROR_Y: case BLOCK_DRAG: /* Drag */ case BLOCK_MOVE: /* Move */ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector ); MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector ); @@ -148,8 +148,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_COPY: /* Copy */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector ); @@ -160,8 +160,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) break; case BLOCK_PASTE: - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); PasteListOfItems( DC ); block->ClearItemsList(); @@ -182,7 +182,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) GetScreen()->ClearDrawingState(); GetScreen()->ClearBlockCommand(); GetScreen()->SetCurItem( NULL ); - GetScreen()->TestDanglingEnds( DrawPanel, DC ); + GetScreen()->TestDanglingEnds( m_canvas, DC ); if( block->GetCount() ) { @@ -190,8 +190,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) block->ClearItemsList(); } - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, false ); - DrawPanel->Refresh(); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); + m_canvas->Refresh(); } @@ -206,19 +206,19 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) BlockState state = block->m_State; CmdBlockType command = block->m_Command; - if( DrawPanel->m_endMouseCaptureCallback ) - DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC ); + if( m_canvas->m_endMouseCaptureCallback ) + m_canvas->m_endMouseCaptureCallback( m_canvas, DC ); block->m_State = state; block->m_Command = command; - DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); + m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); GetScreen()->SetCrossHairPosition( block->GetEnd() ); if( block->m_Command != BLOCK_ABORT ) - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { switch( block->m_Command ) { @@ -243,36 +243,36 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) { nextcmd = true; GetScreen()->SelectBlockItems(); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); - DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); block->m_State = STATE_BLOCK_MOVE; } else { - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->SetMouseCapture( NULL, NULL ); } break; case BLOCK_DELETE: /* Delete */ GetScreen()->UpdatePickList(); - DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false ); + DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false ); if( block->GetCount() ) { - DeleteItemsInList( DrawPanel, block->m_ItemsSelection ); + DeleteItemsInList( m_canvas, block->m_ItemsSelection ); OnModify(); } block->ClearItemsList(); - GetScreen()->TestDanglingEnds( DrawPanel, DC ); - DrawPanel->Refresh(); + GetScreen()->TestDanglingEnds( m_canvas, DC ); + m_canvas->Refresh(); break; case BLOCK_SAVE: /* Save */ GetScreen()->UpdatePickList(); - DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false ); + DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -304,7 +304,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) if( block->m_Command == BLOCK_ABORT ) { GetScreen()->ClearDrawingState(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } if( ! nextcmd ) @@ -313,7 +313,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) block->m_State = STATE_NO_BLOCK; block->m_Command = BLOCK_IDLE; GetScreen()->SetCurItem( NULL ); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); } @@ -351,8 +351,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) break; case BLOCK_DRAG: /* move to Drag */ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); // Clear list of items to move, and rebuild it with items to drag: block->ClearItemsList(); @@ -365,30 +365,30 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) blockCmdFinished = false; GetScreen()->SelectBlockItems(); - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); block->m_State = STATE_BLOCK_MOVE; } break; case BLOCK_DELETE: /* move to Delete */ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); if( block->GetCount() ) { - DeleteItemsInList( DrawPanel, block->m_ItemsSelection ); + DeleteItemsInList( m_canvas, block->m_ItemsSelection ); OnModify(); } - GetScreen()->TestDanglingEnds( DrawPanel, DC ); - DrawPanel->Refresh(); + GetScreen()->TestDanglingEnds( m_canvas, DC ); + m_canvas->Refresh(); break; case BLOCK_SAVE: /* Save list in paste buffer*/ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -399,15 +399,15 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) break; case BLOCK_ZOOM: /* Window Zoom */ - DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC ); - DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() ); + m_canvas->m_endMouseCaptureCallback( m_canvas, DC ); + m_canvas->SetCursor( m_canvas->GetDefaultCursor() ); Window_Zoom( GetScreen()->m_BlockLocate ); break; case BLOCK_ROTATE: - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -420,13 +420,13 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) OnModify(); } - GetScreen()->TestDanglingEnds( DrawPanel, DC ); - DrawPanel->Refresh(); + GetScreen()->TestDanglingEnds( m_canvas, DC ); + m_canvas->Refresh(); break; case BLOCK_MIRROR_X: - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -438,13 +438,13 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) Mirror_X_ListOfItems( block->m_ItemsSelection, mirrorPoint ); OnModify(); } - GetScreen()->TestDanglingEnds( DrawPanel, DC ); - DrawPanel->Refresh(); + GetScreen()->TestDanglingEnds( m_canvas, DC ); + m_canvas->Refresh(); break; case BLOCK_MIRROR_Y: - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -457,8 +457,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) OnModify(); } - GetScreen()->TestDanglingEnds( DrawPanel, DC ); - DrawPanel->Refresh(); + GetScreen()->TestDanglingEnds( m_canvas, DC ); + m_canvas->Refresh(); break; default: @@ -469,7 +469,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) { block->Clear(); GetScreen()->SetCurItem( NULL ); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); } } @@ -559,7 +559,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC ) } SetSchItemParent( Struct, GetScreen() ); - Struct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + Struct->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); Struct->SetNext( GetScreen()->GetDrawItems() ); GetScreen()->SetDrawItems( Struct ); } diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index 7246f89a22..35cc237d0f 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -92,13 +92,13 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) { BlockState state = GetScreen()->m_BlockLocate.m_State; CmdBlockType command = GetScreen()->m_BlockLocate.m_Command; - DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC ); + m_canvas->m_endMouseCaptureCallback( m_canvas, DC ); GetScreen()->m_BlockLocate.m_State = state; GetScreen()->m_BlockLocate.m_Command = command; - DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); + m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(), GetScreen()->m_BlockLocate.GetBottom() ) ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } switch( GetScreen()->m_BlockLocate.m_Command ) @@ -118,21 +118,21 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) { nextCmd = true; - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); - DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } break; case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ nextCmd = true; - DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; break; @@ -205,9 +205,9 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->SetCurItem( NULL ); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, - false ); - DrawPanel->Refresh( true ); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, + false ); + m_canvas->Refresh( true ); } return nextCmd; @@ -218,7 +218,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) { wxPoint pt; - if( !DrawPanel->IsMouseCaptured() ) + if( !m_canvas->IsMouseCaptured() ) { DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) ); } @@ -244,7 +244,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) if ( m_component ) m_component->MoveSelectedItems( pt ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); break; case BLOCK_COPY: /* Copy */ @@ -302,8 +302,8 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->SetCurItem( NULL ); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, false ); - DrawPanel->Refresh( true ); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); + m_canvas->Refresh( true ); } diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 9c062e6771..8ec0692152 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -129,7 +129,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) { s_ConnexionStartPoint = cursorpos; s_OldWiresList = GetScreen()->ExtractWires( true ); - GetScreen()->SchematicCleanUp( DrawPanel ); + GetScreen()->SchematicCleanUp( m_canvas ); switch( type ) { @@ -160,7 +160,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) } GetScreen()->SetCurItem( newsegment ); - DrawPanel->SetMouseCapture( DrawSegment, AbortCreateNewLine ); + m_canvas->SetMouseCapture( DrawSegment, AbortCreateNewLine ); m_itemToRepeat = NULL; } else // A segment is in progress: terminates the current segment and add a new segment. @@ -181,7 +181,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) return; } - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); /* Creates the new segment, or terminates the command * if the end point is on a pin, junction or an other wire or bus */ @@ -193,9 +193,9 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) oldsegment->SetNext( GetScreen()->GetDrawItems() ); GetScreen()->SetDrawItems( oldsegment ); - DrawPanel->CrossHairOff( DC ); // Erase schematic cursor - oldsegment->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - DrawPanel->CrossHairOn( DC ); // Display schematic cursor + m_canvas->CrossHairOff( DC ); // Erase schematic cursor + oldsegment->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + m_canvas->CrossHairOn( DC ); // Display schematic cursor /* Create a new segment, and chain it after the current new segment */ if( nextsegment ) @@ -218,7 +218,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) oldsegment->SetFlags( SELECTED ); newsegment->SetFlags( IS_NEW ); GetScreen()->SetCurItem( newsegment ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); /* This is the first segment: Now we know the start segment position. * Create a junction if needed. Note: a junction can be needed later, @@ -282,7 +282,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) GetScreen()->SetDrawItems( lastsegment ); } - DrawPanel->EndMouseCapture( -1, -1, wxEmptyString, false ); + m_canvas->EndMouseCapture( -1, -1, wxEmptyString, false ); GetScreen()->SetCurItem( NULL ); wxPoint end_point, alt_end_point; @@ -298,7 +298,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) alt_end_point = lastsegment->GetStartPoint(); } - GetScreen()->SchematicCleanUp( DrawPanel ); + GetScreen()->SchematicCleanUp( m_canvas ); /* clear flags and find last segment entered, for repeat function */ segment = (SCH_LINE*) GetScreen()->GetDrawItems(); @@ -329,10 +329,10 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) if( GetScreen()->IsJunctionNeeded( s_ConnexionStartPoint ) ) AddJunction( DC, s_ConnexionStartPoint ); - GetScreen()->TestDanglingEnds( DrawPanel, DC ); + GetScreen()->TestDanglingEnds( m_canvas, DC ); /* Redraw wires and junctions which can be changed by TestDanglingEnds() */ - DrawPanel->CrossHairOff( DC ); // Erase schematic cursor + m_canvas->CrossHairOff( DC ); // Erase schematic cursor EDA_ITEM* item = GetScreen()->GetDrawItems(); while( item ) @@ -341,7 +341,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) { case SCH_JUNCTION_T: case SCH_LINE_T: - DrawPanel->RefreshDrawingRect( item->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( item->GetBoundingBox() ); break; default: @@ -351,7 +351,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) item = item->Next(); } - DrawPanel->CrossHairOn( DC ); // Display schematic cursor + m_canvas->CrossHairOn( DC ); // Display schematic cursor SaveCopyInUndoList( s_OldWiresList, UR_WIRE_IMAGE ); s_OldWiresList = NULL; @@ -436,15 +436,15 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) } polyLine->SetPoint( idx, endpos ); - polyLine->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); + polyLine->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode ); } else { - DrawSegment( DrawPanel, DC, wxDefaultPosition, false ); + DrawSegment( m_canvas, DC, wxDefaultPosition, false ); } screen->RemoveFromDrawList( screen->GetCurItem() ); - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; screen->SetCurItem( NULL ); } @@ -456,9 +456,9 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition, m_itemToRepeat = junction; - DrawPanel->CrossHairOff( aDC ); // Erase schematic cursor - junction->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - DrawPanel->CrossHairOn( aDC ); // Display schematic cursor + m_canvas->CrossHairOff( aDC ); // Erase schematic cursor + junction->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + m_canvas->CrossHairOn( aDC ); // Display schematic cursor junction->SetNext( GetScreen()->GetDrawItems() ); GetScreen()->SetDrawItems( junction ); @@ -478,9 +478,9 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPositio NewNoConnect = new SCH_NO_CONNECT( aPosition ); m_itemToRepeat = NewNoConnect; - DrawPanel->CrossHairOff( aDC ); // Erase schematic cursor - NewNoConnect->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - DrawPanel->CrossHairOn( aDC ); // Display schematic cursor + m_canvas->CrossHairOff( aDC ); // Erase schematic cursor + NewNoConnect->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + m_canvas->CrossHairOn( aDC ); // Display schematic cursor NewNoConnect->SetNext( GetScreen()->GetDrawItems() ); GetScreen()->SetDrawItems( NewNoConnect ); @@ -528,7 +528,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) m_itemToRepeat->SetFlags( IS_NEW ); ( (SCH_COMPONENT*) m_itemToRepeat )->SetTimeStamp( GetNewTimeStamp() ); m_itemToRepeat->Move( pos ); - m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); + m_itemToRepeat->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode ); MoveItem( m_itemToRepeat, DC ); return; } @@ -543,7 +543,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) m_itemToRepeat->SetNext( GetScreen()->GetDrawItems() ); GetScreen()->SetDrawItems( m_itemToRepeat ); GetScreen()->TestDanglingEnds(); - m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + m_itemToRepeat->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); SaveCopyInUndoList( m_itemToRepeat, UR_NEW ); m_itemToRepeat->ClearFlags(); } diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index 4642578ea7..9cf60b3304 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -74,10 +74,10 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int en s_LastShape = entry_shape == '/' ? '/' : '\\'; - BusEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); + BusEntry->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode ); BusEntry->SetBusEntryShape( s_LastShape ); GetScreen()->TestDanglingEnds(); - BusEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); + BusEntry->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode ); OnModify( ); } diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 584bd4b071..e1e77748b0 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -62,9 +62,9 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC // If the user aborted the clarification context menu, don't show it again at the // off grid position. - if( !item && DrawPanel->m_AbortRequest ) + if( !item && m_canvas->m_AbortRequest ) { - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; return NULL; } @@ -73,7 +73,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC if( !item ) { - DrawPanel->m_AbortRequest = false; // Just in case the user aborted the context menu. + m_canvas->m_AbortRequest = false; // Just in case the user aborted the context menu. return NULL; } @@ -171,9 +171,9 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF // Set to NULL in case user aborts the clarification context menu. GetScreen()->SetCurItem( NULL ); - DrawPanel->m_AbortRequest = true; // Changed to false if an item is selected + m_canvas->m_AbortRequest = true; // Changed to false if an item is selected PopupMenu( &selectMenu ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); item = GetScreen()->GetCurItem(); } } @@ -208,25 +208,25 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH case WXK_NUMPAD8: case WXK_UP: pos.y -= wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD2: case WXK_DOWN: pos.y += wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD4: case WXK_LEFT: pos.x -= wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD6: case WXK_RIGHT: pos.x += wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; default: @@ -240,23 +240,23 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH { pos = screen->GetCrossHairPosition(); screen->SetCrossHairPosition( oldpos ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); screen->SetCrossHairPosition( pos ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { #ifdef USE_WX_OVERLAY - wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); + wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC ); oDC.Clear(); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false ); #else - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); #endif } #ifdef USE_WX_OVERLAY else - DrawPanel->m_overlay.Reset(); + m_canvas->m_overlay.Reset(); #endif } @@ -291,25 +291,25 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH case WXK_NUMPAD8: case WXK_UP: pos.y -= wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD2: case WXK_DOWN: pos.y += wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD4: case WXK_LEFT: pos.x -= wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD6: case WXK_RIGHT: pos.x += wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; default: @@ -323,23 +323,23 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH { pos = screen->GetCrossHairPosition(); screen->SetCrossHairPosition( oldpos ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); screen->SetCrossHairPosition( pos ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { #ifdef USE_WX_OVERLAY - wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); + wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC ); oDC.Clear(); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false ); #else - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); #endif } #ifdef USE_WX_OVERLAY else - DrawPanel->m_overlay.Reset(); + m_canvas->m_overlay.Reset(); #endif } @@ -371,25 +371,25 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH case WXK_NUMPAD8: case WXK_UP: pos.y -= wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD2: case WXK_DOWN: pos.y += wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD4: case WXK_LEFT: pos.x -= wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD6: case WXK_RIGHT: pos.x += wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; default: @@ -403,13 +403,13 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH { pos = screen->GetCrossHairPosition(); screen->SetCrossHairPosition( oldpos ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); screen->SetCrossHairPosition( pos ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); } } diff --git a/eeschema/dialogs/annotate_dialog.cpp b/eeschema/dialogs/annotate_dialog.cpp index 0d2c481717..e64d06d85f 100644 --- a/eeschema/dialogs/annotate_dialog.cpp +++ b/eeschema/dialogs/annotate_dialog.cpp @@ -118,6 +118,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) message = _( "Clear and annotate all of the components " ); else message = _( "Annotate only the unannotated components " ); + if( GetLevel() ) message += _( "on the entire schematic?" ); else @@ -125,13 +126,14 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) message += _( "\n\nThis operation will change the current annotation and cannot be undone." ); response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL ); + if (response == wxCANCEL) return; m_Parent->AnnotateComponents( GetLevel(), (ANNOTATE_ORDER_T) GetSortOrder(), (ANNOTATE_OPTION_T) GetAnnotateAlgo(), GetResetItems() , true ); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); m_btnClear->Enable(); } @@ -150,12 +152,13 @@ void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event ) message += _( "the current sheet?" ); message += _( "\n\nThis operation will clear the existing annotation and cannot be undone." ); - response = wxMessageBox( message, wxT( "" ), - wxICON_EXCLAMATION | wxOK | wxCANCEL ); + response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL ); + if (response == wxCANCEL) return; + m_Parent->DeleteAnnotation( GetLevel() ? false : true ); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); m_btnClear->Enable(false); } diff --git a/eeschema/dialogs/dialog_SVG_print.cpp b/eeschema/dialogs/dialog_SVG_print.cpp index d9269f0748..d1d3def2d6 100644 --- a/eeschema/dialogs/dialog_SVG_print.cpp +++ b/eeschema/dialogs/dialog_SVG_print.cpp @@ -212,7 +212,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, SheetSize = screen->ReturnPageSize(); // page size in 1/1000 inch, ie in internal units screen->SetScalingFactor( 1.0 ); - EDA_DRAW_PANEL* panel = frame->DrawPanel; + EDA_DRAW_PANEL* panel = frame->GetCanvas(); SetLocaleTo_C_standard(); // Switch the locale to standard C (needed // to print floating point numbers like 1.3) diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp index 0f814e8ff5..a4234da696 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -289,14 +289,17 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() g_DrawBgColor = BLACK; bool warning = false; + for( int ii = 0; ii < MAX_LAYERS; ii++ ) { g_LayerDescr.LayerColor[ ii ] = currentColors[ ii ]; + if( g_DrawBgColor == g_LayerDescr.LayerColor[ ii ] ) warning = true; } m_Parent->SetGridColor( g_LayerDescr.LayerColor[LAYER_GRID] ); + if( g_DrawBgColor == g_LayerDescr.LayerColor[ LAYER_GRID ] ) warning = true; @@ -311,11 +314,9 @@ void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& event ) // Prompt the user if an item has the same color as the background // because this item cannot be seen: if( warning ) - wxMessageBox( - _("Warning:\nSome items have the same color as the background\nand they will not be seen on screen") - ); + wxMessageBox( _("Warning:\nSome items have the same color as the background\nand they will not be seen on screen") ); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); EndModal( 1 ); } @@ -330,7 +331,7 @@ void DIALOG_COLOR_CONFIG::OnCancelClick( wxCommandEvent& event ) void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event ) { UpdateColorsSettings(); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 72e612e3ae..f1da61fd4a 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -29,7 +29,7 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent ) wxCHECK_RET( aComponent != NULL && aComponent->Type() == SCH_COMPONENT_T, wxT( "Invalid component object pointer. Bad Programmer!" ) ); - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; DIALOG_EDIT_COMPONENT_IN_SCHEMATIC* dlg = new DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( this ); @@ -54,8 +54,8 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent ) // so it comes up wide enough next time. DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dlg->GetSize(); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; dlg->Destroy(); } @@ -283,7 +283,7 @@ Do you wish to remove this and all remaining undefined fields?" ), m_Parent->OnModify(); m_Parent->GetScreen()->TestDanglingEnds(); - m_Parent->DrawPanel->Refresh( true ); + m_Parent->GetCanvas()->Refresh( true ); EndModal( 0 ); } @@ -834,8 +834,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) if( m_Cmp->m_Flags == 0 ) m_Parent->SaveCopyInUndoList( m_Cmp, UR_CHANGED ); - INSTALL_UNBUFFERED_DC( dc, m_Parent->DrawPanel ); - m_Cmp->Draw( m_Parent->DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode ); + INSTALL_UNBUFFERED_DC( dc, m_Parent->GetCanvas() ); + m_Cmp->Draw( m_Parent->GetCanvas(), &dc, wxPoint( 0, 0 ), g_XorMode ); // Initialize field values to default values found in library: LIB_FIELD& refField = entry->GetReferenceField(); @@ -850,6 +850,6 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) m_Parent->OnModify(); - m_Cmp->Draw( m_Parent->DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + m_Cmp->Draw( m_Parent->GetCanvas(), &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); EndModal( 1 ); } diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index d8e662db29..43285ce60e 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -214,7 +214,7 @@ void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent ) void DialogLabelEditor::OnCancelClick( wxCommandEvent& aEvent ) { - m_Parent->DrawPanel->MoveCursorToCrossHair(); + m_Parent->GetCanvas()->MoveCursorToCrossHair(); EndModal( wxID_CANCEL ); } @@ -228,7 +228,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) if( m_CurrentText->GetFlags() == 0 ) m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED ); - m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() ); + m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() ); text = m_textLabel->GetValue(); @@ -269,7 +269,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) if( m_CurrentText->IsNew() ) g_DefaultTextLabelSize = m_CurrentText->m_Size.x; - m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() ); - m_Parent->DrawPanel->MoveCursorToCrossHair(); + m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() ); + m_Parent->GetCanvas()->MoveCursorToCrossHair(); EndModal( wxID_OK ); } diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index 579ae16f9f..9f0e8018d6 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -109,7 +109,7 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event ) if( m_component == NULL ) return; - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component ); diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index 6fd1c57231..3df0f6b53c 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -113,7 +113,7 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event ) ScreenList.DeleteAllMarkers( MARK_ERC ); m_MarkersList->ClearList(); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } @@ -563,7 +563,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList ) DisplayERC_MarkersList(); // Display new markers: - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); if( m_writeErcFile ) { diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 0804bac3ee..181d8bf89d 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -316,7 +316,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) wxRect fitRect; wxDC* dc = GetDC(); SCH_EDIT_FRAME* parent = m_Parent->GetParent(); - EDA_DRAW_PANEL* panel = parent->DrawPanel; + EDA_DRAW_PANEL* panel = parent->GetCanvas(); wxBusyCursor dummy; diff --git a/eeschema/edit_bitmap.cpp b/eeschema/edit_bitmap.cpp index a4c4532b99..f626f3bad4 100644 --- a/eeschema/edit_bitmap.cpp +++ b/eeschema/edit_bitmap.cpp @@ -133,9 +133,9 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage( wxDC* aDC ) image->SetFlags( IS_NEW | IS_MOVED ); - image->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + image->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - DrawPanel->SetMouseCapture( moveBitmap, abortMoveBitmap ); + m_canvas->SetMouseCapture( moveBitmap, abortMoveBitmap ); GetScreen()->SetCurItem( image ); OnModify(); @@ -146,16 +146,16 @@ void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC ) { aImageItem->SetFlags( IS_MOVED ); - DrawPanel->SetMouseCapture( moveBitmap, abortMoveBitmap ); + m_canvas->SetMouseCapture( moveBitmap, abortMoveBitmap ); GetScreen()->SetCurItem( aImageItem ); m_itemToRepeat = NULL; SetUndoItem( aImageItem ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); GetScreen()->SetCrossHairPosition( aImageItem->GetPosition() ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->CrossHairOn( aDC ); + m_canvas->MoveCursorToCrossHair(); + m_canvas->CrossHairOn( aDC ); OnModify(); } @@ -167,7 +167,7 @@ void SCH_EDIT_FRAME::RotateImage( SCH_BITMAP* aItem ) aItem->Rotate( aItem->GetPosition() ); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis ) @@ -181,7 +181,7 @@ void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis ) aItem->Mirror_Y( aItem->GetPosition().x ); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem ) @@ -196,5 +196,5 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem ) dlg.TransfertToImage(aItem->m_Image); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 3f96d53b89..04f3c6c3fc 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -74,7 +74,7 @@ create a new power component with the new value." ), GetChars( entry->GetName() // Don't use GetText() here. If the field is the reference designator and it's parent // component has multiple parts, we don't want the part suffix added to the field. wxString newtext = aField->m_Text; - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; wxString title; title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) ); @@ -82,8 +82,8 @@ create a new power component with the new value." ), GetChars( entry->GetName() wxTextEntryDialog dlg( this, wxEmptyString , title, newtext ); int response = dlg.ShowModal(); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; newtext = dlg.GetValue( ); newtext.Trim( true ); newtext.Trim( false ); @@ -91,7 +91,7 @@ create a new power component with the new value." ), GetChars( entry->GetName() if ( response != wxID_OK || newtext == aField->GetText() ) return; // canceled by user - aField->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); + aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); if( !newtext.IsEmpty() ) { @@ -135,7 +135,7 @@ create a new power component with the new value." ), GetChars( entry->GetName() } } - aField->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); + aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); component->DisplayInfo( this ); OnModify(); } @@ -152,14 +152,14 @@ void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField, wxDC* aDC ) if( aField->GetFlags() == 0 ) SaveCopyInUndoList( component, UR_CHANGED ); - aField->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); + aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); if( aField->m_Orient == TEXT_ORIENT_HORIZ ) aField->m_Orient = TEXT_ORIENT_VERT; else aField->m_Orient = TEXT_ORIENT_HORIZ; - aField->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); + aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); OnModify(); } diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index b110e98a1b..e4538b2938 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -60,12 +60,12 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC ) if( aTextItem->GetFlags() == 0 ) SaveCopyInUndoList( aTextItem, UR_CHANGED ); - DrawPanel->CrossHairOff( aDC ); - aTextItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); + m_canvas->CrossHairOff( aDC ); + aTextItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); aTextItem->SetOrientation( orient ); OnModify(); - aTextItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); - DrawPanel->CrossHairOn( aDC ); + aTextItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); + m_canvas->CrossHairOn( aDC ); } @@ -106,7 +106,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType ) textItem->m_Size.x = textItem->m_Size.y = g_DefaultTextLabelSize; textItem->SetFlags( IS_NEW | IS_MOVED ); - textItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); + textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); EditSchematicText( textItem ); if( textItem->m_Text.IsEmpty() ) @@ -124,7 +124,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType ) lastGlobalLabelShape = textItem->GetShape(); } - textItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); MoveItem( (SCH_ITEM*) textItem, aDC ); return textItem; @@ -220,17 +220,17 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent ) * put in undo list later, at the end of the current command (if not aborted) */ - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); - DrawPanel->CrossHairOff( &dc ); // Erase schematic cursor - text->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); + m_canvas->CrossHairOff( &dc ); // Erase schematic cursor + text->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode ); screen->RemoveFromDrawList( text ); screen->AddToDrawList( newtext ); GetScreen()->SetCurItem( newtext ); m_itemToRepeat = NULL; OnModify(); - newtext->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - DrawPanel->CrossHairOn( &dc ); // redraw schematic cursor + newtext->Draw( m_canvas, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + m_canvas->CrossHairOn( &dc ); // redraw schematic cursor if( text->IsNew() ) { diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 617e4ce7fe..6de40ff459 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -47,16 +47,16 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) if( GetScreen() == NULL ) return; - DrawPanel->DrawBackGround( DC ); + m_canvas->DrawBackGround( DC ); - GetScreen()->Draw( DrawPanel, DC, GR_DEFAULT_DRAWMODE ); + GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE ); TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness ); - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, FALSE ); - DrawPanel->DrawCrossHair( DC ); + m_canvas->DrawCrossHair( DC ); // Display the sheet filename, and the sheet path, for non root sheets if( GetScreen()->GetFileName() == m_DefaultSchematicFileName ) diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 9b7dd8a1b4..90dc4f287c 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -170,13 +170,13 @@ bool EDA_APP::OnInit() wxSetWorkingDirectory( filename.GetPath() ); if( frame->LoadOneEEProject( filename.GetFullPath(), false ) ) - frame->DrawPanel->Refresh( true ); + frame->GetCanvas()->Refresh( true ); } else { // Read a default config file if no file to load. frame->LoadProjectFile( wxEmptyString, true ); - frame->DrawPanel->Refresh( true ); + frame->GetCanvas()->Refresh( true ); } return true; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 1b62863c4e..bbc57da4b0 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -191,7 +191,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 ); dlg.SetShowGrid( IsGridVisible() ); dlg.SetShowHiddenPins( m_showAllPins ); - dlg.SetEnableAutoPan( DrawPanel->m_AutoPAN_Enable ); + dlg.SetEnableAutoPan( m_canvas->m_AutoPAN_Enable ); dlg.SetEnableHVBusOrientation( g_HVLines ); dlg.SetShowPageLimits( g_ShowPageLimits ); dlg.Layout(); @@ -222,7 +222,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 ); SetGridVisibility( dlg.GetShowGrid() ); m_showAllPins = dlg.GetShowHiddenPins(); - DrawPanel->m_AutoPAN_Enable = dlg.GetEnableAutoPan(); + m_canvas->m_AutoPAN_Enable = dlg.GetEnableAutoPan(); g_HVLines = dlg.GetEnableHVBusOrientation(); g_ShowPageLimits = dlg.GetShowPageLimits(); @@ -247,7 +247,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) } } - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } diff --git a/eeschema/events_called_functions_for_edit.cpp b/eeschema/events_called_functions_for_edit.cpp index 88083410ff..f6e5984740 100644 --- a/eeschema/events_called_functions_for_edit.cpp +++ b/eeschema/events_called_functions_for_edit.cpp @@ -21,7 +21,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) if( !curr_item || curr_item->GetFlags() ) return; - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); switch( curr_item->Type() ) { @@ -35,7 +35,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) MoveItem( (SCH_ITEM*) newitem, &dc ); // Redraw the original part, because StartMovePart() erased it from screen. - curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + curr_item->Draw( m_canvas, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); } break; @@ -49,7 +49,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) MoveItem( (SCH_ITEM*) newitem, &dc ); /* Redraw the original part in XOR mode */ - curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode ); + curr_item->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode ); } break; diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 05e6dae96e..f21c48174a 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -258,7 +258,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew ) LoadProjectFile( wxEmptyString, true ); Zoom_Automatique( false ); SetSheetNumberAndCount(); - DrawPanel->Refresh(); + m_canvas->Refresh(); return true; } @@ -354,7 +354,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew ) GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); Zoom_Automatique( false ); SetSheetNumberAndCount(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); return diag; } diff --git a/eeschema/find.cpp b/eeschema/find.cpp index 4d42344aad..756bed516c 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -208,7 +208,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference, /* There may be need to reframe the drawing */ - if( ! DrawPanel->IsPointOnDisplay( pos ) ) + if( ! m_canvas->IsPointOnDisplay( pos ) ) { centerAndRedraw = true; } @@ -221,16 +221,16 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference, else { - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); - DrawPanel->CrossHairOff( &dc ); + m_canvas->CrossHairOff( &dc ); if( aWarpMouse ) - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); GetScreen()->SetCrossHairPosition(pos); - DrawPanel->CrossHairOn( &dc ); + m_canvas->CrossHairOn( &dc ); } } diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index ef8f058909..f347c983c7 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -96,7 +96,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, static wxString lastCommponentName; m_itemToRepeat = NULL; - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; if( !libname.IsEmpty() ) { @@ -122,8 +122,8 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if ( dlg.ShowModal() == wxID_CANCEL ) { - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -140,8 +140,8 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( Name.IsEmpty() ) { - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -157,8 +157,8 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( Name.IsEmpty() ) { - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); return NULL; } } @@ -168,8 +168,8 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( GetNameOfPartToLoad( this, Library, Name ) == 0 ) { - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); return NULL; } } @@ -180,8 +180,8 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( Name.IsEmpty() ) { - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); return NULL; } } @@ -200,14 +200,14 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( Entry == NULL ) { - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); return NULL; } } - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); if( Entry == NULL ) { @@ -230,7 +230,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, // Set the component value that can differ from component name in lib, for aliases component->GetField( VALUE )->m_Text = Name; component->DisplayInfo( this ); - component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); + component->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); component->SetFlags( IS_NEW ); MoveItem( (SCH_ITEM*) component, DC ); @@ -252,7 +252,7 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation ) SCH_COMPONENT* component = (SCH_COMPONENT*) item; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( component->GetFlags() == 0 ) { @@ -260,27 +260,27 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation ) GetScreen()->SetCurItem( NULL ); } - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); // Erase the previous component in it's current orientation. - DrawPanel->CrossHairOff( &dc ); + m_canvas->CrossHairOff( &dc ); if( component->GetFlags() ) - component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); + component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); else - DrawPanel->RefreshDrawingRect( component->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( component->GetBoundingBox() ); component->SetOrientation( aOrientation ); /* Redraw the component in the new position. */ if( component->GetFlags() ) - component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); + component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); else - component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - DrawPanel->CrossHairOn( &dc ); - GetScreen()->TestDanglingEnds( DrawPanel, &dc ); + m_canvas->CrossHairOn( &dc ); + GetScreen()->TestDanglingEnds( m_canvas, &dc ); OnModify(); } @@ -296,9 +296,9 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent ) wxCHECK_RET( item != NULL && item->Type() == SCH_COMPONENT_T, wxT( "Cannot select unit of invalid schematic item." ) ); - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); SCH_COMPONENT* component = (SCH_COMPONENT*) item; @@ -330,9 +330,9 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent ) SaveCopyInUndoList( component, UR_CHANGED ); if( flags ) - component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); + component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); else - component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode ); + component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode ); /* Update the unit number. */ component->SetUnitSelection( m_CurrentSheet, unit ); @@ -342,11 +342,11 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent ) /* Redraw the component in the new position. */ if( flags ) - component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); + component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); else - component->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - screen->TestDanglingEnds( DrawPanel, &dc ); + screen->TestDanglingEnds( m_canvas, &dc ); OnModify(); } @@ -372,9 +372,9 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ) int flags = DrawComponent->GetFlags(); if( DrawComponent->GetFlags() ) - DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); + DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); else - DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); + DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode ); DrawComponent->SetConvert( DrawComponent->GetConvert() + 1 ); @@ -392,10 +392,10 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ) /* Redraw the component in the new position. */ if( DrawComponent->IsMoving() ) - DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); + DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); else - DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - GetScreen()->TestDanglingEnds( DrawPanel, DC ); + GetScreen()->TestDanglingEnds( m_canvas, DC ); OnModify( ); } diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index 12192437e3..20a98cbb09 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -280,26 +280,26 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet() // update the References m_CurrentSheet->UpdateAllScreenReferences(); SetSheetNumberAndCount(); - DrawPanel->m_CanStartBlock = -1; + m_canvas->m_CanStartBlock = -1; if( screen->m_FirstRedraw ) { Zoom_Automatique( false ); screen->m_FirstRedraw = false; screen->SetCrossHairPosition( screen->GetScrollCenterPosition() ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } else { RedrawScreen( screen->GetScrollCenterPosition(), true ); } - // Now refresh DrawPanel. Should be not necessary, but because screen has changed + // Now refresh m_canvas. Should be not necessary, but because screen has changed // the previous refresh has set all new draw parameters (scroll position ..) // but most of time there were some inconsitencies about cursor parameters // ( previous position of cursor ...) and artefacts can happen // mainly when sheet size has changed // This second refresh clears artefacts because at this point, // all parameters are now updated - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp index 5d67356d2a..1470fa4dcb 100644 --- a/eeschema/lib_export.cpp +++ b/eeschema/lib_export.cpp @@ -89,7 +89,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event ) m_lastLibImportPath = fn.GetPath(); DisplayLibInfos(); GetScreen()->ClearUndoRedoList(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } delete LibTmp; diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index da89d3a476..2fe713d023 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -118,7 +118,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event ) wxString CmpName; LIB_ALIAS* LibEntry = NULL; - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); if( GetScreen()->IsModify() && !IsOK( this, _( "Current part not saved.\n\nDiscard current changes?" ) ) ) @@ -235,7 +235,7 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) if( GetScreen() == NULL ) return; - DrawPanel->DrawBackGround( DC ); + m_canvas->DrawBackGround( DC ); if( m_component ) { @@ -246,15 +246,15 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) wxString fieldText = Field->m_Text; wxString fieldfullText = Field->GetFullText( m_unit ); Field->m_Text = fieldfullText; - m_component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit, + m_component->Draw( m_canvas, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE ); Field->m_Text = fieldText; } - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); - DrawPanel->DrawCrossHair( DC ); + m_canvas->DrawCrossHair( DC ); DisplayLibInfos(); UpdateStatusBar(); @@ -266,7 +266,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event ) wxFileName fn; wxString msg; - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); if( m_library == NULL ) { @@ -456,7 +456,7 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event ) wxArrayString ListNames; wxString msg; - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); m_lastDrawItem = NULL; m_drawItem = NULL; @@ -536,7 +536,7 @@ All changes will be lost. Discard changes?" ) ) ) m_aliasName.Empty(); } - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -550,7 +550,7 @@ void LIB_EDIT_FRAME::CreateNewLibraryPart( wxCommandEvent& event ) lost!\n\nClear the current component from the screen?" ) ) ) return; - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); m_drawItem = NULL; @@ -634,7 +634,7 @@ lost!\n\nClear the current component from the screen?" ) ) ) m_lastDrawItem = NULL; GetScreen()->ClearUndoRedoList(); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); m_mainToolBar->Refresh(); } diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index f850263fd0..2c94e78a22 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -32,8 +32,8 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) { DisplayCmpDoc(); - if( DrawPanel->m_AbortRequest ) - DrawPanel->m_AbortRequest = false; + if( m_canvas->m_AbortRequest ) + m_canvas->m_AbortRequest = false; } } @@ -97,12 +97,12 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) case ID_LIBEDIT_ANCHOR_ITEM_BUTT: SaveCopyInUndoList( m_component ); PlaceAnchor(); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; default: wxFAIL_MSG( wxString::Format( wxT( "Unhandled command ID %d" ), GetToolId() ) ); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; } } @@ -135,7 +135,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition ) else return; - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; switch( m_drawItem->Type() ) { @@ -187,6 +187,6 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition ) break; } - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; } diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index ab072ce2e7..a4931a42c4 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -51,9 +51,9 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) item = LocateItemUsingCursor( aPosition ); // If the clarify item selection context menu is aborted, don't show the context menu. - if( item == NULL && DrawPanel->m_AbortRequest ) + if( item == NULL && m_canvas->m_AbortRequest ) { - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; return false; } diff --git a/eeschema/libedit_plot_component.cpp b/eeschema/libedit_plot_component.cpp index 1eb5cda237..792394cdba 100644 --- a/eeschema/libedit_plot_component.cpp +++ b/eeschema/libedit_plot_component.cpp @@ -88,9 +88,9 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg ) { - wxSize image_size = DrawPanel->GetClientSize(); + wxSize image_size = m_canvas->GetClientSize(); - wxClientDC dc( DrawPanel ); + wxClientDC dc( m_canvas ); wxBitmap bitmap( image_size.x, image_size.y ); wxMemoryDC memdc; @@ -125,7 +125,7 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode plot_offset.x = pagesize.x/2; plot_offset.y = pagesize.y/2; - m_component->Draw( DrawPanel, aDC, plot_offset, m_unit, m_convert, GR_DEFAULT_DRAWMODE ); + m_component->Draw( m_canvas, aDC, plot_offset, m_unit, m_convert, GR_DEFAULT_DRAWMODE ); } diff --git a/eeschema/libedit_undo_redo.cpp b/eeschema/libedit_undo_redo.cpp index b59907ff12..cbc6e3d075 100644 --- a/eeschema/libedit_undo_redo.cpp +++ b/eeschema/libedit_undo_redo.cpp @@ -62,8 +62,8 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event ) SetShowDeMorgan( m_component->HasConversion() ); DisplayLibInfos(); DisplayCmpDoc(); - OnModify( ); - DrawPanel->Refresh(); + OnModify(); + m_canvas->Refresh(); } @@ -99,5 +99,5 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event ) DisplayLibInfos(); DisplayCmpDoc(); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 3d2dc73f75..0e23437c26 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -223,8 +223,8 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); - if( DrawPanel ) - DrawPanel->m_Block_Enable = true; + if( m_canvas ) + m_canvas->m_Block_Enable = true; EnsureActiveLibExists(); ReCreateMenuBar(); @@ -256,7 +256,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() ); - m_auimgr.AddPane( DrawPanel, + m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.AddPane( m_messagePanel, @@ -382,7 +382,7 @@ double LIB_EDIT_FRAME::BestZoom() GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) ); } - size = DrawPanel->GetClientSize(); + size = m_canvas->GetClientSize(); // Reserve a 10% margin around component bounding box. double margin_scale_factor = 0.8; @@ -562,7 +562,7 @@ void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event ) m_aliasName = m_aliasSelectBox->GetStringSelection(); DisplayCmpDoc(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -575,7 +575,7 @@ void LIB_EDIT_FRAME::OnSelectPart( wxCommandEvent& event ) m_lastDrawItem = NULL; m_unit = i + 1; - DrawPanel->Refresh(); + m_canvas->Refresh(); DisplayCmpDoc(); } @@ -599,7 +599,7 @@ void LIB_EDIT_FRAME::OnViewEntryDoc( wxCommandEvent& event ) void LIB_EDIT_FRAME::OnSelectBodyStyle( wxCommandEvent& event ) { - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); if( event.GetId() == ID_DE_MORGAN_NORMAL_BUTT ) m_convert = 1; @@ -607,7 +607,7 @@ void LIB_EDIT_FRAME::OnSelectBodyStyle( wxCommandEvent& event ) m_convert = 2; m_lastDrawItem = NULL; - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -616,7 +616,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) int id = event.GetId(); wxPoint pos; - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; wxGetMousePosition( &pos.x, &pos.y ); pos.y += 20; @@ -642,23 +642,23 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_LIBEDIT_CANCEL_EDITING: - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->EndMouseCapture(); + if( m_canvas->IsMouseCaptured() ) + m_canvas->EndMouseCapture(); else - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); break; case ID_POPUP_LIBEDIT_DELETE_ITEM: - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); break; default: - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; } - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); switch( id ) { @@ -678,7 +678,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_LIBEDIT_END_CREATE_ITEM: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( m_drawItem ) { EndDrawGraphicItem( &dc ); @@ -688,7 +688,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM: if( m_drawItem ) { - DrawPanel->CrossHairOff( &dc ); + m_canvas->CrossHairOff( &dc ); switch( m_drawItem->Type() ) { @@ -707,7 +707,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ; } - DrawPanel->CrossHairOn( &dc ); + m_canvas->CrossHairOn( &dc ); } break; @@ -717,12 +717,12 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( m_drawItem == NULL ) break; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); int oldFlags = m_drawItem->GetFlags(); m_drawItem->ClearFlags(); - m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); + m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); ( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) ); - m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); + m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); m_drawItem->SetFlags( oldFlags ); m_lastDrawItem = NULL; break; @@ -749,7 +749,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( m_drawItem == NULL ) break; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( m_drawItem->Type() == LIB_RECTANGLE_T || m_drawItem->Type() == LIB_CIRCLE_T || m_drawItem->Type() == LIB_POLYLINE_T @@ -765,15 +765,15 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( m_drawItem == NULL ) break; - DrawPanel->CrossHairOff( &dc ); + m_canvas->CrossHairOff( &dc ); if( m_drawItem->Type() == LIB_FIELD_T ) { EditField( &dc, (LIB_FIELD*) m_drawItem ); } - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->CrossHairOn( &dc ); + m_canvas->MoveCursorToCrossHair(); + m_canvas->CrossHairOn( &dc ); break; case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: @@ -784,60 +784,60 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SaveCopyInUndoList( m_component ); GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_ZOOM_BLOCK: - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM; HandleBlockEnd( &dc ); break; case ID_POPUP_DELETE_BLOCK: - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockEnd( &dc ); break; case ID_POPUP_COPY_BLOCK: - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; case ID_POPUP_SELECT_ITEMS_BLOCK: - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockEnd( &dc ); break; case ID_POPUP_MIRROR_Y_BLOCK: - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_Y; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; case ID_POPUP_MIRROR_X_BLOCK: - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; case ID_POPUP_ROTATE_BLOCK: - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; case ID_POPUP_PLACE_BLOCK: - DrawPanel->m_AutoPAN_Request = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_AutoPAN_Request = false; + m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; @@ -846,7 +846,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; } - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->m_IgnoreMouseEvents = false; if( GetToolId() == ID_NO_TOOL_SELECTED ) m_lastDrawItem = NULL; @@ -933,7 +933,7 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem ) /* Deleting old text. */ if( DC && !DrawItem->InEditMode() ) - DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); + DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem ); frame->ShowModal(); @@ -942,7 +942,7 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem ) /* Display new text. */ if( DC && !DrawItem->InEditMode() ) - DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, NULL, + DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, NULL, DefaultTransform ); } @@ -968,7 +968,7 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event ) DisplayLibInfos(); DisplayCmpDoc(); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -984,11 +984,11 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event ) wxCHECK_RET( m_component != NULL, wxT( "Cannot create new part from non-existent current part." ) ); - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); - DrawPanel->CrossHairOff( &dc ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); + m_canvas->CrossHairOff( &dc ); EditField( &dc, &m_component->GetValueField() ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->CrossHairOn( &dc ); + m_canvas->MoveCursorToCrossHair(); + m_canvas->CrossHairOn( &dc ); } void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) @@ -998,13 +998,13 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) if( GetToolId() == ID_NO_TOOL_SELECTED ) m_lastDrawItem = NULL; - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); switch( id ) { case ID_NO_TOOL_SELECTED: - SetToolID( id, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( id, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_LIBEDIT_PIN_BUTT: @@ -1018,7 +1018,7 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetId( ID_LIBEDIT_EDIT_PIN ); GetEventHandler()->ProcessEvent( cmd ); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); } break; @@ -1047,15 +1047,15 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) break; case ID_LIBEDIT_IMPORT_BODY_BUTT: - SetToolID( id, DrawPanel->GetDefaultCursor(), _( "Import" ) ); + SetToolID( id, m_canvas->GetDefaultCursor(), _( "Import" ) ); LoadOneSymbol(); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_LIBEDIT_EXPORT_BODY_BUTT: - SetToolID( id, DrawPanel->GetDefaultCursor(), _( "Export" ) ); + SetToolID( id, m_canvas->GetDefaultCursor(), _( "Export" ) ); SaveOneSymbol(); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_LIBEDIT_DELETE_ITEM_BUTT: @@ -1072,7 +1072,7 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) break; } - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->m_IgnoreMouseEvents = false; } @@ -1093,7 +1093,7 @@ void LIB_EDIT_FRAME::OnRotateItem( wxCommandEvent& aEvent ) if( !m_drawItem->InEditMode() ) m_drawItem->ClearFlags(); - DrawPanel->Refresh(); + m_canvas->Refresh(); if( GetToolId() == ID_NO_TOOL_SELECTED ) m_lastDrawItem = NULL; @@ -1160,9 +1160,9 @@ LIB_ITEM* LIB_EDIT_FRAME::locateItem( const wxPoint& aPosition, const KICAD_T aF // Set to NULL in case user aborts the clarification context menu. m_drawItem = NULL; - DrawPanel->m_AbortRequest = true; // Changed to false if an item is selected + m_canvas->m_AbortRequest = true; // Changed to false if an item is selected PopupMenu( &selectMenu ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); item = m_drawItem; } } @@ -1180,7 +1180,7 @@ void LIB_EDIT_FRAME::deleteItem( wxDC* aDC ) { wxCHECK_RET( m_drawItem != NULL, wxT( "No drawing item selected to delete." ) ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); SaveCopyInUndoList( m_component ); if( m_drawItem->Type() == LIB_PIN_T ) @@ -1188,7 +1188,7 @@ void LIB_EDIT_FRAME::deleteItem( wxDC* aDC ) LIB_PIN* pin = (LIB_PIN*) m_drawItem; wxPoint pos = pin->GetPosition(); - m_component->RemoveDrawItem( (LIB_ITEM*) pin, DrawPanel, aDC ); + m_component->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC ); if( SynchronizePins() ) { @@ -1206,25 +1206,25 @@ void LIB_EDIT_FRAME::deleteItem( wxDC* aDC ) } } - DrawPanel->Refresh(); + m_canvas->Refresh(); } else { - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->m_endMouseCaptureCallback( DrawPanel, aDC ); + m_canvas->m_endMouseCaptureCallback( m_canvas, aDC ); } else { - m_component->RemoveDrawItem( m_drawItem, DrawPanel, aDC ); - DrawPanel->Refresh(); + m_component->RemoveDrawItem( m_drawItem, m_canvas, aDC ); + m_canvas->Refresh(); } } m_drawItem = NULL; m_lastDrawItem = NULL; OnModify(); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); } @@ -1237,7 +1237,7 @@ void LIB_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent ) && (index >= 0 && index < m_collectedItems.GetCount()) ) { LIB_ITEM* item = m_collectedItems[index]; - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; m_drawItem = item; } } diff --git a/eeschema/libfield.cpp b/eeschema/libfield.cpp index d9a9878a6b..755b5c1091 100644 --- a/eeschema/libfield.cpp +++ b/eeschema/libfield.cpp @@ -144,7 +144,7 @@ this component?" ), if( !aField->InEditMode() ) { SaveCopyInUndoList( parent ); - ( (LIB_ITEM*) aField )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, + ( (LIB_ITEM*) aField )->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText, DefaultTransform ); } @@ -152,7 +152,7 @@ this component?" ), if( !aField->InEditMode() ) { fieldText = aField->GetFullText( m_unit ); - ( (LIB_ITEM*) aField )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, + ( (LIB_ITEM*) aField )->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText, DefaultTransform ); } diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index b99fdb0e60..6c16457224 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -57,7 +57,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( ( GetToolId() == ID_NO_TOOL_SELECTED ) || ( item && item->GetFlags() ) ) { - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; m_itemToRepeat = NULL; if( item && item->GetFlags() ) @@ -79,7 +79,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) item->Place( this, aDC ); GetScreen()->SetCurItem( NULL ); GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); return; case SCH_LINE_T: // May already be drawing segment. @@ -129,16 +129,16 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { m_itemToRepeat = AddNoConnect( aDC, gridPosition ); GetScreen()->SetCurItem( m_itemToRepeat ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; } GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); break; case ID_JUNCTION_BUTT: @@ -146,16 +146,16 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { m_itemToRepeat = AddJunction( aDC, gridPosition, true ); GetScreen()->SetCurItem( m_itemToRepeat ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; } GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); break; case ID_WIRETOBUS_ENTRY_BUTT: @@ -165,15 +165,15 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) item = CreateBusEntry( aDC, ( GetToolId() == ID_WIRETOBUS_ENTRY_BUTT ) ? WIRE_TO_BUS : BUS_TO_BUS ); GetScreen()->SetCurItem( item ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); GetScreen()->SetCurItem( NULL ); GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->Refresh( true ); + m_canvas->m_AutoPAN_Request = false; } break; @@ -183,29 +183,29 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) case ID_WIRE_BUTT: BeginSegment( aDC, LAYER_WIRE ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; break; case ID_BUS_BUTT: BeginSegment( aDC, LAYER_BUS ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; break; case ID_LINE_COMMENT_BUTT: BeginSegment( aDC, LAYER_NOTES ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; break; case ID_TEXT_COMMENT_BUTT: if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) { GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; } break; @@ -213,12 +213,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) { GetScreen()->SetCurItem( CreateNewImage( aDC ) ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; } break; @@ -226,14 +226,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) { GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } break; @@ -247,14 +247,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( GetToolId() == ID_HIERLABEL_BUTT ) GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } break; @@ -262,14 +262,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) { GetScreen()->SetCurItem( CreateSheet( aDC ) ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } break; @@ -292,7 +292,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { item->Place( this, aDC ); GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } break; @@ -300,14 +300,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( (item == NULL) || (item->GetFlags() == 0) ) { GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } break; @@ -316,19 +316,19 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { GetScreen()->SetCurItem( Load_Component( aDC, wxT( "power" ), s_PowerNameList, false ) ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { item->Place( this, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } break; default: - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick invalid tool ID <" ) + wxString::Format( wxT( "%d> selected." ), GetToolId() ) ); } @@ -368,7 +368,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) case SCH_COMPONENT_T: EditComponent( (SCH_COMPONENT*) item ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case SCH_TEXT_T: @@ -384,7 +384,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) case SCH_FIELD_T: EditComponentFieldText( (SCH_FIELD*) item, aDC ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case SCH_MARKER_T: diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index fae0761f95..fd10526209 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -76,7 +76,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) bool BlockActive = GetScreen()->IsBlockActive(); // Do not start a block command on context menu. - DrawPanel->m_CanStartBlock = -1; + m_canvas->m_CanStartBlock = -1; if( BlockActive ) { @@ -91,9 +91,9 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) item = LocateAndShowItem( aPosition, SCH_COLLECTOR::AllItemsButPins ); // If the clarify item selection context menu is aborted, don't show the context menu. - if( item == NULL && DrawPanel->m_AbortRequest ) + if( item == NULL && m_canvas->m_AbortRequest ) { - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; return false; } } diff --git a/eeschema/operations_on_items_lists.cpp b/eeschema/operations_on_items_lists.cpp index a6eae2adf2..79f585f4fd 100644 --- a/eeschema/operations_on_items_lists.cpp +++ b/eeschema/operations_on_items_lists.cpp @@ -142,6 +142,7 @@ void DeleteItemsInList( EDA_DRAW_PANEL* panel, PICKED_ITEMS_LIST& aItemsList ) void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem ) { wxCHECK_RET( aItem != NULL, wxT( "Cannot delete invalid item." ) ); + if( aItem == NULL ) return; @@ -155,7 +156,7 @@ void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem ) wxT( "Sheet label has invalid parent item." ) ); SaveCopyInUndoList( (SCH_ITEM*) sheet, UR_CHANGED ); sheet->RemovePin( (SCH_SHEET_PIN*) aItem ); - DrawPanel->RefreshDrawingRect( sheet->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( sheet->GetBoundingBox() ); } else { @@ -165,7 +166,7 @@ void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem ) aItem->SetBack( NULL ); // Only one struct -> no link SaveCopyInUndoList( aItem, UR_DELETED ); - DrawPanel->RefreshDrawingRect( aItem->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( aItem->GetBoundingBox() ); } } diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 8081e4a529..9cf7ec365a 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -116,7 +116,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) if( pin->IsNew() ) { pin->SetFlags( IS_CANCELLED ); - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); } return; } @@ -152,7 +152,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) OnModify( ); pin->DisplayInfo( this ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } pin->EnableEditMode( false, m_editPinsPerPartOrConvert ); @@ -220,12 +220,12 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC ) if( ask_for_pin && SynchronizePins() ) { - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; status = IsOK( this, _( "This position is already occupied by \ another pin. Continue?" ) ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; if( !status ) return; @@ -241,7 +241,7 @@ another pin. Continue?" ) ); else SaveCopyInUndoList( m_component ); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); OnModify(); CurrentPin->SetPosition( newpos ); @@ -268,11 +268,11 @@ another pin. Continue?" ) ); Pin->ClearFlags(); } - DrawPanel->CrossHairOff( DC ); + m_canvas->CrossHairOff( DC ); bool showPinText = true; - CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, + CurrentPin->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, &showPinText, DefaultTransform ); - DrawPanel->CrossHairOn( DC ); + m_canvas->CrossHairOn( DC ); m_drawItem = NULL; } @@ -313,13 +313,13 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC ) startPos.x = OldPos.x; startPos.y = -OldPos.y; - DrawPanel->CrossHairOff( DC ); + m_canvas->CrossHairOff( DC ); GetScreen()->SetCrossHairPosition( startPos ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); CurrentPin->DisplayInfo( this ); - DrawPanel->SetMouseCapture( DrawMovePin, AbortPinMove ); - DrawPanel->CrossHairOn( DC ); + m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove ); + m_canvas->CrossHairOn( DC ); } @@ -398,12 +398,12 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC ) pin->SetUnit( LastPinCommonUnit ? 0 : m_unit ); pin->SetVisible( LastPinVisible ); PinPreviousPos = pin->GetPosition(); - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetId( ID_LIBEDIT_EDIT_PIN ); GetEventHandler()->ProcessEvent( cmd ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; if( pin->GetFlags() & IS_CANCELLED ) { @@ -412,10 +412,10 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC ) else { ClearTempCopyComponent(); - DrawPanel->SetMouseCapture( DrawMovePin, AbortPinMove ); + m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove ); if( DC ) - pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, wxCOPY, &showPinText, + pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, wxCOPY, &showPinText, DefaultTransform ); } @@ -503,7 +503,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id ) if( selected && !Pin->IsSelected() ) continue; - Pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform ); + Pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform ); switch( id ) { @@ -520,7 +520,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id ) break; } - Pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, &showPinText, + Pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, &showPinText, DefaultTransform ); } } @@ -553,7 +553,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) Pin->SetFlags( IS_LINKED ); wxPoint savepos = GetScreen()->GetCrossHairPosition(); - DrawPanel->CrossHairOff( DC ); + m_canvas->CrossHairOff( DC ); GetScreen()->SetCrossHairPosition( wxPoint( Pin->GetPosition().x, -Pin->GetPosition().y ) ); // Add this new pin in list, and creates pins for others parts if needed @@ -563,7 +563,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) m_lastDrawItem = Pin; GetScreen()->SetCrossHairPosition( savepos ); - DrawPanel->CrossHairOn( DC ); + m_canvas->CrossHairOn( DC ); Pin->DisplayInfo( this ); OnModify( ); diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 8273861359..2d1d245108 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -345,14 +345,14 @@ bool SCH_FIELD::Save( FILE* aFile ) const void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { - frame->DrawPanel->SetMouseCapture( NULL, NULL ); + frame->GetCanvas()->SetMouseCapture( NULL, NULL ); SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent(); // save old cmp in undo list frame->SaveUndoItemInUndoList( component ); - Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + Draw( frame->GetCanvas(), DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); ClearFlags(); frame->GetScreen()->SetCurItem( NULL ); frame->OnModify(); diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 1d58402398..91169bd542 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -484,12 +484,12 @@ void SCH_SHEET::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { // fix size and position of the new sheet // using the last values set by the m_mouseCaptureCallback function - frame->DrawPanel->SetMouseCapture( NULL, NULL ); + frame->GetCanvas()->SetMouseCapture( NULL, NULL ); if( !frame->EditSheet( this, DC ) ) { frame->GetScreen()->SetCurItem( NULL ); - Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); + Draw( frame->GetCanvas(), DC, wxPoint( 0, 0 ), g_XorMode ); delete this; return; } diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index dd13af2fd1..58f208cb9b 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -144,11 +144,11 @@ void SCH_SHEET_PIN::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC ) } ClearFlags(); - sheet->Draw( aFrame->DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + sheet->Draw( aFrame->GetCanvas(), aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); // Make sure we don't call the abort move function. - aFrame->DrawPanel->SetMouseCapture( NULL, NULL ); - aFrame->DrawPanel->EndMouseCapture(); + aFrame->GetCanvas()->SetMouseCapture( NULL, NULL ); + aFrame->GetCanvas()->EndMouseCapture(); } diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 0c59e17eda..551277b269 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -100,17 +100,17 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_DELETE: // Stop the current command (if any) but keep the current tool - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); break; default: // Stop the current command and deselect the current tool - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); break; } - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); item = screen->GetCurItem(); // Can be modified by previous calls. switch( id ) @@ -134,30 +134,30 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_SCH_ENTRY_SELECT_SLASH: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) item, '/' ); break; case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) item, '\\' ); break; case ID_POPUP_CANCEL_CURRENT_COMMAND: - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->EndMouseCapture(); - SetToolID( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString ); + m_canvas->EndMouseCapture(); + SetToolID( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString ); } else { - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); } break; case ID_POPUP_END_LINE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); EndSegment( &dc ); break; @@ -168,24 +168,24 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_DELETE_NODE: case ID_POPUP_SCH_DELETE_CONNECTION: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ); screen->SetCurItem( NULL ); m_itemToRepeat = NULL; - screen->TestDanglingEnds( DrawPanel, &dc ); - DrawPanel->Refresh(); + screen->TestDanglingEnds( m_canvas, &dc ); + m_canvas->Refresh(); break; case ID_POPUP_SCH_BREAK_WIRE: { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); SCH_ITEM* oldWiresList = screen->ExtractWires( true ); screen->BreakSegment( screen->GetCrossHairPosition() ); if( oldWiresList ) SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE ); - screen->TestDanglingEnds( DrawPanel, &dc ); + screen->TestDanglingEnds( m_canvas, &dc ); } break; @@ -197,19 +197,19 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) DeleteItem( item ); screen->SetCurItem( NULL ); m_itemToRepeat = NULL; - screen->TestDanglingEnds( DrawPanel, &dc ); + screen->TestDanglingEnds( m_canvas, &dc ); SetSheetNumberAndCount(); OnModify(); break; case ID_POPUP_SCH_END_SHEET: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); item->Place( this, &dc ); break; case ID_POPUP_SCH_RESIZE_SHEET: ReSizeSheet( (SCH_SHEET*) item, &dc ); - screen->TestDanglingEnds( DrawPanel, &dc ); + screen->TestDanglingEnds( m_canvas, &dc ); break; case ID_POPUP_IMPORT_GLABEL: @@ -236,12 +236,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SaveCopyInUndoList( sheet, UR_CHANGED ); sheet->CleanupSheet(); OnModify(); - DrawPanel->RefreshDrawingRect( sheet->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( sheet->GetBoundingBox() ); } break; case ID_POPUP_SCH_INIT_CMP: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_SCH_EDIT_CONVERT_CMP: @@ -249,7 +249,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) // Ensure the struct is a component (could be a struct of a component, like Field, text..) if( item && item->Type() == SCH_COMPONENT_T ) { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ConvertPart( (SCH_COMPONENT*) item, &dc ); } @@ -291,8 +291,8 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PLACE_BLOCK: - DrawPanel->m_AutoPAN_Request = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_AutoPAN_Request = false; + m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; @@ -301,25 +301,25 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_DELETE_BLOCK: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); SetSheetNumberAndCount(); break; case ID_POPUP_COPY_BLOCK: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockEndByPopUp( BLOCK_COPY, &dc ); break; case ID_POPUP_DRAG_BLOCK: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); HandleBlockEndByPopUp( BLOCK_DRAG, &dc ); break; case ID_POPUP_SCH_ADD_JUNCTION: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); screen->SetCurItem( AddJunction( &dc, screen->GetCrossHairPosition(), true ) ); - screen->TestDanglingEnds( DrawPanel, &dc ); + screen->TestDanglingEnds( m_canvas, &dc ); screen->SetCurItem( NULL ); break; @@ -332,7 +332,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( item ) { item->Place( this, &dc ); - screen->TestDanglingEnds( DrawPanel, &dc ); + screen->TestDanglingEnds( m_canvas, &dc ); screen->SetCurItem( NULL ); } @@ -380,7 +380,7 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent ) return; } - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); switch( item->Type() ) { @@ -426,18 +426,18 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent ) if( screen->IsBlockActive() ) { - DrawPanel->SetCursor( wxCursor( DrawPanel->GetDefaultCursor() ) ); + m_canvas->SetCursor( wxCursor( m_canvas->GetDefaultCursor() ) ); screen->ClearBlockCommand(); // Stop the current command (if any) but keep the current tool - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); } else { - if( DrawPanel->IsMouseCaptured() ) // Stop the current command but keep the current tool - DrawPanel->EndMouseCapture(); + if( m_canvas->IsMouseCaptured() ) // Stop the current command but keep the current tool + m_canvas->EndMouseCapture(); else // Deselect current tool - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); } } @@ -447,12 +447,12 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) int id = aEvent.GetId(); // Stop the current command and deselect the current tool. - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); switch( id ) { case ID_NO_TOOL_SELECTED: - SetToolID( id, DrawPanel->GetDefaultCursor(), _( "No tool selected" ) ); + SetToolID( id, m_canvas->GetDefaultCursor(), _( "No tool selected" ) ); break; case ID_HIERARCHY_PUSH_POP_BUTT: @@ -542,7 +542,7 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) wxPoint pos = data->GetPosition(); - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); OnLeftClick( &dc, pos ); } } @@ -563,7 +563,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool aFullConnection ) if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 ) { - DeleteItemsInList( DrawPanel, pickList ); + DeleteItemsInList( m_canvas, pickList ); OnModify(); } } @@ -585,7 +585,7 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC ) DeleteItem( item ); if( itemHasConnections ) - screen->TestDanglingEnds( DrawPanel, DC ); + screen->TestDanglingEnds( m_canvas, DC ); OnModify(); return true; @@ -676,18 +676,18 @@ void SCH_EDIT_FRAME::MoveItem( SCH_ITEM* aItem, wxDC* aDC ) aItem->SetFlags( IS_MOVED ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); if( aItem->Type() != SCH_SHEET_PIN_T ) GetScreen()->SetCrossHairPosition( aItem->GetPosition() ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); OnModify(); - DrawPanel->SetMouseCapture( moveItem, abortMoveItem ); + m_canvas->SetMouseCapture( moveItem, abortMoveItem ); GetScreen()->SetCurItem( aItem ); - moveItem( DrawPanel, aDC, wxDefaultPosition, true ); - DrawPanel->CrossHairOn( aDC ); + moveItem( m_canvas, aDC, wxDefaultPosition, true ); + m_canvas->CrossHairOn( aDC ); } @@ -696,7 +696,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent ) SCH_SCREEN* screen = GetScreen(); SCH_ITEM* item = screen->GetCurItem(); - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); if( item == NULL ) { @@ -739,12 +739,12 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent ) case SCH_LABEL_T: case SCH_GLOBAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ChangeTextOrient( (SCH_TEXT*) item, &dc ); break; case SCH_FIELD_T: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); RotateField( (SCH_FIELD*) item, &dc ); break; @@ -768,7 +768,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) SCH_SCREEN* screen = GetScreen(); SCH_ITEM* item = screen->GetCurItem(); - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); if( item == NULL ) { @@ -856,7 +856,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent ) SCH_SCREEN* screen = GetScreen(); SCH_ITEM* item = screen->GetCurItem(); - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); if( item == NULL ) { @@ -889,7 +889,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent ) case SCH_GLOBAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T: case SCH_SHEET_T: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); // The easiest way to handle a drag component or sheet command // is to simulate a block drag command @@ -920,7 +920,7 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent ) SCH_SCREEN* screen = GetScreen(); SCH_ITEM* item = screen->GetCurItem(); - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); if( item == NULL ) { diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index f6876ce002..2daae5cf3f 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -362,7 +362,7 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event ) SetSheetNumberAndCount(); GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -385,5 +385,5 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event ) SetSheetNumberAndCount(); GetScreen()->TestDanglingEnds(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 69f5b1c8f8..a343686c78 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -224,8 +224,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); - if( DrawPanel ) - DrawPanel->m_Block_Enable = true; + if( m_canvas ) + m_canvas->m_Block_Enable = true; ReCreateMenuBar(); ReCreateHToolbar(); @@ -260,8 +260,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() ); - if( DrawPanel ) - m_auimgr.AddPane( DrawPanel, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); + if( m_canvas ) + m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); if( m_messagePanel ) m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom(). @@ -492,7 +492,7 @@ double SCH_EDIT_FRAME::BestZoom() dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; - size = DrawPanel->GetClientSize(); + size = m_canvas->GetClientSize(); // Reserve no margin because best zoom shows the full page // and margins are already included in function that draws the sheet refernces @@ -653,7 +653,7 @@ void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& aEvent ) wxCHECK_RET( m_findReplaceData != NULL, wxT( "Forgot to create find/replace data. Bad Programmer!" ) ); - this->DrawPanel->m_IgnoreMouseEvents = true; + this->GetCanvas()->m_IgnoreMouseEvents = true; if( m_dlgFindReplace ) { @@ -704,7 +704,7 @@ void SCH_EDIT_FRAME::OnFindDialogClose( wxFindDialogEvent& event ) m_dlgFindReplace = NULL; } - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->m_IgnoreMouseEvents = false; } @@ -722,7 +722,7 @@ void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnLoadStuffFile( wxCommandEvent& event ) { ReadInputStuffFile(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -876,7 +876,7 @@ void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData ) { - GetScreen()->Draw( DrawPanel, aDC, GR_DEFAULT_DRAWMODE ); + GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE ); TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness ); } @@ -890,7 +890,7 @@ void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent ) && (index >= 0 && index < m_collectedItems.GetCount()) ) { SCH_ITEM* item = m_collectedItems[index]; - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; GetScreen()->SetCurItem( item ); } } diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 5c1cd57b70..f82c5bfceb 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -163,8 +163,8 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) } } - aSheet->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); - DrawPanel->m_IgnoreMouseEvents = true; + aSheet->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); + m_canvas->m_IgnoreMouseEvents = true; if( isUndoable ) SaveCopyInUndoList( aSheet, UR_CHANGED ); @@ -203,9 +203,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) if( aSheet->GetName().IsEmpty() ) aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; - aSheet->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + aSheet->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); OnModify(); return true; @@ -320,12 +320,12 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC ) // also need to update the hierarchy, if we are adding // a sheet to a screen that already has multiple instances (!) GetScreen()->SetCurItem( sheet ); - DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, false ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, false ); + m_canvas->CrossHairOff( aDC ); GetScreen()->SetCrossHairPosition( sheet->GetResizePosition() ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->CrossHairOn( aDC ); + m_canvas->MoveCursorToCrossHair(); + m_canvas->CrossHairOn( aDC ); return sheet; } @@ -340,16 +340,16 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) wxString::Format( wxT( "Cannot perform sheet resize on %s object." ), GetChars( aSheet->GetClass() ) ) ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); GetScreen()->SetCrossHairPosition( aSheet->GetResizePosition() ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->CrossHairOn( aDC ); + m_canvas->MoveCursorToCrossHair(); + m_canvas->CrossHairOn( aDC ); SetUndoItem( aSheet ); aSheet->SetFlags( IS_RESIZED ); - DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true ); + m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, true ); if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo SetUndoItem( aSheet ); @@ -361,15 +361,15 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) if( ( aSheet == NULL ) || ( aSheet->Type() != SCH_SHEET_T ) ) return; - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); GetScreen()->SetCrossHairPosition( aSheet->GetPosition() ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( !aSheet->IsNew() ) SetUndoItem( aSheet ); aSheet->SetFlags( IS_MOVED ); - DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, true ); + m_canvas->CrossHairOn( aDC ); } diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index 959eadb0d6..f2f36e6b3f 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -75,7 +75,7 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC ) return wxID_CANCEL; if( aDC ) - aSheetPin->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); + aSheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); if( !aSheetPin->IsNew() ) { @@ -89,7 +89,7 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC ) aSheetPin->SetShape( dlg.GetConnectionType() ); if( aDC ) - aSheetPin->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + aSheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); return wxID_OK; } diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index 5fd26b99e8..e6a53f0492 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -94,7 +94,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem ) OnModify( ); DrawItem->DisplayInfo( this ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -123,7 +123,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC ) LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ) { - DrawPanel->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn ); + m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn ); wxPoint drawPos = GetScreen()->GetCrossHairPosition( true ); // no temp copy -> the current version of component will be used for Undo @@ -155,10 +155,10 @@ LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ) Text->m_Orient = m_textOrientation; // Enter the graphic text info - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; EditSymbolText( NULL, Text ); - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); if( Text->m_Text.IsEmpty() ) { @@ -188,16 +188,16 @@ LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ) m_drawItem->SetConvert( m_convert ); // Draw initial symbol: - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } else { - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); return NULL; } - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = FALSE; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = FALSE; return m_drawItem; } @@ -214,7 +214,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC ) if( m_drawItem->ContinueEdit( pos ) ) { - m_drawItem->Draw( DrawPanel, DC, pos, -1, g_XorMode, NULL, DefaultTransform ); + m_drawItem->Draw( m_canvas, DC, pos, -1, g_XorMode, NULL, DefaultTransform ); return; } @@ -262,8 +262,8 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC ) TempCopyComponent(); m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCrossHairPosition( true ) ); - DrawPanel->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true ); + m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, true ); } @@ -275,8 +275,8 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC ) TempCopyComponent(); m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCrossHairPosition( true ) ); - DrawPanel->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true ); + m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, true ); } @@ -308,7 +308,7 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC ) if( GetToolId() != ID_NO_TOOL_SELECTED ) SetCursor( wxCURSOR_PENCIL ); else - SetCursor( DrawPanel->GetDefaultCursor() ); + SetCursor( m_canvas->GetDefaultCursor() ); if( GetTempCopyComponent() ) // used when editing an existing item SaveCopyInUndoList( GetTempCopyComponent() ); @@ -325,6 +325,6 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC ) OnModify(); - DrawPanel->SetMouseCapture( NULL, NULL ); - DrawPanel->Refresh(); + m_canvas->SetMouseCapture( NULL, NULL ); + m_canvas->Refresh(); } diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index bb4dc93f7e..832dcd4c15 100644 --- a/eeschema/symbedit.cpp +++ b/eeschema/symbedit.cpp @@ -57,7 +57,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol() if( m_component == NULL || ( m_drawItem && m_drawItem->GetFlags() ) ) return; - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath(); @@ -69,8 +69,8 @@ void LIB_EDIT_FRAME::LoadOneSymbol() return; GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = FALSE; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = FALSE; wxFileName fn = dlg.GetPath(); wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() ); @@ -126,7 +126,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol() m_component->ClearSelectedItems(); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); delete Lib; } @@ -250,5 +250,5 @@ void LIB_EDIT_FRAME::PlaceAnchor() /* Redraw the symbol */ RedrawScreen( wxPoint( 0 , 0 ), true ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index cf2b0e616b..189d14c15f 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -302,6 +302,7 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar() KiBitmap( lines90_xpm ), _( "HV orientation for wires and bus" ), wxITEM_CHECK ); + // set icon paddings m_optionsToolBar->SetToolBorderPadding(2); // padding m_optionsToolBar->SetToolSeparation(0); @@ -313,7 +314,7 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar() void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { - if( DrawPanel == NULL ) + if( m_canvas == NULL ) return; int id = event.GetId(); @@ -322,7 +323,7 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { case ID_TB_OPTIONS_HIDDEN_PINS: m_showAllPins = m_optionsToolBar->GetToolToggled( id ); - DrawPanel->Refresh( ); + m_canvas->Refresh(); break; case ID_TB_OPTIONS_BUS_WIRES_ORIENT: diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 3f30fe5b2e..29bdbdfef8 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -191,8 +191,8 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph DisplayLibInfos(); - if( DrawPanel ) - DrawPanel->SetAcceleratorTable( table ); + if( m_canvas ) + m_canvas->SetAcceleratorTable( table ); m_auimgr.SetManagedWindow( this ); @@ -227,7 +227,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph Left().Row( 1 ) ); // Manage the draw panel - m_auimgr.AddPane( DrawPanel, + m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre() ); // Manage the message panel @@ -354,7 +354,7 @@ double LIB_VIEW_FRAME::BestZoom() return bestzoom; } - wxSize size = DrawPanel->GetClientSize(); + wxSize size = m_canvas->GetClientSize(); EDA_RECT BoundaryBox = component->GetBoundingBox( m_unit, m_convert ); @@ -407,7 +407,7 @@ void LIB_VIEW_FRAME::ReCreateListLib() ReCreateListCmp(); ReCreateHToolbar(); DisplayLibInfos(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -462,7 +462,7 @@ void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event ) m_libraryName = name; ReCreateListCmp(); - DrawPanel->Refresh(); + m_canvas->Refresh(); DisplayLibInfos(); ReCreateHToolbar(); } @@ -485,7 +485,7 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event ) m_convert = 1; Zoom_Automatique( false ); ReCreateHToolbar(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } } diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index 995cd60c3d..db2e591f3e 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -59,14 +59,14 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true ); m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, FALSE ); m_convert = 1; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT: m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, FALSE ); m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, true ); m_convert = 2; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_LIBVIEW_SELECT_PART_NUMBER: @@ -74,7 +74,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( ii < 0 ) return; m_unit = ii + 1; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; default: @@ -135,7 +135,7 @@ void LIB_VIEW_FRAME::SelectCurrentLibrary() if( m_LibList ) { ReCreateListCmp(); - DrawPanel->Refresh(); + m_canvas->Refresh(); DisplayLibInfos(); ReCreateHToolbar(); int id = m_LibList->FindString( m_libraryName.GetData() ); @@ -232,7 +232,7 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) m_entryName = CmpName; DisplayLibInfos(); Zoom_Automatique( false ); - DrawPanel->Refresh( ); + m_canvas->Refresh( ); if( m_CmpList ) { @@ -269,7 +269,7 @@ void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) component = entry->GetComponent(); - DrawPanel->DrawBackGround( DC ); + m_canvas->DrawBackGround( DC ); if( !entry->IsRoot() ) { @@ -283,6 +283,7 @@ void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) if( m_unit < 1 ) m_unit = 1; + if( m_convert < 1 ) m_convert = 1; } @@ -291,10 +292,10 @@ void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) msg = _( "None" ); } - component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE ); + component->Draw( m_canvas, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE ); /* Redraw the cursor */ - DrawPanel->DrawCrossHair( DC ); + m_canvas->DrawCrossHair( DC ); if( !tmp.IsEmpty() ) component->SetName( tmp ); diff --git a/gerbview/block.cpp b/gerbview/block.cpp index b2576bee03..0c5375cf54 100644 --- a/gerbview/block.cpp +++ b/gerbview/block.cpp @@ -77,23 +77,23 @@ int GERBVIEW_FRAME::ReturnBlockCommand( int key ) void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC ) { - wxASSERT( DrawPanel->IsMouseCaptured() ); + wxASSERT( m_canvas->IsMouseCaptured() ); GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; switch( GetScreen()->m_BlockLocate.m_Command ) { case BLOCK_MOVE: /* Move */ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); Block_Move( DC ); GetScreen()->m_BlockLocate.ClearItemsList(); break; case BLOCK_COPY: /* Copy */ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); Block_Duplicate( DC ); GetScreen()->m_BlockLocate.ClearItemsList(); @@ -116,7 +116,7 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC ) break; } - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, false ); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); GetScreen()->SetModify(); GetScreen()->ClearBlockCommand(); @@ -131,7 +131,7 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC ) bool nextcmd = false; bool zoom_command = false; - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) switch( GetScreen()->m_BlockLocate.m_Command ) { @@ -139,14 +139,14 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC ) case BLOCK_COPY: /* Copy */ GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; nextcmd = true; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); - DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); break; case BLOCK_DELETE: /* Delete */ GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); Block_Delete( DC ); break; @@ -172,8 +172,8 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC ) if( ! nextcmd ) { GetScreen()->ClearBlockCommand(); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, - false ); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, + false ); } if( zoom_command ) @@ -257,10 +257,10 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC ) wxPoint oldpos; oldpos = GetScreen()->GetCrossHairPosition(); - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; GetScreen()->SetCrossHairPosition( oldpos ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); GetScreen()->SetModify(); GetScreen()->m_BlockLocate.Normalize(); @@ -276,7 +276,7 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC ) gerb_item->MoveAB( delta ); } - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } @@ -286,10 +286,10 @@ void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC ) wxPoint oldpos; oldpos = GetScreen()->GetCrossHairPosition(); - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; GetScreen()->SetCrossHairPosition( oldpos ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); GetScreen()->SetModify(); GetScreen()->m_BlockLocate.Normalize(); @@ -297,9 +297,11 @@ void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC ) /* Copy items in block */ BOARD_ITEM* item = GetBoard()->m_Drawings; + for( ; item; item = item->Next() ) { GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item; + if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) ) { /* this item must be duplicated */ @@ -309,5 +311,5 @@ void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC ) } } - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index 4abe922d68..6cddcf3cb0 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -176,7 +176,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) } myframe->GetBoard()->SetVisibleLayers( visibleLayers ); - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); break; } } @@ -188,6 +188,7 @@ void GERBER_LAYER_WIDGET::ReFill() BOARD* brd = myframe->GetBoard(); int layer; ClearLayerRows(); + for( layer = 0; layer < LAYER_COUNT; layer++ ) { wxString msg; @@ -205,7 +206,7 @@ void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor ) { myframe->GetBoard()->SetLayerColor( aLayer, aColor ); myframe->m_SelLayerBox->ResyncBitmapOnly(); - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); } bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer ) @@ -215,8 +216,9 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer ) int layer = myframe->getActiveLayer( ); myframe->setActiveLayer( aLayer, false ); myframe->syncLayerBox(); + if( layer != myframe->getActiveLayer( ) ) - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); return true; } @@ -234,13 +236,13 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin brd->SetVisibleLayers( visibleLayers ); if( isFinal ) - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); } void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, int aColor ) { myframe->GetBoard()->SetVisibleElementColor( aId, aColor ); - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); } void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) @@ -248,7 +250,7 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) BOARD* brd = myframe->GetBoard(); brd->SetElementVisibility( aId, isEnabled ); - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); } //----------------------------------------------- diff --git a/gerbview/controle.cpp b/gerbview/controle.cpp index 9fc8128001..a0f66c734a 100644 --- a/gerbview/controle.cpp +++ b/gerbview/controle.cpp @@ -24,25 +24,25 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH case WXK_NUMPAD8: case WXK_UP: pos.y -= wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD2: case WXK_DOWN: pos.y += wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD4: case WXK_LEFT: pos.x -= wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD6: case WXK_RIGHT: pos.x += wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; default: @@ -55,13 +55,13 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH { pos = GetScreen()->GetCrossHairPosition(); GetScreen()->SetCrossHairPosition( oldpos ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); GetScreen()->SetCrossHairPosition( pos ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); } } diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp index 1efcdf391a..5f14791481 100644 --- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp +++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp @@ -37,8 +37,9 @@ void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event ) { DIALOG_DISPLAY_OPTIONS dlg( this ); int opt = dlg.ShowModal(); + if (opt > 0 ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) : diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index 1b245e972a..eb87c3fabf 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -56,11 +56,11 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, int aPrintMasklayer, DisplayOpt.DisplayZonesMode = 0; g_DisplayPolygonsModeSketch = 0; - DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; + m_canvas->m_PrintIsMirrored = aPrintMirrorMode; - GetBoard()->Draw( DrawPanel, aDC, -1, wxPoint( 0, 0 ) ); + GetBoard()->Draw( m_canvas, aDC, -1, wxPoint( 0, 0 ) ); - DrawPanel->m_PrintIsMirrored = false; + m_canvas->m_PrintIsMirrored = false; // Restore draw options: GetBoard()->SetVisibleLayers( visiblemask ); @@ -96,22 +96,22 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) } // Draw according to the current setting. This needs to be GR_COPY or GR_OR. - GetBoard()->Draw( DrawPanel, DC, drawMode, wxPoint( 0, 0 ) ); + GetBoard()->Draw( m_canvas, DC, drawMode, wxPoint( 0, 0 ) ); // Draw the "background" now, i.e. grid and axis after gerber layers // because most of time the actual background is erased by successive drawings of each gerber // layer mainly in COPY mode - DrawPanel->DrawBackGround( DC ); + m_canvas->DrawBackGround( DC ); if( IsElementVisible( DCODES_VISIBLE ) ) DrawItemsDCodeID( DC, GR_COPY ); TraceWorkSheet( DC, screen, 0 ); - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); - DrawPanel->DrawCrossHair( DC ); + m_canvas->DrawCrossHair( DC ); // Display the filename and the layer name (found in the gerber files, if any) // relative to the active layer @@ -406,7 +406,7 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, int aDrawMode ) int color = g_ColorsSettings.GetItemColor( DCODES_VISIBLE ); - DrawGraphicText( DrawPanel, aDC, pos, (EDA_Colors) color, Line, + DrawGraphicText( m_canvas, aDC, pos, (EDA_Colors) color, Line, orient, wxSize( width, width ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, 0, false, false ); diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 457341bddd..1fcf1a6b59 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -127,7 +127,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_CANCEL_CURRENT_COMMAND: - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE ) { @@ -138,26 +138,28 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) } if( GetToolId() == ID_NO_TOOL_SELECTED ) - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); else - DrawPanel->SetCursor( DrawPanel->GetCurrentCursor() ); + m_canvas->SetCursor( m_canvas->GetCurrentCursor() ); break; default: - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); break; } - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); switch( id ) { case ID_GERBVIEW_SET_PAGE_BORDER: { DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this ); + if (dlg.ShowModal() == wxID_OK ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } + break; case ID_GERBVIEW_GLOBAL_DELETE: @@ -166,11 +168,11 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_NO_TOOL_SELECTED: - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_POPUP_CLOSE_CURRENT_TOOL: - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_POPUP_CANCEL_CURRENT_COMMAND: @@ -182,7 +184,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PLACE_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; - DrawPanel->m_AutoPAN_Request = FALSE; + m_canvas->m_AutoPAN_Request = FALSE; HandleBlockPlace( &dc ); break; @@ -211,13 +213,15 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event ) { GERBER_IMAGE* gerber_image = g_GERBER_List[getActiveLayer()]; + if( gerber_image ) { int tool = m_DCodeSelector->GetSelectedDCodeId(); + if( tool != gerber_image->m_Selected_Tool ) { gerber_image->m_Selected_Tool = tool; - DrawPanel->Refresh(); + m_canvas->Refresh(); } } } @@ -231,8 +235,9 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event ) int layer = getActiveLayer(); setActiveLayer( event.GetSelection() ); + if( layer != getActiveLayer() ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -283,7 +288,7 @@ void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event ) } if( GetDisplayMode() != oldMode ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } void GERBVIEW_FRAME::OnQuit( wxCommandEvent& event ) diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 141eec6d1a..21d531a19e 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -56,18 +56,18 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event ) case ID_GERBVIEW_ERASE_ALL: Clear_Pcb( true ); Zoom_Automatique( false ); - DrawPanel->Refresh(); + m_canvas->Refresh(); ClearMsgPanel(); break; case ID_GERBVIEW_LOAD_DRILL_FILE: LoadExcellonFiles( wxEmptyString ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_GERBVIEW_LOAD_DCODE_FILE: LoadDCodeFile( wxEmptyString ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; default: diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 7e94b641be..956bd56b6c 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -75,8 +75,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, m_displayMode = 0; m_drillFileHistory.SetBaseId( ID_GERBVIEW_DRILL_FILE1 ); - if( DrawPanel ) - DrawPanel->m_Block_Enable = true; + if( m_canvas ) + m_canvas->m_Block_Enable = true; // Give an icon wxIcon icon; @@ -98,7 +98,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, if( screenHeight <= 900 ) pointSize = (pointSize * 8) / 10; - m_LayersManager = new GERBER_LAYER_WIDGET( this, DrawPanel, pointSize ); + m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize ); // LoadSettings() *after* creating m_LayersManager, because LoadSettings() // initialize parameters in m_LayersManager @@ -143,8 +143,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() ); - if( DrawPanel ) - m_auimgr.AddPane( DrawPanel, + if( m_canvas ) + m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); if( m_messagePanel ) @@ -187,7 +187,7 @@ double GERBVIEW_FRAME::BestZoom() bbox.Merge( gerb_item->GetBoundingBox() ); } - wxSize size = DrawPanel->GetClientSize(); + wxSize size = m_canvas->GetClientSize(); double x = (double) bbox.GetWidth() / (double) size.x; double y = (double) bbox.GetHeight() / (double) size.y; diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index 08250ecb60..6e5fe42e07 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -136,15 +136,16 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) break; case HK_SWITCH_GBR_ITEMS_DISPLAY_MODE: - DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1; - DrawPanel->Refresh(); + DisplayOpt.DisplayPcbTrackFill ^= 1; + DisplayOpt.DisplayPcbTrackFill &= 1; + m_canvas->Refresh(); break; case HK_SWITCH_LAYER_TO_PREVIOUS: if( getActiveLayer() > 0 ) { setActiveLayer( getActiveLayer() - 1 ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; @@ -152,7 +153,7 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) if( getActiveLayer() < 31 ) { setActiveLayer( getActiveLayer() + 1 ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; } diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index 93b6b43e10..7042329929 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -110,7 +110,7 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query ) } GetScreen()->SetModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); m_LayersManager->UpdateLayerIcons(); syncLayerBox(); } diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index c347500ac2..a262709c43 100644 --- a/gerbview/onrightclick.cpp +++ b/gerbview/onrightclick.cpp @@ -20,7 +20,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); // Do not initiate a start block validation on menu. - DrawPanel->m_CanStartBlock = -1; + m_canvas->m_CanStartBlock = -1; // Simple location of elements where possible. if( ( DrawStruct == NULL ) || ( DrawStruct->GetFlags() == 0 ) ) diff --git a/gerbview/options.cpp b/gerbview/options.cpp index ed4b977ea1..9bebd0c498 100644 --- a/gerbview/options.cpp +++ b/gerbview/options.cpp @@ -43,7 +43,8 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { DisplayOpt.DisplayPadFill = m_DisplayPadFill = true; } - DrawPanel->Refresh( true ); + + m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_LINES_SKETCH: @@ -57,7 +58,8 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) m_DisplayPcbTrackFill = true; DisplayOpt.DisplayPcbTrackFill = true; } - DrawPanel->Refresh( true ); + + m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH: @@ -65,12 +67,13 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) g_DisplayPolygonsModeSketch = 1; else g_DisplayPolygonsModeSketch = 0; - DrawPanel->Refresh( true ); + + m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_DCODES: SetElementVisibility( DCODES_VISIBLE, state ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); break; case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR: diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index 1f249d822c..ac6b14dd9a 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file class_drawpanel.h: * @brief EDA_DRAW_PANEL class definition. @@ -34,14 +59,13 @@ private: int m_defaultCursor; ///< The default mouse cursor shape id. bool m_showCrossHair; ///< Indicate if cross hair is to be shown. int m_cursorLevel; ///< Index for cursor redraw in XOR mode. + int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit. + int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit. + wxPoint m_CursorStartPos; ///< Used for testing the cursor movement. public: EDA_RECT m_ClipBox; // the clipbox used in screen redraw (usually gives the // visible area in internal units) - wxPoint m_CursorStartPos; // useful in testing the cursor movement - int m_scrollIncrementX; // X axis scroll increment in pixels per unit. - int m_scrollIncrementY; // Y axis scroll increment in pixels per unit. - bool m_AbortRequest; // Flag to abort long commands bool m_AbortEnable; // true if abort button or menu to be displayed diff --git a/include/wxstruct.h b/include/wxstruct.h index 7c7da45e53..da40d8ad1c 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -366,22 +366,22 @@ class EDA_DRAW_FRAME : public EDA_BASE_FRAME ///< Id of active button on the vertical toolbar. int m_toolId; -public: - EDA_DRAW_PANEL* DrawPanel; // Draw area - protected: EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList; int m_LastGridSizeId; bool m_DrawGrid; // hide/Show grid int m_GridColor; // Grid color + /// The area to draw on. + EDA_DRAW_PANEL* m_canvas; + /// Internal units count that is equivalent to 1 inch. Set to 1000 (0.001") for /// schematic drawing and 10000 (0.0001") for PCB drawing. int m_internalUnits; /// Tool ID of previously active draw tool bar button. int m_lastDrawToolId; - // on the vertical toolbar + /// The shape of the KiCad cursor. The default value (0) is the normal cross /// hair cursor. Set to non-zero value to draw the full screen cursor. /// @note This is not the system mouse cursor. @@ -463,6 +463,8 @@ public: int GetInternalUnits() const { return m_internalUnits; } + EDA_DRAW_PANEL* GetCanvas() { return m_canvas; } + virtual wxString GetScreenDesc(); /** diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp index 34dc7faa61..2b757c47b3 100644 --- a/pcbnew/attribut.cpp +++ b/pcbnew/attribut.cpp @@ -51,10 +51,10 @@ void PCB_EDIT_FRAME::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On ) return; OnModify(); - DrawPanel->CrossHairOff( DC ); // Erase cursor shape + m_canvas->CrossHairOff( DC ); // Erase cursor shape track->SetState( TRACK_LOCKED, Flag_On ); - track->Draw( DrawPanel, DC, GR_OR | GR_HIGHLIGHT ); - DrawPanel->CrossHairOn( DC ); // Display cursor shape + track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); + m_canvas->CrossHairOn( DC ); // Display cursor shape track->DisplayInfo( this ); } @@ -68,9 +68,9 @@ void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ) if( (track == NULL ) || (track->Type() == PCB_ZONE_T) ) return; - DrawPanel->CrossHairOff( DC ); // Erase cursor shape + m_canvas->CrossHairOff( DC ); // Erase cursor shape Track = GetBoard()->MarkTrace( track, &nb_segm, NULL, NULL, true ); - DrawTraces( DrawPanel, DC, Track, nb_segm, GR_OR | GR_HIGHLIGHT ); + DrawTraces( m_canvas, DC, Track, nb_segm, GR_OR | GR_HIGHLIGHT ); for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- ) { @@ -79,7 +79,7 @@ void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ) Track = Track->Next(); } - DrawPanel->CrossHairOn( DC ); // Display cursor shape + m_canvas->CrossHairOn( DC ); // Display cursor shape OnModify(); } @@ -103,7 +103,7 @@ void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On ) } } - DrawPanel->CrossHairOff( DC ); // Erase cursor shape + m_canvas->CrossHairOff( DC ); // Erase cursor shape while( Track ) /* Flag change */ { @@ -112,10 +112,10 @@ void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On ) OnModify(); Track->SetState( TRACK_LOCKED, Flag_On ); - Track->Draw( DrawPanel, DC, GR_OR | GR_HIGHLIGHT ); + Track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); Track = Track->Next(); } - DrawPanel->CrossHairOn( DC ); // Display cursor shape + m_canvas->CrossHairOn( DC ); // Display cursor shape OnModify(); } diff --git a/pcbnew/automove.cpp b/pcbnew/automove.cpp index d948e24b93..94349b4045 100644 --- a/pcbnew/automove.cpp +++ b/pcbnew/automove.cpp @@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event ) if( m_mainToolBar == NULL ) return; - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); switch( id ) { @@ -93,15 +93,15 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event ) return; case ID_POPUP_CANCEL_CURRENT_COMMAND: - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc ); + m_canvas->m_endMouseCaptureCallback( m_canvas, &dc ); } break; default: // Abort a current command (if any) - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); break; } @@ -293,7 +293,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) if( newList.GetCount() ) SaveCopyInUndoList( newList, UR_CHANGED ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index 0165f4730f..c97c6706fe 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -117,8 +117,8 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) if( GetBoard()->m_Modules == NULL ) return; - DrawPanel->m_AbortRequest = false; - DrawPanel->m_AbortEnable = true; + m_canvas->m_AbortRequest = false; + m_canvas->m_AbortEnable = true; switch( place_mode ) { @@ -247,7 +247,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) if( Module->m_ModuleStatus & MODULE_to_PLACE ) // Erase from screen { NbModules++; - Module->Draw( DrawPanel, DC, GR_XOR ); + Module->Draw( m_canvas, DC, GR_XOR ); } else { @@ -390,8 +390,8 @@ end_of_tst: GetBoard()->m_Status_Pcb = 0; Compile_Ratsnest( DC, true ); - DrawPanel->ReDraw( DC, true ); - DrawPanel->m_AbortEnable = false; + m_canvas->ReDraw( DC, true ); + m_canvas->m_AbortEnable = false; } @@ -431,7 +431,7 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC ) color = DARKGRAY; } - GRPutPixel( &DrawPanel->m_ClipBox, DC, ox, oy, color ); + GRPutPixel( &m_canvas->m_ClipBox, DC, ox, oy, color ); } } } @@ -680,7 +680,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) } } - DrawModuleOutlines( DrawPanel, aDC, aModule ); + DrawModuleOutlines( m_canvas, aDC, aModule ); mincout = -1.0; SetStatusText( wxT( "Score ??, pos ??" ) ); @@ -690,19 +690,19 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) { wxYield(); - if( DrawPanel->m_AbortRequest ) + if( m_canvas->m_AbortRequest ) { if( IsOK( this, _( "Ok to abort?" ) ) ) return ESC; else - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; } cx = aModule->m_Pos.x; cy = aModule->m_Pos.y; aModule->m_BoundaryBox.SetX( ox + CurrPosition.x ); aModule->m_BoundaryBox.SetY( oy + CurrPosition.y ); - DrawModuleOutlines( DrawPanel, aDC, aModule ); + DrawModuleOutlines( m_canvas, aDC, aModule ); g_Offset_Module.x = cx - CurrPosition.x; CurrPosition.y = bbbox.GetY() - oy; @@ -710,13 +710,13 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) /* Placement on grid. */ CurrPosition.y -= CurrPosition.y % Board.m_GridRouting; - DrawModuleOutlines( DrawPanel, aDC, aModule ); + DrawModuleOutlines( m_canvas, aDC, aModule ); for( ; CurrPosition.y < bbbox.GetBottom() - fy; CurrPosition.y += Board.m_GridRouting ) { /* Erase traces. */ - DrawModuleOutlines( DrawPanel, aDC, aModule ); + DrawModuleOutlines( m_canvas, aDC, aModule ); if( showRat ) Compute_Ratsnest_PlaceModule( aDC ); @@ -726,7 +726,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) aModule->m_BoundaryBox.SetY( oy + CurrPosition.y ); g_Offset_Module.y = cy - CurrPosition.y; - DrawModuleOutlines( DrawPanel, aDC, aModule ); + DrawModuleOutlines( m_canvas, aDC, aModule ); keepOut = TstModuleOnBoard( GetBoard(), aModule, TstOtherSide ); if( keepOut >= 0 ) /* c a d if the module can be placed. */ @@ -757,7 +757,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) } } - DrawModuleOutlines( DrawPanel, aDC, aModule ); /* erasing the last traces */ + DrawModuleOutlines( m_canvas, aDC, aModule ); /* erasing the last traces */ if( showRat ) Compute_Ratsnest_PlaceModule( aDC ); @@ -956,7 +956,7 @@ float PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC ) if( AutoPlaceShowAll ) { - GRLine( &DrawPanel->m_ClipBox, DC, ox, oy, fx, fy, 0, color ); + GRLine( &m_canvas->m_ClipBox, DC, ox, oy, fx, fy, 0, color ); } /* Cost of the ratsnest. */ diff --git a/pcbnew/autorout.cpp b/pcbnew/autorout.cpp index 80d9cd29dc..7b02d43065 100644 --- a/pcbnew/autorout.cpp +++ b/pcbnew/autorout.cpp @@ -173,7 +173,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) /* Construction of the track list for router. */ Build_Work( GetBoard() ); - // DisplayBoard(DrawPanel, DC); + // DisplayBoard(m_canvas, DC); if( Nb_Sides == TWO_SIDES ) Solve( DC, TWO_SIDES ); /* double face */ diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index b64eeb2e3b..943ac7e06a 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -175,7 +175,7 @@ double PCB_BASE_FRAME::BestZoom( void ) dx = bbbox.GetWidth(); dy = bbbox.GetHeight(); - size = DrawPanel->GetClientSize(); + size = m_canvas->GetClientSize(); if( size.x ) ii = (double)(dx + ( size.x / 2) ) / (double) size.x; @@ -201,10 +201,10 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos ) PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen(); - wxClientDC dc( DrawPanel ); + wxClientDC dc( m_canvas ); /* There may be need to reframe the drawing. */ - if( !DrawPanel->IsPointOnDisplay( aPos ) ) + if( !m_canvas->IsPointOnDisplay( aPos ) ) { screen->SetCrossHairPosition( aPos ); RedrawScreen( aPos, true ); @@ -212,10 +212,10 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos ) else { // Put cursor on item position - DrawPanel->CrossHairOff( &dc ); + m_canvas->CrossHairOff( &dc ); screen->SetCrossHairPosition( aPos ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->CrossHairOn( &dc ); + m_canvas->MoveCursorToCrossHair(); + m_canvas->CrossHairOn( &dc ); } } @@ -278,7 +278,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, int layer ) GetScreen()->m_Active_Layer = layer; if( DisplayOpt.ContrastModeDisplay ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -293,7 +293,7 @@ void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent ) void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent ) { m_DisplayPadFill = DisplayOpt.DisplayPadFill = !m_DisplayPadFill; - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -371,7 +371,7 @@ void PCB_BASE_FRAME::ProcessItemSelection( wxCommandEvent& aEvent ) if( id >= ID_POPUP_PCB_ITEM_SELECTION_START && id <= ID_POPUP_PCB_ITEM_SELECTION_END ) { BOARD_ITEM* item = (*m_Collector)[itemNdx]; - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; #if 0 && defined (DEBUG) item->Show( 0, std::cout ); @@ -455,8 +455,8 @@ void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg ) // must do this after the tool has been set, otherwise pad::Draw() does // not show proper color when DisplayOpt.ContrastModeDisplay is true. - if( redraw && DrawPanel) - DrawPanel->Refresh(); + if( redraw && m_canvas) + m_canvas->Refresh(); } diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index 4d97de0ac1..9b97410b5d 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -121,15 +121,15 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title { wxPoint oldpos = parent->GetScreen()->GetCrossHairPosition(); - parent->DrawPanel->m_IgnoreMouseEvents = true; + parent->GetCanvas()->m_IgnoreMouseEvents = true; DIALOG_BLOCK_OPTIONS * dlg = new DIALOG_BLOCK_OPTIONS( parent, title ); int cmd = dlg->ShowModal(); dlg->Destroy(); parent->GetScreen()->SetCrossHairPosition( oldpos ); - parent->DrawPanel->MoveCursorToCrossHair(); - parent->DrawPanel->m_IgnoreMouseEvents = false; + parent->GetCanvas()->MoveCursorToCrossHair(); + parent->GetCanvas()->m_IgnoreMouseEvents = false; return cmd == wxID_OK; } @@ -219,7 +219,7 @@ int PCB_EDIT_FRAME::ReturnBlockCommand( int aKey ) void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) { - if( !DrawPanel->IsMouseCaptured() ) + if( !m_canvas->IsMouseCaptured() ) { DisplayError( this, wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) ); } @@ -234,16 +234,16 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_DRAG: /* Drag */ case BLOCK_MOVE: /* Move */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); Block_Move(); GetScreen()->m_BlockLocate.ClearItemsList(); break; case BLOCK_COPY: /* Copy */ - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); Block_Duplicate(); GetScreen()->m_BlockLocate.ClearItemsList(); @@ -259,7 +259,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) OnModify(); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, false ); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); GetScreen()->ClearBlockCommand(); if( GetScreen()->m_BlockLocate.GetCount() ) @@ -278,8 +278,8 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) // If coming here after cancel block, clean up and exit if( GetScreen()->m_BlockLocate.m_State == STATE_NO_BLOCK ) { - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, - false ); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, + false ); GetScreen()->ClearBlockCommand(); return false; } @@ -293,11 +293,11 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) cancelCmd = true; // undraw block outline - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } else { - DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false ); + DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false ); Block_SelectItems(); // Exit if no items found @@ -306,7 +306,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) } } - if( !cancelCmd && DrawPanel->IsMouseCaptured() ) + if( !cancelCmd && m_canvas->IsMouseCaptured() ) { switch( GetScreen()->m_BlockLocate.m_Command ) { @@ -320,24 +320,24 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; nextcmd = true; - DrawPanel->m_mouseCaptureCallback = drawMovingBlock; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback = drawMovingBlock; + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); break; case BLOCK_DELETE: /* Delete */ - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; Block_Delete(); break; case BLOCK_ROTATE: /* Rotation */ - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; Block_Rotate(); break; case BLOCK_FLIP: /* Flip */ - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; Block_Flip(); break; @@ -357,7 +357,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) // Turn off the redraw block routine now so it is not displayed // with one corner at the new center of the screen - DrawPanel->m_mouseCaptureCallback = NULL; + m_canvas->m_mouseCaptureCallback = NULL; Window_Zoom( GetScreen()->m_BlockLocate ); break; @@ -369,8 +369,8 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) if( ! nextcmd ) { GetScreen()->ClearBlockCommand(); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, - false ); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, + false ); } return nextcmd; @@ -647,7 +647,7 @@ void PCB_EDIT_FRAME::Block_Delete() SaveCopyInUndoList( *itemsList, UR_DELETED ); Compile_Ratsnest( NULL, true ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } @@ -707,7 +707,7 @@ void PCB_EDIT_FRAME::Block_Rotate() SaveCopyInUndoList( *itemsList, UR_ROTATED, centre ); Compile_Ratsnest( NULL, true ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } @@ -768,7 +768,7 @@ void PCB_EDIT_FRAME::Block_Flip() SaveCopyInUndoList( *itemsList, UR_FLIPPED, center ); Compile_Ratsnest( NULL, true ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } @@ -822,7 +822,7 @@ void PCB_EDIT_FRAME::Block_Move() SaveCopyInUndoList( *itemsList, UR_MOVED, MoveVector ); Compile_Ratsnest( NULL, true ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } @@ -937,5 +937,5 @@ void PCB_EDIT_FRAME::Block_Duplicate() SaveCopyInUndoList( newList, UR_NEW ); Compile_Ratsnest( NULL, true ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index ef7c50bae7..e3de67fd99 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -122,13 +122,13 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) { BlockState state = GetScreen()->m_BlockLocate.m_State; CmdBlockType command = GetScreen()->m_BlockLocate.m_Command; - DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC ); + m_canvas->m_endMouseCaptureCallback( m_canvas, DC ); GetScreen()->m_BlockLocate.m_State = state; GetScreen()->m_BlockLocate.m_Command = command; - DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); + m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(), GetScreen()->m_BlockLocate.GetBottom() ) ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } switch( GetScreen()->m_BlockLocate.m_Command ) @@ -146,21 +146,21 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) { nextcmd = true; - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); - DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } break; case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ nextcmd = true; - DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; break; @@ -218,9 +218,9 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) GetScreen()->ClearBlockCommand(); SetCurItem( NULL ); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } return nextcmd; @@ -231,7 +231,7 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) { MODULE* currentModule = GetBoard()->m_Modules; - if( !DrawPanel->IsMouseCaptured() ) + if( !m_canvas->IsMouseCaptured() ) { DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) ); } @@ -249,7 +249,7 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) GetScreen()->m_BlockLocate.ClearItemsList(); SaveCopyInUndoList( currentModule, UR_MODEDIT ); MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.m_MoveVector ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); break; case BLOCK_COPY: /* Copy */ @@ -288,8 +288,8 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; SetCurItem( NULL ); - DrawPanel->EndMouseCapture( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString, false ); - DrawPanel->Refresh( true ); + m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); + m_canvas->Refresh( true ); } diff --git a/pcbnew/board_undo_redo.cpp b/pcbnew/board_undo_redo.cpp index 3b23dfad19..3efc072509 100644 --- a/pcbnew/board_undo_redo.cpp +++ b/pcbnew/board_undo_redo.cpp @@ -662,7 +662,7 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event ) GetScreen()->PushCommandToRedoList( List ); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -690,7 +690,7 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& event ) GetScreen()->PushCommandToUndoList( List ); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 1a699bd949..6012712d05 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -301,7 +301,7 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor ) { myframe->GetBoard()->SetLayerColor( aLayer, aColor ); myframe->ReCreateLayerBox( NULL ); - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); } bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) @@ -311,7 +311,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) myframe->setActiveLayer( aLayer, false ); if(DisplayOpt.ContrastModeDisplay) - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); return true; } @@ -330,13 +330,13 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal brd->SetVisibleLayers( visibleLayers ); if( isFinal ) - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); } void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, int aColor ) { myframe->GetBoard()->SetVisibleElementColor( aId, aColor ); - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); } void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) @@ -365,7 +365,7 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) brd->SetElementVisibility( aId, isEnabled ); } - myframe->DrawPanel->Refresh(); + myframe->GetCanvas()->Refresh(); } //----------------------------------------------- diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 9ad384d210..bd31196f2c 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -451,7 +451,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos ) if( GetBoard() && GetBoard()->m_PcbFrame ) { // Use grid size because it is known - wxRealPoint grid = GetBoard()->m_PcbFrame->DrawPanel->GetGrid(); + wxRealPoint grid = GetBoard()->m_PcbFrame->GetCanvas()->GetGrid(); min_dist = wxRound( MIN( grid.x, grid.y ) ); } #endif @@ -497,7 +497,7 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos ) if( GetBoard() && GetBoard()->m_PcbFrame ) { // Use grid size because it is known - wxRealPoint grid = GetBoard()->m_PcbFrame->DrawPanel->GetGrid(); + wxRealPoint grid = GetBoard()->m_PcbFrame->GetCanvas()->GetGrid(); min_dist = wxRound( MIN( grid.x, grid.y ) ); } #endif diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 7c5c96df72..94d3362277 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -68,7 +68,7 @@ void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC ) CleanupTracks( this, dlg.cleanVias, dlg.mergeSegments, dlg.deleteUnconnectedSegm, dlg.connectToPads ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } @@ -207,7 +207,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ) if( aFrame->GetBoard()->m_Track == NULL ) return; - aFrame->DrawPanel->m_AbortRequest = false; + aFrame->GetCanvas()->m_AbortRequest = false; // correct via m_End defects for( segment = aFrame->GetBoard()->m_Track; segment; segment = next ) @@ -231,7 +231,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ) { next = segment->Next(); - if( aFrame->DrawPanel->m_AbortRequest ) + if( aFrame->GetCanvas()->m_AbortRequest ) break; if( segment->GetNet() != oldnetcode ) @@ -412,7 +412,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) int flag, no_inc; wxString msg; - aFrame->DrawPanel->m_AbortRequest = false; + aFrame->GetCanvas()->m_AbortRequest = false; // Delete null segments for( segment = aFrame->GetBoard()->m_Track; segment; segment = nextsegment ) @@ -475,7 +475,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) nextsegment = segment->Next(); - if( aFrame->DrawPanel->m_AbortRequest ) + if( aFrame->GetCanvas()->m_AbortRequest ) return; if( segment->Type() != PCB_TRACE_T ) @@ -856,13 +856,13 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame ) int nb_new_trace = 0; wxString msg; - aFrame->DrawPanel->m_AbortRequest = false; + aFrame->GetCanvas()->m_AbortRequest = false; for( segment = aFrame->GetBoard()->m_Track; segment; segment = segment->Next() ) { D_PAD* pad; - if( aFrame->DrawPanel->m_AbortRequest ) + if( aFrame->GetCanvas()->m_AbortRequest ) return; pad = aFrame->GetBoard()->GetPad( segment, START ); diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index b7478a12cf..a161e12e49 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -234,18 +234,18 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) * a m_IgnoreMouseEvents++ ) * was not balanced with the -- (now m_IgnoreMouseEvents=false), so I had to revert. * Somebody should track down these and make them balanced. - * DrawPanel->m_IgnoreMouseEvents = true; + * m_canvas->m_IgnoreMouseEvents = true; */ // this menu's handler is void PCB_BASE_FRAME::ProcessItemSelection() // and it calls SetCurItem() which in turn calls DisplayInfo() on the item. - DrawPanel->m_AbortRequest = true; // changed in false if an item is selected + m_canvas->m_AbortRequest = true; // changed in false if an item is selected PopupMenu( &itemMenu ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); // The function ProcessItemSelection() has set the current item, return it. - if( DrawPanel->m_AbortRequest ) // Nothing selected + if( m_canvas->m_AbortRequest ) // Nothing selected item = NULL; else item = GetCurItem(); @@ -270,25 +270,25 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH case WXK_NUMPAD8: case WXK_UP: pos.y -= wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD2: case WXK_DOWN: pos.y += wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD4: case WXK_LEFT: pos.x -= wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD6: case WXK_RIGHT: pos.x += wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; default: @@ -345,23 +345,25 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH { pos = GetScreen()->GetCrossHairPosition(); GetScreen()->SetCrossHairPosition( oldpos, false ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); GetScreen()->SetCrossHairPosition( pos, false ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { #ifdef USE_WX_OVERLAY - wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); + wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC ); oDC.Clear(); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false ); #else - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); #endif } #ifdef USE_WX_OVERLAY else - DrawPanel->m_overlay.Reset(); + { + m_canvas->m_overlay.Reset(); + } #endif } diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index 1e35528b71..f0e65c4330 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -57,7 +57,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) D( g_CurrentTrackList.VerifyListIntegrity(); ) // Delete the current trace - ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false ); + ShowNewTrackWhenMovingCursor( m_canvas, DC, wxDefaultPosition, false ); // delete the most recently entered delete g_CurrentTrackList.PopBack(); @@ -100,7 +100,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) if( g_CurrentTrackList.GetCount() == 0 ) { - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); if( GetBoard()->IsHighLightNetON() ) HighLight( DC ); @@ -110,8 +110,8 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) } else { - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); return g_CurrentTrackSegment; } @@ -126,7 +126,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) container->Remove( aTrack ); // redraw the area where the track was - DrawPanel->RefreshDrawingRect( aTrack->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( aTrack->GetBoundingBox() ); SaveCopyInUndoList( aTrack, UR_DELETED ); OnModify(); @@ -176,7 +176,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack ) GetBoard()->m_Track.Remove( segm ); // redraw the area where the track was - DrawPanel->RefreshDrawingRect( segm->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( segm->GetBoundingBox() ); picker.m_PickedItem = segm; picker.m_PickedItemType = segm->Type(); itemsList.PushItem( picker ); @@ -225,7 +225,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm ) GetBoard()->m_Track.Remove( tracksegment ); // redraw the area where the track was - DrawPanel->RefreshDrawingRect( tracksegment->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( tracksegment->GetBoundingBox() ); picker.m_PickedItem = tracksegment; picker.m_PickedItemType = tracksegment->Type(); itemsList.PushItem( picker ); diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index 9ea68f7712..05254a9f40 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -245,7 +245,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, screen->SetScalingFactor( 1.0 ); float dpi = (float)m_Parent->GetInternalUnits(); - EDA_DRAW_PANEL* panel = m_Parent->DrawPanel; + EDA_DRAW_PANEL* panel = m_Parent->GetCanvas(); SetLocaleTo_C_standard(); // Switch the locale to standard C (needed // to print floating point numbers like 1.3) diff --git a/pcbnew/dialogs/dialog_display_options.cpp b/pcbnew/dialogs/dialog_display_options.cpp index faec7c714f..60725bad40 100644 --- a/pcbnew/dialogs/dialog_display_options.cpp +++ b/pcbnew/dialogs/dialog_display_options.cpp @@ -165,7 +165,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event) DisplayOpt.DisplayDrawItems = m_OptDisplayDrawings->GetSelection(); DisplayOpt.DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection(); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); EndModal( 1 ); } diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 0803bea006..e375a49747 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -556,13 +556,11 @@ void DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent( wxCommandEvent& event ) void DIALOG_DRC_CONTROL::RedrawDrawPanel() { - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } -/*********************************************************/ void DIALOG_DRC_CONTROL::DelDRCMarkers() -/*********************************************************/ { m_Parent->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker m_ClearanceListBox->DeleteAllItems(); @@ -611,6 +609,7 @@ void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event ) if( curTab == 0 ) { selectedIndex = m_ClearanceListBox->GetSelection(); + if( selectedIndex != wxNOT_FOUND ) { m_ClearanceListBox->DeleteItem( selectedIndex ); @@ -622,6 +621,7 @@ void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event ) else if( curTab == 1 ) { selectedIndex = m_UnconnectedListBox->GetSelection(); + if( selectedIndex != wxNOT_FOUND ) { m_UnconnectedListBox->DeleteItem( selectedIndex ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index cbeecfbc55..314dd7af15 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -457,8 +457,8 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) if( m_DC ) { - m_Parent->DrawPanel->CrossHairOff( m_DC ); - m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); + m_Parent->GetCanvas()->CrossHairOff( m_DC ); + m_CurrentModule->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); } // Initialize masks clearances @@ -475,8 +475,10 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) // A margin ratio de -50% means no paste on a pad, the ratio must be >= 50% if( dtmp < -50 ) dtmp = -50; + if( dtmp > +100 ) dtmp = +100; + m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100; // Set Module Position @@ -518,6 +520,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) long orient = 0; msg = m_OrientValue->GetValue(); msg.ToLong( &orient ); + if( m_CurrentModule->m_Orient != orient ) m_CurrentModule->Rotate( m_CurrentModule->m_Pos, orient - m_CurrentModule->m_Orient ); @@ -537,14 +540,19 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) /* Update 3D shape list */ int ii = m_3D_ShapeNameListBox->GetSelection(); + if( ii >= 0 ) TransfertDisplayTo3DValues( ii ); + S3D_MASTER* draw3D = m_CurrentModule->m_3D_Drawings; + for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ ) { S3D_MASTER* draw3DCopy = m_Shapes3D_list[ii]; + if( draw3DCopy->m_Shape3DName.IsEmpty() ) continue; + if( draw3D == NULL ) { draw3D = new S3D_MASTER( draw3D ); @@ -561,6 +569,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) // Remove old extra 3D shapes S3D_MASTER* nextdraw3D; + for( ; draw3D != NULL; draw3D = nextdraw3D ) { nextdraw3D = (S3D_MASTER*) draw3D->Next(); @@ -580,8 +589,8 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) if( m_DC ) { - m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); - m_Parent->DrawPanel->CrossHairOn( m_DC ); + m_CurrentModule->Draw( m_Parent->GetCanvas(), m_DC, GR_OR ); + m_Parent->GetCanvas()->CrossHairOn( m_DC ); } } diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index 4f201ceef8..359dd23b16 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -45,14 +45,13 @@ private: void OnCancelClick( wxCommandEvent& event ); }; -/*************************************************************************************/ + void PCB_BASE_FRAME::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC ) -/**************************************************************************************/ { - DrawPanel->m_IgnoreMouseEvents = TRUE; + m_canvas->m_IgnoreMouseEvents = TRUE; DialogEditModuleText dialog( this, TextMod, DC ); dialog.ShowModal(); - DrawPanel->m_IgnoreMouseEvents = FALSE; + m_canvas->m_IgnoreMouseEvents = FALSE; } @@ -85,9 +84,7 @@ void DialogEditModuleText::OnCancelClick( wxCommandEvent& event ) } -/********************************************************/ void DialogEditModuleText::initDlg( ) -/********************************************************/ { SetFocus(); @@ -97,13 +94,14 @@ void DialogEditModuleText::initDlg( ) { wxString format = m_ModuleInfoText->GetLabel(); msg.Printf( format, - GetChars( m_module->m_Reference->m_Text ), - GetChars( m_module->m_Value->m_Text ), - (float) m_module->m_Orient / 10 ); + GetChars( m_module->m_Reference->m_Text ), + GetChars( m_module->m_Value->m_Text ), + (float) m_module->m_Orient / 10 ); } - else + { msg.Empty(); + } m_ModuleInfoText->SetLabel( msg ); @@ -141,6 +139,7 @@ void DialogEditModuleText::initDlg( ) int text_orient = m_currentText->m_Orient; NORMALIZE_ANGLE_90(text_orient) + if( (text_orient != 0) ) m_Orient->SetSelection( 1 ); @@ -149,17 +148,16 @@ void DialogEditModuleText::initDlg( ) } -/*********************************************************************************/ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) -/*********************************************************************************/ { wxString msg; if ( m_module) m_parent->SaveCopyInUndoList( m_module, UR_CHANGED ); + if( m_dc ) //Erase old text on screen { - m_currentText->Draw( m_parent->DrawPanel, m_dc, GR_XOR, + m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR, (m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) ); } m_currentText->m_Text = m_Name->GetValue(); @@ -195,12 +193,16 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) // Test for a reasonnable width: if( width <= 1 ) width = 1; + int maxthickness = Clamp_Text_PenSize(width, m_currentText->m_Size ); + if( width > maxthickness ) { - DisplayError(NULL, _("The text thickness is too large for the text size. It will be clamped")); + DisplayError( NULL, + _( "The text thickness is too large for the text size. It will be clamped" ) ); width = maxthickness; } + m_currentText->SetThickness( width ); m_currentText->SetVisible( m_Show->GetSelection() == 0 ); @@ -209,9 +211,10 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) m_currentText->m_Orient = text_orient; m_currentText->SetDrawCoord(); + if( m_dc ) // Display new text { - m_currentText->Draw( m_parent->DrawPanel, m_dc, GR_XOR, + m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR, (m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) ); } diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index 59c87f76d1..4be3c567cd 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -88,7 +88,7 @@ void Dialog_GeneralOptions::init() m_TrackAutodel->SetValue( g_AutoDeleteOldTrack ); m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); - m_AutoPANOpt->SetValue( GetParent()->DrawPanel->m_AutoPAN_Enable ); + m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->m_AutoPAN_Enable ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); @@ -126,14 +126,14 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() ) { GetParent()->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() ); - GetParent()->DrawPanel->Refresh( ); + GetParent()->GetCanvas()->Refresh( ); } g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); g_AutoDeleteOldTrack = m_TrackAutodel->GetValue(); Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue(); - GetParent()->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); + GetParent()->GetCanvas()->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue(); g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection(); @@ -159,9 +159,9 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) if( GetToolId() == ID_TRACK_BUTT ) { if( Drc_On ) - DrawPanel->SetCursor( wxCURSOR_PENCIL ); + m_canvas->SetCursor( wxCURSOR_PENCIL ); else - DrawPanel->SetCursor( wxCURSOR_QUESTION_ARROW ); + m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW ); } break; @@ -174,7 +174,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) Compile_Ratsnest( NULL, true ); } - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST: @@ -187,32 +187,32 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) case ID_TB_OPTIONS_SHOW_ZONES: DisplayOpt.DisplayZonesMode = 0; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_TB_OPTIONS_SHOW_ZONES_DISABLE: DisplayOpt.DisplayZonesMode = 1; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY: DisplayOpt.DisplayZonesMode = 2; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH: m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = !state; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: DisplayOpt.ContrastModeDisplay = state; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE: diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index b5838b4cbf..1906a578fd 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -145,7 +145,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) m_Parent->Compile_Ratsnest( NULL, true ); } - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); m_Parent->OnModify(); EndModal( 1 ); diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp index f9ac29a994..6ee9556fa3 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp @@ -200,8 +200,9 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event ) } EndModal( 1 ); + if( change ) - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 6cb8513770..34f5d9994b 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -70,12 +70,13 @@ void PCB_EDIT_FRAME::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxD DisplayError(this, wxT("InstallGraphicItemPropertiesDialog() error: NULL item")); return; } - DrawPanel->m_IgnoreMouseEvents = TRUE; + + m_canvas->m_IgnoreMouseEvents = TRUE; DialogGraphicItemProperties* dialog = new DialogGraphicItemProperties( this, - aItem, aDC ); + aItem, aDC ); dialog->ShowModal(); dialog->Destroy(); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = FALSE; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = FALSE; } /**************************************************************************/ @@ -188,8 +189,9 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) m_Parent->SaveCopyInUndoList( m_Item, UR_CHANGED ); wxString msg; + if( m_DC ) - m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); + m_Item->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); msg = m_Center_StartXCtrl->GetValue(); m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() )); @@ -225,8 +227,10 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) } m_Parent->OnModify(); + if( m_DC ) - m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); + m_Item->Draw( m_Parent->GetCanvas(), m_DC, GR_OR ); + m_Item->DisplayInfo( m_Parent ); m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings ); diff --git a/pcbnew/dialogs/dialog_orient_footprints.cpp b/pcbnew/dialogs/dialog_orient_footprints.cpp index 1e5dc148eb..2cafc222bc 100644 --- a/pcbnew/dialogs/dialog_orient_footprints.cpp +++ b/pcbnew/dialogs/dialog_orient_footprints.cpp @@ -102,9 +102,10 @@ void PCB_EDIT_FRAME::OnOrientFootprints( wxCommandEvent& event ) return; wxString text = dlg.GetFilter(); + if( ReOrientModules( text, dlg.GetOrientation(), dlg.ApplyToLockedModules() ) ) { - DrawPanel->Refresh(); + m_canvas->Refresh(); Compile_Ratsnest( NULL, true ); } } diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 99e813889d..f6d02fdab2 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -600,7 +600,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) // redraw the area where the pad was, without pad (delete pad on screen) m_CurrentPad->SetFlags( DO_NOT_DRAW ); - m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() ); + m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() ); m_CurrentPad->ClearFlags( DO_NOT_DRAW ); // Update values @@ -673,7 +673,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) m_CurrentPad->DisplayInfo( m_Parent ); // redraw the area where the pad was - m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() ); + m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() ); m_Parent->OnModify(); } diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index c57eb9c0b5..e11caf3e62 100644 --- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp @@ -68,11 +68,11 @@ DIALOG_PCB_TEXT_PROPERTIES::DIALOG_PCB_TEXT_PROPERTIES( PCB_EDIT_FRAME* parent, */ void PCB_EDIT_FRAME::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ) { - DrawPanel->m_IgnoreMouseEvents = TRUE; + m_canvas->m_IgnoreMouseEvents = TRUE; DIALOG_PCB_TEXT_PROPERTIES dlg( this, TextPCB, DC ); dlg.ShowModal(); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = FALSE; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = FALSE; } @@ -102,6 +102,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit() m_Parent->GetInternalUnits() ); int enabledLayers = m_Parent->GetBoard()->GetEnabledLayers(); + for( int layer = 0; layer < NB_LAYERS; ++layer ) { if( enabledLayers & (1 << layer) ) @@ -109,6 +110,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit() layerList.push_back( layer ); int itemIndex = m_LayerSelectionCtrl->Append( m_Parent->GetBoard()->GetLayerName( layer ) ); + if( m_SelectedPCBText->GetLayer() == layer ) m_LayerSelectionCtrl->SetSelection( itemIndex ); } @@ -119,14 +121,17 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit() default: m_OrientationCtrl->SetSelection( 0 ); break; + case 900: case -2700: m_OrientationCtrl->SetSelection( 1 ); break; + case 1800: case -1800: m_OrientationCtrl->SetSelection( 2 ); break; + case 2700: case -900: m_OrientationCtrl->SetSelection( 3 ); @@ -185,7 +190,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) // Erase old text on screen if context is available if( m_DC ) { - m_SelectedPCBText->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); + m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); } // Set the new text content @@ -195,32 +200,45 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) } // Set PCB Text position - newPosition.x = ReturnValueFromString( g_UserUnit, m_PositionXCtrl->GetValue(), m_Parent->GetInternalUnits() ); - newPosition.y = ReturnValueFromString( g_UserUnit, m_PositionYCtrl->GetValue(), m_Parent->GetInternalUnits() ); + newPosition.x = ReturnValueFromString( g_UserUnit, m_PositionXCtrl->GetValue(), + m_Parent->GetInternalUnits() ); + newPosition.y = ReturnValueFromString( g_UserUnit, m_PositionYCtrl->GetValue(), + m_Parent->GetInternalUnits() ); m_SelectedPCBText->m_Pos = newPosition; // Check constraints and set PCB Text size - newSize.x = ReturnValueFromString( g_UserUnit, m_SizeXCtrl->GetValue(), m_Parent->GetInternalUnits() ); - newSize.y = ReturnValueFromString( g_UserUnit, m_SizeYCtrl->GetValue(), m_Parent->GetInternalUnits() ); + newSize.x = ReturnValueFromString( g_UserUnit, m_SizeXCtrl->GetValue(), + m_Parent->GetInternalUnits() ); + newSize.y = ReturnValueFromString( g_UserUnit, m_SizeYCtrl->GetValue(), + m_Parent->GetInternalUnits() ); if( newSize.x < TEXTS_MIN_SIZE ) newSize.x = TEXTS_MIN_SIZE; + if( newSize.y < TEXTS_MIN_SIZE ) newSize.y = TEXTS_MIN_SIZE; + if( newSize.x > TEXTS_MAX_WIDTH ) newSize.x = TEXTS_MAX_WIDTH; + if( newSize.y > TEXTS_MAX_WIDTH ) newSize.y = TEXTS_MAX_WIDTH; + m_SelectedPCBText->m_Size = newSize; // Set the new thickness - m_SelectedPCBText->m_Thickness = ReturnValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue(), m_Parent->GetInternalUnits() ); + m_SelectedPCBText->m_Thickness = ReturnValueFromString( g_UserUnit, + m_ThicknessCtrl->GetValue(), + m_Parent->GetInternalUnits() ); // Test for acceptable values for thickness and size and clamp if fails - int maxthickness = Clamp_Text_PenSize( m_SelectedPCBText->m_Thickness, m_SelectedPCBText->m_Size ); + int maxthickness = Clamp_Text_PenSize( m_SelectedPCBText->m_Thickness, + m_SelectedPCBText->m_Size ); + if( m_SelectedPCBText->m_Thickness > maxthickness ) { - DisplayError(NULL, _("The text thickness is too large for the text size. It will be clamped")); + DisplayError( NULL, + _( "The text thickness is too large for the text size. It will be clamped" ) ); m_SelectedPCBText->m_Thickness = maxthickness; } @@ -255,8 +273,9 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) // Finally, display new text if there is a context to do so if( m_DC ) { - m_SelectedPCBText->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); + m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_OR ); } + m_Parent->OnModify(); EndModal( 1 ); } diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index cd1b5bf811..a2097da7d6 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -134,7 +134,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) { if( m_DC ) // Delete old text. { - CurrentDimension->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); + CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); } m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED); @@ -184,7 +184,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) if( m_DC ) // Display new text { - CurrentDimension->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); + CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_OR ); } m_Parent->OnModify(); @@ -262,9 +262,9 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC ) aDimension->AdjustDimensionDetails( ); - aDimension->Draw( DrawPanel, aDC, GR_XOR ); + aDimension->Draw( m_canvas, aDC, GR_XOR ); - DrawPanel->SetMouseCapture( BuildDimension, AbortBuildDimension ); + m_canvas->SetMouseCapture( BuildDimension, AbortBuildDimension ); return aDimension; } @@ -275,7 +275,7 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC ) return aDimension; } - aDimension->Draw( DrawPanel, aDC, GR_OR ); + aDimension->Draw( m_canvas, aDC, GR_OR ); aDimension->ClearFlags(); /* ADD this new item in list */ @@ -285,7 +285,7 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC ) SaveCopyInUndoList( aDimension, UR_NEW ); OnModify(); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); return NULL; } @@ -361,7 +361,7 @@ void PCB_EDIT_FRAME::DeleteDimension( DIMENSION* aDimension, wxDC* aDC ) return; if( aDC ) - aDimension->Draw( DrawPanel, aDC, GR_XOR ); + aDimension->Draw( m_canvas, aDC, GR_XOR ); SaveCopyInUndoList( aDimension, UR_DELETED ); aDimension->UnLink(); @@ -379,16 +379,16 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC ) // Store the initial position for undo/abort command initialTextPosition = aItem->m_Text.m_Pos; - aItem->Draw( DrawPanel, DC, GR_XOR ); + aItem->Draw( m_canvas, DC, GR_XOR ); aItem->SetFlags( IS_MOVED ); aItem->DisplayInfo( this ); GetScreen()->SetCrossHairPosition( aItem->m_Text.m_Pos ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); - DrawPanel->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText ); + m_canvas->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText ); SetCurItem( aItem ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } @@ -435,13 +435,13 @@ void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) */ void PCB_EDIT_FRAME::PlaceDimensionText( DIMENSION* aItem, wxDC* DC ) { - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); if( aItem == NULL ) return; - aItem->Draw( DrawPanel, DC, GR_OR ); + aItem->Draw( m_canvas, DC, GR_OR ); OnModify(); EXCHG( aItem->m_Text.m_Pos, initialTextPosition ); diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 2f99cdfc3c..3c17c76976 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -501,7 +501,7 @@ void DRC::testUnconnected() { if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 ) { - wxClientDC dc( m_mainWindow->DrawPanel ); + wxClientDC dc( m_mainWindow->GetCanvas() ); m_mainWindow->Compile_Ratsnest( &dc, true ); } diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index 2d6cb3b88d..0d65e350a3 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -39,13 +39,13 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) if( Edge == NULL ) return; - Edge->Draw( DrawPanel, DC, GR_XOR ); + Edge->Draw( m_canvas, DC, GR_XOR ); Edge->SetFlags( IS_MOVED ); MoveVector.x = MoveVector.y = 0; CursorInitialPosition = GetScreen()->GetCrossHairPosition(); - DrawPanel->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline ); + m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline ); SetCurItem( Edge ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } @@ -61,14 +61,14 @@ void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* aEdge ) aEdge->SetEnd0( aEdge->GetEnd0() - MoveVector ); aEdge->ClearFlags(); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); OnModify(); MODULE* module = (MODULE*) aEdge->GetParent(); module->CalculateBoundingBox(); - DrawPanel->Refresh( ); + m_canvas->Refresh( ); } @@ -337,7 +337,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge, Edge->m_End0 = Edge->m_Start0; module->CalculateBoundingBox(); - DrawPanel->SetMouseCapture( ShowNewEdgeModule, Abort_Move_ModuleOutline ); + m_canvas->SetMouseCapture( ShowNewEdgeModule, Abort_Move_ModuleOutline ); } /* Segment creation in progress. * The ending coordinate is updated by the function @@ -350,7 +350,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge, { if( Edge->m_Start0 != Edge->m_End0 ) { - Edge->Draw( DrawPanel, DC, GR_OR ); + Edge->Draw( m_canvas, DC, GR_OR ); EDGE_MODULE* newedge = new EDGE_MODULE( module ); newedge->Copy( Edge ); @@ -408,5 +408,5 @@ void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge ) Module->CalculateBoundingBox(); Module->m_LastEdit_Time = time( NULL ); OnModify(); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 81b16dfa9d..f50e8e9a0e 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -62,10 +62,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) wxPoint pos; int itmp; - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); MODULE* module; - DrawPanel->CrossHairOff( &dc ); + m_canvas->CrossHairOff( &dc ); wxGetMousePosition( &pos.x, &pos.y ); @@ -143,9 +143,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_CANCEL_CURRENT_COMMAND: - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { - DrawPanel->EndMouseCapture(); + m_canvas->EndMouseCapture(); } /* Should not be executed, just in case */ @@ -157,22 +157,22 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } if( GetToolId() == ID_NO_TOOL_SELECTED ) - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); else - SetCursor( DrawPanel->GetDefaultCursor() ); + SetCursor( m_canvas->GetDefaultCursor() ); break; default: // Finish (abort) the command - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_endMouseCaptureCallback( m_canvas, &dc ); if( GetToolId() != id ) { if( m_lastDrawToolId != GetToolId() ) m_lastDrawToolId = GetToolId(); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); } break; } @@ -213,14 +213,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PLACE_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; HandleBlockPlace( &dc ); break; case ID_POPUP_COPY_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.SetMessageBlock( this ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; HandleBlockPlace( &dc ); break; @@ -267,14 +267,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_CLOSE_CURRENT_TOOL: - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_POPUP_CANCEL_CURRENT_COMMAND: break; case ID_POPUP_PCB_END_LINE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); // EndSegment(&dc); break; @@ -283,7 +283,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( GetCurItem() == NULL ) break; Edit_Track_Width( &dc, (TRACK*) GetCurItem() ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); OnModify(); break; @@ -291,7 +291,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( GetCurItem() == NULL ) break; Edit_TrackSegm_Width( &dc, (TRACK*) GetCurItem() ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); OnModify(); break; @@ -309,16 +309,16 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } } - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_END_TRACK: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); End_Route( (TRACK*) GetCurItem(), &dc ); break; case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( GetCurItem()->IsDragging() ) { @@ -332,13 +332,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) * switch from _/ to -\ . * If a track is in progress, it will be redrawn */ - if( DrawPanel->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) - ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false ); + if( m_canvas->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) + ShowNewTrackWhenMovingCursor( m_canvas, &dc, wxDefaultPosition, false ); g_Alternate_Track_Posture = !g_Alternate_Track_Posture; - if( DrawPanel->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) - ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false ); + if( m_canvas->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) + ShowNewTrackWhenMovingCursor( m_canvas, &dc, wxDefaultPosition, false ); break; @@ -347,7 +347,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_PLACE_VIA: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( GetCurItem()->IsDragging() ) { @@ -365,7 +365,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) GetBoard()->GetDesignSettings().m_CurrentViaType = v_type; if( DisplayOpt.ContrastModeDisplay ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; @@ -373,7 +373,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( GetCurItem() == NULL ) break; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) ); OnModify(); break; @@ -381,14 +381,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_DELETE_TRACK: if( GetCurItem() == NULL ) break; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Delete_Track( &dc, (TRACK*) GetCurItem() ); SetCurItem( NULL ); OnModify(); break; case ID_POPUP_PCB_DELETE_TRACKNET: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Delete_net( &dc, (TRACK*) GetCurItem() ); SetCurItem( NULL ); OnModify(); @@ -422,7 +422,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_DELETE_ZONE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( GetCurItem() == NULL ) break; @@ -444,20 +444,20 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE: - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_AutoPAN_Request = true; Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() ); break; case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE: - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_AutoPAN_Request = true; Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() ); break; case ID_POPUP_PCB_DELETE_ZONE_CONTAINER: case ID_POPUP_PCB_DELETE_ZONE_CUTOUT: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); { int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet(); Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() ); @@ -474,34 +474,34 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_MOVE_ZONE_CORNER: { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, false ); break; } case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT: { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->m_CornerSelection ); break; } case ID_POPUP_PCB_MOVE_ZONE_OUTLINES: { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; Start_Move_Zone_Outlines( &dc, zone_cont ); break; } case ID_POPUP_PCB_ADD_ZONE_CORNER: { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); wxPoint pos = GetScreen()->GetCrossHairPosition(); @@ -509,11 +509,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) * and zone_cont->m_CornerSelection+1 * and start move the new corner */ - zone_cont->Draw( DrawPanel, &dc, GR_XOR ); + zone_cont->Draw( m_canvas, &dc, GR_XOR ); zone_cont->m_Poly->InsertCorner( zone_cont->m_CornerSelection, pos.x, pos.y ); zone_cont->m_CornerSelection++; - zone_cont->Draw( DrawPanel, &dc, GR_XOR ); - DrawPanel->m_AutoPAN_Request = true; + zone_cont->Draw( m_canvas, &dc, GR_XOR ); + m_canvas->m_AutoPAN_Request = true; Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, true ); break; } @@ -521,17 +521,17 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: case ID_POPUP_PCB_PLACE_ZONE_CORNER: { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; break; } case ID_POPUP_PCB_FILL_ALL_ZONES: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Fill_All_Zones( this ); - DrawPanel->Refresh(); + m_canvas->Refresh(); GetBoard()->DisplayInfo( this ); break; @@ -543,7 +543,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) TestNetConnection( NULL, zone_container->GetNet() ); OnModify(); GetBoard()->DisplayInfo( this ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } SetCurItem( NULL ); break; @@ -563,20 +563,20 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) TestForActiveLinksInRatsnest( 0 ); // Recalculate the active ratsnest, i.e. the unconnected links OnModify(); GetBoard()->DisplayInfo( this ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_POPUP_PCB_FILL_ZONE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Fill_Zone( (ZONE_CONTAINER*) GetCurItem() ); TestNetConnection( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() ); GetBoard()->DisplayInfo( this ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST: StartMoveTextePcb( (TEXTE_PCB*) GetCurItem(), &dc ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; break; case ID_POPUP_PCB_DRAG_MODULE_REQUEST: @@ -609,7 +609,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SendMessageToEESCHEMA( module ); GetScreen()->SetCrossHairPosition( module->m_Pos ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMove_Module( module, &dc ); break; @@ -630,12 +630,12 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } SendMessageToEESCHEMA( module ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMove_Module( module, &dc ); break; case ID_POPUP_PCB_DELETE_MODULE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); // If the current Item is a pad, text module ...: Get its parent if( GetCurItem()->Type() != PCB_MODULE_T ) @@ -663,7 +663,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); // If the current Item is a pad, text module ...: Get its parent if( GetCurItem()->Type() != PCB_MODULE_T ) @@ -691,7 +691,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); // If the current Item is a pad, text module ...: Get its parent if( GetCurItem()->Type() != PCB_MODULE_T ) @@ -720,7 +720,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_CHANGE_SIDE_MODULE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); // If the current Item is a pad, text module ...: Get its parent if( GetCurItem()->Type() != PCB_MODULE_T ) @@ -757,7 +757,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_DRAG_PAD_REQUEST: @@ -776,7 +776,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } g_Drag_Pistes_On = true; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMovePad( (D_PAD*) GetCurItem(), &dc ); break; @@ -796,28 +796,28 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } g_Drag_Pistes_On = false; - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMovePad( (D_PAD*) GetCurItem(), &dc ); break; case ID_POPUP_PCB_EDIT_PAD: InstallPadOptionsFrame( (D_PAD*) GetCurItem() ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED ); Import_Pad_Settings( (D_PAD*) GetCurItem(), true ); break; case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Global_Import_Pad_Settings( (D_PAD*) GetCurItem(), true ); break; case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Export_Pad_Settings( (D_PAD*) GetCurItem() ); break; @@ -825,12 +825,12 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED ); DeletePad( (D_PAD*) GetCurItem() ); SetCurItem( NULL ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_EDIT_TEXTMODULE: InstallTextModOptionsFrame( (TEXTE_MODULE*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_RESET_TEXT_SIZE: @@ -838,20 +838,20 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMoveTexteModule( (TEXTE_MODULE*) GetCurItem(), &dc ); break; case ID_POPUP_PCB_ROTATE_TEXTMODULE: RotateTextModule( (TEXTE_MODULE*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_DELETE_TEXTMODULE: DeleteTextModule( (TEXTE_MODULE*) GetCurItem() ); SetCurItem( NULL ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_SELECT_LAYER: @@ -860,7 +860,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( itmp >= 0 ) setActiveLayer( itmp ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: @@ -873,7 +873,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( itmp >= 0 ) setActiveLayer( itmp ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_SELECT_CU_LAYER: @@ -886,57 +886,57 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_SELECT_LAYER_PAIR: SelectLayerPair(); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_TOOLBARH_PCB_SELECT_LAYER: setActiveLayer( (size_t) m_SelLayerBox->GetLayerSelection()); if( DisplayOpt.ContrastModeDisplay ) - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); break; case ID_POPUP_PCB_EDIT_TEXTEPCB: InstallTextPCBOptionsFrame( (TEXTE_PCB*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_ROTATE_TEXTEPCB: Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_DELETE_TEXTEPCB: Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_MOVE_MIRE_REQUEST: BeginMoveTarget( (PCB_TARGET*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_EDIT_MIRE: ShowTargetOptionsDialog( (PCB_TARGET*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_DELETE_MIRE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); DeleteTarget( (PCB_TARGET*) GetCurItem(), &dc ); SetCurItem( NULL ); break; case ID_POPUP_PCB_DELETE_DIMENSION: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); DeleteDimension( (DIMENSION*) GetCurItem(), &dc ); SetCurItem( NULL ); break; case ID_POPUP_PCB_EDIT_DIMENSION: ShowDimensionPropertyDialog( (DIMENSION*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST: @@ -945,19 +945,19 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_DELETE_DRAWING: Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_DELETE_MARKER: RemoveStruct( GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_GETINFO_MARKER: if( GetCurItem() && GetCurItem()->Type() == PCB_MARKER_T ) ( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_DELETE_DRAWING_LAYER: @@ -966,22 +966,22 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) Delete_Drawings_All_Layer( GetCurItem()->GetLayer() ); SetCurItem( NULL ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->Refresh(); + m_canvas->MoveCursorToCrossHair(); + m_canvas->Refresh(); break; case ID_POPUP_PCB_EDIT_DRAWING: InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_MOVE_DRAWING_REQUEST: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Start_Move_DrawItem( (DRAWSEGMENT*) GetCurItem(), &dc ); break; case ID_POPUP_PCB_STOP_CURRENT_DRAWING: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( GetCurItem() && (GetCurItem()->IsNew()) ) { @@ -992,7 +992,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( GetCurItem() && (GetCurItem()->IsNew()) ) { @@ -1000,11 +1000,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SetCurItem( NULL ); } - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; break; case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( GetCurItem() && (GetCurItem()->IsNew()) ) { @@ -1016,32 +1016,32 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id ); break; case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: case ID_POPUP_PCB_MOVE_TRACK_NODE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id ); break; case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->GetCurItem(), &dc ); break; case ID_POPUP_PCB_BREAK_TRACK: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); { TRACK* track = (TRACK*) GetScreen()->GetCurItem(); wxPoint pos = GetScreen()->GetCrossHairPosition(); - track->Draw( DrawPanel, &dc, GR_XOR ); + track->Draw( m_canvas, &dc, GR_XOR ); PICKED_ITEMS_LIST itemsListPicker; TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker ); SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED ); - track->Draw( DrawPanel, &dc, GR_XOR ); - newtrack->Draw( DrawPanel, &dc, GR_XOR ); + track->Draw( m_canvas, &dc, GR_XOR ); + newtrack->Draw( m_canvas, &dc, GR_XOR ); /* compute the new ratsnest, because connectivity could change */ TestNetConnection( &dc, track->GetNet() ); } @@ -1091,8 +1091,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; } - DrawPanel->CrossHairOn( &dc ); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->CrossHairOn( &dc ); + m_canvas->m_IgnoreMouseEvents = false; } @@ -1155,7 +1155,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) if( Item == GetCurItem() ) SetCurItem( NULL ); - ( (MARKER_PCB*) Item )->Draw( DrawPanel, DC, GR_XOR ); + ( (MARKER_PCB*) Item )->Draw( m_canvas, DC, GR_XOR ); // delete the marker, and free memory. Don't use undo stack. GetBoard()->Delete( Item ); @@ -1242,7 +1242,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer ) if( Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC ) ) { if( DisplayOpt.ContrastModeDisplay ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } // if the via was allowed by DRC, then the layer swap has already @@ -1261,7 +1261,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer ) setActiveLayer( layer ); if( DisplayOpt.ContrastModeDisplay ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -1272,15 +1272,15 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) if( GetToolId() == id ) return; - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); // Stop the current command and deselect the current tool. - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); switch( id ) { case ID_NO_TOOL_SELECTED: - SetToolID( id, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( id, m_canvas->GetDefaultCursor(), wxEmptyString ); break; case ID_TRACK_BUTT: diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index 1846156b88..7cead2ac97 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -61,13 +61,13 @@ void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC ) */ void PCB_EDIT_FRAME::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) { - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); if( TextePcb == NULL ) return; - TextePcb->Draw( DrawPanel, DC, GR_OR ); + TextePcb->Draw( m_canvas, DC, GR_OR ); OnModify(); if( TextePcb->IsNew() ) // If new: prepare undo command @@ -106,16 +106,16 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ) if( !TextePcb->IsNew() ) s_TextCopy.Copy( TextePcb ); - TextePcb->Draw( DrawPanel, DC, GR_XOR ); + TextePcb->Draw( m_canvas, DC, GR_XOR ); TextePcb->SetFlags( IS_MOVED ); TextePcb->DisplayInfo( this ); GetScreen()->SetCrossHairPosition( TextePcb->GetPosition() ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); - DrawPanel->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text ); + m_canvas->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text ); SetCurItem( TextePcb ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } @@ -142,11 +142,11 @@ void PCB_EDIT_FRAME::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) if( TextePcb == NULL ) return; - TextePcb->Draw( DrawPanel, DC, GR_XOR ); + TextePcb->Draw( m_canvas, DC, GR_XOR ); SaveCopyInUndoList( TextePcb, UR_DELETED ); TextePcb->UnLink(); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); } @@ -197,13 +197,13 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) return; /* Erase previous text. */ - TextePcb->Draw( DrawPanel, DC, GR_XOR ); + TextePcb->Draw( m_canvas, DC, GR_XOR ); TextePcb->m_Orient += angle; NORMALIZE_ANGLE_POS( TextePcb->m_Orient ); /* Redraw text in new position. */ - TextePcb->Draw( DrawPanel, DC, drawmode ); + TextePcb->Draw( m_canvas, DC, drawmode ); TextePcb->DisplayInfo( this ); if( TextePcb->GetFlags() == 0 ) // i.e. not edited, or moved diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index a8cda42008..2c71502384 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -142,10 +142,10 @@ void PCB_EDIT_FRAME::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem ) { TRACK* oldsegm = (TRACK*) itemsListPicker.GetPickedItemLink( 0 ); wxASSERT( oldsegm ); - DrawPanel->CrossHairOff( aDC ); // Erase cursor shape - oldsegm->Draw( DrawPanel, aDC, GR_XOR ); // Erase old track shape - aTrackItem->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape - DrawPanel->CrossHairOn( aDC ); // Display cursor shape + m_canvas->CrossHairOff( aDC ); // Erase cursor shape + oldsegm->Draw( m_canvas, aDC, GR_XOR ); // Erase old track shape + aTrackItem->Draw( m_canvas, aDC, GR_OR ); // Display new track shape + m_canvas->CrossHairOn( aDC ); // Display cursor shape } SaveCopyInUndoList( itemsListPicker, UR_CHANGED ); @@ -187,17 +187,17 @@ void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment ) // Some segment have changed: redraw them and save in undo list if( aDC ) { - DrawPanel->CrossHairOff( aDC ); // Erase cursor shape + m_canvas->CrossHairOff( aDC ); // Erase cursor shape for( unsigned ii = 0; ii < itemsListPicker.GetCount(); ii++ ) { TRACK* segm = (TRACK*) itemsListPicker.GetPickedItemLink( ii ); - segm->Draw( DrawPanel, aDC, GR_XOR ); // Erase old track shape + segm->Draw( m_canvas, aDC, GR_XOR ); // Erase old track shape segm = (TRACK*) itemsListPicker.GetPickedItem( ii ); - segm->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape + segm->Draw( m_canvas, aDC, GR_OR ); // Display new track shape } - DrawPanel->CrossHairOn( aDC ); // Display cursor shape + m_canvas->CrossHairOn( aDC ); // Display cursor shape } SaveCopyInUndoList( itemsListPicker, UR_CHANGED ); diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 4162791848..c7cbd3ebb4 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -32,13 +32,13 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) if( drawitem == NULL ) return; - drawitem->Draw( DrawPanel, DC, GR_XOR ); + drawitem->Draw( m_canvas, DC, GR_XOR ); drawitem->SetFlags( IS_MOVED ); s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition(); drawitem->DisplayInfo( this ); - DrawPanel->SetMouseCapture( Move_Segment, Abort_EditEdge ); + m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge ); SetCurItem( drawitem ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } @@ -52,8 +52,8 @@ void PCB_EDIT_FRAME::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) drawitem->ClearFlags(); SaveCopyInUndoList(drawitem, UR_MOVED, s_LastPosition - s_InitialPosition); - drawitem->Draw( DrawPanel, DC, GR_OR ); - DrawPanel->SetMouseCapture( NULL, NULL ); + drawitem->Draw( m_canvas, DC, GR_OR ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); OnModify(); } @@ -96,7 +96,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) { /* Delete current segment. */ DisplayOpt.DisplayDrawItems = SKETCH; - Segment->Draw( DrawPanel, DC, GR_XOR ); + Segment->Draw( m_canvas, DC, GR_XOR ); PtStruct = Segment->Back(); Segment ->DeleteStructure(); @@ -108,7 +108,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) } else if( Segment->GetFlags() == 0 ) { - Segment->Draw( DrawPanel, DC, GR_XOR ); + Segment->Draw( m_canvas, DC, GR_XOR ); Segment->ClearFlags(); SaveCopyInUndoList(Segment, UR_DELETED); Segment->UnLink(); @@ -228,7 +228,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, Segment->SetAngle( 900 ); Segment->SetStart( GetScreen()->GetCrossHairPosition() ); Segment->SetEnd( GetScreen()->GetCrossHairPosition() ); - DrawPanel->SetMouseCapture( DrawSegment, Abort_EditEdge ); + m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge ); } else /* The ending point ccordinate Segment->m_End was updated by he function * DrawSegment() called on a move mouse event @@ -245,7 +245,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, OnModify(); Segment->ClearFlags(); - Segment->Draw( DrawPanel, DC, GR_OR ); + Segment->Draw( m_canvas, DC, GR_OR ); DrawItem = Segment; @@ -259,7 +259,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, Segment->SetAngle( DrawItem->GetAngle() ); Segment->SetStart( DrawItem->GetEnd() ); Segment->SetEnd( DrawItem->GetEnd() ); - DrawSegment( DrawPanel, DC, wxDefaultPosition, false ); + DrawSegment( m_canvas, DC, wxDefaultPosition, false ); } else { @@ -278,7 +278,7 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) if( Segment == NULL ) return; - Segment->Draw( DrawPanel, DC, GR_OR ); + Segment->Draw( m_canvas, DC, GR_OR ); // Delete if segment length is zero. if( Segment->GetStart() == Segment->GetEnd() ) @@ -293,7 +293,7 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) SaveCopyInUndoList( Segment, UR_NEW ); } - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); } diff --git a/pcbnew/editmod.cpp b/pcbnew/editmod.cpp index c642a9c646..c436879eae 100644 --- a/pcbnew/editmod.cpp +++ b/pcbnew/editmod.cpp @@ -147,7 +147,7 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) case PCB_MODULE_EDGE_T: Delete_Edge_Module( (EDGE_MODULE*) Item ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case PCB_MODULE_T: diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 8c46b62b12..dadf5ec6d1 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -92,7 +92,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) itmp = g_CurrentTrackList.GetCount(); Begin_Route( g_CurrentTrackSegment, DC ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); /* create the via */ SEGVIA* via = new SEGVIA( GetBoard() ); @@ -153,7 +153,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) /* DRC fault: the Via cannot be placed here ... */ delete via; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); // delete the track(s) added in Begin_Route() while( g_CurrentTrackList.GetCount() > itmp ) @@ -207,7 +207,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() ); } - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); via->DisplayInfo( this ); UpdateStatusBar(); @@ -253,7 +253,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) if( ( net->m_Status & CH_ACTIF ) == 0 ) continue; - net->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) ); + net->Draw( m_canvas, DC, GR_XOR, wxPoint( 0, 0 ) ); } } } @@ -290,7 +290,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) if( (net->m_Status & CH_ACTIF) == 0 ) continue; - net->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) ); + net->Draw( m_canvas, DC, GR_XOR, wxPoint( 0, 0 ) ); } } } @@ -320,7 +320,7 @@ void PCB_EDIT_FRAME::HighlightUnconnectedPads( wxDC* DC ) if( (net->m_Status & CH_ACTIF) == 0 ) continue; - net->m_PadStart->Draw( DrawPanel, DC, GR_OR | GR_HIGHLIGHT ); - net->m_PadEnd->Draw( DrawPanel, DC, GR_OR | GR_HIGHLIGHT ); + net->m_PadStart->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); + net->m_PadEnd->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); } } diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index a1b26af5bc..21803f750f 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -102,7 +102,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) if( aTrack == NULL ) /* Starting a new track segment */ { - DrawPanel->SetMouseCapture( ShowNewTrackWhenMovingCursor, Abort_Create_Track ); + m_canvas->SetMouseCapture( ShowNewTrackWhenMovingCursor, Abort_Create_Track ); // Prepare the undo command info s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but... @@ -157,7 +157,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) D( g_CurrentTrackList.VerifyListIntegrity(); ); GetBoard()->HighLightON(); - GetBoard()->DrawHighLight( DrawPanel, aDC, GetBoard()->GetHighLightNetCode() ); + GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() ); // Display info about track Net class, and init track and vias sizes: g_CurrentTrackSegment->SetNet( GetBoard()->GetHighLightNetCode() ); @@ -200,7 +200,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) g_CurrentTrackSegment->DisplayInfoBase( this ); SetCurItem( g_CurrentTrackSegment, false ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, false ); if( Drc_On ) { @@ -245,7 +245,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) /* Erase old track on screen */ D( g_CurrentTrackList.VerifyListIntegrity(); ); - ShowNewTrackWhenMovingCursor( DrawPanel, aDC, wxDefaultPosition, false ); + ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false ); D( g_CurrentTrackList.VerifyListIntegrity(); ); @@ -282,7 +282,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) D( g_CurrentTrackList.VerifyListIntegrity(); ); /* Show the new position */ - ShowNewTrackWhenMovingCursor( DrawPanel, aDC, wxDefaultPosition, false ); + ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false ); } } @@ -424,8 +424,8 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) if( Begin_Route( aTrack, aDC ) == NULL ) return false; - ShowNewTrackWhenMovingCursor( DrawPanel, aDC, wxDefaultPosition, true ); - ShowNewTrackWhenMovingCursor( DrawPanel, aDC, wxDefaultPosition, false ); + ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, true ); + ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false ); TraceAirWiresToTargets( aDC ); /* cleanup @@ -513,7 +513,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) GetBoard()->DisplayInfo( this ); // Redraw the entire new track. - DrawTraces( DrawPanel, aDC, firstTrack, newCount, GR_OR ); + DrawTraces( m_canvas, aDC, firstTrack, newCount, GR_OR ); } wxASSERT( g_FirstTrackSegment == NULL ); @@ -526,9 +526,9 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) GetBoard()->PopHighLight(); if( GetBoard()->IsHighLightNetON() ) - GetBoard()->DrawHighLight( DrawPanel, aDC, GetBoard()->GetHighLightNetCode() ); + GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() ); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); return true; diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 36a7094659..09d0dcf8af 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -60,12 +60,12 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC ) Text->SetLocalCoord(); InstallTextModOptionsFrame( Text, NULL ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Text->ClearFlags(); if( DC ) - Text->Draw( DrawPanel, DC, GR_OR ); + Text->Draw( m_canvas, DC, GR_OR ); Text->DisplayInfo( this ); @@ -89,14 +89,14 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) } // we expect MoveVector to be (0,0) if there is no move in progress - Text->Draw( DrawPanel, DC, GR_XOR, MoveVector ); + Text->Draw( m_canvas, DC, GR_XOR, MoveVector ); Text->m_Orient += 900; while( Text->m_Orient >= 1800 ) Text->m_Orient -= 1800; - Text->Draw( DrawPanel, DC, GR_XOR, MoveVector ); + Text->Draw( m_canvas, DC, GR_XOR, MoveVector ); Text->DisplayInfo( this ); if( module ) @@ -120,7 +120,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text ) if( Text->GetType() == TEXT_is_DIVERS ) { - DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( Text->GetBoundingBox() ); Text->DeleteStructure(); OnModify(); Module->m_LastEdit_Time = time( NULL ); @@ -188,13 +188,13 @@ void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) // Center cursor on initial position of text GetScreen()->SetCrossHairPosition( TextInitialPosition ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Text->DisplayInfo( this ); SetCurItem( Text ); - DrawPanel->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true ); + m_canvas->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, true ); } @@ -204,8 +204,8 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) { if( Text != NULL ) { - DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() ); - Text->DrawUmbilical( DrawPanel, DC, GR_XOR, -MoveVector ); + m_canvas->RefreshDrawingRect( Text->GetBoundingBox() ); + Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector ); /* Update the coordinates for anchor. */ MODULE* Module = (MODULE*) Text->GetParent(); @@ -233,7 +233,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) OnModify(); /* Redraw text. */ - DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( Text->GetBoundingBox() ); } else { @@ -244,7 +244,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) // leave it at (0,0) so we can use it Rotate when not moving. MoveVector.x = MoveVector.y = 0; - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); } @@ -328,7 +328,7 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ) text->SetThickness( newThickness ); if( aDC ) - DrawPanel->Refresh(); + m_canvas->Refresh(); OnModify(); } @@ -433,7 +433,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC ) } if( aDC ) - DrawPanel->Refresh(); + m_canvas->Refresh(); OnModify(); } diff --git a/pcbnew/event_handlers_tracks_vias_sizes.cpp b/pcbnew/event_handlers_tracks_vias_sizes.cpp index 5126756535..4e93e02048 100644 --- a/pcbnew/event_handlers_tracks_vias_sizes.cpp +++ b/pcbnew/event_handlers_tracks_vias_sizes.cpp @@ -30,7 +30,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) /* Note: none of these events require aborting the current command (if any) * (like move, edit or block command) * so we do not test for a current command in progress and call - * DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc ); + * m_canvas->m_endMouseCaptureCallback( m_canvas, &dc ); */ switch( id ) { @@ -46,7 +46,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) break; case ID_POPUP_PCB_SELECT_AUTO_WIDTH: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = true; break; @@ -58,7 +58,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) case ID_POPUP_PCB_SELECT_WIDTH6: case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH8: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false; ii = id - ID_POPUP_PCB_SELECT_WIDTH1; GetBoard()->m_TrackWidthSelector = ii; @@ -72,7 +72,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) case ID_POPUP_PCB_SELECT_VIASIZE6: case ID_POPUP_PCB_SELECT_VIASIZE7: case ID_POPUP_PCB_SELECT_VIASIZE8: // select the new current value for via size (via diameter) - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; GetBoard()->m_ViaSizeSelector = ii; break; diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 2452dd780a..a5e32a6a3d 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -62,7 +62,7 @@ void PCB_EDIT_FRAME::OnFileHistory( wxCommandEvent& event ) if( fn != wxEmptyString ) { - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); ::wxSetWorkingDirectory( ::wxPathOnly( fn ) ); LoadOnePcbFile( fn ); } @@ -77,9 +77,9 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) // If an edition is in progress, stop it. // For something else than save, get rid of current tool. if( id == ID_SAVE_BOARD ) - DrawPanel->EndMouseCapture( -1, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( -1, m_canvas->GetDefaultCursor() ); else - DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); switch( id ) { diff --git a/pcbnew/find.cpp b/pcbnew/find.cpp index 0424a359d8..bc760e3fce 100644 --- a/pcbnew/find.cpp +++ b/pcbnew/find.cpp @@ -60,8 +60,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) s_OldStringFound = m_NewText->GetValue(); - m_Parent->DrawPanel->GetViewStart( &screen->m_StartVisu.x, - &screen->m_StartVisu.y ); + m_Parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); if( FindMarker ) { diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index c386f0ce75..6eec000c31 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -204,7 +204,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) if( aDraw ) { Module->SetFlags( DO_NOT_DRAW ); - DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( Module->GetBoundingBox() ); Module->ClearFlags( DO_NOT_DRAW ); } @@ -279,7 +279,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) Module->CalculateBoundingBox(); if( aDraw ) - DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( Module->GetBoundingBox() ); } OnModify(); diff --git a/pcbnew/highlight.cpp b/pcbnew/highlight.cpp index b543436f2e..ef0a4660ad 100644 --- a/pcbnew/highlight.cpp +++ b/pcbnew/highlight.cpp @@ -101,7 +101,7 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event ) if( found ) { - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); if( GetBoard()->IsHighLightNetON() ) HighLight( &dc ); @@ -177,5 +177,5 @@ void PCB_EDIT_FRAME::HighLight( wxDC* DC ) else GetBoard()->HighLightON(); - GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() ); + GetBoard()->DrawHighLight( m_canvas, DC, GetBoard()->GetHighLightNetCode() ); } diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 503a36c0ac..ce1ee4b074 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -62,7 +62,7 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe tPosition = screen->GetNearestGridPosition( aPosition ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); screen->SetMousePosition( tPosition ); GeneralControl( aDC, tPosition ); @@ -80,7 +80,7 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe cmd.SetId( ID_ZOOM_REDRAW ); GetEventHandler()->ProcessEvent( cmd ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); } @@ -408,7 +408,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case HK_DELETE: @@ -451,7 +451,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( itemCurrentlyEdited && GetCurItem()->IsTrack() && GetCurItem()->IsNew() ) { // A new track is in progress: call to End_Route() - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); End_Route( (TRACK*) GetCurItem(), aDC ); } @@ -553,7 +553,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit SetCurItem( track ); if( track ) - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else if( GetCurItem()->IsNew() ) { @@ -564,7 +564,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( track ) // A new segment was created SetCurItem( track, false ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } break; @@ -904,12 +904,12 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED; bool itemCurrentlyEdited = item && item->GetFlags(); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; if( itemCurrentlyEdited ) { - DrawPanel->m_IgnoreMouseEvents = true; - DrawPanel->CrossHairOff( aDC ); + m_canvas->m_IgnoreMouseEvents = true; + m_canvas->CrossHairOff( aDC ); switch( item->Type() ) { @@ -950,8 +950,8 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) break; } - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->CrossHairOn( aDC ); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->CrossHairOn( aDC ); return true; } diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 3156972c2b..6dc624851f 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -387,7 +387,7 @@ void PCB_BASE_FRAME::Archive_Modules( const wxString& LibName, bool NewModulesOn return; } - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; // Create a new, empty library if no old lib, or if archive all modules if( !NewModulesOnly || !file_exists ) @@ -430,7 +430,7 @@ void PCB_BASE_FRAME::Archive_Modules( const wxString& LibName, bool NewModulesOn DisplayActivity( (int) ( ii * step ), wxEmptyString ); /* Check for request to stop backup (ESCAPE key actuated) */ - if( DrawPanel->m_AbortRequest ) + if( m_canvas->m_AbortRequest ) break; } } diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index d08ddd58e0..4cccee89e3 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -125,7 +125,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* if( moduleName.IsEmpty() ) /* Cancel command */ { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -139,7 +139,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* if( moduleName.IsEmpty() ) /* Cancel command */ { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); return NULL; } } @@ -148,9 +148,10 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* { AllowWildSeach = false; moduleName = Select_1_Module_From_List( this, library, moduleName, wxEmptyString ); + if( moduleName.IsEmpty() ) { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); return NULL; /* Cancel command. */ } } @@ -166,7 +167,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* if( moduleName.IsEmpty() ) { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); return NULL; /* Cancel command. */ } else @@ -176,7 +177,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* } GetScreen()->SetCrossHairPosition( curspos ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( module ) { @@ -200,7 +201,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* RecalculateAllTracksNetcode(); if( DC ) - module->Draw( DrawPanel, DC, GR_OR ); + module->Draw( m_canvas, DC, GR_OR ); } return module; diff --git a/pcbnew/mirepcb.cpp b/pcbnew/mirepcb.cpp index d2c7a4877c..47b1f12615 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/mirepcb.cpp @@ -136,7 +136,7 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnCancelClick( wxCommandEvent& event ) */ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event ) { - m_Target->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); + m_Target->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); // Save old item in undo list, if is is not currently edited (will be later if so) if( m_Target->GetFlags() == 0 ) @@ -151,7 +151,7 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event ) m_Target->SetSize( m_MireSizeCtrl->GetValue() ); m_Target->SetShape( m_MireShape->GetSelection() ? 1 : 0 ); - m_Target->Draw( m_Parent->DrawPanel, m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR ); + m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR ); m_Parent->OnModify(); EndModal( 1 ); @@ -163,7 +163,7 @@ void PCB_EDIT_FRAME::DeleteTarget( PCB_TARGET* aTarget, wxDC* DC ) if( aTarget == NULL ) return; - aTarget->Draw( DrawPanel, DC, GR_XOR ); + aTarget->Draw( m_canvas, DC, GR_XOR ); SaveCopyInUndoList( aTarget, UR_DELETED ); aTarget->UnLink(); } @@ -217,7 +217,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ) target->SetLayer( EDGE_N ); target->SetWidth( GetBoard()->GetDesignSettings().m_EdgeSegmentWidth ); target->SetSize( MireDefaultSize ); - target->SetPosition( DrawPanel->GetScreen()->GetCrossHairPosition() ); + target->SetPosition( m_canvas->GetScreen()->GetCrossHairPosition() ); PlaceTarget( target, DC ); @@ -234,7 +234,7 @@ void PCB_EDIT_FRAME::BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC ) s_TargetCopy = *aTarget; aTarget->SetFlags( IS_MOVED ); - DrawPanel->SetMouseCapture( ShowTargetShapeWhileMovingMouse, AbortMoveAndEditTarget ); + m_canvas->SetMouseCapture( ShowTargetShapeWhileMovingMouse, AbortMoveAndEditTarget ); SetCurItem( aTarget ); } @@ -244,8 +244,8 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC ) if( aTarget == NULL ) return; - aTarget->Draw( DrawPanel, DC, GR_OR ); - DrawPanel->SetMouseCapture( NULL, NULL ); + aTarget->Draw( m_canvas, DC, GR_OR ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); OnModify(); diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 4947148cef..aec181830a 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -110,12 +110,12 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode ) // PCB_BASE_FRAME::ProcessItemSelection() // and it calls SetCurItem() which in turn calls DisplayInfo() on the // item. - DrawPanel->m_AbortRequest = true; // changed in false if an item + m_canvas->m_AbortRequest = true; // changed in false if an item PopupMenu( &itemMenu ); // m_AbortRequest = false if an // item is selected - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; // The function ProcessItemSelection() has set the current item, return it. item = GetCurItem(); @@ -156,7 +156,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) wxPoint pos; bool redraw = false; - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); wxGetMousePosition( &pos.x, &pos.y ); @@ -195,14 +195,14 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_CANCEL_CURRENT_COMMAND: default: - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { // for all other commands: stop the move in progress - DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc ); + m_canvas->m_endMouseCaptureCallback( m_canvas, &dc ); } if( id != ID_POPUP_CANCEL_CURRENT_COMMAND ) - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; } @@ -449,7 +449,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) GetScreen()->GetCurItem()->ClearFlags(); if( ret > 0 ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; @@ -460,13 +460,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true ); redraw = true; break; case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true ); redraw = true; break; @@ -477,16 +477,16 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) int ret = dialog.ShowModal(); GetScreen()->GetCurItem()->ClearFlags(); GetScreen()->GetCurItem()->ClearFlags(); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( ret > 0 ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; case ID_POPUP_PCB_MOVE_PAD_REQUEST: { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc ); } break; @@ -494,7 +494,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_EDIT_PAD: { InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem() ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } break; @@ -502,36 +502,36 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); DeletePad( (D_PAD*) GetScreen()->GetCurItem(), false ); SetCurItem( NULL ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true ); break; case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Export_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem() ); break; case ID_POPUP_PCB_EDIT_TEXTMODULE: { InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } break; case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); } break; @@ -539,7 +539,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_ROTATE_TEXTMODULE: { RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } break; @@ -547,18 +547,18 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem() ); SetCurItem( NULL ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_MOVE_EDGE: { Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } break; case ID_POPUP_PCB_STOP_CURRENT_DRAWING: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( GetScreen()->GetCurItem()->IsNew() ) { @@ -578,40 +578,40 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } Enter_Edge_Width( edge ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( edge ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Edit_Edge_Width( NULL ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE: - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); Edit_Edge_Layer( NULL ); - DrawPanel->Refresh(); + m_canvas->Refresh(); break; case ID_POPUP_PCB_DELETE_EDGE: SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); RemoveStruct( GetScreen()->GetCurItem() ); SetCurItem( NULL ); break; @@ -647,14 +647,14 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PLACE_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; HandleBlockPlace( &dc ); break; case ID_POPUP_COPY_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.SetMessageBlock( this ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; HandleBlockPlace( &dc ); break; @@ -689,7 +689,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } if( redraw ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -826,7 +826,7 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent ) { int id = aEvent.GetId(); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); switch( id ) { @@ -866,7 +866,7 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent ) { SetToolID( id, wxCURSOR_ARROW, _( "Pad settings" ) ); InstallPadOptionsFrame( NULL ); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); } break; @@ -876,6 +876,6 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent ) default: wxFAIL_MSG( wxT( "Unknown command id." ) ); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); } } diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index 5ad77a0cc3..0288d3b73a 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -25,7 +25,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { BOARD_ITEM* item = GetCurItem(); - DrawPanel->CrossHairOff( DC ); + m_canvas->CrossHairOff( DC ); if( GetToolId() == ID_NO_TOOL_SELECTED ) { @@ -96,13 +96,13 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { End_Edge_Module( (EDGE_MODULE*) item ); SetCurItem( NULL ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } else if( ( (EDGE_MODULE*) item )->GetShape() == S_ARC ) { End_Edge_Module( (EDGE_MODULE*) item ); SetCurItem( NULL ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } else if( ( (EDGE_MODULE*) item )->GetShape() == S_SEGMENT ) { @@ -144,16 +144,16 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) // Replace the module in position 0, to recalculate absolutes coordinates of items module->SetPosition( wxPoint( 0, 0 ) ); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); SetCurItem( NULL ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; case ID_MODEDIT_PLACE_GRID_COORD: - DrawPanel->DrawGridAxis( DC, GR_XOR ); + m_canvas->DrawGridAxis( DC, GR_XOR ); GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition(); - DrawPanel->DrawGridAxis( DC, GR_COPY ); + m_canvas->DrawGridAxis( DC, GR_COPY ); GetScreen()->SetModify(); break; @@ -176,10 +176,10 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) default: DisplayError( this, wxT( "FOOTPRINT_EDIT_FRAME::ProcessCommand error" ) ); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); } - DrawPanel->CrossHairOn( DC ); + m_canvas->CrossHairOn( DC ); } @@ -416,7 +416,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) { case PCB_PAD_T: InstallPadOptionsFrame( (D_PAD*) item ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case PCB_MODULE_T: @@ -424,16 +424,16 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item ); int ret = dialog.ShowModal(); GetScreen()->GetCurItem()->ClearFlags(); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( ret > 0 ) - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; case PCB_MODULE_TEXT_T: InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; default: @@ -448,7 +448,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) { End_Edge_Module( (EDGE_MODULE*) item ); SetCurItem( NULL ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } break; diff --git a/pcbnew/modedit_undo_redo.cpp b/pcbnew/modedit_undo_redo.cpp index d2d3b114b5..1f7a51db1e 100644 --- a/pcbnew/modedit_undo_redo.cpp +++ b/pcbnew/modedit_undo_redo.cpp @@ -73,7 +73,7 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event ) SetCurItem( NULL ); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } @@ -102,5 +102,5 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event ) SetCurItem( NULL ); OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index fb813396a6..6b017ad5d3 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -49,22 +49,22 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { case ID_TB_OPTIONS_SHOW_PADS_SKETCH: m_DisplayPadFill = !m_optionsToolBar->GetToolToggled( id ); - DrawPanel->Refresh( ); + m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: m_DisplayViaFill = !m_optionsToolBar->GetToolToggled( id ); - DrawPanel->Refresh( ); + m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: m_DisplayModText = m_optionsToolBar->GetToolToggled( id ) ? SKETCH : FILLED; - DrawPanel->Refresh( ); + m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: m_DisplayModEdge = m_optionsToolBar->GetToolToggled( id ) ? SKETCH : FILLED; - DrawPanel->Refresh( ); + m_canvas->Refresh( ); break; default: diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index afdd2f30cf..6ee622c3ef 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -177,8 +177,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, ReCreateVToolbar(); ReCreateOptToolbar(); - if( DrawPanel ) - DrawPanel->m_Block_Enable = true; + if( m_canvas ) + m_canvas->m_Block_Enable = true; m_auimgr.SetManagedWindow( this ); @@ -203,7 +203,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ). Left() ); - m_auimgr.AddPane( DrawPanel, + m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.AddPane( m_messagePanel, @@ -375,25 +375,25 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, case WXK_NUMPAD8: case WXK_UP: pos.y -= wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD2: case WXK_DOWN: pos.y += wxRound( gridSize.y ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD4: case WXK_LEFT: pos.x -= wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; case WXK_NUMPAD6: case WXK_RIGHT: pos.x += wxRound( gridSize.x ); - DrawPanel->MoveCursor( pos ); + m_canvas->MoveCursor( pos ); break; default: @@ -406,23 +406,25 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, { pos = GetScreen()->GetCrossHairPosition(); GetScreen()->SetCrossHairPosition( oldpos ); - DrawPanel->CrossHairOff( aDC ); + m_canvas->CrossHairOff( aDC ); GetScreen()->SetCrossHairPosition( pos ); - DrawPanel->CrossHairOn( aDC ); + m_canvas->CrossHairOn( aDC ); - if( DrawPanel->IsMouseCaptured() ) + if( m_canvas->IsMouseCaptured() ) { #ifdef USE_WX_OVERLAY - wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); + wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC ); oDC.Clear(); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false ); #else - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); #endif } #ifdef USE_WX_OVERLAY else - DrawPanel->m_overlay.Reset(); + { + m_canvas->m_overlay.Reset(); + } #endif } diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 5311b391e7..70e997663d 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -90,7 +90,7 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC ) if( g_Drag_Pistes_On ) { - Build_Drag_Liste( DrawPanel, DC, module ); + Build_Drag_Liste( m_canvas, DC, module ); ITEM_PICKER itemWrapper( NULL, UR_CHANGED ); for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) @@ -104,18 +104,18 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC ) } GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; - DrawPanel->SetMouseCapture( MoveFootprint, Abort_MoveOrCopyModule ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->SetMouseCapture( MoveFootprint, Abort_MoveOrCopyModule ); + m_canvas->m_AutoPAN_Request = true; // Erase the module. if( DC ) { module->SetFlags( DO_NOT_DRAW ); - DrawPanel->RefreshDrawingRect( module->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( module->GetBoundingBox() ); module->ClearFlags( DO_NOT_DRAW ); } - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } @@ -261,7 +261,7 @@ bool PCB_EDIT_FRAME::Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeD // Redraw the full screen to ensure perfect display of board and ratsnest. if( aDC ) - DrawPanel->Refresh(); + m_canvas->Refresh(); return true; } @@ -284,7 +284,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC ) if( DC ) { Module->SetFlags( DO_NOT_DRAW ); - DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( Module->GetBoundingBox() ); Module->ClearFlags( DO_NOT_DRAW ); } @@ -300,8 +300,8 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC ) /* Erase footprint and draw outline if it has been already drawn. */ if( DC ) { - DrawModuleOutlines( DrawPanel, DC, Module ); - DrawSegmentWhileMovingFootprint( DrawPanel, DC ); + DrawModuleOutlines( m_canvas, DC, Module ); + DrawSegmentWhileMovingFootprint( m_canvas, DC ); } } @@ -314,7 +314,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC ) { if( DC ) { - Module->Draw( DrawPanel, DC, GR_OR ); + Module->Draw( m_canvas, DC, GR_OR ); if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) Compile_Ratsnest( DC, true ); @@ -324,8 +324,8 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC ) { if( DC ) { - DrawModuleOutlines( DrawPanel, DC, Module ); - DrawSegmentWhileMovingFootprint( DrawPanel, DC ); + DrawModuleOutlines( m_canvas, DC, Module ); + DrawSegmentWhileMovingFootprint( m_canvas, DC ); } GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK; @@ -376,7 +376,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat s_ModuleInitialCopy = NULL; if( aDC ) - aModule->Draw( DrawPanel, aDC, GR_OR ); + aModule->Draw( m_canvas, aDC, GR_OR ); if( g_DragSegmentList.size() ) { @@ -387,7 +387,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat pt_segm->SetState( IN_EDIT, OFF ); if( aDC ) - pt_segm->Draw( DrawPanel, aDC, GR_OR ); + pt_segm->Draw( m_canvas, aDC, GR_OR ); } // Delete drag list @@ -395,13 +395,13 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat } g_Drag_Pistes_On = false; - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) && !aDoNotRecreateRatsnest ) Compile_Ratsnest( aDC, true ); if( aDC ) - DrawPanel->Refresh(); + m_canvas->Refresh(); aModule->DisplayInfo( this ); } @@ -427,7 +427,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in if( DC ) // Erase footprint to screen { module->SetFlags( DO_NOT_DRAW ); - DrawPanel->RefreshDrawingRect( module->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( module->GetBoundingBox() ); module->ClearFlags( DO_NOT_DRAW ); if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) @@ -438,8 +438,8 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in { if( DC ) { - DrawModuleOutlines( DrawPanel, DC, module ); - DrawSegmentWhileMovingFootprint( DrawPanel, DC ); + DrawModuleOutlines( m_canvas, DC, module ); + DrawSegmentWhileMovingFootprint( m_canvas, DC ); } } @@ -457,7 +457,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in if( !module->IsMoving() ) { // not beiing moved: redraw the module and update ratsnest - module->Draw( DrawPanel, DC, GR_OR ); + module->Draw( m_canvas, DC, GR_OR ); if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) Compile_Ratsnest( DC, true ); @@ -465,12 +465,12 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in else { // Beiing moved: just redraw it - DrawModuleOutlines( DrawPanel, DC, module ); - DrawSegmentWhileMovingFootprint( DrawPanel, DC ); + DrawModuleOutlines( m_canvas, DC, module ); + DrawSegmentWhileMovingFootprint( m_canvas, DC ); } if( module->GetFlags() == 0 ) // module not in edit: redraw full screen - DrawPanel->Refresh(); + m_canvas->Refresh(); } } diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index 4d2ccd0709..52935ba2ea 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -138,7 +138,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) if( aDraw ) { aPad->SetFlags( DO_NOT_DRAW ); - DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() ); aPad->ClearFlags( DO_NOT_DRAW ); } @@ -175,7 +175,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) aPad->ComputeShapeMaxRadius(); if( aDraw ) - DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() ); ( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL ); } @@ -227,7 +227,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw ) Pad->DisplayInfo( this ); if( draw ) - DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( Module->GetBoundingBox() ); } @@ -262,7 +262,7 @@ void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery ) m_Pcb->m_Status_Pcb = 0; aPad->DeleteStructure(); - DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( Module->GetBoundingBox() ); Module->CalculateBoundingBox(); OnModify(); @@ -278,16 +278,16 @@ void PCB_BASE_FRAME::StartMovePad( D_PAD* Pad, wxDC* DC ) s_CurrentSelectedPad = Pad; Pad_OldPos = Pad->m_Pos; Pad->DisplayInfo( this ); - DrawPanel->SetMouseCapture( Show_Pad_Move, Abort_Move_Pad ); + m_canvas->SetMouseCapture( Show_Pad_Move, Abort_Move_Pad ); /* Draw the pad (SKETCH mode) */ - Pad->Draw( DrawPanel, DC, GR_XOR ); + Pad->Draw( m_canvas, DC, GR_XOR ); Pad->SetFlags( IS_MOVED ); - Pad->Draw( DrawPanel, DC, GR_XOR ); + Pad->Draw( m_canvas, DC, GR_XOR ); /* Build the list of track segments to drag if the command is a drag pad*/ if( g_Drag_Pistes_On ) - Build_1_Pad_SegmentsToDrag( DrawPanel, DC, Pad ); + Build_1_Pad_SegmentsToDrag( m_canvas, DC, Pad ); else EraseDragList(); } @@ -339,7 +339,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC ) } Pad->m_Pos = pad_curr_position; - Pad->Draw( DrawPanel, DC, GR_XOR ); + Pad->Draw( m_canvas, DC, GR_XOR ); /* Redraw dragged track segments */ for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) @@ -356,7 +356,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC ) Track->SetState( IN_EDIT, OFF ); if( DC ) - Track->Draw( DrawPanel, DC, GR_OR ); + Track->Draw( m_canvas, DC, GR_OR ); } /* Compute local coordinates (i.e refer to Module position and for Module orient = 0) */ @@ -370,7 +370,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC ) Pad->ClearFlags(); if( DC ) - Pad->Draw( DrawPanel, DC, GR_OR ); + Pad->Draw( m_canvas, DC, GR_OR ); Module->CalculateBoundingBox(); Module->m_LastEdit_Time = time( NULL ); @@ -378,7 +378,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC ) EraseDragList(); OnModify(); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK ); } @@ -398,7 +398,7 @@ void PCB_BASE_FRAME::RotatePad( D_PAD* Pad, wxDC* DC ) OnModify(); if( DC ) - Module->Draw( DrawPanel, DC, GR_XOR ); + Module->Draw( m_canvas, DC, GR_XOR ); EXCHG( Pad->m_Size.x, Pad->m_Size.y ); EXCHG( Pad->m_Drill.x, Pad->m_Drill.y ); @@ -411,5 +411,5 @@ void PCB_BASE_FRAME::RotatePad( D_PAD* Pad, wxDC* DC ) Pad->DisplayInfo( this ); if( DC ) - Module->Draw( DrawPanel, DC, GR_OR ); + Module->Draw( m_canvas, DC, GR_OR ); } diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 6845d62394..37bf6d7135 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -702,7 +702,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC if( aCommand != ID_POPUP_PCB_MOVE_TRACK_SEGMENT ) { - Collect_TrackSegmentsToDrag( DrawPanel, aDC, aTrack->m_Start, + Collect_TrackSegmentsToDrag( m_canvas, aDC, aTrack->m_Start, aTrack->ReturnMaskLayer(), aTrack->GetNet() ); } @@ -720,24 +720,24 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC { case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: // Move segment aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT ); - AddSegmentToDragList( DrawPanel, aDC, aTrack->GetFlags(), aTrack ); + AddSegmentToDragList( m_canvas, aDC, aTrack->GetFlags(), aTrack ); break; case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: // drag a segment pos = aTrack->m_Start; - Collect_TrackSegmentsToDrag( DrawPanel, aDC, pos, + Collect_TrackSegmentsToDrag( m_canvas, aDC, pos, aTrack->ReturnMaskLayer(), aTrack->GetNet() ); pos = aTrack->m_End; aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT ); - Collect_TrackSegmentsToDrag( DrawPanel, aDC, pos, + Collect_TrackSegmentsToDrag( m_canvas, aDC, pos, aTrack->ReturnMaskLayer(), aTrack->GetNet() ); break; case ID_POPUP_PCB_MOVE_TRACK_NODE: // Drag via or move node pos = (diag & STARTPOINT) ? aTrack->m_Start : aTrack->m_End; - Collect_TrackSegmentsToDrag( DrawPanel, aDC, pos, + Collect_TrackSegmentsToDrag( m_canvas, aDC, pos, aTrack->ReturnMaskLayer(), aTrack->GetNet() ); PosInit = pos; @@ -764,13 +764,13 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC } s_LastPos = PosInit; - DrawPanel->SetMouseCapture( Show_MoveNode, Abort_MoveTrack ); + m_canvas->SetMouseCapture( Show_MoveNode, Abort_MoveTrack ); GetBoard()->SetHighLightNet( aTrack->GetNet() ); GetBoard()->HighLightON(); - GetBoard()->DrawHighLight( DrawPanel, aDC, GetBoard()->GetHighLightNetCode() ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true ); + GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() ); + m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, true ); } @@ -938,7 +938,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( track->m_Start != TrackToStartPoint->m_Start ) flag = ENDPOINT; - AddSegmentToDragList( DrawPanel, DC, flag, TrackToStartPoint ); + AddSegmentToDragList( m_canvas, DC, flag, TrackToStartPoint ); track->SetFlags( STARTPOINT ); } @@ -949,20 +949,20 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( track->m_End != TrackToEndPoint->m_Start ) flag = ENDPOINT; - AddSegmentToDragList( DrawPanel, DC, flag, TrackToEndPoint ); + AddSegmentToDragList( m_canvas, DC, flag, TrackToEndPoint ); track->SetFlags( ENDPOINT ); } - AddSegmentToDragList( DrawPanel, DC, track->GetFlags(), track ); + AddSegmentToDragList( m_canvas, DC, track->GetFlags(), track ); PosInit = GetScreen()->GetCrossHairPosition(); s_LastPos = GetScreen()->GetCrossHairPosition(); - DrawPanel->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack ); + m_canvas->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack ); GetBoard()->SetHighLightNet( track->GetNet() ); GetBoard()->HighLightON(); - GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() ); + GetBoard()->DrawHighLight( m_canvas, DC, GetBoard()->GetHighLightNetCode() ); // Prepare the Undo command ITEM_PICKER picker( NULL, UR_CHANGED ); @@ -981,8 +981,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( !InitialiseDragParameters() ) { DisplayError( this, _( "Unable to drag this segment: two collinear segments" ) ); - DrawPanel->m_mouseCaptureCallback = NULL; - Abort_MoveTrack( DrawPanel, DC ); + m_canvas->m_mouseCaptureCallback = NULL; + Abort_MoveTrack( m_canvas, DC ); return; } } @@ -1021,7 +1021,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) // DRC Ok: place track segments Track->ClearFlags(); Track->SetState( IN_EDIT, OFF ); - Track->Draw( DrawPanel, DC, draw_mode ); + Track->Draw( m_canvas, DC, draw_mode ); /* Draw dragged tracks */ for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) @@ -1029,7 +1029,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) Track = g_DragSegmentList[ii].m_Segm; Track->SetState( IN_EDIT, OFF ); Track->ClearFlags(); - Track->Draw( DrawPanel, DC, draw_mode ); + Track->Draw( m_canvas, DC, draw_mode ); /* Test the connections modified by the move * (only pad connection must be tested, track connection will be @@ -1061,12 +1061,12 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) GetBoard()->PopHighLight(); if( GetBoard()->IsHighLightNetON() ) - GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() ); + GetBoard()->DrawHighLight( m_canvas, DC, GetBoard()->GetHighLightNetCode() ); OnModify(); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); - DrawPanel->Refresh(); + m_canvas->Refresh(); if( current_net_code > 0 ) TestNetConnection( DC, current_net_code ); diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 7ddddea943..f9b525afc2 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -168,8 +168,8 @@ void PCB_EDIT_FRAME::Begin_Self( wxDC* DC ) GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); UpdateStatusBar(); - DrawPanel->SetMouseCapture( ShowBoundingBoxMicroWaveInductor, Exit_Self ); - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + m_canvas->SetMouseCapture( ShowBoundingBoxMicroWaveInductor, Exit_Self ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } @@ -179,8 +179,8 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) int ll; wxString msg; - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->SetMouseCapture( NULL, NULL ); if( Self_On == 0 ) { @@ -290,7 +290,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) module->m_Value->SetPos0( module->m_Value->m_Pos - module->m_Pos ); module->CalculateBoundingBox(); - module->Draw( DrawPanel, DC, GR_OR ); + module->Draw( m_canvas, DC, GR_OR ); return module; } @@ -615,7 +615,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) if( dlg.ShowModal() != wxID_OK ) { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); return NULL; // cancelled by user } @@ -633,7 +633,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) if( angledlg.ShowModal() != wxID_OK ) { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); return NULL; // cancelled by user } @@ -653,7 +653,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) if( abort ) { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -944,7 +944,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() frame->Destroy(); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); if( ok != 1 ) { @@ -1075,7 +1075,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module ) return; } - Module->Draw( DrawPanel, DC, GR_XOR ); + Module->Draw( m_canvas, DC, GR_XOR ); /* Calculate the current dimension. */ gap_size = next_pad->m_Pos0.x - pad->m_Pos0.x - pad->m_Size.x; @@ -1107,5 +1107,5 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module ) RotatePoint( &next_pad->m_Pos.x, &next_pad->m_Pos.y, Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient ); - Module->Draw( DrawPanel, DC, GR_OR ); + Module->Draw( m_canvas, DC, GR_OR ); } diff --git a/pcbnew/muwave_command.cpp b/pcbnew/muwave_command.cpp index a85220ca98..11e04cd98c 100644 --- a/pcbnew/muwave_command.cpp +++ b/pcbnew/muwave_command.cpp @@ -20,7 +20,7 @@ void PCB_EDIT_FRAME::ProcessMuWaveFunctions( wxCommandEvent& event ) { int id = event.GetId(); wxPoint pos; - INSTALL_UNBUFFERED_DC( dc, DrawPanel ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); wxGetMousePosition( &pos.x, &pos.y ); @@ -32,7 +32,7 @@ void PCB_EDIT_FRAME::ProcessMuWaveFunctions( wxCommandEvent& event ) break; default: // End block command in progress. - DrawPanel->EndMouseCapture( ); + m_canvas->EndMouseCapture( ); break; } @@ -93,9 +93,9 @@ void PCB_EDIT_FRAME::MuWaveCommand( wxDC* DC, const wxPoint& MousePos ) break; default: - DrawPanel->SetCursor( wxCURSOR_ARROW ); + m_canvas->SetCursor( wxCURSOR_ARROW ); DisplayError( this, wxT( "PCB_EDIT_FRAME::MuWaveCommand() id error" ) ); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; } @@ -104,5 +104,5 @@ void PCB_EDIT_FRAME::MuWaveCommand( wxDC* DC, const wxPoint& MousePos ) StartMove_Module( module, DC ); } - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 856a989ca8..23c57039da 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -308,7 +308,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, } GetBoard()->DisplayInfo( this ); - DrawPanel->Refresh(); + m_canvas->Refresh(); return true; } diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index b48bed951a..9e01240192 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -51,19 +51,19 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( no_tool || ( DrawStruct && DrawStruct->GetFlags() ) ) { - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; if( DrawStruct && DrawStruct->GetFlags() ) // Command in progress { - DrawPanel->m_IgnoreMouseEvents = true; - DrawPanel->CrossHairOff( aDC ); + m_canvas->m_IgnoreMouseEvents = true; + m_canvas->CrossHairOff( aDC ); switch( DrawStruct->Type() ) { case PCB_ZONE_AREA_T: if( DrawStruct->IsNew() ) { - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; Begin_Zone( aDC ); } else @@ -134,8 +134,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; } - DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->CrossHairOn( aDC ); + m_canvas->m_IgnoreMouseEvents = false; + m_canvas->CrossHairOn( aDC ); if( exit ) return; @@ -212,7 +212,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) ) { SetCurItem( (BOARD_ITEM*) CreateTarget( aDC ) ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); } else if( DrawStruct->Type() == PCB_TARGET_T ) { @@ -247,7 +247,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { DrawStruct = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC ); SetCurItem( DrawStruct ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else if( DrawStruct && (DrawStruct->Type() == PCB_LINE_T) @@ -255,7 +255,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { DrawStruct = (BOARD_ITEM*) Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC ); SetCurItem( DrawStruct ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } break; } @@ -273,7 +273,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) SetCurItem( DrawStruct ); if( DrawStruct ) - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else if( DrawStruct && DrawStruct->IsNew() ) { @@ -284,7 +284,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( track ) // A new segment was created SetCurItem( DrawStruct = (BOARD_ITEM*) track, false ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } break; @@ -313,21 +313,21 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( hit_on_corner ) { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; Start_Move_Zone_Corner( aDC, zone_cont, zone_cont->m_CornerSelection, false ); } else if( Begin_Zone( aDC ) ) { - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; DrawStruct = GetBoard()->m_CurrentZoneContour; GetScreen()->SetCurItem( DrawStruct ); } } else if( DrawStruct && (DrawStruct->Type() == PCB_ZONE_AREA_T) && DrawStruct->IsNew() ) { // Add a new corner to the current outline being created: - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; Begin_Zone( aDC ); DrawStruct = GetBoard()->m_CurrentZoneContour; GetScreen()->SetCurItem( DrawStruct ); @@ -343,13 +343,13 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) ) { SetCurItem( Create_Texte_Pcb( aDC ) ); - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_AutoPAN_Request = true; } else if( DrawStruct->Type() == PCB_TEXT_T ) { Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; } else { @@ -361,7 +361,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) case ID_PCB_MODULE_BUTT: if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) ) { - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); DrawStruct = (BOARD_ITEM*) Load_Module_From_Library( wxEmptyString, aDC ); SetCurItem( DrawStruct ); @@ -371,7 +371,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) else if( DrawStruct->Type() == PCB_MODULE_T ) { PlaceModule( (MODULE*) DrawStruct, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; } else { @@ -391,13 +391,13 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { DrawStruct = (BOARD_ITEM*) EditDimension( NULL, aDC ); SetCurItem( DrawStruct ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else if( DrawStruct && (DrawStruct->Type() == PCB_DIMENSION_T) && DrawStruct->IsNew() ) { DrawStruct = (BOARD_ITEM*) EditDimension( (DIMENSION*) DrawStruct, aDC ); SetCurItem( DrawStruct ); - DrawPanel->m_AutoPAN_Request = true; + m_canvas->m_AutoPAN_Request = true; } else { @@ -422,21 +422,21 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; case ID_PCB_PLACE_OFFSET_COORD_BUTT: - DrawPanel->DrawAuxiliaryAxis( aDC, GR_XOR ); + m_canvas->DrawAuxiliaryAxis( aDC, GR_XOR ); m_originAxisPosition = GetScreen()->GetCrossHairPosition(); - DrawPanel->DrawAuxiliaryAxis( aDC, GR_COPY ); + m_canvas->DrawAuxiliaryAxis( aDC, GR_COPY ); OnModify(); break; case ID_PCB_PLACE_GRID_COORD_BUTT: - DrawPanel->DrawGridAxis( aDC, GR_XOR ); + m_canvas->DrawGridAxis( aDC, GR_XOR ); GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition(); - DrawPanel->DrawGridAxis( aDC, GR_COPY ); + m_canvas->DrawGridAxis( aDC, GR_COPY ); break; default: DisplayError( this, wxT( "PCB_EDIT_FRAME::OnLeftClick() id error" ) ); - SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString ); + SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); break; } } @@ -471,7 +471,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) if( DrawStruct->IsNew() ) { if( End_Route( (TRACK*) DrawStruct, aDC ) ) - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; } else if( DrawStruct->GetFlags() == 0 ) { @@ -487,7 +487,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) case PCB_DIMENSION_T: case PCB_MODULE_TEXT_T: OnEditItemRequest( aDC, DrawStruct ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); break; case PCB_LINE_T: @@ -511,7 +511,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) if( DrawStruct && DrawStruct->IsNew() ) { if( End_Route( (TRACK*) DrawStruct, aDC ) ) - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; } break; @@ -519,7 +519,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) case ID_PCB_ZONES_BUTT: if( End_Zone( aDC ) ) { - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; SetCurItem( NULL ); } @@ -534,14 +534,14 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) if( DrawStruct->Type() != PCB_LINE_T ) { DisplayError( this, wxT( "DrawStruct Type error" ) ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; break; } if( DrawStruct->IsNew() ) { End_Edge( (DRAWSEGMENT*) DrawStruct, aDC ); - DrawPanel->m_AutoPAN_Request = false; + m_canvas->m_AutoPAN_Request = false; SetCurItem( NULL ); } diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 2f635f3fac..23a5000e32 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -55,11 +55,11 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) bool locate_track = false; bool blockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); - wxClientDC dc( DrawPanel ); + wxClientDC dc( m_canvas ); BOARD_ITEM* item = GetCurItem(); - DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu + m_canvas->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu // If a command or a block is in progress: // Put the Cancel command (if needed) and the End command @@ -71,7 +71,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) return true; } - DrawPanel->CrossHairOff( &dc ); + m_canvas->CrossHairOff( &dc ); if( GetToolId() != ID_NO_TOOL_SELECTED ) { @@ -119,12 +119,12 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) // previously picked at this position if( !item || cursorPos != selectPos ) { - DrawPanel->m_AbortRequest = false; + m_canvas->m_AbortRequest = false; item = PcbGeneralLocateAndDisplay(); - if( DrawPanel->m_AbortRequest ) + if( m_canvas->m_AbortRequest ) { - DrawPanel->CrossHairOn( &dc ); + m_canvas->CrossHairOn( &dc ); return false; } } @@ -404,7 +404,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) break; } - DrawPanel->CrossHairOn( &dc ); + m_canvas->CrossHairOn( &dc ); return true; } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 12bbe551d1..7f29d909ee 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -300,7 +300,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, if( screenHeight <= 900 ) pointSize = (pointSize * 8) / 10; - m_Layers = new PCB_LAYER_WIDGET( this, DrawPanel, pointSize ); + m_Layers = new PCB_LAYER_WIDGET( this, m_canvas, pointSize ); m_drc = new DRC( this ); // these 2 objects point to each other @@ -328,8 +328,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); - if( DrawPanel ) - DrawPanel->m_Block_Enable = true; + if( m_canvas ) + m_canvas->m_Block_Enable = true; ReCreateMenuBar(); ReCreateHToolbar(); @@ -391,8 +391,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); } - if( DrawPanel ) - m_auimgr.AddPane( DrawPanel, + if( m_canvas ) + m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); if( m_messagePanel ) @@ -451,7 +451,7 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event ) void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) { - DrawPanel->m_AbortRequest = true; + m_canvas->m_AbortRequest = true; if( GetScreen()->IsModify() ) { diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 26430536a5..980d80f266 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -196,7 +196,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); * This is more a workaround than a fix. */ frame->SetFocus(); - frame->DrawPanel->SetFocus(); + frame->GetCanvas()->SetFocus(); return true; } diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 1aa50f43b1..556579eef4 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -63,7 +63,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, DisplayOpt.DisplayZonesMode = 0; DisplayOpt.DisplayNetNamesMode = 0; - DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; + m_canvas->m_PrintIsMirrored = aPrintMirrorMode; // The OR mode is used in color mode, but be aware the background *must be // BLACK. In the print page dialog, we first print in BLACK, and after @@ -80,6 +80,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, wxPoint offset; offset.x = GetScreen()->m_CurrentSheetDesc->m_Size.x / 2; offset.y = GetScreen()->m_CurrentSheetDesc->m_Size.y / 2; + // offset is in mils, converts in internal units offset.x *= m_internalUnits / 1000; offset.y *= m_internalUnits / 1000; @@ -87,13 +88,13 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, for( ; Module != NULL; Module = Module->Next() ) { Module->Move( offset ); - Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); + Print_Module( m_canvas, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); Module->Move( -offset ); } D_PAD::m_PadSketchModePenSize = tmp; - DrawPanel->m_PrintIsMirrored = false; + m_canvas->m_PrintIsMirrored = false; DisplayOpt = save_opt; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; @@ -194,7 +195,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, DisplayOpt.DisplayZonesMode = 0; DisplayOpt.DisplayNetNamesMode = 0; - DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; + m_canvas->m_PrintIsMirrored = aPrintMirrorMode; // The OR mode is used in color mode, but be aware the background *must be // BLACK. In the print page dialog, we first print in BLACK, and after @@ -217,7 +218,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 ) break; - item->Draw( DrawPanel, aDC, drawmode ); + item->Draw( m_canvas, aDC, drawmode ); break; case PCB_MARKER_T: @@ -239,7 +240,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, int radius = pt_trace->m_Width >> 1; int color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + pt_trace->m_Shape ); GRSetDrawMode( aDC, drawmode ); - GRFilledCircle( &DrawPanel->m_ClipBox, aDC, + GRFilledCircle( &m_canvas->m_ClipBox, aDC, pt_trace->m_Start.x, pt_trace->m_Start.y, radius, @@ -247,7 +248,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, } else { - pt_trace->Draw( DrawPanel, aDC, drawmode ); + pt_trace->Draw( m_canvas, aDC, drawmode ); } } @@ -258,7 +259,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, if( ( aPrintMaskLayer & pt_trace->ReturnMaskLayer() ) == 0 ) continue; - pt_trace->Draw( DrawPanel, aDC, drawmode ); + pt_trace->Draw( m_canvas, aDC, drawmode ); } /* Draw filled areas (i.e. zones) */ @@ -269,7 +270,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 ) continue; - zone->DrawFilledArea( DrawPanel, aDC, drawmode ); + zone->DrawFilledArea( m_canvas, aDC, drawmode ); } // Draw footprints, this is done at last in order to print the pad holes in @@ -280,7 +281,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, for( ; Module != NULL; Module = Module->Next() ) { - Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); + Print_Module( m_canvas, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); } D_PAD::m_PadSketchModePenSize = tmp; @@ -309,7 +310,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, else diameter = pt_trace->GetDrillValue(); - GRFilledCircle( &DrawPanel->m_ClipBox, aDC, + GRFilledCircle( &m_canvas->m_ClipBox, aDC, pt_trace->m_Start.x, pt_trace->m_Start.y, diameter/2, 0, color, color ); @@ -319,7 +320,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, GRForceBlackPen( blackpenstate ); } - DrawPanel->m_PrintIsMirrored = false; + m_canvas->m_PrintIsMirrored = false; DisplayOpt = save_opt; GetScreen()->m_Active_Layer = activeLayer; diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index 7be410bd6e..fae5d573a8 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -264,7 +264,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() GRForceBlackPen( true ); - EDA_DRAW_PANEL* panel = m_Parent->DrawPanel; + EDA_DRAW_PANEL* panel = m_Parent->GetCanvas(); EDA_RECT tmp = panel->m_ClipBox; // Set clip box to the max size diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 297ebc950f..c2e1a21b61 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -286,7 +286,7 @@ void PCB_BASE_FRAME::DrawGeneralRatsnest( wxDC* aDC, int aNetcode ) if( ( aNetcode <= 0 ) || ( aNetcode == item.GetNet() ) ) { - item.Draw( DrawPanel, aDC, GR_XOR, wxPoint( 0, 0 ) ); + item.Draw( m_canvas, aDC, GR_XOR, wxPoint( 0, 0 ) ); } } } @@ -719,14 +719,14 @@ void PCB_BASE_FRAME::TraceModuleRatsNest( wxDC* DC ) if( rats->m_Status & LOCAL_RATSNEST_ITEM ) { g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, YELLOW); - rats->Draw( DrawPanel, DC, GR_XOR, g_Offset_Module ); + rats->Draw( m_canvas, DC, GR_XOR, g_Offset_Module ); } else { g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, tmpcolor); wxPoint tmp = rats->m_PadStart->m_Pos; rats->m_PadStart->m_Pos -= g_Offset_Module; - rats->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) ); + rats->Draw( m_canvas, DC, GR_XOR, wxPoint( 0, 0 ) ); rats->m_PadStart->m_Pos = tmp; } } @@ -876,6 +876,6 @@ void PCB_BASE_FRAME::TraceAirWiresToTargets( wxDC* aDC ) if( ii >= g_MaxLinksShowed ) break; - GRLine( &DrawPanel->m_ClipBox, aDC, s_CursorPos, s_TargetsLocations[ii], 0, YELLOW ); + GRLine( &m_canvas->m_ClipBox, aDC, s_CursorPos, s_TargetsLocations[ii], 0, YELLOW ); } } diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 4d0c043794..f88e60d80f 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -234,18 +234,17 @@ void PCB_BASE_FRAME::SelectLayerPair() return; } - SELECT_LAYERS_PAIR_DIALOG* frame = - new SELECT_LAYERS_PAIR_DIALOG( this ); + SELECT_LAYERS_PAIR_DIALOG* frame = new SELECT_LAYERS_PAIR_DIALOG( this ); int result = frame->ShowModal(); frame->Destroy(); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); // if user changed colors and we are in high contrast mode, then redraw // because the PAD_SMD pads may change color. if( result >= 0 && DisplayOpt.ContrastModeDisplay ) { - DrawPanel->Refresh(); + m_canvas->Refresh(); } } diff --git a/pcbnew/set_grid.cpp b/pcbnew/set_grid.cpp index cb2bb28e5e..204fe27e5e 100644 --- a/pcbnew/set_grid.cpp +++ b/pcbnew/set_grid.cpp @@ -64,7 +64,7 @@ void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos ) if( GetScreen()->GetGridId() == ID_POPUP_GRID_USER ) GetScreen()->SetGrid( ID_POPUP_GRID_USER ); - DrawPanel->Refresh(); + m_canvas->Refresh(); } diff --git a/pcbnew/solve.cpp b/pcbnew/solve.cpp index 4cc3932c47..6f0a2ec6a7 100644 --- a/pcbnew/solve.cpp +++ b/pcbnew/solve.cpp @@ -267,8 +267,8 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) bool stop = false; wxString msg; - DrawPanel->m_AbortRequest = false; - DrawPanel->m_AbortEnable = true; + m_canvas->m_AbortRequest = false; + m_canvas->m_AbortEnable = true; s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance(); @@ -289,7 +289,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) /* Test to stop routing ( escape key pressed ) */ wxYield(); - if( DrawPanel->m_AbortRequest ) + if( m_canvas->m_AbortRequest ) { if( IsOK( this, _( "Abort routing?" ) ) ) { @@ -299,7 +299,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) } else { - DrawPanel->m_AbortRequest = 0; + m_canvas->m_AbortRequest = 0; } } @@ -323,7 +323,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) segm_fY = GetBoard()->GetBoundingBox().GetY() + (Board.m_GridRouting * row_target); /* Draw segment. */ - GRLine( &DrawPanel->m_ClipBox, + GRLine( &m_canvas->m_ClipBox, DC, segm_oX, segm_oY, @@ -331,8 +331,8 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) segm_fY, 0, WHITE | GR_XOR ); - pt_cur_ch->m_PadStart->Draw( DrawPanel, DC, GR_OR | GR_HIGHLIGHT ); - pt_cur_ch->m_PadEnd->Draw( DrawPanel, DC, GR_OR | GR_HIGHLIGHT ); + pt_cur_ch->m_PadStart->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); + pt_cur_ch->m_PadEnd->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); success = Autoroute_One_Track( this, DC, @@ -371,14 +371,14 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) AppendMsgPanel( wxT( "Not Connected" ), msg, CYAN ); /* Delete routing from display. */ - pt_cur_ch->m_PadStart->Draw( DrawPanel, DC, GR_AND ); - pt_cur_ch->m_PadEnd->Draw( DrawPanel, DC, GR_AND ); + pt_cur_ch->m_PadStart->Draw( m_canvas, DC, GR_AND ); + pt_cur_ch->m_PadEnd->Draw( m_canvas, DC, GR_AND ); if( stop ) break; } - DrawPanel->m_AbortEnable = false; + m_canvas->m_AbortEnable = false; SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED ); s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items @@ -608,7 +608,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, { /* Remove link. */ GRSetDrawMode( DC, GR_XOR ); - GRLine( &pcbframe->DrawPanel->m_ClipBox, + GRLine( &pcbframe->GetCanvas()->m_ClipBox, DC, segm_oX, segm_oY, @@ -627,7 +627,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, break; /* Routing complete. */ } - if( pcbframe->DrawPanel->m_AbortRequest ) + if( pcbframe->GetCanvas()->m_AbortRequest ) { result = STOP_FROM_ESC; break; @@ -1274,7 +1274,7 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC ) int dx0, dy0, dx1, dy1; int marge, via_marge; - EDA_DRAW_PANEL* panel = pcbframe->DrawPanel; + EDA_DRAW_PANEL* panel = pcbframe->GetCanvas(); PCB_SCREEN* screen = pcbframe->GetScreen(); marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 ); diff --git a/pcbnew/specctra_import.cpp b/pcbnew/specctra_import.cpp index 531adf7e42..bf777c03ee 100644 --- a/pcbnew/specctra_import.cpp +++ b/pcbnew/specctra_import.cpp @@ -32,7 +32,7 @@ */ -#include "class_drawpanel.h" // DrawPanel +#include "class_drawpanel.h" // m_canvas #include "confirm.h" // DisplayError() #include "gestfich.h" // EDA_FileSelector() #include "wxPcbStruct.h" @@ -131,7 +131,7 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event ) SetStatusText( wxString( _( "Session file imported and merged OK." ) ) ); - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index 7f53d5d8ab..87a986ccd1 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -421,5 +421,5 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event ) } } - DrawPanel->Refresh( true ); + m_canvas->Refresh( true ); } diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index a7a15e7db5..dc9fa9e6c0 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -238,7 +238,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, /* Marked track can be erased. */ TRACK* NextS; - DrawTraces( DrawPanel, aDC, pt_del, nb_segm, GR_XOR | GR_HIGHLIGHT ); + DrawTraces( m_canvas, aDC, pt_del, nb_segm, GR_XOR | GR_HIGHLIGHT ); for( jj = 0; jj < nb_segm; jj++, pt_del = NextS ) { @@ -266,7 +266,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, pt_del->SetState( IN_EDIT, OFF ); if( aDC ) - pt_del->Draw( DrawPanel, aDC, GR_OR ); + pt_del->Draw( m_canvas, aDC, GR_OR ); } pt_del->SetState( IN_EDIT | IS_LINKED, OFF ); diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index 1caa89699e..f23eac1569 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -68,29 +68,29 @@ void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) GRSetDrawMode( DC, GR_COPY ); - DrawPanel->DrawBackGround( DC ); + m_canvas->DrawBackGround( DC ); TraceWorkSheet( DC, screen, 0 ); /* Redraw the footprints */ for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) { - module->Draw( DrawPanel, DC, GR_OR ); + module->Draw( m_canvas, DC, GR_OR ); } #ifdef USE_WX_OVERLAY if( IsShown() ) { - DrawPanel->m_overlay.Reset(); - wxDCOverlay overlaydc( DrawPanel->m_overlay, (wxWindowDC*)DC ); + m_canvas->m_overlay.Reset(); + wxDCOverlay overlaydc( m_canvas->m_overlay, (wxWindowDC*)DC ); overlaydc.Clear(); } #endif - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); /* Redraw the cursor */ - DrawPanel->DrawCrossHair( DC ); + m_canvas->DrawCrossHair( DC ); } @@ -105,28 +105,28 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) GRSetDrawMode( DC, GR_COPY ); - DrawPanel->DrawBackGround( DC ); + m_canvas->DrawBackGround( DC ); TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness ); - GetBoard()->Draw( DrawPanel, DC, GR_OR ); + GetBoard()->Draw( m_canvas, DC, GR_OR ); DrawGeneralRatsnest( DC ); #ifdef USE_WX_OVERLAY if( IsShown() ) { - DrawPanel->m_overlay.Reset(); - wxDCOverlay overlaydc( DrawPanel->m_overlay, (wxWindowDC*)DC ); + m_canvas->m_overlay.Reset(); + wxDCOverlay overlaydc( m_canvas->m_overlay, (wxWindowDC*)DC ); overlaydc.Clear(); } #endif - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); // Redraw the cursor - DrawPanel->DrawCrossHair( DC ); + m_canvas->DrawCrossHair( DC ); } @@ -232,7 +232,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint } -void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode ) +void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode ) { int draw_mode; @@ -248,7 +248,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode ) { if( (*zc)->GetNet() == aNetCode ) { - (*zc)->Draw( aDrawPanel, DC, draw_mode ); + (*zc)->Draw( am_canvas, DC, draw_mode ); } } @@ -259,7 +259,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode ) { if( pad->GetNet() == aNetCode ) { - pad->Draw( aDrawPanel, DC, draw_mode ); + pad->Draw( am_canvas, DC, draw_mode ); } } } @@ -269,7 +269,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode ) { if( seg->GetNet() == aNetCode ) { - seg->Draw( aDrawPanel, DC, draw_mode ); + seg->Draw( am_canvas, DC, draw_mode ); } } } diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index c000b75ea6..34b76b2d6f 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -28,7 +28,8 @@ private: PCB_EDIT_FRAME* m_Parent; MODULE* m_CurrentModule; -public: DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* aParent, MODULE* aModule ); +public: + DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* aParent, MODULE* aModule ); ~DIALOG_EXCHANGE_MODULE() { }; private: @@ -255,7 +256,7 @@ void DIALOG_EXCHANGE_MODULE::Change_Current_Module() if( m_Parent->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) m_Parent->Compile_Ratsnest( NULL, true ); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } if( pickList.GetCount() ) @@ -344,7 +345,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue ) if( m_Parent->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) m_Parent->Compile_Ratsnest( NULL, true ); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } if( pickList.GetCount() ) @@ -397,7 +398,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll() if( m_Parent->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) m_Parent->Compile_Ratsnest( NULL, true ); - m_Parent->DrawPanel->Refresh(); + m_Parent->GetCanvas()->Refresh(); } if( pickList.GetCount() ) diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index db4b92fa0b..e41e644552 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -115,18 +115,18 @@ int PCB_EDIT_FRAME::Delete_LastCreatedCorner( wxDC* DC ) if( zone->GetNumCorners() == 0 ) return 0; - zone->DrawWhileCreateOutline( DrawPanel, DC, GR_XOR ); + zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR ); if( zone->GetNumCorners() > 2 ) { zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 ); - if( DrawPanel->IsMouseCaptured() ) - DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); } else { - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); zone->RemoveAllContours(); zone->ClearFlags(); @@ -195,7 +195,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont zone_container->m_Poly->InsertCorner(corner_id-1, cx, cy ); zone_container->SetFlags( IN_EDIT ); - DrawPanel->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse, + m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse, Abort_Zone_Move_Corner_Or_Outlines ); s_CornerInitialPosition = zone_container->GetCornerPosition( corner_id ); s_CornerIsNew = IsNewCorner; @@ -210,7 +210,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC, { zone_container->SetFlags( IS_DRAGGED ); zone_container->m_CornerSelection = corner_id; - DrawPanel->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse, + m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse, Abort_Zone_Move_Corner_Or_Outlines ); s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->GetCrossHairPosition(); s_AddCutoutToCurrentZone = false; @@ -244,7 +244,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co zone_container->GetLayer() ); zone_container->SetFlags( IS_MOVED ); - DrawPanel->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse, + m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse, Abort_Zone_Move_Corner_Or_Outlines ); s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->GetCrossHairPosition(); s_CornerIsNew = false; @@ -256,10 +256,10 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container ) { zone_container->ClearFlags(); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); if( DC ) - zone_container->Draw( DrawPanel, DC, GR_OR ); + zone_container->Draw( m_canvas, DC, GR_OR ); OnModify(); s_AddCutoutToCurrentZone = false; @@ -270,7 +270,7 @@ void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* /* Combine zones if possible */ wxBusyCursor dummy; GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone_container, true, s_Verbose ); - DrawPanel->Refresh(); + m_canvas->Refresh(); int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists @@ -297,12 +297,12 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe if( zone_container->m_Poly->GetNumCorners() <= 3 ) { - DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() ); + m_canvas->RefreshDrawingRect( zone_container->GetBoundingBox() ); if( DC ) { // Remove the full zone because this is no more an area zone_container->UnFill(); - zone_container->DrawFilledArea( DrawPanel, DC, GR_XOR ); + zone_container->DrawFilledArea( m_canvas, DC, GR_XOR ); } GetBoard()->Delete( zone_container ); @@ -313,8 +313,8 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe if( DC ) { - GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer ); - GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_XOR, layer ); + GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer ); + GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer ); } _AuxiliaryList.ClearListAndDeleteItems(); @@ -328,8 +328,8 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe if( DC ) { - GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer ); - GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer ); + GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer ); + GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_OR, layer ); } UpdateCopyOfZonesList( s_PickedList, _AuxiliaryList, GetBoard() ); @@ -467,7 +467,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) zone->SetLayer( getActiveLayer() ); // Prompt user for parameters: - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; if( zone->IsOnCopperLayer() ) { // Put a zone on a copper layer @@ -495,8 +495,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) g_Zone_Default_Setting.m_NetcodeSelection = 0; // No net for non copper zones } - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; if( diag == ZONE_ABORT ) return 0; @@ -557,7 +557,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) } SetCurItem( zone ); - DrawPanel->SetMouseCapture( Show_New_Edge_While_Move_Mouse, Abort_Zone_Create_Outline ); + m_canvas->SetMouseCapture( Show_New_Edge_While_Move_Mouse, Abort_Zone_Create_Outline ); } else // edge in progress: { @@ -588,7 +588,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) // Validate the current outline: if( zone->GetNumCorners() <= 2 ) // An outline must have 3 corners or more { - Abort_Zone_Create_Outline( DrawPanel, DC ); + Abort_Zone_Create_Outline( m_canvas, DC ); return true; } @@ -603,21 +603,21 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) { DisplayError( this, _( "DRC error: closing this area creates a drc error with an other area" ) ); - DrawPanel->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); return false; } } zone->ClearFlags(); - zone->DrawWhileCreateOutline( DrawPanel, DC, GR_XOR ); + zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR ); - DrawPanel->SetMouseCapture( NULL, NULL ); + m_canvas->SetMouseCapture( NULL, NULL ); // Undraw old drawings, because they can have important changes int layer = zone->GetLayer(); - GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer ); - GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_XOR, layer ); + GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer ); + GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer ); // Save initial zones configuration, for undo/redo, before adding new zone _AuxiliaryList.ClearListAndDeleteItems(); @@ -655,8 +655,8 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone, true, s_Verbose ); // Redraw the real edge zone : - GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer ); - GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer ); + GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer ); + GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_OR, layer ); int ii = GetBoard()->GetAreaIndex( zone ); // test if zone_container exists @@ -718,7 +718,7 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container ) { int diag; - DrawPanel->m_IgnoreMouseEvents = true; + m_canvas->m_IgnoreMouseEvents = true; /* Save initial zones configuration, for undo/redo, before adding new zone * note the net name and the layer can be changed, so we must save all zones @@ -739,8 +739,8 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container diag = InstallDialogNonCopperZonesEditor( zone_container ); } - DrawPanel->MoveCursorToCrossHair(); - DrawPanel->m_IgnoreMouseEvents = false; + m_canvas->MoveCursorToCrossHair(); + m_canvas->m_IgnoreMouseEvents = false; if( diag == ZONE_ABORT ) { @@ -761,7 +761,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ ) { ZONE_CONTAINER* edge_zone = GetBoard()->GetArea( ii ); - edge_zone->Draw( DrawPanel, DC, GR_XOR ); + edge_zone->Draw( m_canvas, DC, GR_XOR ); } g_Zone_Default_Setting.ExportSetting( *zone_container); @@ -774,7 +774,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone_container, true, s_Verbose ); // Redraw the real new zone outlines: - GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_OR, -1 ); + GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, -1 ); UpdateCopyOfZonesList( s_PickedList, _AuxiliaryList, GetBoard() ); SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED); @@ -807,7 +807,7 @@ void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contain zone_container->m_Poly->RemoveContour( ncont ); } - DrawPanel->RefreshDrawingRect( dirty ); + m_canvas->RefreshDrawingRect( dirty ); OnModify(); } diff --git a/pcbnew/zones_by_polygon_fill_functions.cpp b/pcbnew/zones_by_polygon_fill_functions.cpp index 7600c295f0..08087f2a21 100644 --- a/pcbnew/zones_by_polygon_fill_functions.cpp +++ b/pcbnew/zones_by_polygon_fill_functions.cpp @@ -78,7 +78,7 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp ) if( modify ) { OnModify(); - DrawPanel->Refresh(); + m_canvas->Refresh(); } }