Changeset 63 for trunk/src/IDocument.cxx

Show
Ignore:
Timestamp:
04/14/06 14:36:57 (3 years ago)
Author:
jordi
Message:

The presenter now can reload a document. To do so I had to add the setters for IDocument's zoom and rotation (they should've been from the start, but...)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/IDocument.cxx

    r60 r63  
    654654 
    655655/// 
     656/// @brief Sets the current rotation degress. 
     657/// 
     658/// @param rotation The rotation in positive degrees.  
     659///                 If the parameter is greater than 360 degrees, its set 
     660///                 between 0 and 360 as a result of @a rotation % 360. 
     661/// 
     662void 
     663IDocument::setRotation (gint rotation) 
     664{ 
     665    m_Rotation = (rotation % 360); 
     666} 
     667 
     668/// 
    656669/// @brief Rotates 90 to the left. 
    657670/// 
     
    661674IDocument::rotateLeft () 
    662675{ 
    663     m_Rotation = (m_Rotation - 90) % 360; 
    664     if ( m_Rotation < 0 ) 
    665     { 
    666         m_Rotation += 360; 
    667     } 
     676    gint rotation = (getRotation () - 90); 
     677    if ( rotation < 0 ) 
     678    { 
     679        rotation += 360; 
     680    } 
     681    setRotation (rotation); 
    668682} 
    669683 
     
    676690IDocument::rotateRight () 
    677691{ 
    678     m_Rotation = (m_Rotation + 90) % 360; 
     692    setRotation (getRotation () + 90); 
    679693} 
    680694 
     
    706720/// @return The current zoom or scale level. 
    707721/// 
    708 gfloat 
     722gdouble 
    709723IDocument::getZoom (void) 
    710724{ 
    711725    return m_Scale; 
     726} 
     727 
     728/// 
     729/// @brief Sets the current zoom. 
     730/// 
     731/// @param zoom The new zoom level. 
     732/// 
     733void 
     734IDocument::setZoom (gdouble zoom) 
     735{ 
     736    m_Scale = zoom; 
    712737} 
    713738 
     
    725750    if (canZoomIn ()) 
    726751    { 
    727         m_Scale *= ZOOM_IN_FACTOR; 
     752        setZoom (getZoom () * ZOOM_IN_FACTOR); 
    728753    } 
    729754} 
     
    742767    if (canZoomOut ()) 
    743768    { 
    744         m_Scale *= ZOOM_OUT_FACTOR; 
     769        setZoom (getZoom () * ZOOM_OUT_FACTOR); 
    745770    } 
    746771} 
     
    766791    gdouble widthScale = (gdouble)width / pageWidth; 
    767792    gdouble heightScale = (gdouble)height / pageHeight; 
    768     m_Scale = MIN (widthScale, heightScale); 
     793    setZoom (MIN (widthScale, heightScale)); 
    769794} 
    770795 
     
    784809 
    785810    getPageSize (&pageWidth, &pageHeight); 
    786     m_Scale = (gdouble)width / pageWidth; 
    787 } 
     811    setZoom ((gdouble)width / pageWidth); 
     812}