Changeset 212
- Timestamp:
- 06/10/06 11:43:58 (2 years ago)
- Files:
-
- trunk/data/Makefile.am (modified) (2 diffs)
- trunk/data/epdfview-ui-print.xml (added)
- trunk/data/epdfview-ui.xml (modified) (1 diff)
- trunk/src/IMainView.h (modified) (1 diff)
- trunk/src/MainPter.cxx (modified) (3 diffs)
- trunk/src/gtk/MainView.cxx (modified) (8 diffs)
- trunk/src/gtk/MainView.h (modified) (1 diff)
- trunk/src/gtk/PageView.cxx (modified) (1 diff)
- trunk/tests/DumbMainView.cxx (modified) (3 diffs)
- trunk/tests/DumbMainView.h (modified) (4 diffs)
- trunk/tests/MainPterTest.cxx (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/Makefile.am
r160 r212 6 6 stock_find_next_24.png \ 7 7 stock_find_previous_24.png \ 8 stock_rotate-90.png \8 stock_rotate-90.png \ 9 9 stock_rotate-270.png \ 10 10 stock_zoom-page-width.png \ 11 epdfview-ui.xml \ 11 epdfview-ui.xml \ 12 epdfview-ui-print.xml \ 12 13 epdfview.desktop 13 14 … … 25 26 uidir = $(pkgdatadir)/ui 26 27 ui_DATA = \ 27 epdfview-ui.xml 28 epdfview-ui.xml \ 29 epdfview-ui-print.xml 28 30 29 31 desktopdir = $(datadir)/applications trunk/data/epdfview-ui.xml
r202 r212 5 5 <menuitem name="ReloadFile" action="ReloadFile"/> 6 6 <menuitem name="SaveFile" action="SaveFile"/> 7 <placeholder name="PrintPlaceHolder"/> 7 8 <separator/> 8 9 <menuitem name="Quit" action="Quit"/> trunk/src/IMainView.h
r201 r212 201 201 virtual void sensitiveGoToPreviousPage (gboolean sensitive) = 0; 202 202 203 #if defined (HAVE_CUPS) 204 /// 205 /// @brief Changes the sensitivity of the "Print" action. 206 /// 207 /// The view must change the sensitivity (it's called enabled or 208 /// disabled on some toolkits) of the "Print" action 209 /// (both on the menu and the toolbar or any other place). 210 /// 211 /// @param sensitive Set to TRUE if need to make the action 212 /// sensitive (enable) or FALSE to 213 /// insensitive (disable) it. 214 /// 215 virtual void sensitivePrint (gboolean sensitive) = 0; 216 #endif // HAVE_CUPS 217 203 218 /// 204 219 /// @brief Changes the sensitivity of the "Open" action. trunk/src/MainPter.cxx
r209 r212 138 138 view.activeZoomWidth (config.zoomToWidth ()); 139 139 view.setTotalPages (m_Document->getNumPages ()); 140 #if defined (HAVE_CUPS) 141 view.sensitivePrint (TRUE); 142 #endif // HAVE_CUPS 140 143 141 144 checkZoomSettings (); … … 166 169 view.sensitiveZoomWidth (FALSE); 167 170 showSidebar = FALSE; 171 #if defined (HAVE_CUPS) 172 view.sensitivePrint (FALSE); 173 #endif // HAVE_CUPS 168 174 } 169 175 … … 218 224 view.sensitiveZoomWidth (FALSE); 219 225 view.sensitiveOpen (FALSE); 226 #if defined (HAVE_CUPS) 227 view.sensitivePrint (FALSE); 228 #endif // HAVE_CUPS 220 229 // Show the text on the status bar. 221 230 gchar *statusText = NULL; trunk/src/gtk/MainView.cxx
r201 r212 72 72 static void main_window_zoom_width_cb (GtkToggleAction *, gpointer); 73 73 74 #if defined (HAVE_CUPS) 75 static void main_window_print_cb (GtkWidget *, gpointer); 76 #endif // HAVE_CUPS 77 74 78 // The actions for menus and toolbars. 75 79 static const GtkActionEntry g_NormalEntries[] = … … 92 96 N_("Save a copy of the current document"), 93 97 G_CALLBACK (main_window_save_file_cb) }, 98 99 #if defined (HAVE_CUPS) 100 { "Print", GTK_STOCK_PRINT, N_("_Print..."), "<control>P", 101 N_("Print the current document"), 102 G_CALLBACK (main_window_print_cb) }, 103 #endif // HAVE_CUPS 94 104 95 105 { "Quit", GTK_STOCK_CLOSE, N_("_Close"), "<control>W", … … 238 248 MainView::activeZoomFit (gboolean active) 239 249 { 240 GtkAction *zoomFit = 250 GtkAction *zoomFit = 241 251 gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomFit"); 242 252 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (zoomFit), active); … … 426 436 MainView::sensitiveGoToLastPage (gboolean sensitive) 427 437 { 428 GtkAction *goToLastPage = 438 GtkAction *goToLastPage = 429 439 gtk_ui_manager_get_action (m_UIManager, "/MenuBar/GoMenu/GoToLastPage"); 430 440 gtk_action_set_sensitive (goToLastPage, sensitive); … … 434 444 MainView::sensitiveGoToNextPage (gboolean sensitive) 435 445 { 436 GtkAction *goToNextPage = 446 GtkAction *goToNextPage = 437 447 gtk_ui_manager_get_action (m_UIManager, "/MenuBar/GoMenu/GoToNextPage"); 438 448 gtk_action_set_sensitive (goToNextPage, sensitive); … … 453 463 } 454 464 455 void 465 void 456 466 MainView::sensitiveOpen (gboolean sensitive) 457 467 { 458 GtkAction *open = 468 GtkAction *open = 459 469 gtk_ui_manager_get_action (m_UIManager, "/MenuBar/FileMenu/OpenFile"); 460 470 gtk_action_set_sensitive (open, sensitive); 461 471 } 472 473 #if defined (HAVE_CUPS) 474 void 475 MainView::sensitivePrint (gboolean sensitive) 476 { 477 GtkAction *print = gtk_ui_manager_get_action (m_UIManager, 478 "/MenuBar/FileMenu/PrintPlaceHolder/Print"); 479 gtk_action_set_sensitive (print, sensitive); 480 } 481 #endif // HAVE_CUPS 462 482 463 483 void … … 852 872 exit (EXIT_FAILURE); 853 873 } 874 875 #if defined (HAVE_CUPS) 876 if ( !gtk_ui_manager_add_ui_from_file (m_UIManager, 877 DATADIR"/ui/epdfview-ui-print.xml", 878 &error) ) 879 { 880 g_critical (_("Error building UI manager: %s\n"), error->message); 881 g_error_free (error); 882 exit (EXIT_FAILURE); 883 } 884 #endif // HAVE_CUPS 854 885 855 886 // Set the previous and next pages tool items important, so they will … … 1155 1186 } 1156 1187 1188 #if defined (HAVE_CUPS) 1189 /// 1190 /// 1191 /// @brief The user wants to print the current document. 1192 /// 1193 void 1194 main_window_print_cb (GtkWidget *widget, gpointer data) 1195 { 1196 g_assert ( NULL != data && "The data parameter is NULL."); 1197 1198 MainPter *pter = (MainPter *)data; 1199 } 1200 #endif // HAVE_CUPS 1201 1157 1202 /// 1158 1203 /// @brief Called when the window is closed or Quit is activated. trunk/src/gtk/MainView.h
r201 r212 47 47 void sensitiveReload (gboolean sensitive); 48 48 void sensitiveOpen (gboolean sensitive); 49 #if defined (HAVE_CUPS) 50 void sensitivePrint (gboolean sensitive); 51 #endif // HAVE_CUPS 49 52 void sensitiveRotateLeft (gboolean sensitive); 50 53 void sensitiveRotateRight (gboolean sensitive); trunk/src/gtk/PageView.cxx
r208 r212 371 371 // get the current widget size and the current image size to know 372 372 // how many widget space is being used for padding. 373 gint horizontalPadding = PAGE_VIEW_PADDING; 374 gint verticalPadding = PAGE_VIEW_PADDING; 373 375 GdkPixbuf *page = gtk_image_get_pixbuf (GTK_IMAGE (m_PageImage)); 374 gint horizontalPadding = 375 (m_PageImage->allocation.width - gdk_pixbuf_get_width (page)) / 2; 376 gint verticalPadding = 377 (m_PageImage->allocation.height - gdk_pixbuf_get_height (page)) / 2; 376 if ( NULL != page ) 377 { 378 horizontalPadding = 379 (m_PageImage->allocation.width - gdk_pixbuf_get_width (page)) / 2; 380 verticalPadding = 381 (m_PageImage->allocation.height - gdk_pixbuf_get_height (page)) / 2; 382 } 378 383 379 384 *pageX = widgetX - horizontalPadding + (gint)getHorizontalScroll (); trunk/tests/DumbMainView.cxx
r210 r212 46 46 m_SensitiveGoToPage = TRUE; 47 47 m_SensitiveGoToPreviousPage = TRUE; 48 m_SensitivePrint = TRUE; 48 49 m_SensitiveReload = TRUE; 49 50 m_SensitiveRotateLeft = TRUE; … … 177 178 178 179 void 180 DumbMainView::sensitivePrint (gboolean sensitive) 181 { 182 m_SensitivePrint = sensitive; 183 } 184 185 void 179 186 DumbMainView::sensitiveReload (gboolean sensitive) 180 187 { … … 397 404 { 398 405 return m_SensitiveGoToPreviousPage; 406 } 407 408 gboolean 409 DumbMainView::isSensitivePrint () 410 { 411 return m_SensitivePrint; 399 412 } 400 413 trunk/tests/DumbMainView.h
r210 r212 19 19 #define __DUMB_MAIN_VIEW_H__ 20 20 21 namespace ePDFView 21 namespace ePDFView 22 22 { 23 23 // Forward declarations. 24 24 class DumbFindView; 25 25 class DumbPageView; 26 26 27 27 class DumbMainView: public IMainView 28 28 { … … 48 48 void sensitiveGoToPreviousPage (gboolean sensitive); 49 49 void sensitiveOpen (gboolean sensitive); 50 void sensitivePrint (gboolean sensitive); 50 51 void sensitiveReload (gboolean sensitive); 51 52 void sensitiveRotateLeft (gboolean sensitive); … … 86 87 gboolean isSensitiveGoToPage (void); 87 88 gboolean isSensitiveGoToPreviousPage (void); 89 gboolean isSensitivePrint (void); 88 90 gboolean isSensitiveReload (void); 89 91 gboolean isSensitiveRotateLeft (void); … … 122 124 gboolean m_SensitiveGoToPage; 123 125 gboolean m_SensitiveGoToPreviousPage; 126 gboolean m_SensitivePrint; 124 127 gboolean m_SensitiveReload; 125 128 gboolean m_SensitiveRotateLeft; trunk/tests/MainPterTest.cxx
r210 r212 93 93 CPPUNIT_ASSERT (m_View->isShownToolbar ()); 94 94 CPPUNIT_ASSERT (m_View->isShownStatusbar ()); 95 #if defined (HAVE_CUPS) 96 CPPUNIT_ASSERT (!m_View->isSensitivePrint ()); 97 #endif // HAVE_CUPS 95 98 } 96 99 … … 127 130 CPPUNIT_ASSERT (m_View->isSensitiveZoomWidth ()); 128 131 CPPUNIT_ASSERT (!m_View->isShownIndex ()); 132 #if defined (HAVE_CUPS) 133 CPPUNIT_ASSERT (m_View->isSensitivePrint ()); 134 #endif // HAVE_CUPS 129 135 130 136 // Now try a document with a title. … … 149 155 CPPUNIT_ASSERT (m_View->isSensitiveZoomWidth ()); 150 156 CPPUNIT_ASSERT (!m_View->isShownIndex ()); 157 #if defined (HAVE_CUPS) 158 CPPUNIT_ASSERT (m_View->isSensitivePrint ()); 159 #endif // HAVE_CUPS 151 160 } 152 161 … … 179 188 CPPUNIT_ASSERT (!m_View->isSensitiveZoomWidth ()); 180 189 CPPUNIT_ASSERT (!m_View->shownError ()); 190 #if defined (HAVE_CUPS) 191 CPPUNIT_ASSERT (!m_View->isSensitivePrint ()); 192 #endif // HAVE_CUPS 181 193 } 182 194 … … 213 225 CPPUNIT_ASSERT (!m_View->isSensitiveZoomWidth ()); 214 226 CPPUNIT_ASSERT (m_View->shownError ()); 227 #if defined (HAVE_CUPS) 228 CPPUNIT_ASSERT (!m_View->isSensitivePrint ()); 229 #endif // HAVE_CUPS 215 230 } 216 231 … … 248 263 CPPUNIT_ASSERT (!m_View->isSensitiveZoomWidth ()); 249 264 CPPUNIT_ASSERT (!m_View->shownError ()); 265 #if defined (HAVE_CUPS) 266 CPPUNIT_ASSERT (!m_View->isSensitivePrint ()); 267 #endif // HAVE_CUPS 250 268 } 251 269 … … 284 302 CPPUNIT_ASSERT (m_View->shownError ()); 285 303 CPPUNIT_ASSERT_EQUAL (3, m_View->countTimesShownPasswordPrompt ()); 304 #if defined (HAVE_CUPS) 305 CPPUNIT_ASSERT (!m_View->isSensitivePrint ()); 306 #endif // HAVE_CUPS 286 307 } 287 308 … … 319 340 CPPUNIT_ASSERT (!m_View->shownError ()); 320 341 CPPUNIT_ASSERT_EQUAL (1, m_View->countTimesShownPasswordPrompt ()); 342 #if defined (HAVE_CUPS) 343 CPPUNIT_ASSERT (m_View->isSensitivePrint ()); 344 #endif // HAVE_CUPS 321 345 } 322 346
