Changeset 30

Show
Ignore:
Timestamp:
04/11/06 14:16:02 (2 years ago)
Author:
jordi
Message:

The main presenter now can rotate as well.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/MainPter.cxx

    r29 r30  
    139139} 
    140140 
     141/// 
     142/// @brief The "Go To Last Page" action was activated. 
     143/// 
    141144void 
    142145MainPter::goToLastPageActivated (void) 
     
    149152} 
    150153 
     154/// 
     155/// @brief The "Go To Next Page" action was activated. 
     156/// 
    151157void 
    152158MainPter::goToNextPageActivated (void) 
     
    159165} 
    160166 
     167/// 
     168/// @brief The "Go To Page" action was activated. 
     169/// 
     170/// This action is activated when the user presses the Enter key on 
     171/// the displayed current apge number. The user can change the value, 
     172/// and the page will change to that value. 
     173/// 
    161174void 
    162175MainPter::goToPageActivated (void) 
     
    178191} 
    179192 
     193 
     194/// 
     195/// @brief The "Go To Previous Page" action was activated. 
     196/// 
    180197void 
    181198MainPter::goToPreviousPageActivated (void) 
     
    265282 
    266283/// 
     284/// @brief The "Rotate Left" was activated. 
     285/// 
     286void 
     287MainPter::rotateLeftActivated () 
     288{ 
     289    g_assert ( NULL != m_Document && "Tried to rotate a NULL document."); 
     290 
     291    m_Document->rotateLeft (); 
     292    showPage (); 
     293} 
     294 
     295/// 
     296/// @brief The "Rotate Right" was activated. 
     297/// 
     298void 
     299MainPter::rotateRightActivated () 
     300{ 
     301    g_assert ( NULL != m_Document && "Tried to rotate a NULL document."); 
     302 
     303    m_Document->rotateRight (); 
     304    showPage (); 
     305} 
     306 
     307/// 
    267308/// @brief Shows the current page. 
    268309/// 
  • trunk/src/MainPter.h

    r29 r30  
    3838            void goToPreviousPageActivated (void); 
    3939            void openFileActivated (void); 
     40            void rotateLeftActivated (void); 
     41            void rotateRightActivated (void); 
    4042 
    4143        protected: 
  • trunk/tests/DumbDocument.cxx

    r29 r30  
    6666                     "%s", IDocument::getErrorMessage (m_OpenError)); 
    6767    } 
     68    m_Rotation = 0; 
     69    m_Scale = 1.0f; 
    6870    return m_Loaded; 
    6971} 
     
    7274DumbDocument::getPageSize (gdouble *width, gdouble *height) 
    7375{ 
    74     *width = 10
    75     *height = 10; 
     76    *width = 100
     77    *height = 250; 
    7678} 
    7779 
  • trunk/tests/MainPterTest.cxx

    r29 r30  
    412412    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    413413} 
     414 
     415/// 
     416/// @brief Test the rotation of the page. 
     417/// 
     418/// This is a very simple test about page rotation. 
     419/// 
     420void 
     421MainPterTest::pageRotate () 
     422{ 
     423    m_View->setOpenFileName ("/tmp/test.pdf"); 
     424    m_MainPter->openFileActivated (); 
     425    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     426    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     427    CPPUNIT_ASSERT_EQUAL (m_Document->getRotation (), 0); 
     428 
     429    m_MainPter->rotateRightActivated ();  
     430    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     431    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     432    CPPUNIT_ASSERT_EQUAL (m_Document->getRotation (), 90); 
     433 
     434    m_MainPter->rotateLeftActivated ();  
     435    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     436    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     437    CPPUNIT_ASSERT_EQUAL (m_Document->getRotation (), 0); 
     438} 
  • trunk/tests/MainPterTest.h

    r29 r30  
    3434        CPPUNIT_TEST (goodPassword); 
    3535        CPPUNIT_TEST (pageNavigation); 
     36        CPPUNIT_TEST (pageRotate); 
    3637        CPPUNIT_TEST_SUITE_END(); 
    3738 
     
    4849            void goodPassword (void); 
    4950            void pageNavigation (void); 
     51            void pageRotate (void); 
    5052 
    5153        private: