Changeset 128
- Timestamp:
- 04/29/06 03:33:17 (2 years ago)
- Location:
- trunk
- Files:
-
- 9 modified
-
src/IDocument.cxx (modified) (2 diffs)
-
src/IDocument.h (modified) (1 diff)
-
src/IDocumentObserver.h (modified) (1 diff)
-
src/PDFDocument.cxx (modified) (2 diffs)
-
tests/DumbDocument.cxx (modified) (1 diff)
-
tests/DumbDocumentObserver.cxx (modified) (4 diffs)
-
tests/DumbDocumentObserver.h (modified) (2 diffs)
-
tests/PDFDocumentTest.cxx (modified) (4 diffs)
-
tests/PDFDocumentTest.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/IDocument.cxx
r126 r128 285 285 286 286 void 287 IDocument::notifyPageChanged () 288 { 289 gint pageNum = getCurrentPageNum (); 290 for ( GList *item = g_list_first (m_Observers) ; NULL != item ; 291 item = g_list_next (item) ) 292 { 293 IDocumentObserver *observer = (IDocumentObserver *)item->data; 294 observer->notifyPageChanged (pageNum); 295 } 296 } 297 298 void 287 299 IDocument::load (const gchar *fileName, const gchar *password) 288 300 { 301 m_CurrentPage = 1; 302 m_Rotation = 0; 303 m_Scale = 1.0f; 304 289 305 JobLoad *job = new JobLoad (); 290 306 job->setDocument (this); … … 850 866 IDocument::goToPage (gint pageNum) 851 867 { 852 m_CurrentPage = CLAMP (pageNum, 1, getNumPages ()); 853 854 scheduleToRender (m_CurrentPage); 855 if ( 1 < m_CurrentPage ) 856 { 857 scheduleToRender (m_CurrentPage - 1); 858 } 859 if ( m_CurrentPage < getNumPages () ) 860 { 861 scheduleToRender (m_CurrentPage + 1); 868 if ( pageNum != m_CurrentPage && 1 <= pageNum && pageNum <= getNumPages ()) 869 { 870 m_CurrentPage = pageNum; 871 872 scheduleToRender (m_CurrentPage); 873 if ( 1 < m_CurrentPage ) 874 { 875 scheduleToRender (m_CurrentPage - 1); 876 } 877 if ( m_CurrentPage < getNumPages () ) 878 { 879 scheduleToRender (m_CurrentPage + 1); 880 } 881 882 notifyPageChanged (); 862 883 } 863 884 } -
trunk/src/IDocument.h
r126 r128 180 180 void notifyLoadError (const GError *error); 181 181 void notifyLoadPassword (const GError *error); 182 void notifyPageChanged (void); 182 183 183 184 const gchar *getTitle (void); -
trunk/src/IDocumentObserver.h
r126 r128 29 29 virtual void notifyLoadError (const GError *error) { } 30 30 virtual void notifyLoadPassword (const GError *error) { } 31 virtual void notifyPageChanged (gint pageNum) { } 31 32 32 33 protected: -
trunk/src/PDFDocument.cxx
r121 r128 144 144 m_Outline = new DocumentOutline (); 145 145 setOutline (m_Outline, outline); 146 // Set the current rotation angle and zoom level.147 setRotation (0);148 setZoom (1.0f);149 146 150 147 return TRUE; … … 234 231 // Get the number of pages and set the current to the first. 235 232 setNumPages (poppler_document_get_n_pages (m_Document)); 236 goToFirstPage ();237 233 } 238 234 -
trunk/tests/DumbDocument.cxx
r122 r128 70 70 m_Loaded = FALSE; 71 71 } 72 setRotation (0);73 setZoom (1.0f);74 72 return m_Loaded; 75 73 } -
trunk/tests/DumbDocumentObserver.cxx
r126 r128 24 24 IDocumentObserver () 25 25 { 26 m_CurrentPage = 0; 26 27 m_Error = NULL; 27 28 m_NotifiedError = FALSE; … … 39 40 { 40 41 m_NotifiedLoad = TRUE; 42 m_CurrentPage = 1; 41 43 } 42 44 … … 55 57 } 56 58 59 void 60 DumbDocumentObserver::notifyPageChanged (gint pageNum) 61 { 62 m_CurrentPage = pageNum; 63 } 64 57 65 //////////////////////////////////////////////////////////////// 58 66 // Test purposes methods. … … 62 70 DumbDocumentObserver::getCurrentPage (void) 63 71 { 64 return 0;72 return m_CurrentPage; 65 73 } 66 74 -
trunk/tests/DumbDocumentObserver.h
r126 r128 30 30 void notifyLoadError (const GError *error); 31 31 void notifyLoadPassword (const GError *error); 32 void notifyPageChanged (gint pageNum); 32 33 33 34 gint getCurrentPage (void); … … 43 44 44 45 protected: 46 gint m_CurrentPage; 45 47 GError *m_Error; 46 48 gboolean m_NotifiedError; -
trunk/tests/PDFDocumentTest.cxx
r127 r128 308 308 } 309 309 310 /*311 310 /// 312 311 /// @brief Test changing pages. … … 321 320 // First try with a 2 page document. 322 321 gchar *testFile = getTestFile ("test2.pdf"); 323 CPPUNIT_ASSERT (m_Document->loadFile (testFile, NULL, NULL));322 m_Document->load (testFile, NULL); 324 323 while ( !m_Observer->loadFinished () ) { } 325 324 CPPUNIT_ASSERT (m_Observer->notifiedLoaded ()); … … 368 367 g_free (testFile); 369 368 testFile = getTestFile ("test1.pdf"); 370 CPPUNIT_ASSERT (m_Document->loadFile (testFile, NULL, NULL));369 m_Document->load (testFile, NULL); 371 370 while ( !m_Observer->loadFinished () ) { } 372 371 CPPUNIT_ASSERT (m_Observer->notifiedLoaded ()); … … 427 426 g_free (testFile); 428 427 } 429 428 /* 430 429 /// 431 430 /// @brief Test rotating a page. -
trunk/tests/PDFDocumentTest.h
r127 r128 32 32 CPPUNIT_TEST (validFile); 33 33 CPPUNIT_TEST (relativePath); 34 /*CPPUNIT_TEST (pageChange);35 CPPUNIT_TEST (pageRotate);34 CPPUNIT_TEST (pageChange); 35 /* CPPUNIT_TEST (pageRotate); 36 36 CPPUNIT_TEST (pageZoom); 37 37 CPPUNIT_TEST (pageRender);*/
