Commit d657b430 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Use wxDC for all coordinate manipulations.

* Remove all occurrences if #ifdef USE_WX_ZOOM and all associated code within
  the #else/#endif block ( old zoom code ).
* Removed the build option for USE_WX_ZOOM from CMakeList.txt and config.h.in.
* Removed all scaling code in base screen object.
* Fixed buffered paint and buffered client DC on Windows.  Buffering works
  properly on Linux and Windows.
* Modified kicad_device_context.h to automatically uses buffering on platforms
  where double buffering is supported natively.
* Remove all of the scaled versions of the drawing functions in gr_basic.cpp
  and any support code.
* Removed all traces of ActiveScreen global variable from eeschema and
  gerbview.
* Renamed Recadre_Trace to RedrawScreen in draw frame object.
* Renamed PostDirtyRect to RefreshDrawingRect in draw panel object.
* Lots of code cleaning an Doxygen comment improvements.
parent 654b8909
......@@ -22,8 +22,6 @@ option(KICAD_GOST "enable/disable building using GOST notation for multiple gate
#for those who bored with uppercase
option(KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected")
option(USE_WX_ZOOM "Use wxDC to perform zooming (default ON)." ON)
option(USE_WX_GRAPHICS_CONTEXT
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental")
......@@ -61,18 +59,12 @@ if(KICAD_KEEPCASE)
add_definitions(-DKICAD_KEEPCASE)
endif(KICAD_KEEPCASE)
if(USE_WX_ZOOM)
add_definitions(-DUSE_WX_ZOOM)
endif(USE_WX_ZOOM)
if(USE_WX_OVERLAY OR APPLE)
add_definitions(-DUSE_WX_OVERLAY)
endif(USE_WX_OVERLAY OR APPLE)
if(USE_WX_GRAPHICS_CONTEXT)
set( USE_WX_ZOOM ON )
add_definitions(-DUSE_WX_ZOOM)
add_definitions(-DUSE_WX_GRAPHICS_CONTEXT)
endif(USE_WX_GRAPHICS_CONTEXT)
......
......@@ -49,9 +49,6 @@
#define strnicmp _strnicmp
#endif
/* Warning!!! Using wxDC for zooming is experimental. */
#cmakedefine USE_WX_ZOOM 1
/* Warning!!! Using wxGraphicContext for rendering is experimental. */
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
......
......@@ -101,23 +101,6 @@ void BASE_SCREEN::SetPageSize( wxSize& aPageSize )
}
/**
* Function CursorRealPosition
* @return the position in user units of location ScreenPos
* @param ScreenPos = the screen (in pixel) position co convert
*/
wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
{
wxPoint curpos = ScreenPos;
Unscale( curpos );
#ifndef USE_WX_ZOOM
curpos += m_DrawOrg;
#endif
return curpos;
}
/**
* Function SetScalingFactor
* calculates the .m_Zoom member to have a given scaling factor
......@@ -131,113 +114,15 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
// Limit zoom to max and min allowed values:
if (zoom < m_ZoomList[0])
zoom = m_ZoomList[0];
int idxmax = m_ZoomList.GetCount() - 1;
if (zoom > m_ZoomList[idxmax])
zoom = m_ZoomList[idxmax];
SetZoom( zoom );
}
/**
* Calculate coordinate value for zooming.
*
* Call this method when drawing on the device context. It scales the
* coordinate using the current zoom settings. Zooming in Kicad occurs
* by actually scaling the entire drawing using the zoom setting.
*
* FIXME: We should probably use wxCoord instead of int here but that would
* require using wxCoord in all of the other code that makes device
* context calls as well.
*/
int BASE_SCREEN::Scale( int coord )
{
#ifdef USE_WX_ZOOM
return coord;
#else
if( !m_ZoomScalar || !m_Zoom )
return coord;
return wxRound( (double) ( coord * m_ZoomScalar ) / (double) m_Zoom );
#endif
}
double BASE_SCREEN::Scale( double coord )
{
#ifdef USE_WX_ZOOM
return coord;
#else
if( !m_Zoom )
return 0;
if( !m_ZoomScalar || !m_Zoom )
return 0;
return ( coord * (double) m_ZoomScalar ) / (double) m_Zoom;
#endif
}
void BASE_SCREEN::Scale( wxPoint& pt )
{
pt.x = Scale( pt.x );
pt.y = Scale( pt.y );
}
void BASE_SCREEN::Scale( wxRealPoint& pt )
{
#ifdef USE_WX_ZOOM
// No change
#else
if( !m_ZoomScalar || !m_Zoom )
return;
pt.x = pt.x * m_ZoomScalar / (double) m_Zoom;
pt.y = pt.y * m_ZoomScalar / (double) m_Zoom;
#endif
}
void BASE_SCREEN::Scale( wxSize& sz )
{
sz.SetHeight( Scale( sz.GetHeight() ) );
sz.SetWidth( Scale( sz.GetWidth() ) );
}
/**
* Calculate the physical (unzoomed) location of a coordinate.
*
* Call this method when you want to find the unzoomed (physical) location
* of a coordinate on the drawing.
*/
int BASE_SCREEN::Unscale( int coord )
{
#ifdef USE_WX_ZOOM
return coord;
#else
if( !m_Zoom || !m_ZoomScalar )
return 0;
return wxRound( (double) ( coord * m_Zoom ) / (double) m_ZoomScalar );
#endif
}
void BASE_SCREEN::Unscale( wxPoint& pt )
{
pt.x = Unscale( pt.x );
pt.y = Unscale( pt.y );
}
void BASE_SCREEN::Unscale( wxSize& sz )
{
sz.SetHeight( Unscale( sz.GetHeight() ) );
sz.SetWidth( Unscale( sz.GetWidth() ) );
}
void BASE_SCREEN::SetZoomList( const wxArrayInt& zoomlist )
{
if( !m_ZoomList.IsEmpty() )
......
......@@ -399,11 +399,7 @@ void EDA_TextStruct::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aAnchor_color != UNSPECIFIED_COLOR )
{
#if USE_WX_ZOOM
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
#else
int anchor_size = aPanel->GetScreen()->Unscale( 2 );
#endif
aAnchor_color = (EDA_Colors) ( aAnchor_color & MASKCOLOR );
......
......@@ -96,16 +96,15 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
}
void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset,
int aDrawMode,
int aColor )
void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor )
{
int w = aPanel->GetScreen()->Scale( GetWidth() );
int h = aPanel->GetScreen()->Scale( GetHeight() );
int w = GetWidth();
int h = GetHeight();
GRSetDrawMode( aDC, aDrawMode );
if( w == 0 || h == 0 )
GRLine( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
......
......@@ -289,7 +289,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
return;
GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
GetBaseScreen()->SetZoom( selectedZoom );
Recadre_Trace( false );
RedrawScreen( false );
}
}
......
This diff is collapsed.
......@@ -287,10 +287,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
if( aPanel )
{
int xm, ym, ll, xc, yc;
ll = aPanel->GetScreen()->Scale( ABS( dx ) );
ll = ABS( dx );
xc = GRMapX( current_char_pos.x );
yc = GRMapY( current_char_pos.y );
xc = current_char_pos.x;
yc = current_char_pos.y;
x0 = aPanel->m_ClipBox.GetX() - ll;
y0 = aPanel->m_ClipBox.GetY() - ll;
......@@ -343,11 +343,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
}
// Note: if aPanel == NULL, we are using a GL Canvas that handle scaling
if( aPanel && aPanel->GetScreen()->Scale( aSize.x ) == 0 )
if( aSize.x == 0 )
return;
/* if a text size is too small, the text cannot be drawn, and it is drawn as a single graphic line */
if( aPanel && ABS( ( aPanel->GetScreen()->Scale( aSize.x ) ) ) < 3 )
/* if a text size is too small, the text cannot be drawn, and it is drawn as a single
* graphic line */
if( aSize.x < 3 )
{
/* draw the text as a line always vertically centered */
wxPoint end( current_char_pos.x + dx, current_char_pos.y );
......
This diff is collapsed.
......@@ -17,33 +17,30 @@
#include "kicad_device_context.h"
#include "hotkeys_basic.h"
/** Compute draw offset (scroll bars and draw parameters)
* in order to have the current graphic cursor position at the screen center
* @param ToMouse if TRUE, the mouse cursor is moved
* to the graphic cursor position (which is usually on grid)
*
* Note: Mac OS ** does not ** allow moving mouse cursor by program.
*/
void EDA_DRAW_FRAME::Recadre_Trace( bool ToMouse )
void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
{
PutOnGrid( &(GetBaseScreen()->m_Curseur) );
AdjustScrollBars();
#if !(defined(__WXMAC__) && defined(USE_WX_ZOOM))
/* We do not use here DrawPanel->Refresh() because
* the redraw is delayed and the mouse events (from MouseToCursorSchema ot others)
* during this delay create problems: the mouse cursor position is false in calculations.
* TODO: see exactly how the mouse creates problems when moving during refresh
* use Refresh() and update() do not change problems
#if !defined(__WXMAC__)
/* DrawPanel->Refresh() is not used here because the redraw is delayed and the mouse
* events (from MouseToCursorSchema ot others) during this delay create problems: the
* mouse cursor position is false in calculations. TODO: see exactly how the mouse
* creates problems when moving during refresh use Refresh() and update() do not change
* problems
*/
INSTALL_DC( dc, DrawPanel );
DrawPanel->SetClipBox( dc );
DrawPanel->ReDraw( &dc, DrawPanel->m_DisableEraseBG ? false : true );
#else
DrawPanel->Refresh();
DrawPanel->Update();
#endif
/* Move the mouse cursor to the on grid graphic cursor position */
if( ToMouse == TRUE )
if( aWarpPointer )
DrawPanel->MouseToCursorSchema();
}
......@@ -77,7 +74,7 @@ void EDA_DRAW_FRAME::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize )
void EDA_DRAW_FRAME::Zoom_Automatique( bool move_mouse_cursor )
{
GetBaseScreen()->SetZoom( BestZoom() ); // Set the best zoom
Recadre_Trace( move_mouse_cursor ); // Set the best centering and refresh the screen
RedrawScreen( move_mouse_cursor ); // Set the best centering and refresh the screen
}
......@@ -101,7 +98,7 @@ void EDA_DRAW_FRAME::Window_Zoom( EDA_Rect& Rect )
GetBaseScreen()->SetScalingFactor( bestscale );
GetBaseScreen()->m_Curseur = Rect.Centre();
Recadre_Trace( TRUE );
RedrawScreen( TRUE );
}
......@@ -130,7 +127,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
if( id == ID_ZOOM_IN )
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
if( screen->SetPreviousZoom() )
Recadre_Trace( zoom_at_cursor );
RedrawScreen( zoom_at_cursor );
break;
case ID_POPUP_ZOOM_OUT:
......@@ -142,7 +139,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
if( id == ID_ZOOM_OUT )
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
if( screen->SetNextZoom() )
Recadre_Trace( zoom_at_cursor );
RedrawScreen( zoom_at_cursor );
break;
case ID_ZOOM_REDRAW:
......@@ -150,7 +147,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break;
case ID_POPUP_ZOOM_CENTER:
Recadre_Trace( true );
RedrawScreen( true );
break;
case ID_ZOOM_PAGE:
......@@ -174,7 +171,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
return;
}
if( screen->SetZoom( screen->m_ZoomList[i] ) )
Recadre_Trace( true );
RedrawScreen( true );
}
UpdateStatusBar();
......
......@@ -492,7 +492,7 @@ void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event )
{
CreateScreenCmp();
DrawFrame->AdjustScrollBars();
DrawFrame->Recadre_Trace( FALSE );
DrawFrame->RedrawScreen( FALSE );
}
......
......@@ -236,6 +236,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_DRAG: /* Drag */
GetScreen()->BreakSegmentsOnJunctions();
// fall through
case BLOCK_ROTATE:
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y:
......@@ -243,6 +244,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_COPY: /* Copy */
GetScreen()->UpdatePickList();
// fall through
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( block->GetCount() )
{
......@@ -297,7 +299,6 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_FLIP: /* pcbnew only! */
break;
case BLOCK_ZOOM: /* Window Zoom */
zoom_command = true;
break;
......@@ -308,9 +309,10 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
}
}
if( block->m_Command == BLOCK_ABORT )
if( block->m_Command == BLOCK_ABORT )
{
GetScreen()->ClearDrawingState();
DrawPanel->Refresh();
}
if( ! nextcmd )
......@@ -327,7 +329,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( zoom_command )
Window_Zoom( GetScreen()->m_BlockLocate );
return nextcmd ;
return nextcmd;
}
......
......@@ -365,7 +365,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
{
case SCH_JUNCTION_T:
case SCH_LINE_T:
DrawPanel->PostDirtyRect( item->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( item->GetBoundingBox() );
break;
default:
......
......@@ -366,11 +366,8 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
/* Enable this to draw the anchor of the component. */
#if 0
#ifdef USE_WX_ZOOM
int len = aDc->DeviceToLogicalXRel( 3 );
#else
int len = aPanel->GetScreen()->Unscale( 3 );
#endif
GRLine( &aPanel->m_ClipBox, 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,
......
......@@ -243,8 +243,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
int hotkey = 0;
double scalar = screen->GetScalingFactor();
ActiveScreen = screen;
curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
......@@ -339,8 +337,6 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
int hotkey = 0;
double scalar = screen->GetScalingFactor();
ActiveScreen = screen;
curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
......@@ -434,8 +430,6 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
int hotkey = 0;
double scalar = screen->GetScalingFactor();
ActiveScreen = screen;
curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
......
......@@ -25,7 +25,6 @@
// Keys for configuration
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )
extern BASE_SCREEN* ActiveScreen;
#define WIDTH_MAX_VALUE 100
#define WIDTH_MIN_VALUE 1
......@@ -125,7 +124,6 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
schscreen = schframe->m_CurrentSheet->LastScreen();
ActiveScreen = schscreen;
}
else // Should not happen
return;
......@@ -169,8 +167,6 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
msg += wxT( "\n" );
m_MessagesBox->AppendText( msg );
}
ActiveScreen = oldscreen;
}
......
......@@ -820,8 +820,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
if( m_Cmp->m_Flags == 0 )
m_Parent->SaveCopyInUndoList( m_Cmp, UR_CHANGED );
INSTALL_DC( dc, m_Parent->DrawPanel );
INSTALL_UNBUFFERED_DC( dc, m_Parent->DrawPanel );
m_Cmp->Draw( m_Parent->DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode );
// Initialize field values to default values found in library:
......
......@@ -197,7 +197,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
if( m_CurrentText->m_Flags == 0 )
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() );
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
text = m_textLabel->GetValue();
if( !text.IsEmpty() )
......@@ -235,7 +235,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
if( (m_CurrentText->m_Flags & IS_NEW) != 0 )
g_DefaultTextLabelSize = m_CurrentText->m_Size.x;
m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() );
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
m_Parent->DrawPanel->MouseToCursorSchema();
EndModal( wxID_OK );
}
......@@ -172,12 +172,11 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
{
sheet->LastScreen()->SetZoom( m_Parent->GetScreen()->GetZoom() );
*m_Parent->m_CurrentSheet = *sheet;
ActiveScreen = m_Parent->m_CurrentSheet->LastScreen();
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
}
sheet->LastScreen()->m_Curseur = pos;
m_Parent->Recadre_Trace( true );
m_Parent->RedrawScreen( true );
}
......
......@@ -145,7 +145,6 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
{
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SCREEN* oldscreen = screen;
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
wxString PlotFileName;
Ki_PageDescr* PlotSheet;
......@@ -168,27 +167,29 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
{
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->m_CurrentSheet = &list;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
screen = schframe->m_CurrentSheet->LastScreen();
ActiveScreen = screen;
}
else // Should not happen
return;
sheetpath = SheetList.GetNext();
}
PlotSheet = screen->m_CurrentSheetDesc;
double scale = 10;
plot_offset.x = 0;
plot_offset.y = 0;
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(
".dxf" );
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale );
......@@ -196,7 +197,6 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
break;
}
ActiveScreen = oldscreen;
schframe->m_CurrentSheet = oldsheetpath;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
......@@ -204,10 +204,10 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint plot_offset,
double scale )
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint plot_offset,
double scale )
{
wxString msg;
......
......@@ -208,6 +208,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( )
EESCHEMA_INTERNAL_UNIT);
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
g_HPGL_Pen_Descr.m_Pen_Diam = 100;
if( g_HPGL_Pen_Descr.m_Pen_Diam < 1 )
g_HPGL_Pen_Descr.m_Pen_Diam = 1;
}
......@@ -216,8 +217,10 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( )
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenSpeed( )
{
g_HPGL_Pen_Descr.m_Pen_Speed = m_penSpeedCtrl->GetValue();
if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
g_HPGL_Pen_Descr.m_Pen_Speed = 40;
if( g_HPGL_Pen_Descr.m_Pen_Speed < 1 )
g_HPGL_Pen_Descr.m_Pen_Speed = 1;
}
......@@ -226,8 +229,10 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenSpeed( )
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenNum( )
{
g_HPGL_Pen_Descr.m_Pen_Num = m_penNumCtrl->GetValue();
if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
g_HPGL_Pen_Descr.m_Pen_Num = 8;
if( g_HPGL_Pen_Descr.m_Pen_Num < 1 )
g_HPGL_Pen_Descr.m_Pen_Num = 1;
}
......@@ -258,8 +263,8 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
* selected sheet
*/
void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( BASE_SCREEN* screen,
wxSize& SheetSize,
wxPoint& SheetOffset )
wxSize& SheetSize,
wxPoint& SheetOffset )
{
Ki_PageDescr* PlotSheet;
......@@ -277,7 +282,6 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
{
wxString PlotFileName;
SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SCREEN* oldscreen = screen;
SCH_SHEET_PATH* sheetpath, * oldsheetpath = m_Parent->GetSheet();
Ki_PageDescr* PlotSheet;
wxSize SheetSize;
......@@ -300,46 +304,47 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
{
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_Parent->m_CurrentSheet = &list;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
screen = m_Parent->m_CurrentSheet->LastScreen();
ActiveScreen = screen;
}
else // Should not happen
return;
sheetpath = SheetList.GetNext();
}
ReturnSheetDims( screen, SheetSize, SheetOffset );
/* Calculation of conversion scales. */
if( HPGL_SheetSize )
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
else
PlotSheet = screen->m_CurrentSheetDesc;
/* 10x because eeschema works in mils, not decimals */
double plot_scale = 10 * (double) PlotSheet->m_Size.x /
(double) SheetSize.x;
double plot_scale = 10 * (double) PlotSheet->m_Size.x / (double) SheetSize.x;
/* Calculate offsets */
PlotOffset.x = -SheetOffset.x;
PlotOffset.y = -SheetOffset.y;
PlotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() +
wxT( ".plt" );
PlotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" );
SetLocaleTo_C_standard();
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset,
plot_scale );
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset, plot_scale );
SetLocaleTo_Default();
if( !aPlotAll )
break;
}
ActiveScreen = oldscreen;
m_Parent->m_CurrentSheet = oldsheetpath;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
......@@ -347,10 +352,10 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint& offset,
double plot_scale )
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint& offset,
double plot_scale )
{
wxString msg;
......@@ -383,6 +388,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
plotter->start_plot( output_file );
plotter->set_color( BLACK );
if( m_plot_Sheet_Ref )
m_Parent->PlotWorkSheet( plotter, screen );
......
......@@ -173,7 +173,6 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{
SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SCREEN* oldscreen = screen;
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH* oldsheetpath = m_Parent->GetSheet(); // sheetpath is saved here
wxString plotFileName;
......@@ -198,20 +197,24 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_Parent->m_CurrentSheet = &list;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
screen = m_Parent->m_CurrentSheet->LastScreen();
ActiveScreen = screen;
}
else // Should not happen
return;
sheetpath = SheetList.GetNext();
}
actualPage = screen->m_CurrentSheetDesc;
switch( m_pageSizeSelect )
{
case PAGE_SIZE_A:
......@@ -243,7 +246,6 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
break;
}
ActiveScreen = oldscreen;
m_Parent->m_CurrentSheet = oldsheetpath;
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
......
......@@ -40,7 +40,7 @@ public:
bool HasPage( int page );
bool OnBeginDocument( int startPage, int endPage );
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo );
void DrawPage();
void DrawPage( SCH_SCREEN* aScreen );
};
......@@ -227,7 +227,6 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
parent->AppendMsgPanel( msg, wxEmptyString, CYAN );
SCH_SCREEN* screen = parent->GetScreen();
SCH_SCREEN* oldscreen = screen;
SCH_SHEET_PATH* oldsheetpath = parent->GetSheet();
SCH_SHEET_PATH list;
SCH_SHEET_LIST SheetList( NULL );
......@@ -248,9 +247,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
if( screen == NULL )
return false;
ActiveScreen = screen;
DrawPage();
ActiveScreen = oldscreen;
DrawPage( screen );
parent->m_CurrentSheet = oldsheetpath;
parent->m_CurrentSheet->UpdateAllScreenReferences();
parent->SetSheetNumberAndCount();
......@@ -259,8 +256,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
}
void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage,
int* selPageFrom, int* selPageTo )
void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo )
{
*minPage = *selPageFrom = 1;
*maxPage = *selPageTo = g_RootSheet->CountSheets();
......@@ -306,7 +302,7 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
/*
* This is the real print function: print the active screen
*/
void SCH_PRINTOUT::DrawPage()
void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
{
int oldZoom;
wxPoint tmp_startvisu;
......@@ -321,15 +317,12 @@ void SCH_PRINTOUT::DrawPage()
wxBusyCursor dummy;
/* Save current scale factor, offsets, and clip box. */
tmp_startvisu = ActiveScreen->m_StartVisu;
oldZoom = ActiveScreen->GetZoom();
old_org = ActiveScreen->m_DrawOrg;
tmp_startvisu = aScreen->m_StartVisu;
oldZoom = aScreen->GetZoom();
old_org = aScreen->m_DrawOrg;
oldClipBox = panel->m_ClipBox;
/* Change scale factor, offsets, and clip box to print the whole page. */
ActiveScreen->SetScalingFactor( 1.0 );
ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0;
ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0;
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
......@@ -343,8 +336,9 @@ void SCH_PRINTOUT::DrawPage()
wxBitmap psuedoBitmap( 1, 1 );
wxMemoryDC memDC;
memDC.SelectObject( psuedoBitmap );
( (SCH_SCREEN*) ActiveScreen )->Draw( panel, &memDC, GR_DEFAULT_DRAWMODE );
parent->TraceWorkSheet( &memDC, ActiveScreen, g_DrawDefaultLineThickness );
aScreen->Draw( panel, &memDC, GR_DEFAULT_DRAWMODE );
parent->TraceWorkSheet( &memDC, aScreen, g_DrawDefaultLineThickness );
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
......@@ -356,7 +350,7 @@ void SCH_PRINTOUT::DrawPage()
}
else
{
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size;
SheetSize = aScreen->m_CurrentSheetDesc->m_Size;
FitThisSizeToPaper( SheetSize );
fitRect = GetLogicalPaperRect();
}
......@@ -369,21 +363,22 @@ void SCH_PRINTOUT::DrawPage()
if( parent->GetPrintMonochrome() )
GRForceBlackPen( true );
ActiveScreen->m_IsPrinting = true;
aScreen->m_IsPrinting = true;
int bg_color = g_DrawBgColor;
( ( SCH_SCREEN* ) ActiveScreen )->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
if( printReference )
parent->TraceWorkSheet( dc, ActiveScreen, g_DrawDefaultLineThickness );
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness );
g_DrawBgColor = bg_color;
ActiveScreen->m_IsPrinting = false;
aScreen->m_IsPrinting = false;
panel->m_ClipBox = oldClipBox;
GRForceBlackPen( false );
ActiveScreen->m_StartVisu = tmp_startvisu;
ActiveScreen->m_DrawOrg = old_org;
ActiveScreen->SetZoom( oldZoom );
aScreen->m_StartVisu = tmp_startvisu;
aScreen->m_DrawOrg = old_org;
aScreen->SetZoom( oldZoom );
}
......@@ -50,8 +50,6 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( GetScreen() == NULL )
return;
ActiveScreen = GetScreen();
DrawPanel->DrawBackGround( DC );
GetScreen()->Draw( DrawPanel, DC, GR_DEFAULT_DRAWMODE );
......
......@@ -159,7 +159,6 @@ bool WinEDA_App::OnInit()
SetupServerFunction( RemoteCommand );
}
ActiveScreen = frame->GetScreen();
frame->Zoom_Automatique( TRUE );
/* Load file specified in the command line. */
......
......@@ -27,7 +27,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
if( !curr_item || curr_item->m_Flags )
return;
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
switch( curr_item->Type() )
{
......
......@@ -61,13 +61,12 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
{
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheetFoundIn;
ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences();
}
sheetFoundIn->LastScreen()->m_Curseur = lastMarker->m_Pos;
Recadre_Trace( TRUE );
RedrawScreen( TRUE );
wxString path = sheetFoundIn->Path();
wxString units = GetAbbreviatedUnitsLabel();
......@@ -184,7 +183,6 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE;
}
......@@ -215,10 +213,10 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
#undef MARGIN
if( DoCenterAndRedraw )
Recadre_Trace( mouseWarp );
RedrawScreen( mouseWarp );
else
{
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc );
......@@ -329,13 +327,12 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& event )
{
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheetFoundIn;
ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences();
}
// sheetFoundIn->LastScreen()->m_Curseur = lastItem->GetBoundingBox().Centre();
sheetFoundIn->LastScreen()->m_Curseur = lastItemPosition;
Recadre_Trace( true );
RedrawScreen( true );
msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable();
SetStatusText( msg );
......
......@@ -259,7 +259,7 @@ void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC,
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
{
DrawPanel->PostDirtyRect( DrawComponent->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( DrawComponent->GetBoundingBox() );
}
}
......@@ -441,11 +441,11 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
// switch from normal mode to xor mode for the duration of the move, first
// by erasing fully any "normal drawing mode" primitives with the
// PostDirtyRect(), then by drawing the first time in xor mode so that
// RefreshDrawingRect(), then by drawing the first time in xor mode so that
// subsequent xor drawing modes will fully erase this first copy.
Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
DrawPanel->PostDirtyRect( Component->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Component->GetBoundingBox() );
Component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
......
......@@ -260,16 +260,14 @@ void SCH_EDIT_FRAME::InstallPreviousSheet()
ClearMsgPanel();
//make a copy for testing purposes.
SCH_SHEET_PATH listtemp = *m_CurrentSheet;
listtemp.Pop();
m_CurrentSheet->Pop();
if( listtemp.LastScreen() == NULL )
if( m_CurrentSheet->LastScreen() == NULL )
{
DisplayError( this, wxT( "InstallPreviousScreen() Error: Sheet not found" ) );
return;
}
m_CurrentSheet->Pop();
UpdateScreenFromSheet( this );
}
......@@ -286,6 +284,7 @@ void SCH_EDIT_FRAME::InstallNextScreen( SCH_SHEET* Sheet )
{
DisplayError( this, wxT( "InstallNextScreen() error" ) ); return;
}
m_CurrentSheet->Push( Sheet );
m_itemToRepeat = NULL;
ClearMsgPanel();
......@@ -298,41 +297,33 @@ void SCH_EDIT_FRAME::InstallNextScreen( SCH_SHEET* Sheet )
*/
static bool UpdateScreenFromSheet( SCH_EDIT_FRAME* frame )
{
SCH_SCREEN* NewScreen;
NewScreen = frame->m_CurrentSheet->LastScreen();
if( !NewScreen )
if( !frame->m_CurrentSheet->LastScreen() )
{
DisplayError( frame, wxT( "Screen not found for this sheet" ) );
return false;
}
SCH_SCREEN* screen = frame->m_CurrentSheet->LastScreen();
// Reset display settings of the new screen
// Assumes m_CurrentSheet has already been updated.
frame->ClearMsgPanel();
frame->DrawPanel->SetScrollbars( NewScreen->m_ScrollPixelsPerUnitX,
NewScreen->m_ScrollPixelsPerUnitY,
NewScreen->m_ScrollbarNumber.x,
NewScreen->m_ScrollbarNumber.y,
NewScreen->m_ScrollbarPos.x,
NewScreen->m_ScrollbarPos.y, TRUE );
// update the References
frame->m_CurrentSheet->UpdateAllScreenReferences();
frame->SetSheetNumberAndCount();
frame->DrawPanel->m_CanStartBlock = -1;
ActiveScreen = frame->m_CurrentSheet->LastScreen();
if( NewScreen->m_FirstRedraw )
if( screen->m_FirstRedraw )
{
NewScreen->m_FirstRedraw = FALSE;
frame->Zoom_Automatique( TRUE );
screen->m_FirstRedraw = false;
frame->Zoom_Automatique( true );
}
else
{
frame->DrawPanel->MouseToCursorSchema();
frame->RedrawScreen( true );
}
frame->DrawPanel->Refresh();
return true;
}
......@@ -198,8 +198,6 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( GetScreen() == NULL )
return;
ActiveScreen = GetScreen();
DrawPanel->DrawBackGround( DC );
if( m_component )
......
......@@ -640,7 +640,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
switch( id )
{
......@@ -928,6 +928,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 )
m_lastDrawItem = NULL;
}
......@@ -1072,7 +1073,7 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
wxCHECK_RET( m_component != NULL,
wxT( "Cannot create new part from non-existant current part." ) );
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
DrawPanel->CursorOff( &dc );
EditField( &dc, &m_component->GetValueField() );
DrawPanel->MouseToCursorSchema();
......
......@@ -167,7 +167,7 @@ void DeleteStruct( EDA_DRAW_PANEL* panel, wxDC* DC, SCH_ITEM* DrawStruct )
{
screen->RemoveFromDrawList( DrawStruct );
panel->PostDirtyRect( DrawStruct->GetBoundingBox() );
panel->RefreshDrawingRect( DrawStruct->GetBoundingBox() );
/* Unlink the structure */
DrawStruct->SetNext( 0 );
......
......@@ -531,6 +531,6 @@ private:
};
typedef boost::ptr_vector< SCH_SHEET > SCH_SHEETS;
typedef std::vector< SCH_SHEET* > SCH_SHEETS;
#endif /* CLASS_DRAWSHEET_H */
......@@ -448,23 +448,22 @@ SCH_ITEM* SCH_SHEET_PATH::MatchNextItem( wxFindReplaceData& aSearchData,
}
bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
SCH_SHEET_PATH& SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
{
if( this == &d1 ) // Self assignment is bad!
return *this;
m_numSheets = d1.m_numSheets;
unsigned i;
for( i = 0; i < m_numSheets; i++ )
{
m_sheets[i] = d1.m_sheets[i];
}
for( ; i < DSLSZ; i++ )
{
m_sheets[i] = 0;
}
return true;
return *this;
}
......@@ -483,29 +482,6 @@ bool SCH_SHEET_PATH::operator==( const SCH_SHEET_PATH& d1 ) const
}
bool SCH_SHEET_PATH::operator!=( const SCH_SHEET_PATH& d1 ) const
{
if( m_numSheets != d1.m_numSheets )
return true;
for( unsigned i = 0; i < m_numSheets; i++ )
{
if( m_sheets[i] != d1.m_sheets[i] )
{
/*
printf( "micompare this:'%s' d1:'%s'\n",
CONV_TO_UTF8( PathHumanReadable() ),
CONV_TO_UTF8( d1.PathHumanReadable() ) );
*/
return true;
}
}
return false;
}
/*********************************************************************/
/* Class SCH_SHEET_LIST to handle the list of Sheets in a hierarchy */
/*********************************************************************/
......@@ -635,6 +611,28 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
}
bool SCH_SHEET_LIST::IsModified()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet != NULL; sheet = GetNext() )
{
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
return true;
}
return false;
}
void SCH_SHEET_LIST::ClearModifyStatus()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet != NULL; sheet = GetNext() )
{
if( sheet->LastScreen() )
sheet->LastScreen()->ClrModify();
}
}
void SCH_SHEET_LIST::AnnotatePowerSymbols()
{
int ref = 1;
......
......@@ -240,11 +240,11 @@ public:
SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem,
wxPoint * aFindLocation );
bool operator=( const SCH_SHEET_PATH& d1 );
SCH_SHEET_PATH& operator=( const SCH_SHEET_PATH& d1 );
bool operator==( const SCH_SHEET_PATH& d1 ) const;
bool operator!=( const SCH_SHEET_PATH& d1 ) const;
bool operator!=( const SCH_SHEET_PATH& d1 ) const { return !( *this == d1 ) ; }
};
......@@ -336,6 +336,15 @@ public:
*/
SCH_SHEET_PATH* GetSheet( int aIndex );
/**
* Function IsModified
* checks the entire hierachy for any modifications.
* @returns True if the hierarchy is modified otherwise false.
*/
bool IsModified();
void ClearModifyStatus();
/**
* Function AnnotatePowerSymbols
* clear and annotates the entire hierarchy of the sheet path list.
......
......@@ -156,7 +156,8 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
switch( id )
{
case ID_HIERARCHY:
......@@ -403,7 +404,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList( sheet, UR_CHANGED );
sheet->CleanupSheet();
OnModify();
DrawPanel->PostDirtyRect( sheet->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( sheet->GetBoundingBox() );
}
break;
......
......@@ -346,23 +346,12 @@ void SCH_EDIT_FRAME::CreateScreens()
void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
SCH_SHEET_PATH* sheet;
if( m_LibeditFrame ) // Can close component editor ?
{
if( !m_LibeditFrame->Close() )
return;
}
if( m_LibeditFrame && !m_LibeditFrame->Close() ) // Can close component editor?
return;
SCH_SHEET_LIST SheetList;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
break;
}
if( sheet )
if( SheetList.IsModified() )
{
wxMessageDialog dialog( this,
_( "Schematic modified, Save before exit ?" ),
......@@ -385,15 +374,7 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
}
}
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
{
if( sheet->LastScreen() )
{
sheet->LastScreen()->ClrModify();
}
}
SheetList.ClearModifyStatus();
if( !g_RootSheet->GetScreen()->GetFileName().IsEmpty()
&& (g_RootSheet->GetScreen()->GetDrawItems() != NULL) )
......@@ -733,7 +714,6 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
wxT( "Library Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
ActiveScreen = GetBaseScreen();
m_LibeditFrame->AdjustScrollBars();
}
}
......
......@@ -271,7 +271,7 @@ void SCH_EDIT_FRAME::DeleteSheetLabel( bool aRedraw, SCH_SHEET_PIN* aSheetLabelT
parent->RemoveLabel( aSheetLabelToDel );
if( aRedraw )
DrawPanel->PostDirtyRect( parent->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( parent->GetBoundingBox() );
#if 0 && defined(DEBUG)
......
......@@ -237,6 +237,6 @@ void LIB_EDIT_FRAME::PlaceAncre()
/* Redraw the symbol */
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
Recadre_Trace( TRUE );
RedrawScreen( TRUE );
DrawPanel->Refresh();
}
......@@ -259,8 +259,6 @@ void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
wxString msg;
wxString tmp;
ActiveScreen = GetScreen();
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib == NULL )
......
......@@ -78,11 +78,10 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
wxBusyCursor dummy;
ActiveScreen = screen;
GRSetDrawMode( DC, GR_COPY );
int drawMode = -1;
switch ( GetDisplayMode() )
{
default:
......
......@@ -117,6 +117,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
}
INSTALL_DC( dc, DrawPanel );
switch( id )
{
case ID_EXIT:
......
......@@ -96,8 +96,6 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
wxFileName filename = aFullFileName;
wxString currentPath;
ActiveScreen = GetScreen();
if( ! filename.IsOk() )
{
/* Standard gerber filetypes
......@@ -197,14 +195,11 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
* 0 if file not read (cancellation of order ...)
* 1 if OK
*/
static void LoadDCodeFile( WinEDA_GerberFrame* frame,
const wxString& FullFileName )
static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName )
{
wxString wildcard;
wxFileName fn = FullFileName;
ActiveScreen = frame->GetScreen();
if( !fn.IsOk() )
{
wildcard.Printf( _( "Gerber DCODE files (%s)|*.%s" ),
......
......@@ -152,7 +152,6 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
#endif
SetBaseScreen( ScreenPcb );
ActiveScreen = ScreenPcb;
SetBoard( new BOARD( NULL, this ) );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
......
......@@ -93,7 +93,6 @@ bool WinEDA_App::OnInit()
}
ScreenPcb = new PCB_SCREEN();
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
ActiveScreen = ScreenPcb;
// read current setup and reopen last directory if no filename to open in
// command line
......
......@@ -44,7 +44,7 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0;
SetBaseScreen( ActiveScreen = ScreenPcb );
SetBaseScreen( ScreenPcb );
GetScreen()->Init();
setActiveLayer(LAYER_N_BACK);
syncLayerBox();
......
......@@ -62,7 +62,6 @@ public:
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
wxPoint m_MousePositionInPixels;
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units.
* (coordinates from last reset position)*/
......@@ -165,13 +164,6 @@ public:
wxSize ReturnPageSize( void );
virtual int GetInternalUnits( void );
/**
* Function CursorRealPosition
* @return the position in user units of location ScreenPos
* @param ScreenPos = the screen (in pixel) position co convert
*/
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
/**
* Return the current cursor position in drawing coordinates.
*
......@@ -301,16 +293,6 @@ public:
*/
void SetZoomList( const wxArrayInt& aZoomList );
int Scale( int coord );
double Scale( double coord );
void Scale( wxPoint& pt );
void Scale( wxSize& sz );
void Scale( wxRealPoint& sz );
int Unscale( int coord );
void Unscale( wxPoint& pt );
void Unscale( wxSize& sz );
bool SetNextZoom();
bool SetPreviousZoom();
bool SetFirstZoom();
......
......@@ -89,7 +89,6 @@ public:
}
void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event );
/**
* Function DrawBackGround
......@@ -128,7 +127,7 @@ public:
*/
void DrawGridAxis( wxDC* aDC, int aDrawMode );
void OnEraseBackground( wxEraseEvent& event );
void OnEraseBackground( wxEraseEvent& event ) { }
void OnActivate( wxActivateEvent& event );
......@@ -141,7 +140,7 @@ public:
* update the boundary box. If wxDC coordinate manipulation is used, then
* the scale factor and drawing logical offset is set. Then the base
* method is called to set the DC device origin and user scale. This
* connects everything together to acheive the appropiate coordinate
* connects everything together to achieve the appropriate coordinate
* manipulation using wxDC LogicalToDeviceXXX and DeviceToLogixalXXX
* methods. This gets called automatically for a paint event. If you do
* any drawing outside the paint event, you must call DoPrepareDC manually.
......@@ -150,6 +149,18 @@ public:
*/
virtual void DoPrepareDC(wxDC& dc);
/**
* Function DeviceToLogical
* converts \a aRect from device to drawing (logical) coordinates.
* <p>
* \a aRect must be in scrolled device units.
* <\p>
* @param aRect The rectangle to convert.
* @param aDC The device context used for the conversion.
* @return A rectangle converted to drawing units.
*/
wxRect DeviceToLogical( const wxRect& aRect, wxDC& aDC );
/* Mouse and keys events */
void OnMouseWheel( wxMouseEvent& event );
void OnMouseEvent( wxMouseEvent& event );
......@@ -171,7 +182,22 @@ public:
void Process_Special_Functions( wxCommandEvent& event );
bool IsPointOnDisplay( wxPoint ref_pos );
void SetBoundaryBox( wxDC* dc );
/**
* Function SetClipBox
* sets the clip box in drawing (logical) units from \a aRect in device units.
* <p>
* If \a aRect is NULL, then the entire visible area of the screen is used as the clip
* area. The clip box is used when drawing to determine which objects are not visible
* and do not need to be drawn.
* </p>
* @param aDc The device context use for drawing with the correct scale and
* offsets already configured. See DoPrepareDC().
* @param aRect The clip rectangle in device units or NULL for the entire visible area
* of the screen.
*/
void SetClipBox( wxDC& dc, const wxRect* aRect = NULL );
void ReDraw( wxDC* DC, bool erasebg = TRUE );
/**
......@@ -183,40 +209,18 @@ public:
/**
* Function CursorScreenPosition
* @return the curseur current position in pixels in the screen draw area
* @return the cursor current position in pixels in the screen draw area
*/
wxPoint CursorScreenPosition();
/**
* Function PostDirtyRect
* appends the given rectangle in pcb units to the DrawPanel's invalid
* region list so that very soon (but not immediately), this rectangle
* along with any other recently posted rectangles is redrawn. Conversion
* to pixels is done in here.
* @param aRect The rectangle to append, it must be orthogonal
* (vertical and horizontal edges only), and it must be [,) in nature,
* i.e. [pos, dim) == [inclusive, exclusive)
*/
void PostDirtyRect( EDA_Rect aRect );
/**
* Function ConvertPcbUnitsToPixelsUnits
* converts pos and size of the given EDA_Rect to pos and size in pixels,
* relative to the current draw area (origin 0,0 is the left top visible
* corner of draw area) according to the current scroll and zoom.
* @param aRect = the rectangle to convert
*/
void ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect );
/**
* Function ConvertPcbUnitsToPixelsUnits
* converts a given wxPoint position (in internal units) to units of
* pixels, relative to the current draw area (origin 0,0 is the left
* top visible
* corner of draw area) according to the current scroll and zoom.
* @param aPosition = the position to convert
* Function RefreshDrawingRect
* redraws the contents of \a aRect in drawing units. \a aRect is converted to
* screen coordinates and wxWindow::RefreshRect() is called to repaint the region.
* @param aRect The rectangle to repaint.
* @param aEraseBackground Erases the background if true.
*/
void ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition );
void RefreshDrawingRect( const EDA_Rect& aRect, bool aEraseBackground = true );
wxPoint GetScreenCenterRealPosition( void );
void MouseToCursorSchema();
......
......@@ -45,9 +45,6 @@ typedef enum {
} GRLineStypeType;
int GRMapX( int x );
int GRMapY( int y );
class EDA_DRAW_PANEL;
void GRSetDrawMode( wxDC* DC, int mode );
......@@ -68,8 +65,6 @@ void GRForceBlackPen( bool flagforce );
*/
bool GetGRForceBlackPenState( void );
void GRSPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int color );
void GRLine( EDA_Rect* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, int aColor );
void GRLine( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color );
void GRMixedLine( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
......
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2009 jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2007 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
*/
/**
* a helper to handle the real device context used in kicad
* @file kicad_device_context.h
......@@ -6,43 +32,89 @@
#ifndef __KICAD_DEVICE_CONTEXT_H__
#define __KICAD_DEVICE_CONTEXT_H__
// Comment this line to use the standard wxClientDC
// and uncomment to use buffered DC
// #define KICAD_USE_BUFFERED_DC // Currently under test
#include <wx/dcbuffer.h>
// Comment this line to use the standard wxPaintDC
// and uncomment to use buffered PaintDC
#define KICAD_USE_BUFFERED_PAINTDC // Currently under test
#if defined(KICAD_USE_BUFFERED_PAINTDC)
#undef KICAD_USE_BUFFERED_PAINTDC
#endif
#if defined KICAD_USE_BUFFERED_DC || defined KICAD_USE_BUFFERED_PAINTDC
#ifndef KICAD_USE_BUFFERED_PAINTDC
#define KICAD_USE_BUFFERED_PAINTDC
#endif
#include <wx/dcbuffer.h>
#if defined(KICAD_USE_BUFFERED_DC)
#undef KICAD_USE_BUFFERED_DC
#endif
// wxWidgets defines the platforms where device context buffering is well behaved. These
// definitions take advantage of their experience in this area. See <wx/dcbuffer.h> for
// more information.
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
#define KICAD_USE_BUFFERED_PAINTDC 1
#define KICAD_USE_BUFFERED_DC_HELPER 0
#define KICAD_USE_BUFFERED_DC 0
#else
#define KICAD_USE_BUFFERED_PAINTDC 1
#define KICAD_USE_BUFFERED_DC_HELPER 1
#define KICAD_USE_BUFFERED_DC 1
#endif
#if USE_WX_GRAPHICS_CONTEXT && USE_WX_ZOOM
/**
* Class BUFFERED_DC_HELPER
* fixes a bug on Windows when using buffered device context.
*
* <p>
* When using buffered device context drawing in Windows, the user scaling must be set to 1
* and the logical offset must be set to zero before the bitmap blit operation occurs in
* the destructor of wxBufferdDC but after the normal drawing takes place.
* </p>
*/
class BUFFERED_DC_HELPER
{
public:
BUFFERED_DC_HELPER( wxBufferedDC* aDC )
: m_dc( aDC ) {}
virtual ~BUFFERED_DC_HELPER()
{
if( m_dc )
{
m_dc->SetLogicalOrigin( 0, 0 );
m_dc->SetUserScale( 1.0, 1.0 );
}
}
private:
wxBufferedDC* m_dc;
};
#if USE_WX_GRAPHICS_CONTEXT
#include <wx/dcgraph.h>
#endif
// Macro used to declare a device context in kicad:
#if USE_WX_GRAPHICS_CONTEXT && USE_WX_ZOOM
#if USE_WX_GRAPHICS_CONTEXT
//#pragma message( "INSTALL_DC is wxClientDC with wxGCDC" )
#define INSTALL_DC(name,parent) \
#define INSTALL_DC( name, parent ) \
wxClientDC _cDC( parent ); \
wxGCDC name(_cDC); \
wxGCDC name( _cDC ); \
parent->DoPrepareDC( name ); \
name.GetGraphicsContext()->Translate( 0.5, 0.5 );
#else
#ifdef KICAD_USE_BUFFERED_DC
#if KICAD_USE_BUFFERED_DC && !KICAD_USE_BUFFERED_DC_HELPER
//#pragma message( "INSTALL_DC is wxClientDC with wxBufferedDC" )
#define INSTALL_DC(name,parent) \
#define INSTALL_DC( name, parent ) \
wxClientDC _cDC( parent ); \
wxBufferedDC name(&_cDC, _cDC.GetSize() ); \
parent->DoPrepareDC( name );
#elif KICAD_USE_BUFFERED_DC && KICAD_USE_BUFFERED_DC_HELPER
//#pragma message( "INSTALL_DC is wxBufferedDC with BUFFERED_DC_HELPER" )
#define INSTALL_DC( name, parent ) \
wxClientDC _cDC( parent ); \
wxBufferedDC name(&_cDC, _cDC.GetSize() ); \
parent->DoPrepareDC( name ); \
BUFFERED_DC_HELPER helper( &name );
#else
//#pragma message( "INSTALL_DC is wxClientDC" )
#define INSTALL_DC(name,parent) \
#define INSTALL_DC( name, parent ) \
wxClientDC name( parent ); \
parent->DoPrepareDC( name );
#endif
......@@ -50,16 +122,22 @@
#if USE_WX_GRAPHICS_CONTEXT
//#pragma message( "INSTALL_PAINTDC is wxPaintDC with wxGCDC" )
#define INSTALL_PAINTDC(name,parent) \
wxPaintDC _pDC(parent); \
wxGCDC name(_pDC); \
#define INSTALL_PAINTDC( name, parent) \
wxPaintDC _pDC( parent ); \
wxGCDC name( _pDC ); \
parent->DoPrepareDC( name ); \
name.GetGraphicsContext()->Translate( 0.5, 0.5 );
#elif !defined( USE_WX_ZOOM ) && defined( KICAD_USE_BUFFERED_PAINTDC )
#elif KICAD_USE_BUFFERED_PAINTDC && !KICAD_USE_BUFFERED_DC_HELPER
//#pragma message( "INSTALL_PAINTDC is wxAutoBufferedPaintDC" )
#define INSTALL_PAINTDC(name,parent) \
wxAutoBufferedPaintDC name(parent ); \
#define INSTALL_PAINTDC( name, parent ) \
wxAutoBufferedPaintDC name( parent ); \
parent->DoPrepareDC( name );
#elif KICAD_USE_BUFFERED_PAINTDC && KICAD_USE_BUFFERED_DC_HELPER
//#pragma message( "INSTALL_PAINTDC is wxBufferedPaintDC with BUFFERED_DC_HELPER" )
#define INSTALL_PAINTDC( name, parent ) \
wxBufferedPaintDC name( parent ); \
parent->DoPrepareDC( name ); \
BUFFERED_DC_HELPER help( &name );
#else
//#pragma message( "INSTALL_PAINTDC is wxPaintDC" )
#define INSTALL_PAINTDC(name,parent) \
......@@ -67,4 +145,11 @@
parent->DoPrepareDC( name );
#endif
// This macro should be used when drawing objects directly without drawing the background.
#define INSTALL_UNBUFFERED_DC( name, parent ) \
wxClientDC name( parent ); \
parent->DoPrepareDC( name );
#endif // __KICAD_DEVICE_CONTEXT_H__
......@@ -372,7 +372,17 @@ public:
void SetToolbarBgColor( int color_num );
virtual void OnZoom( wxCommandEvent& event );
void OnGrid( int grid_type );
void Recadre_Trace( bool ToMouse );
/**
* Function RedrawScreen
* redraws the entire screen area by updating the scroll bars and mouse pointer in
* order to have the current graphic cursor position at the center of the screen.
* @param aWarpPointer Moves the mouse cursor is to the drawing position ( which
* is usually on grid) if true.
*
* Note: Mac OS ** does not ** allow moving mouse cursor by program.
*/
void RedrawScreen( bool aWarpPointer );
/** Adjust the coordinate to the nearest grid value
* @param aCoord = coordinate to adjust
......
......@@ -43,7 +43,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
if( m_HToolBar == NULL )
return;
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
switch( id )
{
......
......@@ -237,9 +237,9 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC )
{
for( i = 0; i < maxi; i++ )
for( j = 0; j < maxi; j++ )
GRSPutPixel( &panel->m_ClipBox, DC,
( col * maxi ) + i + DRAW_OFFSET_X,
( row * maxi ) + j + DRAW_OFFSET_Y, color );
GRPutPixel( &panel->m_ClipBox, DC,
( col * maxi ) + i + DRAW_OFFSET_X,
( row * maxi ) + j + DRAW_OFFSET_Y, color );
}
}
......
......@@ -135,7 +135,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
if( !DrawPanel->IsPointOnDisplay( aPos ) )
{
screen->m_Curseur = aPos;
Recadre_Trace( true );
RedrawScreen( true );
}
else
{
......
......@@ -550,11 +550,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( width ) < 2 )
#else
if( panel->GetScreen()->Scale( width ) < 2 )
#endif
typeaff = FILAIRE;
switch( typeaff )
......
......@@ -258,11 +258,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
if( m_Flags & FORCE_SKETCH )
mode = SKETCH;
#ifdef USE_WX_ZOOM
if( l_piste < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
#else
if( l_piste < panel->GetScreen()->Unscale( L_MIN_DESSIN ) )
#endif
mode = FILAIRE;
switch( m_Shape )
......
......@@ -190,11 +190,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
typeaff = SKETCH;
}
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( m_Width ) < L_MIN_DESSIN )
#else
if( screen->Scale( m_Width ) < L_MIN_DESSIN )
#endif
typeaff = FILAIRE;
switch( type_trace )
......
......@@ -118,11 +118,7 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( width ) < 2 )
#else
if( panel->GetScreen()->Scale( width ) < 2 )
#endif
typeaff = FILAIRE;
rayon = m_Size / 4;
......
......@@ -67,11 +67,7 @@ MODULE::~MODULE()
void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
int dim_ancre, int draw_mode )
{
#ifdef USE_WX_ZOOM
int anchor_size = DC->DeviceToLogicalXRel( dim_ancre );
#else
int anchor_size = panel->GetScreen()->Unscale( dim_ancre );
#endif
GRSetDrawMode( DC, draw_mode );
......
......@@ -42,9 +42,7 @@ public:
bool m_ShowNCMark; // true to show pad not connected mark
bool m_IsPrinting; // true to print, false to display on screen.
wxPoint m_Offset; // general draw offset
#ifndef USE_WX_ZOOM
double m_Scale; // Draw scaling factor
#endif
PAD_DRAWINFO( );
};
......
......@@ -37,9 +37,6 @@ PAD_DRAWINFO::PAD_DRAWINFO()
m_Display_netname = true;
m_ShowPadFilled = true;
m_ShowNCMark = true;
#ifndef USE_WX_ZOOM
m_Scale = 1.0;
#endif
m_IsPrinting = false;
}
......@@ -319,9 +316,6 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
drawInfo.m_Mask_margin = mask_margin;
drawInfo.m_ShowNCMark = brd->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) );
drawInfo.m_IsPrinting = screen->m_IsPrinting;
#ifndef USE_WX_ZOOM
drawInfo.m_Scale = (double) screen->Scale( 1000 ) / 1000;
#endif
SetAlpha( &color, 170 );
/* Get the pad clearance. This has a meaning only for Pcbnew.
......@@ -467,11 +461,7 @@ void D_PAD::DrawShape( EDA_Rect* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
{
case PAD_CIRCLE:
#ifdef USE_WX_ZOOM
if( aDC->LogicalToDeviceXRel( hole ) > 1 )
#else
if( aDrawInfo.m_Scale * hole > 1 ) /* draw hole if its size is enough */
#endif
GRFilledCircle( aClipBox, aDC, holepos.x, holepos.y, hole, 0,
aDrawInfo.m_Color, aDrawInfo.m_HoleColor );
break;
......@@ -579,11 +569,7 @@ void D_PAD::DrawShape( EDA_Rect* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
tsize = min( AreaSize.y, AreaSize.x / numpad_len );
#define CHAR_SIZE_MIN 5
#ifdef USE_WX_ZOOM
if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable when size too small.
#else
if( aDrawInfo.m_Scale * tsize >= CHAR_SIZE_MIN ) // Not drawable when size too small.
#endif
if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable when size too small.
{
// tsize reserve room for marges and segments thickness
tsize = (int) ( tsize * 0.8 );
......@@ -600,11 +586,7 @@ void D_PAD::DrawShape( EDA_Rect* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
shortname_len = MAX( shortname_len, MIN_CHAR_COUNT );
tsize = min( AreaSize.y, AreaSize.x / shortname_len );
#ifdef USE_WX_ZOOM
if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small.
#else
if( aDrawInfo.m_Scale * tsize >= CHAR_SIZE_MIN ) // Not drawable in size too small.
#endif
if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small.
{
tpos = tpos0;
if( aDrawInfo.m_Display_padnum )
......
......@@ -354,12 +354,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w
width = m_Thickness;
if( ( frame->m_DisplayModText == FILAIRE )
#ifdef USE_WX_ZOOM
|| ( DC->LogicalToDeviceXRel( width ) < L_MIN_DESSIN ) )
#else
|| ( screen->Scale( width ) < L_MIN_DESSIN ) )
#endif
|| ( DC->LogicalToDeviceXRel( width ) < L_MIN_DESSIN ) )
width = 0;
else if( frame->m_DisplayModText == SKETCH )
width = -width;
......@@ -371,11 +366,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w
{
color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
#ifdef USE_WX_ZOOM
int anchor_size = DC->DeviceToLogicalXRel( 2 );
#else
int anchor_size = screen->Unscale( 2 );
#endif
GRLine( &panel->m_ClipBox, DC,
pos.x - anchor_size, pos.y,
pos.x + anchor_size, pos.y, 0, color );
......
......@@ -597,11 +597,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
rayon = (int) hypot( (double) ( m_End.x - m_Start.x ),
(double) ( m_End.y - m_Start.y ) );
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
#endif
{
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
m_Start.y + aOffset.y, rayon, color );
......@@ -609,11 +605,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
else
{
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */
#else
if( panel->GetScreen()->Scale( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */
#endif
{
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
m_Start.y + aOffset.y, rayon, color );
......@@ -635,11 +627,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
return;
}
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
#endif
{
GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
m_Start.y + aOffset.y,
......@@ -695,11 +683,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
if( len < THRESHOLD * m_Width )
return;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( m_Width ) < 6 ) // no room to display a text inside track
#else
if( panel->GetScreen()->Scale( m_Width ) < 6 ) // no room to display a text inside track
#endif
return;
if( GetNet() == 0 )
......@@ -722,11 +706,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
if( (m_End.x - m_Start.x) == 0 ) // Vertical segment
angle = 900; // angle is in 0.1 degree
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( tsize ) >= 6 )
#else
if( panel->GetScreen()->Scale( tsize ) >= 6 )
#endif
{
if( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay) )
{
......@@ -791,22 +771,14 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
rayon = m_Width >> 1;
// for small via size on screen (rayon < 4 pixels) draw a simplified shape
#ifdef USE_WX_ZOOM
int radius_in_pixels = DC->LogicalToDeviceXRel( rayon );
#else
int radius_in_pixels = panel->GetScreen()->Scale( rayon );
#endif
bool fast_draw = false;
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
int drill_rayon = GetDrillValue() / 2;
#ifdef USE_WX_ZOOM
int inner_rayon = rayon - DC->DeviceToLogicalXRel( 2 );
#else
int inner_rayon = rayon - panel->GetScreen()->Unscale( 2 );
#endif
if( radius_in_pixels < 3 )
{
......@@ -852,11 +824,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
else
GRSetDrawMode( DC, GR_XOR );
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( drill_rayon ) > 1 ) /* draw hole if its size is enought */
#else
if( screen->Scale( drill_rayon ) > 1 ) /* draw hole if its size is enought */
#endif
if( DC->LogicalToDeviceXRel( drill_rayon ) > 1 ) // Draw hole if large enough.
GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
m_Start.y + aOffset.y, drill_rayon, 0, color, color );
......@@ -960,11 +928,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
// calculate a good size for the text
int tsize = m_Width / len;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( tsize ) >= 6 )
#else
if( panel->GetScreen()->Scale( tsize ) >= 6 )
#endif
{
tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via
DrawGraphicText( panel, DC, m_Start,
......
......@@ -344,7 +344,8 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
if( !Drc_On || !g_CurrentTrackSegment
|| g_CurrentTrackSegment != this->GetCurItem()
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment ))
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) )
{
GetScreen()->m_Curseur = on_grid;
}
......
......@@ -121,7 +121,7 @@ void RemoteCommand( const char* cmdline )
}
if( module ) // if found, center the module on screen, and redraw the screen.
frame->Recadre_Trace( false );
frame->RedrawScreen( false );
}
......
......@@ -113,7 +113,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
container->Remove( aTrack );
// redraw the area where the track was
DrawPanel->PostDirtyRect( aTrack->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( aTrack->GetBoundingBox() );
SaveCopyInUndoList( aTrack, UR_DELETED );
OnModify();
......@@ -163,7 +163,7 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack )
GetBoard()->m_Track.Remove( segm );
// redraw the area where the track was
DrawPanel->PostDirtyRect( segm->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( segm->GetBoundingBox() );
picker.m_PickedItem = segm;
picker.m_PickedItemType = segm->Type();
itemsList.PushItem( picker );
......@@ -214,7 +214,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
GetBoard()->m_Track.Remove( tracksegment );
// redraw the area where the track was
DrawPanel->PostDirtyRect( tracksegment->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( tracksegment->GetBoundingBox() );
picker.m_PickedItem = tracksegment;
picker.m_PickedItemType = tracksegment->Type();
itemsList.PushItem( picker );
......
......@@ -259,9 +259,9 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
int bg_color = g_DrawBgColor;
g_DrawBgColor = WHITE;
if( aPrint_Frame_Ref )
m_Parent->TraceWorkSheet( &dc, ActiveScreen, s_Parameters.m_PenDefaultSize );
m_Parent->TraceWorkSheet( &dc, screen, s_Parameters.m_PenDefaultSize );
m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters);
g_DrawBgColor = bg_color;
......
......@@ -133,26 +133,8 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
scale *= 0.7;
dc.SetUserScale( scale, scale );
#ifndef USE_WX_ZOOM
drawInfo.m_Scale = scale;
wxPoint org = ActiveScreen->m_DrawOrg;
wxPoint strt = ActiveScreen->m_StartVisu;
int pzoom = ActiveScreen->GetZoom();
ActiveScreen->m_DrawOrg = wxPoint( 0, 0 );
ActiveScreen->m_StartVisu = wxPoint( 0, 0 );
// Actual scaling factor is 10/Zoom
// We need a scale 1 , and therefore zoom = 10
ActiveScreen->SetZoom( 10 );
#endif
m_dummyPad->DrawShape( NULL, &dc, drawInfo );
#ifndef USE_WX_ZOOM
ActiveScreen->m_DrawOrg = org;
ActiveScreen->m_StartVisu = strt;
ActiveScreen->SetZoom( pzoom );
#endif
event.Skip();
}
......@@ -582,7 +564,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
// redraw the area where the pad was, without pad (delete pad on screen)
m_CurrentPad->m_Flags |= DO_NOT_DRAW;
m_Parent->DrawPanel->PostDirtyRect( m_CurrentPad->GetBoundingBox() );
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() );
m_CurrentPad->m_Flags &= ~DO_NOT_DRAW;
// Update values
......@@ -651,7 +633,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
m_CurrentPad->DisplayInfo( m_Parent );
// redraw the area where the pad was
m_Parent->DrawPanel->PostDirtyRect( m_CurrentPad->GetBoundingBox() );
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() );
m_Parent->OnModify();
}
......
......@@ -35,7 +35,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
wxPoint pos;
int itmp;
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
BOARD_ITEM* DrawStruct = GetCurItem();
MODULE* module;
......
......@@ -548,13 +548,10 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
}
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack )
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoint& aRef )
{
int net = aTrack->GetNet();
int width = aTrack->m_Width;
int layer = ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer;
wxPoint ref = ActiveScreen->RefPos( true );
TRACK* found = NULL;
......@@ -565,17 +562,16 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack )
if( track->GetState( BUSY | DELETED ) )
continue;
if( layer != track->GetLayer() )
if( aLayer != track->GetLayer() )
continue;
if( track->GetNet() == net )
continue;
/* TRACK::HitTest */
int dist = (width + track->m_Width) / 2 + aTrack->GetClearance(
track );
int dist = (width + track->m_Width) / 2 + aTrack->GetClearance( track );
wxPoint pos = ref - track->m_Start;
wxPoint pos = aRef - track->m_Start;
wxPoint vec = track->m_End - track->m_Start;
if( !DistanceTest( dist, vec.x, vec.y, pos.x, pos.y ) )
......@@ -585,8 +581,8 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack )
/* prefer intrusions from the side, not the end */
double tmp = (double) pos.x * vec.x + (double) pos.y * vec.y;
if( tmp >= 0 && tmp <= (double) vec.x * vec.x + (double) vec.y *
vec.y )
if( tmp >= 0 && tmp <= (double) vec.x * vec.x + (double) vec.y * vec.y )
break;
}
}
......@@ -613,8 +609,9 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack )
*/
static void PushTrack( EDA_DRAW_PANEL* panel )
{
PCB_SCREEN* screen = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetScreen();
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard();
wxPoint cursor = ActiveScreen->m_Curseur;
wxPoint cursor = screen->m_Curseur;
wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment;
TRACK* other;
......@@ -622,7 +619,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
int dist;
double f;
other = LocateIntrusion( pcb->m_Track, track );
other = LocateIntrusion( pcb->m_Track, track, screen->m_Active_Layer, screen->RefPos( true ) );
/* are we currently pointing into a conflicting trace ? */
if( !other )
......@@ -740,7 +737,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
{
if( g_TwoSegmentTrackBuild )
{
g_CurrentTrackSegment->m_End = ActiveScreen->m_Curseur;
g_CurrentTrackSegment->m_End = screen->m_Curseur;
if( Drc_On )
PushTrack( panel );
......
......@@ -110,7 +110,7 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
if( Text->m_Type == TEXT_is_DIVERS )
{
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
Text->DeleteStructure();
OnModify();
Module->m_LastEdit_Time = time( NULL );
......@@ -146,7 +146,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
Text->m_Orient = TextInitialOrientation;
/* Redraw the text */
Panel->PostDirtyRect( Text->GetBoundingBox() );
Panel->RefreshDrawingRect( Text->GetBoundingBox() );
// leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0;
......@@ -200,7 +200,7 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
{
if( Text != NULL )
{
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
Text->DrawUmbilical( DrawPanel, DC, GR_XOR, -MoveVector );
/* Update the coordinates for anchor. */
......@@ -226,7 +226,7 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
OnModify();
/* Redraw text. */
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
}
else
Text->m_Pos = GetScreen()->m_Curseur;
......
......@@ -199,7 +199,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if( aDraw )
{
Module->m_Flags |= DO_NOT_DRAW;
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
Module->m_Flags &= ~DO_NOT_DRAW;
}
......@@ -273,7 +273,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
Module->Set_Rectangle_Encadrement();
if( aDraw )
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
}
OnModify();
......
......@@ -164,7 +164,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
wxPoint pos;
bool redraw = false;
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
wxGetMousePosition( &pos.x, &pos.y );
......
......@@ -138,7 +138,7 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
Place_Ancre( module ); // set the new relatives internal
// coordinates of items
GetScreen()->m_Curseur = wxPoint( 0, 0 );
Recadre_Trace( TRUE );
RedrawScreen( TRUE );
// Replace the module in position 0, to recalculate absolutes
// coordinates of items
......
......@@ -104,7 +104,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
{
int tmp = module->m_Flags;
module->m_Flags |= DO_NOT_DRAW;
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( module->GetBoundingBox() );
module->m_Flags = tmp;
}
......@@ -328,7 +328,7 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
{
int tmp = Module->m_Flags;
Module->m_Flags |= DO_NOT_DRAW;
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
Module->m_Flags = tmp;
}
......@@ -482,7 +482,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
{
int tmp = module->m_Flags;
module->m_Flags |= DO_NOT_DRAW;
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( module->GetBoundingBox() );
module->m_Flags = tmp;
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
......
......@@ -128,7 +128,7 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if( aDraw )
{
aPad->m_Flags |= DO_NOT_DRAW;
DrawPanel->PostDirtyRect( aPad->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() );
aPad->m_Flags &= ~DO_NOT_DRAW;
}
......@@ -166,7 +166,7 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
aPad->ComputeShapeMaxRadius();
if( aDraw )
DrawPanel->PostDirtyRect( aPad->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() );
( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL );
}
......@@ -220,7 +220,7 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
Module->Set_Rectangle_Encadrement();
Pad->DisplayInfo( this );
if( draw )
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
}
......@@ -254,7 +254,7 @@ void WinEDA_BasePcbFrame::DeletePad( D_PAD* aPad, bool aQuery )
m_Pcb->m_Status_Pcb = 0;
aPad->DeleteStructure();
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
Module->Set_Rectangle_Encadrement();
OnModify();
......
......@@ -21,7 +21,7 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
wxGetMousePosition( &pos.x, &pos.y );
......
......@@ -261,11 +261,9 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
* the old draw area in the new draw area, because the draw origin has not moved
* (this is the upper left corner) but the Y axis is reversed, therefore the plotting area
* is the y coordinate values from - PlotAreaSize.y to 0 */
#ifdef USE_WX_ZOOM
int y_dc_offset = PlotAreaSizeInPixels.y;
y_dc_offset = (int) ( ( double ) y_dc_offset * userscale );
dc->SetDeviceOrigin( 0, y_dc_offset );
#endif
int ysize = (int) ( PlotAreaSizeInPixels.y / scaley );
DrawOffset.y += ysize;
......@@ -277,13 +275,11 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
* to the middle of the page.
*/
wxPoint pcb_centre = brd_BBox.Centre();
if( userscale <= 1.0 )
DrawOffset.y += pcb_centre.y - (ysize / 2);
#ifdef USE_WX_ZOOM
dc->SetLogicalOrigin( ActiveScreen->m_DrawOrg.x, ActiveScreen->m_DrawOrg.y );
#else
ActiveScreen->m_DrawOrg = DrawOffset;
#endif
dc->SetLogicalOrigin( ActiveScreen->m_DrawOrg.x, ActiveScreen->m_DrawOrg.y );
panel->m_ClipBox.SetOrigin( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ) );
}
......
......@@ -211,7 +211,7 @@ void Montre_Position_Empreinte( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
/* EDITRACK.C : */
/****************/
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack );
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoint& aRef );
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
......
......@@ -78,7 +78,7 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
if( found )
{
INSTALL_DC( dc, DrawPanel );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
if( g_HighLight_Status )
High_Light( &dc );
......
......@@ -329,7 +329,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_contain
if( zone_container->m_Poly->GetNumCorners() <= 3 )
{
DrawPanel->PostDirtyRect( zone_container->GetBoundingBox() );
DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() );
if( DC )
{ // Remove the full zone because this is no more an area
Delete_Zone_Fill( NULL, zone_container->m_TimeStamp );
......@@ -864,7 +864,7 @@ void WinEDA_PcbFrame::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contai
zone_container->m_Poly->RemoveContour( ncont );
}
DrawPanel->PostDirtyRect( dirty );
DrawPanel->RefreshDrawingRect( dirty );
OnModify();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment