Changeset 38
- Timestamp:
- 04/12/06 07:27:49 (3 years ago)
- Location:
- trunk/src/gtk
- Files:
-
- 2 modified
-
MainView.cxx (modified) (6 diffs)
-
MainView.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gtk/MainView.cxx
r37 r38 34 34 static void main_window_open_file_cb (GtkWidget *, gpointer); 35 35 static void main_window_quit_cb (GtkWidget *, gpointer); 36 static void main_window_zoom_fit_cb (GtkWidget *, gpointer); 37 static void main_window_zoom_in_cb (GtkWidget *, gpointer); 38 static void main_window_zoom_out_cb (GtkWidget *, gpointer); 39 static void main_window_zoom_width_cb (GtkWidget *, gpointer); 36 40 37 41 //////////////////////////////////////////////////////////////// … … 60 64 gtk_box_pack_start (GTK_BOX (m_MainBox), toolBar, FALSE, FALSE, 0); 61 65 // Create the page view 62 GtkWidget *pageView =createPageView ();63 gtk_box_pack_start (GTK_BOX (m_MainBox), pageView, TRUE, TRUE, 0);66 createPageView (); 67 gtk_box_pack_start (GTK_BOX (m_MainBox), m_PageViewScroll, TRUE, TRUE, 0); 64 68 } 65 69 … … 231 235 MainView::getPageViewSize (gint *width, gint *height) 232 236 { 237 g_assert (NULL != width && "Tried to save the width to a NULL pointer."); 238 g_assert (NULL != height && "Tried to save the height to a NULL pointer."); 239 240 *width = m_PageView->allocation.width - 12; 241 *height = m_PageViewScroll->allocation.height - 12; 233 242 } 234 243 … … 243 252 //////////////////////////////////////////////////////////////// 244 253 245 GtkWidget * 254 void 246 255 MainView::createPageView () 247 256 { 248 GtkWidget *scrolledWindow= gtk_scrolled_window_new (NULL, NULL);249 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW ( scrolledWindow),257 m_PageViewScroll = gtk_scrolled_window_new (NULL, NULL); 258 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_PageViewScroll), 250 259 GTK_POLICY_AUTOMATIC, 251 260 GTK_POLICY_AUTOMATIC); 252 261 m_PageView = gtk_image_new (); 253 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledWindow), 254 m_PageView); 255 return scrolledWindow; 262 gtk_scrolled_window_add_with_viewport ( 263 GTK_SCROLLED_WINDOW (m_PageViewScroll), m_PageView); 256 264 } 257 265 … … 267 275 { "OpenFile", GTK_STOCK_OPEN, _("_Open"), "<control>O", NULL, G_CALLBACK (main_window_open_file_cb) }, 268 276 { "Quit", GTK_STOCK_QUIT, _("_Quit"), "<control>Q", NULL, G_CALLBACK (main_window_quit_cb) }, 269 { "ZoomIn", GTK_STOCK_ZOOM_IN, _("Zoom _In"), "plus", NULL, NULL},270 { "ZoomOut", GTK_STOCK_ZOOM_OUT, _("Zoom _Out"), "minus", NULL, NULL},271 { "ZoomFit", GTK_STOCK_ZOOM_FIT, _("Zoom to _Fit"), NULL, NULL, NULL},272 { "ZoomWidth", NULL, _("Zoom to _Width"), NULL, NULL, NULL},277 { "ZoomIn", GTK_STOCK_ZOOM_IN, _("Zoom _In"), "plus", NULL, G_CALLBACK (main_window_zoom_in_cb) }, 278 { "ZoomOut", GTK_STOCK_ZOOM_OUT, _("Zoom _Out"), "minus", NULL, G_CALLBACK (main_window_zoom_out_cb) }, 279 { "ZoomFit", GTK_STOCK_ZOOM_FIT, _("Zoom to _Fit"), NULL, NULL, G_CALLBACK (main_window_zoom_fit_cb) }, 280 { "ZoomWidth", NULL, _("Zoom to _Width"), NULL, NULL, G_CALLBACK (main_window_zoom_width_cb) }, 273 281 { "RotateRight", GTK_STOCK_REDO, _("Rotate _Right"), NULL, NULL, G_CALLBACK (main_window_rotate_right)}, 274 282 { "RotateLeft", GTK_STOCK_UNDO, _("Rotate Left"), NULL, NULL, G_CALLBACK (main_window_rotate_left)}, … … 426 434 gtk_main_quit (); 427 435 } 436 437 void 438 main_window_zoom_fit_cb (GtkWidget *widget, gpointer data) 439 { 440 g_assert ( NULL != data && "The data parameter is NULL."); 441 442 MainPter *pter = (MainPter *)data; 443 pter->zoomFitActivated (); 444 } 445 446 void 447 main_window_zoom_in_cb (GtkWidget *widget, gpointer data) 448 { 449 g_assert ( NULL != data && "The data parameter is NULL."); 450 451 MainPter *pter = (MainPter *)data; 452 pter->zoomInActivated (); 453 } 454 455 void 456 main_window_zoom_out_cb (GtkWidget *widget, gpointer data) 457 { 458 g_assert ( NULL != data && "The data parameter is NULL."); 459 460 MainPter *pter = (MainPter *)data; 461 pter->zoomOutActivated (); 462 } 463 464 void 465 main_window_zoom_width_cb (GtkWidget *widget, gpointer data) 466 { 467 g_assert ( NULL != data && "The data parameter is NULL."); 468 469 MainPter *pter = (MainPter *)data; 470 pter->zoomWidthActivated (); 471 } -
trunk/src/gtk/MainView.h
r36 r38 58 58 GtkWidget *m_MainBox; 59 59 GtkWidget *m_PageView; 60 GtkWidget *m_PageViewScroll; 60 61 GtkUIManager *m_UIManager; 61 62 62 GtkWidget *createPageView (void);63 void createPageView (void); 63 64 void createUIManager (void); 64 65 GdkPixbuf *getPixbufFromPage (DocumentPage *page);
