Changeset 99 for trunk/src/gtk/MainView.cxx
- Timestamp:
- 04/20/06 13:09:22 (3 years ago)
- Files:
-
- 1 modified
-
trunk/src/gtk/MainView.cxx (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gtk/MainView.cxx
r97 r99 46 46 static void main_window_open_file_cb (GtkWidget *, gpointer); 47 47 static void main_window_outline_cb (GtkTreeSelection *, gpointer); 48 static void main_window_page_view_resized_cb (GtkWidget *, GtkAllocation *, 49 gpointer); 48 50 static void main_window_quit_cb (GtkWidget *, gpointer); 49 51 static void main_window_show_sidebar_cb (GtkToggleAction *, gpointer); 50 52 static void main_window_show_statusbar_cb (GtkToggleAction *, gpointer); 51 53 static void main_window_show_toolbar_cb (GtkToggleAction *, gpointer); 52 static void main_window_zoom_fit_cb (Gtk Widget*, gpointer);54 static void main_window_zoom_fit_cb (GtkToggleAction *, gpointer); 53 55 static void main_window_zoom_in_cb (GtkWidget *, gpointer); 54 56 static void main_window_zoom_out_cb (GtkWidget *, gpointer); 55 static void main_window_zoom_width_cb (Gtk Widget*, gpointer);57 static void main_window_zoom_width_cb (GtkToggleAction *, gpointer); 56 58 57 59 // The actions for menus and toolbars. … … 83 85 G_CALLBACK (main_window_zoom_out_cb) }, 84 86 85 { "ZoomFit", GTK_STOCK_ZOOM_FIT, N_("Zoom to _Fit"), NULL,86 N_("Make the current document fill the window"),87 G_CALLBACK (main_window_zoom_fit_cb) },88 89 { "ZoomWidth", EPDFVIEW_STOCK_ZOOM_WIDTH, N_("Zoom to _Width"), NULL,90 N_("Make the current document fill the window width"),91 G_CALLBACK (main_window_zoom_width_cb) },92 93 87 { "RotateRight", EPDFVIEW_STOCK_ROTATE_RIGHT, N_("Rotate _Right"), NULL, 94 88 N_("Rotate the document 90 degrees clockwise"), … … 130 124 { "ShowSideBar", NULL, N_("Show O_utline"), NULL, 131 125 N_("Show or hide the document's outline"), 132 G_CALLBACK (main_window_show_sidebar_cb), FALSE } 126 G_CALLBACK (main_window_show_sidebar_cb), FALSE }, 127 128 { "ZoomFit", GTK_STOCK_ZOOM_FIT, N_("Zoom to _Fit"), NULL, 129 N_("Make the current document fill the window"), 130 G_CALLBACK (main_window_zoom_fit_cb), FALSE }, 131 132 { "ZoomWidth", EPDFVIEW_STOCK_ZOOM_WIDTH, N_("Zoom to _Width"), NULL, 133 N_("Make the current document fill the window width"), 134 G_CALLBACK (main_window_zoom_width_cb), FALSE } 135 133 136 }; 134 137 … … 190 193 } 191 194 195 void 196 MainView::activeZoomFit (gboolean active) 197 { 198 GtkAction *zoomFit = 199 gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomFit"); 200 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (zoomFit), active); 201 } 202 203 void 204 MainView::activeZoomWidth (gboolean active) 205 { 206 GtkAction *zoomWidth = 207 gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomWidth"); 208 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (zoomWidth), active); 209 } 192 210 193 211 gchar * … … 513 531 GTK_POLICY_AUTOMATIC, 514 532 GTK_POLICY_AUTOMATIC); 533 // When resizing. 534 g_signal_connect (G_OBJECT (m_PageViewScroll), "size-allocate", 535 G_CALLBACK (main_window_page_view_resized_cb), m_Pter); 536 // The actual image, 515 537 m_PageView = gtk_image_new (); 516 538 gtk_misc_set_padding (GTK_MISC (m_PageView), … … 586 608 gtk_action_group_add_toggle_actions (actionGroup, g_ToggleEntries, 587 609 G_N_ELEMENTS (g_ToggleEntries), 588 this);610 m_Pter); 589 611 m_UIManager = gtk_ui_manager_new (); 590 612 gtk_ui_manager_insert_action_group (m_UIManager, actionGroup, 0); … … 919 941 } 920 942 } 943 944 /// 945 /// @brief The page view has been resized. 946 static void 947 main_window_page_view_resized_cb (GtkWidget *widget, GtkAllocation *allocation, 948 gpointer data) 949 { 950 g_assert ( NULL != data && "The data parameter is NULL."); 951 952 gint scrollSize = SCROLLBARS_SIZE + PAGE_VIEW_PADDING * 2; 953 gint width = allocation->width - scrollSize; 954 gint height = allocation->height - scrollSize; 955 MainPter *pter = (MainPter *)data; 956 pter->pageViewResized (width, height); 957 } 958 921 959 /// 922 960 /// @brief Called when the window is closed or Quit is activated. … … 936 974 g_assert ( NULL != data && "The data parameter is NULL."); 937 975 938 MainView *view = (MainView *)data;939 view->showSidebar (gtk_toggle_action_get_active (action));976 // MainView *view = (MainView *)data; 977 // view->showSidebar (gtk_toggle_action_get_active (action)); 940 978 } 941 979 … … 948 986 g_assert ( NULL != data && "The data parameter is NULL."); 949 987 950 MainView *view = (MainView *)data;951 view->showStatusbar (gtk_toggle_action_get_active (action));988 // MainView *view = (MainView *)data; 989 // view->showStatusbar (gtk_toggle_action_get_active (action)); 952 990 } 953 991 … … 960 998 g_assert ( NULL != data && "The data parameter is NULL."); 961 999 962 MainView *view = (MainView *)data;963 view->showToolbar (gtk_toggle_action_get_active (action));1000 // MainView *view = (MainView *)data; 1001 // view->showToolbar (gtk_toggle_action_get_active (action)); 964 1002 } 965 1003 … … 968 1006 /// 969 1007 void 970 main_window_zoom_fit_cb (Gtk Widget *widget, gpointer data)971 { 972 g_assert ( NULL != data && "The data parameter is NULL."); 973 974 MainPter *pter = (MainPter *)data; 975 pter->zoomFitActivated ( );1008 main_window_zoom_fit_cb (GtkToggleAction *action, gpointer data) 1009 { 1010 g_assert ( NULL != data && "The data parameter is NULL."); 1011 1012 MainPter *pter = (MainPter *)data; 1013 pter->zoomFitActivated (gtk_toggle_action_get_active (action)); 976 1014 } 977 1015 … … 1004 1042 /// 1005 1043 void 1006 main_window_zoom_width_cb (Gtk Widget *widget, gpointer data)1007 { 1008 g_assert ( NULL != data && "The data parameter is NULL."); 1009 1010 MainPter *pter = (MainPter *)data; 1011 pter->zoomWidthActivated ( );1012 } 1044 main_window_zoom_width_cb (GtkToggleAction *action, gpointer data) 1045 { 1046 g_assert ( NULL != data && "The data parameter is NULL."); 1047 1048 MainPter *pter = (MainPter *)data; 1049 pter->zoomWidthActivated (gtk_toggle_action_get_active (action)); 1050 }
