Changeset 42
- Timestamp:
- 01/06/09 16:35:52 (3 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
ChangeLog (modified) (1 diff)
-
src/pdfcube.cc (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r29 r42 1 2009-01-06 Mirko Maischberger <mirko.maischberger@gmail.com> 2 * src/pdfcube.cc: Removed --transition switch in favor of reading 3 transitions from the PDF file. Added a dialog to open files when 4 no file is given on the command line (this is so the first "GUI" 5 version of PDFCube) 6 1 7 2008-11-23 Mirko Maischberger <mirko.maischberger@gmail.com> 2 8 * man/: moved pdfcube.1 manpage inside man folder. -
trunk/src/pdfcube.cc
r41 r42 61 61 #define DEFAULT_TITLE "PDFCube" 62 62 #define N_FRAMES 30 63 #define TIMEOUT_INTERVAL 3863 #define TIMEOUT_INTERVAL 25 64 64 65 65 ////////////////////////////////////////////////////////////////////////// … … 99 99 static GLfloat clear_color[4] = { 0.6, 0.0, 0.0, 0.0 }; 100 100 static GLfloat top_color[4] = { 0.7, 0.6, 0.6, 0.0 }; 101 static double animation_emphasis = 3.0;101 static double animation_emphasis = 2.4; 102 102 103 103 static bool … … 1039 1039 poppler_page_get_size(page, &w, &h); 1040 1040 poppler_page_render_to_pixbuf(page, 0, 0, iWidth, iHeight, 1041 1.0 * iWidth /w, 0, pm);1041 ((double)iWidth)/w, 0, pm); 1042 1042 } 1043 1043 … … 1541 1541 g_print("Advance key\n"); 1542 1542 #endif 1543 if (page_transition[ pc->page()]and sleeping())1543 if (page_transition[(pc->page()+1)%pc->pages()] and sleeping()) 1544 1544 start_animation(widget, CUBE_NEXT); 1545 1545 else if (sleeping()) … … 1869 1869 ("top-color,t", po::value<std::string>(), 1870 1870 "Cube top color in 'r:g:b' format again with reals in [0,1].") 1871 ("transitions,c", po::value<std::vector<int> >()->multitoken(),1872 "Pages at wich to do a cube transition by default eg. 2 4 7\nMust be the last option on the command line.")1873 1871 ("input-file,i", po::value<std::string>(), "PDF file to show.") 1874 1872 ("no-fullscreen,n", … … 1893 1891 cout << endl; 1894 1892 cout << "Usage examples:" << endl; 1893 cout << " $ pdfcube" << endl; 1895 1894 cout << " $ pdfcube presentation.pdf" << endl; 1896 cout << " $ pdfcube presentation.pdf --bgcolor 0:0:0 --top-color 0.6:0.2:0.2 --transitions 1 5 7" 1897 << endl 1898 << " (floating point numbers are locale aware on some C libraries)" 1899 << endl << endl << endl; 1895 cout << 1896 " $ pdfcube presentation.pdf --bgcolor 0:0:0 --top-color 0.6:0.2:0.2" << 1897 endl << endl << 1898 " The \"Box\" transition present in PDF files is rendered as a 3D cube." 1899 << 1900 endl << 1901 " (e.g in beamer you can use the \\transboxin command)" << 1902 endl << endl << 1903 " If no file is given on the command line a file open dialog is shown." 1904 << 1905 endl << endl << 1906 " NB: floating point numbers are locale aware on some C libraries." << 1907 endl << endl << endl; 1900 1908 return 0; 1901 1909 } … … 1967 1975 1968 1976 if (document == NULL) { 1969 perror("Invaild PDF file.");1977 cerr << "Invaild PDF file." << endl; 1970 1978 exit(1); 1971 1979 } … … 1973 1981 pc = new pdfcube(document); 1974 1982 1983 // Read transitions form PDF file 1975 1984 page_transition = new bool[pc->pages()]; 1976 std::fill(&page_transition[0], &page_transition[pc->pages()], false); 1977 if(vm.count("transitions")) { 1978 vector<int> tr = vm["transitions"].as<std::vector<int> >(); 1979 for (std::vector<int>::iterator ii = tr.begin(); ii != tr.end(); ++ii) { 1980 if(*ii > pc->pages() || *ii < 1) 1985 for(int ii(0); ii != pc->pages(); ++ii) 1986 { 1987 PopplerPage* page = 1988 poppler_document_get_page(document, ii); 1989 PopplerPageTransition* transition = 1990 poppler_page_get_transition(page); 1991 if(!transition) 1981 1992 { 1982 cerr << "Transision after end of file." << endl;1993 page_transition[ii] = false; 1983 1994 } 1984 1995 else 1985 1996 { 1986 page_transition[*ii-1] = true; 1987 #ifndef NDEBUG 1988 cerr << "Transision at: " << (*ii-1) << endl; 1989 #endif 1997 switch(transition->type) 1998 { 1999 case POPPLER_PAGE_TRANSITION_REPLACE: 2000 page_transition[ii] = false; 2001 break; 2002 case POPPLER_PAGE_TRANSITION_BOX: 2003 page_transition[ii] = true; 2004 break; 2005 default: 2006 cerr << "Unsuported transition type (" << transition->type 2007 << ") at page " << (ii+1) << endl; 2008 break; 2009 } 1990 2010 } 1991 2011 } 1992 } 1993 2012 1994 2013 /* Create and show the application window. */ 1995 2014 window = create_window(glconfig);

