more nanometer work, see comment at line 66 of pcbnew/classpcb.cpp

This commit is contained in:
Dick Hollenbeck
2012-05-06 15:10:43 -05:00
parent 3d747571d6
commit 9fbc499361
12 changed files with 209 additions and 203 deletions
+16 -47
View File
@@ -98,16 +98,8 @@ double BASE_SCREEN::GetScalingFactor() const
void BASE_SCREEN::SetScalingFactor( double aScale )
{
double zoom = aScale;
// Limit zoom to max and min allowed values:
if( zoom < m_ZoomList[0] )
zoom = m_ZoomList[0];
int idxmax = m_ZoomList.GetCount() - 1;
if( zoom > m_ZoomList[idxmax] )
zoom = m_ZoomList[idxmax];
double zoom = Clamp( GetMinAllowedZoom(), aScale, GetMaxAllowedZoom() );
SetZoom( zoom );
}
@@ -115,38 +107,30 @@ void BASE_SCREEN::SetScalingFactor( double aScale )
bool BASE_SCREEN::SetFirstZoom()
{
if( m_ZoomList.IsEmpty() )
{
if( m_Zoom != 1.0 )
{
SetZoom( 1.0 );
return true;
}
}
else if( m_Zoom != m_ZoomList[0] )
{
SetZoom( m_ZoomList[0] );
return true;
}
return false;
return SetZoom( GetMinAllowedZoom() );
}
double BASE_SCREEN::GetZoom() const
bool BASE_SCREEN::SetLastZoom()
{
return m_Zoom;
return SetZoom( GetMaxAllowedZoom() );
}
bool BASE_SCREEN::SetZoom( double coeff )
bool BASE_SCREEN::SetZoom( double iu_per_du )
{
if( coeff == m_Zoom )
if( iu_per_du == m_Zoom )
return false;
wxLogDebug( "Zoom:%16g 1/Zoom:%16g", coeff, 1/coeff );
wxLogDebug( "Zoom:%16g 1/Zoom:%16g", iu_per_du, 1/iu_per_du );
m_Zoom = coeff;
if( iu_per_du < GetMinAllowedZoom() )
return false;
if( iu_per_du > GetMaxAllowedZoom() )
return false;
m_Zoom = iu_per_du;
return true;
}
@@ -154,10 +138,7 @@ bool BASE_SCREEN::SetZoom( double coeff )
bool BASE_SCREEN::SetNextZoom()
{
if( m_ZoomList.IsEmpty() || m_Zoom >= m_ZoomList.Last() )
return false;
for( unsigned i = 0; i < m_ZoomList.GetCount(); i++ )
for( unsigned i=0; i < m_ZoomList.size(); ++i )
{
if( m_Zoom < m_ZoomList[i] )
{
@@ -172,10 +153,7 @@ bool BASE_SCREEN::SetNextZoom()
bool BASE_SCREEN::SetPreviousZoom()
{
if( m_ZoomList.IsEmpty() || m_Zoom <= m_ZoomList[0] )
return false;
for( unsigned i = m_ZoomList.GetCount(); i != 0; i-- )
for( unsigned i = m_ZoomList.size(); i != 0; --i )
{
if( m_Zoom > m_ZoomList[i - 1] )
{
@@ -188,15 +166,6 @@ bool BASE_SCREEN::SetPreviousZoom()
}
bool BASE_SCREEN::SetLastZoom()
{
if( m_ZoomList.IsEmpty() || m_Zoom == m_ZoomList.Last() )
return false;
return SetZoom( m_ZoomList.Last() );
}
void BASE_SCREEN::SetGridList( GRIDS& gridlist )
{
if( !m_grids.empty() )