diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 6cd24b5f64..cf09a6d4c2 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -494,10 +494,10 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int cX = aPos.x + aOffset.x; int cY = aPos.y + aOffset.y; - GRLine( &aPanel->m_ClipBox, aDC, cX - anchor_size, cY, + GRLine( aPanel->GetClipBox(), aDC, cX - anchor_size, cY, cX + anchor_size, cY, 0, aAnchor_color ); - GRLine( &aPanel->m_ClipBox, aDC, cX, cY - anchor_size, + GRLine( aPanel->GetClipBox(), aDC, cX, cY - anchor_size, cX, cY + anchor_size, 0, aAnchor_color ); } diff --git a/common/block_commande.cpp b/common/block_commande.cpp index 48a012d559..fa605248a5 100644 --- a/common/block_commande.cpp +++ b/common/block_commande.cpp @@ -131,10 +131,10 @@ void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf GRSetDrawMode( aDC, aDrawMode ); if( w == 0 || h == 0 ) - GRLine( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y, + GRLine( aPanel->GetClipBox(), aDC, GetX() + aOffset.x, GetY() + aOffset.y, GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor ); else - GRRect( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y, + GRRect( aPanel->GetClipBox(), aDC, GetX() + aOffset.x, GetY() + aOffset.y, GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor ); } @@ -241,7 +241,7 @@ 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; - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); return true; } @@ -254,7 +254,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo } Block->m_State = STATE_BLOCK_MOVE; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, startpos, false ); + m_canvas->CallMouseCapture( DC, startpos, false ); break; default: @@ -314,7 +314,7 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC ) if( Panel->IsMouseCaptured() ) /* Erase current drawing on screen */ { /* Clear block outline. */ - Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false ); + Panel->CallMouseCapture( DC, wxDefaultPosition, false ); Panel->SetMouseCapture( NULL, NULL ); screen->SetCurItem( NULL ); diff --git a/common/class_marker_base.cpp b/common/class_marker_base.cpp index 9de65efc59..c15a7f1beb 100644 --- a/common/class_marker_base.cpp +++ b/common/class_marker_base.cpp @@ -162,7 +162,7 @@ void MARKER_BASE::DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, corners[ii] += m_Pos + aOffset; } - GRClosedPoly( &aPanel->m_ClipBox, aDC, CORNERS_COUNT, corners, + GRClosedPoly( aPanel->GetClipBox(), aDC, CORNERS_COUNT, corners, true, // = Filled 0, // outline width m_Color, // outline color diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index 2a28c30390..31507a068a 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -1,9 +1,30 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: copy_to_clipboard.cpp -// Author: jean-pierre Charras -// Created: 18 aug 2006 -// Licence: License GNU -///////////////////////////////////////////////////////////////////////////// +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * 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 copy_to_clipboard.cpp + */ #include "wx/metafile.h" #include "fctsys.h" @@ -73,7 +94,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) wxMetafileDC dc; - EDA_RECT tmp = aFrame->GetCanvas()->m_ClipBox; + EDA_RECT tmp = *aFrame->GetCanvas()->GetClipBox(); GRResetPenAndBrush( &dc ); const bool plotBlackAndWhite = false; GRForceBlackPen( plotBlackAndWhite ); @@ -81,10 +102,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) dc.SetUserScale( scale, scale ); ClipboardSizeX = dc.MaxX() + 10; ClipboardSizeY = dc.MaxY() + 10; - aFrame->GetCanvas()->m_ClipBox.SetX( 0 ); - aFrame->GetCanvas()->m_ClipBox.SetY( 0 ); - aFrame->GetCanvas()->m_ClipBox.SetWidth( 0x7FFFFF0 ); - aFrame->GetCanvas()->m_ClipBox.SetHeight( 0x7FFFFF0 ); + aFrame->GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) ); if( DrawBlock ) { @@ -94,7 +112,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) const int maskLayer = 0xFFFFFFFF; aFrame->PrintPage( &dc, maskLayer, false ); screen->m_IsPrinting = false; - aFrame->GetCanvas()->m_ClipBox = tmp; + aFrame->GetCanvas()->SetClipBox( tmp ); wxMetafile* mf = dc.Close(); if( mf ) diff --git a/common/dialogs/dialog_image_editor.cpp b/common/dialogs/dialog_image_editor.cpp index 48b81ec3f2..b1ca03675a 100644 --- a/common/dialogs/dialog_image_editor.cpp +++ b/common/dialogs/dialog_image_editor.cpp @@ -28,10 +28,7 @@ #include "fctsys.h" #include "gr_basic.h" - #include "common.h" -#include "class_drawpanel.h" - #include "class_bitmap_base.h" #include "dialog_image_editor.h" diff --git a/common/drawframe.cpp b/common/drawframe.cpp index a92b9c12cc..361ae0be0b 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -183,7 +183,7 @@ void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event ) m_FrameIsActive = event.GetActive(); if( m_canvas ) - m_canvas->m_CanStartBlock = -1; + m_canvas->SetCanStartBlock( -1 ); event.Skip(); // required under wxMAC } @@ -192,7 +192,7 @@ void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event ) void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event ) { if( m_canvas ) - m_canvas->m_CanStartBlock = -1; + m_canvas->SetCanStartBlock( -1 ); event.Skip(); } @@ -486,7 +486,7 @@ int EDA_DRAW_FRAME::ReturnBlockCommand( int key ) void EDA_DRAW_FRAME::InitBlockPasteInfos() { GetScreen()->m_BlockLocate.ClearItemsList(); - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); } diff --git a/common/drawpanel.cpp b/common/drawpanel.cpp index b7698705f0..c682d18818 100644 --- a/common/drawpanel.cpp +++ b/common/drawpanel.cpp @@ -94,19 +94,19 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, m_ClipBox.SetSize( size ); m_ClipBox.SetX( 0 ); m_ClipBox.SetY( 0 ); - m_CanStartBlock = -1; // Command block can start if >= 0 - m_AbortEnable = m_AbortRequest = false; - m_AutoPAN_Enable = true; - m_IgnoreMouseEvents = 0; + m_canStartBlock = -1; // Command block can start if >= 0 + m_abortRequest = false; + m_enableAutoPan = true; + m_ignoreMouseEvents = false; m_mouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL; if( wxGetApp().GetSettings() ) - wxGetApp().GetSettings()->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true ); + wxGetApp().GetSettings()->Read( wxT( "AutoPAN" ), &m_enableAutoPan, true ); - m_AutoPAN_Request = false; - m_Block_Enable = false; + m_requestAutoPan = false; + m_enableBlockCommands = false; #ifdef __WXMAC__ m_defaultCursor = m_currentCursor = wxCURSOR_CROSS; @@ -116,14 +116,14 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, m_showCrossHair = true; #endif - m_cursorLevel = 0; + m_cursorLevel = 0; m_PrintIsMirrored = false; } EDA_DRAW_PANEL::~EDA_DRAW_PANEL() { - wxGetApp().GetSettings()->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable ); + wxGetApp().GetSettings()->Write( wxT( "AutoPAN" ), m_enableAutoPan ); } @@ -306,7 +306,7 @@ void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition ) void EDA_DRAW_PANEL::OnActivate( wxActivateEvent& event ) { - m_CanStartBlock = -1; // Block Command can't start + m_canStartBlock = -1; // Block Command can't start event.Skip(); } @@ -747,10 +747,10 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event ) GetParent()->AddMenuZoomAndGrid( &MasterMenu ); pos = event.GetPosition(); - m_IgnoreMouseEvents = true; + m_ignoreMouseEvents = true; PopupMenu( &MasterMenu, pos ); MoveCursorToCrossHair(); - m_IgnoreMouseEvents = false; + m_ignoreMouseEvents = false; return true; } @@ -759,9 +759,9 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event ) void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event ) { if( m_mouseCaptureCallback == NULL ) // No command in progress. - m_AutoPAN_Request = false; + m_requestAutoPan = false; - if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents ) + if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents ) return; // Auto pan if mouse is leave working area: @@ -781,7 +781,7 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event ) void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) { - if( m_IgnoreMouseEvents ) + if( m_ignoreMouseEvents ) return; wxRect rect = wxRect( wxPoint( 0, 0 ), GetClientSize() ); @@ -853,18 +853,18 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) /* Count the drag events. Used to filter mouse moves before starting a * block command. A block command can be started only if * MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND - * and m_CanStartBlock >= 0 + * and m_canStartBlock >= 0 * in order to avoid spurious block commands. */ static int MinDragEventCount; if( event.Leaving() ) { - m_CanStartBlock = -1; + m_canStartBlock = -1; } if( !IsMouseCaptured() ) // No mouse capture in progress. - m_AutoPAN_Request = false; + m_requestAutoPan = false; if( GetParent()->IsActive() ) SetFocus(); @@ -882,7 +882,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) return; } - if( m_IgnoreMouseEvents ) + if( m_ignoreMouseEvents ) return; if( event.LeftIsDown() ) @@ -969,7 +969,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) if( LastPanel != this ) { MinDragEventCount = 0; - m_CanStartBlock = -1; + m_canStartBlock = -1; } /* A new command block can start after a release buttons @@ -981,7 +981,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) if( !event.LeftIsDown() && !event.MiddleIsDown() ) { MinDragEventCount = 0; - m_CanStartBlock = 0; + m_canStartBlock = 0; /* Remember the last cursor position when a drag mouse starts * this is the last position ** before ** clicking a button @@ -993,7 +993,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) m_CursorStartPos = screen->GetCrossHairPosition(); } - if( m_Block_Enable && !(localbutt & GR_M_DCLICK) ) + if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) ) { if( !screen->IsBlockActive() ) { @@ -1004,12 +1004,12 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) { if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE ) { - m_AutoPAN_Request = false; + m_requestAutoPan = false; GetParent()->HandleBlockPlace( &DC ); ignoreNextLeftButtonRelease = true; } } - else if( ( m_CanStartBlock >= 0 ) + else if( ( m_canStartBlock >= 0 ) && ( event.LeftIsDown() || event.MiddleIsDown() ) && !IsMouseCaptured() ) { @@ -1038,7 +1038,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) } else { - m_AutoPAN_Request = true; + m_requestAutoPan = true; SetCursor( wxCURSOR_SIZING ); } } @@ -1064,19 +1064,19 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) if( m_endMouseCaptureCallback ) { m_endMouseCaptureCallback( this, &DC ); - m_AutoPAN_Request = false; + m_requestAutoPan = false; } SetCursor( m_currentCursor ); } else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END ) { - m_AutoPAN_Request = false; + m_requestAutoPan = false; GetParent()->HandleBlockEnd( &DC ); SetCursor( m_currentCursor ); if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE ) { - m_AutoPAN_Request = true; + m_requestAutoPan = true; SetCursor( wxCURSOR_HAND ); } } @@ -1124,7 +1124,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event ) break; case WXK_ESCAPE: - m_AbortRequest = true; + m_abortRequest = true; if( IsMouseCaptured() ) EndMouseCapture(); @@ -1227,7 +1227,7 @@ void EDA_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title, m_mouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL; - m_AutoPAN_Request = false; + m_requestAutoPan = false; if( id != -1 && cursor != -1 ) { @@ -1235,3 +1235,21 @@ void EDA_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title, GetParent()->SetToolID( id, cursor, title ); } } + + +void EDA_DRAW_PANEL::CallMouseCapture( wxDC* aDC, const wxPoint& aPosition, bool aErase ) +{ + wxCHECK_RET( aDC != NULL, wxT( "Invalid device context." ) ); + wxCHECK_RET( m_mouseCaptureCallback != NULL, wxT( "Mouse capture callback not set." ) ); + + m_mouseCaptureCallback( this, aDC, aPosition, aErase ); +} + + +void EDA_DRAW_PANEL::CallEndMouseCapture( wxDC* aDC ) +{ + wxCHECK_RET( aDC != NULL, wxT( "Invalid device context." ) ); + wxCHECK_RET( m_endMouseCaptureCallback != NULL, wxT( "End mouse capture callback not set." ) ); + + m_endMouseCaptureCallback( this, aDC ); +} diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 46c34a8ef8..90991306b9 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -249,7 +249,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, int overbar_italic_comp; // Italic compensation for overbar EDA_RECT* clipBox; // Clip box used in basic draw functions - clipBox = aPanel ? &aPanel->m_ClipBox : NULL; + clipBox = aPanel ? aPanel->GetClipBox() : NULL; #define BUF_SIZE 100 wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape) bool sketch_mode = false; @@ -292,10 +292,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, xc = current_char_pos.x; yc = current_char_pos.y; - x0 = aPanel->m_ClipBox.GetX() - ll; - y0 = aPanel->m_ClipBox.GetY() - ll; - xm = aPanel->m_ClipBox.GetRight() + ll; - ym = aPanel->m_ClipBox.GetBottom() + ll; + x0 = aPanel->GetClipBox()->GetX() - ll; + y0 = aPanel->GetClipBox()->GetY() - ll; + xm = aPanel->GetClipBox()->GetRight() + ll; + ym = aPanel->GetClipBox()->GetBottom() + ll; if( xc < x0 ) return; @@ -366,7 +366,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y ); } else - GRLine( &aPanel->m_ClipBox, aDC, + GRLine( aPanel->GetClipBox(), aDC, current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor ); return; diff --git a/common/edaappl.cpp b/common/edaappl.cpp index df2136d9cc..f888a3f390 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -24,7 +24,7 @@ */ /** - * @file edaapl.cpp + * @file edaappl.cpp * * @brief For the main application: init functions, and language selection * (locale handling) diff --git a/common/worksheet.cpp b/common/worksheet.cpp index 9ea4736678..23009eff34 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( &m_canvas->m_ClipBox, DC, 0, 0, + GRRect( m_canvas->GetClipBox(), 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( &m_canvas->m_ClipBox, DC, refx * scale, refy * scale, + GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale, xg * scale, yg * scale, width, Color ); #else for( ii = 0; ii < 2; ii++ ) { - GRRect( &m_canvas->m_ClipBox, DC, refx * scale, refy * scale, + GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale, xg * scale, yg * scale, width, Color ); refx += GRID_REF_W; refy += GRID_REF_W; @@ -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( &m_canvas->m_ClipBox, DC, pos.x, pos.y, + GRLine( m_canvas->GetClipBox(), 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( &m_canvas->m_ClipBox, DC, pos.x, pos.y, + GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } @@ -1117,7 +1117,7 @@ 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( &m_canvas->m_ClipBox, DC, ii * scale, refy * scale, + GRLine( m_canvas->GetClipBox(), DC, ii * scale, refy * scale, ii * scale, ( refy + GRID_REF_W ) * scale, width, Color ); } DrawGraphicText( m_canvas, DC, @@ -1128,7 +1128,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid width, false, false ); if( ii < xg - PAS_REF / 2 ) { - GRLine( &m_canvas->m_ClipBox, DC, ii * scale, yg * scale, + GRLine( m_canvas->GetClipBox(), DC, ii * scale, yg * scale, ii * scale, ( yg - GRID_REF_W ) * scale, width, Color ); } DrawGraphicText( m_canvas, DC, @@ -1141,17 +1141,20 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid ipas = ( yg - refy ) / PAS_REF; gypas = ( yg - refy ) / ipas; + for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- ) { if( jj < 26 ) Line.Printf( wxT( "%c" ), jj + 'A' ); else // I hope 52 identifiers are enought... Line.Printf( wxT( "%c" ), 'a' + jj - 26 ); + if( ii < yg - PAS_REF / 2 ) { - GRLine( &m_canvas->m_ClipBox, DC, refx * scale, ii * scale, + GRLine( m_canvas->GetClipBox(), DC, refx * scale, ii * scale, ( refx + GRID_REF_W ) * scale, ii * scale, width, Color ); } + DrawGraphicText( m_canvas, DC, wxPoint( ( refx + GRID_REF_W / 2 ) * scale, ( ii - gypas / 2 ) * scale ), @@ -1160,7 +1163,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid width, false, false ); if( ii < yg - PAS_REF / 2 ) { - GRLine( &m_canvas->m_ClipBox, DC, xg * scale, ii * scale, + GRLine( m_canvas->GetClipBox(), DC, xg * scale, ii * scale, ( xg - GRID_REF_W ) * scale, ii * scale, width, Color ); } DrawGraphicText( m_canvas, DC, @@ -1312,7 +1315,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( &m_canvas->m_ClipBox, DC, pos.x, pos.y, + GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } @@ -1375,7 +1378,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( &m_canvas->m_ClipBox, DC, pos.x, pos.y, + GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } @@ -1570,7 +1573,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( &m_canvas->m_ClipBox, DC, pos.x, pos.y, + GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 63d77aee33..66cea3c30a 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -415,7 +415,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi if( m_canvas->IsMouseCaptured() ) { - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, 0 ); + m_canvas->CallMouseCapture( aDC, aPosition, 0 ); } } diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 0b7f5f42ff..16f80961ce 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 ); - m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); } @@ -139,7 +139,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_DRAG: /* Drag */ case BLOCK_MOVE: /* Move */ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector ); MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector ); @@ -149,7 +149,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_COPY: /* Copy */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector ); @@ -161,7 +161,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_PASTE: if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); PasteListOfItems( DC ); block->ClearItemsList(); @@ -206,8 +206,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) BlockState state = block->m_State; CmdBlockType command = block->m_Command; - if( m_canvas->m_endMouseCaptureCallback ) - m_canvas->m_endMouseCaptureCallback( m_canvas, DC ); + m_canvas->CallEndMouseCapture( DC ); block->m_State = state; block->m_Command = command; @@ -243,14 +242,14 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) { nextcmd = true; GetScreen()->SelectBlockItems(); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); - m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); + m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); block->m_State = STATE_BLOCK_MOVE; } else { - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->SetMouseCapture( NULL, NULL ); } break; @@ -352,7 +351,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) case BLOCK_DRAG: /* move to Drag */ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); // Clear list of items to move, and rebuild it with items to drag: block->ClearItemsList(); @@ -366,7 +365,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) GetScreen()->SelectBlockItems(); if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); block->m_State = STATE_BLOCK_MOVE; } @@ -374,7 +373,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) case BLOCK_DELETE: /* move to Delete */ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -388,7 +387,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) case BLOCK_SAVE: /* Save list in paste buffer*/ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -399,7 +398,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) break; case BLOCK_ZOOM: /* Window Zoom */ - m_canvas->m_endMouseCaptureCallback( m_canvas, DC ); + m_canvas->CallEndMouseCapture( DC ); m_canvas->SetCursor( m_canvas->GetDefaultCursor() ); Window_Zoom( GetScreen()->m_BlockLocate ); break; @@ -407,7 +406,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) case BLOCK_ROTATE: if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -426,7 +425,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) case BLOCK_MIRROR_X: if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); if( block->GetCount() ) { @@ -444,7 +443,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) case BLOCK_MIRROR_Y: if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); if( block->GetCount() ) { diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index 35cc237d0f..1d8b8f9c7b 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -92,7 +92,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) { BlockState state = GetScreen()->m_BlockLocate.m_State; CmdBlockType command = GetScreen()->m_BlockLocate.m_Command; - m_canvas->m_endMouseCaptureCallback( m_canvas, DC ); + m_canvas->CallEndMouseCapture( DC ); GetScreen()->m_BlockLocate.m_State = state; GetScreen()->m_BlockLocate.m_Command = command; m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); @@ -120,9 +120,9 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) if( m_canvas->IsMouseCaptured() ) { - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); - m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); + m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; @@ -132,7 +132,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ nextCmd = true; - m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; break; diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 8ec0692152..02b034f9fb 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -181,7 +181,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) return; } - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( 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 */ @@ -218,7 +218,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) oldsegment->SetFlags( SELECTED ); newsegment->SetFlags( IS_NEW ); GetScreen()->SetCurItem( newsegment ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( 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, @@ -444,7 +444,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) } screen->RemoveFromDrawList( screen->GetCurItem() ); - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); screen->SetCurItem( NULL ); } diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 165181ba50..b06350f400 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -362,9 +362,9 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff #if 0 int len = aDc->DeviceToLogicalXRel( 3 ); - GRLine( &aPanel->m_ClipBox, aDc, aOffset.x, aOffset.y - len, aOffset.x, + GRLine( aPanel->GetClipBox(), aDc, aOffset.x, aOffset.y - len, aOffset.x, aOffset.y + len, 0, aColor ); - GRLine( &aPanel->m_ClipBox, aDc, aOffset.x - len, aOffset.y, aOffset.x + len, + GRLine( aPanel->GetClipBox(), aDc, aOffset.x - len, aOffset.y, aOffset.x + len, aOffset.y, 0, aColor ); #endif @@ -372,7 +372,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff * the bounding box calculations. */ #if 0 EDA_RECT bBox = GetBoundingBox( aMulti, aConvert ); - GRRect( &aPanel->m_ClipBox, aDc, bBox.GetOrigin().x, bBox.GetOrigin().y, + GRRect( aPanel->GetClipBox(), aDc, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index e1e77748b0..0fddf914a1 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 && m_canvas->m_AbortRequest ) + if( !item && m_canvas->GetAbortRequest() ) { - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( false ); return NULL; } @@ -73,7 +73,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC if( !item ) { - m_canvas->m_AbortRequest = false; // Just in case the user aborted the context menu. + m_canvas->SetAbortRequest( false ); // Just in case the user aborted the context menu. return NULL; } @@ -171,7 +171,7 @@ 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 ); - m_canvas->m_AbortRequest = true; // Changed to false if an item is selected + m_canvas->SetAbortRequest( true ); // Changed to false if an item is selected PopupMenu( &selectMenu ); m_canvas->MoveCursorToCrossHair(); item = GetScreen()->GetCurItem(); @@ -247,16 +247,18 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH if( m_canvas->IsMouseCaptured() ) { #ifdef USE_WX_OVERLAY - wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC ); + wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC ); oDC.Clear(); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false ); + m_canvas->CallMouseCapture( aDC, aPosition, false ); #else - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); + m_canvas->CallMouseCapture( aDC, aPosition, true ); #endif } #ifdef USE_WX_OVERLAY else - m_canvas->m_overlay.Reset(); + { + m_overlay.Reset(); + } #endif } @@ -330,16 +332,18 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH if( m_canvas->IsMouseCaptured() ) { #ifdef USE_WX_OVERLAY - wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC ); + wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC ); oDC.Clear(); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false ); + m_canvas->CallMouseCapture( aDC, aPosition, false ); #else - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); + m_canvas->CallMouseCapture( aDC, aPosition, true ); #endif } #ifdef USE_WX_OVERLAY else - m_canvas->m_overlay.Reset(); + { + m_overlay.Reset(); + } #endif } @@ -409,7 +413,7 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH if( m_canvas->IsMouseCaptured() ) { - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); + m_canvas->CallMouseCapture( aDC, aPosition, true ); } } diff --git a/eeschema/dialogs/dialog_SVG_print.cpp b/eeschema/dialogs/dialog_SVG_print.cpp index d1d3def2d6..85739100cc 100644 --- a/eeschema/dialogs/dialog_SVG_print.cpp +++ b/eeschema/dialogs/dialog_SVG_print.cpp @@ -220,15 +220,13 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, float dpi = (float) frame->GetInternalUnits(); wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi ); - EDA_RECT tmp = panel->m_ClipBox; + EDA_RECT tmp = *panel->GetClipBox(); GRResetPenAndBrush( &dc ); GRForceBlackPen( aPrintBlackAndWhite ); - panel->m_ClipBox.SetX( -0x3FFFFF0 ); - panel->m_ClipBox.SetY( -0x3FFFFF0 ); - panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); - panel->m_ClipBox.SetHeight( 0x7FFFFF0 ); + panel->SetClipBox( EDA_RECT( wxPoint( -0x3FFFFF0, -0x3FFFFF0 ), + wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) ); screen->m_IsPrinting = true; screen->Draw( panel, &dc, GR_COPY ); @@ -238,7 +236,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, SetLocaleTo_Default(); // revert to the current locale screen->m_IsPrinting = false; - panel->m_ClipBox = tmp; + panel->SetClipBox( tmp ); GRForceBlackPen( false ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index f1da61fd4a..ba310c121d 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!" ) ); - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); DIALOG_EDIT_COMPONENT_IN_SCHEMATIC* dlg = new DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( this ); @@ -55,7 +55,7 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent ) DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dlg->GetSize(); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); dlg->Destroy(); } diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 181d8bf89d..d77fe74f07 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -324,11 +324,10 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) tmp_startvisu = aScreen->m_StartVisu; oldZoom = aScreen->GetZoom(); old_org = aScreen->m_DrawOrg; - oldClipBox = panel->m_ClipBox; + oldClipBox = *panel->GetClipBox(); /* Change scale factor, offsets, and clip box to print the whole page. */ - panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) ); - panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ); + panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) ); bool printReference = parent->GetPrintSheetReference(); @@ -378,7 +377,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) g_DrawBgColor = bg_color; aScreen->m_IsPrinting = false; - panel->m_ClipBox = oldClipBox; + panel->SetClipBox( oldClipBox ); GRForceBlackPen( false ); diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 04f3c6c3fc..77d99bad0d 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; - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); wxString title; title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) ); @@ -83,7 +83,7 @@ create a new power component with the new value." ), GetChars( entry->GetName() int response = dlg.ShowModal(); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); newtext = dlg.GetValue( ); newtext.Trim( true ); newtext.Trim( false ); diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 6de40ff459..c4c4fb7001 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2009-2011 Wayne Stambaugh + * Copyright (C) 2004-2011 KiCad Developers, see change_log.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 eeredraw.cpp */ @@ -29,7 +54,7 @@ void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, in if( !screen->m_IsPrinting ) /* Draw but do not print the Dangling Symbol */ { - GRRect( &panel->m_ClipBox, DC, + GRRect( panel->GetClipBox(), DC, pos.x - DANGLING_SYMBOL_SIZE, pos.y - DANGLING_SYMBOL_SIZE, pos.x + DANGLING_SYMBOL_SIZE, pos.y + DANGLING_SYMBOL_SIZE, 0, Color ); @@ -54,7 +79,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness ); if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, FALSE ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, FALSE ); m_canvas->DrawCrossHair( DC ); diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index bbc57da4b0..f05963100f 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( m_canvas->m_AutoPAN_Enable ); + dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); 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(); - m_canvas->m_AutoPAN_Enable = dlg.GetEnableAutoPan(); + m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() ); g_HVLines = dlg.GetEnableHVBusOrientation(); g_ShowPageLimits = dlg.GetShowPageLimits(); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index f347c983c7..a8c362d8cf 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; - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); if( !libname.IsEmpty() ) { @@ -122,7 +122,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if ( dlg.ShowModal() == wxID_CANCEL ) { - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -140,7 +140,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( Name.IsEmpty() ) { - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -157,7 +157,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( Name.IsEmpty() ) { - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -168,7 +168,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( GetNameOfPartToLoad( this, Library, Name ) == 0 ) { - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -180,7 +180,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( Name.IsEmpty() ) { - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); return NULL; } @@ -200,13 +200,13 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, if( Entry == NULL ) { - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); return NULL; } } - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); if( Entry == NULL ) diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index 20a98cbb09..579a88e96a 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -280,7 +280,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet() // update the References m_CurrentSheet->UpdateAllScreenReferences(); SetSheetNumberAndCount(); - m_canvas->m_CanStartBlock = -1; + m_canvas->SetCanStartBlock( -1 ); if( screen->m_FirstRedraw ) { diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 3d71b8ed0f..5c0c16b055 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -416,21 +416,27 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf fill = NO_FILL; if( fill == FILLED_WITH_BG_BODYCOLOR ) - GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, + { + GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize( ), (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + } else if( fill == FILLED_SHAPE && !aData ) - GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color ); + { + GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, + color, color ); + } else { #ifdef DRAW_ARC_WITH_ANGLE - GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize(), color ); + GRArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, + GetPenSize(), color ); #else - GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, + GRArc1( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, GetPenSize(), color ); #endif } @@ -439,7 +445,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf * calculation. */ #if 0 EDA_RECT bBox = GetBoundingBox(); - GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, + GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index 2c3888ad66..330aa0bc93 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -332,15 +332,15 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& GRSetDrawMode( aDC, aDrawMode ); if( fill == FILLED_WITH_BG_BODYCOLOR ) - GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), + GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], 1, GetPenSize(), (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE ) - GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), + GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], 1, GetPenSize(), color, color ); else - GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), + GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], 0, GetPenSize(), color, color ); /* Set to one (1) to draw bounding box around bezier curve to validate @@ -348,7 +348,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& #if 0 EDA_RECT bBox = GetBoundingBox(); bBox.Inflate( m_Thickness + 1, m_Thickness + 1 ); - GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, + GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index bd8a78e0c3..391583655b 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -244,19 +244,19 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& fill = NO_FILL; if( fill == FILLED_WITH_BG_BODYCOLOR ) - GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), + GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE ) - GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, m_Radius, 0, color, color ); + GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, 0, color, color ); else - GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), color ); + GRCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), color ); /* Set to one (1) to draw bounding box around circle to validate bounding * box calculation. */ #if 0 EDA_RECT bBox = GetBoundingBox(); - GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, + GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/lib_draw_item.cpp b/eeschema/lib_draw_item.cpp index 801fc7fe59..32293af452 100644 --- a/eeschema/lib_draw_item.cpp +++ b/eeschema/lib_draw_item.cpp @@ -140,7 +140,7 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, if( m_eraseLastDrawItem ) { GRSetDrawMode( aDC, g_XorMode ); - drawEditGraphics( &aPanel->m_ClipBox, aDC, color ); + drawEditGraphics( aPanel->GetClipBox(), aDC, color ); drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData, aTransform ); } @@ -148,7 +148,7 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, calcEdit( aOffset ); // Draw the items using the new attributes. - drawEditGraphics( &aPanel->m_ClipBox, aDC, color ); + drawEditGraphics( aPanel->GetClipBox(), aDC, color ); drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData, aTransform ); m_Fill = fillMode; diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index d41188faa4..b5cad9f212 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -325,7 +325,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) ); grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) ); grBox.Move( aOffset ); - GRRect( &aPanel->m_ClipBox, aDC, grBox, 0, LIGHTMAGENTA ); + GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index cd2ea8cc53..ffc9c7aadb 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -853,7 +853,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, /* Set to one (1) to draw bounding box around pin to validate bounding * box calculation. */ #if 0 - EDA_RECT* clipbox = aPanel ? &aPanel->m_ClipBox : NULL; + EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL; TRANSFORM transform = DefaultTransform; DefaultTransform = aTransform; EDA_RECT bBox = GetBoundingBox(); @@ -876,7 +876,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, int color; int width = GetPenSize(); int posX = aPinPos.x, posY = aPinPos.y, len = m_length; - EDA_RECT* clipbox = aPanel ? &aPanel->m_ClipBox : NULL; + EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL; color = ReturnLayerColor( LAYER_PIN ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index acb2290908..40fcd1b88f 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -305,14 +305,14 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint GRSetDrawMode( aDC, aDrawMode ); if( fill == FILLED_WITH_BG_BODYCOLOR ) - GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), + GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE ) - GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), + GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), color, color ); else - GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(), + GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(), color, color ); delete[] buffer; @@ -322,7 +322,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint #if 0 EDA_RECT bBox = GetBoundingBox(); bBox.Inflate( m_Thickness + 1, m_Thickness + 1 ); - GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, + GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 765a115fb7..438552324e 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -233,21 +233,21 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GRSetDrawMode( aDC, aDrawMode ); if( fill == FILLED_WITH_BG_BODYCOLOR && !aData ) - GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize( ), + GRFilledRect( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize( ), (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( m_Fill == FILLED_SHAPE && !aData ) - GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, + GRFilledRect( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize(), color, color ); else - GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize(), color ); + GRRect( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize(), color ); /* Set to one (1) to draw bounding box around rectangle to validate * bounding box calculation. */ #if 0 EDA_RECT bBox = GetBoundingBox(); bBox.Inflate( m_Thickness + 1, m_Thickness + 1 ); - GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, + GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 4e6e4d9a06..391d472033 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -403,7 +403,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) ); grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) ); grBox.Move( aOffset ); - GRRect( &aPanel->m_ClipBox, aDC, grBox, 0, LIGHTMAGENTA ); + GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA ); #endif } diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index d73356e0d7..38909883a5 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -252,7 +252,7 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) } if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->DrawCrossHair( DC ); diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index 2c94e78a22..fee4a66616 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2010 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 libedit_onleftclick.cpp * @brief Eeschema library editor event handler for a mouse left button single or double click. @@ -27,13 +52,16 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) item = LocateItemUsingCursor( aPosition ); if( item ) + + { item->DisplayInfo( this ); + } else { DisplayCmpDoc(); - if( m_canvas->m_AbortRequest ) - m_canvas->m_AbortRequest = false; + if( m_canvas->GetAbortRequest() ) + m_canvas->SetAbortRequest( false ); } } @@ -135,7 +163,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition ) else return; - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); switch( m_drawItem->Type() ) { @@ -188,5 +216,5 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition ) } m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); } diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index a4931a42c4..241cecd42b 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 && m_canvas->m_AbortRequest ) + if( item == NULL && m_canvas->GetAbortRequest() ) { - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( false ); return false; } diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 0e23437c26..12afe1036c 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -224,7 +224,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); if( m_canvas ) - m_canvas->m_Block_Enable = true; + m_canvas->SetEnableBlockCommands( true ); EnsureActiveLibExists(); ReCreateMenuBar(); @@ -616,7 +616,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) int id = event.GetId(); wxPoint pos; - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); wxGetMousePosition( &pos.x, &pos.y ); pos.y += 20; @@ -788,55 +788,55 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_ZOOM_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM; HandleBlockEnd( &dc ); break; case ID_POPUP_DELETE_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE; m_canvas->MoveCursorToCrossHair(); HandleBlockEnd( &dc ); break; case ID_POPUP_COPY_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; case ID_POPUP_SELECT_ITEMS_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY; m_canvas->MoveCursorToCrossHair(); HandleBlockEnd( &dc ); break; case ID_POPUP_MIRROR_Y_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_Y; m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; case ID_POPUP_MIRROR_X_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X; m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; case ID_POPUP_ROTATE_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE; m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; case ID_POPUP_PLACE_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; @@ -846,7 +846,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; } - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); if( GetToolId() == ID_NO_TOOL_SELECTED ) m_lastDrawItem = NULL; @@ -1072,7 +1072,7 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) break; } - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); } @@ -1160,7 +1160,7 @@ 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; - m_canvas->m_AbortRequest = true; // Changed to false if an item is selected + m_canvas->SetAbortRequest( true ); // Changed to false if an item is selected PopupMenu( &selectMenu ); m_canvas->MoveCursorToCrossHair(); item = m_drawItem; @@ -1212,7 +1212,7 @@ void LIB_EDIT_FRAME::deleteItem( wxDC* aDC ) { if( m_canvas->IsMouseCaptured() ) { - m_canvas->m_endMouseCaptureCallback( m_canvas, aDC ); + m_canvas->CallEndMouseCapture( aDC ); } else { @@ -1237,7 +1237,7 @@ void LIB_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent ) && (index >= 0 && index < m_collectedItems.GetCount()) ) { LIB_ITEM* item = m_collectedItems[index]; - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( false ); m_drawItem = item; } } diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index 6c16457224..d6618e046c 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() ) ) { - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); m_itemToRepeat = NULL; if( item && item->GetFlags() ) @@ -129,12 +129,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { m_itemToRepeat = AddNoConnect( aDC, gridPosition ); GetScreen()->SetCurItem( m_itemToRepeat ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); } GetScreen()->TestDanglingEnds(); @@ -146,12 +146,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { m_itemToRepeat = AddJunction( aDC, gridPosition, true ); GetScreen()->SetCurItem( m_itemToRepeat ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); } GetScreen()->TestDanglingEnds(); @@ -165,7 +165,7 @@ 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 ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { @@ -173,7 +173,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) GetScreen()->SetCurItem( NULL ); GetScreen()->TestDanglingEnds(); m_canvas->Refresh( true ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); } break; @@ -183,29 +183,29 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) case ID_WIRE_BUTT: BeginSegment( aDC, LAYER_WIRE ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); break; case ID_BUS_BUTT: BeginSegment( aDC, LAYER_BUS ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); break; case ID_LINE_COMMENT_BUTT: BeginSegment( aDC, LAYER_NOTES ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); break; case ID_TEXT_COMMENT_BUTT: if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) { GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( 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 ) ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); } break; @@ -226,12 +226,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) { GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->TestDanglingEnds(); m_canvas->Refresh( true ); } @@ -247,12 +247,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( GetToolId() == ID_HIERLABEL_BUTT ) GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->TestDanglingEnds(); m_canvas->Refresh( true ); } @@ -262,12 +262,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) { GetScreen()->SetCurItem( CreateSheet( aDC ) ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->TestDanglingEnds(); m_canvas->Refresh( true ); } @@ -300,12 +300,12 @@ 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 ) ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->TestDanglingEnds(); m_canvas->Refresh( true ); } @@ -316,12 +316,12 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { GetScreen()->SetCurItem( Load_Component( aDC, wxT( "power" ), s_PowerNameList, false ) ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { item->Place( this, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); GetScreen()->TestDanglingEnds(); m_canvas->Refresh( true ); } diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index fd10526209..270897f7c8 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. - m_canvas->m_CanStartBlock = -1; + m_canvas->SetCanStartBlock( -1 ); if( BlockActive ) { @@ -91,15 +91,15 @@ 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 && m_canvas->m_AbortRequest ) + if( item == NULL && m_canvas->GetAbortRequest() ) { - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( false ); return false; } } // If Command in progress: add "cancel" and "end tool" menu - if( GetToolId() != ID_NO_TOOL_SELECTED ) + if( GetToolId() != ID_NO_TOOL_SELECTED ) { if( item && item->GetFlags() ) { diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 9cf7ec365a..719b39bdda 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -220,12 +220,12 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC ) if( ask_for_pin && SynchronizePins() ) { - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); status = IsOK( this, _( "This position is already occupied by \ another pin. Continue?" ) ); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); if( !status ) return; @@ -398,12 +398,12 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC ) pin->SetUnit( LastPinCommonUnit ? 0 : m_unit ); pin->SetVisible( LastPinVisible ); PinPreviousPos = pin->GetPosition(); - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetId( ID_LIBEDIT_EDIT_PIN ); GetEventHandler()->ProcessEvent( cmd ); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); if( pin->GetFlags() & IS_CANCELLED ) { diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index a3ef919b93..2007bde7f7 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -190,7 +190,7 @@ void SCH_BITMAP::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset wxSize size = m_Image->GetSize(); pos.x -= size.x / 2; pos.y -= size.y / 2; - GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y, + GRRect( aPanel->GetClipBox(), aDC, pos.x, pos.y, pos.x + size.x, pos.y + size.y, 0, aColor ); } } diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 1d676d8d48..63db57e180 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -199,7 +199,7 @@ void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff GRSetDrawMode( aDC, aDrawMode ); - GRLine( &aPanel->m_ClipBox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, + GRLine( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color ); } diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index d6f935c7a2..d812bcec20 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -334,18 +334,18 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset { EDA_RECT BoundaryBox; BoundaryBox = GetBoundingBox(); - GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); + GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); #if 1 if( GetField( REFERENCE )->IsVisible() ) { BoundaryBox = GetField( REFERENCE )->GetBoundingBox(); - GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); + GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); } if( GetField( VALUE )->IsVisible() ) { BoundaryBox = GetField( VALUE )->GetBoundingBox(); - GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); + GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); } #endif } diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 2d1d245108..c4a8dd0671 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -201,7 +201,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, #if 0 // Draw boundary box: - GRRect( &panel->m_ClipBox, DC, boundaryBox, 0, BROWN ); + GRRect( panel->GetClipBox(), DC, boundaryBox, 0, BROWN ); // Draw the text anchor point @@ -211,9 +211,9 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, textpos = parentComponent->GetScreenCoord( textpos ); textpos += parentComponent->GetPosition(); const int len = 10; - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE ); #endif } diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index e39c97bc63..8c2f1f0fa6 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -134,7 +134,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs GRSetDrawMode( aDC, aDrawMode ); - GRFilledCircle( &aPanel->m_ClipBox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, + GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, ( m_size.x / 2 ), 0, color, color ); } diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 5638f74788..a495e2c2f9 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -240,13 +240,14 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, if( ( m_Flags & STARTPOINT ) == 0 ) start += offset; + if( ( m_Flags & ENDPOINT ) == 0 ) end += offset; if( m_Layer == LAYER_NOTES ) - GRDashedLine( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, width, color ); + GRDashedLine( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, width, color ); else - GRLine( &panel->m_ClipBox, DC, start, end, width, color ); + GRLine( panel->GetClipBox(), DC, start, end, width, color ); if( m_startIsDangling ) DrawDanglingSymbol( panel, DC, start, color ); diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index edc7204512..3b24b32c96 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -148,8 +148,10 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf GRSetDrawMode( aDC, aDrawMode ); - GRLine( &aPanel->m_ClipBox, aDC, pX - delta, pY - delta, pX + delta, pY + delta, width, color ); - GRLine( &aPanel->m_ClipBox, aDC, pX + delta, pY - delta, pX - delta, pY + delta, width, color ); + GRLine( aPanel->GetClipBox(), aDC, pX - delta, pY - delta, pX + delta, pY + delta, + width, color ); + GRLine( aPanel->GetClipBox(), aDC, pX + delta, pY - delta, pX - delta, pY + delta, + width, color ); } diff --git a/eeschema/sch_polyline.cpp b/eeschema/sch_polyline.cpp index 7e131b1f68..9d7e129690 100644 --- a/eeschema/sch_polyline.cpp +++ b/eeschema/sch_polyline.cpp @@ -187,13 +187,13 @@ void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs if( m_Layer == LAYER_NOTES ) { for( unsigned i = 1; i < GetCornerCount(); i++ ) - GRDashedLineTo( &aPanel->m_ClipBox, aDC, m_points[i].x + aOffset.x, + GRDashedLineTo( aPanel->GetClipBox(), aDC, m_points[i].x + aOffset.x, m_points[i].y + aOffset.y, width, color ); } else { for( unsigned i = 1; i < GetCornerCount(); i++ ) - GRLineTo( &aPanel->m_ClipBox, aDC, m_points[i].x + aOffset.x, + GRLineTo( aPanel->GetClipBox(), aDC, m_points[i].x + aOffset.x, m_points[i].y + aOffset.y, width, color ); } } diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 069779328e..b32289f946 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -608,7 +608,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, int aDrawMode, int aC // uncomment line below when there is a virtual // EDA_ITEM::GetBoundingBox() - // if( panel->m_ClipBox.Intersects( Structs->GetBoundingBox() + // if( panel->GetClipBox().Intersects( Structs->GetBoundingBox() // ) ) item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor ); } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 91169bd542..4ead3f3bf7 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -608,7 +608,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GRSetDrawMode( aDC, aDrawMode ); - GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y, + GRRect( aPanel->GetClipBox(), aDC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color ); pos_sheetname = GetSheetNamePosition() + aOffset; diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 1e45f9a6b3..2f3efa46b2 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -397,7 +397,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, #if 0 { EDA_RECT BoundaryBox = GetBoundingBox(); - GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); + GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); } #endif } @@ -1225,7 +1225,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, EXCHG( linewidth, m_Thickness ); // set initial value CreateGraphicShape( Poly, m_Pos + aOffset ); - GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); + GRPoly( panel->GetClipBox(), DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); if( m_isDangling ) DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color ); @@ -1234,7 +1234,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, #if 0 { EDA_RECT BoundaryBox = GetBoundingBox(); - GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); + GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); } #endif } @@ -1562,7 +1562,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, EXCHG( linewidth, m_Thickness ); // set initial value CreateGraphicShape( Poly, m_Pos + offset ); - GRPoly( &panel->m_ClipBox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); + GRPoly( panel->GetClipBox(), DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); if( m_isDangling ) DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); @@ -1571,7 +1571,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, #if 0 { EDA_RECT BoundaryBox = GetBoundingBox(); - GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); + GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); } #endif } diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 551277b269..647c420241 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -291,7 +291,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PLACE_BLOCK: - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); m_canvas->MoveCursorToCrossHair(); HandleBlockPlace( &dc ); break; diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index a343686c78..c9a1447711 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -225,7 +225,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); if( m_canvas ) - m_canvas->m_Block_Enable = true; + m_canvas->SetEnableBlockCommands( true ); ReCreateMenuBar(); ReCreateHToolbar(); @@ -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->GetCanvas()->m_IgnoreMouseEvents = true; + this->GetCanvas()->SetIgnoreMouseEvents( true ); if( m_dlgFindReplace ) { @@ -704,7 +704,7 @@ void SCH_EDIT_FRAME::OnFindDialogClose( wxFindDialogEvent& event ) m_dlgFindReplace = NULL; } - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); } @@ -890,7 +890,7 @@ void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent ) && (index >= 0 && index < m_collectedItems.GetCount()) ) { SCH_ITEM* item = m_collectedItems[index]; - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( false ); GetScreen()->SetCurItem( item ); } } diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index f82c5bfceb..eff1d5703e 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -164,7 +164,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) } aSheet->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); if( isUndoable ) SaveCopyInUndoList( aSheet, UR_CHANGED ); @@ -204,7 +204,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) ); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); aSheet->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); OnModify(); @@ -321,7 +321,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC ) // a sheet to a screen that already has multiple instances (!) GetScreen()->SetCurItem( sheet ); m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false ); m_canvas->CrossHairOff( aDC ); GetScreen()->SetCrossHairPosition( sheet->GetResizePosition() ); m_canvas->MoveCursorToCrossHair(); @@ -349,7 +349,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) aSheet->SetFlags( IS_RESIZED ); m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, true ); + m_canvas->CallMouseCapture( aDC, wxDefaultPosition, true ); if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo SetUndoItem( aSheet ); @@ -370,6 +370,6 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) aSheet->SetFlags( IS_MOVED ); m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, true ); + m_canvas->CallMouseCapture( aDC, wxDefaultPosition, true ); m_canvas->CrossHairOn( aDC ); } diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index e6a53f0492..ea197c27c0 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2009-2011 Wayne Stambaugh + * Copyright (C) 2004-2011 KiCad Developers, see change_log.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 symbdraw.cpp * @brief Create, move .. graphic shapes used to build and draw a component (lines, arcs ..) @@ -155,9 +180,9 @@ LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ) Text->m_Orient = m_textOrientation; // Enter the graphic text info - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); EditSymbolText( NULL, Text ); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); if( Text->m_Text.IsEmpty() ) @@ -188,7 +213,7 @@ LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ) m_drawItem->SetConvert( m_convert ); // Draw initial symbol: - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } else { @@ -197,7 +222,7 @@ LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ) } m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = FALSE; + m_canvas->SetIgnoreMouseEvents( false ); return m_drawItem; } @@ -263,7 +288,7 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC ) TempCopyComponent(); m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCrossHairPosition( true ) ); m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, true ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, true ); } @@ -276,7 +301,7 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC ) TempCopyComponent(); m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCrossHairPosition( true ) ); m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, true ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, true ); } diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index 832dcd4c15..8acbf85a51 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; - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath(); @@ -70,7 +70,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol() GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = FALSE; + m_canvas->SetIgnoreMouseEvents( false ); wxFileName fn = dlg.GetPath(); wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() ); diff --git a/gerbview/block.cpp b/gerbview/block.cpp index 0c5375cf54..22f026f93e 100644 --- a/gerbview/block.cpp +++ b/gerbview/block.cpp @@ -85,7 +85,7 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC ) { case BLOCK_MOVE: /* Move */ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); Block_Move( DC ); GetScreen()->m_BlockLocate.ClearItemsList(); @@ -93,7 +93,7 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_COPY: /* Copy */ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); Block_Duplicate( DC ); GetScreen()->m_BlockLocate.ClearItemsList(); @@ -139,14 +139,14 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC ) case BLOCK_COPY: /* Copy */ GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; nextcmd = true; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); - m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); + m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); break; case BLOCK_DELETE: /* Delete */ GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); Block_Delete( DC ); break; @@ -257,7 +257,7 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC ) wxPoint oldpos; oldpos = GetScreen()->GetCrossHairPosition(); - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); GetScreen()->SetCrossHairPosition( oldpos ); m_canvas->MoveCursorToCrossHair(); @@ -286,7 +286,7 @@ void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC ) wxPoint oldpos; oldpos = GetScreen()->GetCrossHairPosition(); - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); GetScreen()->SetCrossHairPosition( oldpos ); m_canvas->MoveCursorToCrossHair(); diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index 5cc92c8793..044deda9de 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -364,7 +364,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, if( !isDark ) isFilled = true; - DrawGbrPoly( &aPanel->m_ClipBox, aDC, color, aOffset, isFilled ); + DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled ); break; case GBR_CIRCLE: @@ -376,14 +376,14 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, if( !isFilled ) { // draw the border of the pen's path using two circles, each as narrow as possible - GRCircle( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), + GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ), radius - halfPenWidth, 0, color ); - GRCircle( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), + GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ), radius + halfPenWidth, 0, color ); } else // Filled mode { - GRCircle( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), + GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ), radius, m_Size.x, color ); } break; @@ -393,21 +393,21 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, // a round pen only is expected. #if 0 // for arc debug only - GRLine( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), + GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ), GetABPosition( m_ArcCentre ), 0, color ); - GRLine( &aPanel->m_ClipBox, aDC, GetABPosition( m_End ), + GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_End ), GetABPosition( m_ArcCentre ), 0, color ); #endif if( !isFilled ) { - GRArc1( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), + GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ), GetABPosition( m_End ), GetABPosition( m_ArcCentre ), 0, color ); } else { - GRArc1( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), + GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ), GetABPosition( m_End ), GetABPosition( m_ArcCentre ), m_Size.x, color ); } @@ -420,7 +420,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, case GBR_SPOT_POLY: case GBR_SPOT_MACRO: isFilled = DisplayOpt.DisplayPadFill ? true : false; - d_codeDescr->DrawFlashedShape( this, &aPanel->m_ClipBox, aDC, color, alt_color, + d_codeDescr->DrawFlashedShape( this, aPanel->GetClipBox(), aDC, color, alt_color, m_Start, isFilled ); break; @@ -435,18 +435,18 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, if( m_PolyCorners.size() == 0 ) ConvertSegmentToPolygon( ); - DrawGbrPoly( &aPanel->m_ClipBox, aDC, color, aOffset, isFilled ); + DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled ); } else { if( !isFilled ) { - GRCSegm( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), + GRCSegm( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ), GetABPosition( m_End ), m_Size.x, color ); } else { - GRFilledSegment( &aPanel->m_ClipBox, aDC, GetABPosition( m_Start ), + GRFilledSegment( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ), GetABPosition( m_End ), m_Size.x, color ); } } diff --git a/gerbview/controle.cpp b/gerbview/controle.cpp index a0f66c734a..e003f1d0b9 100644 --- a/gerbview/controle.cpp +++ b/gerbview/controle.cpp @@ -1,6 +1,30 @@ -/****************/ -/* controle.cpp */ -/****************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2010 + * Copyright (C) 1992-2010 KiCad Developers, see change_log.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 gerbview/controle.cpp + */ #include "fctsys.h" #include "common.h" @@ -61,7 +85,7 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH if( m_canvas->IsMouseCaptured() ) { - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); + m_canvas->CallMouseCapture( aDC, aPosition, true ); } } diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index eb87c3fabf..e7f2ce8ed3 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; - m_canvas->m_PrintIsMirrored = aPrintMirrorMode; + m_canvas->SetPrintMirrored( aPrintMirrorMode ); GetBoard()->Draw( m_canvas, aDC, -1, wxPoint( 0, 0 ) ); - m_canvas->m_PrintIsMirrored = false; + m_canvas->SetPrintMirrored( false ); // Restore draw options: GetBoard()->SetVisibleLayers( visiblemask ); @@ -109,7 +109,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) TraceWorkSheet( DC, screen, 0 ); if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->DrawCrossHair( DC ); @@ -158,7 +158,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin // these parameters are saved here, because they are modified // and restored later - EDA_RECT drawBox = aPanel->m_ClipBox; + EDA_RECT drawBox = *aPanel->GetClipBox(); double scale; aDC->GetUserScale(&scale, &scale); wxPoint dev_org = aDC->GetDeviceOrigin(); @@ -171,7 +171,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin screenBitmap = new wxBitmap( bitmapWidth, bitmapHeight ); layerDC.SelectObject( *layerBitmap ); aPanel->DoPrepareDC( layerDC ); - aPanel->m_ClipBox = drawBox; + aPanel->SetClipBox( drawBox ); layerDC.SetBackground( bgBrush ); layerDC.SetBackgroundMode( wxSOLID ); layerDC.Clear(); diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 1fcf1a6b59..8ffedf7b4f 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -184,7 +184,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PLACE_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; - m_canvas->m_AutoPAN_Request = FALSE; + m_canvas->SetAutoPanRequest( false ); HandleBlockPlace( &dc ); break; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 956bd56b6c..3c45a42c86 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -76,7 +76,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, m_drillFileHistory.SetBaseId( ID_GERBVIEW_DRILL_FILE1 ); if( m_canvas ) - m_canvas->m_Block_Enable = true; + m_canvas->SetEnableBlockCommands( true ); // Give an icon wxIcon icon; diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index a262709c43..4e46ba7b51 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. - m_canvas->m_CanStartBlock = -1; + m_canvas->SetCanStartBlock( -1 ); // Simple location of elements where possible. if( ( DrawStruct == NULL ) || ( DrawStruct->GetFlags() == 0 ) ) diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index ac6b14dd9a..536e8e845f 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -63,37 +63,34 @@ private: 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) - bool m_AbortRequest; // Flag to abort long commands - bool m_AbortEnable; // true if abort button or menu to be displayed + /// The drawing area used to redraw the screen which is usually the visible area + /// of the drawing in internal units. + EDA_RECT m_ClipBox; - bool m_AutoPAN_Enable; // true to allow auto pan - bool m_AutoPAN_Request; // true to request an auto pan (will be made only if - // m_AutoPAN_Enable = true) - int m_IgnoreMouseEvents; // when non-zero (true), then ignore mouse events - bool m_Block_Enable; // true to accept Block Commands + bool m_abortRequest; ///< Flag used to abort long commands. + + bool m_enableAutoPan; ///< True to enable automatic panning. + + /// true to request an auto pan. Valid only when m_enableAutoPan = true. + bool m_requestAutoPan; + + bool m_ignoreMouseEvents; ///< Ignore mouse events when true. + + bool m_enableBlockCommands; ///< True enables block commands. + + /// True when drawing in mirror mode. Used by the draw arc function, because arcs + /// are oriented, and in mirror mode, orientations are reversed. + bool m_PrintIsMirrored; + + /// Mouse capture move callback function. + MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback; + + /// Abort mouse capture callback function. + END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback; // useful to avoid false start block in certain cases // (like switch from a sheet to an other sheet - int m_CanStartBlock; // >= 0 (or >= n) if a block can start - bool m_PrintIsMirrored; // True when drawing in mirror mode. Used in draw arc function, - // because arcs are oriented, and in mirror mode, orientations - // are reversed - -#ifdef USE_WX_OVERLAY - // MAC Uses overlay to workaround the wxINVERT and wxXOR miss - wxOverlay m_overlay; -#endif - - /* Cursor management (used in editing functions) */ - - /* Mouse capture move callback function. */ - MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback; - - /* Abort mouse capture callback function. */ - END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback; + int m_canStartBlock; // >= 0 (or >= n) if a block can start public: @@ -106,6 +103,29 @@ public: void OnPaint( wxPaintEvent& event ); + EDA_RECT* GetClipBox() { return &m_ClipBox; } + + void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; } + + bool GetAbortRequest() const { return m_abortRequest; } + + void SetAbortRequest( bool aAbortRequest ) { m_abortRequest = aAbortRequest; } + + bool GetEnableAutoPan() const { return m_enableAutoPan; } + + void SetEnableAutoPan( bool aEnable ) { m_enableAutoPan = aEnable; } + + void SetAutoPanRequest( bool aEnable ) { m_requestAutoPan = aEnable; } + + void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; } + + void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; } + + bool GetPrintMirrored() const { return m_PrintIsMirrored; } + + void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; } + + void SetCanStartBlock( int aStartBlock ) { m_canStartBlock = aStartBlock; } /** * Function DrawBackGround @@ -151,7 +171,7 @@ public: * Function OnActivate * handles window activation events. *

- * The member m_CanStartBlock is initialize to avoid a block start command on activation + * The member m_canStartBlock is initialize to avoid a block start command on activation * (because a left mouse button can be pressed and no block command wanted. This happens * when enter on a hierarchy sheet on double click. *

@@ -310,6 +330,13 @@ public: m_endMouseCaptureCallback = aEndMouseCaptureCallback; } + + void SetMouseCaptureCallback( MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback ) + { + m_mouseCaptureCallback = aMouseCaptureCallback; + } + + /** * Function EndMouseCapture * ends mouse a capture. @@ -328,6 +355,26 @@ public: inline bool IsMouseCaptured() const { return m_mouseCaptureCallback != NULL; } + /** + * Function CallMouseCapture + * calls the mouse capture callback. + * + * @param aDC A point to a wxDC object to perform any drawing upon. + * @param aPosition A referecnce to a wxPoint object containing the current cursor + * position. + * @param aErase True indicates the item being drawn should be erase before drawing + * it a \a aPosition. + */ + void CallMouseCapture( wxDC* aDC, const wxPoint& aPosition, bool aErase ); + + /** + * Function CallEndMouseCapture + * calls the end mouse capture callback. + * + * @param aDC A point to a wxDC object to perform any drawing upon. + */ + void CallEndMouseCapture( wxDC* aDC ); + /** * Function SetCurrentCursor * Set the current cursor shape for drawpanel diff --git a/include/common.h b/include/common.h index b6a0651ce6..de164adec5 100644 --- a/include/common.h +++ b/include/common.h @@ -37,9 +37,6 @@ #include "wx/fileconf.h" class wxAboutDialogInfo; -class BASE_SCREEN; -class EDA_DRAW_FRAME; -class EDA_DRAW_PANEL; /* Flag for special keys */ #define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right diff --git a/include/dialog_helpers.h b/include/dialog_helpers.h index 2c025bcba2..ff98234161 100644 --- a/include/dialog_helpers.h +++ b/include/dialog_helpers.h @@ -11,6 +11,10 @@ #include "common.h" // EDA_UNITS_T +class EDA_DRAW_FRAME; + + + /** * class EDA_LIST_DIALOG * diff --git a/include/wxstruct.h b/include/wxstruct.h index da40d8ad1c..dd574775d3 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -363,9 +363,13 @@ public: */ class EDA_DRAW_FRAME : public EDA_BASE_FRAME { +private: ///< Id of active button on the vertical toolbar. int m_toolId; + BASE_SCREEN* m_currentScreen; ///< current used SCREEN + bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid. + protected: EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList; int m_LastGridSizeId; @@ -419,14 +423,15 @@ protected: /// Panel used to display information at the bottom of the main window. EDA_MSG_PANEL* m_messagePanel; +#ifdef USE_WX_OVERLAY + // MAC Uses overlay to workaround the wxINVERT and wxXOR miss + wxOverlay m_overlay; +#endif + /// Let the #EDA_DRAW_PANEL object have access to the protected data since /// it is closely tied to the #EDA_DRAW_FRAME. friend class EDA_DRAW_PANEL; -private: - BASE_SCREEN* m_currentScreen; ///< current used SCREEN - bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid. - protected: void SetScreen( BASE_SCREEN* aScreen ) { diff --git a/pcbnew/automove.cpp b/pcbnew/automove.cpp index 94349b4045..5d13966ffc 100644 --- a/pcbnew/automove.cpp +++ b/pcbnew/automove.cpp @@ -95,7 +95,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event ) case ID_POPUP_CANCEL_CURRENT_COMMAND: if( m_canvas->IsMouseCaptured() ) { - m_canvas->m_endMouseCaptureCallback( m_canvas, &dc ); + m_canvas->CallEndMouseCapture( &dc ); } break; diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index c97c6706fe..694df6989e 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -117,8 +117,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) if( GetBoard()->m_Modules == NULL ) return; - m_canvas->m_AbortRequest = false; - m_canvas->m_AbortEnable = true; + m_canvas->SetAbortRequest( false ); switch( place_mode ) { @@ -391,7 +390,6 @@ end_of_tst: GetBoard()->m_Status_Pcb = 0; Compile_Ratsnest( DC, true ); m_canvas->ReDraw( DC, true ); - m_canvas->m_AbortEnable = false; } @@ -431,7 +429,7 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC ) color = DARKGRAY; } - GRPutPixel( &m_canvas->m_ClipBox, DC, ox, oy, color ); + GRPutPixel( m_canvas->GetClipBox(), DC, ox, oy, color ); } } } @@ -690,12 +688,12 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) { wxYield(); - if( m_canvas->m_AbortRequest ) + if( m_canvas->GetAbortRequest() ) { if( IsOK( this, _( "Ok to abort?" ) ) ) return ESC; else - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( false ); } cx = aModule->m_Pos.x; cy = aModule->m_Pos.y; @@ -956,7 +954,7 @@ float PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC ) if( AutoPlaceShowAll ) { - GRLine( &m_canvas->m_ClipBox, DC, ox, oy, fx, fy, 0, color ); + GRLine( m_canvas->GetClipBox(), DC, ox, oy, fx, fy, 0, color ); } /* Cost of the ratsnest. */ diff --git a/pcbnew/autorout.cpp b/pcbnew/autorout.cpp index 7b02d43065..730d561c5a 100644 --- a/pcbnew/autorout.cpp +++ b/pcbnew/autorout.cpp @@ -253,7 +253,7 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC ) { for( i = 0; i < maxi; i++ ) for( j = 0; j < maxi; j++ ) - GRPutPixel( &panel->m_ClipBox, DC, + GRPutPixel( panel->GetClipBox(), DC, ( col * maxi ) + i + DRAW_OFFSET_X, ( row * maxi ) + j + DRAW_OFFSET_Y, color ); diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 943ac7e06a..581b9c8266 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -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]; - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( false ); #if 0 && defined (DEBUG) item->Show( 0, std::cout ); diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index 9b97410b5d..1a6925e869 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -121,7 +121,7 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title { wxPoint oldpos = parent->GetScreen()->GetCrossHairPosition(); - parent->GetCanvas()->m_IgnoreMouseEvents = true; + parent->GetCanvas()->SetIgnoreMouseEvents( true ); DIALOG_BLOCK_OPTIONS * dlg = new DIALOG_BLOCK_OPTIONS( parent, title ); int cmd = dlg->ShowModal(); @@ -129,7 +129,7 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title parent->GetScreen()->SetCrossHairPosition( oldpos ); parent->GetCanvas()->MoveCursorToCrossHair(); - parent->GetCanvas()->m_IgnoreMouseEvents = false; + parent->GetCanvas()->SetIgnoreMouseEvents( false ); return cmd == wxID_OK; } @@ -235,7 +235,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_MOVE: /* Move */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); Block_Move(); GetScreen()->m_BlockLocate.ClearItemsList(); @@ -243,7 +243,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) case BLOCK_COPY: /* Copy */ if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); Block_Duplicate(); GetScreen()->m_BlockLocate.ClearItemsList(); @@ -293,7 +293,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) cancelCmd = true; // undraw block outline - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } else { @@ -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; - m_canvas->m_mouseCaptureCallback = drawMovingBlock; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->SetMouseCaptureCallback( drawMovingBlock ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); break; case BLOCK_DELETE: /* Delete */ - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; Block_Delete(); break; case BLOCK_ROTATE: /* Rotation */ - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; Block_Rotate(); break; case BLOCK_FLIP: /* Flip */ - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( 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 - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); Window_Zoom( GetScreen()->m_BlockLocate ); break; diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index e3de67fd99..6343f9dde9 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -122,7 +122,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) { BlockState state = GetScreen()->m_BlockLocate.m_State; CmdBlockType command = GetScreen()->m_BlockLocate.m_Command; - m_canvas->m_endMouseCaptureCallback( m_canvas, DC ); + m_canvas->CallEndMouseCapture( DC ); GetScreen()->m_BlockLocate.m_State = state; GetScreen()->m_BlockLocate.m_Command = command; m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); @@ -148,9 +148,9 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) if( m_canvas->IsMouseCaptured() ) { - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); - m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); + m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; @@ -160,7 +160,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ nextcmd = true; - m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines; + m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; break; diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 06547a6021..02c58bcc15 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -355,55 +355,55 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP width = 0; case FILLED: - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_crossBarOx - ox, m_crossBarOy - oy, m_crossBarFx - ox, m_crossBarFy - oy, width, gcolor ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_featureLineGOx - ox, m_featureLineGOy - oy, m_featureLineGFx - ox, m_featureLineGFy - oy, width, gcolor ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_featureLineDOx - ox, m_featureLineDOy - oy, m_featureLineDFx - ox, m_featureLineDFy - oy, width, gcolor ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_arrowD1Ox - ox, m_arrowD1Oy - oy, m_arrowD1Fx - ox, m_arrowD1Fy - oy, width, gcolor ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_arrowD2Ox - ox, m_arrowD2Oy - oy, m_arrowD2Fx - ox, m_arrowD2Fy - oy, width, gcolor ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_arrowG1Ox - ox, m_arrowG1Oy - oy, m_arrowG1Fx - ox, m_arrowG1Fy - oy, width, gcolor ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_arrowG2Ox - ox, m_arrowG2Oy - oy, m_arrowG2Fx - ox, m_arrowG2Fy - oy, width, gcolor ); break; case SKETCH: - GRCSegm( &panel->m_ClipBox, DC, + GRCSegm( panel->GetClipBox(), DC, m_crossBarOx - ox, m_crossBarOy - oy, m_crossBarFx - ox, m_crossBarFy - oy, width, gcolor ); - GRCSegm( &panel->m_ClipBox, DC, + GRCSegm( panel->GetClipBox(), DC, m_featureLineGOx - ox, m_featureLineGOy - oy, m_featureLineGFx - ox, m_featureLineGFy - oy, width, gcolor ); - GRCSegm( &panel->m_ClipBox, DC, + GRCSegm( panel->GetClipBox(), DC, m_featureLineDOx - ox, m_featureLineDOy - oy, m_featureLineDFx - ox, m_featureLineDFy - oy, width, gcolor ); - GRCSegm( &panel->m_ClipBox, DC, + GRCSegm( panel->GetClipBox(), DC, m_arrowD1Ox - ox, m_arrowD1Oy - oy, m_arrowD1Fx - ox, m_arrowD1Fy - oy, width, gcolor ); - GRCSegm( &panel->m_ClipBox, DC, + GRCSegm( panel->GetClipBox(), DC, m_arrowD2Ox - ox, m_arrowD2Oy - oy, m_arrowD2Fx - ox, m_arrowD2Fy - oy, width, gcolor ); - GRCSegm( &panel->m_ClipBox, DC, + GRCSegm( panel->GetClipBox(), DC, m_arrowG1Ox - ox, m_arrowG1Oy - oy, m_arrowG1Fx - ox, m_arrowG1Fy - oy, width, gcolor ); - GRCSegm( &panel->m_ClipBox, DC, + GRCSegm( panel->GetClipBox(), DC, m_arrowG2Ox - ox, m_arrowG2Oy - oy, m_arrowG2Fx - ox, m_arrowG2Fy - oy, width, gcolor ); diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 7f81a4e665..3babf3f511 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -196,16 +196,16 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx if( mode == FILAIRE ) { - GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, color ); } else if( mode == SKETCH ) { - GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius - l_trace, color ); - GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius + l_trace, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - l_trace, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + l_trace, color ); } else { - GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, m_Width, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); } break; @@ -216,7 +216,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx StAngle = (int) ArcTangente( dy - uy0, dx - ux0 ); EndAngle = StAngle + m_Angle; - if( !panel->m_PrintIsMirrored ) + if( !panel->GetPrintMirrored() ) { if( StAngle > EndAngle ) EXCHG( StAngle, EndAngle ); @@ -229,19 +229,19 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx if( mode == FILAIRE ) - GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); else if( mode == SKETCH ) { - GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius - l_trace, color ); - GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius + l_trace, color ); } else { - GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color ); } break; @@ -250,20 +250,20 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx for (unsigned int i=1; i < m_BezierPoints.size(); i++) { if( mode == FILAIRE ) - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_BezierPoints[i].x, m_BezierPoints[i].y, m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0, color ); else if( mode == SKETCH ) { - GRCSegm( &panel->m_ClipBox, DC, - m_BezierPoints[i].x, m_BezierPoints[i].y, - m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, + GRCSegm( panel->GetClipBox(), DC, + m_BezierPoints[i].x, m_BezierPoints[i].y, + m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, m_Width, color ); } else { - GRFillCSegm( &panel->m_ClipBox, DC, + GRFillCSegm( panel->GetClipBox(), DC, m_BezierPoints[i].x, m_BezierPoints[i].y, m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, m_Width, color ); @@ -273,17 +273,15 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx default: if( mode == FILAIRE ) { - GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color ); + GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, 0, color ); } else if( mode == SKETCH ) { - GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, - m_Width, color ); + GRCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); } else { - GRFillCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, - m_Width, color ); + GRFillCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); } break; diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index b930dc0bcc..6f586bc84f 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -125,12 +125,12 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx { case S_SEGMENT: if( typeaff == FILAIRE ) - GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color ); + GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, 0, color ); else if( typeaff == FILLED ) - GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, m_Width, color ); + GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); else // SKETCH Mode - GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, m_Width, color ); + GRCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); break; @@ -139,18 +139,18 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx if( typeaff == FILAIRE ) { - GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, color ); } else { if( typeaff == FILLED ) { - GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, m_Width, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); } else // SKETCH Mode { - GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius + (m_Width / 2), color ); - GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius - (m_Width / 2), color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + (m_Width / 2), color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - (m_Width / 2), color ); } } @@ -166,17 +166,17 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx if( typeaff == FILAIRE ) { - GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, radius, color ); + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); } else if( typeaff == FILLED ) { - GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color ); + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color ); } else // SKETCH Mode { - GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius + (m_Width / 2), color ); - GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius - (m_Width / 2), color ); } break; @@ -196,7 +196,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx pt += module->m_Pos - offset; } - GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0], true, m_Width, color, color ); + GRPoly( panel->GetClipBox(), DC, points.size(), &points[0], true, m_Width, color, color ); break; } } diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index ff109f4f25..3fd1525a32 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -98,12 +98,12 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wx width = 0; case FILLED: - GRCircle( &panel->m_ClipBox, DC, ox, oy, radius, width, gcolor ); + GRCircle( panel->GetClipBox(), DC, ox, oy, radius, width, gcolor ); break; case SKETCH: - GRCircle( &panel->m_ClipBox, DC, ox, oy, radius + (width / 2), gcolor ); - GRCircle( &panel->m_ClipBox, DC, ox, oy, radius - (width / 2), gcolor ); + GRCircle( panel->GetClipBox(), DC, ox, oy, radius + (width / 2), gcolor ); + GRCircle( panel->GetClipBox(), DC, ox, oy, radius - (width / 2), gcolor ); break; } @@ -125,13 +125,13 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wx { case FILAIRE: case FILLED: - GRLine( &panel->m_ClipBox, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor ); - GRLine( &panel->m_ClipBox, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor ); + GRLine( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor ); + GRLine( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor ); break; case SKETCH: - GRCSegm( &panel->m_ClipBox, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor ); - GRCSegm( &panel->m_ClipBox, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor ); + GRCSegm( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor ); + GRCSegm( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor ); break; } } diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 39301a9213..fbf8df60b1 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -99,11 +99,11 @@ void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) ) { int color = g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y, m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y, 0, color ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size, m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size, 0, color ); @@ -261,7 +261,7 @@ void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoi // Enable these line to draw m_BoundaryBox (debug tests purposes only) #if 0 - GRRect( &aPanel->m_ClipBox, aDC, m_BoundaryBox, 0, BROWN ); + GRRect( aPanel->GetClipBox(), aDC, m_BoundaryBox, 0, BROWN ); #endif } diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 38bdbcaadb..c2057cd80b 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -172,6 +172,6 @@ void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel, int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE); - GRLine( &panel->m_ClipBox, DC, m_PadStart->m_Pos - aOffset, + GRLine( panel->GetClipBox(), DC, m_PadStart->m_Pos - aOffset, m_PadEnd->m_Pos - aOffset, 0, color ); } diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index d28ae08bb4..d830a8cebb 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -376,7 +376,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi if( !IsOnLayer( screen->m_Active_Layer ) && DisplayOpt.ContrastModeDisplay ) drawInfo.m_Display_netname = false; - DrawShape( &aPanel->m_ClipBox, aDC, drawInfo ); + DrawShape( aPanel->GetClipBox(), aDC, drawInfo ); } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 07a4abdf04..36deed2eb5 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -253,10 +253,10 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w int anchor_size = DC->DeviceToLogicalXRel( 2 ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, pos.x - anchor_size, pos.y, pos.x + anchor_size, pos.y, 0, color ); - GRLine( &panel->m_ClipBox, DC, + GRLine( panel->GetClipBox(), DC, pos.x, pos.y - anchor_size, pos.x, pos.y + anchor_size, 0, color ); } @@ -300,11 +300,12 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel, const wxPoint& aOffset ) { MODULE* parent = (MODULE*) GetParent(); + if( !parent ) return; GRSetDrawMode( aDC, GR_XOR ); - GRLine( &aPanel->m_ClipBox, aDC, + GRLine( aPanel->GetClipBox(), aDC, parent->GetPosition(), GetPosition() + aOffset, 0, UMBILICAL_COLOR); } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 4a1990f02c..f410eb94a4 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -648,7 +648,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& if( DC->LogicalToDeviceXRel( l_trace ) < MIN_DRAW_WIDTH ) { - GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius, color ); } else @@ -656,19 +656,19 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& if( DC->LogicalToDeviceXRel( l_trace ) <= 1 ) /* Sketch mode if l_trace/zoom <= 1 */ { - GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius, color ); } else if( ( !DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) ) { - GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius - l_trace, color ); - GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius + l_trace, color ); } else { - GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius, m_Width, color ); } } @@ -678,17 +678,17 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& if( DC->LogicalToDeviceXRel( l_trace ) < MIN_DRAW_WIDTH ) { - GRLine( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset, 0, color ); + GRLine( panel->GetClipBox(), DC, m_Start + aOffset, m_End + aOffset, 0, color ); return; } if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) { - GRCSegm( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset, m_Width, color ); + GRCSegm( panel->GetClipBox(), DC, m_Start + aOffset, m_End + aOffset, m_Width, color ); } else { - GRFillCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + GRFillCSegm( panel->GetClipBox(), DC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color ); } @@ -699,7 +699,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& // Show clearance for tracks, not for zone segments if( ShowClearance( this ) ) { - GRCSegm( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset, + GRCSegm( panel->GetClipBox(), DC, m_Start + aOffset, m_End + aOffset, m_Width + (GetClearance() * 2), color ); } @@ -831,14 +831,16 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint if( fillvia ) { - GRFilledCircle( &panel->m_ClipBox, DC, m_Start + aOffset, radius, color ); + GRFilledCircle( panel->GetClipBox(), DC, m_Start + aOffset, radius, color ); } else { - GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset,radius, 0, color ); + GRCircle( panel->GetClipBox(), DC, m_Start + aOffset,radius, 0, color ); + if ( fast_draw ) return; - GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, inner_radius, 0, color ); + + GRCircle( panel->GetClipBox(), DC, m_Start + aOffset, inner_radius, 0, color ); } // Draw the via hole if the display option allows it @@ -869,7 +871,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint GRSetDrawMode( DC, GR_XOR ); if( DC->LogicalToDeviceXRel( drill_radius ) > 1 ) // Draw hole if large enough. - GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + GRFilledCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, drill_radius, 0, color, color ); if( screen->m_IsPrinting ) @@ -878,13 +880,13 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint else { if( drill_radius < inner_radius ) // We can show the via hole - GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, drill_radius, 0, color ); + GRCircle( panel->GetClipBox(), DC, m_Start + aOffset, drill_radius, 0, color ); } } } if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS ) - GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, radius + GetClearance(), 0, color ); + GRCircle( panel->GetClipBox(), DC, m_Start + aOffset, radius + GetClearance(), 0, color ); // for Micro Vias, draw a partial cross : X on component layer, or + on copper layer // (so we can see 2 superimposed microvias ): @@ -904,21 +906,21 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint } /* lines | or \ */ - GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax, + GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay, m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color ); - GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x + bx, + GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x + bx, m_Start.y + aOffset.y + by, m_Start.x + aOffset.x + ax, m_Start.y + aOffset.y + ay, 0, color ); /* lines - or / */ - GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x + ay, + GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x + ay, m_Start.y + aOffset.y - ax, m_Start.x + aOffset.x + by, m_Start.y + aOffset.y - bx, 0, color ); - GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - by, + GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x - by, m_Start.y + aOffset.y + bx, m_Start.x + aOffset.x - ay, m_Start.y + aOffset.y + ax, 0, color ); @@ -936,7 +938,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint /* lines for the top layer */ RotatePoint( &ax, &ay, layer_top * 3600 / brd->GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_top * 3600 / brd->GetCopperLayerCount( ) ); - GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax, + GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay, m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color ); @@ -945,7 +947,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint ax = 0; ay = radius; bx = 0; by = drill_radius; RotatePoint( &ax, &ay, layer_bottom * 3600 / brd->GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_bottom * 3600 / brd->GetCopperLayerCount( ) ); - GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax, + GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay, m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color ); diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index eef20010ac..5b76ef6990 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -198,8 +198,8 @@ public: double aCorrectionFactor ); /** * Function SetDrillValue - * Set the drill value for vias - * @param drill_value = new drill value + * sets the drill value for vias. + * @param aDrill = new drill value */ void SetDrill( int aDrill ) { m_Drill = aDrill; } diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index bd31196f2c..31243a78f9 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -179,7 +179,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const lines.push_back( seg_end ); } - GRLineArray( &panel->m_ClipBox, DC, lines, 0, color ); + GRLineArray( panel->GetClipBox(), DC, lines, 0, color ); // draw hatches lines.clear(); @@ -195,7 +195,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const lines.push_back( seg_end ); } - GRLineArray( &panel->m_ClipBox, DC, lines, 0, color ); + GRLineArray( panel->GetClipBox(), DC, lines, 0, color ); } @@ -290,11 +290,11 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, if( CornersTypeBuffer[ie] == 0 ) // Draw only basic outlines, not extra segments { if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) - GRCSegm( &panel->m_ClipBox, DC, + GRCSegm( panel->GetClipBox(), DC, x0, y0, x1, y1, m_ZoneMinThickness, color ); else - GRFillCSegm( &panel->m_ClipBox, DC, + GRFillCSegm( panel->GetClipBox(), DC, x0, y0, x1, y1, m_ZoneMinThickness, color ); } @@ -303,7 +303,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, // Draw areas: if( m_FillMode==0 && !outline_mode ) - GRPoly( &panel->m_ClipBox, DC, CornersBuffer.size(), &CornersBuffer[0], + GRPoly( panel->GetClipBox(), DC, CornersBuffer.size(), &CornersBuffer[0], true, 0, color, color ); } @@ -320,10 +320,10 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, wxPoint end = m_FillSegmList[ic].m_End + offset; if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) - GRCSegm( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, + GRCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, m_ZoneMinThickness, color ); else - GRFillCSegm( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, + GRFillCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, m_ZoneMinThickness, color ); } } @@ -415,9 +415,9 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in GRSetDrawMode( DC, current_gr_mode ); if( is_close_segment ) - GRLine( &panel->m_ClipBox, DC, xi, yi, xf, yf, 0, WHITE ); + GRLine( panel->GetClipBox(), DC, xi, yi, xf, yf, 0, WHITE ); else - GRLine( &panel->m_ClipBox, DC, xi, yi, xf, yf, 0, color ); + GRLine( panel->GetClipBox(), DC, xi, yi, xf, yf, 0, color ); } } diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 94d3362277..940bfc100d 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -207,7 +207,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ) if( aFrame->GetBoard()->m_Track == NULL ) return; - aFrame->GetCanvas()->m_AbortRequest = false; + aFrame->GetCanvas()->SetAbortRequest( 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->GetCanvas()->m_AbortRequest ) + if( aFrame->GetCanvas()->GetAbortRequest() ) break; if( segment->GetNet() != oldnetcode ) @@ -412,7 +412,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) int flag, no_inc; wxString msg; - aFrame->GetCanvas()->m_AbortRequest = false; + aFrame->GetCanvas()->SetAbortRequest( 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->GetCanvas()->m_AbortRequest ) + if( aFrame->GetCanvas()->GetAbortRequest() ) 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->GetCanvas()->m_AbortRequest = false; + aFrame->GetCanvas()->SetAbortRequest( false ); for( segment = aFrame->GetBoard()->m_Track; segment; segment = segment->Next() ) { D_PAD* pad; - if( aFrame->GetCanvas()->m_AbortRequest ) + if( aFrame->GetCanvas()->GetAbortRequest() ) return; pad = aFrame->GetBoard()->GetPad( segment, START ); diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index a161e12e49..041482351b 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. - * m_canvas->m_IgnoreMouseEvents = true; + * m_canvas->SetIgnoreMouseEvents( true ); */ // this menu's handler is void PCB_BASE_FRAME::ProcessItemSelection() // and it calls SetCurItem() which in turn calls DisplayInfo() on the item. - m_canvas->m_AbortRequest = true; // changed in false if an item is selected + m_canvas->SetAbortRequest( true ); // changed in false if an item is selected PopupMenu( &itemMenu ); m_canvas->MoveCursorToCrossHair(); // The function ProcessItemSelection() has set the current item, return it. - if( m_canvas->m_AbortRequest ) // Nothing selected + if( m_canvas->GetAbortRequest() ) // Nothing selected item = NULL; else item = GetCurItem(); @@ -352,17 +352,17 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH if( m_canvas->IsMouseCaptured() ) { #ifdef USE_WX_OVERLAY - wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC ); + wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC ); oDC.Clear(); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false ); + m_canvas->CallMouseCapture( aDC, aPosition, false ); #else - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); + m_canvas->CallMouseCapture( aDC, aPosition, true ); #endif } #ifdef USE_WX_OVERLAY else { - m_canvas->m_overlay.Reset(); + m_overlay.Reset(); } #endif } diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index f0e65c4330..50524adaf1 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -111,7 +111,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) else { if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); return g_CurrentTrackSegment; } diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index 05254a9f40..67e3beca14 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -251,19 +251,16 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, // to print floating point numbers like 1.3) wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi ); - EDA_RECT tmp = panel->m_ClipBox; + EDA_RECT tmp = *panel->GetClipBox(); GRResetPenAndBrush( &dc ); GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true ); s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; - panel->m_ClipBox.SetX( 0 ); - panel->m_ClipBox.SetY( 0 ); // Set clip box to the max size #define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer // and that allows calculations without overflow - panel->m_ClipBox.SetWidth( MAX_VALUE ); - panel->m_ClipBox.SetHeight( MAX_VALUE ); + panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) ); screen->m_IsPrinting = true; @@ -277,7 +274,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, g_DrawBgColor = bg_color; SetLocaleTo_Default(); // revert to the current locale screen->m_IsPrinting = false; - panel->m_ClipBox = tmp; + panel->SetClipBox( tmp ); GRForceBlackPen( false ); diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index 359dd23b16..46255339db 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -48,10 +48,10 @@ private: void PCB_BASE_FRAME::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC ) { - m_canvas->m_IgnoreMouseEvents = TRUE; + m_canvas->SetIgnoreMouseEvents( true ); DialogEditModuleText dialog( this, TextMod, DC ); dialog.ShowModal(); - m_canvas->m_IgnoreMouseEvents = FALSE; + m_canvas->SetIgnoreMouseEvents( false ); } diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index 4be3c567cd..3ec86912b8 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()->GetCanvas()->m_AutoPAN_Enable ); + m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableAutoPan() ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); @@ -133,9 +133,8 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) 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()->GetCanvas()->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); + GetParent()->GetCanvas()->SetEnableAutoPan( m_AutoPANOpt->GetValue() ); g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue(); - g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection(); g_MagneticTrackOption = m_MagneticTrackOptCtrl->GetSelection(); diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 34f5d9994b..b6d806e52a 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -71,12 +71,11 @@ void PCB_EDIT_FRAME::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxD return; } - m_canvas->m_IgnoreMouseEvents = TRUE; - DialogGraphicItemProperties* dialog = new DialogGraphicItemProperties( this, - aItem, aDC ); + m_canvas->SetIgnoreMouseEvents( true ); + DialogGraphicItemProperties* dialog = new DialogGraphicItemProperties( this, aItem, aDC ); dialog->ShowModal(); dialog->Destroy(); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = FALSE; + m_canvas->SetIgnoreMouseEvents( false ); } /**************************************************************************/ diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index e11caf3e62..52d97f6031 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 ) { - m_canvas->m_IgnoreMouseEvents = TRUE; + m_canvas->SetIgnoreMouseEvents( true ); DIALOG_PCB_TEXT_PROPERTIES dlg( this, TextPCB, DC ); dlg.ShowModal(); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = FALSE; + m_canvas->SetIgnoreMouseEvents( false ); } diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index a2097da7d6..3fe508dd5f 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -388,7 +388,7 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC ) m_canvas->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText ); SetCurItem( aItem ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index 0d65e350a3..3e5b8c7618 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -1,9 +1,31 @@ -/*******************************/ -/* Footprint outlines editing. */ -/*******************************/ +/* + * 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 + */ /** - * Functions to edit graphic items used to draw footprint edges. + * @file edgemod.cpp: + * @brief Functions to edit graphic items used to draw footprint edges. * * @todo - Arc functions not compete but menus are ready to use. */ @@ -45,7 +67,7 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) CursorInitialPosition = GetScreen()->GetCrossHairPosition(); m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline ); SetCurItem( Edge ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index f50e8e9a0e..86587d380a 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -165,7 +165,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) default: // Finish (abort) the command if( m_canvas->IsMouseCaptured() ) - m_canvas->m_endMouseCaptureCallback( m_canvas, &dc ); + m_canvas->CallEndMouseCapture( &dc ); if( GetToolId() != id ) { @@ -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; - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); HandleBlockPlace( &dc ); break; case ID_POPUP_COPY_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.SetMessageBlock( this ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); HandleBlockPlace( &dc ); break; @@ -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( m_canvas->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) - ShowNewTrackWhenMovingCursor( m_canvas, &dc, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false ); g_Alternate_Track_Posture = !g_Alternate_Track_Posture; - if( m_canvas->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) - ShowNewTrackWhenMovingCursor( m_canvas, &dc, wxDefaultPosition, false ); + if( m_canvas->IsMouseCaptured() ) + m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false ); break; @@ -445,13 +445,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE: m_canvas->MoveCursorToCrossHair(); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() ); break; case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE: m_canvas->MoveCursorToCrossHair(); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() ); break; @@ -476,7 +476,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) { m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, false ); break; } @@ -485,7 +485,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) { m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->m_CornerSelection ); break; } @@ -494,7 +494,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) { m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Start_Move_Zone_Outlines( &dc, zone_cont ); break; } @@ -513,7 +513,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) zone_cont->m_Poly->InsertCorner( zone_cont->m_CornerSelection, pos.x, pos.y ); zone_cont->m_CornerSelection++; zone_cont->Draw( m_canvas, &dc, GR_XOR ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, true ); break; } @@ -524,7 +524,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); break; } @@ -576,7 +576,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST: StartMoveTextePcb( (TEXTE_PCB*) GetCurItem(), &dc ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); break; case ID_POPUP_PCB_DRAG_MODULE_REQUEST: @@ -1000,7 +1000,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SetCurItem( NULL ); } - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); break; case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER: @@ -1092,7 +1092,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } m_canvas->CrossHairOn( &dc ); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); } diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index 7cead2ac97..60b27f76c2 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -1,6 +1,31 @@ -/*********************************************************************/ -/* Edition of texts on copper and technical layers (TEXTE_PCB class) */ -/*********************************************************************/ +/* + * 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) 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 edit_pcb_text.cpp + * @brief Editimg of text on copper and technical layers (TEXTE_PCB class) + */ #include "fctsys.h" #include "gr_basic.h" @@ -115,7 +140,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ) m_canvas->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text ); SetCurItem( TextePcb ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index c7cbd3ebb4..4640b5bef5 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -1,6 +1,31 @@ -/***********************************/ -/* Edit segments and edges of PCB. */ -/***********************************/ +/* + * 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) 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 editedge.cpp + * @brief Edit segments and edges of PCB. + */ #include "fctsys.h" #include "class_drawpanel.h" @@ -38,7 +63,7 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) drawitem->DisplayInfo( this ); m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge ); SetCurItem( drawitem ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } @@ -185,7 +210,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ) if( Segment->IsNew() ) { - Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false ); + Panel->CallMouseCapture( DC, wxDefaultPosition, false ); Segment ->DeleteStructure(); Segment = NULL; } @@ -193,7 +218,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ) { wxPoint pos = Panel->GetScreen()->GetCrossHairPosition(); Panel->GetScreen()->SetCrossHairPosition( s_InitialPosition ); - Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true ); + Panel->CallMouseCapture( DC, wxDefaultPosition, true ); Panel->GetScreen()->SetCrossHairPosition( pos ); Segment->ClearFlags(); Segment->Draw( Panel, DC, GR_OR ); diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index dadf5ec6d1..39f2ebf8be 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 ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( 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; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( 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() ); } - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); via->DisplayInfo( this ); UpdateStatusBar(); diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 21803f750f..8e8bf5972b 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -200,7 +200,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) g_CurrentTrackSegment->DisplayInfoBase( this ); SetCurItem( g_CurrentTrackSegment, false ); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false ); if( Drc_On ) { @@ -686,7 +686,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo { int color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() ); - GRCircle( &aPanel->m_ClipBox, aDC, g_CurrentTrackSegment->m_End.x, + GRCircle( aPanel->GetClipBox(), aDC, g_CurrentTrackSegment->m_End.x, g_CurrentTrackSegment->m_End.y, ( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(), color ); @@ -754,7 +754,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo { int color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer()); - GRCircle( &aPanel->m_ClipBox, aDC, g_CurrentTrackSegment->m_End.x, + GRCircle( aPanel->GetClipBox(), aDC, g_CurrentTrackSegment->m_End.x, g_CurrentTrackSegment->m_End.y, ( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(), color ); diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 09d0dcf8af..dc77ca12dc 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -1,3 +1,27 @@ +/* + * 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) 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 edtxtmod.cpp * @brief Edit module text. @@ -194,7 +218,7 @@ void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) SetCurItem( Text ); m_canvas->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, true ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, true ); } diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 65152f962e..488ba90f41 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -235,28 +235,28 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit break; case HK_SWITCH_TRACK_WIDTH_TO_NEXT: - if( GetCanvas()->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) - ShowNewTrackWhenMovingCursor( GetCanvas(), aDC, wxDefaultPosition, false ); + if( GetCanvas()->IsMouseCaptured() ) + GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false ); GetBoard()->m_TrackWidthSelector = ( GetBoard()->m_TrackWidthSelector + 1 ) % GetBoard()->m_TrackWidthList.size(); - if( GetCanvas()->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) - ShowNewTrackWhenMovingCursor( GetCanvas(), aDC, wxDefaultPosition, false ); + if( GetCanvas()->IsMouseCaptured() ) + GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false ); break; case HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS: - if( GetCanvas()->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) - ShowNewTrackWhenMovingCursor( GetCanvas(), aDC, wxDefaultPosition, false ); + if( GetCanvas()->IsMouseCaptured() ) + GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false ); if( GetBoard()->m_TrackWidthSelector == 0 ) GetBoard()->m_TrackWidthSelector = GetBoard()->m_TrackWidthList.size(); GetBoard()->m_TrackWidthSelector--; - if( GetCanvas()->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor ) - ShowNewTrackWhenMovingCursor( GetCanvas(), aDC, wxDefaultPosition, false ); + if( GetCanvas()->IsMouseCaptured() ) + GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false ); break; @@ -567,7 +567,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit SetCurItem( track ); if( track ) - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else if( GetCurItem()->IsNew() ) { @@ -578,7 +578,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( track ) // A new segment was created SetCurItem( track, false ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } break; @@ -918,11 +918,11 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED; bool itemCurrentlyEdited = item && item->GetFlags(); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); if( itemCurrentlyEdited ) { - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); m_canvas->CrossHairOff( aDC ); switch( item->Type() ) @@ -964,7 +964,7 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) break; } - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->CrossHairOn( aDC ); return true; diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 6dc624851f..9f3caf55da 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; } - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( 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( m_canvas->m_AbortRequest ) + if( m_canvas->GetAbortRequest() ) break; } } diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index aec181830a..0fc5420fc7 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -110,12 +110,11 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode ) // PCB_BASE_FRAME::ProcessItemSelection() // and it calls SetCurItem() which in turn calls DisplayInfo() on the // item. - m_canvas->m_AbortRequest = true; // changed in false if an item - PopupMenu( &itemMenu ); // m_AbortRequest = false if an - // item is selected + m_canvas->SetAbortRequest( true ); // changed in false if an item + PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); // The function ProcessItemSelection() has set the current item, return it. item = GetCurItem(); @@ -198,7 +197,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( m_canvas->IsMouseCaptured() ) { // for all other commands: stop the move in progress - m_canvas->m_endMouseCaptureCallback( m_canvas, &dc ); + m_canvas->CallEndMouseCapture( &dc ); } if( id != ID_POPUP_CANCEL_CURRENT_COMMAND ) @@ -647,14 +646,14 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PLACE_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); HandleBlockPlace( &dc ); break; case ID_POPUP_COPY_BLOCK: GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.SetMessageBlock( this ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); HandleBlockPlace( &dc ); break; diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 6ee622c3ef..870b983f06 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -178,7 +178,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, ReCreateOptToolbar(); if( m_canvas ) - m_canvas->m_Block_Enable = true; + m_canvas->SetEnableBlockCommands( true ); m_auimgr.SetManagedWindow( this ); @@ -413,17 +413,17 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, if( m_canvas->IsMouseCaptured() ) { #ifdef USE_WX_OVERLAY - wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC ); + wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC ); oDC.Clear(); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false ); + m_canvas->CallMouseCapture( aDC, aPosition, false ); #else - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true ); + m_canvas->CallMouseCapture( aDC, aPosition, true ); #endif } #ifdef USE_WX_OVERLAY else { - m_canvas->m_overlay.Reset(); + m_overlay.Reset(); } #endif } diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 70e997663d..d1b038df93 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -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) 2008-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 modules.cpp */ @@ -105,7 +130,7 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC ) GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; m_canvas->SetMouseCapture( MoveFootprint, Abort_MoveOrCopyModule ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); // Erase the module. if( DC ) @@ -115,7 +140,7 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC ) module->ClearFlags( DO_NOT_DRAW ); } - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 37bf6d7135..969bec096b 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -87,7 +87,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) Panel->GetScreen()->SetCrossHairPosition( PosInit ); if( Panel->IsMouseCaptured() ) - Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true ); + Panel->CallMouseCapture( DC, wxDefaultPosition, true ); Panel->GetScreen()->SetCrossHairPosition( oldpos ); pcb->HighLightOFF(); @@ -770,7 +770,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC GetBoard()->HighLightON(); GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() ); - m_canvas->m_mouseCaptureCallback( m_canvas, aDC, wxDefaultPosition, true ); + m_canvas->CallMouseCapture( aDC, wxDefaultPosition, true ); } @@ -981,7 +981,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( !InitialiseDragParameters() ) { DisplayError( this, _( "Unable to drag this segment: two collinear segments" ) ); - m_canvas->m_mouseCaptureCallback = NULL; + m_canvas->SetMouseCaptureCallback( NULL ); Abort_MoveTrack( m_canvas, DC ); return; } diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index f9b525afc2..a2765e73c7 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -118,7 +118,7 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, if( aErase ) { - GRPoly( &aPanel->m_ClipBox, aDC, 5, poly, false, 0, YELLOW, YELLOW ); + GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW ); } Mself.m_End = aPanel->GetScreen()->GetCrossHairPosition(); @@ -137,7 +137,7 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, poly[3] = Mself.m_Start + pt; poly[4] = poly[0]; - GRPoly( &aPanel->m_ClipBox, aDC, 5, poly, false, 0, YELLOW, YELLOW ); + GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW ); } @@ -146,7 +146,7 @@ void Exit_Self( EDA_DRAW_PANEL* Panel, wxDC* DC ) if( Self_On ) { Self_On = 0; - Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, 0 ); + Panel->CallMouseCapture( DC, wxDefaultPosition, 0 ); } } @@ -169,7 +169,7 @@ void PCB_EDIT_FRAME::Begin_Self( wxDC* DC ) UpdateStatusBar(); m_canvas->SetMouseCapture( ShowBoundingBoxMicroWaveInductor, Exit_Self ); - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } @@ -179,7 +179,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) int ll; wxString msg; - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->SetMouseCapture( NULL, NULL ); if( Self_On == 0 ) diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index 9e01240192..ca3292d0bc 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -51,11 +51,11 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( no_tool || ( DrawStruct && DrawStruct->GetFlags() ) ) { - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); if( DrawStruct && DrawStruct->GetFlags() ) // Command in progress { - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); m_canvas->CrossHairOff( aDC ); switch( DrawStruct->Type() ) @@ -63,7 +63,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) case PCB_ZONE_AREA_T: if( DrawStruct->IsNew() ) { - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Begin_Zone( aDC ); } else @@ -134,7 +134,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; } - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->CrossHairOn( aDC ); if( exit ) @@ -247,7 +247,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { DrawStruct = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC ); SetCurItem( DrawStruct ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( 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 ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } break; } @@ -273,7 +273,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) SetCurItem( DrawStruct ); if( DrawStruct ) - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( 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 ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } break; @@ -315,19 +315,19 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Start_Move_Zone_Corner( aDC, zone_cont, zone_cont->m_CornerSelection, false ); } else if( Begin_Zone( aDC ) ) { - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( 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: - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); Begin_Zone( aDC ); DrawStruct = GetBoard()->m_CurrentZoneContour; GetScreen()->SetCurItem( DrawStruct ); @@ -344,12 +344,12 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { SetCurItem( Create_Texte_Pcb( aDC ) ); m_canvas->MoveCursorToCrossHair(); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else if( DrawStruct->Type() == PCB_TEXT_T ) { Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); } else { @@ -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 ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); } else { @@ -391,13 +391,13 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) { DrawStruct = (BOARD_ITEM*) EditDimension( NULL, aDC ); SetCurItem( DrawStruct ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else if( DrawStruct && (DrawStruct->Type() == PCB_DIMENSION_T) && DrawStruct->IsNew() ) { DrawStruct = (BOARD_ITEM*) EditDimension( (DIMENSION*) DrawStruct, aDC ); SetCurItem( DrawStruct ); - m_canvas->m_AutoPAN_Request = true; + m_canvas->SetAutoPanRequest( true ); } else { @@ -471,7 +471,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) if( DrawStruct->IsNew() ) { if( End_Route( (TRACK*) DrawStruct, aDC ) ) - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); } else if( DrawStruct->GetFlags() == 0 ) { @@ -511,7 +511,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) if( DrawStruct && DrawStruct->IsNew() ) { if( End_Route( (TRACK*) DrawStruct, aDC ) ) - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( 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 ) ) { - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( 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" ) ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); break; } if( DrawStruct->IsNew() ) { End_Edge( (DRAWSEGMENT*) DrawStruct, aDC ); - m_canvas->m_AutoPAN_Request = false; + m_canvas->SetAutoPanRequest( false ); SetCurItem( NULL ); } diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 23a5000e32..6a4fe78d69 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -59,7 +59,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) BOARD_ITEM* item = GetCurItem(); - m_canvas->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu + m_canvas->SetCanStartBlock( -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 @@ -119,10 +119,10 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) // previously picked at this position if( !item || cursorPos != selectPos ) { - m_canvas->m_AbortRequest = false; + m_canvas->SetAbortRequest( false ); item = PcbGeneralLocateAndDisplay(); - if( m_canvas->m_AbortRequest ) + if( m_canvas->GetAbortRequest() ) { m_canvas->CrossHairOn( &dc ); return false; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 7f29d909ee..127a6df09c 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -329,7 +329,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); if( m_canvas ) - m_canvas->m_Block_Enable = true; + m_canvas->SetEnableBlockCommands( true ); ReCreateMenuBar(); ReCreateHToolbar(); @@ -451,7 +451,7 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event ) void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) { - m_canvas->m_AbortRequest = true; + m_canvas->SetAbortRequest( true ); if( GetScreen()->IsModify() ) { diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 556579eef4..a6a7f517f4 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; - m_canvas->m_PrintIsMirrored = aPrintMirrorMode; + m_canvas->SetPrintMirrored( 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 @@ -94,7 +94,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, D_PAD::m_PadSketchModePenSize = tmp; - m_canvas->m_PrintIsMirrored = false; + m_canvas->SetPrintMirrored( false ); DisplayOpt = save_opt; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; @@ -195,7 +195,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, DisplayOpt.DisplayZonesMode = 0; DisplayOpt.DisplayNetNamesMode = 0; - m_canvas->m_PrintIsMirrored = aPrintMirrorMode; + m_canvas->SetPrintMirrored( 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 @@ -240,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( &m_canvas->m_ClipBox, aDC, + GRFilledCircle( m_canvas->GetClipBox(), aDC, pt_trace->m_Start.x, pt_trace->m_Start.y, radius, @@ -310,7 +310,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, else diameter = pt_trace->GetDrillValue(); - GRFilledCircle( &m_canvas->m_ClipBox, aDC, + GRFilledCircle( m_canvas->GetClipBox(), aDC, pt_trace->m_Start.x, pt_trace->m_Start.y, diameter/2, 0, color, color ); @@ -320,7 +320,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, GRForceBlackPen( blackpenstate ); } - m_canvas->m_PrintIsMirrored = false; + m_canvas->SetPrintMirrored( false ); DisplayOpt = save_opt; GetScreen()->m_Active_Layer = activeLayer; diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index fae5d573a8..067cfb5b58 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -260,18 +260,18 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() screen->m_DrawOrg = DrawOffset; GRResetPenAndBrush( dc ); + if( m_PrintParams.m_Print_Black_and_White ) GRForceBlackPen( true ); EDA_DRAW_PANEL* panel = m_Parent->GetCanvas(); - EDA_RECT tmp = panel->m_ClipBox; + EDA_RECT tmp = *panel->GetClipBox(); // Set clip box to the max size #define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer // and that allows calculations without overflow - panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) ); - panel->m_ClipBox.SetSize( wxSize( MAX_VALUE, MAX_VALUE ) ); + panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) ); m_Parent->GetScreen()->m_IsPrinting = true; int bg_color = g_DrawBgColor; @@ -283,6 +283,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() { // To plot mirror, we reverse the y axis, and modify the plot y origin dc->SetAxisOrientation( true, true ); + if( userscale < 1.0 ) scaley /= userscale; @@ -309,7 +310,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() DrawOffset.y += pcb_centre.y - (ysize / 2); dc->SetLogicalOrigin( screen->m_DrawOrg.x, screen->m_DrawOrg.y ); - panel->m_ClipBox.SetOrigin( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ) ); + panel->SetClipBox( EDA_RECT( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ), + panel->GetClipBox()->GetSize() ) ); } g_DrawBgColor = WHITE; @@ -331,7 +333,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() g_DrawBgColor = bg_color; m_Parent->GetScreen()->m_IsPrinting = false; - panel->m_ClipBox = tmp; + panel->SetClipBox( tmp ); GRForceBlackPen( false ); diff --git a/pcbnew/protos.h b/pcbnew/protos.h index 0726058f5c..c70d729d6c 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -70,8 +70,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo bool aErase ); /** - * Determine coordinate for a segment direction of 0, 90 or 45 degrees, - * depending on it's position from the origin (ox, oy) and \a aPosiition.. + * Determine coordinate for a segment direction of 0, 90, or 45 degrees + * depending on it's position from the origin (ox, oy) and \a aPosiition. */ void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy ); diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index c2e1a21b61..0057329155 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -876,6 +876,6 @@ void PCB_BASE_FRAME::TraceAirWiresToTargets( wxDC* aDC ) if( ii >= g_MaxLinksShowed ) break; - GRLine( &m_canvas->m_ClipBox, aDC, s_CursorPos, s_TargetsLocations[ii], 0, YELLOW ); + GRLine( m_canvas->GetClipBox(), aDC, s_CursorPos, s_TargetsLocations[ii], 0, YELLOW ); } } diff --git a/pcbnew/solve.cpp b/pcbnew/solve.cpp index 6f0a2ec6a7..400f90751e 100644 --- a/pcbnew/solve.cpp +++ b/pcbnew/solve.cpp @@ -267,8 +267,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) bool stop = false; wxString msg; - m_canvas->m_AbortRequest = false; - m_canvas->m_AbortEnable = true; + m_canvas->SetAbortRequest( false ); s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance(); @@ -289,7 +288,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) /* Test to stop routing ( escape key pressed ) */ wxYield(); - if( m_canvas->m_AbortRequest ) + if( m_canvas->GetAbortRequest() ) { if( IsOK( this, _( "Abort routing?" ) ) ) { @@ -299,7 +298,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) } else { - m_canvas->m_AbortRequest = 0; + m_canvas->SetAbortRequest( false ); } } @@ -323,7 +322,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) segm_fY = GetBoard()->GetBoundingBox().GetY() + (Board.m_GridRouting * row_target); /* Draw segment. */ - GRLine( &m_canvas->m_ClipBox, + GRLine( m_canvas->GetClipBox(), DC, segm_oX, segm_oY, @@ -378,8 +377,6 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) break; } - m_canvas->m_AbortEnable = false; - SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED ); s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items @@ -608,7 +605,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, { /* Remove link. */ GRSetDrawMode( DC, GR_XOR ); - GRLine( &pcbframe->GetCanvas()->m_ClipBox, + GRLine( pcbframe->GetCanvas()->GetClipBox(), DC, segm_oX, segm_oY, @@ -627,7 +624,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, break; /* Routing complete. */ } - if( pcbframe->GetCanvas()->m_AbortRequest ) + if( pcbframe->GetCanvas()->GetAbortRequest() ) { result = STOP_FROM_ESC; break; @@ -635,6 +632,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, /* report every COUNT new nodes or so */ #define COUNT 20000 + if( ( OpenNodes - lastopen > COUNT ) || ( ClosNodes - lastclos > COUNT ) || ( MoveNodes - lastmove > COUNT ) ) diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index f23eac1569..6bad2af501 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -80,14 +80,14 @@ void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) #ifdef USE_WX_OVERLAY if( IsShown() ) { - m_canvas->m_overlay.Reset(); - wxDCOverlay overlaydc( m_canvas->m_overlay, (wxWindowDC*)DC ); + m_overlay.Reset(); + wxDCOverlay overlaydc( m_overlay, (wxWindowDC*)DC ); overlaydc.Clear(); } #endif if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); /* Redraw the cursor */ m_canvas->DrawCrossHair( DC ); @@ -116,14 +116,14 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) #ifdef USE_WX_OVERLAY if( IsShown() ) { - m_canvas->m_overlay.Reset(); - wxDCOverlay overlaydc( m_canvas->m_overlay, (wxWindowDC*)DC ); + m_overlay.Reset(); + wxDCOverlay overlaydc( m_overlay, (wxWindowDC*)DC ); overlaydc.Clear(); } #endif if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); // Redraw the cursor m_canvas->DrawCrossHair( DC ); diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index e41e644552..895346b513 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -122,7 +122,7 @@ int PCB_EDIT_FRAME::Delete_LastCreatedCorner( wxDC* DC ) zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 ); if( m_canvas->IsMouseCaptured() ) - m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } else { @@ -467,7 +467,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) zone->SetLayer( getActiveLayer() ); // Prompt user for parameters: - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( true ); if( zone->IsOnCopperLayer() ) { // Put a zone on a copper layer @@ -496,7 +496,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) } m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); if( diag == ZONE_ABORT ) return 0; @@ -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; - m_canvas->m_IgnoreMouseEvents = true; + m_canvas->SetIgnoreMouseEvents( 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 @@ -740,7 +740,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container } m_canvas->MoveCursorToCrossHair(); - m_canvas->m_IgnoreMouseEvents = false; + m_canvas->SetIgnoreMouseEvents( false ); if( diag == ZONE_ABORT ) {