Changeset 208
- Timestamp:
- 06/10/06 07:24:26 (2 years ago)
- Files:
-
- 1 modified
-
trunk/src/gtk/PageView.cxx (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gtk/PageView.cxx
r190 r208 90 90 g_assert (NULL != width && "Tried to save the width to a NULL pointer."); 91 91 g_assert (NULL != height && "Tried to save the height to a NULL pointer."); 92 92 93 93 gint vScrollSize = 0; 94 94 gint hScrollSize = 0; … … 119 119 gdouble docX1 = getHorizontalScroll () - PAGE_VIEW_PADDING; 120 120 gdouble docX2 = docX1 + hAdjustment->page_size; 121 121 122 122 gdouble dx = 0.0; 123 123 if ( realX1 < docX1 ) … … 134 134 hAdjustment->lower, 135 135 hAdjustment->upper - hAdjustment->page_size)); 136 136 137 137 // Calculate the vertical adjustment. 138 138 GtkAdjustment *vAdjustment = gtk_scrolled_window_get_vadjustment ( … … 211 211 { 212 212 IPageView::setPresenter (pter); 213 213 214 214 // When resizing. 215 215 g_signal_connect (G_OBJECT (m_PageScroll), "size-allocate", … … 245 245 hAdjustment->lower, 246 246 hAdjustment->upper - hAdjustment->page_size)); 247 247 248 248 GtkAdjustment *vAdjustment = gtk_scrolled_window_get_vadjustment ( 249 249 GTK_SCROLLED_WINDOW (m_PageScroll)); … … 295 295 gint width = gdk_pixbuf_get_width (originalPage); 296 296 gint height = gdk_pixbuf_get_height (originalPage); 297 298 PangoLayout *layout = 297 298 PangoLayout *layout = 299 299 gtk_widget_create_pango_layout (m_PageImage, text); 300 300 … … 318 318 pango_layout_set_font_description (layout, fontDescription); 319 319 pango_layout_get_pixel_extents (layout, NULL, &logicalRectangle); 320 320 321 321 // Once the font are set up, I just need to render 322 322 // the pixbuf to the pixmap (copying from client-side to … … 346 346 g_object_unref (mask); 347 347 } 348 348 349 349 gtk_image_set_from_pixbuf (GTK_IMAGE (m_PageImage), modifiedPage); 350 350 g_object_unref (modifiedPage); … … 366 366 { 367 367 g_assert ( NULL != pageX && "Tried to save the page's X to NULL."); 368 g_assert ( NULL != pageY && "Tried to save the page's Y to NULL."); 369 370 *pageX = widgetX - PAGE_VIEW_PADDING + (gint)getHorizontalScroll (); 371 *pageY = widgetY - PAGE_VIEW_PADDING + (gint)getVerticalScroll (); 368 g_assert ( NULL != pageY && "Tried to save the page's Y to NULL."); 369 370 // Since the page is centered on the GtkImage widget, we need to 371 // get the current widget size and the current image size to know 372 // how many widget space is being used for padding. 373 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; 378 379 *pageX = widgetX - horizontalPadding + (gint)getHorizontalScroll (); 380 *pageY = widgetY - verticalPadding + (gint)getVerticalScroll (); 372 381 } 373 382 … … 441 450 g_assert ( NULL != data && "The data is NULL."); 442 451 PageView *view = (PageView *)data; 443 452 444 453 gint event_x; 445 454 gint event_y; … … 459 468 g_assert (NULL != width && "Tried to save the width to a NULL pointer."); 460 469 g_assert (NULL != height && "Tried to save the height to a NULL pointer."); 461 470 462 471 gint borderWidth = widget->style->xthickness; 463 472 gint borderHeight = widget->style->ythickness; … … 468 477 borderHeight += widget->style->ythickness; 469 478 } 470 479 471 480 gint scrollBarSpacing = 0; 472 481 gtk_widget_style_get (widget, "scrollbar-spacing", &scrollBarSpacing, NULL); 473 482 474 483 GtkWidget *vScrollBar = GTK_SCROLLED_WINDOW (widget)->vscrollbar; 475 484 *width = vScrollBar->allocation.width + … … 489 498 { 490 499 g_assert ( NULL != data && "The data parameter is NULL."); 491 500 492 501 gint vScrollSize = 0; 493 502 gint hScrollSize = 0; … … 541 550 gboolean horizontal = FALSE; 542 551 PagePter *pter = (PagePter *)data; 543 552 544 553 GtkAdjustment *adjustment = 545 554 gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (widget)); 546 555 gdouble position = gtk_adjustment_get_value (adjustment); 547 556 548 557 if ( event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK) ) 549 558 { 550 559 return FALSE; 551 560 } 552 561 553 562 switch ( event->keyval ) 554 563 { … … 558 567 horizontal = TRUE; 559 568 break; 560 569 561 570 case GDK_Right: 562 571 case GDK_KP_Right: … … 564 573 direction = GTK_SCROLL_STEP_RIGHT; 565 574 break; 566 575 567 576 case GDK_Up: 568 577 case GDK_KP_Up: 569 578 direction = GTK_SCROLL_STEP_UP; 570 579 break; 571 580 572 581 case GDK_Down: 573 582 case GDK_KP_Down: 574 583 direction = GTK_SCROLL_STEP_DOWN; 575 584 break; 576 585 577 586 case GDK_Page_Up: 578 587 case GDK_KP_Page_Up: … … 584 593 direction = GTK_SCROLL_START; 585 594 break; 586 595 587 596 case GDK_Page_Down: 588 597 case GDK_KP_Page_Down: … … 594 603 direction = GTK_SCROLL_END; 595 604 break; 596 605 597 606 default: 598 607 return FALSE; 599 608 } 600 609 601 610 g_signal_emit_by_name(G_OBJECT(widget), "scroll-child", 602 611 direction, horizontal);
