Changeset 35
- Timestamp:
- 04/12/06 05:27:57 (3 years ago)
- Location:
- trunk/src
- Files:
-
- 4 modified
-
MainPter.cxx (modified) (5 diffs)
-
MainPter.h (modified) (2 diffs)
-
gtk/MainView.cxx (modified) (7 diffs)
-
gtk/MainView.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MainPter.cxx
r33 r35 26 26 { 27 27 m_Document = new PDFDocument (); 28 m_DocumentPage = NULL; 28 29 m_View = NULL; 29 30 } … … 41 42 42 43 m_Document = document; 44 m_DocumentPage = NULL; 43 45 m_View = NULL; 44 46 } … … 50 52 { 51 53 delete m_Document; 54 delete m_DocumentPage; 52 55 delete m_View; 53 56 } … … 268 271 getView ().showErrorMessage (_("Error Loading File"), 269 272 _("The password you have supplier is not a" 270 " valid password for this file."));273 " valid password for this file.")); 271 274 g_free (password); 272 275 } … … 394 397 view.sensitiveZoomOut (m_Document->canZoomOut ()); 395 398 396 DocumentPage *page = m_Document->renderPage (); 397 if ( NULL != page ) 399 DocumentPage *oldPage = m_DocumentPage; 400 m_DocumentPage = m_Document->renderPage (); 401 if ( NULL != m_DocumentPage ) 398 402 { 399 getView ().showPage (page); 400 delete page; 403 getView ().showPage (m_DocumentPage); 401 404 } 402 } 405 delete oldPage; 406 } -
trunk/src/MainPter.h
r33 r35 23 23 // Forward declarations. 24 24 class IDocument; 25 class DocumentPage; 25 26 26 27 class MainPter … … 52 53 53 54 IDocument *m_Document; 55 DocumentPage *m_DocumentPage; 54 56 IMainView *m_View; 55 57 }; -
trunk/src/gtk/MainView.cxx
r34 r35 20 20 #include <IMainView.h> 21 21 #include <MainPter.h> 22 #include <DocumentPage.h> 22 23 #include "MainView.h" 23 24 … … 52 53 GtkWidget *toolBar = gtk_ui_manager_get_widget (m_UIManager, "/ToolBar"); 53 54 gtk_box_pack_start (GTK_BOX (m_MainBox), toolBar, FALSE, FALSE, 0); 55 // Create the page view 56 GtkWidget *pageView = createPageView (); 57 gtk_box_pack_start (GTK_BOX (m_MainBox), pageView, TRUE, TRUE, 0); 54 58 } 55 59 … … 82 86 MainView::promptPasswordDialog () 83 87 { 88 return g_strdup(""); 84 89 } 85 90 … … 154 159 MainView::showPage (DocumentPage *page) 155 160 { 161 gtk_image_set_from_pixbuf (GTK_IMAGE (m_PageView), NULL); 162 GdkPixbuf *pixbuf = getPixbufFromPage (page); 163 gtk_image_set_from_pixbuf (GTK_IMAGE (m_PageView), pixbuf); 164 gdk_pixbuf_unref (pixbuf); 156 165 } 157 166 … … 169 178 MainView::getGoToPageText (void) 170 179 { 180 return "1"; 171 181 } 172 182 … … 185 195 // GTK+ Functions. 186 196 //////////////////////////////////////////////////////////////// 197 198 GtkWidget * 199 MainView::createPageView () 200 { 201 GtkWidget *scrolledWindow = gtk_scrolled_window_new (NULL, NULL); 202 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledWindow), 203 GTK_POLICY_AUTOMATIC, 204 GTK_POLICY_AUTOMATIC); 205 m_PageView = gtk_image_new (); 206 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledWindow), 207 m_PageView); 208 return scrolledWindow; 209 } 187 210 188 211 void … … 268 291 } 269 292 293 GdkPixbuf * 294 MainView::getPixbufFromPage (DocumentPage *page) 295 { 296 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (page->getData (), 297 GDK_COLORSPACE_RGB, FALSE, 8, page->getWidth (), page->getHeight (), 298 page->getRowStride (), NULL, NULL); 299 300 return pixbuf; 301 } 302 270 303 //////////////////////////////////////////////////////////////// 271 304 // GTK+ Callbacks. -
trunk/src/gtk/MainView.h
r33 r35 55 55 GtkWidget *m_MainWindow; 56 56 GtkWidget *m_MainBox; 57 GtkWidget *m_PageView; 57 58 GtkUIManager *m_UIManager; 58 59 60 GtkWidget *createPageView (void); 59 61 void createUIManager (void); 62 GdkPixbuf *getPixbufFromPage (DocumentPage *page); 60 63 }; 61 64 }
