Changeset 199
- Timestamp:
- 05/28/06 15:57:37 (2 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 8 modified
-
IMainView.h (modified) (19 diffs)
-
MainPter.cxx (modified) (11 diffs)
-
MainPter.h (modified) (1 diff)
-
gtk/FindView.cxx (modified) (1 diff)
-
gtk/MainView.cxx (modified) (23 diffs)
-
gtk/MainView.h (modified) (2 diffs)
-
gtk/Makefile.am (modified) (1 diff)
-
gtk/PageView.h (modified) (1 diff)
-
gtk/PreferencesView.cxx (added)
-
gtk/PreferencesView.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/IMainView.h
r172 r199 66 66 /// 67 67 virtual void activeZoomFit (gboolean active) = 0; 68 68 69 69 /// 70 70 /// @brief Actives or deactivates the zoom to width. … … 77 77 /// 78 78 virtual void activeZoomWidth (gboolean active) = 0; 79 79 80 80 /// 81 81 /// @brief Shows the open file dialog. … … 106 106 /// 107 107 virtual gchar *promptPasswordDialog (void) = 0; 108 108 109 109 /// 110 110 /// @brief Changes the sensitivity of the "Find" action. … … 132 132 /// 133 133 virtual void sensitiveGoToFirstPage (gboolean sensitive) = 0; 134 134 135 135 /// 136 136 /// @brief Changes the sensitivity of the "Go To Last Page" action. … … 145 145 /// 146 146 virtual void sensitiveGoToLastPage (gboolean sensitive) = 0; 147 147 148 148 /// 149 149 /// @brief Changes the sensitivity of the "Go To Next Page" action. … … 158 158 /// 159 159 virtual void sensitiveGoToNextPage (gboolean sensitive) = 0; 160 160 161 161 /// 162 162 /// @brief Changes the sensitivity of the "Go To Page" action. … … 171 171 /// 172 172 virtual void sensitiveGoToPage (gboolean sensitive) = 0; 173 173 174 174 /// 175 175 /// @brief Changes the sensitivity of the "Go To Prev. Page" action. … … 184 184 /// 185 185 virtual void sensitiveGoToPreviousPage (gboolean sensitive) = 0; 186 186 187 187 /// 188 188 /// @brief Changes the sensitivity of the "Open" action. … … 210 210 /// 211 211 virtual void sensitiveReload (gboolean sensitive) = 0; 212 212 213 213 /// 214 214 /// @brief Changes the sensitivity of the "Rotate Left" action. … … 223 223 /// 224 224 virtual void sensitiveRotateLeft (gboolean sensitive) = 0; 225 225 226 226 /// 227 227 /// @brief Changes the sensitivity of the "Rotate Right" action. … … 236 236 /// 237 237 virtual void sensitiveRotateRight (gboolean sensitive) = 0; 238 238 239 239 /// 240 240 /// @brief Changes the sensitivity of the "Zoom In" action. … … 249 249 /// 250 250 virtual void sensitiveZoomIn (gboolean sensitive) = 0; 251 251 252 252 /// 253 253 /// @brief Changes the sensitivity of the "Zoom Out" action. … … 262 262 /// 263 263 virtual void sensitiveZoomOut (gboolean sensitive) = 0; 264 264 265 265 /// 266 266 /// @brief Changes the sensitivity of the "Zoom to Fit" action. … … 275 275 /// 276 276 virtual void sensitiveZoomFit (gboolean sensitive) = 0; 277 277 278 278 /// 279 279 /// @brief Changes the sensitivity of the "Zoom to Width" action. … … 331 331 /// @param body The error dialog's body (the error message.) 332 332 /// 333 virtual void showErrorMessage (const gchar *title, 333 virtual void showErrorMessage (const gchar *title, 334 334 const gchar *body) = 0; 335 335 336 336 /// 337 337 /// @brief Shows the document's index. … … 359 359 /// 360 360 virtual void showStatusbar (gboolean show) = 0; 361 361 362 362 /// 363 363 /// @brief Shows the tool bar. … … 369 369 /// 370 370 virtual void showToolbar (gboolean show) = 0; 371 371 372 372 /// 373 373 /// @brief Gives the number of pages that the document has. … … 417 417 /// freed by the main view. 418 418 virtual IFindView *getFindView (void) = 0; 419 419 420 420 /// 421 421 /// @brief Gets the page's view. … … 432 432 /// 433 433 virtual IPageView *getPageView (void) = 0; 434 435 /// 436 /// @brief Gets the preferences' view. 437 /// 438 /// The preferences view is created each time the presenter 439 /// calls this function, with the main view as its parent window. 440 /// 441 /// @return The new preferences view. The returned pointer 442 /// must be freed by the caller. 443 /// 444 virtual IPreferencesView *getPreferencesView (void) = 0; 434 445 435 446 /// -
trunk/src/MainPter.cxx
r177 r199 104 104 { 105 105 g_assert ( NULL != m_Document && "The document is NULL."); 106 106 107 107 IMainView &view = getView (); 108 108 Config &config = Config::getConfig (); … … 137 137 0 < m_Document->getOutline ()->getNumChildren () && 138 138 PageModeOutlines == m_Document->getPageMode ()); 139 140 139 } 141 140 else … … 174 173 // by the first outline is selected and we don't want this. 175 174 view.show (); 176 177 175 } 178 176 … … 307 305 g_assert (NULL != m_Document && 308 306 "Tried to go to the next page of a NULL document."); 309 307 310 308 if ( m_Document->getCurrentPageNum () < m_Document->getNumPages () ) 311 309 { … … 325 323 MainPter::goToPageActivated () 326 324 { 327 g_assert (NULL != m_Document && 325 g_assert (NULL != m_Document && 328 326 "Tried to go to the a page of a NULL document."); 329 327 330 328 // First try to get the page number from the view. 331 329 const gchar *goToPageText = getView ().getGoToPageText (); … … 346 344 getView ().setGoToPageText (goToPageText); 347 345 g_free (goToPageText); 348 349 346 } 350 347 } … … 359 356 g_assert (NULL != m_Document && 360 357 "Tried to go to the previous page of a NULL document."); 361 358 362 359 if ( 1 < m_Document->getCurrentPageNum () ) 363 360 { … … 386 383 if ( NULL != fileName ) 387 384 { 388 gchar *dirName = g_path_get_dirname (fileName); 385 gchar *dirName = g_path_get_dirname (fileName); 389 386 config.setOpenFileFolder (dirName); 390 387 g_free (dirName); … … 407 404 { 408 405 g_assert (NULL != outline && "The outline activated is NULL."); 409 406 410 407 m_PagePter->setNextPageScroll (PAGE_SCROLL_START); 411 408 m_Document->goToPage (outline->getDestinationPage ()); … … 413 410 414 411 /// 412 /// @brief The "Preferences" was activated. 413 /// 414 void 415 MainPter::preferencesActivated () 416 { 417 PreferencesPter *preferences = new PreferencesPter (); 418 IPreferencesView *view = getView ().getPreferencesView (); 419 if ( NULL != view ) 420 { 421 preferences->setView (view); 422 } 423 // There's no need to keep a pointer of the preferences presenter because 424 // when the dialog is closed of the application is finished it will 425 // destroy itself. 426 } 427 428 /// 415 429 /// @brief The "Reload" was activated. 416 430 /// … … 420 434 void 421 435 MainPter::reloadActivated () 422 { 436 { 423 437 g_assert ( m_Document->isLoaded () && 424 438 "Tried to reload a yet to load document."); -
trunk/src/MainPter.h
r159 r199 52 52 void goToPageActivated (void); 53 53 void goToPreviousPageActivated (void); 54 gboolean openDocument (const gchar *fileName, 54 gboolean openDocument (const gchar *fileName, 55 55 const gchar *oldPassword, GError **error); 56 56 void openFileActivated (void); 57 57 void outlineActivated (DocumentOutline *outline); 58 void preferencesActivated (void); 58 59 void reloadActivated (void); 59 60 void rotateLeftActivated (void); -
trunk/src/gtk/FindView.cxx
r164 r199 134 134 (gpointer) find_view_close_cb, oldPter); 135 135 } 136 136 137 137 IFindView::setPresenter (pter); 138 138 -
trunk/src/gtk/MainView.cxx
r188 r199 25 25 #include "FindView.h" 26 26 #include "PageView.h" 27 #include "PreferencesView.h" 27 28 #include "MainView.h" 28 29 … … 33 34 34 35 // Enumerations. 35 static enum 36 static enum 36 37 { 37 38 outlineTitleColumn, … … 56 57 static void main_window_open_file_cb (GtkWidget *, gpointer); 57 58 static void main_window_outline_cb (GtkTreeSelection *, gpointer); 59 static void main_window_preferences_cb (GtkWidget *, gpointer); 58 60 static void main_window_quit_cb (GtkWidget *, gpointer); 59 61 static void main_window_show_index_cb (GtkToggleAction *, gpointer); … … 74 76 { "HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL }, 75 77 76 { "OpenFile", GTK_STOCK_OPEN, N_("_Open"), "<control>O", 78 { "OpenFile", GTK_STOCK_OPEN, N_("_Open"), "<control>O", 77 79 N_("Open a PDF document"), 78 80 G_CALLBACK (main_window_open_file_cb) }, … … 81 83 N_("Reload the current document"), 82 84 G_CALLBACK (main_window_reload_cb) }, 83 84 { "Quit", GTK_STOCK_CLOSE, N_("_Close"), "<control>W", 85 N_("Close this window"), 85 86 { "Quit", GTK_STOCK_CLOSE, N_("_Close"), "<control>W", 87 N_("Close this window"), 86 88 G_CALLBACK (main_window_quit_cb) }, 87 89 … … 89 91 N_("Find a word in the document"), 90 92 G_CALLBACK (main_window_find_cb) }, 91 92 { "ZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _In"), "<control>plus", 93 N_("Enlarge the document"), 93 94 { "Preferences", GTK_STOCK_PREFERENCES, N_("Preferences..."), NULL, 95 N_("Change the application's preferences"), 96 G_CALLBACK (main_window_preferences_cb) }, 97 98 { "ZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _In"), "<control>plus", 99 N_("Enlarge the document"), 94 100 G_CALLBACK (main_window_zoom_in_cb) }, 95 101 96 { "ZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), "<control>minus", 97 N_("Shrink the document"), 102 { "ZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), "<control>minus", 103 N_("Shrink the document"), 98 104 G_CALLBACK (main_window_zoom_out_cb) }, 99 100 { "RotateRight", EPDFVIEW_STOCK_ROTATE_RIGHT, N_("Rotate _Right"), NULL, 101 N_("Rotate the document 90 degrees clockwise"), 105 106 { "RotateRight", EPDFVIEW_STOCK_ROTATE_RIGHT, N_("Rotate _Right"), NULL, 107 N_("Rotate the document 90 degrees clockwise"), 102 108 G_CALLBACK (main_window_rotate_right_cb) }, 103 109 104 { "RotateLeft", EPDFVIEW_STOCK_ROTATE_LEFT, N_("Rotate _Left"), NULL, 105 N_("Rotate the document 90 degrees counter-clockwise"), 110 { "RotateLeft", EPDFVIEW_STOCK_ROTATE_LEFT, N_("Rotate _Left"), NULL, 111 N_("Rotate the document 90 degrees counter-clockwise"), 106 112 G_CALLBACK (main_window_rotate_left_cb) }, 107 113 108 114 { "GoToFirstPage", GTK_STOCK_GOTO_FIRST, N_("_First Page"), "<control>Home", 109 N_("Go to the first page"), 115 N_("Go to the first page"), 110 116 G_CALLBACK (main_window_go_to_first_page_cb) }, 111 117 112 { "GoToNextPage", GTK_STOCK_GO_FORWARD, N_("_Next Page"), "<Shift>Page_Down", 113 N_("Go to the next page"), 118 { "GoToNextPage", GTK_STOCK_GO_FORWARD, N_("_Next Page"), "<Shift>Page_Down", 119 N_("Go to the next page"), 114 120 G_CALLBACK (main_window_go_to_next_page_cb) }, 115 121 116 { "GoToPreviousPage", GTK_STOCK_GO_BACK, N_("_Previous Page"), "<Shift>Page_Up", 122 { "GoToPreviousPage", GTK_STOCK_GO_BACK, N_("_Previous Page"), "<Shift>Page_Up", 117 123 N_("Go to the previous page"), 118 124 G_CALLBACK (main_window_go_to_previous_page_cb) }, … … 122 128 G_CALLBACK (main_window_go_to_last_page_cb) }, 123 129 124 { "About", GTK_STOCK_ABOUT, N_("_About"), NULL, 125 N_("Display application's credits"), 130 { "About", GTK_STOCK_ABOUT, N_("_About"), NULL, 131 N_("Display application's credits"), 126 132 G_CALLBACK (main_window_about_box_cb) }, 127 133 … … 131 137 }; 132 138 133 static GtkToggleActionEntry g_ToggleEntries[] = 139 static GtkToggleActionEntry g_ToggleEntries[] = 134 140 { 135 141 { "ShowToolBar", NULL, N_("Show _Toolbar"), NULL, … … 144 150 145 151 { "ZoomFit", GTK_STOCK_ZOOM_FIT, N_("Zoom to _Fit"), NULL, 146 N_("Make the current document fill the window"), 152 N_("Make the current document fill the window"), 147 153 G_CALLBACK (main_window_zoom_fit_cb), FALSE }, 148 154 149 155 { "ZoomWidth", EPDFVIEW_STOCK_ZOOM_WIDTH, N_("Zoom to _Width"), NULL, 150 N_("Make the current document fill the window width"), 156 N_("Make the current document fill the window width"), 151 157 G_CALLBACK (main_window_zoom_width_cb), FALSE } 152 158 … … 225 231 MainView::activeZoomWidth (gboolean active) 226 232 { 227 GtkAction *zoomWidth = 233 GtkAction *zoomWidth = 228 234 gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomWidth"); 229 235 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (zoomWidth), active); … … 241 247 gtk_dialog_set_alternative_button_order (GTK_DIALOG (openDialog), 242 248 GTK_RESPONSE_ACCEPT, GTK_RESPONSE_CANCEL, -1); 243 249 244 250 // Select the last used folder as the initial folder, if any. 245 251 if ( NULL != lastFolder ) … … 555 561 IPageView * 556 562 MainView::getPageView () 557 { 563 { 558 564 return m_PageView; 559 565 } 560 566 561 void 567 IPreferencesView * 568 MainView::getPreferencesView () 569 { 570 return new PreferencesView (GTK_WINDOW (m_MainWindow)); 571 } 572 573 void 562 574 MainView::setTitle (const gchar *title) 563 575 { … … 600 612 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (toggleAction), show); 601 613 GtkWidget *toolBar = gtk_ui_manager_get_widget (m_UIManager, "/ToolBar"); 602 if ( show ) 614 if ( show ) 603 615 { 604 616 gtk_widget_show (toolBar); … … 623 635 { 624 636 GtkWidget *hbox = gtk_hbox_new (FALSE, 3); 625 637 626 638 GtkWidget *pageLabel= gtk_label_new (_("Page")); 627 639 gtk_box_pack_start (GTK_BOX (hbox), pageLabel, FALSE, FALSE, 0); 628 640 629 641 m_CurrentPage = gtk_entry_new (); 630 642 gtk_entry_set_text (GTK_ENTRY (m_CurrentPage), _("0 of 0")); … … 633 645 G_CALLBACK (main_window_go_to_page_cb), m_Pter); 634 646 gtk_box_pack_start (GTK_BOX (hbox), m_CurrentPage, TRUE, TRUE, 0); 635 647 636 648 m_CurrentPageToolItem = gtk_tool_item_new (); 637 649 gtk_container_add (GTK_CONTAINER (m_CurrentPageToolItem), hbox); … … 653 665 // Create the page view. 654 666 m_PageView = new PageView (); 655 667 656 668 // Create the side bar, with the index tree. 657 669 m_Outline = gtk_tree_store_new (outlineNumColumns, … … 664 676 gtk_tree_view_column_set_title (column, _("Index")); 665 677 gtk_tree_view_append_column (GTK_TREE_VIEW (m_TreeIndex), column); 666 678 667 679 { 668 680 GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); … … 675 687 gtk_tree_view_column_set_attributes (column, renderer, "text", 0, NULL); 676 688 } 677 689 678 690 { 679 691 GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); … … 711 723 void 712 724 MainView::createUIManager () 713 { 725 { 714 726 GtkActionGroup *actionGroup = gtk_action_group_new ("ePDFView"); 715 727 // Set the translation domain for labels and tool tips. … … 723 735 m_UIManager = gtk_ui_manager_new (); 724 736 gtk_ui_manager_insert_action_group (m_UIManager, actionGroup, 0); 725 737 726 738 GError *error = NULL; 727 739 if ( !gtk_ui_manager_add_ui_from_file (m_UIManager, … … 756 768 "icon_epdfview-24.png", 757 769 }; 758 770 759 771 GList *iconList = NULL; 760 772 int iconFilesNum = G_N_ELEMENTS (iconFiles); … … 796 808 { 797 809 if ( NULL != outline ) 798 { 810 { 799 811 DocumentOutline *child = outline->getFirstChild (); 800 812 while (NULL != child) 801 813 { 802 GtkTreeIter childIter; 814 GtkTreeIter childIter; 803 815 gtk_tree_store_append (m_Outline, &childIter, rootIter); 804 816 gtk_tree_store_set (m_Outline, &childIter, … … 1025 1037 1026 1038 /// 1039 /// @brief The user wants to change the preferences. 1040 /// 1041 void 1042 main_window_preferences_cb (GtkWidget *widget, gpointer data) 1043 { 1044 g_assert ( NULL != data && "The data parameter is NULL."); 1045 1046 MainPter *pter = (MainPter *)data; 1047 pter->preferencesActivated (); 1048 } 1049 1050 /// 1027 1051 /// @brief Called when the window is closed or Quit is activated. 1028 1052 /// -
trunk/src/gtk/MainView.h
r159 r199 33 33 MainView (MainPter *pter); 34 34 ~MainView (); 35 35 36 36 void activeZoomFit (gboolean active); 37 37 void activeZoomWidth (gboolean active); … … 62 62 IFindView *getFindView (void); 63 63 IPageView *getPageView (void); 64 IPreferencesView *getPreferencesView (void); 64 65 void setTitle (const gchar *title); 65 66 void setOutline (DocumentOutline *outline); -
trunk/src/gtk/Makefile.am
r159 r199 5 5 FindView.h \ 6 6 MainView.cxx \ 7 MainView.h \7 MainView.h \ 8 8 PageView.cxx \ 9 9 PageView.h \ 10 PreferencesView.cxx \ 11 PreferencesView.h \ 10 12 StockIcons.cxx \ 11 13 StockIcons.h -
trunk/src/gtk/PageView.h
r165 r199 26 26 PageView (void); 27 27 ~PageView (void); 28 28 29 29 gdouble getHorizontalScroll (void); 30 30 GtkWidget *getTopWidget (void);
