Changeset 151
- Timestamp:
- 05/07/06 09:30:06 (2 years ago)
- Files:
-
- trunk/src/IPageView.h (modified) (1 diff)
- trunk/src/PDFDocument.cxx (modified) (1 diff)
- trunk/src/PagePter.cxx (modified) (8 diffs)
- trunk/src/PagePter.h (modified) (1 diff)
- trunk/src/gtk/PageView.cxx (modified) (4 diffs)
- trunk/src/gtk/PageView.h (modified) (1 diff)
- trunk/tests/DumbDocumentObserver.cxx (modified) (1 diff)
- trunk/tests/DumbPageView.cxx (modified) (1 diff)
- trunk/tests/DumbPageView.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/IPageView.h
r150 r151 107 107 /// @return The position of the vertical scroll bar. 108 108 virtual gdouble getVerticalScroll (void) = 0; 109 110 /// 111 /// @brief Resize the current page. 112 /// 113 /// When the document's scale is changed the view is instructed 114 /// to resize the current page when the cached page image is 115 /// not ready yet. The view should resize the current image using 116 /// a fast algorithm, without caring too much about the final 117 /// result. 118 /// 119 /// @param width The new width of the page. 120 /// @param height The new height of the page. 121 /// 122 virtual void resizePage (gint width, gint height) = 0; 109 123 110 124 /// trunk/src/PDFDocument.cxx
r149 r151 395 395 poppler_page_render_to_pixbuf (page, 0, 0, width, height, getZoom (), 396 396 getRotation (), pixbuf); 397 g dk_pixbuf_unref (pixbuf);397 g_object_unref (pixbuf); 398 398 setLinks (renderedPage, page); 399 399 g_object_unref (G_OBJECT (page)); trunk/src/PagePter.cxx
r150 r151 193 193 { 194 194 g_WaitingForPage = FALSE; 195 refreshPage (PAGE_SCROLL_START );195 refreshPage (PAGE_SCROLL_START, FALSE); 196 196 } 197 197 … … 200 200 { 201 201 g_WaitingForPage = FALSE; 202 refreshPage (m_NextPageScroll );202 refreshPage (m_NextPageScroll, FALSE); 203 203 } 204 204 … … 207 207 { 208 208 g_WaitingForPage = FALSE; 209 refreshPage (PAGE_SCROLL_START );209 refreshPage (PAGE_SCROLL_START, FALSE); 210 210 } 211 211 … … 214 214 { 215 215 g_WaitingForPage = FALSE; 216 refreshPage (PAGE_SCROLL_NONE );216 refreshPage (PAGE_SCROLL_NONE, TRUE); 217 217 } 218 218 … … 221 221 { 222 222 g_WaitingForPage = FALSE; 223 refreshPage (PAGE_SCROLL_NONE );223 refreshPage (PAGE_SCROLL_NONE, FALSE); 224 224 } 225 225 … … 232 232 if ( g_WaitingForPage ) 233 233 { 234 data->pter->refreshPage (data->scroll );234 data->pter->refreshPage (data->scroll, FALSE); 235 235 return TRUE; 236 236 } … … 248 248 /// @param pageScroll This will be passed to the main view to let it know how 249 249 /// to show the scroll this new page. 250 /// 251 void 252 PagePter::refreshPage (PageScroll pageScroll) 250 /// @param wasZoomed If this is set to TRUE then it means that the page 251 /// has been refreshed because its scaled has changed. 252 /// 253 void 254 PagePter::refreshPage (PageScroll pageScroll, gboolean wasZoomed) 253 255 { 254 256 g_assert (NULL != m_Document && … … 269 271 { 270 272 documentPage = m_Document->getEmptyPage (); 271 view.showPage (documentPage, pageScroll); 272 delete documentPage; 273 view.showText (_("Loading...")); 273 if ( wasZoomed ) 274 { 275 view.resizePage (documentPage->getWidth (), 276 documentPage->getHeight ()); 277 } 278 else 279 { 280 view.showPage (documentPage, pageScroll); 281 delete documentPage; 282 view.showText (_("Loading...")); 283 } 274 284 275 285 g_WaitingForPage = TRUE; trunk/src/PagePter.h
r148 r151 62 62 IPageView *m_PageView; 63 63 64 void refreshPage (PageScroll pageScroll );64 void refreshPage (PageScroll pageScroll, gboolean wasZoomed); 65 65 }; 66 66 } trunk/src/gtk/PageView.cxx
r150 r151 106 106 107 107 void 108 PageView::resizePage (gint width, gint height) 109 { 110 GdkPixbuf *originalPage = gtk_image_get_pixbuf (GTK_IMAGE (m_PageImage)); 111 if ( NULL != originalPage ) 112 { 113 GdkPixbuf *scaledPage = gdk_pixbuf_scale_simple (originalPage, 114 width, height, 115 GDK_INTERP_NEAREST); 116 if ( NULL != scaledPage ) 117 { 118 gtk_image_set_from_pixbuf (GTK_IMAGE (m_PageImage), scaledPage); 119 g_object_unref (scaledPage); 120 } 121 } 122 } 123 124 void 108 125 PageView::setCursor (PageCursor cursorType) 109 126 { … … 188 205 GdkPixbuf *pixbuf = getPixbufFromPage (page); 189 206 gtk_image_set_from_pixbuf (GTK_IMAGE (m_PageImage), pixbuf); 190 g dk_pixbuf_unref (pixbuf);207 g_object_unref (pixbuf); 191 208 // Set the vertical scroll to the specified. 192 209 if ( PAGE_SCROLL_NONE != scroll ) … … 274 291 275 292 gtk_image_set_from_pixbuf (GTK_IMAGE (m_PageImage), modifiedPage); 276 g dk_pixbuf_unref (modifiedPage);293 g_object_unref (modifiedPage); 277 294 } 278 295 } … … 311 328 page->getRowStride (), NULL, NULL); 312 329 GdkPixbuf *finalPixbuf = gdk_pixbuf_copy (pixbuf); 313 g dk_pixbuf_unref (pixbuf);330 g_object_unref (pixbuf); 314 331 315 332 return finalPixbuf; trunk/src/gtk/PageView.h
r150 r151 33 33 void getSize (gint *width, gint *height); 34 34 gdouble getVerticalScroll (void); 35 void resizePage (gint width, gint height); 35 36 void scrollPage (gdouble scrollX, gdouble scrollY, 36 37 gint dx, gint dy); trunk/tests/DumbDocumentObserver.cxx
r136 r151 86 86 DumbDocumentObserver::notifyReload (void) 87 87 { 88 m_NotifiedReload ;88 m_NotifiedReload = TRUE; 89 89 } 90 90 trunk/tests/DumbPageView.cxx
r150 r151 52 52 53 53 void 54 DumbPageView::resizePage (gint width, gint height) 55 { 56 } 57 58 void 54 59 DumbPageView::scrollPage (gdouble scrollX, gdouble scrollY, gint dx, gint dy) 55 60 { trunk/tests/DumbPageView.h
r150 r151 30 30 void getSize (gint *width, gint *height); 31 31 gdouble getVerticalScroll (void); 32 void resizePage (gint width, gint height); 32 33 void scrollPage (gdouble scrollX, gdouble scrollY, 33 34 gint dx, gint dy);
