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.
This commit is contained in:
parent
654b89095d
commit
d657b43052
|
@ -22,8 +22,6 @@ option(KICAD_GOST "enable/disable building using GOST notation for multiple gate
|
||||||
#for those who bored with uppercase
|
#for those who bored with uppercase
|
||||||
option(KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected")
|
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
|
option(USE_WX_GRAPHICS_CONTEXT
|
||||||
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental")
|
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental")
|
||||||
|
|
||||||
|
@ -61,18 +59,12 @@ if(KICAD_KEEPCASE)
|
||||||
add_definitions(-DKICAD_KEEPCASE)
|
add_definitions(-DKICAD_KEEPCASE)
|
||||||
endif(KICAD_KEEPCASE)
|
endif(KICAD_KEEPCASE)
|
||||||
|
|
||||||
if(USE_WX_ZOOM)
|
|
||||||
add_definitions(-DUSE_WX_ZOOM)
|
|
||||||
endif(USE_WX_ZOOM)
|
|
||||||
|
|
||||||
if(USE_WX_OVERLAY OR APPLE)
|
if(USE_WX_OVERLAY OR APPLE)
|
||||||
add_definitions(-DUSE_WX_OVERLAY)
|
add_definitions(-DUSE_WX_OVERLAY)
|
||||||
endif(USE_WX_OVERLAY OR APPLE)
|
endif(USE_WX_OVERLAY OR APPLE)
|
||||||
|
|
||||||
|
|
||||||
if(USE_WX_GRAPHICS_CONTEXT)
|
if(USE_WX_GRAPHICS_CONTEXT)
|
||||||
set( USE_WX_ZOOM ON )
|
|
||||||
add_definitions(-DUSE_WX_ZOOM)
|
|
||||||
add_definitions(-DUSE_WX_GRAPHICS_CONTEXT)
|
add_definitions(-DUSE_WX_GRAPHICS_CONTEXT)
|
||||||
endif(USE_WX_GRAPHICS_CONTEXT)
|
endif(USE_WX_GRAPHICS_CONTEXT)
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,6 @@
|
||||||
#define strnicmp _strnicmp
|
#define strnicmp _strnicmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Warning!!! Using wxDC for zooming is experimental. */
|
|
||||||
#cmakedefine USE_WX_ZOOM 1
|
|
||||||
|
|
||||||
/* Warning!!! Using wxGraphicContext for rendering is experimental. */
|
/* Warning!!! Using wxGraphicContext for rendering is experimental. */
|
||||||
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
|
#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
|
* Function SetScalingFactor
|
||||||
* calculates the .m_Zoom member to have a given scaling factor
|
* 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:
|
// Limit zoom to max and min allowed values:
|
||||||
if (zoom < m_ZoomList[0])
|
if (zoom < m_ZoomList[0])
|
||||||
zoom = m_ZoomList[0];
|
zoom = m_ZoomList[0];
|
||||||
|
|
||||||
int idxmax = m_ZoomList.GetCount() - 1;
|
int idxmax = m_ZoomList.GetCount() - 1;
|
||||||
|
|
||||||
if (zoom > m_ZoomList[idxmax])
|
if (zoom > m_ZoomList[idxmax])
|
||||||
zoom = m_ZoomList[idxmax];
|
zoom = m_ZoomList[idxmax];
|
||||||
|
|
||||||
SetZoom( zoom );
|
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 )
|
void BASE_SCREEN::SetZoomList( const wxArrayInt& zoomlist )
|
||||||
{
|
{
|
||||||
if( !m_ZoomList.IsEmpty() )
|
if( !m_ZoomList.IsEmpty() )
|
||||||
|
|
|
@ -399,11 +399,7 @@ void EDA_TextStruct::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
if( aAnchor_color != UNSPECIFIED_COLOR )
|
if( aAnchor_color != UNSPECIFIED_COLOR )
|
||||||
{
|
{
|
||||||
|
|
||||||
#if USE_WX_ZOOM
|
|
||||||
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
|
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
|
||||||
#else
|
|
||||||
int anchor_size = aPanel->GetScreen()->Unscale( 2 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
aAnchor_color = (EDA_Colors) ( aAnchor_color & MASKCOLOR );
|
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,
|
void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
|
||||||
const wxPoint& aOffset,
|
int aDrawMode, int aColor )
|
||||||
int aDrawMode,
|
|
||||||
int aColor )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int w = aPanel->GetScreen()->Scale( GetWidth() );
|
int w = GetWidth();
|
||||||
int h = aPanel->GetScreen()->Scale( GetHeight() );
|
int h = GetHeight();
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
if( w == 0 || h == 0 )
|
if( w == 0 || h == 0 )
|
||||||
GRLine( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
|
GRLine( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
|
||||||
GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
|
GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
|
||||||
|
|
|
@ -289,7 +289,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
||||||
GetBaseScreen()->SetZoom( selectedZoom );
|
GetBaseScreen()->SetZoom( selectedZoom );
|
||||||
Recadre_Trace( false );
|
RedrawScreen( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "class_base_screen.h"
|
#include "class_base_screen.h"
|
||||||
#include "wxstruct.h"
|
#include "wxstruct.h"
|
||||||
|
|
||||||
#include <wx/wupdlock.h>
|
|
||||||
#include "kicad_device_context.h"
|
#include "kicad_device_context.h"
|
||||||
|
|
||||||
#define CURSOR_SIZE 12 // Cursor size in pixels
|
#define CURSOR_SIZE 12 // Cursor size in pixels
|
||||||
|
@ -21,12 +20,13 @@
|
||||||
|
|
||||||
|
|
||||||
/* Definitions for enabling and disabling debugging features in drawpanel.cpp.
|
/* Definitions for enabling and disabling debugging features in drawpanel.cpp.
|
||||||
* Please don't forget to turn these off before making any SvN commits.
|
* Please don't forget to turn these off before making any commits to Launchpad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEBUG_SHOW_CLIP_RECT 0 // Set to 1 to draw clipping rectangle.
|
#define DEBUG_SHOW_CLIP_RECT 0 // Set to 1 to draw clipping rectangle.
|
||||||
#define DEBUG_DUMP_CLIP_COORDS 0 // Set to 1 to dump clipping rectangle coordinates.
|
#define DEBUG_DUMP_CLIP_COORDS 0 // Set to 1 to dump clipping rectangle coordinates.
|
||||||
#define DEBUG_DUMP_SCROLL_SETTINGS 0 // Set to 1 to dump scroll settings.
|
#define DEBUG_DUMP_SCROLL_SETTINGS 0 // Set to 1 to dump scroll settings.
|
||||||
|
#define KICAD_TRACE_COORDS wxT( "kicad_dump_coords" )
|
||||||
|
|
||||||
|
|
||||||
/* Used to inhibit a response to a mouse left button release, after a
|
/* Used to inhibit a response to a mouse left button release, after a
|
||||||
|
@ -45,12 +45,13 @@ BEGIN_EVENT_TABLE( EDA_DRAW_PANEL, wxScrolledWindow )
|
||||||
EVT_CHAR( EDA_DRAW_PANEL::OnKeyEvent )
|
EVT_CHAR( EDA_DRAW_PANEL::OnKeyEvent )
|
||||||
EVT_CHAR_HOOK( EDA_DRAW_PANEL::OnKeyEvent )
|
EVT_CHAR_HOOK( EDA_DRAW_PANEL::OnKeyEvent )
|
||||||
EVT_PAINT( EDA_DRAW_PANEL::OnPaint )
|
EVT_PAINT( EDA_DRAW_PANEL::OnPaint )
|
||||||
EVT_SIZE( EDA_DRAW_PANEL::OnSize )
|
EVT_ERASE_BACKGROUND( EDA_DRAW_PANEL::OnEraseBackground )
|
||||||
EVT_SCROLLWIN( EDA_DRAW_PANEL::OnScroll )
|
EVT_SCROLLWIN( EDA_DRAW_PANEL::OnScroll )
|
||||||
EVT_ACTIVATE( EDA_DRAW_PANEL::OnActivate )
|
EVT_ACTIVATE( EDA_DRAW_PANEL::OnActivate )
|
||||||
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, EDA_DRAW_PANEL::OnPan )
|
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, EDA_DRAW_PANEL::OnPan )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* EDA_DRAW_PANEL base functions (EDA_DRAW_PANEL is the main panel)*/
|
/* EDA_DRAW_PANEL base functions (EDA_DRAW_PANEL is the main panel)*/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@ -58,20 +59,22 @@ END_EVENT_TABLE()
|
||||||
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||||
const wxPoint& pos, const wxSize& size ) :
|
const wxPoint& pos, const wxSize& size ) :
|
||||||
wxScrolledWindow( parent, id, pos, size,
|
wxScrolledWindow( parent, id, pos, size,
|
||||||
wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE )
|
wxBORDER | wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE )
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
wxASSERT( m_Parent );
|
wxASSERT( m_Parent );
|
||||||
|
|
||||||
m_scrollIncrementX = MIN( size.x / 8, 10 );
|
m_scrollIncrementX = MIN( size.x / 8, 10 );
|
||||||
m_scrollIncrementY = MIN( size.y / 8, 10 );
|
m_scrollIncrementY = MIN( size.y / 8, 10 );
|
||||||
|
|
||||||
SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
|
SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
|
||||||
ColorRefs[g_DrawBgColor].m_Green,
|
ColorRefs[g_DrawBgColor].m_Green,
|
||||||
ColorRefs[g_DrawBgColor].m_Blue ) );
|
ColorRefs[g_DrawBgColor].m_Blue ) );
|
||||||
#if defined KICAD_USE_BUFFERED_DC || defined KICAD_USE_BUFFERED_PAINTDC
|
|
||||||
|
#if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC
|
||||||
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
|
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
|
||||||
#endif
|
#endif
|
||||||
EnableScrolling( TRUE, TRUE );
|
|
||||||
m_ClipBox.SetSize( size );
|
m_ClipBox.SetSize( size );
|
||||||
m_ClipBox.SetX( 0 );
|
m_ClipBox.SetX( 0 );
|
||||||
m_ClipBox.SetY( 0 );
|
m_ClipBox.SetY( 0 );
|
||||||
|
@ -85,14 +88,15 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||||
ForceCloseManageCurseur = NULL;
|
ForceCloseManageCurseur = NULL;
|
||||||
|
|
||||||
if( wxGetApp().m_EDA_Config )
|
if( wxGetApp().m_EDA_Config )
|
||||||
wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable,
|
wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true );
|
||||||
true );
|
|
||||||
|
|
||||||
m_AutoPAN_Request = false;
|
m_AutoPAN_Request = false;
|
||||||
m_Block_Enable = false;
|
m_Block_Enable = false;
|
||||||
m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW;
|
m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW;
|
||||||
m_CursorLevel = 0;
|
m_CursorLevel = 0;
|
||||||
m_PrintIsMirrored = false;
|
m_PrintIsMirrored = false;
|
||||||
|
|
||||||
|
wxLog::AddTraceMask( KICAD_TRACE_COORDS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,7 +123,7 @@ void EDA_DRAW_PANEL::DrawCursor( wxDC* aDC, int aColor )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
SetCursor(*wxCROSS_CURSOR);
|
SetCursor( *wxCROSS_CURSOR );
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -129,30 +133,17 @@ void EDA_DRAW_PANEL::DrawCursor( wxDC* aDC, int aColor )
|
||||||
|
|
||||||
if( m_Parent->m_CursorShape == 1 ) /* Draws a crosshair. */
|
if( m_Parent->m_CursorShape == 1 ) /* Draws a crosshair. */
|
||||||
{
|
{
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
wxSize clientSize = GetClientSize();
|
wxSize clientSize = GetClientSize();
|
||||||
wxPoint lineStart = wxPoint( Cursor.x, aDC->DeviceToLogicalY( 0 ) );
|
wxPoint lineStart = wxPoint( Cursor.x, aDC->DeviceToLogicalY( 0 ) );
|
||||||
wxPoint lineEnd = wxPoint( Cursor.x, aDC->DeviceToLogicalY( clientSize.y ) );
|
wxPoint lineEnd = wxPoint( Cursor.x, aDC->DeviceToLogicalY( clientSize.y ) );
|
||||||
GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor ); // Y azis
|
GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor ); // Y axis
|
||||||
lineStart = wxPoint( aDC->DeviceToLogicalX( 0 ), Cursor.y );
|
lineStart = wxPoint( aDC->DeviceToLogicalX( 0 ), Cursor.y );
|
||||||
lineEnd = wxPoint( aDC->DeviceToLogicalX( clientSize.x ), Cursor.y );
|
lineEnd = wxPoint( aDC->DeviceToLogicalX( clientSize.x ), Cursor.y );
|
||||||
GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor ); // X azis
|
GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor ); // X axis
|
||||||
#else
|
|
||||||
int dx = GetScreen()->Unscale( m_ClipBox.GetWidth() );
|
|
||||||
int dy = GetScreen()->Unscale( m_ClipBox.GetHeight() );
|
|
||||||
GRLine( &m_ClipBox, aDC, Cursor.x - dx, Cursor.y,
|
|
||||||
Cursor.x + dx, Cursor.y, 0, aColor ); // Y axis
|
|
||||||
GRLine( &m_ClipBox, aDC, Cursor.x, Cursor.y - dx,
|
|
||||||
Cursor.x, Cursor.y + dy, 0, aColor ); // X axis
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
int len = aDC->DeviceToLogicalXRel( CURSOR_SIZE );
|
int len = aDC->DeviceToLogicalXRel( CURSOR_SIZE );
|
||||||
#else
|
|
||||||
int len = GetScreen()->Unscale( CURSOR_SIZE );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRLine( &m_ClipBox, aDC, Cursor.x - len, Cursor.y,
|
GRLine( &m_ClipBox, aDC, Cursor.x - len, Cursor.y,
|
||||||
Cursor.x + len, Cursor.y, 0, aColor );
|
Cursor.x + len, Cursor.y, 0, aColor );
|
||||||
|
@ -232,93 +223,36 @@ bool EDA_DRAW_PANEL::IsPointOnDisplay( wxPoint ref_pos )
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
EDA_Rect display_rect;
|
EDA_Rect display_rect;
|
||||||
|
|
||||||
INSTALL_DC( dc, this ); // Refresh the boundary box.
|
INSTALL_UNBUFFERED_DC( dc, this ); // Refresh the boundary box.
|
||||||
|
SetClipBox( dc );
|
||||||
|
|
||||||
display_rect = m_ClipBox;
|
display_rect = m_ClipBox;
|
||||||
|
|
||||||
// Slightly decreased the size of the useful screen area to avoid drawing
|
// Slightly decreased the size of the useful screen area to avoid drawing limits.
|
||||||
// limits.
|
|
||||||
#define PIXEL_MARGIN 8
|
#define PIXEL_MARGIN 8
|
||||||
display_rect.Inflate( -PIXEL_MARGIN );
|
display_rect.Inflate( -PIXEL_MARGIN );
|
||||||
|
|
||||||
#ifndef USE_WX_ZOOM
|
|
||||||
// Convert physical coordinates.
|
|
||||||
pos = CalcUnscrolledPosition( display_rect.GetPosition() );
|
|
||||||
|
|
||||||
GetScreen()->Unscale( pos );
|
|
||||||
pos += GetScreen()->m_DrawOrg;
|
|
||||||
display_rect.m_Pos = pos;
|
|
||||||
GetScreen()->Unscale( display_rect.m_Size );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return display_rect.Contains( ref_pos );
|
return display_rect.Contains( ref_pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::PostDirtyRect( EDA_Rect aRect )
|
void EDA_DRAW_PANEL::RefreshDrawingRect( const EDA_Rect& aRect, bool aEraseBackground )
|
||||||
{
|
{
|
||||||
// D( printf( "1) PostDirtyRect( x=%d, y=%d, width=%d, height=%d)\n", aRect.m_Pos.x, aRect.m_Pos.y, aRect.m_Size.x, aRect.m_Size.y ); )
|
INSTALL_UNBUFFERED_DC( dc, this );
|
||||||
|
|
||||||
// Convert the rect coordinates and size to pixels (make a draw clip box):
|
wxRect rect = aRect;
|
||||||
ConvertPcbUnitsToPixelsUnits( &aRect );
|
|
||||||
|
|
||||||
// Ensure the rectangle is large enough after truncations.
|
rect.x = dc.LogicalToDeviceX( rect.x );
|
||||||
// The pcb units have finer granularity than the pixels, so it can happen
|
rect.y = dc.LogicalToDeviceY( rect.y );
|
||||||
// that the rectangle is not large enough for the erase portion.
|
rect.width = dc.LogicalToDeviceXRel( rect.width );
|
||||||
|
rect.height = dc.LogicalToDeviceYRel( rect.height );
|
||||||
|
|
||||||
aRect.m_Size.x += 4; // += 1 is not enough!
|
wxLogTrace( KICAD_TRACE_COORDS,
|
||||||
aRect.m_Size.y += 4;
|
wxT( "Refresh area: drawing (%d, %d, %d, %d), device (%d, %d, %d, %d)" ),
|
||||||
|
aRect.GetX(), aRect.GetY(), aRect.GetWidth(), aRect.GetHeight(),
|
||||||
|
rect.x, rect.y, rect.width, rect.height );
|
||||||
|
|
||||||
// D( printf( "2) PostDirtyRect( x=%d, y=%d, width=%d, height=%d)\n", aRect.m_Pos.x, aRect.m_Pos.y, aRect.m_Size.x, aRect.m_Size.y ); )
|
RefreshRect( rect, aEraseBackground );
|
||||||
|
|
||||||
// pass wxRect() via EDA_Rect::operator wxRect() overload
|
|
||||||
RefreshRect( aRect, TRUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scale and offset a rectangle in drawing units to device units.
|
|
||||||
*
|
|
||||||
* This is the equivalent of wxDC::LogicalToDevice.
|
|
||||||
*
|
|
||||||
* @param aRect - Rectangle to scale.
|
|
||||||
*/
|
|
||||||
void EDA_DRAW_PANEL::ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect )
|
|
||||||
{
|
|
||||||
// Calculate the draw area origin in internal units:
|
|
||||||
wxPoint pos = aRect->GetPosition();
|
|
||||||
|
|
||||||
ConvertPcbUnitsToPixelsUnits( &pos );
|
|
||||||
aRect->SetOrigin( pos ); // rect origin in pixel units
|
|
||||||
|
|
||||||
double scale = GetScreen()->GetScalingFactor();
|
|
||||||
aRect->m_Size.x = wxRound( (double) aRect->m_Size.x * scale );
|
|
||||||
aRect->m_Size.y = wxRound( (double) aRect->m_Size.y * scale );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition )
|
|
||||||
{
|
|
||||||
// Calculate the draw area origin in internal units:
|
|
||||||
wxPoint drwOrig;
|
|
||||||
int x_axis_scale, y_axis_scale;
|
|
||||||
|
|
||||||
// Origin in scroll units;
|
|
||||||
GetViewStart( &drwOrig.x, &drwOrig.y );
|
|
||||||
GetScrollPixelsPerUnit( &x_axis_scale, &y_axis_scale );
|
|
||||||
|
|
||||||
// Origin in pixels units
|
|
||||||
drwOrig.x *= x_axis_scale;
|
|
||||||
drwOrig.y *= y_axis_scale;
|
|
||||||
|
|
||||||
double x, y;
|
|
||||||
double scalar = GetScreen()->GetScalingFactor();
|
|
||||||
x = (double) aPosition->x - ( ( (double) drwOrig.x / scalar )
|
|
||||||
+ (double) GetScreen()->m_DrawOrg.x );
|
|
||||||
y = (double) aPosition->y - ( ( (double) drwOrig.y / scalar )
|
|
||||||
+ (double) GetScreen()->m_DrawOrg.y );
|
|
||||||
aPosition->x = wxRound( x * scalar );
|
|
||||||
aPosition->y = wxRound( y * scalar );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,14 +316,12 @@ void EDA_DRAW_PANEL::MouseTo( const wxPoint& Mouse )
|
||||||
|
|
||||||
CalcScrolledPosition( Mouse.x, Mouse.y, &screenPos.x, &screenPos.y );
|
CalcScrolledPosition( Mouse.x, Mouse.y, &screenPos.x, &screenPos.y );
|
||||||
|
|
||||||
/* Scroll if the requested mouse position cursor is outside the drawing
|
// Scroll if the requested mouse position cursor is outside the drawing area.
|
||||||
* area. */
|
|
||||||
if( !clientRect.Contains( screenPos ) )
|
if( !clientRect.Contains( screenPos ) )
|
||||||
{
|
{
|
||||||
GetViewStart( &x, &y );
|
GetViewStart( &x, &y );
|
||||||
GetScrollPixelsPerUnit( &xPpu, &yPpu );
|
GetScrollPixelsPerUnit( &xPpu, &yPpu );
|
||||||
CalcUnscrolledPosition( screenPos.x, screenPos.y,
|
CalcUnscrolledPosition( screenPos.x, screenPos.y, &drawingPos.x, &drawingPos.y );
|
||||||
&drawingPos.x, &drawingPos.y );
|
|
||||||
|
|
||||||
wxLogDebug( wxT( "MouseTo() initial screen position(%d, %d) " ) \
|
wxLogDebug( wxT( "MouseTo() initial screen position(%d, %d) " ) \
|
||||||
wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ),
|
wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ),
|
||||||
|
@ -406,11 +338,10 @@ void EDA_DRAW_PANEL::MouseTo( const wxPoint& Mouse )
|
||||||
x -= m_scrollIncrementX * xPpu;
|
x -= m_scrollIncrementX * xPpu;
|
||||||
|
|
||||||
Scroll( x, y );
|
Scroll( x, y );
|
||||||
CalcScrolledPosition( drawingPos.x, drawingPos.y,
|
CalcScrolledPosition( drawingPos.x, drawingPos.y, &screenPos.x, &screenPos.y );
|
||||||
&screenPos.x, &screenPos.y );
|
|
||||||
|
|
||||||
wxLogDebug( wxT( "MouseTo() scrolled screen position(%d, %d) " ) \
|
wxLogDebug( wxT( "MouseTo() scrolled screen position(%d, %d) view(%d, %d)" ),
|
||||||
wxT( "view(%d, %d)" ), screenPos.x, screenPos.y, x, y );
|
screenPos.x, screenPos.y, x, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
WarpPointer( screenPos.x, screenPos.y );
|
WarpPointer( screenPos.x, screenPos.y );
|
||||||
|
@ -430,6 +361,7 @@ void EDA_DRAW_PANEL::OnActivate( wxActivateEvent& event )
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
|
void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetEventType();
|
int id = event.GetEventType();
|
||||||
|
@ -455,12 +387,14 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
|
||||||
if( dir == wxHORIZONTAL )
|
if( dir == wxHORIZONTAL )
|
||||||
{
|
{
|
||||||
x -= m_scrollIncrementX;
|
x -= m_scrollIncrementX;
|
||||||
|
|
||||||
if( x < 0 )
|
if( x < 0 )
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y -= m_scrollIncrementY;
|
y -= m_scrollIncrementY;
|
||||||
|
|
||||||
if( y < 0 )
|
if( y < 0 )
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
|
@ -476,6 +410,7 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y += m_scrollIncrementY;
|
y += m_scrollIncrementY;
|
||||||
|
|
||||||
if( y > maxY )
|
if( y > maxY )
|
||||||
y = maxY;
|
y = maxY;
|
||||||
}
|
}
|
||||||
|
@ -502,70 +437,52 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnSize( wxSizeEvent& event )
|
|
||||||
|
void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
|
||||||
{
|
{
|
||||||
if( IsShown() )
|
wxRect clipBox;
|
||||||
|
|
||||||
|
// Use the entire visible device area if no clip area was defined.
|
||||||
|
if( aRect == NULL )
|
||||||
{
|
{
|
||||||
INSTALL_DC( dc, this ); // Update boundary box.
|
BASE_SCREEN* Screen = GetScreen();
|
||||||
|
|
||||||
|
if( !Screen )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
|
||||||
|
clipBox.SetSize( GetClientSize() );
|
||||||
|
|
||||||
|
int scrollX, scrollY;
|
||||||
|
|
||||||
|
double scalar = Screen->GetScalingFactor();
|
||||||
|
scrollX = wxRound( Screen->GetGridSize().x * scalar );
|
||||||
|
scrollY = wxRound( Screen->GetGridSize().y * scalar );
|
||||||
|
|
||||||
|
m_scrollIncrementX = MAX( GetClientSize().x / 8, scrollX );
|
||||||
|
m_scrollIncrementY = MAX( GetClientSize().y / 8, scrollY );
|
||||||
|
Screen->m_ScrollbarPos.x = GetScrollPos( wxHORIZONTAL );
|
||||||
|
Screen->m_ScrollbarPos.y = GetScrollPos( wxVERTICAL );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clipBox = *aRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.Skip();
|
// Pad clip box in device units.
|
||||||
}
|
clipBox.Inflate( CLIP_BOX_PADDING );
|
||||||
|
|
||||||
|
// Convert from device units to drawing units.
|
||||||
|
m_ClipBox.m_Pos = wxPoint( aDC.DeviceToLogicalX( clipBox.x ),
|
||||||
|
aDC.DeviceToLogicalY( clipBox.y ) );
|
||||||
|
m_ClipBox.m_Size = wxSize( aDC.DeviceToLogicalXRel( clipBox.width ),
|
||||||
|
aDC.DeviceToLogicalYRel( clipBox.height ) );
|
||||||
|
|
||||||
/**
|
#if DEBUG_DUMP_CLIP_COORDS
|
||||||
* Function SetBoundaryBox
|
wxLogDebug( wxT( "Device clip box=(%d, %d, %d, %d), Logical clip box=(%d, %d, %d, %d)" ),
|
||||||
* Set the clip box to the current displayed rectangle dimensions.
|
clipBox.x, clipBox.y, clipBox.width, clipBox.height,
|
||||||
*
|
m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y, m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
|
||||||
* When using wxDC for scaling, the clip box coordinates are in drawing (logical)
|
|
||||||
* units. In other words, the area of the drawing that will be displayed on the
|
|
||||||
* screen. When using Kicad's scaling, the clip box coordinates are in screen
|
|
||||||
* (device) units according to the current scroll position.
|
|
||||||
*
|
|
||||||
* @param dc - The device context use for drawing with the correct scale and
|
|
||||||
* offsets already configured. See DoPrepareDC().
|
|
||||||
*/
|
|
||||||
void EDA_DRAW_PANEL::SetBoundaryBox( wxDC* dc )
|
|
||||||
{
|
|
||||||
wxASSERT( dc != NULL );
|
|
||||||
|
|
||||||
BASE_SCREEN* Screen = GetScreen();;
|
|
||||||
|
|
||||||
if( !Screen )
|
|
||||||
return;
|
|
||||||
|
|
||||||
Screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
|
|
||||||
m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
|
|
||||||
m_ClipBox.SetSize( GetClientSize() );
|
|
||||||
|
|
||||||
int scrollX, scrollY;
|
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
double scalar = Screen->GetScalingFactor();
|
|
||||||
scrollX = wxRound( Screen->GetGridSize().x * scalar );
|
|
||||||
scrollY = wxRound( Screen->GetGridSize().y * scalar );
|
|
||||||
#else
|
|
||||||
scrollX = wxRound( Screen->Scale( Screen->GetGridSize().x ) );
|
|
||||||
scrollY = wxRound( Screen->Scale( Screen->GetGridSize().y ) );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_scrollIncrementX = MAX( GetClientSize().x / 8, scrollX );
|
|
||||||
m_scrollIncrementY = MAX( GetClientSize().y / 8, scrollY );
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
/* Using wxDC scaling requires clipping in drawing (logical) units. */
|
|
||||||
m_ClipBox.SetOrigin( CalcUnscrolledPosition( wxPoint( 0, 0 ) ) );
|
|
||||||
m_ClipBox.Inflate( CLIP_BOX_PADDING );
|
|
||||||
m_ClipBox.m_Pos.x = wxRound( (double) m_ClipBox.m_Pos.x / scalar );
|
|
||||||
m_ClipBox.m_Pos.y = wxRound( (double) m_ClipBox.m_Pos.y / scalar );
|
|
||||||
m_ClipBox.m_Pos += Screen->m_DrawOrg;
|
|
||||||
m_ClipBox.m_Size.x = wxRound( (double) m_ClipBox.m_Size.x / scalar );
|
|
||||||
m_ClipBox.m_Size.y = wxRound( (double) m_ClipBox.m_Size.y / scalar );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Screen->m_ScrollbarPos.x = GetScrollPos( wxHORIZONTAL );
|
|
||||||
Screen->m_ScrollbarPos.y = GetScrollPos( wxVERTICAL );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -573,38 +490,35 @@ void EDA_DRAW_PANEL::EraseScreen( wxDC* DC )
|
||||||
{
|
{
|
||||||
GRSetDrawMode( DC, GR_COPY );
|
GRSetDrawMode( DC, GR_COPY );
|
||||||
|
|
||||||
GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
|
GRSFilledRect( NULL, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
|
||||||
m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
|
m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
|
||||||
0, g_DrawBgColor, g_DrawBgColor );
|
0, g_DrawBgColor, g_DrawBgColor );
|
||||||
|
|
||||||
/* Set to one (1) to draw bounding box validate bounding box calculation. */
|
/* Set to one (1) to draw bounding box validate bounding box calculation. */
|
||||||
#if DEBUG_SHOW_CLIP_RECT
|
#if DEBUG_SHOW_CLIP_RECT
|
||||||
EDA_Rect bBox = m_ClipBox;
|
EDA_Rect bBox = m_ClipBox;
|
||||||
bBox.Inflate( -DC->DeviceToLogicalXRel( 1 ) );
|
|
||||||
GRRect( NULL, DC, bBox.GetOrigin().x, bBox.GetOrigin().y,
|
GRRect( NULL, DC, bBox.GetOrigin().x, bBox.GetOrigin().y,
|
||||||
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
|
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::DoPrepareDC(wxDC& dc)
|
void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc )
|
||||||
{
|
{
|
||||||
#ifdef USE_WX_ZOOM
|
wxScrolledWindow::DoPrepareDC( dc );
|
||||||
|
|
||||||
if( GetScreen() != NULL )
|
if( GetScreen() != NULL )
|
||||||
{
|
{
|
||||||
double scale = GetScreen()->GetScalingFactor();
|
double scale = GetScreen()->GetScalingFactor();
|
||||||
dc.SetUserScale( scale, scale );
|
dc.SetUserScale( scale, scale );
|
||||||
|
|
||||||
wxPoint pt = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
|
wxPoint pt = GetScreen()->m_DrawOrg;
|
||||||
dc.SetDeviceOrigin( -pt.x, -pt.y );
|
|
||||||
pt = GetScreen()->m_DrawOrg;
|
|
||||||
dc.SetLogicalOrigin( pt.x, pt.y );
|
dc.SetLogicalOrigin( pt.x, pt.y );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
SetClipBox( dc ); // Reset the clip box to the entire screen.
|
||||||
GRResetPenAndBrush( &dc );
|
GRResetPenAndBrush( &dc );
|
||||||
dc.SetBackgroundMode( wxTRANSPARENT );
|
dc.SetBackgroundMode( wxTRANSPARENT );
|
||||||
SetBoundaryBox( &dc );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -618,67 +532,10 @@ void EDA_DRAW_PANEL::OnPaint( wxPaintEvent& event )
|
||||||
|
|
||||||
INSTALL_PAINTDC( paintDC, this );
|
INSTALL_PAINTDC( paintDC, this );
|
||||||
|
|
||||||
/* wxAutoBufferedPaintDC does not work correctly by setting the user scale and
|
wxRect region = GetUpdateRegion().GetBox();
|
||||||
* logcial offset. The bitmap coordinates and scaling are not effected by the
|
SetClipBox( paintDC, ®ion );
|
||||||
* code below. It appears that the wxBufferPaintDC needs to be created with the
|
wxDCClipper dcclip( paintDC, m_ClipBox );
|
||||||
* wxBUFFER_VIRTUAL_AREA set and the wirtual method wxWindow::PrepareDC() needs
|
ReDraw( &paintDC, m_DisableEraseBG ? false : true );
|
||||||
* to be overridden to set up the buffered paint DC properly. The bitmap grid
|
|
||||||
* draw code ( see DrawGrid() below ) will have to be fixed before this can be
|
|
||||||
* implemented.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EDA_Rect tmp = m_ClipBox;
|
|
||||||
|
|
||||||
// Get the union of all rectangles in the update region.
|
|
||||||
wxRect PaintClipBox = GetUpdateRegion().GetBox();
|
|
||||||
|
|
||||||
#if DEBUG_DUMP_CLIP_COORDS
|
|
||||||
wxLogDebug( wxT( "1) PaintClipBox=(%d, %d, %d, %d), m_ClipBox=(%d, %d, %d, %d)" ),
|
|
||||||
PaintClipBox.x, PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
|
|
||||||
m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y, m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined( USE_WX_ZOOM )
|
|
||||||
/* When using wxDC scaling the clipping region coordinates are in drawing
|
|
||||||
* (logical) units.
|
|
||||||
*/
|
|
||||||
double scalar = GetScreen()->GetScalingFactor();
|
|
||||||
m_ClipBox.m_Pos = CalcUnscrolledPosition( PaintClipBox.GetPosition() );
|
|
||||||
m_ClipBox.m_Size = PaintClipBox.GetSize();
|
|
||||||
m_ClipBox.Inflate( CLIP_BOX_PADDING );
|
|
||||||
m_ClipBox.m_Pos.x = wxRound( (double) m_ClipBox.m_Pos.x / scalar );
|
|
||||||
m_ClipBox.m_Pos.y = wxRound( (double) m_ClipBox.m_Pos.y / scalar );
|
|
||||||
m_ClipBox.m_Pos += GetScreen()->m_DrawOrg;
|
|
||||||
m_ClipBox.m_Size.x = wxRound( (double) m_ClipBox.m_Size.x / scalar );
|
|
||||||
m_ClipBox.m_Size.y = wxRound( (double) m_ClipBox.m_Size.y / scalar );
|
|
||||||
PaintClipBox = m_ClipBox;
|
|
||||||
#else
|
|
||||||
/* When using Kicad's scaling the clipping region coordinates are in screen
|
|
||||||
* (device) units.
|
|
||||||
*/
|
|
||||||
m_ClipBox.SetX( PaintClipBox.GetX() );
|
|
||||||
m_ClipBox.SetY( PaintClipBox.GetY() );
|
|
||||||
m_ClipBox.SetWidth( PaintClipBox.GetWidth() );
|
|
||||||
m_ClipBox.SetHeight( PaintClipBox.GetHeight() );
|
|
||||||
|
|
||||||
// Be sure the drawpanel clipbox is bigger than the region to repair:
|
|
||||||
m_ClipBox.Inflate( 1 ); // Give it one pixel more in each direction
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DEBUG_DUMP_CLIP_COORDS
|
|
||||||
wxLogDebug( wxT( "2) PaintClipBox=(%d, %d, %d, %d), m_ClipBox=(%d, %d, %d, %d)" ),
|
|
||||||
PaintClipBox.x, PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
|
|
||||||
m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y, m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// call ~wxDCClipper() before ~wxPaintDC()
|
|
||||||
{
|
|
||||||
wxDCClipper dcclip( paintDC, PaintClipBox );
|
|
||||||
ReDraw( &paintDC, m_DisableEraseBG ? false : true );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ClipBox = tmp;
|
|
||||||
event.Skip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -706,10 +563,6 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
|
||||||
if( erasebg )
|
if( erasebg )
|
||||||
EraseScreen( DC );
|
EraseScreen( DC );
|
||||||
|
|
||||||
SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
|
|
||||||
ColorRefs[g_DrawBgColor].m_Green,
|
|
||||||
ColorRefs[g_DrawBgColor].m_Blue ) );
|
|
||||||
|
|
||||||
GRResetPenAndBrush( DC );
|
GRResetPenAndBrush( DC );
|
||||||
|
|
||||||
DC->SetBackground( *wxBLACK_BRUSH );
|
DC->SetBackground( *wxBLACK_BRUSH );
|
||||||
|
@ -767,152 +620,80 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* DC )
|
||||||
{
|
{
|
||||||
#define MIN_GRID_SIZE 10 // min grid size in pixels to allow drawing
|
#define MIN_GRID_SIZE 10 // min grid size in pixels to allow drawing
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
int ii, jj, xg, yg;
|
wxRealPoint gridSize;
|
||||||
wxRealPoint screen_grid_size;
|
wxSize screenSize;
|
||||||
wxSize size;
|
|
||||||
wxPoint org;
|
wxPoint org;
|
||||||
wxRealPoint dgrid;
|
wxRealPoint screenGridSize;
|
||||||
|
|
||||||
/* The grid must be visible. this is possible only is grid value
|
/* The grid must be visible. this is possible only is grid value
|
||||||
* and zoom value are sufficient
|
* and zoom value are sufficient
|
||||||
*/
|
*/
|
||||||
screen_grid_size = screen->GetGridSize();
|
gridSize = screen->GetGridSize();
|
||||||
org = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
|
screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
|
||||||
screen->m_StartVisu = org;
|
screenSize = GetClientSize();
|
||||||
size = GetClientSize();
|
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
screenGridSize.x = DC->LogicalToDeviceXRel( wxRound( gridSize.x ) );
|
||||||
dgrid.x = DC->LogicalToDeviceXRel( wxRound( screen_grid_size.x ) );
|
screenGridSize.y = DC->LogicalToDeviceXRel( wxRound( gridSize.y ) );
|
||||||
dgrid.y = DC->LogicalToDeviceXRel( wxRound( screen_grid_size.y ) );
|
|
||||||
|
|
||||||
org = m_ClipBox.m_Pos;
|
org = m_ClipBox.m_Pos;
|
||||||
size = m_ClipBox.m_Size;
|
|
||||||
#else
|
|
||||||
dgrid = screen_grid_size;
|
|
||||||
screen->Scale( dgrid ); // dgrid = grid size in pixels
|
|
||||||
screen->Unscale( size );
|
|
||||||
screen->Unscale( org );
|
|
||||||
org += screen->m_DrawOrg;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if the grid size is small ( < MIN_GRID_SIZE pixels ) do not display all points
|
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
|
||||||
bool double_size = false;
|
|
||||||
if( dgrid.x < MIN_GRID_SIZE )
|
|
||||||
{
|
{
|
||||||
double_size = true;
|
screenGridSize.x *= 2.0;
|
||||||
dgrid.x *= 2;
|
screenGridSize.y *= 2.0;
|
||||||
|
gridSize.x *= 2.0;
|
||||||
|
gridSize.y *= 2.0;
|
||||||
}
|
}
|
||||||
if( dgrid.x < MIN_GRID_SIZE )
|
|
||||||
return; // The X grid is too small: do not show it
|
|
||||||
|
|
||||||
if( dgrid.y < MIN_GRID_SIZE )
|
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
|
||||||
{
|
return;
|
||||||
double_size = true;
|
|
||||||
dgrid.y *= 2;
|
|
||||||
}
|
|
||||||
if( dgrid.y < MIN_GRID_SIZE )
|
|
||||||
return; // The Y grid is too small: do not show it
|
|
||||||
|
|
||||||
|
m_Parent->PutOnGrid( &org, &gridSize );
|
||||||
|
|
||||||
m_Parent->PutOnGrid( &org );
|
#if ( defined( __WXMAC__ ) || defined( __WXGTK__ ) || 1 )
|
||||||
|
// Use a pixel based draw to display grid. There are a lot of calls, so the cost is high
|
||||||
|
// and grid is slowly drawn on some platforms. Please note that this should always be
|
||||||
|
// enabled until the bitmap based solution below is fixed.
|
||||||
GRSetColorPen( DC, m_Parent->GetGridColor() );
|
GRSetColorPen( DC, m_Parent->GetGridColor() );
|
||||||
int xpos, ypos;
|
|
||||||
|
|
||||||
/* When we use an double_size grid, we must align grid ord on double grid
|
int xpos;
|
||||||
*/
|
double right = ( double ) m_ClipBox.GetRight();
|
||||||
int increment = double_size ? 2 : 1;
|
double bottom = ( double ) m_ClipBox.GetBottom();
|
||||||
if( double_size )
|
|
||||||
|
for( double x = (double) org.x; x <= right; x += gridSize.x )
|
||||||
{
|
{
|
||||||
wxRealPoint dblgrid = screen_grid_size + screen_grid_size;
|
xpos = wxRound( x );
|
||||||
m_Parent->PutOnGrid( &org, &dblgrid );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw grid: the best algorithm depend on the platform.
|
for( double y = (double) org.y; y <= bottom; y += gridSize.y )
|
||||||
// under macOSX, the first method is better
|
|
||||||
// under window, the second method is better
|
|
||||||
// Under linux, to be tested (could be depend on linux versions
|
|
||||||
// so perhaps could be necessary to set this option at run time.
|
|
||||||
|
|
||||||
/* The bitmap grid drawing code below cannot be used when wxDC scaling is used
|
|
||||||
* as it does not scale the grid bitmap properly. This needs to be fixed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined( __WXMAC__ ) && !defined( USE_WX_ZOOM )
|
|
||||||
// Use a pixel based draw to display grid
|
|
||||||
// When is not used USE_WX_ZOOM
|
|
||||||
for( ii = 0; ; ii += increment )
|
|
||||||
{
|
|
||||||
xg = wxRound( ii * screen_grid_size.x );
|
|
||||||
if( xg > size.x )
|
|
||||||
break;
|
|
||||||
xpos = org.x + xg;
|
|
||||||
xpos = GRMapX( xpos );
|
|
||||||
for( jj = 0; ; jj += increment )
|
|
||||||
{
|
{
|
||||||
yg = wxRound( jj * screen_grid_size.y );
|
DC->DrawPoint( xpos, wxRound( y ) );
|
||||||
if( yg > size.y )
|
|
||||||
break;
|
|
||||||
ypos = org.y + yg;
|
|
||||||
DC->DrawPoint( xpos, GRMapY( ypos ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined( USE_WX_ZOOM )
|
|
||||||
// Use a pixel based draw to display grid
|
|
||||||
// There is a lot of calls, so the cost is hight
|
|
||||||
// and grid is slowly drawn on some platforms
|
|
||||||
for( ii = 0; ; ii += increment )
|
|
||||||
{
|
|
||||||
xg = wxRound( ii * screen_grid_size.x );
|
|
||||||
if( xg > size.x )
|
|
||||||
break;
|
|
||||||
xpos = org.x + xg;
|
|
||||||
xpos = GRMapX( xpos );
|
|
||||||
if( xpos < m_ClipBox.GetOrigin().x ) // column not in active screen area.
|
|
||||||
continue;
|
|
||||||
if( xpos > m_ClipBox.GetEnd().x ) // end of active area reached.
|
|
||||||
break;
|
|
||||||
for( jj = 0; ; jj += increment )
|
|
||||||
{
|
|
||||||
yg = wxRound( jj * screen_grid_size.y );
|
|
||||||
if( yg > size.y )
|
|
||||||
break;
|
|
||||||
ypos = org.y + yg;
|
|
||||||
if( ypos < m_ClipBox.GetOrigin().y ) // column not in active screen area.
|
|
||||||
continue;
|
|
||||||
if( ypos > m_ClipBox.GetEnd().y ) // end of active area reached.
|
|
||||||
break;
|
|
||||||
DC->DrawPoint( xpos, GRMapY( ypos ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
/* Currently under development: use a bitmap to draw the grid. This is fast only if the
|
||||||
/* Currently on test: Use a fast way to draw the grid
|
* Blit function is fast. Not true on all platforms.
|
||||||
* But this is fast only if the Blit function is fast. Not true on all platforms
|
|
||||||
* a grid column is drawn; and then copied to others grid columns
|
|
||||||
* this is possible because the grid is drawn only after clearing the screen.
|
|
||||||
*
|
*
|
||||||
* A first grid column is drawn in a temporary bitmap,
|
* A single grid column is drawn to a bitmap and then copied to each column. This is
|
||||||
* and after is duplicated using the Blit function
|
* possible because the grid is drawn only after clearing the screen.
|
||||||
* (copy from a screen area to an other screen area)
|
*
|
||||||
|
* A first grid column is drawn in a temporary bitmap, and after is duplicated using
|
||||||
|
* the Blit function (copy from a screen area to an other screen area).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxSize screenSize = GetClientSize();
|
|
||||||
wxMemoryDC tmpDC;
|
wxMemoryDC tmpDC;
|
||||||
wxBitmap tmpBM( 1, screenSize.y );
|
wxBitmap tmpBM( 1, m_ClipBox.GetHeight() );
|
||||||
tmpDC.SelectObject( tmpBM );
|
tmpDC.SelectObjectAsSource( tmpBM );
|
||||||
GRSetColorPen( &tmpDC, g_DrawBgColor );
|
GRSetColorPen( &tmpDC, g_DrawBgColor );
|
||||||
tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background
|
tmpDC.DrawLine( 0, 0, 0, m_ClipBox.GetHeight() - 1 ); // init background
|
||||||
GRSetColorPen( &tmpDC, m_Parent->GetGridColor() );
|
GRSetColorPen( &tmpDC, m_Parent->GetGridColor() );
|
||||||
for( jj = 0; ; jj += increment ) // draw grid points
|
|
||||||
|
double bottom = ( double ) m_ClipBox.GetBottom();
|
||||||
|
|
||||||
|
for( double y = (double) org.y; y <= bottom; y += gridSize.y ) // draw grid points
|
||||||
{
|
{
|
||||||
yg = wxRound( jj * screen_grid_size.y );
|
if( y > bottom )
|
||||||
ypos = screen->Scale( yg );
|
|
||||||
if( ypos > screenSize.y )
|
|
||||||
break;
|
break;
|
||||||
tmpDC.DrawPoint( 0, ypos );
|
|
||||||
|
tmpDC.DrawPoint( 0, wxRound( y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the layer bitmap itself as a mask when blitting.
|
// Use the layer bitmap itself as a mask when blitting.
|
||||||
|
@ -922,20 +703,12 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* DC )
|
||||||
tmpBM.SetMask( new wxMask( tmpBM, MakeColour( g_DrawBgColor ) ) );
|
tmpBM.SetMask( new wxMask( tmpBM, MakeColour( g_DrawBgColor ) ) );
|
||||||
tmpDC.SelectObject( tmpBM );
|
tmpDC.SelectObject( tmpBM );
|
||||||
|
|
||||||
ypos = GRMapY( org.y );
|
double right = m_ClipBox.GetRight();
|
||||||
for( ii = 0; ; ii += increment )
|
|
||||||
{
|
|
||||||
xg = wxRound( ii * screen_grid_size.x );
|
|
||||||
if( xg > size.x )
|
|
||||||
break;
|
|
||||||
xpos = GRMapX( org.x + xg );
|
|
||||||
if( xpos < m_ClipBox.GetOrigin().x) // column not in active screen area.
|
|
||||||
continue;
|
|
||||||
if( xpos > m_ClipBox.GetEnd().x) // end of active area reached.
|
|
||||||
break;
|
|
||||||
DC->Blit( xpos, ypos, 1, screenSize.y, &tmpDC, 0, 0, wxCOPY, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for( double x = (double) org.x; x <= right; x += gridSize.x )
|
||||||
|
{
|
||||||
|
DC->Blit( wxRound( x ), org.y, 1, m_ClipBox.GetHeight(), &tmpDC, 0, 0, wxCOPY, true );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,12 +751,12 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
|
||||||
void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
|
void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
if( !m_Parent->m_Draw_Grid_Axis
|
if( !m_Parent->m_Draw_Grid_Axis
|
||||||
|| ( screen->m_GridOrigin.x == 0
|
|| ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
|
||||||
&& screen->m_GridOrigin.y == 0 ) )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int Color = m_Parent->GetGridColor();
|
int Color = m_Parent->GetGridColor();
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
|
@ -1070,8 +843,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
|
||||||
|| !rect.Contains( event.GetPosition() ) )
|
|| !rect.Contains( event.GetPosition() ) )
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
wxLogDebug( wxT( "OnMouseWheel() position(%d, %d) " ) \
|
wxLogDebug( wxT( "OnMouseWheel() position(%d, %d) rectangle(%d, %d, %d, %d)" ),
|
||||||
wxT( "rectangle(%d, %d, %d, %d)" ),
|
|
||||||
event.GetPosition().x, event.GetPosition().y,
|
event.GetPosition().x, event.GetPosition().y,
|
||||||
rect.x, rect.y, rect.width, rect.height );
|
rect.x, rect.y, rect.width, rect.height );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1079,8 +851,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->m_Curseur =
|
GetScreen()->m_Curseur = CursorRealPosition( CalcUnscrolledPosition( event.GetPosition() ) );
|
||||||
CursorRealPosition( CalcUnscrolledPosition( event.GetPosition() ) );
|
|
||||||
|
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
@ -1132,6 +903,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
* in order to avoid spurious block commands.
|
* in order to avoid spurious block commands.
|
||||||
*/
|
*/
|
||||||
static int MinDragEventCount;
|
static int MinDragEventCount;
|
||||||
|
|
||||||
if( event.Leaving() )
|
if( event.Leaving() )
|
||||||
{
|
{
|
||||||
m_CanStartBlock = -1;
|
m_CanStartBlock = -1;
|
||||||
|
@ -1145,8 +917,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !event.IsButton() && !event.Moving()
|
if( !event.IsButton() && !event.Moving() && !event.Dragging() && !localkey )
|
||||||
&& !event.Dragging() && !localkey )
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1178,24 +949,24 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
localrealbutt |= localbutt; /* compensation default wxGTK */
|
localrealbutt |= localbutt; /* compensation default wxGTK */
|
||||||
|
|
||||||
/* Compute the cursor position in screen (device) units. */
|
/* Compute the cursor position in screen (device) units. */
|
||||||
screen->m_MousePositionInPixels = CalcUnscrolledPosition( event.GetPosition() );
|
wxPoint pos = CalcUnscrolledPosition( event.GetPosition() );
|
||||||
|
|
||||||
/* Compute the cursor position in drawing (logical) units. */
|
/* Compute the cursor position in drawing (logical) units. */
|
||||||
screen->m_MousePosition =
|
screen->m_MousePosition = CursorRealPosition( pos );
|
||||||
CursorRealPosition( CalcUnscrolledPosition( event.GetPosition() ) );
|
|
||||||
|
|
||||||
INSTALL_DC( DC, this );
|
INSTALL_UNBUFFERED_DC( DC, this );
|
||||||
|
DC.SetBackground( *wxBLACK_BRUSH );
|
||||||
|
|
||||||
int kbstat = 0;
|
int kbstat = 0;
|
||||||
|
|
||||||
DC.SetBackground( *wxBLACK_BRUSH );
|
|
||||||
|
|
||||||
g_KeyPressed = localkey;
|
g_KeyPressed = localkey;
|
||||||
|
|
||||||
if( event.ShiftDown() )
|
if( event.ShiftDown() )
|
||||||
kbstat |= GR_KB_SHIFT;
|
kbstat |= GR_KB_SHIFT;
|
||||||
|
|
||||||
if( event.ControlDown() )
|
if( event.ControlDown() )
|
||||||
kbstat |= GR_KB_CTRL;
|
kbstat |= GR_KB_CTRL;
|
||||||
|
|
||||||
if( event.AltDown() )
|
if( event.AltDown() )
|
||||||
kbstat |= GR_KB_ALT;
|
kbstat |= GR_KB_ALT;
|
||||||
|
|
||||||
|
@ -1204,7 +975,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
// Calling Double Click and Click functions :
|
// Calling Double Click and Click functions :
|
||||||
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
|
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
|
||||||
{
|
{
|
||||||
m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels );
|
m_Parent->OnLeftDClick( &DC, pos );
|
||||||
|
|
||||||
// inhibit a response to the mouse left button release,
|
// inhibit a response to the mouse left button release,
|
||||||
// because we have a double click, and we do not want a new
|
// because we have a double click, and we do not want a new
|
||||||
|
@ -1215,9 +986,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
// A block command is in progress: a left up is the end of block
|
// A block command is in progress: a left up is the end of block
|
||||||
// or this is the end of a double click, already seen
|
// or this is the end of a double click, already seen
|
||||||
if( screen->m_BlockLocate.m_State==STATE_NO_BLOCK
|
if( screen->m_BlockLocate.m_State==STATE_NO_BLOCK && !s_IgnoreNextLeftButtonRelease )
|
||||||
&& !s_IgnoreNextLeftButtonRelease )
|
m_Parent->OnLeftClick( &DC, pos );
|
||||||
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
|
|
||||||
|
|
||||||
s_IgnoreNextLeftButtonRelease = false;
|
s_IgnoreNextLeftButtonRelease = false;
|
||||||
}
|
}
|
||||||
|
@ -1232,21 +1002,17 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
s_IgnoreNextLeftButtonRelease = false;
|
s_IgnoreNextLeftButtonRelease = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( event.ButtonUp( wxMOUSE_BTN_MIDDLE )
|
if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
|
||||||
&& (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
|
|
||||||
{
|
{
|
||||||
// The middle button has been released, with no block command:
|
// The middle button has been released, with no block command:
|
||||||
// We use it for a zoom center at cursor position command
|
// We use it for a zoom center at cursor position command
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED,
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
|
||||||
ID_POPUP_ZOOM_CENTER );
|
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Calling the general function on mouse changes (and pseudo key commands) */
|
/* Calling the general function on mouse changes (and pseudo key commands) */
|
||||||
m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels );
|
m_Parent->GeneralControle( &DC, pos );
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
/* Control of block commands : */
|
/* Control of block commands : */
|
||||||
|
@ -1287,6 +1053,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
screen->m_BlockLocate.SetOrigin( m_CursorStartPos );
|
screen->m_BlockLocate.SetOrigin( m_CursorStartPos );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( event.LeftDown() || event.MiddleDown() )
|
if( event.LeftDown() || event.MiddleDown() )
|
||||||
{
|
{
|
||||||
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
|
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
|
||||||
|
@ -1301,8 +1068,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
&& ManageCurseur == NULL
|
&& ManageCurseur == NULL
|
||||||
&& ForceCloseManageCurseur == NULL )
|
&& ForceCloseManageCurseur == NULL )
|
||||||
{
|
{
|
||||||
// Mouse is dragging: if no block in progress, start a block
|
// Mouse is dragging: if no block in progress, start a block command.
|
||||||
// command.
|
|
||||||
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
|
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
|
||||||
{
|
{
|
||||||
// Start a block command
|
// Start a block command
|
||||||
|
@ -1345,19 +1111,17 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
*/
|
*/
|
||||||
#define BLOCK_MINSIZE_LIMIT 1
|
#define BLOCK_MINSIZE_LIMIT 1
|
||||||
bool BlockIsSmall =
|
bool BlockIsSmall =
|
||||||
( ABS( screen->Scale( screen->m_BlockLocate.GetWidth() ) )
|
( ABS( screen->m_BlockLocate.GetWidth() ) < BLOCK_MINSIZE_LIMIT )
|
||||||
< BLOCK_MINSIZE_LIMIT)
|
&& ( ABS( screen->m_BlockLocate.GetHeight() ) < BLOCK_MINSIZE_LIMIT );
|
||||||
&& ( ABS( screen->Scale( screen->m_BlockLocate.GetHeight() ) )
|
|
||||||
< BLOCK_MINSIZE_LIMIT);
|
|
||||||
|
|
||||||
if( (screen->m_BlockLocate.m_State
|
if( (screen->m_BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall )
|
||||||
!= STATE_NO_BLOCK) && BlockIsSmall )
|
|
||||||
{
|
{
|
||||||
if( ForceCloseManageCurseur )
|
if( ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
ForceCloseManageCurseur( this, &DC );
|
ForceCloseManageCurseur( this, &DC );
|
||||||
m_AutoPAN_Request = false;
|
m_AutoPAN_Request = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
|
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
|
||||||
}
|
}
|
||||||
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
|
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
|
||||||
|
@ -1365,6 +1129,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
m_AutoPAN_Request = false;
|
m_AutoPAN_Request = false;
|
||||||
m_Parent->HandleBlockEnd( &DC );
|
m_Parent->HandleBlockEnd( &DC );
|
||||||
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
|
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
|
||||||
|
|
||||||
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
|
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
|
||||||
{
|
{
|
||||||
m_AutoPAN_Request = TRUE;
|
m_AutoPAN_Request = TRUE;
|
||||||
|
@ -1375,8 +1140,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of block command on a double click
|
// End of block command on a double click
|
||||||
// To avoid an unwanted block move command if the mouse is moved while
|
// To avoid an unwanted block move command if the mouse is moved while double clicking
|
||||||
// double clicking
|
|
||||||
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
|
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
|
||||||
{
|
{
|
||||||
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
|
@ -1440,7 +1204,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
||||||
if( (localkey > GR_KB_CTRL) && (localkey <= GR_KB_CTRL+26) )
|
if( (localkey > GR_KB_CTRL) && (localkey <= GR_KB_CTRL+26) )
|
||||||
localkey += 'A' - 1;
|
localkey += 'A' - 1;
|
||||||
|
|
||||||
INSTALL_DC( DC, this );
|
INSTALL_UNBUFFERED_DC( DC, this );
|
||||||
|
|
||||||
BASE_SCREEN* Screen = GetScreen();
|
BASE_SCREEN* Screen = GetScreen();
|
||||||
|
|
||||||
|
@ -1464,12 +1228,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
||||||
/* Some key commands use the current mouse position: refresh it */
|
/* Some key commands use the current mouse position: refresh it */
|
||||||
pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
|
pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
|
||||||
|
|
||||||
/* Compute cursor position in screen units (pixel) including the
|
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
|
||||||
* current scroll bar position. Also known as device units to wxDC. */
|
|
||||||
Screen->m_MousePositionInPixels = pos;
|
|
||||||
|
|
||||||
/* Compute the cursor position in drawing units. Also known as logical units
|
|
||||||
* to wxDC. */
|
|
||||||
Screen->m_MousePosition = CursorRealPosition( pos );
|
Screen->m_MousePosition = CursorRealPosition( pos );
|
||||||
|
|
||||||
m_Parent->GeneralControle( &DC, pos );
|
m_Parent->GeneralControle( &DC, pos );
|
||||||
|
@ -1519,10 +1278,13 @@ void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event )
|
||||||
|
|
||||||
if( x < 0 )
|
if( x < 0 )
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
||||||
if( y < 0 )
|
if( y < 0 )
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
if( x > maxX )
|
if( x > maxX )
|
||||||
x = maxX;
|
x = maxX;
|
||||||
|
|
||||||
if( y > maxY )
|
if( y > maxY )
|
||||||
y = maxY;
|
y = maxY;
|
||||||
|
|
||||||
|
@ -1534,10 +1296,11 @@ void EDA_DRAW_PANEL::UnManageCursor( int id, int cursor, const wxString& title )
|
||||||
{
|
{
|
||||||
if( ManageCurseur && ForceCloseManageCurseur )
|
if( ManageCurseur && ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
INSTALL_DC( dc, this );
|
INSTALL_UNBUFFERED_DC( dc, this );
|
||||||
ForceCloseManageCurseur( this, &dc );
|
ForceCloseManageCurseur( this, &dc );
|
||||||
m_AutoPAN_Request = false;
|
m_AutoPAN_Request = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( id != -1 && cursor != -1 )
|
if( id != -1 && cursor != -1 )
|
||||||
{
|
{
|
||||||
wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
|
wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
|
||||||
|
|
|
@ -287,10 +287,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
|
||||||
if( aPanel )
|
if( aPanel )
|
||||||
{
|
{
|
||||||
int xm, ym, ll, xc, yc;
|
int xm, ym, ll, xc, yc;
|
||||||
ll = aPanel->GetScreen()->Scale( ABS( dx ) );
|
ll = ABS( dx );
|
||||||
|
|
||||||
xc = GRMapX( current_char_pos.x );
|
xc = current_char_pos.x;
|
||||||
yc = GRMapY( current_char_pos.y );
|
yc = current_char_pos.y;
|
||||||
|
|
||||||
x0 = aPanel->m_ClipBox.GetX() - ll;
|
x0 = aPanel->m_ClipBox.GetX() - ll;
|
||||||
y0 = aPanel->m_ClipBox.GetY() - 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
|
// 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;
|
return;
|
||||||
|
|
||||||
/* if a text size is too small, the text cannot be drawn, and it is drawn as a single graphic line */
|
/* if a text size is too small, the text cannot be drawn, and it is drawn as a single
|
||||||
if( aPanel && ABS( ( aPanel->GetScreen()->Scale( aSize.x ) ) ) < 3 )
|
* graphic line */
|
||||||
|
if( aSize.x < 3 )
|
||||||
{
|
{
|
||||||
/* draw the text as a line always vertically centered */
|
/* draw the text as a line always vertically centered */
|
||||||
wxPoint end( current_char_pos.x + dx, current_char_pos.y );
|
wxPoint end( current_char_pos.x + dx, current_char_pos.y );
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,33 +17,30 @@
|
||||||
#include "kicad_device_context.h"
|
#include "kicad_device_context.h"
|
||||||
#include "hotkeys_basic.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
|
void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
|
||||||
* @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 )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
PutOnGrid( &(GetBaseScreen()->m_Curseur) );
|
PutOnGrid( &(GetBaseScreen()->m_Curseur) );
|
||||||
AdjustScrollBars();
|
AdjustScrollBars();
|
||||||
|
|
||||||
#if !(defined(__WXMAC__) && defined(USE_WX_ZOOM))
|
#if !defined(__WXMAC__)
|
||||||
/* We do not use here DrawPanel->Refresh() because
|
/* DrawPanel->Refresh() is not used here because the redraw is delayed and the mouse
|
||||||
* the redraw is delayed and the mouse events (from MouseToCursorSchema ot others)
|
* events (from MouseToCursorSchema ot others) during this delay create problems: the
|
||||||
* during this delay create problems: the mouse cursor position is false in calculations.
|
* mouse cursor position is false in calculations. TODO: see exactly how the mouse
|
||||||
* TODO: see exactly how the mouse creates problems when moving during refresh
|
* creates problems when moving during refresh use Refresh() and update() do not change
|
||||||
* use Refresh() and update() do not change problems
|
* problems
|
||||||
*/
|
*/
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_DC( dc, DrawPanel );
|
||||||
|
DrawPanel->SetClipBox( dc );
|
||||||
DrawPanel->ReDraw( &dc, DrawPanel->m_DisableEraseBG ? false : true );
|
DrawPanel->ReDraw( &dc, DrawPanel->m_DisableEraseBG ? false : true );
|
||||||
#else
|
#else
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
DrawPanel->Update();
|
DrawPanel->Update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Move the mouse cursor to the on grid graphic cursor position */
|
/* Move the mouse cursor to the on grid graphic cursor position */
|
||||||
if( ToMouse == TRUE )
|
if( aWarpPointer )
|
||||||
DrawPanel->MouseToCursorSchema();
|
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 )
|
void EDA_DRAW_FRAME::Zoom_Automatique( bool move_mouse_cursor )
|
||||||
{
|
{
|
||||||
GetBaseScreen()->SetZoom( BestZoom() ); // Set the best zoom
|
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()->SetScalingFactor( bestscale );
|
||||||
GetBaseScreen()->m_Curseur = Rect.Centre();
|
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 )
|
if( id == ID_ZOOM_IN )
|
||||||
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
||||||
if( screen->SetPreviousZoom() )
|
if( screen->SetPreviousZoom() )
|
||||||
Recadre_Trace( zoom_at_cursor );
|
RedrawScreen( zoom_at_cursor );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_OUT:
|
case ID_POPUP_ZOOM_OUT:
|
||||||
|
@ -142,7 +139,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
||||||
if( id == ID_ZOOM_OUT )
|
if( id == ID_ZOOM_OUT )
|
||||||
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
||||||
if( screen->SetNextZoom() )
|
if( screen->SetNextZoom() )
|
||||||
Recadre_Trace( zoom_at_cursor );
|
RedrawScreen( zoom_at_cursor );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ZOOM_REDRAW:
|
case ID_ZOOM_REDRAW:
|
||||||
|
@ -150,7 +147,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_CENTER:
|
case ID_POPUP_ZOOM_CENTER:
|
||||||
Recadre_Trace( true );
|
RedrawScreen( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ZOOM_PAGE:
|
case ID_ZOOM_PAGE:
|
||||||
|
@ -174,7 +171,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( screen->SetZoom( screen->m_ZoomList[i] ) )
|
if( screen->SetZoom( screen->m_ZoomList[i] ) )
|
||||||
Recadre_Trace( true );
|
RedrawScreen( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
|
|
|
@ -492,7 +492,7 @@ void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
CreateScreenCmp();
|
CreateScreenCmp();
|
||||||
DrawFrame->AdjustScrollBars();
|
DrawFrame->AdjustScrollBars();
|
||||||
DrawFrame->Recadre_Trace( FALSE );
|
DrawFrame->RedrawScreen( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -236,6 +236,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: /* Drag */
|
||||||
GetScreen()->BreakSegmentsOnJunctions();
|
GetScreen()->BreakSegmentsOnJunctions();
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case BLOCK_ROTATE:
|
case BLOCK_ROTATE:
|
||||||
case BLOCK_MIRROR_X:
|
case BLOCK_MIRROR_X:
|
||||||
case BLOCK_MIRROR_Y:
|
case BLOCK_MIRROR_Y:
|
||||||
|
@ -243,6 +244,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
GetScreen()->UpdatePickList();
|
GetScreen()->UpdatePickList();
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||||
if( block->GetCount() )
|
if( block->GetCount() )
|
||||||
{
|
{
|
||||||
|
@ -297,7 +299,6 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_FLIP: /* pcbnew only! */
|
case BLOCK_FLIP: /* pcbnew only! */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case BLOCK_ZOOM: /* Window Zoom */
|
case BLOCK_ZOOM: /* Window Zoom */
|
||||||
zoom_command = true;
|
zoom_command = true;
|
||||||
break;
|
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();
|
GetScreen()->ClearDrawingState();
|
||||||
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! nextcmd )
|
if( ! nextcmd )
|
||||||
|
@ -327,7 +329,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
if( zoom_command )
|
if( zoom_command )
|
||||||
Window_Zoom( GetScreen()->m_BlockLocate );
|
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_JUNCTION_T:
|
||||||
case SCH_LINE_T:
|
case SCH_LINE_T:
|
||||||
DrawPanel->PostDirtyRect( item->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( item->GetBoundingBox() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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. */
|
/* Enable this to draw the anchor of the component. */
|
||||||
#if 0
|
#if 0
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
int len = aDc->DeviceToLogicalXRel( 3 );
|
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,
|
GRLine( &aPanel->m_ClipBox, aDc, aOffset.x, aOffset.y - len, aOffset.x,
|
||||||
aOffset.y + len, 0, aColor );
|
aOffset.y + len, 0, aColor );
|
||||||
GRLine( &aPanel->m_ClipBox, aDc, aOffset.x - len, aOffset.y, aOffset.x + len,
|
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;
|
int hotkey = 0;
|
||||||
double scalar = screen->GetScalingFactor();
|
double scalar = screen->GetScalingFactor();
|
||||||
|
|
||||||
ActiveScreen = screen;
|
|
||||||
|
|
||||||
curpos = screen->m_MousePosition;
|
curpos = screen->m_MousePosition;
|
||||||
oldpos = screen->m_Curseur;
|
oldpos = screen->m_Curseur;
|
||||||
|
|
||||||
|
@ -339,8 +337,6 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
double scalar = screen->GetScalingFactor();
|
double scalar = screen->GetScalingFactor();
|
||||||
|
|
||||||
ActiveScreen = screen;
|
|
||||||
|
|
||||||
curpos = screen->m_MousePosition;
|
curpos = screen->m_MousePosition;
|
||||||
oldpos = screen->m_Curseur;
|
oldpos = screen->m_Curseur;
|
||||||
|
|
||||||
|
@ -434,8 +430,6 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
double scalar = screen->GetScalingFactor();
|
double scalar = screen->GetScalingFactor();
|
||||||
|
|
||||||
ActiveScreen = screen;
|
|
||||||
|
|
||||||
curpos = screen->m_MousePosition;
|
curpos = screen->m_MousePosition;
|
||||||
oldpos = screen->m_Curseur;
|
oldpos = screen->m_Curseur;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
// Keys for configuration
|
// Keys for configuration
|
||||||
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )
|
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )
|
||||||
|
|
||||||
extern BASE_SCREEN* ActiveScreen;
|
|
||||||
#define WIDTH_MAX_VALUE 100
|
#define WIDTH_MAX_VALUE 100
|
||||||
#define WIDTH_MIN_VALUE 1
|
#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->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
schframe->SetSheetNumberAndCount();
|
schframe->SetSheetNumberAndCount();
|
||||||
schscreen = schframe->m_CurrentSheet->LastScreen();
|
schscreen = schframe->m_CurrentSheet->LastScreen();
|
||||||
ActiveScreen = schscreen;
|
|
||||||
}
|
}
|
||||||
else // Should not happen
|
else // Should not happen
|
||||||
return;
|
return;
|
||||||
|
@ -169,8 +167,6 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
||||||
msg += wxT( "\n" );
|
msg += wxT( "\n" );
|
||||||
m_MessagesBox->AppendText( msg );
|
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 )
|
if( m_Cmp->m_Flags == 0 )
|
||||||
m_Parent->SaveCopyInUndoList( m_Cmp, UR_CHANGED );
|
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 );
|
m_Cmp->Draw( m_Parent->DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode );
|
||||||
|
|
||||||
// Initialize field values to default values found in library:
|
// Initialize field values to default values found in library:
|
||||||
|
|
|
@ -197,7 +197,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
|
||||||
if( m_CurrentText->m_Flags == 0 )
|
if( m_CurrentText->m_Flags == 0 )
|
||||||
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
|
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();
|
text = m_textLabel->GetValue();
|
||||||
if( !text.IsEmpty() )
|
if( !text.IsEmpty() )
|
||||||
|
@ -235,7 +235,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
|
||||||
if( (m_CurrentText->m_Flags & IS_NEW) != 0 )
|
if( (m_CurrentText->m_Flags & IS_NEW) != 0 )
|
||||||
g_DefaultTextLabelSize = m_CurrentText->m_Size.x;
|
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();
|
m_Parent->DrawPanel->MouseToCursorSchema();
|
||||||
EndModal( wxID_OK );
|
EndModal( wxID_OK );
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,12 +172,11 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
sheet->LastScreen()->SetZoom( m_Parent->GetScreen()->GetZoom() );
|
sheet->LastScreen()->SetZoom( m_Parent->GetScreen()->GetZoom() );
|
||||||
*m_Parent->m_CurrentSheet = *sheet;
|
*m_Parent->m_CurrentSheet = *sheet;
|
||||||
ActiveScreen = m_Parent->m_CurrentSheet->LastScreen();
|
|
||||||
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
sheet->LastScreen()->m_Curseur = pos;
|
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_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
|
||||||
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
|
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
|
||||||
wxString PlotFileName;
|
wxString PlotFileName;
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
|
@ -168,27 +167,29 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
|
||||||
{
|
{
|
||||||
if( sheetpath == NULL )
|
if( sheetpath == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
list.Clear();
|
list.Clear();
|
||||||
|
|
||||||
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
||||||
{
|
{
|
||||||
schframe->m_CurrentSheet = &list;
|
schframe->m_CurrentSheet = &list;
|
||||||
schframe->m_CurrentSheet->UpdateAllScreenReferences();
|
schframe->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
schframe->SetSheetNumberAndCount();
|
schframe->SetSheetNumberAndCount();
|
||||||
screen = schframe->m_CurrentSheet->LastScreen();
|
screen = schframe->m_CurrentSheet->LastScreen();
|
||||||
ActiveScreen = screen;
|
|
||||||
}
|
}
|
||||||
else // Should not happen
|
else // Should not happen
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sheetpath = SheetList.GetNext();
|
sheetpath = SheetList.GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotSheet = screen->m_CurrentSheetDesc;
|
PlotSheet = screen->m_CurrentSheetDesc;
|
||||||
double scale = 10;
|
double scale = 10;
|
||||||
|
|
||||||
plot_offset.x = 0;
|
plot_offset.x = 0;
|
||||||
plot_offset.y = 0;
|
plot_offset.y = 0;
|
||||||
|
|
||||||
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(
|
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
|
||||||
".dxf" );
|
|
||||||
|
|
||||||
PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale );
|
PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale );
|
||||||
|
|
||||||
|
@ -196,7 +197,6 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveScreen = oldscreen;
|
|
||||||
schframe->m_CurrentSheet = oldsheetpath;
|
schframe->m_CurrentSheet = oldsheetpath;
|
||||||
schframe->m_CurrentSheet->UpdateAllScreenReferences();
|
schframe->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
schframe->SetSheetNumberAndCount();
|
schframe->SetSheetNumberAndCount();
|
||||||
|
@ -204,10 +204,10 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
|
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
|
||||||
SCH_SCREEN* screen,
|
SCH_SCREEN* screen,
|
||||||
Ki_PageDescr* sheet,
|
Ki_PageDescr* sheet,
|
||||||
wxPoint plot_offset,
|
wxPoint plot_offset,
|
||||||
double scale )
|
double scale )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
|
|
@ -208,6 +208,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( )
|
||||||
EESCHEMA_INTERNAL_UNIT);
|
EESCHEMA_INTERNAL_UNIT);
|
||||||
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
|
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
|
||||||
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 )
|
if( g_HPGL_Pen_Descr.m_Pen_Diam < 1 )
|
||||||
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( )
|
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenSpeed( )
|
||||||
{
|
{
|
||||||
g_HPGL_Pen_Descr.m_Pen_Speed = m_penSpeedCtrl->GetValue();
|
g_HPGL_Pen_Descr.m_Pen_Speed = m_penSpeedCtrl->GetValue();
|
||||||
|
|
||||||
if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
|
if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
|
||||||
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 )
|
if( g_HPGL_Pen_Descr.m_Pen_Speed < 1 )
|
||||||
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( )
|
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenNum( )
|
||||||
{
|
{
|
||||||
g_HPGL_Pen_Descr.m_Pen_Num = m_penNumCtrl->GetValue();
|
g_HPGL_Pen_Descr.m_Pen_Num = m_penNumCtrl->GetValue();
|
||||||
|
|
||||||
if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
|
if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
|
||||||
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 )
|
if( g_HPGL_Pen_Descr.m_Pen_Num < 1 )
|
||||||
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
|
* selected sheet
|
||||||
*/
|
*/
|
||||||
void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( BASE_SCREEN* screen,
|
void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( BASE_SCREEN* screen,
|
||||||
wxSize& SheetSize,
|
wxSize& SheetSize,
|
||||||
wxPoint& SheetOffset )
|
wxPoint& SheetOffset )
|
||||||
{
|
{
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
|
|
||||||
|
@ -277,7 +282,6 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
|
||||||
{
|
{
|
||||||
wxString PlotFileName;
|
wxString PlotFileName;
|
||||||
SCH_SCREEN* screen = m_Parent->GetScreen();
|
SCH_SCREEN* screen = m_Parent->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
|
||||||
SCH_SHEET_PATH* sheetpath, * oldsheetpath = m_Parent->GetSheet();
|
SCH_SHEET_PATH* sheetpath, * oldsheetpath = m_Parent->GetSheet();
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
wxSize SheetSize;
|
wxSize SheetSize;
|
||||||
|
@ -300,46 +304,47 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
|
||||||
{
|
{
|
||||||
if( sheetpath == NULL )
|
if( sheetpath == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
list.Clear();
|
list.Clear();
|
||||||
|
|
||||||
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
||||||
{
|
{
|
||||||
m_Parent->m_CurrentSheet = &list;
|
m_Parent->m_CurrentSheet = &list;
|
||||||
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
m_Parent->SetSheetNumberAndCount();
|
m_Parent->SetSheetNumberAndCount();
|
||||||
screen = m_Parent->m_CurrentSheet->LastScreen();
|
screen = m_Parent->m_CurrentSheet->LastScreen();
|
||||||
ActiveScreen = screen;
|
|
||||||
}
|
}
|
||||||
else // Should not happen
|
else // Should not happen
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sheetpath = SheetList.GetNext();
|
sheetpath = SheetList.GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnSheetDims( screen, SheetSize, SheetOffset );
|
ReturnSheetDims( screen, SheetSize, SheetOffset );
|
||||||
|
|
||||||
/* Calculation of conversion scales. */
|
/* Calculation of conversion scales. */
|
||||||
if( HPGL_SheetSize )
|
if( HPGL_SheetSize )
|
||||||
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
|
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
|
||||||
else
|
else
|
||||||
PlotSheet = screen->m_CurrentSheetDesc;
|
PlotSheet = screen->m_CurrentSheetDesc;
|
||||||
|
|
||||||
/* 10x because eeschema works in mils, not decimals */
|
/* 10x because eeschema works in mils, not decimals */
|
||||||
double plot_scale = 10 * (double) PlotSheet->m_Size.x /
|
double plot_scale = 10 * (double) PlotSheet->m_Size.x / (double) SheetSize.x;
|
||||||
(double) SheetSize.x;
|
|
||||||
|
|
||||||
/* Calculate offsets */
|
/* Calculate offsets */
|
||||||
PlotOffset.x = -SheetOffset.x;
|
PlotOffset.x = -SheetOffset.x;
|
||||||
PlotOffset.y = -SheetOffset.y;
|
PlotOffset.y = -SheetOffset.y;
|
||||||
|
|
||||||
PlotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() +
|
PlotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" );
|
||||||
wxT( ".plt" );
|
|
||||||
|
|
||||||
SetLocaleTo_C_standard();
|
SetLocaleTo_C_standard();
|
||||||
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset,
|
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset, plot_scale );
|
||||||
plot_scale );
|
|
||||||
SetLocaleTo_Default();
|
SetLocaleTo_Default();
|
||||||
|
|
||||||
if( !aPlotAll )
|
if( !aPlotAll )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveScreen = oldscreen;
|
|
||||||
m_Parent->m_CurrentSheet = oldsheetpath;
|
m_Parent->m_CurrentSheet = oldsheetpath;
|
||||||
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
m_Parent->SetSheetNumberAndCount();
|
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,
|
void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
|
||||||
SCH_SCREEN* screen,
|
SCH_SCREEN* screen,
|
||||||
Ki_PageDescr* sheet,
|
Ki_PageDescr* sheet,
|
||||||
wxPoint& offset,
|
wxPoint& offset,
|
||||||
double plot_scale )
|
double plot_scale )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
@ -383,6 +388,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
|
||||||
plotter->start_plot( output_file );
|
plotter->start_plot( output_file );
|
||||||
|
|
||||||
plotter->set_color( BLACK );
|
plotter->set_color( BLACK );
|
||||||
|
|
||||||
if( m_plot_Sheet_Ref )
|
if( m_plot_Sheet_Ref )
|
||||||
m_Parent->PlotWorkSheet( plotter, screen );
|
m_Parent->PlotWorkSheet( plotter, screen );
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,6 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
|
||||||
void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
|
void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = m_Parent->GetScreen();
|
SCH_SCREEN* screen = m_Parent->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
|
||||||
SCH_SHEET_PATH* sheetpath;
|
SCH_SHEET_PATH* sheetpath;
|
||||||
SCH_SHEET_PATH* oldsheetpath = m_Parent->GetSheet(); // sheetpath is saved here
|
SCH_SHEET_PATH* oldsheetpath = m_Parent->GetSheet(); // sheetpath is saved here
|
||||||
wxString plotFileName;
|
wxString plotFileName;
|
||||||
|
@ -198,20 +197,24 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
|
||||||
{
|
{
|
||||||
if( sheetpath == NULL )
|
if( sheetpath == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
list.Clear();
|
list.Clear();
|
||||||
|
|
||||||
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
||||||
{
|
{
|
||||||
m_Parent->m_CurrentSheet = &list;
|
m_Parent->m_CurrentSheet = &list;
|
||||||
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
m_Parent->SetSheetNumberAndCount();
|
m_Parent->SetSheetNumberAndCount();
|
||||||
screen = m_Parent->m_CurrentSheet->LastScreen();
|
screen = m_Parent->m_CurrentSheet->LastScreen();
|
||||||
ActiveScreen = screen;
|
|
||||||
}
|
}
|
||||||
else // Should not happen
|
else // Should not happen
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sheetpath = SheetList.GetNext();
|
sheetpath = SheetList.GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
actualPage = screen->m_CurrentSheetDesc;
|
actualPage = screen->m_CurrentSheetDesc;
|
||||||
|
|
||||||
switch( m_pageSizeSelect )
|
switch( m_pageSizeSelect )
|
||||||
{
|
{
|
||||||
case PAGE_SIZE_A:
|
case PAGE_SIZE_A:
|
||||||
|
@ -243,7 +246,6 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveScreen = oldscreen;
|
|
||||||
m_Parent->m_CurrentSheet = oldsheetpath;
|
m_Parent->m_CurrentSheet = oldsheetpath;
|
||||||
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
m_Parent->SetSheetNumberAndCount();
|
m_Parent->SetSheetNumberAndCount();
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
bool HasPage( int page );
|
bool HasPage( int page );
|
||||||
bool OnBeginDocument( int startPage, int endPage );
|
bool OnBeginDocument( int startPage, int endPage );
|
||||||
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo );
|
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 );
|
parent->AppendMsgPanel( msg, wxEmptyString, CYAN );
|
||||||
|
|
||||||
SCH_SCREEN* screen = parent->GetScreen();
|
SCH_SCREEN* screen = parent->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
|
||||||
SCH_SHEET_PATH* oldsheetpath = parent->GetSheet();
|
SCH_SHEET_PATH* oldsheetpath = parent->GetSheet();
|
||||||
SCH_SHEET_PATH list;
|
SCH_SHEET_PATH list;
|
||||||
SCH_SHEET_LIST SheetList( NULL );
|
SCH_SHEET_LIST SheetList( NULL );
|
||||||
|
@ -248,9 +247,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
|
||||||
if( screen == NULL )
|
if( screen == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ActiveScreen = screen;
|
DrawPage( screen );
|
||||||
DrawPage();
|
|
||||||
ActiveScreen = oldscreen;
|
|
||||||
parent->m_CurrentSheet = oldsheetpath;
|
parent->m_CurrentSheet = oldsheetpath;
|
||||||
parent->m_CurrentSheet->UpdateAllScreenReferences();
|
parent->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
parent->SetSheetNumberAndCount();
|
parent->SetSheetNumberAndCount();
|
||||||
|
@ -259,8 +256,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage,
|
void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo )
|
||||||
int* selPageFrom, int* selPageTo )
|
|
||||||
{
|
{
|
||||||
*minPage = *selPageFrom = 1;
|
*minPage = *selPageFrom = 1;
|
||||||
*maxPage = *selPageTo = g_RootSheet->CountSheets();
|
*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
|
* This is the real print function: print the active screen
|
||||||
*/
|
*/
|
||||||
void SCH_PRINTOUT::DrawPage()
|
void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
|
||||||
{
|
{
|
||||||
int oldZoom;
|
int oldZoom;
|
||||||
wxPoint tmp_startvisu;
|
wxPoint tmp_startvisu;
|
||||||
|
@ -321,15 +317,12 @@ void SCH_PRINTOUT::DrawPage()
|
||||||
wxBusyCursor dummy;
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
/* Save current scale factor, offsets, and clip box. */
|
/* Save current scale factor, offsets, and clip box. */
|
||||||
tmp_startvisu = ActiveScreen->m_StartVisu;
|
tmp_startvisu = aScreen->m_StartVisu;
|
||||||
oldZoom = ActiveScreen->GetZoom();
|
oldZoom = aScreen->GetZoom();
|
||||||
old_org = ActiveScreen->m_DrawOrg;
|
old_org = aScreen->m_DrawOrg;
|
||||||
oldClipBox = panel->m_ClipBox;
|
oldClipBox = panel->m_ClipBox;
|
||||||
|
|
||||||
/* Change scale factor, offsets, and clip box to print the whole page. */
|
/* 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.SetOrigin( wxPoint( 0, 0 ) );
|
||||||
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
|
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
|
||||||
|
|
||||||
|
@ -343,8 +336,9 @@ void SCH_PRINTOUT::DrawPage()
|
||||||
wxBitmap psuedoBitmap( 1, 1 );
|
wxBitmap psuedoBitmap( 1, 1 );
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
memDC.SelectObject( psuedoBitmap );
|
memDC.SelectObject( psuedoBitmap );
|
||||||
( (SCH_SCREEN*) ActiveScreen )->Draw( panel, &memDC, GR_DEFAULT_DRAWMODE );
|
aScreen->Draw( panel, &memDC, GR_DEFAULT_DRAWMODE );
|
||||||
parent->TraceWorkSheet( &memDC, ActiveScreen, g_DrawDefaultLineThickness );
|
parent->TraceWorkSheet( &memDC, aScreen, g_DrawDefaultLineThickness );
|
||||||
|
|
||||||
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
|
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
|
||||||
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
|
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
|
||||||
|
|
||||||
|
@ -356,7 +350,7 @@ void SCH_PRINTOUT::DrawPage()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size;
|
SheetSize = aScreen->m_CurrentSheetDesc->m_Size;
|
||||||
FitThisSizeToPaper( SheetSize );
|
FitThisSizeToPaper( SheetSize );
|
||||||
fitRect = GetLogicalPaperRect();
|
fitRect = GetLogicalPaperRect();
|
||||||
}
|
}
|
||||||
|
@ -369,21 +363,22 @@ void SCH_PRINTOUT::DrawPage()
|
||||||
if( parent->GetPrintMonochrome() )
|
if( parent->GetPrintMonochrome() )
|
||||||
GRForceBlackPen( true );
|
GRForceBlackPen( true );
|
||||||
|
|
||||||
ActiveScreen->m_IsPrinting = true;
|
aScreen->m_IsPrinting = true;
|
||||||
|
|
||||||
int bg_color = g_DrawBgColor;
|
int bg_color = g_DrawBgColor;
|
||||||
|
|
||||||
( ( SCH_SCREEN* ) ActiveScreen )->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
|
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
|
||||||
|
|
||||||
if( printReference )
|
if( printReference )
|
||||||
parent->TraceWorkSheet( dc, ActiveScreen, g_DrawDefaultLineThickness );
|
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness );
|
||||||
|
|
||||||
g_DrawBgColor = bg_color;
|
g_DrawBgColor = bg_color;
|
||||||
ActiveScreen->m_IsPrinting = false;
|
aScreen->m_IsPrinting = false;
|
||||||
panel->m_ClipBox = oldClipBox;
|
panel->m_ClipBox = oldClipBox;
|
||||||
|
|
||||||
GRForceBlackPen( false );
|
GRForceBlackPen( false );
|
||||||
|
|
||||||
ActiveScreen->m_StartVisu = tmp_startvisu;
|
aScreen->m_StartVisu = tmp_startvisu;
|
||||||
ActiveScreen->m_DrawOrg = old_org;
|
aScreen->m_DrawOrg = old_org;
|
||||||
ActiveScreen->SetZoom( oldZoom );
|
aScreen->SetZoom( oldZoom );
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,6 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
if( GetScreen() == NULL )
|
if( GetScreen() == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActiveScreen = GetScreen();
|
|
||||||
|
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
|
|
||||||
GetScreen()->Draw( DrawPanel, DC, GR_DEFAULT_DRAWMODE );
|
GetScreen()->Draw( DrawPanel, DC, GR_DEFAULT_DRAWMODE );
|
||||||
|
|
|
@ -159,7 +159,6 @@ bool WinEDA_App::OnInit()
|
||||||
SetupServerFunction( RemoteCommand );
|
SetupServerFunction( RemoteCommand );
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveScreen = frame->GetScreen();
|
|
||||||
frame->Zoom_Automatique( TRUE );
|
frame->Zoom_Automatique( TRUE );
|
||||||
|
|
||||||
/* Load file specified in the command line. */
|
/* 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 )
|
if( !curr_item || curr_item->m_Flags )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
switch( curr_item->Type() )
|
switch( curr_item->Type() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,13 +61,12 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
|
||||||
{
|
{
|
||||||
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
||||||
*m_CurrentSheet = *sheetFoundIn;
|
*m_CurrentSheet = *sheetFoundIn;
|
||||||
ActiveScreen = m_CurrentSheet->LastScreen();
|
|
||||||
m_CurrentSheet->UpdateAllScreenReferences();
|
m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
sheetFoundIn->LastScreen()->m_Curseur = lastMarker->m_Pos;
|
sheetFoundIn->LastScreen()->m_Curseur = lastMarker->m_Pos;
|
||||||
|
|
||||||
Recadre_Trace( TRUE );
|
RedrawScreen( TRUE );
|
||||||
|
|
||||||
wxString path = sheetFoundIn->Path();
|
wxString path = sheetFoundIn->Path();
|
||||||
wxString units = GetAbbreviatedUnitsLabel();
|
wxString units = GetAbbreviatedUnitsLabel();
|
||||||
|
@ -184,7 +183,6 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
|
||||||
{
|
{
|
||||||
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
||||||
*m_CurrentSheet = *sheet;
|
*m_CurrentSheet = *sheet;
|
||||||
ActiveScreen = m_CurrentSheet->LastScreen();
|
|
||||||
m_CurrentSheet->UpdateAllScreenReferences();
|
m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
DoCenterAndRedraw = TRUE;
|
DoCenterAndRedraw = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -215,10 +213,10 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
|
||||||
#undef MARGIN
|
#undef MARGIN
|
||||||
|
|
||||||
if( DoCenterAndRedraw )
|
if( DoCenterAndRedraw )
|
||||||
Recadre_Trace( mouseWarp );
|
RedrawScreen( mouseWarp );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
||||||
DrawPanel->CursorOff( &dc );
|
DrawPanel->CursorOff( &dc );
|
||||||
|
@ -329,13 +327,12 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& event )
|
||||||
{
|
{
|
||||||
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
||||||
*m_CurrentSheet = *sheetFoundIn;
|
*m_CurrentSheet = *sheetFoundIn;
|
||||||
ActiveScreen = m_CurrentSheet->LastScreen();
|
|
||||||
m_CurrentSheet->UpdateAllScreenReferences();
|
m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
// sheetFoundIn->LastScreen()->m_Curseur = lastItem->GetBoundingBox().Centre();
|
// sheetFoundIn->LastScreen()->m_Curseur = lastItem->GetBoundingBox().Centre();
|
||||||
sheetFoundIn->LastScreen()->m_Curseur = lastItemPosition;
|
sheetFoundIn->LastScreen()->m_Curseur = lastItemPosition;
|
||||||
Recadre_Trace( true );
|
RedrawScreen( true );
|
||||||
|
|
||||||
msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable();
|
msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable();
|
||||||
SetStatusText( msg );
|
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 );
|
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
|
||||||
else
|
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
|
// switch from normal mode to xor mode for the duration of the move, first
|
||||||
// by erasing fully any "normal drawing mode" primitives with the
|
// 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.
|
// subsequent xor drawing modes will fully erase this first copy.
|
||||||
|
|
||||||
Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
|
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 );
|
Component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
|
||||||
|
|
||||||
|
|
|
@ -260,16 +260,14 @@ void SCH_EDIT_FRAME::InstallPreviousSheet()
|
||||||
ClearMsgPanel();
|
ClearMsgPanel();
|
||||||
|
|
||||||
//make a copy for testing purposes.
|
//make a copy for testing purposes.
|
||||||
SCH_SHEET_PATH listtemp = *m_CurrentSheet;
|
m_CurrentSheet->Pop();
|
||||||
listtemp.Pop();
|
|
||||||
|
|
||||||
if( listtemp.LastScreen() == NULL )
|
if( m_CurrentSheet->LastScreen() == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "InstallPreviousScreen() Error: Sheet not found" ) );
|
DisplayError( this, wxT( "InstallPreviousScreen() Error: Sheet not found" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_CurrentSheet->Pop();
|
|
||||||
UpdateScreenFromSheet( this );
|
UpdateScreenFromSheet( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +284,7 @@ void SCH_EDIT_FRAME::InstallNextScreen( SCH_SHEET* Sheet )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "InstallNextScreen() error" ) ); return;
|
DisplayError( this, wxT( "InstallNextScreen() error" ) ); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_CurrentSheet->Push( Sheet );
|
m_CurrentSheet->Push( Sheet );
|
||||||
m_itemToRepeat = NULL;
|
m_itemToRepeat = NULL;
|
||||||
ClearMsgPanel();
|
ClearMsgPanel();
|
||||||
|
@ -298,41 +297,33 @@ void SCH_EDIT_FRAME::InstallNextScreen( SCH_SHEET* Sheet )
|
||||||
*/
|
*/
|
||||||
static bool UpdateScreenFromSheet( SCH_EDIT_FRAME* frame )
|
static bool UpdateScreenFromSheet( SCH_EDIT_FRAME* frame )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* NewScreen;
|
if( !frame->m_CurrentSheet->LastScreen() )
|
||||||
|
|
||||||
NewScreen = frame->m_CurrentSheet->LastScreen();
|
|
||||||
if( !NewScreen )
|
|
||||||
{
|
{
|
||||||
DisplayError( frame, wxT( "Screen not found for this sheet" ) );
|
DisplayError( frame, wxT( "Screen not found for this sheet" ) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCH_SCREEN* screen = frame->m_CurrentSheet->LastScreen();
|
||||||
|
|
||||||
// Reset display settings of the new screen
|
// Reset display settings of the new screen
|
||||||
// Assumes m_CurrentSheet has already been updated.
|
// Assumes m_CurrentSheet has already been updated.
|
||||||
frame->ClearMsgPanel();
|
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
|
// update the References
|
||||||
frame->m_CurrentSheet->UpdateAllScreenReferences();
|
frame->m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
frame->SetSheetNumberAndCount();
|
frame->SetSheetNumberAndCount();
|
||||||
frame->DrawPanel->m_CanStartBlock = -1;
|
frame->DrawPanel->m_CanStartBlock = -1;
|
||||||
ActiveScreen = frame->m_CurrentSheet->LastScreen();
|
|
||||||
|
|
||||||
if( NewScreen->m_FirstRedraw )
|
if( screen->m_FirstRedraw )
|
||||||
{
|
{
|
||||||
NewScreen->m_FirstRedraw = FALSE;
|
screen->m_FirstRedraw = false;
|
||||||
frame->Zoom_Automatique( TRUE );
|
frame->Zoom_Automatique( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frame->DrawPanel->MouseToCursorSchema();
|
frame->DrawPanel->MouseToCursorSchema();
|
||||||
|
frame->RedrawScreen( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
frame->DrawPanel->Refresh();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,8 +198,6 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
if( GetScreen() == NULL )
|
if( GetScreen() == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActiveScreen = GetScreen();
|
|
||||||
|
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
|
|
||||||
if( m_component )
|
if( m_component )
|
||||||
|
|
|
@ -640,7 +640,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
@ -928,6 +928,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
if( m_ID_current_state == 0 )
|
if( m_ID_current_state == 0 )
|
||||||
m_lastDrawItem = NULL;
|
m_lastDrawItem = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1072,7 +1073,7 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
|
||||||
wxCHECK_RET( m_component != NULL,
|
wxCHECK_RET( m_component != NULL,
|
||||||
wxT( "Cannot create new part from non-existant current part." ) );
|
wxT( "Cannot create new part from non-existant current part." ) );
|
||||||
|
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
DrawPanel->CursorOff( &dc );
|
DrawPanel->CursorOff( &dc );
|
||||||
EditField( &dc, &m_component->GetValueField() );
|
EditField( &dc, &m_component->GetValueField() );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
|
|
@ -167,7 +167,7 @@ void DeleteStruct( EDA_DRAW_PANEL* panel, wxDC* DC, SCH_ITEM* DrawStruct )
|
||||||
{
|
{
|
||||||
screen->RemoveFromDrawList( DrawStruct );
|
screen->RemoveFromDrawList( DrawStruct );
|
||||||
|
|
||||||
panel->PostDirtyRect( DrawStruct->GetBoundingBox() );
|
panel->RefreshDrawingRect( DrawStruct->GetBoundingBox() );
|
||||||
|
|
||||||
/* Unlink the structure */
|
/* Unlink the structure */
|
||||||
DrawStruct->SetNext( 0 );
|
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 */
|
#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;
|
m_numSheets = d1.m_numSheets;
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for( i = 0; i < m_numSheets; i++ )
|
for( i = 0; i < m_numSheets; i++ )
|
||||||
{
|
|
||||||
m_sheets[i] = d1.m_sheets[i];
|
m_sheets[i] = d1.m_sheets[i];
|
||||||
}
|
|
||||||
|
|
||||||
for( ; i < DSLSZ; i++ )
|
for( ; i < DSLSZ; i++ )
|
||||||
{
|
|
||||||
m_sheets[i] = 0;
|
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 */
|
/* 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()
|
void SCH_SHEET_LIST::AnnotatePowerSymbols()
|
||||||
{
|
{
|
||||||
int ref = 1;
|
int ref = 1;
|
||||||
|
|
|
@ -240,11 +240,11 @@ public:
|
||||||
SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem,
|
SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem,
|
||||||
wxPoint * aFindLocation );
|
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;
|
bool operator!=( const SCH_SHEET_PATH& d1 ) const { return !( *this == d1 ) ; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -336,6 +336,15 @@ public:
|
||||||
*/
|
*/
|
||||||
SCH_SHEET_PATH* GetSheet( int aIndex );
|
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
|
* Function AnnotatePowerSymbols
|
||||||
* clear and annotates the entire hierarchy of the sheet path list.
|
* 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_HIERARCHY:
|
case ID_HIERARCHY:
|
||||||
|
@ -403,7 +404,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
SaveCopyInUndoList( sheet, UR_CHANGED );
|
SaveCopyInUndoList( sheet, UR_CHANGED );
|
||||||
sheet->CleanupSheet();
|
sheet->CleanupSheet();
|
||||||
OnModify();
|
OnModify();
|
||||||
DrawPanel->PostDirtyRect( sheet->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( sheet->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -346,23 +346,12 @@ void SCH_EDIT_FRAME::CreateScreens()
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
{
|
{
|
||||||
SCH_SHEET_PATH* sheet;
|
if( m_LibeditFrame && !m_LibeditFrame->Close() ) // Can close component editor?
|
||||||
|
return;
|
||||||
if( m_LibeditFrame ) // Can close component editor ?
|
|
||||||
{
|
|
||||||
if( !m_LibeditFrame->Close() )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SCH_SHEET_LIST SheetList;
|
SCH_SHEET_LIST SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
if( SheetList.IsModified() )
|
||||||
{
|
|
||||||
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sheet )
|
|
||||||
{
|
{
|
||||||
wxMessageDialog dialog( this,
|
wxMessageDialog dialog( this,
|
||||||
_( "Schematic modified, Save before exit ?" ),
|
_( "Schematic modified, Save before exit ?" ),
|
||||||
|
@ -385,15 +374,7 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst();
|
SheetList.ClearModifyStatus();
|
||||||
sheet != NULL;
|
|
||||||
sheet = SheetList.GetNext() )
|
|
||||||
{
|
|
||||||
if( sheet->LastScreen() )
|
|
||||||
{
|
|
||||||
sheet->LastScreen()->ClrModify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !g_RootSheet->GetScreen()->GetFileName().IsEmpty()
|
if( !g_RootSheet->GetScreen()->GetFileName().IsEmpty()
|
||||||
&& (g_RootSheet->GetScreen()->GetDrawItems() != NULL) )
|
&& (g_RootSheet->GetScreen()->GetDrawItems() != NULL) )
|
||||||
|
@ -733,7 +714,6 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
||||||
wxT( "Library Editor" ),
|
wxT( "Library Editor" ),
|
||||||
wxPoint( -1, -1 ),
|
wxPoint( -1, -1 ),
|
||||||
wxSize( 600, 400 ) );
|
wxSize( 600, 400 ) );
|
||||||
ActiveScreen = GetBaseScreen();
|
|
||||||
m_LibeditFrame->AdjustScrollBars();
|
m_LibeditFrame->AdjustScrollBars();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ void SCH_EDIT_FRAME::DeleteSheetLabel( bool aRedraw, SCH_SHEET_PIN* aSheetLabelT
|
||||||
parent->RemoveLabel( aSheetLabelToDel );
|
parent->RemoveLabel( aSheetLabelToDel );
|
||||||
|
|
||||||
if( aRedraw )
|
if( aRedraw )
|
||||||
DrawPanel->PostDirtyRect( parent->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( parent->GetBoundingBox() );
|
||||||
|
|
||||||
|
|
||||||
#if 0 && defined(DEBUG)
|
#if 0 && defined(DEBUG)
|
||||||
|
|
|
@ -237,6 +237,6 @@ void LIB_EDIT_FRAME::PlaceAncre()
|
||||||
|
|
||||||
/* Redraw the symbol */
|
/* Redraw the symbol */
|
||||||
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
|
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
|
||||||
Recadre_Trace( TRUE );
|
RedrawScreen( TRUE );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,8 +259,6 @@ void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
|
|
||||||
ActiveScreen = GetScreen();
|
|
||||||
|
|
||||||
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
|
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
|
||||||
|
|
||||||
if( lib == NULL )
|
if( lib == NULL )
|
||||||
|
|
|
@ -78,11 +78,10 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
|
|
||||||
wxBusyCursor dummy;
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
ActiveScreen = screen;
|
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_COPY );
|
GRSetDrawMode( DC, GR_COPY );
|
||||||
|
|
||||||
int drawMode = -1;
|
int drawMode = -1;
|
||||||
|
|
||||||
switch ( GetDisplayMode() )
|
switch ( GetDisplayMode() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -117,6 +117,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_DC( dc, DrawPanel );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_EXIT:
|
case ID_EXIT:
|
||||||
|
|
|
@ -96,8 +96,6 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
wxFileName filename = aFullFileName;
|
wxFileName filename = aFullFileName;
|
||||||
wxString currentPath;
|
wxString currentPath;
|
||||||
|
|
||||||
ActiveScreen = GetScreen();
|
|
||||||
|
|
||||||
if( ! filename.IsOk() )
|
if( ! filename.IsOk() )
|
||||||
{
|
{
|
||||||
/* Standard gerber filetypes
|
/* Standard gerber filetypes
|
||||||
|
@ -197,14 +195,11 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
* 0 if file not read (cancellation of order ...)
|
* 0 if file not read (cancellation of order ...)
|
||||||
* 1 if OK
|
* 1 if OK
|
||||||
*/
|
*/
|
||||||
static void LoadDCodeFile( WinEDA_GerberFrame* frame,
|
static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName )
|
||||||
const wxString& FullFileName )
|
|
||||||
{
|
{
|
||||||
wxString wildcard;
|
wxString wildcard;
|
||||||
wxFileName fn = FullFileName;
|
wxFileName fn = FullFileName;
|
||||||
|
|
||||||
ActiveScreen = frame->GetScreen();
|
|
||||||
|
|
||||||
if( !fn.IsOk() )
|
if( !fn.IsOk() )
|
||||||
{
|
{
|
||||||
wildcard.Printf( _( "Gerber DCODE files (%s)|*.%s" ),
|
wildcard.Printf( _( "Gerber DCODE files (%s)|*.%s" ),
|
||||||
|
|
|
@ -152,7 +152,6 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SetBaseScreen( ScreenPcb );
|
SetBaseScreen( ScreenPcb );
|
||||||
ActiveScreen = ScreenPcb;
|
|
||||||
|
|
||||||
SetBoard( new BOARD( NULL, this ) );
|
SetBoard( new BOARD( NULL, this ) );
|
||||||
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
|
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
|
||||||
|
|
|
@ -93,7 +93,6 @@ bool WinEDA_App::OnInit()
|
||||||
}
|
}
|
||||||
ScreenPcb = new PCB_SCREEN();
|
ScreenPcb = new PCB_SCREEN();
|
||||||
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
|
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
|
||||||
ActiveScreen = ScreenPcb;
|
|
||||||
|
|
||||||
// read current setup and reopen last directory if no filename to open in
|
// read current setup and reopen last directory if no filename to open in
|
||||||
// command line
|
// command line
|
||||||
|
|
|
@ -44,7 +44,7 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
|
||||||
GetBoard()->m_NbNodes = 0;
|
GetBoard()->m_NbNodes = 0;
|
||||||
GetBoard()->m_NbNoconnect = 0;
|
GetBoard()->m_NbNoconnect = 0;
|
||||||
|
|
||||||
SetBaseScreen( ActiveScreen = ScreenPcb );
|
SetBaseScreen( ScreenPcb );
|
||||||
GetScreen()->Init();
|
GetScreen()->Init();
|
||||||
setActiveLayer(LAYER_N_BACK);
|
setActiveLayer(LAYER_N_BACK);
|
||||||
syncLayerBox();
|
syncLayerBox();
|
||||||
|
|
|
@ -62,7 +62,6 @@ public:
|
||||||
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
|
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
|
||||||
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
|
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
|
||||||
wxPoint m_MousePosition; /* Mouse cursor coordinate (off 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)
|
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
|
||||||
* in user units.
|
* in user units.
|
||||||
* (coordinates from last reset position)*/
|
* (coordinates from last reset position)*/
|
||||||
|
@ -165,13 +164,6 @@ public:
|
||||||
wxSize ReturnPageSize( void );
|
wxSize ReturnPageSize( void );
|
||||||
virtual int GetInternalUnits( 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.
|
* Return the current cursor position in drawing coordinates.
|
||||||
*
|
*
|
||||||
|
@ -301,16 +293,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetZoomList( const wxArrayInt& aZoomList );
|
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 SetNextZoom();
|
||||||
bool SetPreviousZoom();
|
bool SetPreviousZoom();
|
||||||
bool SetFirstZoom();
|
bool SetFirstZoom();
|
||||||
|
|
|
@ -89,7 +89,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPaint( wxPaintEvent& event );
|
void OnPaint( wxPaintEvent& event );
|
||||||
void OnSize( wxSizeEvent& event );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DrawBackGround
|
* Function DrawBackGround
|
||||||
|
@ -128,7 +127,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void DrawGridAxis( wxDC* aDC, int aDrawMode );
|
void DrawGridAxis( wxDC* aDC, int aDrawMode );
|
||||||
|
|
||||||
void OnEraseBackground( wxEraseEvent& event );
|
void OnEraseBackground( wxEraseEvent& event ) { }
|
||||||
|
|
||||||
void OnActivate( wxActivateEvent& event );
|
void OnActivate( wxActivateEvent& event );
|
||||||
|
|
||||||
|
@ -141,7 +140,7 @@ public:
|
||||||
* update the boundary box. If wxDC coordinate manipulation is used, then
|
* update the boundary box. If wxDC coordinate manipulation is used, then
|
||||||
* the scale factor and drawing logical offset is set. Then the base
|
* 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
|
* 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
|
* manipulation using wxDC LogicalToDeviceXXX and DeviceToLogixalXXX
|
||||||
* methods. This gets called automatically for a paint event. If you do
|
* methods. This gets called automatically for a paint event. If you do
|
||||||
* any drawing outside the paint event, you must call DoPrepareDC manually.
|
* any drawing outside the paint event, you must call DoPrepareDC manually.
|
||||||
|
@ -150,6 +149,18 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void DoPrepareDC(wxDC& dc);
|
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 */
|
/* Mouse and keys events */
|
||||||
void OnMouseWheel( wxMouseEvent& event );
|
void OnMouseWheel( wxMouseEvent& event );
|
||||||
void OnMouseEvent( wxMouseEvent& event );
|
void OnMouseEvent( wxMouseEvent& event );
|
||||||
|
@ -171,7 +182,22 @@ public:
|
||||||
void Process_Special_Functions( wxCommandEvent& event );
|
void Process_Special_Functions( wxCommandEvent& event );
|
||||||
|
|
||||||
bool IsPointOnDisplay( wxPoint ref_pos );
|
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 );
|
void ReDraw( wxDC* DC, bool erasebg = TRUE );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,40 +209,18 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function CursorScreenPosition
|
* 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();
|
wxPoint CursorScreenPosition();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PostDirtyRect
|
* Function RefreshDrawingRect
|
||||||
* appends the given rectangle in pcb units to the DrawPanel's invalid
|
* redraws the contents of \a aRect in drawing units. \a aRect is converted to
|
||||||
* region list so that very soon (but not immediately), this rectangle
|
* screen coordinates and wxWindow::RefreshRect() is called to repaint the region.
|
||||||
* along with any other recently posted rectangles is redrawn. Conversion
|
* @param aRect The rectangle to repaint.
|
||||||
* to pixels is done in here.
|
* @param aEraseBackground Erases the background if true.
|
||||||
* @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 );
|
void RefreshDrawingRect( const EDA_Rect& aRect, bool aEraseBackground = true );
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
void ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition );
|
|
||||||
|
|
||||||
wxPoint GetScreenCenterRealPosition( void );
|
wxPoint GetScreenCenterRealPosition( void );
|
||||||
void MouseToCursorSchema();
|
void MouseToCursorSchema();
|
||||||
|
|
|
@ -45,9 +45,6 @@ typedef enum {
|
||||||
} GRLineStypeType;
|
} GRLineStypeType;
|
||||||
|
|
||||||
|
|
||||||
int GRMapX( int x );
|
|
||||||
int GRMapY( int y );
|
|
||||||
|
|
||||||
class EDA_DRAW_PANEL;
|
class EDA_DRAW_PANEL;
|
||||||
|
|
||||||
void GRSetDrawMode( wxDC* DC, int mode );
|
void GRSetDrawMode( wxDC* DC, int mode );
|
||||||
|
@ -68,8 +65,6 @@ void GRForceBlackPen( bool flagforce );
|
||||||
*/
|
*/
|
||||||
bool GetGRForceBlackPenState( void );
|
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* 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 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,
|
void GRMixedLine( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
|
|
|
@ -1,3 +1,29 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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
|
* a helper to handle the real device context used in kicad
|
||||||
* @file kicad_device_context.h
|
* @file kicad_device_context.h
|
||||||
|
@ -6,43 +32,89 @@
|
||||||
#ifndef __KICAD_DEVICE_CONTEXT_H__
|
#ifndef __KICAD_DEVICE_CONTEXT_H__
|
||||||
#define __KICAD_DEVICE_CONTEXT_H__
|
#define __KICAD_DEVICE_CONTEXT_H__
|
||||||
|
|
||||||
// Comment this line to use the standard wxClientDC
|
#include <wx/dcbuffer.h>
|
||||||
// and uncomment to use buffered DC
|
|
||||||
// #define KICAD_USE_BUFFERED_DC // Currently under test
|
|
||||||
|
|
||||||
// Comment this line to use the standard wxPaintDC
|
#if defined(KICAD_USE_BUFFERED_PAINTDC)
|
||||||
// and uncomment to use buffered PaintDC
|
#undef KICAD_USE_BUFFERED_PAINTDC
|
||||||
#define KICAD_USE_BUFFERED_PAINTDC // Currently under test
|
|
||||||
|
|
||||||
#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>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_WX_GRAPHICS_CONTEXT && USE_WX_ZOOM
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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>
|
#include <wx/dcgraph.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Macro used to declare a device context in kicad:
|
// 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" )
|
//#pragma message( "INSTALL_DC is wxClientDC with wxGCDC" )
|
||||||
#define INSTALL_DC(name,parent) \
|
#define INSTALL_DC( name, parent ) \
|
||||||
wxClientDC _cDC( parent ); \
|
wxClientDC _cDC( parent ); \
|
||||||
wxGCDC name(_cDC); \
|
wxGCDC name( _cDC ); \
|
||||||
parent->DoPrepareDC( name ); \
|
parent->DoPrepareDC( name ); \
|
||||||
name.GetGraphicsContext()->Translate( 0.5, 0.5 );
|
name.GetGraphicsContext()->Translate( 0.5, 0.5 );
|
||||||
#else
|
#else
|
||||||
#ifdef KICAD_USE_BUFFERED_DC
|
#if KICAD_USE_BUFFERED_DC && !KICAD_USE_BUFFERED_DC_HELPER
|
||||||
//#pragma message( "INSTALL_DC is wxClientDC with wxBufferedDC" )
|
//#pragma message( "INSTALL_DC is wxClientDC with wxBufferedDC" )
|
||||||
#define INSTALL_DC(name,parent) \
|
#define INSTALL_DC( name, parent ) \
|
||||||
wxClientDC _cDC( parent ); \
|
wxClientDC _cDC( parent ); \
|
||||||
wxBufferedDC name(&_cDC, _cDC.GetSize() ); \
|
wxBufferedDC name(&_cDC, _cDC.GetSize() ); \
|
||||||
parent->DoPrepareDC( name );
|
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
|
#else
|
||||||
//#pragma message( "INSTALL_DC is wxClientDC" )
|
//#pragma message( "INSTALL_DC is wxClientDC" )
|
||||||
#define INSTALL_DC(name,parent) \
|
#define INSTALL_DC( name, parent ) \
|
||||||
wxClientDC name( parent ); \
|
wxClientDC name( parent ); \
|
||||||
parent->DoPrepareDC( name );
|
parent->DoPrepareDC( name );
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,16 +122,22 @@
|
||||||
|
|
||||||
#if USE_WX_GRAPHICS_CONTEXT
|
#if USE_WX_GRAPHICS_CONTEXT
|
||||||
//#pragma message( "INSTALL_PAINTDC is wxPaintDC with wxGCDC" )
|
//#pragma message( "INSTALL_PAINTDC is wxPaintDC with wxGCDC" )
|
||||||
#define INSTALL_PAINTDC(name,parent) \
|
#define INSTALL_PAINTDC( name, parent) \
|
||||||
wxPaintDC _pDC(parent); \
|
wxPaintDC _pDC( parent ); \
|
||||||
wxGCDC name(_pDC); \
|
wxGCDC name( _pDC ); \
|
||||||
parent->DoPrepareDC( name ); \
|
parent->DoPrepareDC( name ); \
|
||||||
name.GetGraphicsContext()->Translate( 0.5, 0.5 );
|
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" )
|
//#pragma message( "INSTALL_PAINTDC is wxAutoBufferedPaintDC" )
|
||||||
#define INSTALL_PAINTDC(name,parent) \
|
#define INSTALL_PAINTDC( name, parent ) \
|
||||||
wxAutoBufferedPaintDC name(parent ); \
|
wxAutoBufferedPaintDC name( parent ); \
|
||||||
parent->DoPrepareDC( name );
|
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
|
#else
|
||||||
//#pragma message( "INSTALL_PAINTDC is wxPaintDC" )
|
//#pragma message( "INSTALL_PAINTDC is wxPaintDC" )
|
||||||
#define INSTALL_PAINTDC(name,parent) \
|
#define INSTALL_PAINTDC(name,parent) \
|
||||||
|
@ -67,4 +145,11 @@
|
||||||
parent->DoPrepareDC( name );
|
parent->DoPrepareDC( name );
|
||||||
#endif
|
#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__
|
#endif // __KICAD_DEVICE_CONTEXT_H__
|
||||||
|
|
|
@ -372,7 +372,17 @@ public:
|
||||||
void SetToolbarBgColor( int color_num );
|
void SetToolbarBgColor( int color_num );
|
||||||
virtual void OnZoom( wxCommandEvent& event );
|
virtual void OnZoom( wxCommandEvent& event );
|
||||||
void OnGrid( int grid_type );
|
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
|
/** Adjust the coordinate to the nearest grid value
|
||||||
* @param aCoord = coordinate to adjust
|
* @param aCoord = coordinate to adjust
|
||||||
|
|
|
@ -43,7 +43,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
||||||
if( m_HToolBar == NULL )
|
if( m_HToolBar == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
|
|
@ -237,9 +237,9 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
for( i = 0; i < maxi; i++ )
|
for( i = 0; i < maxi; i++ )
|
||||||
for( j = 0; j < maxi; j++ )
|
for( j = 0; j < maxi; j++ )
|
||||||
GRSPutPixel( &panel->m_ClipBox, DC,
|
GRPutPixel( &panel->m_ClipBox, DC,
|
||||||
( col * maxi ) + i + DRAW_OFFSET_X,
|
( col * maxi ) + i + DRAW_OFFSET_X,
|
||||||
( row * maxi ) + j + DRAW_OFFSET_Y, color );
|
( row * maxi ) + j + DRAW_OFFSET_Y, color );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
|
||||||
if( !DrawPanel->IsPointOnDisplay( aPos ) )
|
if( !DrawPanel->IsPointOnDisplay( aPos ) )
|
||||||
{
|
{
|
||||||
screen->m_Curseur = aPos;
|
screen->m_Curseur = aPos;
|
||||||
Recadre_Trace( true );
|
RedrawScreen( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -550,11 +550,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
|
||||||
typeaff = DisplayOpt.DisplayDrawItems;
|
typeaff = DisplayOpt.DisplayDrawItems;
|
||||||
width = m_Width;
|
width = m_Width;
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( width ) < 2 )
|
if( DC->LogicalToDeviceXRel( width ) < 2 )
|
||||||
#else
|
|
||||||
if( panel->GetScreen()->Scale( width ) < 2 )
|
|
||||||
#endif
|
|
||||||
typeaff = FILAIRE;
|
typeaff = FILAIRE;
|
||||||
|
|
||||||
switch( typeaff )
|
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 )
|
if( m_Flags & FORCE_SKETCH )
|
||||||
mode = SKETCH;
|
mode = SKETCH;
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( l_piste < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
|
if( l_piste < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
|
||||||
#else
|
|
||||||
if( l_piste < panel->GetScreen()->Unscale( L_MIN_DESSIN ) )
|
|
||||||
#endif
|
|
||||||
mode = FILAIRE;
|
mode = FILAIRE;
|
||||||
|
|
||||||
switch( m_Shape )
|
switch( m_Shape )
|
||||||
|
|
|
@ -190,11 +190,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
typeaff = SKETCH;
|
typeaff = SKETCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( m_Width ) < L_MIN_DESSIN )
|
if( DC->LogicalToDeviceXRel( m_Width ) < L_MIN_DESSIN )
|
||||||
#else
|
|
||||||
if( screen->Scale( m_Width ) < L_MIN_DESSIN )
|
|
||||||
#endif
|
|
||||||
typeaff = FILAIRE;
|
typeaff = FILAIRE;
|
||||||
|
|
||||||
switch( type_trace )
|
switch( type_trace )
|
||||||
|
|
|
@ -118,11 +118,7 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||||
typeaff = DisplayOpt.DisplayDrawItems;
|
typeaff = DisplayOpt.DisplayDrawItems;
|
||||||
width = m_Width;
|
width = m_Width;
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( width ) < 2 )
|
if( DC->LogicalToDeviceXRel( width ) < 2 )
|
||||||
#else
|
|
||||||
if( panel->GetScreen()->Scale( width ) < 2 )
|
|
||||||
#endif
|
|
||||||
typeaff = FILAIRE;
|
typeaff = FILAIRE;
|
||||||
|
|
||||||
rayon = m_Size / 4;
|
rayon = m_Size / 4;
|
||||||
|
|
|
@ -67,11 +67,7 @@ MODULE::~MODULE()
|
||||||
void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
|
void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
|
||||||
int dim_ancre, int draw_mode )
|
int dim_ancre, int draw_mode )
|
||||||
{
|
{
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
int anchor_size = DC->DeviceToLogicalXRel( dim_ancre );
|
int anchor_size = DC->DeviceToLogicalXRel( dim_ancre );
|
||||||
#else
|
|
||||||
int anchor_size = panel->GetScreen()->Unscale( dim_ancre );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRSetDrawMode( DC, draw_mode );
|
GRSetDrawMode( DC, draw_mode );
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,7 @@ public:
|
||||||
bool m_ShowNCMark; // true to show pad not connected mark
|
bool m_ShowNCMark; // true to show pad not connected mark
|
||||||
bool m_IsPrinting; // true to print, false to display on screen.
|
bool m_IsPrinting; // true to print, false to display on screen.
|
||||||
wxPoint m_Offset; // general draw offset
|
wxPoint m_Offset; // general draw offset
|
||||||
#ifndef USE_WX_ZOOM
|
|
||||||
double m_Scale; // Draw scaling factor
|
|
||||||
#endif
|
|
||||||
PAD_DRAWINFO( );
|
PAD_DRAWINFO( );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,6 @@ PAD_DRAWINFO::PAD_DRAWINFO()
|
||||||
m_Display_netname = true;
|
m_Display_netname = true;
|
||||||
m_ShowPadFilled = true;
|
m_ShowPadFilled = true;
|
||||||
m_ShowNCMark = true;
|
m_ShowNCMark = true;
|
||||||
#ifndef USE_WX_ZOOM
|
|
||||||
m_Scale = 1.0;
|
|
||||||
#endif
|
|
||||||
m_IsPrinting = false;
|
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_Mask_margin = mask_margin;
|
||||||
drawInfo.m_ShowNCMark = brd->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) );
|
drawInfo.m_ShowNCMark = brd->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) );
|
||||||
drawInfo.m_IsPrinting = screen->m_IsPrinting;
|
drawInfo.m_IsPrinting = screen->m_IsPrinting;
|
||||||
#ifndef USE_WX_ZOOM
|
|
||||||
drawInfo.m_Scale = (double) screen->Scale( 1000 ) / 1000;
|
|
||||||
#endif
|
|
||||||
SetAlpha( &color, 170 );
|
SetAlpha( &color, 170 );
|
||||||
|
|
||||||
/* Get the pad clearance. This has a meaning only for Pcbnew.
|
/* 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:
|
case PAD_CIRCLE:
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( aDC->LogicalToDeviceXRel( hole ) > 1 )
|
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,
|
GRFilledCircle( aClipBox, aDC, holepos.x, holepos.y, hole, 0,
|
||||||
aDrawInfo.m_Color, aDrawInfo.m_HoleColor );
|
aDrawInfo.m_Color, aDrawInfo.m_HoleColor );
|
||||||
break;
|
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 );
|
tsize = min( AreaSize.y, AreaSize.x / numpad_len );
|
||||||
#define CHAR_SIZE_MIN 5
|
#define CHAR_SIZE_MIN 5
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable when size too small.
|
||||||
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
|
|
||||||
{
|
{
|
||||||
// tsize reserve room for marges and segments thickness
|
// tsize reserve room for marges and segments thickness
|
||||||
tsize = (int) ( tsize * 0.8 );
|
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 );
|
shortname_len = MAX( shortname_len, MIN_CHAR_COUNT );
|
||||||
tsize = min( AreaSize.y, AreaSize.x / shortname_len );
|
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.
|
||||||
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
|
|
||||||
{
|
{
|
||||||
tpos = tpos0;
|
tpos = tpos0;
|
||||||
if( aDrawInfo.m_Display_padnum )
|
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;
|
width = m_Thickness;
|
||||||
|
|
||||||
if( ( frame->m_DisplayModText == FILAIRE )
|
if( ( frame->m_DisplayModText == FILAIRE )
|
||||||
|
|| ( DC->LogicalToDeviceXRel( width ) < L_MIN_DESSIN ) )
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
|| ( DC->LogicalToDeviceXRel( width ) < L_MIN_DESSIN ) )
|
|
||||||
#else
|
|
||||||
|| ( screen->Scale( width ) < L_MIN_DESSIN ) )
|
|
||||||
#endif
|
|
||||||
width = 0;
|
width = 0;
|
||||||
else if( frame->m_DisplayModText == SKETCH )
|
else if( frame->m_DisplayModText == SKETCH )
|
||||||
width = -width;
|
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);
|
color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
int anchor_size = DC->DeviceToLogicalXRel( 2 );
|
int anchor_size = DC->DeviceToLogicalXRel( 2 );
|
||||||
#else
|
|
||||||
int anchor_size = screen->Unscale( 2 );
|
|
||||||
#endif
|
|
||||||
GRLine( &panel->m_ClipBox, DC,
|
GRLine( &panel->m_ClipBox, DC,
|
||||||
pos.x - anchor_size, pos.y,
|
pos.x - anchor_size, pos.y,
|
||||||
pos.x + anchor_size, pos.y, 0, color );
|
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 ),
|
rayon = (int) hypot( (double) ( m_End.x - m_Start.x ),
|
||||||
(double) ( m_End.y - m_Start.y ) );
|
(double) ( m_End.y - m_Start.y ) );
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
|
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,
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, rayon, color );
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */
|
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,
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, rayon, color );
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
|
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,
|
GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y,
|
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 )
|
if( len < THRESHOLD * m_Width )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( m_Width ) < 6 ) // no room to display a text inside track
|
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;
|
return;
|
||||||
|
|
||||||
if( GetNet() == 0 )
|
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
|
if( (m_End.x - m_Start.x) == 0 ) // Vertical segment
|
||||||
angle = 900; // angle is in 0.1 degree
|
angle = 900; // angle is in 0.1 degree
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( tsize ) >= 6 )
|
if( DC->LogicalToDeviceXRel( tsize ) >= 6 )
|
||||||
#else
|
|
||||||
if( panel->GetScreen()->Scale( tsize ) >= 6 )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay) )
|
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;
|
rayon = m_Width >> 1;
|
||||||
// for small via size on screen (rayon < 4 pixels) draw a simplified shape
|
// for small via size on screen (rayon < 4 pixels) draw a simplified shape
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
int radius_in_pixels = DC->LogicalToDeviceXRel( rayon );
|
int radius_in_pixels = DC->LogicalToDeviceXRel( rayon );
|
||||||
#else
|
|
||||||
int radius_in_pixels = panel->GetScreen()->Scale( rayon );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool fast_draw = false;
|
bool fast_draw = false;
|
||||||
|
|
||||||
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
|
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
|
||||||
int drill_rayon = GetDrillValue() / 2;
|
int drill_rayon = GetDrillValue() / 2;
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
int inner_rayon = rayon - DC->DeviceToLogicalXRel( 2 );
|
int inner_rayon = rayon - DC->DeviceToLogicalXRel( 2 );
|
||||||
#else
|
|
||||||
int inner_rayon = rayon - panel->GetScreen()->Unscale( 2 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( radius_in_pixels < 3 )
|
if( radius_in_pixels < 3 )
|
||||||
{
|
{
|
||||||
|
@ -852,11 +824,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
else
|
else
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
if( DC->LogicalToDeviceXRel( drill_rayon ) > 1 ) // Draw hole if large enough.
|
||||||
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
|
|
||||||
GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, drill_rayon, 0, color, color );
|
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
|
// calculate a good size for the text
|
||||||
int tsize = m_Width / len;
|
int tsize = m_Width / len;
|
||||||
|
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
if( DC->LogicalToDeviceXRel( tsize ) >= 6 )
|
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
|
tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via
|
||||||
DrawGraphicText( panel, DC, m_Start,
|
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.
|
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
|
||||||
if( !Drc_On || !g_CurrentTrackSegment
|
if( !Drc_On || !g_CurrentTrackSegment
|
||||||
|| g_CurrentTrackSegment != this->GetCurItem()
|
|| 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;
|
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.
|
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 );
|
container->Remove( aTrack );
|
||||||
|
|
||||||
// redraw the area where the track was
|
// redraw the area where the track was
|
||||||
DrawPanel->PostDirtyRect( aTrack->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( aTrack->GetBoundingBox() );
|
||||||
|
|
||||||
SaveCopyInUndoList( aTrack, UR_DELETED );
|
SaveCopyInUndoList( aTrack, UR_DELETED );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -163,7 +163,7 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack )
|
||||||
GetBoard()->m_Track.Remove( segm );
|
GetBoard()->m_Track.Remove( segm );
|
||||||
|
|
||||||
// redraw the area where the track was
|
// redraw the area where the track was
|
||||||
DrawPanel->PostDirtyRect( segm->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( segm->GetBoundingBox() );
|
||||||
picker.m_PickedItem = segm;
|
picker.m_PickedItem = segm;
|
||||||
picker.m_PickedItemType = segm->Type();
|
picker.m_PickedItemType = segm->Type();
|
||||||
itemsList.PushItem( picker );
|
itemsList.PushItem( picker );
|
||||||
|
@ -214,7 +214,7 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
|
||||||
GetBoard()->m_Track.Remove( tracksegment );
|
GetBoard()->m_Track.Remove( tracksegment );
|
||||||
|
|
||||||
// redraw the area where the track was
|
// redraw the area where the track was
|
||||||
DrawPanel->PostDirtyRect( tracksegment->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( tracksegment->GetBoundingBox() );
|
||||||
picker.m_PickedItem = tracksegment;
|
picker.m_PickedItem = tracksegment;
|
||||||
picker.m_PickedItemType = tracksegment->Type();
|
picker.m_PickedItemType = tracksegment->Type();
|
||||||
itemsList.PushItem( picker );
|
itemsList.PushItem( picker );
|
||||||
|
|
|
@ -259,9 +259,9 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
|
||||||
|
|
||||||
int bg_color = g_DrawBgColor;
|
int bg_color = g_DrawBgColor;
|
||||||
g_DrawBgColor = WHITE;
|
g_DrawBgColor = WHITE;
|
||||||
|
|
||||||
if( aPrint_Frame_Ref )
|
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);
|
m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters);
|
||||||
g_DrawBgColor = bg_color;
|
g_DrawBgColor = bg_color;
|
||||||
|
|
|
@ -133,26 +133,8 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
||||||
scale *= 0.7;
|
scale *= 0.7;
|
||||||
dc.SetUserScale( scale, scale );
|
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 );
|
m_dummyPad->DrawShape( NULL, &dc, drawInfo );
|
||||||
|
|
||||||
#ifndef USE_WX_ZOOM
|
|
||||||
ActiveScreen->m_DrawOrg = org;
|
|
||||||
ActiveScreen->m_StartVisu = strt;
|
|
||||||
ActiveScreen->SetZoom( pzoom );
|
|
||||||
#endif
|
|
||||||
event.Skip();
|
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)
|
// redraw the area where the pad was, without pad (delete pad on screen)
|
||||||
m_CurrentPad->m_Flags |= DO_NOT_DRAW;
|
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;
|
m_CurrentPad->m_Flags &= ~DO_NOT_DRAW;
|
||||||
|
|
||||||
// Update values
|
// Update values
|
||||||
|
@ -651,7 +633,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
||||||
m_CurrentPad->DisplayInfo( m_Parent );
|
m_CurrentPad->DisplayInfo( m_Parent );
|
||||||
|
|
||||||
// redraw the area where the pad was
|
// redraw the area where the pad was
|
||||||
m_Parent->DrawPanel->PostDirtyRect( m_CurrentPad->GetBoundingBox() );
|
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() );
|
||||||
m_Parent->OnModify();
|
m_Parent->OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
int itmp;
|
int itmp;
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||||
MODULE* module;
|
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 net = aTrack->GetNet();
|
||||||
int width = aTrack->m_Width;
|
int width = aTrack->m_Width;
|
||||||
int layer = ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer;
|
|
||||||
|
|
||||||
wxPoint ref = ActiveScreen->RefPos( true );
|
|
||||||
|
|
||||||
TRACK* found = NULL;
|
TRACK* found = NULL;
|
||||||
|
|
||||||
|
@ -565,17 +562,16 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack )
|
||||||
if( track->GetState( BUSY | DELETED ) )
|
if( track->GetState( BUSY | DELETED ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( layer != track->GetLayer() )
|
if( aLayer != track->GetLayer() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( track->GetNet() == net )
|
if( track->GetNet() == net )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* TRACK::HitTest */
|
/* TRACK::HitTest */
|
||||||
int dist = (width + track->m_Width) / 2 + aTrack->GetClearance(
|
int dist = (width + track->m_Width) / 2 + aTrack->GetClearance( track );
|
||||||
track );
|
|
||||||
|
|
||||||
wxPoint pos = ref - track->m_Start;
|
wxPoint pos = aRef - track->m_Start;
|
||||||
wxPoint vec = track->m_End - track->m_Start;
|
wxPoint vec = track->m_End - track->m_Start;
|
||||||
|
|
||||||
if( !DistanceTest( dist, vec.x, vec.y, pos.x, pos.y ) )
|
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 */
|
/* prefer intrusions from the side, not the end */
|
||||||
double tmp = (double) pos.x * vec.x + (double) pos.y * vec.y;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,8 +609,9 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack )
|
||||||
*/
|
*/
|
||||||
static void PushTrack( EDA_DRAW_PANEL* panel )
|
static void PushTrack( EDA_DRAW_PANEL* panel )
|
||||||
{
|
{
|
||||||
|
PCB_SCREEN* screen = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetScreen();
|
||||||
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard();
|
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard();
|
||||||
wxPoint cursor = ActiveScreen->m_Curseur;
|
wxPoint cursor = screen->m_Curseur;
|
||||||
wxPoint cv, vec, n;
|
wxPoint cv, vec, n;
|
||||||
TRACK* track = g_CurrentTrackSegment;
|
TRACK* track = g_CurrentTrackSegment;
|
||||||
TRACK* other;
|
TRACK* other;
|
||||||
|
@ -622,7 +619,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
|
||||||
int dist;
|
int dist;
|
||||||
double f;
|
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 ? */
|
/* are we currently pointing into a conflicting trace ? */
|
||||||
if( !other )
|
if( !other )
|
||||||
|
@ -740,7 +737,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
if( g_TwoSegmentTrackBuild )
|
if( g_TwoSegmentTrackBuild )
|
||||||
{
|
{
|
||||||
g_CurrentTrackSegment->m_End = ActiveScreen->m_Curseur;
|
g_CurrentTrackSegment->m_End = screen->m_Curseur;
|
||||||
|
|
||||||
if( Drc_On )
|
if( Drc_On )
|
||||||
PushTrack( panel );
|
PushTrack( panel );
|
||||||
|
|
|
@ -110,7 +110,7 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
|
||||||
|
|
||||||
if( Text->m_Type == TEXT_is_DIVERS )
|
if( Text->m_Type == TEXT_is_DIVERS )
|
||||||
{
|
{
|
||||||
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
|
||||||
Text->DeleteStructure();
|
Text->DeleteStructure();
|
||||||
OnModify();
|
OnModify();
|
||||||
Module->m_LastEdit_Time = time( NULL );
|
Module->m_LastEdit_Time = time( NULL );
|
||||||
|
@ -146,7 +146,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
Text->m_Orient = TextInitialOrientation;
|
Text->m_Orient = TextInitialOrientation;
|
||||||
|
|
||||||
/* Redraw the text */
|
/* 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.
|
// leave it at (0,0) so we can use it Rotate when not moving.
|
||||||
MoveVector.x = MoveVector.y = 0;
|
MoveVector.x = MoveVector.y = 0;
|
||||||
|
@ -200,7 +200,7 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( Text != NULL )
|
if( Text != NULL )
|
||||||
{
|
{
|
||||||
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
|
||||||
Text->DrawUmbilical( DrawPanel, DC, GR_XOR, -MoveVector );
|
Text->DrawUmbilical( DrawPanel, DC, GR_XOR, -MoveVector );
|
||||||
|
|
||||||
/* Update the coordinates for anchor. */
|
/* Update the coordinates for anchor. */
|
||||||
|
@ -226,7 +226,7 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
/* Redraw text. */
|
/* Redraw text. */
|
||||||
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Text->m_Pos = GetScreen()->m_Curseur;
|
Text->m_Pos = GetScreen()->m_Curseur;
|
||||||
|
|
|
@ -199,7 +199,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
if( aDraw )
|
if( aDraw )
|
||||||
{
|
{
|
||||||
Module->m_Flags |= DO_NOT_DRAW;
|
Module->m_Flags |= DO_NOT_DRAW;
|
||||||
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||||
Module->m_Flags &= ~DO_NOT_DRAW;
|
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();
|
Module->Set_Rectangle_Encadrement();
|
||||||
if( aDraw )
|
if( aDraw )
|
||||||
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
|
@ -164,7 +164,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
bool redraw = false;
|
bool redraw = false;
|
||||||
|
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
wxGetMousePosition( &pos.x, &pos.y );
|
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
|
Place_Ancre( module ); // set the new relatives internal
|
||||||
// coordinates of items
|
// coordinates of items
|
||||||
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
||||||
Recadre_Trace( TRUE );
|
RedrawScreen( TRUE );
|
||||||
|
|
||||||
// Replace the module in position 0, to recalculate absolutes
|
// Replace the module in position 0, to recalculate absolutes
|
||||||
// coordinates of items
|
// coordinates of items
|
||||||
|
|
|
@ -104,7 +104,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
|
||||||
{
|
{
|
||||||
int tmp = module->m_Flags;
|
int tmp = module->m_Flags;
|
||||||
module->m_Flags |= DO_NOT_DRAW;
|
module->m_Flags |= DO_NOT_DRAW;
|
||||||
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( module->GetBoundingBox() );
|
||||||
module->m_Flags = tmp;
|
module->m_Flags = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||||
{
|
{
|
||||||
int tmp = Module->m_Flags;
|
int tmp = Module->m_Flags;
|
||||||
Module->m_Flags |= DO_NOT_DRAW;
|
Module->m_Flags |= DO_NOT_DRAW;
|
||||||
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||||
Module->m_Flags = tmp;
|
Module->m_Flags = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
|
||||||
{
|
{
|
||||||
int tmp = module->m_Flags;
|
int tmp = module->m_Flags;
|
||||||
module->m_Flags |= DO_NOT_DRAW;
|
module->m_Flags |= DO_NOT_DRAW;
|
||||||
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( module->GetBoundingBox() );
|
||||||
module->m_Flags = tmp;
|
module->m_Flags = tmp;
|
||||||
|
|
||||||
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
|
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
|
||||||
|
|
|
@ -128,7 +128,7 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
if( aDraw )
|
if( aDraw )
|
||||||
{
|
{
|
||||||
aPad->m_Flags |= DO_NOT_DRAW;
|
aPad->m_Flags |= DO_NOT_DRAW;
|
||||||
DrawPanel->PostDirtyRect( aPad->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() );
|
||||||
aPad->m_Flags &= ~DO_NOT_DRAW;
|
aPad->m_Flags &= ~DO_NOT_DRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
aPad->ComputeShapeMaxRadius();
|
aPad->ComputeShapeMaxRadius();
|
||||||
|
|
||||||
if( aDraw )
|
if( aDraw )
|
||||||
DrawPanel->PostDirtyRect( aPad->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() );
|
||||||
|
|
||||||
( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL );
|
( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL );
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->Set_Rectangle_Encadrement();
|
||||||
Pad->DisplayInfo( this );
|
Pad->DisplayInfo( this );
|
||||||
if( draw )
|
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;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
aPad->DeleteStructure();
|
aPad->DeleteStructure();
|
||||||
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->Set_Rectangle_Encadrement();
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
|
@ -21,7 +21,7 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
wxGetMousePosition( &pos.x, &pos.y );
|
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
|
* 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
|
* (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 */
|
* is the y coordinate values from - PlotAreaSize.y to 0 */
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
int y_dc_offset = PlotAreaSizeInPixels.y;
|
int y_dc_offset = PlotAreaSizeInPixels.y;
|
||||||
y_dc_offset = (int) ( ( double ) y_dc_offset * userscale );
|
y_dc_offset = (int) ( ( double ) y_dc_offset * userscale );
|
||||||
dc->SetDeviceOrigin( 0, y_dc_offset );
|
dc->SetDeviceOrigin( 0, y_dc_offset );
|
||||||
#endif
|
|
||||||
int ysize = (int) ( PlotAreaSizeInPixels.y / scaley );
|
int ysize = (int) ( PlotAreaSizeInPixels.y / scaley );
|
||||||
DrawOffset.y += ysize;
|
DrawOffset.y += ysize;
|
||||||
|
|
||||||
|
@ -277,13 +275,11 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
||||||
* to the middle of the page.
|
* to the middle of the page.
|
||||||
*/
|
*/
|
||||||
wxPoint pcb_centre = brd_BBox.Centre();
|
wxPoint pcb_centre = brd_BBox.Centre();
|
||||||
|
|
||||||
if( userscale <= 1.0 )
|
if( userscale <= 1.0 )
|
||||||
DrawOffset.y += pcb_centre.y - (ysize / 2);
|
DrawOffset.y += pcb_centre.y - (ysize / 2);
|
||||||
#ifdef USE_WX_ZOOM
|
|
||||||
dc->SetLogicalOrigin( ActiveScreen->m_DrawOrg.x, ActiveScreen->m_DrawOrg.y );
|
dc->SetLogicalOrigin( ActiveScreen->m_DrawOrg.x, ActiveScreen->m_DrawOrg.y );
|
||||||
#else
|
|
||||||
ActiveScreen->m_DrawOrg = DrawOffset;
|
|
||||||
#endif
|
|
||||||
panel->m_ClipBox.SetOrigin( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ) );
|
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 : */
|
/* 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 );
|
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
|
||||||
|
|
||||||
if( found )
|
if( found )
|
||||||
{
|
{
|
||||||
INSTALL_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
if( g_HighLight_Status )
|
if( g_HighLight_Status )
|
||||||
High_Light( &dc );
|
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 )
|
if( zone_container->m_Poly->GetNumCorners() <= 3 )
|
||||||
{
|
{
|
||||||
DrawPanel->PostDirtyRect( zone_container->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() );
|
||||||
if( DC )
|
if( DC )
|
||||||
{ // Remove the full zone because this is no more an area
|
{ // Remove the full zone because this is no more an area
|
||||||
Delete_Zone_Fill( NULL, zone_container->m_TimeStamp );
|
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 );
|
zone_container->m_Poly->RemoveContour( ncont );
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->PostDirtyRect( dirty );
|
DrawPanel->RefreshDrawingRect( dirty );
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue