double PL_EDITOR_FRAME::BestZoom() { double sizeX = (double) GetPageLayout().GetPageSettings().GetWidthIU(); double sizeY = (double) GetPageLayout().GetPageSettings().GetHeightIU(); wxPoint centre( KiROUND( sizeX / 2 ), KiROUND( sizeY / 2 ) ); // The sheet boundary already affords us some margin, so add only an // additional 5%. double margin_scale_factor = 1.05; return bestZoom( sizeX, sizeY, margin_scale_factor, centre ); }
double FOOTPRINT_EDIT_FRAME::BestZoom() { EDA_RECT ibbbox = GetBoardBoundingBox(); double sizeX = (double) ibbbox.GetWidth(); double sizeY = (double) ibbbox.GetHeight(); wxPoint centre = ibbbox.Centre(); // Reserve a 20% margin around "board" bounding box. double margin_scale_factor = 1.2; return bestZoom( sizeX, sizeY, margin_scale_factor, centre ); }
double LIB_VIEW_FRAME::BestZoom() { LIB_PART* part = NULL; double defaultLibraryZoom = 7.33; if( m_libraryName.IsEmpty() || m_entryName.IsEmpty() ) { SetScrollCenterPosition( wxPoint( 0, 0 ) ); return defaultLibraryZoom; } LIB_ALIAS* alias = nullptr; try { alias = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName ); } catch( ... ) { } if( alias ) part = alias->GetPart(); if( !part ) { SetScrollCenterPosition( wxPoint( 0, 0 ) ); return defaultLibraryZoom; } EDA_RECT boundingBox = part->GetUnitBoundingBox( m_unit, m_convert ); double sizeX = (double) boundingBox.GetWidth(); double sizeY = (double) boundingBox.GetHeight(); wxPoint centre = boundingBox.Centre(); // Reserve a 20% margin around component bounding box. double margin_scale_factor = 1.2; return bestZoom( sizeX, sizeY, margin_scale_factor, centre ); }
double LIB_EDIT_FRAME::BestZoom() { LIB_PART* part = GetCurPart(); double defaultLibraryZoom = 7.33; if( !part ) { SetScrollCenterPosition( wxPoint( 0, 0 ) ); return defaultLibraryZoom; } EDA_RECT boundingBox = part->GetUnitBoundingBox( m_unit, m_convert ); double sizeX = (double) boundingBox.GetWidth(); double sizeY = (double) boundingBox.GetHeight(); wxPoint centre = boundingBox.Centre(); // Reserve a 20% margin around component bounding box. double margin_scale_factor = 1.2; return bestZoom( sizeX, sizeY, margin_scale_factor, centre); }