Changeset 227
- Timestamp:
- 06/12/06 16:40:59 (2 years ago)
- Location:
- trunk
- Files:
-
- 9 modified
-
src/IMainView.h (modified) (2 diffs)
-
src/MainPter.cxx (modified) (3 diffs)
-
src/gtk/MainView.cxx (modified) (5 diffs)
-
src/gtk/MainView.h (modified) (3 diffs)
-
tests/DumbMainView.cxx (modified) (6 diffs)
-
tests/DumbMainView.h (modified) (4 diffs)
-
tests/MainPterTest.cxx (modified) (2 diffs)
-
tests/PrintPterTest.cxx (modified) (3 diffs)
-
tests/PrintPterTest.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/IMainView.h
r213 r227 356 356 357 357 /// 358 /// @brief Sets the text for the number of pages. 359 /// 360 /// The view displays the number of pages separately 361 /// of the current page. This function should set the 362 /// text to display in this separate control. 363 /// 364 /// @param text The text to set as the number of pages. 365 /// 366 virtual void setNumberOfPagesText (const gchar *text) = 0; 367 368 /// 358 369 /// @brief Sets the text of the status bar. 359 370 /// … … 436 447 /// 437 448 virtual void showToolbar (gboolean show) = 0; 438 439 ///440 /// @brief Gives the number of pages that the document has.441 ///442 /// The view should keep a the number of total pages and show it443 /// to the user.444 ///445 /// @param pages The total number of pages the document has.446 ///447 virtual void setTotalPages (gint pages) = 0;448 449 449 450 /// -
trunk/src/MainPter.cxx
r225 r227 137 137 view.activeZoomFit (config.zoomToFit ()); 138 138 view.activeZoomWidth (config.zoomToWidth ()); 139 view.setTotalPages (m_Document->getNumPages ());140 139 #if defined (HAVE_CUPS) 141 140 view.sensitivePrint (TRUE); … … 376 375 gint newPageNum = m_Document->getCurrentPageNum (); 377 376 gint totalPages = m_Document->getNumPages (); 378 gchar *goToPageText = g_strdup_printf (_("%d of %d"), 379 newPageNum, totalPages); 377 gchar *goToPageText = g_strdup_printf ("%d", newPageNum); 380 378 getView ().setGoToPageText (goToPageText); 381 379 g_free (goToPageText); 380 gchar *totalPagesText = g_strdup_printf (_("of %d"), totalPages); 381 getView ().setNumberOfPagesText (totalPagesText); 382 g_free (totalPagesText); 382 383 } 383 384 } … … 845 846 // Set the text for the current page. 846 847 gint totalPages = m_Document->getNumPages (); 847 gchar *goToPageText = g_strdup_printf ( _("%d of %d"), pageNum, totalPages);848 gchar *goToPageText = g_strdup_printf ("%d", pageNum); 848 849 view.setGoToPageText (goToPageText); 849 850 g_free (goToPageText); 851 gchar *totalPagesText = g_strdup_printf(_("of %d"), totalPages); 852 view.setNumberOfPagesText (totalPagesText); 853 g_free (totalPagesText); 850 854 851 855 // Set the page navigation sensitivity. -
trunk/src/gtk/MainView.cxx
r225 r227 35 35 // Constants. 36 36 static gint CURRENT_PAGE_POS = 5; 37 static gint CURRENT_PAGE_WIDTH = 14;37 static gint CURRENT_PAGE_WIDTH = 5; 38 38 static gint CURRENT_ZOOM_POS = 8; 39 39 static gint CURRENT_ZOOM_WIDTH = 6; 40 40 41 41 // Enumerations. 42 static enum 42 enum indexColumns 43 43 { 44 44 outlineTitleColumn, … … 46 46 outlineDataColumn, 47 47 outlineNumColumns 48 } indexColumns;48 }; 49 49 50 50 // Forward declarations. … … 625 625 } 626 626 627 void 628 MainView::set TotalPages (gint pages)629 { 630 m_TotalPages = pages;631 } 632 633 void 627 void 628 MainView::setNumberOfPagesText (const gchar *text) 629 { 630 gtk_label_set_text (GTK_LABEL (m_NumberOfPages), text); 631 } 632 633 void 634 634 MainView::setGoToPageText (const gchar *text) 635 635 { … … 756 756 GtkWidget *hbox = gtk_hbox_new (FALSE, 3); 757 757 758 GtkWidget *pageLabel = gtk_label_new (_("Page"));758 GtkWidget *pageLabel = gtk_label_new (_("Page")); 759 759 gtk_box_pack_start (GTK_BOX (hbox), pageLabel, FALSE, FALSE, 0); 760 760 761 761 m_CurrentPage = gtk_entry_new (); 762 gtk_entry_set_text (GTK_ENTRY (m_CurrentPage), _("0 of 0"));762 gtk_entry_set_text (GTK_ENTRY (m_CurrentPage), "0"); 763 763 gtk_entry_set_alignment (GTK_ENTRY (m_CurrentPage), 1.0f); 764 764 gtk_entry_set_width_chars (GTK_ENTRY (m_CurrentPage), CURRENT_PAGE_WIDTH); … … 766 766 G_CALLBACK (main_window_go_to_page_cb), m_Pter); 767 767 gtk_box_pack_start (GTK_BOX (hbox), m_CurrentPage, TRUE, TRUE, 0); 768 m_NumberOfPages = gtk_label_new (_("of 0")); 769 gtk_misc_set_alignment (GTK_MISC (m_NumberOfPages), 0.0f, 0.5f); 770 gtk_box_pack_start (GTK_BOX (hbox), m_NumberOfPages, FALSE, FALSE, 0); 768 771 769 772 m_CurrentPageToolItem = gtk_tool_item_new (); -
trunk/src/gtk/MainView.h
r213 r227 62 62 void showIndex (gboolean show); 63 63 void setCursor (ViewCursor cursorType); 64 void set TotalPages (gint pages);64 void setNumberOfPagesText (const gchar *text); 65 65 void setGoToPageText (const gchar *text); 66 66 void setStatusBarText (const gchar *text); … … 87 87 GtkWidget *m_MainWindow; 88 88 GtkWidget *m_MainBox; 89 GtkWidget *m_NumberOfPages; 89 90 GtkTreeStore *m_Outline; 90 91 PageView *m_PageView; … … 92 93 GtkWidget *m_StatusBar; 93 94 GtkWidget *m_TreeIndex; 94 gint m_TotalPages;95 95 GtkUIManager *m_UIManager; 96 96 -
trunk/tests/DumbMainView.cxx
r216 r227 34 34 m_CurrentPage = 0; 35 35 m_FindView = new DumbFindView (); 36 m_NumberOfPages = g_strdup ("of 0"); 36 37 m_GoToPageText = g_strdup (""); 37 38 m_OpenFileName = g_strdup (""); … … 65 66 m_Title = g_strdup (""); 66 67 m_TimesShownPassword = 0; 67 m_TotalPages = 0;68 68 m_ZoomText = g_strdup (""); 69 69 m_ZoomToFit = FALSE; … … 76 76 delete m_PageView; 77 77 g_free (m_GoToPageText); 78 g_free (m_NumberOfPages); 78 79 g_free (m_LastOpenFileFolder); 79 80 g_free (m_LastSaveFileFolder); … … 200 201 } 201 202 202 void 203 void 203 204 DumbMainView::sensitiveRotateLeft (gboolean sensitive) 204 205 { … … 266 267 267 268 void 268 DumbMainView::setTotalPages (gint pages) 269 { 270 m_TotalPages = pages; 269 DumbMainView::setNumberOfPagesText (const gchar *text) 270 { 271 g_free (m_NumberOfPages); 272 m_NumberOfPages = g_strdup (text); 271 273 } 272 274 … … 367 369 { 368 370 return m_Outline; 369 }370 371 gint372 DumbMainView::getTotalPages ()373 {374 return m_TotalPages;375 371 } 376 372 -
trunk/tests/DumbMainView.h
r216 r227 63 63 const gchar *getGoToPageText (void); 64 64 void setCursor (ViewCursor cursorType); 65 void set TotalPages (gint pages);66 void setGoToPageText (const char *text);65 void setNumberOfPagesText (const gchar *text); 66 void setGoToPageText (const gchar *text); 67 67 void setTitle (const gchar *title); 68 68 void setOutline (DocumentOutline *outline); … … 82 82 DocumentOutline *getOutline (void); 83 83 const gchar *getTitle (void); 84 gint getTotalPages (void);85 84 gboolean isShown (void); 86 85 gboolean isSensitiveFind (void); … … 113 112 gint m_CurrentPage; 114 113 DumbFindView *m_FindView; 114 gchar *m_NumberOfPages; 115 115 gchar *m_GoToPageText; 116 116 gchar *m_LastOpenFileFolder; … … 144 144 gint m_TimesShownPassword; 145 145 gchar *m_Title; 146 gint m_TotalPages;147 146 gchar *m_ZoomText; 148 147 gboolean m_ZoomToFit; -
trunk/tests/MainPterTest.cxx
r212 r227 454 454 m_MainPter->openFileActivated (); 455 455 m_MainPter->waitForFileLoaded (); 456 // Check that sets the correct number of pages and the current page. 457 CPPUNIT_ASSERT_EQUAL (4, m_View->getTotalPages ()); 456 // Check that sets the correct current page. 458 457 CPPUNIT_ASSERT_EQUAL (1, m_View->getCurrentPage ()); 459 458 // Going to the next page should make all actions sensitive. … … 523 522 m_MainPter->openFileActivated (); 524 523 m_MainPter->waitForFileLoaded (); 525 // Check that sets the correct number of pages and the current page. 526 CPPUNIT_ASSERT_EQUAL (4, m_View->getTotalPages ()); 524 // Check that sets the correct current page. 527 525 CPPUNIT_ASSERT_EQUAL (1, m_View->getCurrentPage ()); 528 526 -
trunk/tests/PrintPterTest.cxx
r218 r227 17 17 18 18 #include <epdfview.h> 19 #include "DumbDocument.h" 19 20 #include "DumbPrintView.h" 20 21 #include "PrintPterTest.h" … … 32 33 { 33 34 Config::loadFile (FALSE); 34 m_PrintPter = new PrintPter (); 35 m_Document = new DumbDocument (); 36 m_PrintPter = new PrintPter (m_Document); 35 37 m_View = new DumbPrintView (); 36 38 m_PrintPter->setView (m_View); … … 52 54 m_View = NULL; 53 55 } 56 delete m_Document; 54 57 } 55 58 -
trunk/tests/PrintPterTest.h
r218 r227 40 40 41 41 protected: 42 DumbDocument *m_Document; 42 43 PrintPter *m_PrintPter; 43 44 DumbPrintView *m_View;
