Browse Source

fix incorrect initialization of VIEW::m_boundary.

This parameter defines the working area (full page) size.

The fix is not perfect, because it does not take in account the page size.
However it is similar to the "old" initialization, before Eeschema GAL.
In Eeschema, a reasonable boundary size is used.
pull/13/head
jean-pierre charras 7 years ago
parent
commit
c539d6e0be
  1. 11
      common/view/view.cpp
  2. 6
      eeschema/sch_view.cpp
  3. 10
      pcbnew/pcb_view.cpp

11
common/view/view.cpp

@ -294,7 +294,16 @@ VIEW::VIEW( bool aIsDynamic ) :
m_nextDrawPriority( 0 ),
m_reverseDrawOrder( false )
{
m_boundary.SetMaximum();
// Set m_boundary to define the max area size. The default area size
// is defined here as the max value of a int.
// this is a default value acceptable for Pcbnew and Gerbview, but too large for Eeschema.
// So in eeschema a call to SetBoundary() with a smaller value will be needed.
typedef std::numeric_limits<int> coord_limits;
double pos = coord_limits::lowest() / 2 + coord_limits::epsilon();
double size = coord_limits::max() - coord_limits::epsilon();
m_boundary.SetOrigin( pos, pos );
m_boundary.SetSize( size, size );
m_allItems.reset( new std::vector<VIEW_ITEM*> );
m_allItems->reserve( 32768 );

6
eeschema/sch_view.cpp

@ -44,6 +44,12 @@ namespace KIGFX {
SCH_VIEW::SCH_VIEW( bool aIsDynamic ) :
VIEW( aIsDynamic )
{
// Set m_boundary to define the max working area size. The default value
// is acceptable for Pcbnew and Gerbview, but too large for Eeschema.
// So we have to use a smaller value.
// A better size could be a size depending on the worksheet size.
m_boundary.SetOrigin( -Millimeter2iu( 3200.0 ), -Millimeter2iu( 2000.0 ) );
m_boundary.SetSize( Millimeter2iu( 6400.0 ), Millimeter2iu( 4000.0 ) );
}

10
pcbnew/pcb_view.cpp

@ -37,6 +37,16 @@ namespace KIGFX {
PCB_VIEW::PCB_VIEW( bool aIsDynamic ) :
VIEW( aIsDynamic )
{
// Set m_boundary to define the max area size. The default value
// is acceptable for Pcbnew and Gerbview.
// However, ensure this area has the right size (max size allowed by integer coordinates)
// in case of the default value is changed.
// Could be a size depending on the worksheet size.
typedef std::numeric_limits<int> coord_limits;
double pos = coord_limits::lowest() / 2 + coord_limits::epsilon();
double size = coord_limits::max() - coord_limits::epsilon();
m_boundary.SetOrigin( pos, pos );
m_boundary.SetSize( size, size );
}

Loading…
Cancel
Save