diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..d72c110f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,205 @@ +# YACReader Changelog + +Please note: this is a work in progress. Keeping a changelog has been neglected +in the past so information is missing and older release information is in +spanish only. Sorry for the mess. + +## 9.0.0 (WIP) + +### Library and Reader + +* Updated Qt to 5.9.1. +* Faster (way faster) pdf backend based on pdfium. +* unarr is used now for handling compressed files (there are some temporal side + effects: f.e. 7z is not supported). YACReader can still be compiled using 7zip + as decompresion library. +* Fixed fullscreen context menus (windows). +* Minor fixes. +* New app icons for Windows. +* Initial support for Haiku OS + +### YACReaderLibrary +* New comics view in addition to flow and grid views: info view. +* New side view for showing current comic info in the grid view + (it can be shown using the icon in the right bottom part of the window). +* Improved the look and feel of the grid view. +* Fixed Comic Vine integration (using the new https end point). +* Usability fixes to Comic View scraper. +* Fixed UI update when clients update comics status. +* New server setting for disabling covers on folders in the client's remote + browser (iOS), this is a workaround to fix a performance issue in large + libraries. +* Fixed YACReader not found in macos. + +### YACReader +* Added an option to disable showing the go to flow on mouse over. +* New "Quick Navigation Mode" for the go to flow feature, full-wide + a scroll + bar, it can be enabled in the settings dialog. (thanks to Yuu Mousou). +* Zig-zag autoscroll reading mode, please see the reading section in the + shortcuts dialog for enabling this, by default there are no keys assigned to + the scrolling actions (thanks to Daisuke Cato). +* Menu bar added for YACReader in macos (thanks to Daisuke Cato). +* "Go to flow" is now manga aware (thanks to Daisuke Cato). +* Added "Open recent" menu entry. +* Fixed issues experienced when opening new comics too fast + +### YACReaderLibraryServer (headless version of YACReaderLibrary) +* Added a systemd service file to run yacreaderlibraryserver on Linux based systems. + +## 8.5.0 - 2016-03-28 +* headless version of YACReaderLibrary's server (no gui) +* grid view has been enhanced with a new slider for choosing covers size + and it also includes a fully configurable background that can use + the covers of your comics. Now every single folder will have a unique look. +* YACReader UI has been refreshed with a cleaner look. +* New fit and zoom modes, finally!. +* open recent functionality + +## 8.0.0 +* Reading lists +* Tags +* 'Favorites' and 'being read' lists +* New search engine, now you can filter folders and comics +* New grid viewb +* Add and delete folders +* Update a single folder (no need for updating the whole library to rescan a single folder) +* Drag and drop for adding new comics and folders +* Customizable shorcuts +* Manga mode (thank you Felix) +* Spread page detection for double page mode (including manga mode)(thank you again Felix :) ) +* New view for folders not containing comics (only subfolders) +* Save selected covers to disk +* Comics in Reading Lists and Tags can be sorted by drag&drop +* Sublist in Reading Lists can by sorted by drag&drop +* Added WebP image format support +* The user has to provide its own Comic Vine API key to prevent usage limit errors from Comic Vine +* New unarr decompression backend for Linux and Unix systems +* Fixed memory and filedescriptor leaks in 7zip wrapper +* Dropped support for Qt4 +* Lots of smaller bugfixes + +## 7.2.0 +* Added support for the new "remote read" feature in iOS devices. +* Improved stability +* Fixed broken compatibility with Windows XP +* Improved Linux "packageability" (thanks to Felix, Alexander and Yoann)** +* German translation (thanks to Gerhard Joeken) +* Bug fixes. + +## 7.1.0 +* A�adida opci�n para resetear el rating de un comics +* Corregidos bugs que afectaban a la informaci�n de p�gina. +* Corregido error que marcaba un comic terminado como empezado si se volv�a a leer. +* A�adidos 2 estados para las carpetas (Completo/Terminado) +* Corregido bug en la comunicaci�n YACReaderLibrary <-> YACReader +* A�adidas las acciones relativas a los comics al men� contextual de la tabla de c�mics. +* Corrgido bug que provocaba el crecimiento ilimatado del log del servidor +* Corregidos bugs menores + +7.0.2 (S�lo MacOSX) +* Eliminado el uso de Poppler en la versi�n de MacOSX +* Trabajo en traducciones. +* Corregidos bugs menores + +7.0.1 +* A�adido QsLog a YACReader +* Corregido bug en la comunicaci�n YACReaderLibrary <-> YACReader + +7.0 (Final) +* Corregidos eventos de teclado en algunos di�logos +* Corregido soporte para archivos Rar en sistemas Unix +* Corregidos problemas borrando c�mics +* Mejorada la gesti�n de errores +* Corregida la comunicaci�n entre YACReader y YACReaderLibrary +* Corregida la toolBar en MacOSX +* Mejorada la compatabilidad de OpenGL en tarjetas NVIDIA +* Corregidos bugs menores + +## 6.9 - (No p�blica) +* A�adida la apertura autom�tica del siguiente/anterior c�mic al llegar al final/portada del c�mic actual +* Corregido el comportamiento del di�logo de nueva versi�n detectada. Ahora avisa una vez al d�a o si el usuario lo elige cada 14 d�as. +* Corregido el ajuste a lo ancho del t�tulo de la toolbar en YACReaderLibrary. +* A�adido log a YACReaderLibrary (permitir� a los usuarios ofrecer m�s informaci�n sobre sus bugs) +* Corregido bug en el historial de navegaci�n (y al editar comics) despu�s de usar el motor de b�squeda. + +## 6.8 - (No p�blica) +* Corregido bug que causaba un cierre inesperado despu�s de cambiar el modo de sincronizaci�n vertical (flow) +* Corregido bug que causaba que la toolbar en el visor no se pudiese ocultar/mostrar sin un c�mic abierto +* Mejorada la gesti�n de errores al abrir c�mics +* Corregidos algunos bugs relacionados con la apertura de c�mics +* A�adida funci�n de rating +* El visor ahora puede abrir archivos de imagen directamente. Si se abre un archivo de imagen se abre el directorio que lo contiene con todas las im�genes. +* Corregida la ordenaci�n de carpetas y c�mics usada en la navegaci�n desde dispositivos iOS + +## 6.7 - (No p�blica) +* A�adidos nuevos campos en la base de datos para almacenar informaci�n adicional sobre c�mics: rating, p�gina actual, bookmarks y configuraci�n de imagen +* A�adida comunicaci�n entre YACReaderLibrary y YACReader para poder almacenar el progreso de los c�mics e informaci�n adicional + +## 6.6 - (No p�blica) +* Modificado YACReader para que abra los archivos comprimidos usando 7z.dll (.so, .dylib) +* YACReader abre ahora los c�mics por la �ltima p�gina le�da. +* Corregido bug que causaba que algunos c�mics no se pudiesen abrir desde * YACReaderLibrary en YACReader +* Corregido el modo en el que se actualizaba la "information label" + +## 6.5 +* Nueva interfaz principal de YACReaderLibrary y YACReader +* Corregido bug que causaba que el servidor no se activase en el primer arranque en MacOSX +* Corregido bug que causaba un fallo al cerrar YACReaderLibrary cada vez que se usaba el servidor +* Nuevo dise�o para el di�logo de propiedades de los c�mics. +* A�adida navegaci�n alante y atr�s de las carpetas visitadas. +* La edici�n del nombre de una biblioteca no fuerza ahora que se recargue la biblioteca +* Corregido el color de fondo en la lupa +* Nuevo bot�n para ajustar a lo alto +* Eliminada la opci�n always on top +* Mostrar en carpeta contenedora arreglado en Windows y MacOSX + +## 6.4 - (No p�blica) +Normalizado el renderizado de p�ginas en modo doble p�gina +A�adida la funci�n de borrar c�mics desde el disco duro +Nuevos iconos de la barra de herramientas de c�mics + +## 6.3 (No p�blica) +* Mejorada la gesti�n de errores relacionada con las bibliotecas +* A�adido bot�n que permite ocultar las portadas en la pantalla de importaci�n +* A�adidos t�tulos "Bibliotecas" y "Carpetas" a la barra de navegaci�n +* Nuevos iconos para seleccionar la carpeta ra�z, expandir y contraer todos. +* Bot�n para cambiar el puerto del servidor por el usuario. +* Ahora las columnas de la lista de c�mics pueden reordenarse +* Ahora YACReaderLibrary s�lo permite una instancia ejecutandose. +* Columna le�do a�adida. +* Cambiado estilo de la lista de c�mics +* Corregidos bugs relacionados con realizar operaciones sobre c�mics cuando no hab�a ninguno seleccionado en la lista de c�mics + +## 6.2 +* Nueva ventana de "bienvenida" +* Nueva ventana de importar/actualizar +* Nuevo control para la b�squeda +* Nueva imagen para las marcas de c�mics le�dos (s�lo en OpenGL) +* Cambiada la distribuci�n de algunos iconos +* Cambiado el modo de eliminar la metainformaci�n (borrar base de datos/portadas de disco) +* Ocultadas las opciones avanzadas de configuraci�n de YACReader Flow, accesibles ahora tras pulsar un bot�n (di�logos de configuraci�n m�s simples) + +## 6.0.1 - (No p�blica) +* Corregido bug al usar las teclas Inicio/fin +* Corregido bug que al arrancar YACReaderLibrary por primera vez causaba que no se * mostrasen las portadas (s�lo bajo ciertas circunstancias) +* A�adidos algunos atajos de teclado a YACReaderLibrary a los ya existentes + +## 6.0 +* Mejorada la velocidad de inicio gracias al uso de /LTCG como opci�n de compilaci�n +* Corregido bug relacionado con OpenGL que causaba consumo excesivo de CPU en tarjetas NVidia +* A�adidos iconos para cada tipo de archivo soportado en YACReaderLibrary +* Cambiado el icono "folder" en YACReaderLibrary +* A�adida barra para ajustar el ancho de p�gina en la toolbar de YACReader +* A�adido widget para la information label +* A�adido nuevo estilo visual a goToFlow +* A�adidos filtros para controlar el brillo, el contraste y el valor gamma +* A�adidas notificaciones de portada y �ltima p�gina +* InformationLabel se muestra ahora en la esquina superiror derecha. +* InformationLabel se muestra en 3 tama�os diferentes en funci�n de la resoluci�n +* Corregido bug que causaba que las marcas de c�mic le�do no se dibujasen adecuadamente. +* Se recuerda si se debe mostrar o no la "label" informaci�n. +* Corregido bug que provocaba el fallo de YACReader al pasar muy r�pido las p�ginas. +* A�adida columna "Tama�o" a la lista de c�mics en YACReaderLibrary +* A�adida la ordinaci�n "natural" de los comics que hay en directorio del c�mic actual. +* Corregido bug que causaba que se abriese el c�mic erroneo en YACReaderLibrary. +* Cambiado el modo en el que se cargan los lenguages, ahora se pueden a�adir traducciones sin necesidad de recompilar. diff --git a/CHANGELOG.txt b/CHANGELOG.txt deleted file mode 100644 index 51e0b35c..00000000 --- a/CHANGELOG.txt +++ /dev/null @@ -1,149 +0,0 @@ -8.0.0 -Reading lists -Tags -'Favorites' and 'being read' lists -New search engine, now you can filter folders and comics -New grid view -Add and delete folders -Update a single folder (no need for updating the whole library to rescan a single folder) -Drag and drop for adding new comics and folders -Customizable shorcuts -Manga mode (thank you Felix) -Spread page detection for double page mode (including manga mode)(thank you again Felix :) ) -New view for folders not containing comics (only subfolders) -Save selected covers to disk -Comics in Reading Lists and Tags can be sorted by drag&drop -Sublist in Reading Lists can by sorted by drag&drop -Added WebP image format support -The user has to provide its own Comic Vine API key to prevent usage limit errors from Comic Vine -New unarr decompression backend for Linux and Unix systems -Fixed memory and filedescriptor leaks in 7zip wrapper -Dropped support for Qt4 -Lots of smaller bugfixes - -7.2.0 -Added support for the new "remote read" feature in iOS devices. -Improved stability -Fixed broken compatibility with Windows XP -Improved Linux "packageability" (thanks to Felix, Alexander and Yoann)** -German translation (thanks to Gerhard Joeken) -Bug fixes. - -7.1.0 -Aadida opcin para resetear el rating de un comics -Corregidos bugs que afectaban a la informacin de pgina. -Corregido error que marcaba un comic terminado como empezado si se volva a leer. -Aadidos 2 estados para las carpetas (Completo/Terminado) -Corregido bug en la comunicacin YACReaderLibrary <-> YACReader -Aadidas las acciones relativas a los comics al men contextual de la tabla de cmics. -Corrgido bug que provocaba el crecimiento ilimatado del log del servidor -Corregidos bugs menores - -7.0.2 (Slo MacOSX) -Eliminado el uso de Poppler en la versin de MacOSX -Trabajo en traducciones. -Corregidos bugs menores - -7.0.1 -Aadido QsLog a YACReader -Corregido bug en la comunicacin YACReaderLibrary <-> YACReader - -7.0 (Final) -Corregidos eventos de teclado en algunos dilogos -Corregido soporte para archivos Rar en sistemas Unix -Corregidos problemas borrando cmics -Mejorada la gestin de errores -Corregida la comunicacin entre YACReader y YACReaderLibrary -Corregida la toolBar en MacOSX -Mejorada la compatabilidad de OpenGL en tarjetas NVIDIA -Corregidos bugs menores - -6.9 (No pblica) -Aadida la apertura automtica del siguiente/anterior cmic al llegar al final/portada del cmic actual -Corregido el comportamiento del dilogo de nueva versin detectada. Ahora avisa una vez al da o si el usuario lo elige cada 14 das. -Corregido el ajuste a lo ancho del ttulo de la toolbar en YACReaderLibrary. -Aadido log a YACReaderLibrary (permitir a los usuarios ofrecer ms informacin sobre sus bugs) -Corregido bug en el historial de navegacin (y al editar comics) despus de usar el motor de bsqueda. - -6.8 (No pblica) -Corregido bug que causaba un cierre inesperado despus de cambiar el modo de sincronizacin vertical (flow) -Corregido bug que causaba que la toolbar en el visor no se pudiese ocultar/mostrar sin un cmic abierto -Mejorada la gestin de errores al abrir cmics -Corregidos algunos bugs relacionados con la apertura de cmics -Aadida funcin de rating -El visor ahora puede abrir archivos de imagen directamente. Si se abre un archivo de imagen se abre el directorio que lo contiene con todas las imgenes. -Corregida la ordenacin de carpetas y cmics usada en la navegacin desde dispositivos iOS - -6.7 (No pblica) -Aadidos nuevos campos en la base de datos para almacenar informacin adicional sobre cmics: rating, pgina actual, bookmarks y configuracin de imagen -Aadida comunicacin entre YACReaderLibrary y YACReader para poder almacenar el progreso de los cmics e informacin adicional - -6.6 (No pblica) -Modificado YACReader para que abra los archivos comprimidos usando 7z.dll (.so, .dylib) -YACReader abre ahora los cmics por la ltima pgina leda. -Corregido bug que causaba que algunos cmics no se pudiesen abrir desde YACReaderLibrary en YACReader -Corregido el modo en el que se actualizaba la "information label" - -6.5 -Nueva interfaz principal de YACReaderLibrary y YACReader -Corregido bug que causaba que el servidor no se activase en el primer arranque en MacOSX -Corregido bug que causaba un fallo al cerrar YACReaderLibrary cada vez que se usaba el servidor -Nuevo diseo para el dilogo de propiedades de los cmics. -Aadida navegacin alante y atrs de las carpetas visitadas. -La edicin del nombre de una biblioteca no fuerza ahora que se recargue la biblioteca -Corregido el color de fondo en la lupa -Nuevo botn para ajustar a lo alto -Eliminada la opcin always on top -Mostrar en carpeta contenedora arreglado en Windows y MacOSX - -6.4 (No pblica) -Normalizado el renderizado de pginas en modo doble pgina -Aadida la funcin de borrar cmics desde el disco duro -Nuevos iconos de la barra de herramientas de cmics - -6.3 (No pblica) -Mejorada la gestin de errores relacionada con las bibliotecas -Aadido botn que permite ocultar las portadas en la pantalla de importacin -Aadidos ttulos "Bibliotecas" y "Carpetas" a la barra de navegacin -Nuevos iconos para seleccionar la carpeta raz, expandir y contraer todos. -Botn para cambiar el puerto del servidor por el usuario. -Ahora las columnas de la lista de cmics pueden reordenarse -Ahora YACReaderLibrary slo permite una instancia ejecutandose. -Columna ledo aadida. -Cambiado estilo de la lista de cmics -Corregidos bugs relacionados con realizar operaciones sobre cmics cuando no haba ninguno seleccionado en la lista de cmics - -6.2 -Nueva ventana de "bienvenida" -Nueva ventana de importar/actualizar -Nuevo control para la bsqueda -Nueva imagen para las marcas de cmics ledos (slo en OpenGL) -Cambiada la distribucin de algunos iconos -Cambiado el modo de eliminar la metainformacin (borrar base de datos/portadas de disco) -Ocultadas las opciones avanzadas de configuracin de YACReader Flow, accesibles ahora tras pulsar un botn (dilogos de configuracin ms simples) - -6.0.1 (No pblica) -Corregido bug al usar las teclas Inicio/fin -Corregido bug que al arrancar YACReaderLibrary por primera vez causaba que no se mostrasen las portadas (slo bajo ciertas circunstancias) -Aadidos algunos atajos de teclado a YACReaderLibrary a los ya existentes - -6.0 - -Mejorada la velocidad de inicio gracias al uso de /LTCG como opcin de compilacin -Corregido bug relacionado con OpenGL que causaba consumo excesivo de CPU en tarjetas NVidia -Aadidos iconos para cada tipo de archivo soportado en YACReaderLibrary -Cambiado el icono "folder" en YACReaderLibrary -Aadida barra para ajustar el ancho de pgina en la toolbar de YACReader -Aadido widget para la information label -Aadido nuevo estilo visual a goToFlow -Aadidos filtros para controlar el brillo, el contraste y el valor gamma -Aadidas notificaciones de portada y ltima pgina -InformationLabel se muestra ahora en la esquina superiror derecha. -InformationLabel se muestra en 3 tamaos diferentes en funcin de la resolucin -Corregido bug que causaba que las marcas de cmic ledo no se dibujasen adecuadamente. -Se recuerda si se debe mostrar o no la "label" informacin. -Corregido bug que provocaba el fallo de YACReader al pasar muy rpido las pginas. -Aadida columna "Tamao" a la lista de cmics en YACReaderLibrary -Aadida la ordinacin "natural" de los comics que hay en directorio del cmic actual. -Corregido bug que causaba que se abriese el cmic erroneo en YACReaderLibrary. -Cambiado el modo en el que se cargan los lenguages, ahora se pueden aadir traducciones sin necesidad de recompilar. \ No newline at end of file diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 00000000..25845328 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,111 @@ +# Building YACReader from source + +YACReader and YACReaderLibrary are build using qmake. To build and install the +program, run: + +> qmake-qt5 CONFIG+=[Options] +> make +> make install + +from the source dir. For separate builds of YACReader or YACReaderLibrary, +enter their respective subfolders and run the commands from there. + +The headless version of YACReaderLibrary is located in the YACReaderLibraryServer +folder. To build it, enter the folder and run the commands described above. + + +## Build dependencies: + +- Qt >= 5.6 with the following modules: + - declarative + - quickcontrols + - sql + - script + - multimedia + - imageformats + - opengl + - sql-sqlite + - network +- A pdf rendering backend (optional, see below) +- qrencode (optional) +- glu +- (lib)unarr (see below) + +Not all dependencies are needed at build time. For example the qml components in +YACReaderLibrary (GridView, InfoView) will only show a white page if the +required qml modules (declarative, quickcontrols) are missing. +This can also happen if these dependencies are too old (i.e Qt < 5.6 is used). + +## Backends + +### Decompression + +YACReader uses [(lib)unarr](https://github.com/selmf/unarr) for comic book archive +decompression. Most Linux distributions don't ship this library yet, so you will +probably have to build it yourself. + +We recommend using (lib)unarr as a shared library, but we also support static +and embedded builds. Please consult the [README](compressed_archive/unarr/README.txt) +for more information on this topic. + +### PDF + +Starting with version 9.0.0 YACReader supports the following pdf render engines: + +- poppler (Linux/Unix default) +- pdfium (default for Windows and MacOS) +- pdfkit (MacOS only) +- no_pdf (disable pdf support) + +To override the default for a given platform add CONFIG+=[pdfbackend] as an option +when running qmake. + +While the Poppler backend is well tested and has been the standard for YACReader +for a long time, it's performance is a bit lacking. The pdfium engine offers +much better performance (about 10x faster on some pdf files we tested). +However, at the time of this writing, it is not a library that is available +prepackaged for Linux. + +### Other build options: + +You can adjust the installation prefix as well als the path "make install" uses +to install the files. + +>qmake PREFIX=DIR + +sets the default prefix (for example "/", "/usr", "/usr/local"). + +>make install INSTALL_ROOT=DIR + +can be used to install to a different location, which is usefull for packaging. + +Default values: + +>PREFIX=/usr +>INSTALL_ROOT="" + +On embedded devices that don't support desktop OpenGL, it is recommended to use +the no_opengl config option: + +qmake-qt5 CONFIG+=no_opengl + +This will remove any dependency on desktop OpenGL and hardlock YACReader's +coverflow to software rendering. Please note that it does not actually remove +OpenGL from the build, the Qt toolkit will still make use of it. + + +# Feedback and contribution + +If you're compiling YACReader because there is no package available for your +Linux distribution please consider creating and submitting a package or filing a +package request. + +While we do provide packages for .deb and .rpm based distributions as well as an +AUR package for Archlinux and it's derivates, we are in need of downstream packagers +that are willing to make YACReader available as a standard package for their distro. + +If you are interested, please contact @selmf on the YACReader forums or write +an email to info@yacreader.com + +If you have already created a package please let us know so we can add it to +our downloads list ;) diff --git a/INSTALL.txt b/INSTALL.txt deleted file mode 100644 index 8bd13166..00000000 --- a/INSTALL.txt +++ /dev/null @@ -1,89 +0,0 @@ -COMPILATION GUIDE FOR LINUX/UNIX USERS -********************************** -YACReader and YACReaderLibrary are build using qmake. To build and install the program, run: - -qmake-qt5 CONFIG+=[Options] -make -make install - -from the source dir. For seperate builds of YACReader or YACReaderLibrary, enter their respective subfolders and run the commands from there. - -For the headless version of YACReaderLibrary enter the YACReaderLibrary folder and run: - -qmake-qt5 YACReaderLibraryServer.pro - -This will select the build config for the headless version instead of the gui version. You can then continue the build as described above. - - -Dependencies: ------------------------ - -- Qt >= 5.3 with the following modules: - - declarative - - quickcontrols - - sql - - script - - multimedia - - imageformats - - opengl - - sql-sqlite - - network - -- poppler-qt5 -- qrencode -- sqllite -- glu -- a decompression backend, either 7zip or unarr (see below) - -Please note that not all of these dependencies are needed at build time. A good example for this is YACReaderLibrary's GridView mode which will -silently fail and only show a white page if the proper qml modules (declarative, quickcontrols) are not installed. - - -Decompression backend: --------------------------------------- - -YACReader supports two decompression backends: - -- unarr -- p7zip=9.20.1 - -These can be selected at build time by adding either CONFIG+=unarr or CONFIG+=7zip as an option when running qmake. -If none of these is provided, the build system will default to unarr on Linux/Unix and [p]7zip on Windows and OS X. - -The decompression backends have their own dependencies and require additional steps like downloading additional source code -for setup. Please consult the README files provided in the compressed_archive and compressed_archive/unarr folders for details. - -If you chose to build YACReader with p7zip as a backend on Linux/Unix, please take notice that this backend has some problems: - -- p7zip > 9.20.1 is not supported -- p7zip 9.20.1 has known bugs that are fixed only in the later versions -- a system update that replaces p7zip 9.20.1 with a later version will make YACReader unusable - -If your system already ships with p7zip > 9.20.1 you can place 7z.so and the Codecs folder with the Rar29.so from p7zip 9.20.1 in /usr/lib/yacreader -YACReader will check this folder first and can thus continue using 7zip as a backend with p7zip > 9.20.1 installed on your system. - - -Other build options: ------------------------------- - -You can adjust the installation prefix as well als the path make install uses to install the files. -Use "qmake PREFIX=DIR" to configure YACReader for your systems default prefix (for example "/", "/usr", "/usr/local"). - -For packaging purposes, you can use "make install INSTALL_ROOT=DIR" to install to a different location than the prefix. - -Default values: - -PREFIX=/usr -INSTALL_ROOT="" - -On embedded devices that don't support desktop OpenGL, it is recommended to use the no_opengl config option: - -qmake CONFIG+=no_opengl - -This will remove any dependency on desktop OpenGL and hardlock YACReader's coverflow to software rendering. Please note that it -doesn't actually remove OpenGL from the build, the Qt toolkit will still make use of it. - - -DO YOU WANT TO HELP YACREADER? -****************************** -If you have experience creating packages, please help to create a package for your favourite Linux distro! Send me an e-mail to: info@yacreader.com diff --git a/YACReader.desktop b/YACReader.desktop index 32d5caf3..196a8d3d 100644 --- a/YACReader.desktop +++ b/YACReader.desktop @@ -3,7 +3,7 @@ Name=YACReader GenericName=Yet Another Comic Reader Comment=A comic reader with support for .cb*, .pdf and whole directories. Exec=YACReader %f -Icon=/usr/share/yacreader/icon.png +Icon=YACReader Terminal=false Type=Application StartupNotify=true diff --git a/YACReader.svg b/YACReader.svg new file mode 100644 index 00000000..bc7cc2f7 --- /dev/null +++ b/YACReader.svg @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YACReader/Info.plist b/YACReader/Info.plist new file mode 100644 index 00000000..b01b250e --- /dev/null +++ b/YACReader/Info.plist @@ -0,0 +1,171 @@ + + + + + NSPrincipalClass + NSApplication + CFBundleIconFile + YACReader.icns + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + ???? + CFBundleExecutable + YACReader + CFBundleIdentifier + com.yacreader.YACReader + CFBundleDocumentTypes + + + CFBundleTypeName + YACReader Comic rar + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + com.yacreader.yacreader.rar + + + + CFBundleTypeName + YACReader Comic zip + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + com.yacreader.yacreader.zip + + + + CFBundleTypeName + YACReader Comic cbr + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + com.yacreader.yacreader.cbr + + + + CFBundleTypeName + YACReader Comic cbz + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + com.yacreader.yacreader.cbz + + + + CFBundleTypeName + YACReader Comic pdf + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + com.adobe.pdf + + + + UTExportedTypeDeclarations + + + UTTypeConformsTo + + public.data + + UTTypeDescription + YACReader Comic + UTTypeIdentifier + com.yacreader.yacreader.rar + UTTypeTagSpecification + + public.filename-extension + rar + public.mime-type + application/comic-rar + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + YACReader Comic + UTTypeIdentifier + com.yacreader.yacreader.zip + UTTypeTagSpecification + + public.filename-extension + zip + public.mime-type + application/comic-zip + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + YACReader Comic + UTTypeIdentifier + com.yacreader.yacreader.cbr + UTTypeTagSpecification + + public.filename-extension + cbr + public.mime-type + application/comic-cbr + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + YACReader Comic + UTTypeIdentifier + com.yacreader.yacreader.cbz + UTTypeTagSpecification + + public.filename-extension + cbz + public.mime-type + application/comic-cbz + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + YACReader Comic + UTTypeIdentifier + com.yacreader.yacreader.pdf + UTTypeTagSpecification + + public.filename-extension + pdf + public.mime-type + application/comic-pdf + + + + + diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 57a500de..8e2b9b66 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -1,272 +1,259 @@ -# ##################################################################### -# Automatically generated by qmake (2.01a) mié 8. oct 20:54:05 2008 -# ##################################################################### -TEMPLATE = app -TARGET = YACReader -DEPENDPATH += . \ - release - -DEFINES += NOMINMAX YACREADER -QMAKE_MAC_SDK = macosx10.11 -QMAKE_MAC_SDK = macosx10.11 - -#load default build flags -include (../config.pri) - -unix:!macx{ - QMAKE_CXXFLAGS += -std=c++11 -} - -CONFIG(force_angle) { - Release:DESTDIR = ../release_angle - Debug:DESTDIR = ../debug_angle -} else { - Release:DESTDIR = ../release - Debug:DESTDIR = ../debug -} - -SOURCES += main.cpp - -INCLUDEPATH += ../common \ - ../custom_widgets - -!CONFIG(no_opengl):CONFIG(legacy_gl_widget) { - INCLUDEPATH += ../common/gl_legacy \ -} else { - INCLUDEPATH += ../common/gl \ -} - -#there are going to be two builds for windows, OpenGL based and ANGLE based -win32 { - CONFIG(force_angle) { - message("using ANGLE") - LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32 - #linking extra libs are necesary for a successful compilation, a better approach should be - #to remove any OpenGL (desktop) dependencies - #the OpenGL stuff should be migrated to OpenGL ES - DEFINES += FORCE_ANGLE - } else { - LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32 - } - - LIBS += -lpoppler-qt5 - INCLUDEPATH += ../dependencies/poppler/include/qt5 - - QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL - QMAKE_LFLAGS_RELEASE += /LTCG - CONFIG -= embed_manifest_exe -} - -unix:!macx{ - -INCLUDEPATH += /usr/include/poppler/qt5 -LIBS += -L/usr/lib -lpoppler-qt5 - -!CONFIG(no_opengl) { - LIBS += -lGLU -} - -} - -macx{ -#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" -#isEqual(QT_MAJOR_VERSION, 5) { -#INCLUDEPATH += /usr/local/include/poppler/qt5 -#LIBS += -L/usr/local/lib -lpoppler-qt5 -#} -#else { -#INCLUDEPATH += /usr/local/include/poppler/qt4 -#LIBS += -L/usr/local/lib -lpoppler-qt4 -#} -CONFIG += objective_c -QT += macextras gui-private - - -LIBS += -framework Foundation -framework ApplicationServices -framework AppKit - -OBJECTIVE_SOURCES += ../common/pdf_comic.mm -HEADERS += ../common/pdf_comic.h -} - -QT += network widgets core -!CONFIG(no_opengl) { - QT += opengl -} - -#CONFIG += release -CONFIG -= flat - -QT += multimedia - -# Input -HEADERS += ../common/comic.h \ - configuration.h \ - goto_dialog.h \ - magnifying_glass.h \ - main_window_viewer.h \ - viewer.h \ - goto_flow.h \ - options_dialog.h \ - ../common/bookmarks.h \ - bookmarks_dialog.h \ - render.h \ - shortcuts_dialog.h \ - translator.h \ - goto_flow_widget.h \ - page_label_widget.h \ - goto_flow_toolbar.h \ - width_slider.h \ - notifications_label_widget.h \ - ../common/pictureflow.h \ - ../common/custom_widgets.h \ - ../common/check_new_version.h \ - ../common/qnaturalsorting.h \ - ../common/yacreader_global.h \ - ../common/yacreader_global_gui.h \ - ../common/onstart_flow_selection_dialog.h \ - ../common/comic_db.h \ - ../common/folder.h \ - ../common/library_item.h \ - yacreader_local_client.h \ - ../common/http_worker.h \ - ../common/exit_check.h \ - ../common/scroll_management.h \ - ../common/opengl_checker.h - -!CONFIG(no_opengl) { - CONFIG(legacy_gl_widget) { - message("using legacy YACReaderFlowGL (QGLWidget) header") - DEFINES += YACREADER_LEGACY_FLOW_GL - HEADERS += ../common/gl_legacy/yacreader_flow_gl.h - } else { - HEADERS += ../common/gl/yacreader_flow_gl.h - } - HEADERS += goto_flow_gl.h -} - -SOURCES += ../common/comic.cpp \ - configuration.cpp \ - goto_dialog.cpp \ - magnifying_glass.cpp \ - main_window_viewer.cpp \ - viewer.cpp \ - goto_flow.cpp \ - options_dialog.cpp \ - ../common/bookmarks.cpp \ - bookmarks_dialog.cpp \ - render.cpp \ - shortcuts_dialog.cpp \ - translator.cpp \ - goto_flow_widget.cpp \ - page_label_widget.cpp \ - goto_flow_toolbar.cpp \ - width_slider.cpp \ - notifications_label_widget.cpp \ - ../common/pictureflow.cpp \ - ../common/custom_widgets.cpp \ - ../common/check_new_version.cpp \ - ../common/qnaturalsorting.cpp \ - ../common/onstart_flow_selection_dialog.cpp \ - ../common/comic_db.cpp \ - ../common/folder.cpp \ - ../common/library_item.cpp \ - yacreader_local_client.cpp \ - ../common/http_worker.cpp \ - ../common/yacreader_global.cpp \ - ../common/yacreader_global_gui.cpp \ - ../common/exit_check.cpp \ - ../common/scroll_management.cpp \ - ../common/opengl_checker.cpp - -!CONFIG(no_opengl) { - CONFIG(legacy_gl_widget) { - message("using legacy YACReaderFlowGL (QGLWidget) source code") - SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp - } else { - SOURCES += ../common/gl/yacreader_flow_gl.cpp - } - SOURCES += goto_flow_gl.cpp -} - -include(../custom_widgets/custom_widgets_yacreader.pri) -CONFIG(7zip){ -include(../compressed_archive/wrapper.pri) -} else:CONFIG(unarr){ -include(../compressed_archive/unarr/unarr-wrapper.pri) -} else { - error(No compression backend specified. Did you mess with the build system?) - } -include(../shortcuts_management/shortcuts_management.pri) - -RESOURCES += yacreader_images.qrc \ - yacreader_files.qrc - -win32:RESOURCES += yacreader_images_win.qrc -unix:!macx:RESOURCES += yacreader_images_win.qrc -macx:RESOURCES += yacreader_images_osx.qrc - - -include(../QsLog/QsLog.pri) - -RC_FILE = icon.rc - -macx { - ICON = YACReader.icns -} - -TRANSLATIONS = yacreader_es.ts \ - yacreader_fr.ts \ - yacreader_ru.ts \ - yacreader_pt.ts \ - yacreader_nl.ts \ - yacreader_tr.ts \ - yacreader_de.ts \ - yacreader_source.ts - -unix:!macx { -#set install prefix if it's empty -isEmpty(PREFIX) { - PREFIX = /usr -} - -BINDIR = $$PREFIX/bin -LIBDIR = $$PREFIX/lib -DATADIR = $$PREFIX/share - -DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" - -#MAKE INSTALL - -INSTALLS += bin docs icon desktop translation manpage - -bin.path = $$BINDIR -isEmpty(DESTDIR) { - bin.files = YACReader -} else { - bin.files = $$DESTDIR/YACReader -} - -docs.path = $$DATADIR/doc/yacreader - -#rename docs for better packageability -docs.extra = cp ../CHANGELOG.txt ../changelog; cp ../README.txt ../README -docs.files = ../README ../changelog - -icon.path = $$DATADIR/yacreader -icon.files = ../images/icon.png - -desktop.path = $$DATADIR/applications -desktop.extra = desktop-file-edit --set-icon=$$DATADIR/yacreader/icon.png ../YACReader.desktop -desktop.files = ../YACReader.desktop - -#TODO: icons should be located at /usr/share/icons and have the same basename as their application - -translation.path = $$DATADIR/yacreader/languages -translation.files = ../release/languages/yacreader_* - -manpage.path = $$DATADIR/man/man1 -manpage.files = ../YACReader.1 - -#remove leftover doc files when 'make clean' is invoked -QMAKE_CLEAN += "../changelog" "../README" -} +TEMPLATE = app +TARGET = YACReader + +QMAKE_TARGET_BUNDLE_PREFIX = "com.yacreader" + +DEPENDPATH += . \ + release + +DEFINES += NOMINMAX YACREADER +QMAKE_MAC_SDK = macosx10.12 + +#load default build flags +include (../config.pri) +include (../dependencies/pdf_backend.pri) + +unix:!macx{ + QMAKE_CXXFLAGS += -std=c++11 +} + +unix:haiku { + DEFINES += _BSD_SOURCE + LIBS += -lnetwork -lbsd +} + +CONFIG(force_angle) { + contains(QMAKE_TARGET.arch, x86_64) { + Release:DESTDIR = ../release64_angle + Debug:DESTDIR = ../debug64_angle + } else { + Release:DESTDIR = ../release_angle + Debug:DESTDIR = ../debug_angle + } +} else { + contains(QMAKE_TARGET.arch, x86_64) { + Release:DESTDIR = ../release64 + Debug:DESTDIR = ../debug64 + } else { + Release:DESTDIR = ../release + Debug:DESTDIR = ../debug + } +} + +SOURCES += main.cpp + +INCLUDEPATH += ../common \ + ../custom_widgets + +!CONFIG(no_opengl):CONFIG(legacy_gl_widget) { + INCLUDEPATH += ../common/gl_legacy \ +} else { + INCLUDEPATH += ../common/gl \ +} + +#there are going to be two builds for windows, OpenGL based and ANGLE based +win32 { + CONFIG(force_angle) { + message("using ANGLE") + LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32 + #linking extra libs are necesary for a successful compilation, a better approach should be + #to remove any OpenGL (desktop) dependencies + #the OpenGL stuff should be migrated to OpenGL ES + DEFINES += FORCE_ANGLE + } else { + LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32 + } + + QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL + QMAKE_LFLAGS_RELEASE += /LTCG + CONFIG -= embed_manifest_exe +} + +unix:!macx:!CONFIG(no_opengl) { + LIBS += -lGLU +} + +macx { + QT += macextras gui-private + CONFIG += objective_c + LIBS += -framework Foundation -framework ApplicationServices -framework AppKit +} + +QT += network widgets core multimedia +!CONFIG(no_opengl) { + QT += opengl +} + +#CONFIG += release +CONFIG -= flat + +# Sources +HEADERS += ../common/comic.h \ + configuration.h \ + goto_dialog.h \ + magnifying_glass.h \ + main_window_viewer.h \ + viewer.h \ + goto_flow.h \ + options_dialog.h \ + ../common/bookmarks.h \ + bookmarks_dialog.h \ + render.h \ + shortcuts_dialog.h \ + translator.h \ + goto_flow_widget.h \ + page_label_widget.h \ + goto_flow_toolbar.h \ + width_slider.h \ + notifications_label_widget.h \ + ../common/pictureflow.h \ + ../common/custom_widgets.h \ + ../common/check_new_version.h \ + ../common/qnaturalsorting.h \ + ../common/yacreader_global.h \ + ../common/yacreader_global_gui.h \ + ../common/onstart_flow_selection_dialog.h \ + ../common/comic_db.h \ + ../common/folder.h \ + ../common/library_item.h \ + yacreader_local_client.h \ + ../common/http_worker.h \ + ../common/exit_check.h \ + ../common/scroll_management.h \ + ../common/opengl_checker.h \ + ../common/pdf_comic.h + +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("Using legacy YACReaderFlowGL (QGLWidget) header") + DEFINES += YACREADER_LEGACY_FLOW_GL + HEADERS += ../common/gl_legacy/yacreader_flow_gl.h + } else { + HEADERS += ../common/gl/yacreader_flow_gl.h + } + HEADERS += goto_flow_gl.h +} + +SOURCES += ../common/comic.cpp \ + configuration.cpp \ + goto_dialog.cpp \ + magnifying_glass.cpp \ + main_window_viewer.cpp \ + viewer.cpp \ + goto_flow.cpp \ + options_dialog.cpp \ + ../common/bookmarks.cpp \ + bookmarks_dialog.cpp \ + render.cpp \ + shortcuts_dialog.cpp \ + translator.cpp \ + goto_flow_widget.cpp \ + page_label_widget.cpp \ + goto_flow_toolbar.cpp \ + width_slider.cpp \ + notifications_label_widget.cpp \ + ../common/pictureflow.cpp \ + ../common/custom_widgets.cpp \ + ../common/check_new_version.cpp \ + ../common/qnaturalsorting.cpp \ + ../common/onstart_flow_selection_dialog.cpp \ + ../common/comic_db.cpp \ + ../common/folder.cpp \ + ../common/library_item.cpp \ + yacreader_local_client.cpp \ + ../common/http_worker.cpp \ + ../common/yacreader_global.cpp \ + ../common/yacreader_global_gui.cpp \ + ../common/exit_check.cpp \ + ../common/scroll_management.cpp \ + ../common/opengl_checker.cpp + +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) source code") + SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp + } else { + SOURCES += ../common/gl/yacreader_flow_gl.cpp + } + SOURCES += goto_flow_gl.cpp +} + +include(../custom_widgets/custom_widgets_yacreader.pri) +CONFIG(7zip){ +include(../compressed_archive/wrapper.pri) +} else:CONFIG(unarr){ +include(../compressed_archive/unarr/unarr-wrapper.pri) +} else { + error(No compression backend specified. Did you mess with the build system?) + } +include(../shortcuts_management/shortcuts_management.pri) + +RESOURCES += yacreader_images.qrc \ + yacreader_files.qrc + +win32:RESOURCES += yacreader_images_win.qrc +unix:!macx:RESOURCES += yacreader_images_win.qrc +macx:RESOURCES += yacreader_images_osx.qrc + +include(../QsLog/QsLog.pri) + +RC_FILE = icon.rc + +macx { + ICON = YACReader.icns + QMAKE_INFO_PLIST = Info.plist +} + +TRANSLATIONS = yacreader_es.ts \ + yacreader_fr.ts \ + yacreader_ru.ts \ + yacreader_pt.ts \ + yacreader_nl.ts \ + yacreader_tr.ts \ + yacreader_de.ts \ + yacreader_source.ts + +unix:!macx { +#set install prefix if it's empty +isEmpty(PREFIX) { + PREFIX = /usr +} + +BINDIR = $$PREFIX/bin +LIBDIR = $$PREFIX/lib +DATADIR = $$PREFIX/share + +DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" + +#MAKE INSTALL + +INSTALLS += bin docs icon desktop translation manpage + +bin.path = $$BINDIR +isEmpty(DESTDIR) { + bin.files = YACReader +} else { + bin.files = $$DESTDIR/YACReader +} + +docs.path = $$DATADIR/doc/yacreader + +#rename docs for better packageability +docs.extra = cp ../README.txt ../README +docs.files = ../README ../CHANGELOG.md + +icon.path = $$DATADIR/icons/hicolor/scalable/apps +icon.files = ../YACReader.svg + +desktop.path = $$DATADIR/applications +desktop.files = ../YACReader.desktop + +translation.path = $$DATADIR/yacreader/languages +translation.files = ../release/languages/yacreader_* + +manpage.path = $$DATADIR/man/man1 +manpage.files = ../YACReader.1 + +#remove leftover doc files when 'make clean' is invoked +QMAKE_CLEAN += "../README" +} diff --git a/YACReader/configuration.cpp b/YACReader/configuration.cpp index 841ce1e6..5a0efd4c 100644 --- a/YACReader/configuration.cpp +++ b/YACReader/configuration.cpp @@ -12,7 +12,12 @@ Configuration::Configuration() { //read configuration - //load("/YACReader.conf"); + //load("/YACReader.conf"); +} + +QSettings *Configuration::getSettings() +{ + return settings; } /*Configuration::Configuration(const Configuration & conf) @@ -50,7 +55,7 @@ void Configuration::load(QSettings * settings) if(!settings->contains(SHOW_TOOLBARS)) settings->setValue(SHOW_TOOLBARS, true); if(!settings->contains(QUICK_NAVI_MODE)) - settings->setValue(QUICK_NAVI_MODE, true); + settings->setValue(QUICK_NAVI_MODE, false); //old fit stuff /*if(!settings->contains(FIT)) settings->setValue(FIT,false); @@ -66,9 +71,9 @@ void Configuration::updateOpenRecentList (QString path) list.removeAll(path); list.prepend(path); //TODO: Make list lenght configurable - while (list.length() > 10) + while (list.length() > getOpenRecentSize()) { list.removeLast(); } settings->setValue("recentFiles", list); -} \ No newline at end of file +} diff --git a/YACReader/configuration.h b/YACReader/configuration.h index ec5932c9..96f78a13 100644 --- a/YACReader/configuration.h +++ b/YACReader/configuration.h @@ -51,6 +51,7 @@ using namespace YACReader; static Configuration configuration; return configuration; }; + QSettings *getSettings(); void load(QSettings * settings); QString getDefaultPath() { return settings->value(PATH).toString(); } void setDefaultPath(QString defaultPath){settings->setValue(PATH,defaultPath);} @@ -66,6 +67,7 @@ using namespace YACReader; void setFitMode ( YACReader::FitMode fitMode ){ settings->setValue(FITMODE, static_cast(fitMode)); } //openRecent + int getOpenRecentSize() { return settings->value("recentSize", 25).toInt();} QStringList openRecentList() { return settings->value("recentFiles").toStringList(); } void updateOpenRecentList (QString path); void clearOpenRecentList() { settings->remove("recentFiles"); } @@ -109,6 +111,7 @@ using namespace YACReader; int getNumDaysBetweenVersionChecks() {return settings->value(NUM_DAYS_BETWEEN_VERSION_CHECKS,1).toInt();} void setNumDaysBetweenVersionChecks(int days) {return settings->setValue(NUM_DAYS_BETWEEN_VERSION_CHECKS,days);} bool getQuickNaviMode(){return settings->value(QUICK_NAVI_MODE).toBool();} + bool getDisableShowOnMouseOver(){return settings->value(DISABLE_MOUSE_OVER_GOTO_FLOW).toBool();} }; #endif diff --git a/YACReader/goto_flow.cpp b/YACReader/goto_flow.cpp index a74acf03..091924c5 100644 --- a/YACReader/goto_flow.cpp +++ b/YACReader/goto_flow.cpp @@ -223,6 +223,12 @@ void GoToFlow::updateConfig(QSettings * settings) resize(5*imageSize.width(), toolBar->height() + imageSize.height()*1.7); updateSize(); } + +void GoToFlow::setFlowRightToLeft(bool b) +{ + flow->setFlowRightToLeft(b); +} + //----------------------------------------------------------------------------- //SlideInitializer //----------------------------------------------------------------------------- diff --git a/YACReader/goto_flow.h b/YACReader/goto_flow.h index 041fe273..be157fa7 100644 --- a/YACReader/goto_flow.h +++ b/YACReader/goto_flow.h @@ -62,6 +62,8 @@ private slots: void setImageReady(int index,const QByteArray & image); void setFlowType(FlowType flowType); void updateConfig(QSettings * settings); + void setFlowRightToLeft(bool b); + signals: void goToPage(unsigned int page); diff --git a/YACReader/goto_flow_gl.cpp b/YACReader/goto_flow_gl.cpp index 5075cbca..80dca124 100644 --- a/YACReader/goto_flow_gl.cpp +++ b/YACReader/goto_flow_gl.cpp @@ -160,3 +160,8 @@ void GoToFlowGL::resizeEvent(QResizeEvent *event) toolBar->move(0, event->size().height() - toolBar->height()); toolBar->setFixedWidth(width()); } + +void GoToFlowGL::setFlowRightToLeft(bool b) +{ + flow->setFlowRightToLeft(b); +} diff --git a/YACReader/goto_flow_gl.h b/YACReader/goto_flow_gl.h index e6d76dc1..1feca85d 100644 --- a/YACReader/goto_flow_gl.h +++ b/YACReader/goto_flow_gl.h @@ -25,6 +25,7 @@ public: void setImageReady(int index,const QByteArray & image); void updateConfig(QSettings * settings); + void setFlowRightToLeft(bool b); signals: void goToPage(unsigned int page); diff --git a/YACReader/goto_flow_toolbar.cpp b/YACReader/goto_flow_toolbar.cpp index 4fe09d79..4043f568 100644 --- a/YACReader/goto_flow_toolbar.cpp +++ b/YACReader/goto_flow_toolbar.cpp @@ -20,18 +20,19 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent) slider = new QSlider(Qt::Horizontal,this); slider->setStyleSheet( "QSlider::groove:horizontal {" - " border: 1px solid white;" - " border-radius: 6px;" - " background: rgba(255, 255, 255, 50);" - " margin: 2px 0;" + " border: 1px solid #22FFFFFF;" + " border-radius: 1px;" + " background: #77000000;" + " margin: 2px 0;" + " padding: 1px;" "}" "QSlider::handle:horizontal {" - " background: rgba(0, 0, 0, 200);" - " border: 1px solid white;" - " width: 24px;" - " border-radius: 6px;" + " background: #55FFFFFF;" + " width: 48px;" + " border-radius: 1px;" "}" ); + connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); }); pageHint = new QLabel("" + tr("Page : ") + "",this); @@ -85,19 +86,11 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent) naviLayout->addWidget(slider); naviLayout->addWidget(goToButton); - switchLayout(); + updateOptions(); setFixedHeight(50); } -void GoToFlowToolBar::switchLayout() -{ - if (Configuration::getConfiguration().getQuickNaviMode()) - setCurrentIndex(1); - else - setCurrentIndex(0); -} - void GoToFlowToolBar::paintEvent(QPaintEvent *) { QPainter painter(this); @@ -130,5 +123,15 @@ void GoToFlowToolBar::goTo() void GoToFlowToolBar::centerSlide() { if(edit->text().toInt()!=0) - emit(setCenter(edit->text().toInt()-1)); + emit(setCenter(edit->text().toInt()-1)); +} + +void GoToFlowToolBar::updateOptions() +{ + if (Configuration::getConfiguration().getQuickNaviMode()) + setCurrentIndex(1); + else + setCurrentIndex(0); + + slider->setInvertedAppearance(Configuration::getConfiguration().getDoubleMangaPage()); } diff --git a/YACReader/goto_flow_toolbar.h b/YACReader/goto_flow_toolbar.h index 803026c0..91a9270a 100644 --- a/YACReader/goto_flow_toolbar.h +++ b/YACReader/goto_flow_toolbar.h @@ -2,7 +2,7 @@ #define GOTO_FLOW_TOOLBAR_H #include -#include +#include class QLineEdit; class QIntValidator; @@ -25,12 +25,13 @@ class GoToFlowToolBar : public QStackedWidget public: GoToFlowToolBar(QWidget * parent = 0); - void switchLayout(); + public slots: void setPage(int pageNumber); void setTop(int numPages); void goTo(); void centerSlide(); + void updateOptions(); signals: void setCenter(unsigned int); void goTo(unsigned int); diff --git a/YACReader/goto_flow_widget.cpp b/YACReader/goto_flow_widget.cpp index 6714a733..acb31468 100644 --- a/YACReader/goto_flow_widget.cpp +++ b/YACReader/goto_flow_widget.cpp @@ -54,7 +54,7 @@ void GoToFlowWidget::keyPressEvent(QKeyEvent* event) void GoToFlowWidget::updateConfig(QSettings * settings) { Q_UNUSED(settings) - toolBar->switchLayout(); + toolBar->updateOptions(); } void GoToFlowWidget::updateSize() diff --git a/YACReader/goto_flow_widget.h b/YACReader/goto_flow_widget.h index 5c194982..a981fa2c 100644 --- a/YACReader/goto_flow_widget.h +++ b/YACReader/goto_flow_widget.h @@ -29,6 +29,7 @@ public slots: virtual void setImageReady(int index,const QByteArray & image) = 0; virtual void updateSize(); virtual void updateConfig(QSettings * settings); + virtual void setFlowRightToLeft(bool b) = 0; protected: void keyPressEvent(QKeyEvent* event); diff --git a/YACReader/icon.ico b/YACReader/icon.ico index 6c31de5a..e85b1e60 100644 Binary files a/YACReader/icon.ico and b/YACReader/icon.ico differ diff --git a/YACReader/main.cpp b/YACReader/main.cpp index efd8d012..ebe4312f 100644 --- a/YACReader/main.cpp +++ b/YACReader/main.cpp @@ -85,12 +85,15 @@ int main(int argc, char * argv[]) app.setApplicationName("YACReader"); app.setOrganizationName("YACReader"); - app.setAttribute(Qt::AA_UseHighDpiPixmaps); - //simple command line parser + app.setAttribute(Qt::AA_UseHighDpiPixmaps); + if (QIcon::hasThemeIcon("YACReader")) { + app.setWindowIcon(QIcon::fromTheme("YACReader")); + } + //simple command line parser //will be replaced by QCommandLineParser in the future QStringList optlist; QStringList arglist; - + if (argc > 1) { //extract options and arguments @@ -118,7 +121,7 @@ int main(int argc, char * argv[]) } } } - + QString destLog = YACReader::getSettingsPath()+"/yacreader.log"; QDir().mkpath(YACReader::getSettingsPath()); @@ -133,11 +136,11 @@ int main(int argc, char * argv[]) QTranslator translator; QString sufix = QLocale::system().name(); -#if defined Q_OS_UNIX && !defined Q_OS_MAC +#if defined Q_OS_UNIX && !defined Q_OS_MAC translator.load(QString(DATADIR)+"/yacreader/languages/yacreader_"+sufix); #else translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix); -#endif +#endif app.installTranslator(&translator); MainWindowViewer * mwv = new MainWindowViewer(); @@ -145,7 +148,7 @@ int main(int argc, char * argv[]) //if we have a valid request, open it - if not, load normally if (argc > 1) { - if (!optlist.filter("--comicId=").isEmpty() && !optlist.filter("--libraryId=").isEmpty()) + if (!optlist.filter("--comicId=").isEmpty() && !optlist.filter("--libraryId=").isEmpty()) { if (arglist.count()>1) { @@ -165,9 +168,19 @@ int main(int argc, char * argv[]) int ret = app.exec(); + delete mwv; + //Configuration::getConfiguration().save(); - + YACReader::exitCheck(ret); +#ifdef Q_OS_MAC + // ugly workaround to avoid crash when app exit on MacOS Sierra due to Qt's QColorDialog bug. + // cf. https://bugreports.qt.io/browse/QTBUG-56448 + QColorDialog colorDlg(0); + colorDlg.setOption(QColorDialog::NoButtons); + colorDlg.setCurrentColor(Qt::white); +#endif + return ret; } diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index d114108d..f5abf669 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -84,8 +84,9 @@ MainWindowViewer::~MainWindowViewer() //delete sliderAction; delete openAction; delete openFolderAction; + delete openLatestComicAction; delete saveImageAction; - delete openPreviousComicAction; + delete openPreviousComicAction; delete openNextComicAction; delete prevAction; delete nextAction; @@ -126,8 +127,6 @@ void MainWindowViewer::loadConfiguration() void MainWindowViewer::setupUI() { - setWindowIcon(QIcon(":/images/icon.png")); - //setUnifiedTitleAndToolBarOnMac(true); viewer = new Viewer(this); @@ -180,15 +179,19 @@ void MainWindowViewer::setupUI() setWindowTitle("YACReader"); checkNewVersion(); - + viewer->setFocusPolicy(Qt::StrongFocus); - + //if(Configuration::getConfiguration().getAlwaysOnTop()) //{ // setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); //} + previousWindowFlags = windowFlags(); + previousPos = pos(); + previousSize = size(); + if(fullscreen) toFullScreen(); if(conf.getMaximized()) @@ -218,20 +221,26 @@ void MainWindowViewer::createActions() openFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_FOLDER_ACTION_Y)); connect(openFolderAction, SIGNAL(triggered()), this, SLOT(openFolder())); - QAction* recentFileAction = 0; + openLatestComicAction = new QAction(tr("Open latest comic"), this); + openLatestComicAction->setToolTip(tr("Open the latest comic opened in the previous reading session")); + openLatestComicAction->setData(OPEN_LATEST_COMIC_Y); + openLatestComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_LATEST_COMIC_Y)); + connect(openLatestComicAction, SIGNAL(triggered()), this, SLOT(openLatestComic())); + + QAction* recentFileAction = nullptr; //TODO: Replace limit with a configurable value - for (int i = 0; i < 10; i++) + for (int i = 0; i < Configuration::getConfiguration().getOpenRecentSize(); i++) { recentFileAction = new QAction(this); recentFileAction->setVisible(false); QObject::connect(recentFileAction, &QAction::triggered, this, &MainWindowViewer::openRecent); recentFilesActionList.append(recentFileAction); } - + clearRecentFilesAction = new QAction(tr("Clear"),this); - clearRecentFilesAction->setToolTip(tr("Clear openrecent list")); + clearRecentFilesAction->setToolTip(tr("Clear open recent list")); connect(clearRecentFilesAction, &QAction::triggered, this, &MainWindowViewer::clearRecentFiles); - + saveImageAction = new QAction(tr("Save"),this); saveImageAction->setIcon(QIcon(":/images/viewer_toolbar/save.png")); saveImageAction->setToolTip(tr("Save current page")); @@ -383,7 +392,7 @@ void MainWindowViewer::createActions() doublePageAction->setData(DOUBLE_PAGE_ACTION_Y); doublePageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_PAGE_ACTION_Y)); connect(doublePageAction, SIGNAL(triggered()),viewer,SLOT(doublePageSwitch())); - + //inversed pictures mode doubleMangaPageAction = new QAction(tr("Double page manga mode"),this); doubleMangaPageAction->setToolTip(tr("Reverse reading order in double page mode")); @@ -394,7 +403,7 @@ void MainWindowViewer::createActions() doubleMangaPageAction->setData(DOUBLE_MANGA_PAGE_ACTION_Y); doubleMangaPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_MANGA_PAGE_ACTION_Y)); connect(doubleMangaPageAction, SIGNAL(triggered()),viewer,SLOT(doubleMangaPageSwitch())); - + goToPageAction = new QAction(tr("Go To"),this); goToPageAction->setIcon(QIcon(":/images/viewer_toolbar/goto.png")); goToPageAction->setDisabled(true); @@ -524,6 +533,7 @@ void MainWindowViewer::createToolBars() QToolButton * tb = new QToolButton(); tb->addAction(openAction); + tb->addAction(openLatestComicAction); tb->addAction(openFolderAction); tb->addAction(recentmenu->menuAction()); tb->setPopupMode(QToolButton::MenuButtonPopup); @@ -531,6 +541,7 @@ void MainWindowViewer::createToolBars() comicToolBar->addWidget(tb); #endif + comicToolBar->addAction(saveImageAction); comicToolBar->addAction(openPreviousComicAction); comicToolBar->addAction(openNextComicAction); @@ -570,7 +581,7 @@ void MainWindowViewer::createToolBars() comicToolBar->addAction(setBookmarkAction); comicToolBar->addAction(showBookmarksAction); - + comicToolBar->addSeparator(); comicToolBar->addAction(showDictionaryAction); @@ -583,7 +594,7 @@ void MainWindowViewer::createToolBars() comicToolBar->addWidget(new YACReaderToolBarStretch()); #endif - + comicToolBar->addAction(showShorcutsAction); comicToolBar->addAction(optionsAction); comicToolBar->addAction(helpAboutAction); @@ -648,16 +659,72 @@ void MainWindowViewer::createToolBars() QMenu * fileMenu = new QMenu(tr("File")); fileMenu->addAction(openAction); + fileMenu->addAction(openLatestComicAction); fileMenu->addAction(openFolderAction); fileMenu->addSeparator(); fileMenu->addAction(saveImageAction); + fileMenu->addSeparator(); + + QMenu * recentmenu = new QMenu(tr("Open recent")); + recentmenu->addActions(recentFilesActionList); + recentmenu->addSeparator(); + recentmenu->addAction(clearRecentFilesAction); + refreshRecentFilesActionList(); + fileMenu->addMenu(recentmenu); + + fileMenu->addSeparator(); + fileMenu->addAction(closeAction); + + QMenu * editMenu = new QMenu(tr("Edit")); + editMenu->addAction(leftRotationAction); + editMenu->addAction(rightRotationAction); + + QMenu * viewMenu = new QMenu(tr("View")); + viewMenu->addAction(adjustHeightAction); + viewMenu->addAction(adjustWidthAction); + viewMenu->addAction(fitToPageAction); + viewMenu->addAction(adjustToFullSizeAction); + viewMenu->addSeparator(); + viewMenu->addAction(increasePageZoomAction); + viewMenu->addAction(decreasePageZoomAction); + viewMenu->addAction(resetZoomAction); + viewMenu->addAction(showZoomSliderlAction); + viewMenu->addSeparator(); + viewMenu->addAction(doublePageAction); + viewMenu->addAction(doubleMangaPageAction); + viewMenu->addSeparator(); + viewMenu->addAction(showMagnifyingGlassAction); + + QMenu * goMenu = new QMenu(tr("Go")); + goMenu->addAction(prevAction); + goMenu->addAction(nextAction); + goMenu->addAction(goToPageAction); + goMenu->addSeparator(); + goMenu->addAction(setBookmarkAction); + goMenu->addAction(showBookmarksAction); + + QMenu * windowMenu = new QMenu(tr("Window")); + windowMenu->addAction(optionsAction); // this action goes to MacOS's Preference menu by Qt + windowMenu->addAction(showShorcutsAction); + windowMenu->addAction(showFlowAction); + windowMenu->addAction(showInfoAction); + windowMenu->addAction(showDictionaryAction); + + QMenu * helpMenu = new QMenu(tr("Help")); + helpMenu->addAction(helpAboutAction); + + menuBar->addMenu(fileMenu); + menuBar->addMenu(editMenu); + menuBar->addMenu(viewMenu); + menuBar->addMenu(goMenu); + menuBar->addMenu(windowMenu); + menuBar->addMenu(helpMenu); //tool bar //QMenu * toolbarMenu = new QMenu(tr("Toolbar")); //toolbarMenu->addAction(); //TODO - menuBar->addMenu(fileMenu); //menu->addMenu(toolbarMenu); //attach toolbar @@ -671,19 +738,19 @@ void MainWindowViewer::createToolBars() void MainWindowViewer::refreshRecentFilesActionList() { QStringList recentFilePaths = Configuration::getConfiguration().openRecentList(); - + //TODO: Replace limit with something configurable - int iteration = (recentFilePaths.size() < 10) ? recentFilePaths.size() : 10; - - for (int i = 0; i < iteration; i++) + int iteration = (recentFilePaths.size() < Configuration::getConfiguration().getOpenRecentSize()) + ? recentFilePaths.size() : Configuration::getConfiguration().getOpenRecentSize(); + for (int i = 0; i < iteration; i++) { QString strippedName = QFileInfo(recentFilePaths.at(i)).fileName(); recentFilesActionList.at(i)->setText(strippedName); recentFilesActionList.at(i)->setData(recentFilePaths.at(i)); recentFilesActionList.at(i)->setVisible(true); } - - for (int i = iteration; i < 10; i++) + + for (int i = iteration; i < Configuration::getConfiguration().getOpenRecentSize(); i++) { recentFilesActionList.at(i)->setVisible(false); } @@ -698,22 +765,39 @@ void MainWindowViewer::clearRecentFiles() void MainWindowViewer::openRecent() { QAction *action = qobject_cast(sender()); - if (action) - { - QFileInfo info1 (action->data().toString()); - if (info1.exists()) - { - if (info1.isFile()) - { - openComicFromPath(action->data().toString()); - } - else if (info1.isDir()) - { - openFolderFromPath(action->data().toString()); - } - } - - } + + openComicFromRecentAction(action); +} + +void MainWindowViewer::openLatestComic() +{ + if (recentFilesActionList.isEmpty()) + { + return; + } + + openComicFromRecentAction(recentFilesActionList[0]); +} + +void MainWindowViewer::openComicFromRecentAction(QAction *action) +{ + if (action == nullptr) + { + return; + } + + QFileInfo info1 (action->data().toString()); + if (info1.exists()) + { + if (info1.isFile()) + { + openComicFromPath(action->data().toString()); + } + else if (info1.isDir()) + { + openFolderFromPath(action->data().toString()); + } + } } void MainWindowViewer::reloadOptions() @@ -772,9 +856,9 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId) //libraryId = QCoreApplication::arguments().at(3).split("=").at(1).toULongLong(); this->libraryId=libraryId; // this->path=path; - + enableActions(); - + currentComicDB.id = comicId; YACReaderLocalClient client; int tries = 1; @@ -789,7 +873,7 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId) } else { - isClient = false; + isClient = false; QMessageBox::information(this,"Connection Error", "Unable to connect to YACReaderLibrary"); //error } @@ -820,7 +904,7 @@ void MainWindowViewer::openComic(QString pathFile) enableActions(); viewer->open(pathFile); - Configuration::getConfiguration().updateOpenRecentList(pathFile); + Configuration::getConfiguration().updateOpenRecentList(fi.absoluteFilePath()); refreshRecentFilesActionList(); } @@ -846,7 +930,7 @@ void MainWindowViewer::openFolderFromPath(QString pathDir) enableActions(); viewer->open(pathDir); - Configuration::getConfiguration().updateOpenRecentList(pathDir); + Configuration::getConfiguration().updateOpenRecentList(fi.absoluteFilePath()); refreshRecentFilesActionList(); } @@ -879,7 +963,7 @@ void MainWindowViewer::openFolderFromPath(QString pathDir, QString atFileName) if(i < list.count()) index = i; - viewer->open(pathDir,index); + viewer->open(pathDir,index); } void MainWindowViewer::saveImage() @@ -922,6 +1006,11 @@ void MainWindowViewer::enableActions() showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited showDictionaryAction->setDisabled(false); showFlowAction->setDisabled(false); + +#ifdef Q_OS_MAC + activateWindow(); + raise(); +#endif } void MainWindowViewer::disableActions() { @@ -1000,6 +1089,57 @@ void MainWindowViewer::toggleFullScreen() Configuration::getConfiguration().setFullScreen(fullscreen = !fullscreen); } +#ifdef Q_OS_WIN //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309 + +void MainWindowViewer::toFullScreen() +{ + fromMaximized = this->isMaximized(); + + hideToolBars(); + viewer->hide(); + viewer->fullscreen = true;//TODO, change by the right use of windowState(); + + previousWindowFlags = windowFlags(); + previousPos = pos(); + previousSize = size(); + + showNormal(); + setWindowFlags(previousWindowFlags | Qt::FramelessWindowHint); + + const QRect r = windowHandle()->screen()->geometry(); + + move(r.x(), r.y()); + resize(r.width(),r.height()+1); + show(); + + viewer->show(); + if(viewer->magnifyingGlassIsVisible()) + viewer->showMagnifyingGlass(); +} + +void MainWindowViewer::toNormal() +{ + //show all + viewer->hide(); + viewer->fullscreen = false;//TODO, change by the right use of windowState(); + //viewer->hideMagnifyingGlass(); + + setWindowFlags(previousWindowFlags); + move(previousPos); + resize(previousSize); + show(); + + if(fromMaximized) + showMaximized(); + + if(Configuration::getConfiguration().getShowToolbars()) + showToolBars(); + viewer->show(); + if(viewer->magnifyingGlassIsVisible()) + viewer->showMagnifyingGlass(); +} + +#else void MainWindowViewer::toFullScreen() { fromMaximized = this->isMaximized(); @@ -1030,6 +1170,7 @@ void MainWindowViewer::toNormal() if(viewer->magnifyingGlassIsVisible()) viewer->showMagnifyingGlass(); } +#endif void MainWindowViewer::toggleToolBars() { @@ -1129,12 +1270,12 @@ void MainWindowViewer::setUpShortcutsManagement() editShortcutsDialog->addActionsGroup(tr("Comics"),QIcon(":/images/shortcuts_group_comics.png"), - tmpList = QList() - << openAction - << openFolderAction - << saveImageAction - << openPreviousComicAction - << openNextComicAction); + tmpList = { openAction, + openLatestComicAction, + openFolderAction, + saveImageAction, + openPreviousComicAction, + openNextComicAction }); allActions << tmpList; @@ -1218,6 +1359,22 @@ void MainWindowViewer::setUpShortcutsManagement() autoScrollBackwardAction->setData(AUTO_SCROLL_BACKWARD_ACTION_Y); autoScrollBackwardAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y)); + QAction * autoScrollForwardHorizontalFirstAction = new QAction(tr("Autoscroll forward, horizontal first"),orphanActions); + autoScrollForwardHorizontalFirstAction->setData(AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y); + autoScrollForwardHorizontalFirstAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y)); + + QAction * autoScrollBackwardHorizontalFirstAction = new QAction(tr("Autoscroll backward, horizontal first"),orphanActions); + autoScrollBackwardHorizontalFirstAction->setData(AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y); + autoScrollBackwardHorizontalFirstAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y)); + + QAction * autoScrollForwardVerticalFirstAction = new QAction(tr("Autoscroll forward, vertical first"),orphanActions); + autoScrollForwardVerticalFirstAction->setData(AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y); + autoScrollForwardVerticalFirstAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y)); + + QAction * autoScrollBackwardVerticalFirstAction = new QAction(tr("Autoscroll backward, vertical first"),orphanActions); + autoScrollBackwardVerticalFirstAction->setData(AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y); + autoScrollBackwardVerticalFirstAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y)); + QAction * moveDownAction = new QAction(tr("Move down"),orphanActions); moveDownAction->setData(MOVE_DOWN_ACTION_Y); moveDownAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y)); @@ -1250,6 +1407,10 @@ void MainWindowViewer::setUpShortcutsManagement() << showBookmarksAction << autoScrollForwardAction << autoScrollBackwardAction + << autoScrollForwardHorizontalFirstAction + << autoScrollBackwardHorizontalFirstAction + << autoScrollForwardVerticalFirstAction + << autoScrollBackwardVerticalFirstAction << moveDownAction << moveUpAction << moveLeftAction @@ -1327,7 +1488,7 @@ void MainWindowViewer::closeEvent ( QCloseEvent * event ) conf.setSize(size()); } conf.setMaximized(isMaximized()); - + emit (closed()); } @@ -1436,16 +1597,16 @@ void MainWindowViewer::dropEvent(QDropEvent *event) QList urlList; QString fName; QFileInfo info; - + if (event->mimeData()->hasUrls()) { urlList = event->mimeData()->urls(); - + if ( urlList.size() > 0 ) { fName = urlList[0].toLocalFile(); // convert first QUrl to local path info.setFile( fName ); // information about file - if (info.isFile()) + if (info.isFile()) { QStringList imageSuffixs = Comic::getSupportedImageLiteralFormats(); if(imageSuffixs.contains(info.suffix())) //image dropped @@ -1453,7 +1614,7 @@ void MainWindowViewer::dropEvent(QDropEvent *event) else openComicFromPath(fName); // if is file, setText } - else + else if(info.isDir()) openFolderFromPath(fName); @@ -1466,8 +1627,8 @@ void MainWindowViewer::dropEvent(QDropEvent *event) void MainWindowViewer::dragEnterEvent(QDragEnterEvent *event) { // accept just text/uri-list mime format - if (event->mimeData()->hasFormat("text/uri-list")) - { + if (event->mimeData()->hasFormat("text/uri-list")) + { event->acceptProposedAction(); isClient = false; } diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index beaef34e..a0a697b7 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -35,6 +35,8 @@ class EditShortcutsDialog; void open(QString path, qint64 comicId, qint64 libraryId); void openFolder(); void openRecent(); + void openLatestComic(); + void openComicFromRecentAction(QAction *action); void saveImage(); void toggleToolBars(); void hideToolBars(); @@ -106,6 +108,7 @@ class EditShortcutsDialog; //! Actions QAction *openAction; QAction *openFolderAction; + QAction *openLatestComicAction; QList recentFilesActionList; QAction *clearRecentFilesAction; QAction *saveImageAction; @@ -167,6 +170,11 @@ class EditShortcutsDialog; bool isClient; QString startComicPath; quint64 libraryId; + + //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309 + Qt::WindowFlags previousWindowFlags; + QPoint previousPos; + QSize previousSize; signals: void closed(); protected: diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index b542d2c3..559b044a 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -105,7 +105,8 @@ OptionsDialog::OptionsDialog(QWidget * parent) connect(gammaS,SIGNAL(valueChanged(int)),this,SLOT(gammaChanged(int))); //connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions())); - quickNavi = new QCheckBox(tr("Quick Navigation Mode")); + quickNavi = new QCheckBox(tr("Quick Navigation Mode")); + disableShowOnMouseOver = new QCheckBox(tr("Disable mouse over activation")); QHBoxLayout * buttons = new QHBoxLayout(); buttons->addStretch(); @@ -119,13 +120,16 @@ OptionsDialog::OptionsDialog(QWidget * parent) layoutGeneral->addWidget(colorBox); layoutGeneral->addWidget(shortcutsBox); layoutGeneral->addStretch(); + layoutFlow->addWidget(sw); #ifndef NO_OPENGL layoutFlow->addWidget(gl); layoutFlow->addWidget(useGL); #endif layoutFlow->addWidget(quickNavi); + layoutFlow->addWidget(disableShowOnMouseOver); layoutFlow->addStretch(); + layoutImage->addWidget(new QLabel(tr("Brightness")),0,0); layoutImage->addWidget(new QLabel(tr("Contrast")),1,0); layoutImage->addWidget(new QLabel(tr("Gamma")),2,0); @@ -194,7 +198,8 @@ void OptionsDialog::saveOptions() settings->setValue(BACKGROUND_COLOR,colorDialog->currentColor()); //settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0); - settings->setValue(QUICK_NAVI_MODE,quickNavi->isChecked()); + settings->setValue(QUICK_NAVI_MODE,quickNavi->isChecked()); + settings->setValue(DISABLE_MOUSE_OVER_GOTO_FLOW,disableShowOnMouseOver->isChecked()); YACReaderOptionsDialog::saveOptions(); } @@ -225,7 +230,8 @@ void OptionsDialog::restoreOptions(QSettings * settings) updateColor(settings->value(BACKGROUND_COLOR).value()); //fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100); - quickNavi->setChecked(settings->value(QUICK_NAVI_MODE).toBool()); + quickNavi->setChecked(settings->value(QUICK_NAVI_MODE).toBool()); + disableShowOnMouseOver->setChecked(settings->value(DISABLE_MOUSE_OVER_GOTO_FLOW).toBool()); brightnessS->setValue(settings->value(BRIGHTNESS,0).toInt()); contrastS->setValue(settings->value(CONTRAST,100).toInt()); diff --git a/YACReader/options_dialog.h b/YACReader/options_dialog.h index df0a723b..95bc5403 100644 --- a/YACReader/options_dialog.h +++ b/YACReader/options_dialog.h @@ -23,7 +23,8 @@ Q_OBJECT //QLabel * pathLabel; QLineEdit * pathEdit; QPushButton * pathFindButton; - QCheckBox * quickNavi; + QCheckBox * quickNavi; + QCheckBox * disableShowOnMouseOver; QLabel * magGlassSizeLabel; diff --git a/YACReader/render.cpp b/YACReader/render.cpp index ff4177c9..e3f6cc44 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -373,7 +373,7 @@ filters(f) void PageRender::run() { QMutexLocker locker(&(render->mutex)); - + QImage img; img.loadFromData(data); if(degrees > 0) @@ -387,7 +387,7 @@ void PageRender::run() img = filters[i]->setFilter(img); } - + *page = img; emit pageReady(numPage); @@ -421,15 +421,16 @@ Render::~Render() comic->deleteLater(); } - foreach(ImageFilter * filter, filters) - delete filter; - foreach(PageRender * pr,pageRenders) if(pr !=0) { if(pr->wait()) delete pr; } + + //TODO move to share_ptr + foreach(ImageFilter * filter, filters) + delete filter; } //Este método se encarga de forzar el renderizado de las páginas. //Actualiza el buffer según es necesario. @@ -687,7 +688,7 @@ void Render::setComic(Comic * c) void Render::prepareAvailablePage(int page) { - if(!doublePage) + if(!doublePage) { if (currentIndex == page) { @@ -701,7 +702,7 @@ void Render::prepareAvailablePage(int page) { emit currentPageReady(); } - else if ((currentIndex == page && !buffer[currentPageBufferedIndex+1]->isNull()) || + else if ((currentIndex == page && !buffer[currentPageBufferedIndex+1]->isNull()) || (currentIndex+1 == page && !buffer[currentPageBufferedIndex]->isNull())) { emit currentPageReady(); @@ -758,16 +759,20 @@ void Render::load(const QString & path, const ComicDB & comicDB) void Render::createComic(const QString & path) { + previousIndex = currentIndex = 0; + pagesEmited.clear(); + if(comic!=0) { //comic->moveToThread(QApplication::instance()->thread()); + comic->invalidate(); + comic->disconnect(); comic->deleteLater(); } //comic->moveToThread(QApplication::instance()->thread()); comic = FactoryComic::newComic(path); - if(comic == NULL)//archivo no encontrado o no válido { emit errorOpening(); @@ -775,21 +780,19 @@ void Render::createComic(const QString & path) return; } - previousIndex = currentIndex = 0; + connect(comic,SIGNAL(errorOpening()),this,SIGNAL(errorOpening()), Qt::QueuedConnection); + connect(comic,SIGNAL(errorOpening(QString)),this,SIGNAL(errorOpening(QString)), Qt::QueuedConnection); + connect(comic,SIGNAL(crcErrorFound(QString)),this,SIGNAL(crcError(QString)), Qt::QueuedConnection); + connect(comic,SIGNAL(errorOpening()),this,SLOT(reset()), Qt::QueuedConnection); + connect(comic,SIGNAL(imageLoaded(int)),this,SLOT(pageRawDataReady(int)), Qt::QueuedConnection); + connect(comic,SIGNAL(imageLoaded(int)),this,SIGNAL(imageLoaded(int)), Qt::QueuedConnection); + connect(comic,SIGNAL(openAt(int)),this,SLOT(renderAt(int)), Qt::QueuedConnection); + connect(comic,SIGNAL(numPages(unsigned int)),this,SIGNAL(numPages(unsigned int)), Qt::QueuedConnection); + connect(comic,SIGNAL(numPages(unsigned int)),this,SLOT(setNumPages(unsigned int)), Qt::QueuedConnection); + connect(comic,SIGNAL(imageLoaded(int,QByteArray)),this,SIGNAL(imageLoaded(int,QByteArray)), Qt::QueuedConnection); + connect(comic,SIGNAL(isBookmark(bool)),this,SIGNAL(currentPageIsBookmark(bool)), Qt::QueuedConnection); - connect(comic,SIGNAL(errorOpening()),this,SIGNAL(errorOpening())); - connect(comic,SIGNAL(errorOpening(QString)),this,SIGNAL(errorOpening(QString))); - connect(comic,SIGNAL(crcErrorFound(QString)),this,SIGNAL(crcError(QString))); - connect(comic,SIGNAL(errorOpening()),this,SLOT(reset())); - connect(comic,SIGNAL(imageLoaded(int)),this,SIGNAL(imageLoaded(int))); - connect(comic,SIGNAL(imageLoaded(int)),this,SLOT(pageRawDataReady(int))); - connect(comic,SIGNAL(openAt(int)),this,SLOT(renderAt(int))); - connect(comic,SIGNAL(numPages(unsigned int)),this,SIGNAL(numPages(unsigned int))); - connect(comic,SIGNAL(numPages(unsigned int)),this,SLOT(setNumPages(unsigned int))); - connect(comic,SIGNAL(imageLoaded(int,QByteArray)),this,SIGNAL(imageLoaded(int,QByteArray))); - connect(comic,SIGNAL(isBookmark(bool)),this,SIGNAL(currentPageIsBookmark(bool))); - - connect(comic,SIGNAL(bookmarksUpdated()),this,SIGNAL(bookmarksUpdated())); + connect(comic,SIGNAL(bookmarksUpdated()),this,SIGNAL(bookmarksUpdated()), Qt::QueuedConnection); //connect(comic,SIGNAL(isLast()),this,SIGNAL(isLast())); //connect(comic,SIGNAL(isCover()),this,SIGNAL(isCover())); @@ -807,19 +810,21 @@ void Render::loadComic(const QString & path, int atPage) void Render::startLoad() { - QThread * thread = NULL; + QThread * thread = nullptr; thread = new QThread(); comic->moveToThread(thread); - connect(comic, SIGNAL(errorOpening()), thread, SLOT(quit())); - connect(comic, SIGNAL(errorOpening(QString)), thread, SLOT(quit())); - connect(comic, SIGNAL(imagesLoaded()), thread, SLOT(quit())); + connect(comic, SIGNAL(errorOpening()), thread, SLOT(quit()), Qt::QueuedConnection); + connect(comic, SIGNAL(errorOpening(QString)), thread, SLOT(quit()), Qt::QueuedConnection); + connect(comic, SIGNAL(imagesLoaded()), thread, SLOT(quit()), Qt::QueuedConnection); + connect(comic, SIGNAL(destroyed()), thread, SLOT(quit()), Qt::QueuedConnection); + connect(comic, SIGNAL(invalidated()), thread, SLOT(quit()), Qt::QueuedConnection); connect(thread, SIGNAL(started()), comic, SLOT(process())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); - if(thread != NULL) + if(thread != nullptr) thread->start(); invalidate(); @@ -867,7 +872,7 @@ void Render::nextDoublePage() else { nextPage = currentIndex; - } + } if(currentIndex != nextPage) { comic->setIndex(nextPage); @@ -881,14 +886,14 @@ void Render::nextDoublePage() emit isLast(); } } - + //si se solicita la página anterior, se calcula cuál debe ser en función de si se lee en modo a doble página o no. //la página sólo se renderiza, si realmente ha cambiado. void Render::previousPage() { int previousPage; //indica cuál será la próxima página previousPage = comic->previousPage(); - + //se fuerza renderizado si la página ha cambiado if(currentIndex != previousPage) { @@ -916,7 +921,7 @@ void Render::previousDoublePage() emit pageChanged(currentIndex); } } - + unsigned int Render::getIndex() { return comic->getIndex(); @@ -949,7 +954,10 @@ void Render::pageRawDataReady(int page) for(int i=0;i= pagesReady.size()) + { + pagesEmited.clear(); return; //Oooops, something went wrong + } pagesReady[pagesEmited.at(i)] = true; if(pagesEmited.at(i) == currentIndex) @@ -1002,7 +1010,7 @@ void Render::updateBuffer() { QMutexLocker locker(&mutex); int windowSize = currentIndex - previousIndex; - + if(windowSize > 0)//add pages to right pages and remove on the left { windowSize = qMin(windowSize,buffer.size()); @@ -1019,7 +1027,7 @@ void Render::updateBuffer() pageRenders.push_back(0); //images - + if(buffer.front()!=0) delete buffer.front(); buffer.pop_front(); @@ -1056,10 +1064,15 @@ void Render::updateBuffer() void Render::fillBuffer() { + if (pagesReady.size() < 1) + { + return; + } + for(int i = 1; i <= qMax(numLeftPages,numRightPages); i++) { - if ((currentIndex+i < (int)comic->numPages()) && - buffer[currentPageBufferedIndex+i]->isNull() && + if ((currentIndex+i < (int)comic->numPages()) && + buffer[currentPageBufferedIndex+i]->isNull() && i <= numRightPages && pageRenders[currentPageBufferedIndex+i]==0 && pagesReady[currentIndex+i]) //preload next pages @@ -1069,8 +1082,8 @@ void Render::fillBuffer() pageRenders[currentPageBufferedIndex+i]->start(); } - if ((currentIndex-i > 0) && - buffer[currentPageBufferedIndex-i]->isNull() && + if ((currentIndex-i > 0) && + buffer[currentPageBufferedIndex-i]->isNull() && i <= numLeftPages && pageRenders[currentPageBufferedIndex-i]==0 && pagesReady[currentIndex-i]) //preload previous pages diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index e5091243..7593ab92 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -117,6 +117,11 @@ Viewer::Viewer(QWidget * parent) //animations verticalScroller = new QPropertyAnimation(verticalScrollBar(), "sliderPosition"); connect(verticalScroller,SIGNAL(valueChanged (const QVariant &)),this,SIGNAL(backgroundChanges())); + horizontalScroller = new QPropertyAnimation(horizontalScrollBar(), "sliderPosition"); + connect(horizontalScroller,SIGNAL(valueChanged (const QVariant &)),this,SIGNAL(backgroundChanges())); + groupScroller = new QParallelAnimationGroup(); + groupScroller->addAnimation(verticalScroller); + groupScroller->addAnimation(horizontalScroller); notificationsLabel = new NotificationsLabelWidget(this); notificationsLabel->hide(); @@ -136,6 +141,8 @@ Viewer::~Viewer() delete hideCursorTimer; delete informationLabel; delete verticalScroller; + delete horizontalScroller; + delete groupScroller; delete bd; delete notificationsLabel; delete mglass; @@ -301,8 +308,6 @@ void Viewer::updatePage() content->setPixmap(*currentPage); updateContentSize(); updateVerticalScrollBar(); - emit backgroundChanges(); - emit(pageAvailable(true)); if(goToFlow->isHidden()) setFocus(Qt::ShortcutFocusReason); @@ -312,6 +317,10 @@ void Viewer::updatePage() if(currentPage->isNull()) setPageUnavailableMessage(); + else + emit(pageAvailable(true)); + + emit backgroundChanges(); if(restoreMagnifyingGlass) { @@ -455,6 +464,142 @@ void Viewer::scrollUp() } } +void Viewer::scrollForwardHorizontalFirst() +{ + if (!doubleMangaPage) + { + scrollZigzag(RIGHT, DOWN, true); // right->right->lower left->right->...->next page + } + else + { + scrollZigzag(LEFT, DOWN, true); // left->left->lower right->left->...->next page + } +} + +void Viewer::scrollBackwardHorizontalFirst() +{ + if (!doubleMangaPage) + { + scrollZigzag(LEFT, UP, false); // left->left->upper right->left->...->prev page + } + else + { + scrollZigzag(RIGHT, UP, false); // right->right->upper left->right->...->prev page + } +} + +void Viewer::scrollForwardVerticalFirst() +{ + if (!doubleMangaPage) + { + scrollZigzag(DOWN, RIGHT, true); // down->down->upper right->down->...->next page + } + else + { + scrollZigzag(DOWN, LEFT, true); // down->down->upper left->down->...->next page + } +} + +void Viewer::scrollBackwardVerticalFirst() +{ + if (!doubleMangaPage) + { + scrollZigzag(UP, LEFT, false); // up->up->lower left->up->...->prev page + } + else + { + scrollZigzag(UP, RIGHT, false); // up->up->lower right->up->...->prev page + } +} + +bool Viewer::isEdge(scrollDirection d) +{ + if(d == UP) + return verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum(); + else if(d == DOWN) + return verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum(); + else if(d == LEFT) + return horizontalScrollBar()->sliderPosition() == horizontalScrollBar()->minimum(); + else // d == RIGHT + return horizontalScrollBar()->sliderPosition() == horizontalScrollBar()->maximum(); +} + +void Viewer::scrollZigzag(scrollDirection d1, scrollDirection d2, bool forward) +{ + if(!isEdge(d1)) + { + if(d1 == UP) + scrollTo(horizontalScrollBar()->sliderPosition(), + verticalScrollBar()->sliderPosition()-static_cast((height()*0.80))); + else if(d1 == DOWN) + scrollTo(horizontalScrollBar()->sliderPosition(), + verticalScrollBar()->sliderPosition()+static_cast((height()*0.80))); + else if(d1 == LEFT) + scrollTo(horizontalScrollBar()->sliderPosition()-static_cast((width()*0.80)), + verticalScrollBar()->sliderPosition()); + else // d1 == RIGHT + scrollTo(horizontalScrollBar()->sliderPosition()+static_cast((width()*0.80)), + verticalScrollBar()->sliderPosition()); + } + else if(!isEdge(d2)) + { + int x = 0; + int y = 0; + + if(d1 == UP) + y = verticalScrollBar()->maximum(); + else if(d1 == DOWN) + y = verticalScrollBar()->minimum(); + else if(d1 == LEFT) + x = horizontalScrollBar()->maximum(); + else // d1 == RIGHT + x = horizontalScrollBar()->minimum(); + + if(d2 == UP) + y = std::max(verticalScrollBar()->sliderPosition()-static_cast((height()*0.80)), verticalScrollBar()->minimum()); + else if(d2 == DOWN) + y = std::min(verticalScrollBar()->sliderPosition()+static_cast((height()*0.80)), verticalScrollBar()->maximum()); + else if(d2 == LEFT) + x = std::max(horizontalScrollBar()->sliderPosition()-static_cast((width()*0.80)), horizontalScrollBar()->minimum()); + else // d2 == RIGHT + x = std::min(horizontalScrollBar()->sliderPosition()+static_cast((width()*0.80)), horizontalScrollBar()->maximum()); + + scrollTo(x, y); + } + else + { + // next or prev page's corner + int savedPageNumber = getCurrentPageNumber(); + + if(forward) + next(); + else + prev(); + + if(savedPageNumber != getCurrentPageNumber()){ + if(d1 == LEFT || d2 == LEFT) + horizontalScrollBar()->setSliderPosition(horizontalScrollBar()->maximum()); + else + horizontalScrollBar()->setSliderPosition(horizontalScrollBar()->minimum()); + emit backgroundChanges(); + } + } +} + +void Viewer::scrollTo(int x, int y) +{ + if(groupScroller->state() == QAbstractAnimation::Running) + return; + horizontalScroller->setDuration(250); + horizontalScroller->setStartValue(horizontalScrollBar()->sliderPosition()); + horizontalScroller->setEndValue(x); + verticalScroller->setDuration(250); + verticalScroller->setStartValue(verticalScrollBar()->sliderPosition()); + verticalScroller->setEndValue(y); + groupScroller->start(); + emit backgroundChanges(); +} + void Viewer::keyPressEvent(QKeyEvent *event) { if(render->hasLoadedComic()) @@ -490,6 +635,26 @@ void Viewer::keyPressEvent(QKeyEvent *event) scrollUp(); } + else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y)) + { + scrollForwardHorizontalFirst(); + } + + else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y)) + { + scrollBackwardHorizontalFirst(); + } + + else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y)) + { + scrollForwardVerticalFirst(); + } + + else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y)) + { + scrollBackwardVerticalFirst(); + } + else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y) || key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_UP_ACTION_Y) || key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_LEFT_ACTION_Y) || @@ -602,27 +767,30 @@ void Viewer::mouseMoveEvent(QMouseEvent * event) mglass->move(static_cast(event->x()-float(mglass->width())/2),static_cast(event->y()-float(mglass->height())/2)); if(render->hasLoadedComic()) - { + { if(showGoToFlowAnimation->state()!=QPropertyAnimation::Running) { - if(goToFlow->isVisible()) - { - QPoint gtfPos = goToFlow->mapFrom(this,event->pos()); - if(gtfPos.y() < 0 || gtfPos.x()<0 || gtfPos.x()>goToFlow->width())//TODO this extra check is for Mavericks (mouseMove over goToFlowGL seems to be broken) - animateHideGoToFlow(); - //goToFlow->hide(); - } - else - { - int umbral = (width()-goToFlow->width())/2; - if((event->y()>height()-15)&&(event->x()>umbral)&&(event->x()isVisible()) + { + QPoint gtfPos = goToFlow->mapFrom(this,event->pos()); + if(gtfPos.y() < 0 || gtfPos.x()<0 || gtfPos.x()>goToFlow->width())//TODO this extra check is for Mavericks (mouseMove over goToFlowGL seems to be broken) + animateHideGoToFlow(); + //goToFlow->hide(); + } + else + { + int umbral = (width()-goToFlow->width())/2; + if((event->y()>height()-15)&&(event->x()>umbral)&&(event->x()stop(); - } - } - } + animateShowGoToFlow(); + hideCursorTimer->stop(); + } + } + } + } if(drag) { @@ -740,6 +908,11 @@ void Viewer::animateHideGoToFlow() void Viewer::moveCursoToGoToFlow() { + if(Configuration::getConfiguration().getDisableShowOnMouseOver()) + { + return; + } + //Move cursor to goToFlow widget on show (this avoid hide when mouse is moved) int y = goToFlow->pos().y(); int x1 = goToFlow->pos().x(); @@ -799,7 +972,10 @@ void Viewer::doubleMangaPageSwitch() { doubleMangaPage = !doubleMangaPage; render->doubleMangaPageSwitch(); - Configuration::getConfiguration().setDoubleMangaPage(doubleMangaPage); + Configuration &config = Configuration::getConfiguration(); + config.setDoubleMangaPage(doubleMangaPage); + goToFlow->setFlowRightToLeft(doubleMangaPage); + goToFlow->updateConfig(config.getSettings()); } void Viewer::resetContent() @@ -1011,7 +1187,14 @@ void Viewer::updateComic(ComicDB & comic) if(render->hasLoadedComic()) { //set currentPage - comic.info.currentPage = render->getIndex()+1; + if(render->currentPageIsDoublePage() == false) + { + comic.info.currentPage = render->getIndex()+1; + } + else + { + comic.info.currentPage = std::min(render->numPages(), render->getIndex()+2); + } //set bookmarks Bookmarks * boomarks = render->getBookmarks(); QList boomarksList = boomarks->getBookmarkPages(); diff --git a/YACReader/viewer.h b/YACReader/viewer.h index 7c3a1b67..e22bfb93 100644 --- a/YACReader/viewer.h +++ b/YACReader/viewer.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "scroll_management.h" @@ -55,6 +56,10 @@ class NotificationsLabelWidget; void updateOptions(); void scrollDown(); void scrollUp(); + void scrollForwardHorizontalFirst(); + void scrollBackwardHorizontalFirst(); + void scrollForwardVerticalFirst(); + void scrollBackwardVerticalFirst(); void magnifyingGlassSwitch(); void showMagnifyingGlass(); void hideMagnifyingGlass(); @@ -108,6 +113,8 @@ virtual void mouseReleaseEvent ( QMouseEvent * event ); PageLabelWidget * informationLabel; //QTimer * scroller; QPropertyAnimation * verticalScroller; + QPropertyAnimation * horizontalScroller; + QParallelAnimationGroup * groupScroller; int posByStep; int nextPos; GoToFlowWidget * goToFlow; @@ -153,6 +160,12 @@ virtual void mouseReleaseEvent ( QMouseEvent * event ); void wheelEvent(QWheelEvent * event); void mouseMoveEvent(QMouseEvent * event); + //!ZigzagScroll + enum scrollDirection{ UP, DOWN, LEFT, RIGHT }; + bool isEdge(scrollDirection d); + void scrollZigzag(scrollDirection d1, scrollDirection d2, bool forward); + void scrollTo(int x, int y); + public: Viewer(QWidget * parent = 0); ~Viewer(); diff --git a/YACReader/yacreader_de.ts b/YACReader/yacreader_de.ts index 65632c5d..21e18de9 100644 --- a/YACReader/yacreader_de.ts +++ b/YACReader/yacreader_de.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -51,12 +51,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -64,22 +64,22 @@ FileComic - + CRC error on page (%1): some of the pages will not be displayed correctly CRC Error auf Seite (%1): einige Seiten werden nicht korrekt dargestellt - + Unknown error opening the file Unbekannter Fehler beim öffnen des Files - + 7z not found 7z nicht gefunden - + Format not supported Format wird nicht unterstützt @@ -116,7 +116,7 @@ GoToFlowToolBar - + Page : Seite : @@ -137,7 +137,7 @@ MainWindowViewer - + &Open &Öffnen @@ -146,12 +146,12 @@ O - + Open a comic Comic öffnen - + Open Folder Ordner Öffnen @@ -160,83 +160,98 @@ Crtl+ O - + Open image folder Bilder Ordner öffnen - + + Open latest comic + + + + + Open the latest comic opened in the previous reading session + + + + + Clear open recent list + + + + Save Speichern - - + + Save current page Diese Seite speichern - + Previous Comic Voheriger Comic - + Open previous comic Vorherigen Comic öffnen - + Next Comic Nächster Comic - + Open next comic Nächsten Comic öffnen - + &Previous &Vorherige - + Go to previous page Zur vorherigen Seite gehen - + &Next &Nächste - + Go to next page Zur nächsten Seite gehen - + Fit Width Breite anpassen - + Fit image to height Bild auf Höhe anpassen - + Fit Height Höhe anpassen - + Fit image to width Bildbreite anpassen - + Rotate image to the left Bild nach links drehen @@ -245,7 +260,7 @@ L - + Rotate image to the right Bild nach rechts drehen @@ -254,12 +269,12 @@ R - + Double page mode Doppelseiten Modus - + Switch to double page mode Zum Doppelseiten Modus wechseln @@ -268,7 +283,7 @@ D - + Go To Gehe zu @@ -277,12 +292,12 @@ G - + Go to page ... Gehe nach Seite ... - + Options Optionen @@ -291,27 +306,28 @@ C - + YACReader options YACReader Optionen - + + Help Hilfe - + Help, About YACReader Hilfe, über YACReader - + Magnifying glass Vergößerungsglas - + Switch Magnifying glass Vergrößerungsglas wechseln @@ -320,22 +336,22 @@ Z - + Set bookmark Lesezeichen setzen - + Set a bookmark on the current page Lesezeichen auf dieser Seite setzen - + Show bookmarks Lesezeichen anzeigen - + Show the bookmarks of the current comic Lesezeichen für diesen Comic anzeigen @@ -344,12 +360,12 @@ M - + Show keyboard shortcuts Tastaturkürzel anzeigen - + Show Info Info anzeigen @@ -358,239 +374,275 @@ I - + Close Schliessen - + Show Dictionary Wörterbuch anzeigen - + Always on top Immer Oberste Ansicht - + Show full size Vollansicht anzeigen - + Clear - - Clear openrecent list - - - - + Fit to page - + Reset zoom - + Show zoom slider - + Zoom+ - + Zoom- - + Double page manga mode - + Reverse reading order in double page mode - + Show go to flow "Go to Flow" anzeigen - + Edit shortcuts - + &File &File - + + Open recent - + File File - - + + Edit + + + + + View + + + + + Go + + + + + Window + + + + + Open Comic Comic öffnen - - + + Comic files Comic Files - + Open folder Ordner öffnen - + Image files (*.jpg) Bilder Files (*.jpg) - + page_%1.jpg Seite_%1.jpg - + Comics - + Toggle fullscreen mode - + Hide/show toolbar - + General Allgemein - + Size up magnifying glass - + Size down magnifying glass - + Zoom in magnifying glass - + Zoom out magnifying glass - + Magnifiying glass - + Toggle between fit to width and fit to height - + Page adjustement - + Autoscroll down - + Autoscroll up - + + Autoscroll forward, horizontal first + + + + + Autoscroll backward, horizontal first + + + + + Autoscroll forward, vertical first + + + + + Autoscroll backward, vertical first + + + + Move down - + Move up - + Move left - + Move right - + Go to the first page - + Go to the last page - + Reading - + There is a new version available Neue Version verfügbar - + Do you want to download the new version? Möchten Sie die neue Version herunterladen? - + Remind me in 14 days In 14 Tagen erneut erinnern - + Not now Nicht jetzt @@ -622,57 +674,67 @@ Auswählen - + + Quick Navigation Mode + + + + + Disable mouse over activation + + + + Restart is needed Neustart erforderlich - + Brightness Helligkeit - + Contrast Kontrast - + Gamma Gamma - + Reset Zurücksetzen - + Image options Bilderoptionen - + General Allgemein - + Page Flow Page Flow - + Image adjustment Bildanpassung - + Options Optionen - + Comics directory Comics Verzeichnis @@ -711,48 +773,48 @@ Viewer - - + + Press 'O' to open comic. 'O' drücken um Comic zu öffnen. - + Not found Nicht gefunden - + Comic not found Comic nicht gefunden - + Error opening comic Fehler beim Öffnen des Comics - + CRC Error CRC Fehler - + Loading...please wait! Ladevorgang... Bitte warten! - + Page not available! Seite nicht verfügbar! - + Cover! Titelseite! - + Last page! Letzte Seite! diff --git a/YACReader/yacreader_es.qm b/YACReader/yacreader_es.qm deleted file mode 100644 index b2cee2ed..00000000 Binary files a/YACReader/yacreader_es.qm and /dev/null differ diff --git a/YACReader/yacreader_es.ts b/YACReader/yacreader_es.ts index 5a07285a..52c55f69 100644 --- a/YACReader/yacreader_es.ts +++ b/YACReader/yacreader_es.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -51,12 +51,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -64,22 +64,22 @@ FileComic - + Unknown error opening the file Error desconocido abriendo el archivo - + 7z not found 7z no encontrado - + Format not supported Formato no soportado - + CRC error on page (%1): some of the pages will not be displayed correctly Error CRC en la página (%1): algunas de las páginas no se mostrarán correctamente @@ -116,7 +116,7 @@ GoToFlowToolBar - + Page : Página : @@ -137,7 +137,7 @@ MainWindowViewer - + &Open &Abrir @@ -146,12 +146,12 @@ O - + Open a comic Abrir cómic - + Open Folder Abrir carpeta @@ -160,94 +160,89 @@ Ctrl+O - + Open image folder Open images in a folder Abrir carpeta de imágenes - + Clear - - Clear openrecent list - - - - + Save Guardar - - + + Save current page Guardar la página actual - + Previous Comic Cómic anterior - + Open previous comic Abrir cómic anterior - + Next Comic Siguiente Cómic - + Open next comic Abrir siguiente cómic - + &Previous A&nterior - + Go to previous page Ir a la página anterior - + &Next Siguie&nte - + Go to next page Ir a la página siguiente - + Fit Width Ajustar anchura - + Fit image to height Ajustar página a lo alto - + Fit Height Ajustar altura - + Fit image to width Ajustar página a lo ancho - + Rotate image to the left Rotar imagen a la izquierda @@ -256,7 +251,7 @@ L - + Rotate image to the right Rotar imagen a la derecha @@ -265,12 +260,12 @@ R - + Double page mode Modo a doble página - + Switch to double page mode Cambiar a modo de doble página @@ -279,7 +274,7 @@ D - + Go To Ir a @@ -288,12 +283,12 @@ G - + Go to page ... Ir a página... - + Options Opciones @@ -302,27 +297,28 @@ C - + YACReader options Opciones de YACReader - + + Help Ayuda - + Help, About YACReader Ayuda, Sobre YACReader - + Magnifying glass Lupa - + Switch Magnifying glass Lupa On/Off @@ -331,22 +327,22 @@ Z - + Set bookmark Añadir marcador - + Set a bookmark on the current page Añadir un marcador en la página actual - + Show bookmarks Mostrar marcadores - + Show the bookmarks of the current comic Mostrar los marcadores del cómic actual @@ -355,12 +351,12 @@ M - + Show keyboard shortcuts Mostrar atajos de teclado - + Show Info Mostrar información @@ -369,229 +365,285 @@ I - + Close Cerrar - + Show Dictionary Mostrar diccionario - + Always on top Siempre visible - + Show full size Mostrar a tamaño original - + + Open latest comic + + + + + Open the latest comic opened in the previous reading session + + + + + Clear open recent list + + + + Fit to page - + Reset zoom - + Show zoom slider - + Zoom+ - + Zoom- - + Double page manga mode - + Reverse reading order in double page mode - + Show go to flow Mostrar flow ir a - + Edit shortcuts - + &File &Archivo - + + Open recent - + File Archivo - - + + Edit + + + + + View + + + + + Go + + + + + Window + + + + + Open Comic Abrir cómic - - + + Comic files Archivos de cómic - + Comics - + Toggle fullscreen mode - + Hide/show toolbar - + General General - + Size up magnifying glass - + Size down magnifying glass - + Zoom in magnifying glass - + Zoom out magnifying glass - + Magnifiying glass - + Toggle between fit to width and fit to height - + Page adjustement - + Autoscroll down - + Autoscroll up - + + Autoscroll forward, horizontal first + + + + + Autoscroll backward, horizontal first + + + + + Autoscroll forward, vertical first + + + + + Autoscroll backward, vertical first + + + + Move down - + Move up - + Move left - + Move right - + Go to the first page - + Go to the last page - + Reading - + Remind me in 14 days Recordar en 14 días - + Not now Ahora no - + Open folder Abrir carpeta - + Image files (*.jpg) Archivos de imagen (*.jpg) - + page_%1.jpg página_%1.jpg - + There is a new version available Hay una nueva versión disponible - + Do you want to download the new version? ¿Desea descargar la nueva versión? @@ -623,57 +675,67 @@ Elegir - + + Quick Navigation Mode + + + + + Disable mouse over activation + + + + Restart is needed Es necesario reiniciar - + Brightness Brillo - + Contrast Contraste - + Gamma Gamma - + Reset Reset - + Image options Opciones de imagen - + General General - + Page Flow Page Flow - + Image adjustment Ajustes de imagen - + Options Opciones - + Comics directory Directorio de cómics @@ -712,48 +774,48 @@ Viewer - - + + Press 'O' to open comic. Pulsa 'O' para abrir un fichero. - + Not found No encontrado - + Comic not found Cómic no encontrado - + Error opening comic Error abriendo cómic - + CRC Error Error CRC - + Page not available! ¡Página no disponible! - + Cover! ¡Portada! - + Last page! ¡Última página! - + Loading...please wait! Cargando...espere, por favor! diff --git a/YACReader/yacreader_fr.ts b/YACReader/yacreader_fr.ts index 32f8d6f3..f93c4cc9 100644 --- a/YACReader/yacreader_fr.ts +++ b/YACReader/yacreader_fr.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -51,12 +51,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -64,22 +64,22 @@ FileComic - + Unknown error opening the file - + 7z not found 7z introuvable - + Format not supported - + CRC error on page (%1): some of the pages will not be displayed correctly @@ -116,7 +116,7 @@ GoToFlowToolBar - + Page : Page : @@ -137,7 +137,7 @@ MainWindowViewer - + &Open &Ouvrir @@ -146,12 +146,12 @@ O - + Open a comic Ouvrir un comic - + Open Folder Ouvrir un dossier @@ -160,83 +160,98 @@ Ctrl+O - + Open image folder Ouvrir un dossier d'images - + + Open latest comic + + + + + Open the latest comic opened in the previous reading session + + + + + Clear open recent list + + + + Save Sauvegarder - - + + Save current page Sauvegarder la page actuelle - + Previous Comic Comic précédent - + Open previous comic Ouvrir le comic précédent - + Next Comic Comic suivant - + Open next comic Ouvrir le livre suivant - + &Previous &Précédent - + Go to previous page Aller à la page précédente - + &Next &Suivant - + Go to next page Aller à la page suivante - + Fit Width Ajuster la largeur - + Fit image to height Ajuster l'image à la hauteur - + Fit Height - + Fit image to width Ajuster l'image à la largeur - + Rotate image to the left Rotation sur la gauche @@ -245,7 +260,7 @@ L - + Rotate image to the right Rotation sur la droite @@ -254,12 +269,12 @@ R - + Double page mode Mode double page - + Switch to double page mode Passer en mode double page @@ -268,7 +283,7 @@ D - + Go To Aller à @@ -277,12 +292,12 @@ G - + Go to page ... Aller à la page ... - + Options Options @@ -291,27 +306,28 @@ C - + YACReader options Options de YACReader - + + Help Aide - + Help, About YACReader Aide, à propos de YACReader - + Magnifying glass Loupe - + Switch Magnifying glass Utiliser la loupe @@ -320,22 +336,22 @@ Z - + Set bookmark Placer un marque-page - + Set a bookmark on the current page Placer un marque-page à la page actuelle - + Show bookmarks Voir les marque-pages - + Show the bookmarks of the current comic Voir les marque-pages de ce comic @@ -344,12 +360,12 @@ M - + Show keyboard shortcuts Voir les raccourcis - + Show Info Voir les infos @@ -358,239 +374,275 @@ I - + Close Fermer - + Show Dictionary Dictionnaire - + Always on top Toujours au dessus - + Show full size Plein écran - + Clear - - Clear openrecent list - - - - + Fit to page - + Reset zoom - + Show zoom slider - + Zoom+ - + Zoom- - + Double page manga mode - + Reverse reading order in double page mode - + Show go to flow Afficher le go to flow - + Edit shortcuts - + &File &Fichier - + + Open recent - + File - - + + Edit + + + + + View + + + + + Go + + + + + Window + + + + + Open Comic Ouvrir le comic - - + + Comic files Comic files - + Open folder Ouvirir le dossier - + Image files (*.jpg) Image files (*.jpg) - + page_%1.jpg page_%1.jpg - + Comics - + Toggle fullscreen mode - + Hide/show toolbar - + General Général - + Size up magnifying glass - + Size down magnifying glass - + Zoom in magnifying glass - + Zoom out magnifying glass - + Magnifiying glass - + Toggle between fit to width and fit to height - + Page adjustement - + Autoscroll down - + Autoscroll up - + + Autoscroll forward, horizontal first + + + + + Autoscroll backward, horizontal first + + + + + Autoscroll forward, vertical first + + + + + Autoscroll backward, vertical first + + + + Move down - + Move up - + Move left - + Move right - + Go to the first page - + Go to the last page - + Reading - + There is a new version available Une nouvelle version est disponible - + Do you want to download the new version? Voulez-vous télécharger la nouvelle version? - + Remind me in 14 days - + Not now @@ -622,57 +674,67 @@ Choisir - + + Quick Navigation Mode + + + + + Disable mouse over activation + + + + Restart is needed Redémarrage nécessaire - + Brightness Luminosité - + Contrast Contraste - + Gamma Gamma - + Reset Reset - + Image options Option de l'image - + General Général - + Page Flow Page Flow - + Image adjustment Ajustement de l'image - + Options Options - + Comics directory Répertoire des comics @@ -711,48 +773,48 @@ Viewer - - + + Press 'O' to open comic. Appuyez sur "O" pour ouvrir un comic. - + Not found Introuvable - + Comic not found Comic introuvable - + Error opening comic - + CRC Error - + Loading...please wait! Chargement...Patientez! - + Page not available! - + Cover! Couverture! - + Last page! Dernière page! diff --git a/YACReader/yacreader_nl.ts b/YACReader/yacreader_nl.ts index b3be4341..887a30d5 100644 --- a/YACReader/yacreader_nl.ts +++ b/YACReader/yacreader_nl.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -51,12 +51,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -64,22 +64,22 @@ FileComic - + Unknown error opening the file - + 7z not found 7Z Archiefbestand niet gevonden - + Format not supported - + CRC error on page (%1): some of the pages will not be displayed correctly @@ -116,7 +116,7 @@ GoToFlowToolBar - + Page : Pagina : @@ -137,7 +137,7 @@ MainWindowViewer - + &Open &Open @@ -146,12 +146,12 @@ O - + Open a comic Open een strip - + Open Folder Map Openen @@ -160,83 +160,98 @@ Ctrl+O - + Open image folder Open afbeeldings map - + + Open latest comic + + + + + Open the latest comic opened in the previous reading session + + + + + Clear open recent list + + + + Save Bewaar - - + + Save current page Bewaren huidige pagina - + Previous Comic Vorige Strip - + Open previous comic Open de vorige strip - + Next Comic Volgende Strip - + Open next comic Open volgende strip - + &Previous &Vorige - + Go to previous page Ga naar de vorige pagina - + &Next &Volgende - + Go to next page Ga naar de volgende pagina - + Fit Width Vensterbreedte aanpassen - + Fit image to height Afbeelding aanpassen aan hoogte - + Fit Height - + Fit image to width Afbeelding aanpassen aan breedte - + Rotate image to the left Links omdraaien @@ -245,7 +260,7 @@ L - + Rotate image to the right Rechts omdraaien @@ -254,12 +269,12 @@ R - + Double page mode Dubbele bladzijde modus - + Switch to double page mode Naar dubbele bladzijde modus @@ -268,7 +283,7 @@ D - + Go To Ga Naar @@ -277,12 +292,12 @@ G - + Go to page ... Ga naar bladzijde ... - + Options Opties @@ -291,27 +306,28 @@ C - + YACReader options YACReader opties - + + Help Help - + Help, About YACReader Help, Over YACReader - + Magnifying glass Vergrootglas - + Switch Magnifying glass Overschakelen naar Vergrootglas @@ -320,22 +336,22 @@ Z - + Set bookmark Bladwijzer instellen - + Set a bookmark on the current page Een bladwijzer toevoegen aan de huidige pagina - + Show bookmarks Bladwijzers weergeven - + Show the bookmarks of the current comic Toon de bladwijzers van de huidige strip @@ -344,12 +360,12 @@ M - + Show keyboard shortcuts Toon de sneltoetsen - + Show Info Info tonen @@ -358,239 +374,275 @@ I - + Close Sluiten - + Show Dictionary Woordenlijst weergeven - + Always on top Altijd op voorgrond - + Show full size Volledig Scherm - + Clear - - Clear openrecent list - - - - + Fit to page - + Reset zoom - + Show zoom slider - + Zoom+ - + Zoom- - + Double page manga mode - + Reverse reading order in double page mode - + Show go to flow Toon ga naar de Omslagbrowser - + Edit shortcuts - + &File &Bestand - + + Open recent - + File - - + + Edit + + + + + View + + + + + Go + + + + + Window + + + + + Open Comic Open een Strip - - + + Comic files Strip bestanden - + Open folder Open een Map - + Image files (*.jpg) Afbeelding bestanden (*.jpg) - + page_%1.jpg pagina_%1.jpg - + Comics - + Toggle fullscreen mode - + Hide/show toolbar - + General Algemeen - + Size up magnifying glass - + Size down magnifying glass - + Zoom in magnifying glass - + Zoom out magnifying glass - + Magnifiying glass - + Toggle between fit to width and fit to height - + Page adjustement - + Autoscroll down - + Autoscroll up - + + Autoscroll forward, horizontal first + + + + + Autoscroll backward, horizontal first + + + + + Autoscroll forward, vertical first + + + + + Autoscroll backward, vertical first + + + + Move down - + Move up - + Move left - + Move right - + Go to the first page - + Go to the last page - + Reading - + There is a new version available Er is een nieuwe versie beschikbaar - + Do you want to download the new version? Wilt u de nieuwe versie downloaden? - + Remind me in 14 days - + Not now @@ -622,57 +674,67 @@ Kies - + + Quick Navigation Mode + + + + + Disable mouse over activation + + + + Restart is needed Herstart is nodig - + Brightness Helderheid - + Contrast Contrast - + Gamma Gamma - + Reset Standaardwaarden terugzetten - + Image options Afbeelding opties - + General Algemeen - + Page Flow Omslagbrowser - + Image adjustment Beeldaanpassing - + Options Opties - + Comics directory Strips map @@ -711,48 +773,48 @@ Viewer - - + + Press 'O' to open comic. Druk 'O' om een strip te openen. - + Not found Niet gevonden - + Comic not found Strip niet gevonden - + Error opening comic - + CRC Error - + Loading...please wait! Inladen...even wachten! - + Page not available! - + Cover! Omslag! - + Last page! Laatste pagina! diff --git a/YACReader/yacreader_pt.ts b/YACReader/yacreader_pt.ts index a212d778..5ac31955 100644 --- a/YACReader/yacreader_pt.ts +++ b/YACReader/yacreader_pt.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -51,12 +51,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -64,22 +64,22 @@ FileComic - + Unknown error opening the file - + 7z not found 7z não encontrado - + Format not supported - + CRC error on page (%1): some of the pages will not be displayed correctly @@ -116,7 +116,7 @@ GoToFlowToolBar - + Page : Página : @@ -137,7 +137,7 @@ MainWindowViewer - + &Open &Abrir @@ -146,12 +146,12 @@ O - + Open a comic Abrir um quadrinho - + Open Folder Abrir Pasta @@ -160,93 +160,88 @@ Ctrl+O - + Open image folder - + Clear - - Clear openrecent list - - - - + Save Salvar - - + + Save current page Salvar página atual - + Previous Comic Quadrinho Anterior - + Open previous comic Abrir quadrinho anterior - + Next Comic Próximo Quadrinho - + Open next comic Abrir próximo quadrinho - + &Previous A&nterior - + Go to previous page Ir para a página anterior - + &Next &Próxima - + Go to next page Ir para a próxima página - + Fit Width Ajustar à Largura - + Fit image to height - + Fit Height - + Fit image to width - + Rotate image to the left Girar imagem à esquerda @@ -255,7 +250,7 @@ L - + Rotate image to the right Girar imagem à direita @@ -264,12 +259,12 @@ R - + Double page mode Modo dupla página - + Switch to double page mode Alternar para o modo dupla página @@ -278,7 +273,7 @@ D - + Go To Ir Para @@ -287,12 +282,12 @@ G - + Go to page ... Ir para a página... - + Options Opções @@ -301,27 +296,28 @@ C - + YACReader options Opções do YACReader - + + Help Ajuda - + Help, About YACReader Ajuda, Sobre o YACReader - + Magnifying glass Lupa - + Switch Magnifying glass Alternar Lupa @@ -330,22 +326,22 @@ Z - + Set bookmark Definir marcador - + Set a bookmark on the current page Definir um marcador na página atual - + Show bookmarks Mostrar marcadores - + Show the bookmarks of the current comic Mostrar os marcadores do quadrinho atual @@ -354,12 +350,12 @@ M - + Show keyboard shortcuts Mostrar teclas de atalhos - + Show Info Mostrar Informações @@ -368,229 +364,285 @@ I - + Close Fechar - + Show Dictionary - + Always on top - + Show full size - + + Open latest comic + + + + + Open the latest comic opened in the previous reading session + + + + + Clear open recent list + + + + Fit to page - + Reset zoom - + Show zoom slider - + Zoom+ - + Zoom- - + Double page manga mode - + Reverse reading order in double page mode - + Show go to flow - + Edit shortcuts - + &File &Arquivo - + + Open recent - + File - - + + Edit + + + + + View + + + + + Go + + + + + Window + + + + + Open Comic Abrir Quadrinho - - + + Comic files - + Comics - + Toggle fullscreen mode - + Hide/show toolbar - + General - + Size up magnifying glass - + Size down magnifying glass - + Zoom in magnifying glass - + Zoom out magnifying glass - + Magnifiying glass - + Toggle between fit to width and fit to height - + Page adjustement - + Autoscroll down - + Autoscroll up - + + Autoscroll forward, horizontal first + + + + + Autoscroll backward, horizontal first + + + + + Autoscroll forward, vertical first + + + + + Autoscroll backward, vertical first + + + + Move down - + Move up - + Move left - + Move right - + Go to the first page - + Go to the last page - + Reading - + Remind me in 14 days - + Not now - + Open folder Abrir pasta - + Image files (*.jpg) Arquivos de imagem (*.jpg) - + page_%1.jpg - + There is a new version available Há uma nova versão disponível - + Do you want to download the new version? Você deseja baixar a nova versão? @@ -622,57 +674,67 @@ - + + Quick Navigation Mode + + + + + Disable mouse over activation + + + + Restart is needed Reiniciar é necessário - + Brightness - + Contrast - + Gamma - + Reset - + Image options - + General - + Page Flow - + Image adjustment - + Options Opções - + Comics directory Diretório de quadrinhos @@ -711,48 +773,48 @@ Viewer - - + + Press 'O' to open comic. Pressione 'O' para abrir um quadrinho. - + Not found - + Comic not found - + Error opening comic - + CRC Error - + Loading...please wait! Carregando... por favor, aguarde! - + Page not available! - + Cover! - + Last page! diff --git a/YACReader/yacreader_ru.ts b/YACReader/yacreader_ru.ts index 2ab2f5e4..da19c9c7 100644 --- a/YACReader/yacreader_ru.ts +++ b/YACReader/yacreader_ru.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -38,50 +38,50 @@ Restore defaults - Вернуть начальные установки + To change a shortcut, double click in the key combination and type the new keys. - Чтобы изменить горячую клавишу, дважды щелкните и введите новые клавиши. + Shortcuts settings - Настройки горячих клавиш + - + Shortcut in use - Горячая клавиша используется + - + The shortcut "%1" is already assigned to other function - Гарячая клавиша "%1" уже назначена для другой функции + FileComic - + Unknown error opening the file - Неизвестная ошибка при открытии файла + - + 7z not found - Распаковщик 7z не найден + 7z не найден - + Format not supported - Формат не поддерживается + - + CRC error on page (%1): some of the pages will not be displayed correctly - Ошибка CRC на странице (%1): некоторые страницы будут отображаться неправильно + @@ -116,7 +116,7 @@ GoToFlowToolBar - + Page : Страница : @@ -137,7 +137,7 @@ MainWindowViewer - + &Open &Открыть @@ -146,12 +146,12 @@ О - + Open a comic Открыть комикс - + Open Folder Открыть папку @@ -160,83 +160,98 @@ Ctrl+О - + Open image folder Открыть папку с изображениями - + + Open latest comic + + + + + Open the latest comic opened in the previous reading session + + + + + Clear open recent list + + + + Save Сохранить - - + + Save current page Сохранить текущию страницу - + Previous Comic Предыдущий комикс - + Open previous comic Открыть предыдуший комикс - + Next Comic Следующий комикс - + Open next comic Открыть следующий комикс - + &Previous &Предыдущий - + Go to previous page Перейти к предыдущей странице - + &Next &Следующий - + Go to next page Перейти к следующей странице - + Fit Width Подогнать ширину - + Fit image to height - Подогнать изображение по высоте + - + Fit Height - Подогнать по высоте + - + Fit image to width - Подгнать изображение по ширине + - + Rotate image to the left Повернуть изображение против часовой стрелки @@ -245,7 +260,7 @@ L - + Rotate image to the right Повернуть изображение по часовой стрелке @@ -254,21 +269,21 @@ R - + Double page mode - Режим разворота + Двойной режим страницы - + Switch to double page mode - Переключить на режим разворота + Переключить на двойной режим страницы D D - + Go To Перейти к @@ -277,12 +292,12 @@ G - + Go to page ... Перейти к странице ... - + Options Настройки @@ -291,27 +306,28 @@ С - + YACReader options Настройки YACReader - + + Help Справка - + Help, About YACReader Справка по YACReader - + Magnifying glass Увеличительное стекло - + Switch Magnifying glass Переключиться на увеличительное стекло @@ -320,22 +336,22 @@ Z - + Set bookmark Установить закладку - + Set a bookmark on the current page Установить закладку на текущей странице - + Show bookmarks Показать закладки - + Show the bookmarks of the current comic Показать закладки в текущем комиксе @@ -344,12 +360,12 @@ M - + Show keyboard shortcuts Показать горячие клавиши - + Show Info Информацию @@ -358,241 +374,277 @@ I - + Close Закрыть - + Show Dictionary Словарь - + Always on top Всегда сверху - + Show full size Полноэкранный режим - + Clear - Очистить + - - Clear openrecent list - Очистить список недавно открытых - - - + Fit to page - По размеру страницы + - + Reset zoom - Сбросить масштаб + - + Show zoom slider - Показать ползунок масштабирования + - + Zoom+ - Масштаб + + - + Zoom- - Масштаб - + - + Double page manga mode - Режим разворота + - + Reverse reading order in double page mode - Обратный порядок чтения в режиме разворота + - + Show go to flow - + Edit shortcuts Редактировать горячие клавиши - + &File &Файл - + + Open recent - Открыть недавний + - + File - Файл + - - + + Edit + + + + + View + + + + + Go + + + + + Window + + + + + Open Comic Открыть комикс - - + + Comic files Файлы комикса - + Open folder Открыть папку - + Image files (*.jpg) - Файлы изображений (*.jpg) + Файлы изображений - + page_%1.jpg - Страница_%1.jpg + - + Comics - Комикс + - + Toggle fullscreen mode - Переключение полноэкранного режима + - + Hide/show toolbar - Скрыть/показать панель инструментов + - + General - Общее + Общее - + Size up magnifying glass - + Size down magnifying glass - + Zoom in magnifying glass - + Zoom out magnifying glass - + Magnifiying glass - Увеличительное стекло + - + Toggle between fit to width and fit to height - Переключение между по ширине и по высоте + - + Page adjustement - Настройка страницы + - + Autoscroll down - Автопрокрутка вниз + - + Autoscroll up - Автопрокрутка вверх + - + + Autoscroll forward, horizontal first + + + + + Autoscroll backward, horizontal first + + + + + Autoscroll forward, vertical first + + + + + Autoscroll backward, vertical first + + + + Move down - Двигать вниз + - + Move up - Двигать вверх + - + Move left - Двигать влево + - + Move right - Двигать вправо + - + Go to the first page - Перейти на первую страницу + - + Go to the last page - Перейти на последнюю страницу + - + Reading - Чтение + - + There is a new version available - Доступна новая версия + Доступно новое обновление - + Do you want to download the new version? - Хотите загрузить новую версию? + Хотите загрузить новую версию ? - + Remind me in 14 days - Напомните мне через две недели + - + Not now - Не сейчас + @@ -622,57 +674,67 @@ Выбрать - + + Quick Navigation Mode + + + + + Disable mouse over activation + + + + Restart is needed Необходима перезагрузка - + Brightness Яркость - + Contrast Контраст - + Gamma Гамма - + Reset Перезапуск - + Image options Настройки изображения - + General Общее - + Page Flow Страница потока - + Image adjustment Регулировки изображения - + Options Настройки - + Comics directory Каталог комиксов @@ -711,50 +773,50 @@ Viewer - - + + Press 'O' to open comic. Нажмите "O" , чтобы открыть комикс. - + Not found Не найдено - + Comic not found Комикс не найден - + Error opening comic - Ошибка открытия комикса + - + CRC Error - Ошибка CRC (контрольной суммы) + - + Loading...please wait! Загрузка ... Пожалуйста подождите! - + Page not available! - Страница недоступна! + - + Cover! - Обложка! + - + Last page! - Последняя страница! + diff --git a/YACReader/yacreader_source.ts b/YACReader/yacreader_source.ts index f9a593f4..f44ae9d4 100644 --- a/YACReader/yacreader_source.ts +++ b/YACReader/yacreader_source.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -51,12 +51,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -64,22 +64,22 @@ FileComic - + CRC error on page (%1): some of the pages will not be displayed correctly - + Unknown error opening the file - + 7z not found - + Format not supported @@ -116,7 +116,7 @@ GoToFlowToolBar - + Page : @@ -137,420 +137,472 @@ MainWindowViewer - + &Open - + Open a comic - + Open Folder - + Open image folder - + Save - - + + Save current page - + Previous Comic - + Open previous comic - + Next Comic - + Open next comic - + &Previous - + Go to previous page - + &Next - + Go to next page - + Fit Width - + Fit image to height - + + Open latest comic + + + + + Open the latest comic opened in the previous reading session + + + + + Clear open recent list + + + + Fit Height - + Fit image to width - + Rotate image to the left - + Rotate image to the right - + Double page mode - + Switch to double page mode - + Go To - + Go to page ... - + Options - + YACReader options - + + Help - + Help, About YACReader - + Magnifying glass - + Switch Magnifying glass - + Set bookmark - + Set a bookmark on the current page - + Show bookmarks - + Show the bookmarks of the current comic - + Show keyboard shortcuts - + Show Info - + Close - + Show Dictionary - + Always on top - + Show full size - + Clear - - Clear openrecent list - - - - + Fit to page - + Reset zoom - + Show zoom slider - + Zoom+ - + Zoom- - + Double page manga mode - + Reverse reading order in double page mode - + Show go to flow - + Edit shortcuts - + &File - + + Open recent - + File - - + + Edit + + + + + View + + + + + Go + + + + + Window + + + + + Open Comic - - + + Comic files - + Open folder - + Image files (*.jpg) - + page_%1.jpg - + Comics - + Toggle fullscreen mode - + Hide/show toolbar - + General - + Size up magnifying glass - + Size down magnifying glass - + Zoom in magnifying glass - + Zoom out magnifying glass - + Magnifiying glass - + Toggle between fit to width and fit to height - + Page adjustement - + Autoscroll down - + Autoscroll up - + + Autoscroll forward, horizontal first + + + + + Autoscroll backward, horizontal first + + + + + Autoscroll forward, vertical first + + + + + Autoscroll backward, vertical first + + + + Move down - + Move up - + Move left - + Move right - + Go to the first page - + Go to the last page - + Reading - + There is a new version available - + Do you want to download the new version? - + Remind me in 14 days - + Not now @@ -578,57 +630,67 @@ - + + Quick Navigation Mode + + + + + Disable mouse over activation + + + + Restart is needed - + Brightness - + Contrast - + Gamma - + Reset - + Image options - + General - + Page Flow - + Image adjustment - + Options - + Comics directory @@ -667,48 +729,48 @@ Viewer - - + + Press 'O' to open comic. - + Not found - + Comic not found - + Error opening comic - + CRC Error - + Loading...please wait! - + Page not available! - + Cover! - + Last page! diff --git a/YACReader/yacreader_tr.ts b/YACReader/yacreader_tr.ts index 1aa7643e..9d4d6e75 100644 --- a/YACReader/yacreader_tr.ts +++ b/YACReader/yacreader_tr.ts @@ -427,10 +427,6 @@ Clear - - Clear openrecent list - - Fit to page @@ -547,6 +543,50 @@ Reading + + Open latest comic + + + + Open the latest comic opened in the previous reading session + + + + Clear open recent list + + + + Edit + + + + View + + + + Go + + + + Window + + + + Autoscroll forward, horizontal first + + + + Autoscroll backward, horizontal first + + + + Autoscroll forward, vertical first + + + + Autoscroll backward, vertical first + + OptionsDialog @@ -614,6 +654,14 @@ Restart is needed Yeniden başlatılmalı + + Quick Navigation Mode + + + + Disable mouse over activation + + QObject diff --git a/YACReaderLibrary.desktop b/YACReaderLibrary.desktop index 75f7a4a3..0bdf35d4 100644 --- a/YACReaderLibrary.desktop +++ b/YACReaderLibrary.desktop @@ -3,7 +3,7 @@ Name=YACReader Library GenericName=Yet Another Comic Reader - Library Comment=A comic library management application with server mode. Exec=YACReaderLibrary %f -Icon=/usr/share/yacreader/iconLibrary.png +Icon=YACReaderLibrary Terminal=false Type=Application StartupNotify=true diff --git a/YACReaderLibrary.svg b/YACReaderLibrary.svg new file mode 100644 index 00000000..dbbea025 --- /dev/null +++ b/YACReaderLibrary.svg @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 53db0a03..88a2c851 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -1,332 +1,325 @@ -###################################################################### -# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008 -###################################################################### - -TEMPLATE = app -TARGET = YACReaderLibrary -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += ../common \ - ./server \ - ./db \ - ../custom_widgets \ - ./comic_vine \ - ./comic_vine/model - -DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY -QMAKE_MAC_SDK = macosx10.11 -#load default build flags -include (../config.pri) - -CONFIG(legacy_gl_widget) { - INCLUDEPATH += ../common/gl_legacy \ -} else { - INCLUDEPATH += ../common/gl \ -} - -#there are going to be two builds for windows, OpenGL based and ANGLE based -win32 { - CONFIG(force_angle) { - message("using ANGLE") - LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32 - #linking extra libs are necesary for a successful compilation, a better approach should be - #to remove any OpenGL (desktop) dependencies - #the OpenGL stuff should be migrated to OpenGL ES - DEFINES += FORCE_ANGLE - } else { - LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32 - } - - LIBS += -lpoppler-qt5 - INCLUDEPATH += ../dependencies/poppler/include/qt5 - - QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL - QMAKE_LFLAGS_RELEASE += /LTCG - CONFIG -= embed_manifest_exe -} - -unix:!macx{ - -INCLUDEPATH += /usr/include/poppler/qt5 -LIBS += -L/usr/lib -lpoppler-qt5 - -!CONFIG(no_opengl) { - LIBS += -lGLU - } -} - -macx{ -#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" -#isEqual(QT_MAJOR_VERSION, 5) { -#INCLUDEPATH += /usr/local/include/poppler/qt5 -#LIBS += -L/usr/local/lib -lpoppler-qt5 -#} -#else { -#INCLUDEPATH += /usr/local/include/poppler/qt4 -#LIBS += -L/usr/local/lib -lpoppler-qt4 -#} -#QT += macextras - -LIBS += -framework Foundation -framework ApplicationServices -framework AppKit - -OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm -HEADERS += $$PWD/../common/pdf_comic.h -CONFIG += objective_c -QT += macextras gui-private -} - -unix{ -CONFIG += c++11 -} - -#CONFIG += release -CONFIG -= flat -QT += sql network widgets script -!CONFIG(no_opengl) { - QT += opengl -} - -# Input -HEADERS += comic_flow.h \ - create_library_dialog.h \ - library_creator.h \ - library_window.h \ - add_library_dialog.h \ - rename_library_dialog.h \ - properties_dialog.h \ - options_dialog.h \ - export_library_dialog.h \ - import_library_dialog.h \ - package_manager.h \ - bundle_creator.h \ - export_comics_info_dialog.h \ - import_comics_info_dialog.h \ - server_config_dialog.h \ - comic_flow_widget.h \ - db_helper.h \ - ./db/data_base_management.h \ - ./db/folder_item.h \ - ./db/folder_model.h \ - ./db/comic_model.h \ - ./db/comic_item.h \ - ../common/comic_db.h \ - ../common/folder.h \ - ../common/library_item.h \ - ../common/comic.h \ - ../common/bookmarks.h \ - ../common/pictureflow.h \ - ../common/custom_widgets.h \ - ../common/qnaturalsorting.h \ - ../common/yacreader_global.h \ - ../common/yacreader_global_gui.h \ - ../common/onstart_flow_selection_dialog.h \ - no_libraries_widget.h \ - import_widget.h \ - yacreader_local_server.h \ - yacreader_main_toolbar.h \ - comics_remover.h \ - ../common/http_worker.h \ - yacreader_libraries.h \ - ../common/exit_check.h \ - comics_view.h \ - classic_comics_view.h \ - empty_folder_widget.h \ - no_search_results_widget.h \ - comic_files_manager.h \ - db/reading_list_model.h \ - db/reading_list_item.h \ - yacreader_folders_view.h \ - yacreader_reading_lists_view.h \ - add_label_dialog.h \ - yacreader_history_controller.h \ - yacreader_navigation_controller.h \ - empty_label_widget.h \ - empty_container_info.h \ - empty_special_list.h \ - empty_reading_list_widget.h \ - ../common/scroll_management.h \ - ../common/opengl_checker.h \ - yacreader_comics_views_manager.h \ - info_comics_view.h \ - yacreader_comics_selection_helper.h \ - yacreader_comic_info_helper.h - -!CONFIG(no_opengl) { - CONFIG(legacy_gl_widget) { - message("using legacy YACReaderFlowGL (QGLWidget) header") - HEADERS += ../common/gl_legacy/yacreader_flow_gl.h - } else { - HEADERS += ../common/gl/yacreader_flow_gl.h - } -} - -SOURCES += comic_flow.cpp \ - create_library_dialog.cpp \ - library_creator.cpp \ - library_window.cpp \ - main.cpp \ - add_library_dialog.cpp \ - rename_library_dialog.cpp \ - properties_dialog.cpp \ - options_dialog.cpp \ - export_library_dialog.cpp \ - import_library_dialog.cpp \ - package_manager.cpp \ - bundle_creator.cpp \ - export_comics_info_dialog.cpp \ - import_comics_info_dialog.cpp \ - server_config_dialog.cpp \ - comic_flow_widget.cpp \ - db_helper.cpp \ - ./db/data_base_management.cpp \ - ./db/folder_item.cpp \ - ./db/folder_model.cpp \ - ./db/comic_model.cpp \ - ./db/comic_item.cpp \ - ../common/comic_db.cpp \ - ../common/folder.cpp \ - ../common/library_item.cpp \ - ../common/comic.cpp \ - ../common/bookmarks.cpp \ - ../common/pictureflow.cpp \ - ../common/custom_widgets.cpp \ - ../common/qnaturalsorting.cpp \ - ../common/onstart_flow_selection_dialog.cpp \ - no_libraries_widget.cpp \ - import_widget.cpp \ - yacreader_local_server.cpp \ - yacreader_main_toolbar.cpp \ - comics_remover.cpp \ - ../common/http_worker.cpp \ - ../common/yacreader_global.cpp \ - ../common/yacreader_global_gui.cpp \ - yacreader_libraries.cpp \ - ../common/exit_check.cpp \ - comics_view.cpp \ - classic_comics_view.cpp \ - empty_folder_widget.cpp \ - no_search_results_widget.cpp \ - comic_files_manager.cpp \ - db/reading_list_model.cpp \ - db/reading_list_item.cpp \ - yacreader_folders_view.cpp \ - yacreader_reading_lists_view.cpp \ - add_label_dialog.cpp \ - yacreader_history_controller.cpp \ - yacreader_navigation_controller.cpp \ - empty_label_widget.cpp \ - empty_container_info.cpp \ - empty_special_list.cpp \ - empty_reading_list_widget.cpp \ - ../common/scroll_management.cpp \ - ../common/opengl_checker.cpp \ - yacreader_comics_views_manager.cpp \ - info_comics_view.cpp \ - yacreader_comics_selection_helper.cpp \ - yacreader_comic_info_helper.cpp - -!CONFIG(no_opengl) { - CONFIG(legacy_gl_widget) { - message("using legacy YACReaderFlowGL (QGLWidget) source code") - SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp - } else { - SOURCES += ../common/gl/yacreader_flow_gl.cpp - } -} - - -include(./server/server.pri) -include(../custom_widgets/custom_widgets_yacreaderlibrary.pri) -CONFIG(7zip){ -include(../compressed_archive/wrapper.pri) -} else:CONFIG(unarr) { -include(../compressed_archive/unarr/unarr-wrapper.pri) -} else { - error(No compression backend specified. Did you mess with the build system?) -} - -include(./comic_vine/comic_vine.pri) -include(../QsLog/QsLog.pri) -include(../shortcuts_management/shortcuts_management.pri) - -RESOURCES += images.qrc files.qrc -win32:RESOURCES += images_win.qrc -unix:!macx:RESOURCES += images_win.qrc -macx:RESOURCES += images_osx.qrc - -RC_FILE = icon.rc - -macx { - ICON = YACReaderLibrary.icns -} - -TRANSLATIONS = yacreaderlibrary_es.ts \ - yacreaderlibrary_ru.ts \ - yacreaderlibrary_pt.ts \ - yacreaderlibrary_fr.ts \ - yacreaderlibrary_nl.ts \ - yacreaderlibrary_tr.ts \ - yacreaderlibrary_de.ts \ - yacreaderlibrary_source.ts - -CONFIG(force_angle) { - Release:DESTDIR = ../release_angle - Debug:DESTDIR = ../debug_angle -} else { - Release:DESTDIR = ../release - Debug:DESTDIR = ../debug -} - -#QML/GridView -QT += quick qml - -HEADERS += grid_comics_view.h \ - comics_view_transition.h - -SOURCES += grid_comics_view.cpp \ - comics_view_transition.cpp - -RESOURCES += qml.qrc -win32:RESOURCES += qml_win.qrc -unix:!macx:RESOURCES += qml_win.qrc -macx:RESOURCES += qml_osx.qrc - -unix:!macx { -#set install prefix if it's empty -isEmpty(PREFIX) { - PREFIX = /usr -} - -BINDIR = $$PREFIX/bin -LIBDIR = $$PREFIX/lib -DATADIR = $$PREFIX/share - -DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" - -#MAKE INSTALL -INSTALLS += bin icon desktop server translation manpage - -bin.path = $$BINDIR -isEmpty(DESTDIR) { - bin.files = YACReaderLibrary -} else { - bin.files = $$DESTDIR/YACReaderLibrary -} - -server.path = $$DATADIR/yacreader -server.files = ../release/server - -icon.path = $$DATADIR/yacreader -icon.files = ../images/iconLibrary.png ../images/db.png ../images/coversPackage.png - -desktop.path = $$DATADIR/applications -desktop.extra = desktop-file-edit --set-icon=$$DATADIR/yacreader/iconLibrary.png $$PWD/../YACReaderLibrary.desktop -desktop.files = ../YACReaderLibrary.desktop -#TODO: icons should be located at /usr/share/icons and have the same basename as their application - -translation.path = $$DATADIR/yacreader/languages -translation.files = ../release/languages/yacreaderlibrary_* - -manpage.path = $$DATADIR/man/man1 -manpage.files = ../YACReaderLibrary.1 -} +TEMPLATE = app +TARGET = YACReaderLibrary + +QMAKE_TARGET_BUNDLE_PREFIX = "com.yacreader" + +DEPENDPATH += . +INCLUDEPATH += . \ + ../common \ + ./server \ + ./db \ + ../custom_widgets \ + ./comic_vine \ + ./comic_vine/model + +DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY +QMAKE_MAC_SDK = macosx10.12 + +# load default build flags +include (../config.pri) +include (../dependencies/pdf_backend.pri) + +unix:haiku { + DEFINES += _BSD_SOURCE + LIBS += -lnetwork -lbsd +} + +CONFIG(legacy_gl_widget) { + INCLUDEPATH += ../common/gl_legacy \ +} else { + INCLUDEPATH += ../common/gl \ +} + +# there are two builds for Windows, Desktop OpenGL based and ANGLE OpenGL ES based +win32 { + CONFIG(force_angle) { + message("using ANGLE") + LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32 + # linking extra libs are necesary for a successful compilation, a better approach should be + # to remove any OpenGL (desktop) dependencies + # the OpenGL stuff should be migrated to OpenGL ES + DEFINES += FORCE_ANGLE + } else { + LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32 + } + + QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL + QMAKE_LFLAGS_RELEASE += /LTCG + CONFIG -= embed_manifest_exe +} + +CONFIG(force_angle) { + contains(QMAKE_TARGET.arch, x86_64) { + Release:DESTDIR = ../release64_angle + Debug:DESTDIR = ../debug64_angle + } else { + Release:DESTDIR = ../release_angle + Debug:DESTDIR = ../debug_angle + } +} else { + contains(QMAKE_TARGET.arch, x86_64) { + Release:DESTDIR = ../release64 + Debug:DESTDIR = ../debug64 + } else { + Release:DESTDIR = ../release + Debug:DESTDIR = ../debug + } +} + +unix:!macx:!CONFIG(no_opengl) { + LIBS += -lGLU +} + +macx { + LIBS += -framework Foundation -framework ApplicationServices -framework AppKit + CONFIG += objective_c + QT += macextras gui-private +} + +unix:!macx { + CONFIG += c++11 +} + +#CONFIG += release +CONFIG -= flat +QT += sql network widgets script +!CONFIG(no_opengl) { + QT += opengl +} + +# Input +HEADERS += comic_flow.h \ + create_library_dialog.h \ + library_creator.h \ + library_window.h \ + add_library_dialog.h \ + rename_library_dialog.h \ + properties_dialog.h \ + options_dialog.h \ + export_library_dialog.h \ + import_library_dialog.h \ + package_manager.h \ + bundle_creator.h \ + export_comics_info_dialog.h \ + import_comics_info_dialog.h \ + server_config_dialog.h \ + comic_flow_widget.h \ + db_helper.h \ + ./db/data_base_management.h \ + ./db/folder_item.h \ + ./db/folder_model.h \ + ./db/comic_model.h \ + ./db/comic_item.h \ + ../common/comic_db.h \ + ../common/folder.h \ + ../common/library_item.h \ + ../common/comic.h \ + ../common/bookmarks.h \ + ../common/pictureflow.h \ + ../common/custom_widgets.h \ + ../common/qnaturalsorting.h \ + ../common/yacreader_global.h \ + ../common/yacreader_global_gui.h \ + ../common/onstart_flow_selection_dialog.h \ + ../common/pdf_comic.h \ + no_libraries_widget.h \ + import_widget.h \ + yacreader_local_server.h \ + yacreader_main_toolbar.h \ + comics_remover.h \ + ../common/http_worker.h \ + yacreader_libraries.h \ + ../common/exit_check.h \ + comics_view.h \ + classic_comics_view.h \ + empty_folder_widget.h \ + no_search_results_widget.h \ + comic_files_manager.h \ + db/reading_list_model.h \ + db/reading_list_item.h \ + yacreader_folders_view.h \ + yacreader_reading_lists_view.h \ + add_label_dialog.h \ + yacreader_history_controller.h \ + yacreader_navigation_controller.h \ + empty_label_widget.h \ + empty_container_info.h \ + empty_special_list.h \ + empty_reading_list_widget.h \ + ../common/scroll_management.h \ + ../common/opengl_checker.h \ + yacreader_comics_views_manager.h \ + info_comics_view.h \ + yacreader_comics_selection_helper.h \ + yacreader_comic_info_helper.h + +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) header") + HEADERS += ../common/gl_legacy/yacreader_flow_gl.h + } else { + HEADERS += ../common/gl/yacreader_flow_gl.h + } +} + +SOURCES += comic_flow.cpp \ + create_library_dialog.cpp \ + library_creator.cpp \ + library_window.cpp \ + main.cpp \ + add_library_dialog.cpp \ + rename_library_dialog.cpp \ + properties_dialog.cpp \ + options_dialog.cpp \ + export_library_dialog.cpp \ + import_library_dialog.cpp \ + package_manager.cpp \ + bundle_creator.cpp \ + export_comics_info_dialog.cpp \ + import_comics_info_dialog.cpp \ + server_config_dialog.cpp \ + comic_flow_widget.cpp \ + db_helper.cpp \ + ./db/data_base_management.cpp \ + ./db/folder_item.cpp \ + ./db/folder_model.cpp \ + ./db/comic_model.cpp \ + ./db/comic_item.cpp \ + ../common/comic_db.cpp \ + ../common/folder.cpp \ + ../common/library_item.cpp \ + ../common/comic.cpp \ + ../common/bookmarks.cpp \ + ../common/pictureflow.cpp \ + ../common/custom_widgets.cpp \ + ../common/qnaturalsorting.cpp \ + ../common/onstart_flow_selection_dialog.cpp \ + no_libraries_widget.cpp \ + import_widget.cpp \ + yacreader_local_server.cpp \ + yacreader_main_toolbar.cpp \ + comics_remover.cpp \ + ../common/http_worker.cpp \ + ../common/yacreader_global.cpp \ + ../common/yacreader_global_gui.cpp \ + yacreader_libraries.cpp \ + ../common/exit_check.cpp \ + comics_view.cpp \ + classic_comics_view.cpp \ + empty_folder_widget.cpp \ + no_search_results_widget.cpp \ + comic_files_manager.cpp \ + db/reading_list_model.cpp \ + db/reading_list_item.cpp \ + yacreader_folders_view.cpp \ + yacreader_reading_lists_view.cpp \ + add_label_dialog.cpp \ + yacreader_history_controller.cpp \ + yacreader_navigation_controller.cpp \ + empty_label_widget.cpp \ + empty_container_info.cpp \ + empty_special_list.cpp \ + empty_reading_list_widget.cpp \ + ../common/scroll_management.cpp \ + ../common/opengl_checker.cpp \ + yacreader_comics_views_manager.cpp \ + info_comics_view.cpp \ + yacreader_comics_selection_helper.cpp \ + yacreader_comic_info_helper.cpp + +!CONFIG(no_opengl) { + CONFIG(legacy_gl_widget) { + message("using legacy YACReaderFlowGL (QGLWidget) source code") + SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp + } else { + SOURCES += ../common/gl/yacreader_flow_gl.cpp + } +} + + +include(./server/server.pri) +include(../custom_widgets/custom_widgets_yacreaderlibrary.pri) + +CONFIG(7zip){ +include(../compressed_archive/wrapper.pri) +} else:CONFIG(unarr) { +include(../compressed_archive/unarr/unarr-wrapper.pri) +} else { + error(No compression backend specified. Did you mess with the build system?) +} + +include(./comic_vine/comic_vine.pri) +include(../QsLog/QsLog.pri) +include(../shortcuts_management/shortcuts_management.pri) + +RESOURCES += images.qrc files.qrc +win32:RESOURCES += images_win.qrc +unix:!macx:RESOURCES += images_win.qrc +macx:RESOURCES += images_osx.qrc + +RC_FILE = icon.rc + +macx { + ICON = YACReaderLibrary.icns +} + +TRANSLATIONS = yacreaderlibrary_es.ts \ + yacreaderlibrary_ru.ts \ + yacreaderlibrary_pt.ts \ + yacreaderlibrary_fr.ts \ + yacreaderlibrary_nl.ts \ + yacreaderlibrary_tr.ts \ + yacreaderlibrary_de.ts \ + yacreaderlibrary_source.ts + +#QML/GridView +QT += quick qml + +HEADERS += grid_comics_view.h \ + comics_view_transition.h + +SOURCES += grid_comics_view.cpp \ + comics_view_transition.cpp + +RESOURCES += qml.qrc +win32:RESOURCES += qml_win.qrc +unix:!macx:RESOURCES += qml_win.qrc +macx:RESOURCES += qml_osx.qrc + +unix:!macx { +#set install prefix if it's empty +isEmpty(PREFIX) { + PREFIX = /usr +} + +BINDIR = $$PREFIX/bin +LIBDIR = $$PREFIX/lib +DATADIR = $$PREFIX/share + +DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" + +#MAKE INSTALL +INSTALLS += bin icon desktop server translation manpage + +bin.path = $$BINDIR +isEmpty(DESTDIR) { + bin.files = YACReaderLibrary +} else { + bin.files = $$DESTDIR/YACReaderLibrary +} + +server.path = $$DATADIR/yacreader +server.files = ../release/server + +icon.path = $$DATADIR/icons/hicolor/scalable/apps +icon.files = ../YACReaderLibrary.svg + +desktop.path = $$DATADIR/applications +desktop.files = ../YACReaderLibrary.desktop + +translation.path = $$DATADIR/yacreader/languages +translation.files = ../release/languages/yacreaderlibrary_* + +manpage.path = $$DATADIR/man/man1 +manpage.files = ../YACReaderLibrary.1 +} diff --git a/YACReaderLibrary/comic_vine/comic_vine.pri b/YACReaderLibrary/comic_vine/comic_vine.pri index c76c0acc..c7977e66 100644 --- a/YACReaderLibrary/comic_vine/comic_vine.pri +++ b/YACReaderLibrary/comic_vine/comic_vine.pri @@ -20,7 +20,8 @@ HEADERS += \ comic_vine/scraper_scroll_label.h \ comic_vine/scraper_results_paginator.h \ comic_vine/scraper_selector.h \ - comic_vine/api_key_dialog.h + comic_vine/api_key_dialog.h \ + $$PWD/comic_vine_all_volume_comics_retriever.h SOURCES += \ comic_vine/comic_vine_dialog.cpp \ @@ -43,4 +44,5 @@ SOURCES += \ comic_vine/scraper_scroll_label.cpp \ comic_vine/scraper_results_paginator.cpp \ comic_vine/scraper_selector.cpp \ - comic_vine/api_key_dialog.cpp + comic_vine/api_key_dialog.cpp \ + $$PWD/comic_vine_all_volume_comics_retriever.cpp diff --git a/YACReaderLibrary/comic_vine/comic_vine_all_volume_comics_retriever.cpp b/YACReaderLibrary/comic_vine/comic_vine_all_volume_comics_retriever.cpp new file mode 100644 index 00000000..9d6e463c --- /dev/null +++ b/YACReaderLibrary/comic_vine/comic_vine_all_volume_comics_retriever.cpp @@ -0,0 +1,97 @@ +#include "comic_vine_all_volume_comics_retriever.h" + +#include "http_worker.h" +#include "response_parser.h" + +#include + +ComicVineAllVolumeComicsRetriever::ComicVineAllVolumeComicsRetriever(const QString &volumeURLString, QObject *parent) + : QObject(parent), volumeURLString(volumeURLString) +{ + +} + +void ComicVineAllVolumeComicsRetriever::getAllVolumeComics() +{ + getAllVolumeComics(0); +} + +void ComicVineAllVolumeComicsRetriever::getAllVolumeComics(int range) +{ + HttpWorker * search = new HttpWorker(volumeURLString.arg(range)); + connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(appendVolumeComicsInfo(const QByteArray &))); + connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut())); + connect(search,SIGNAL(timeout()),this,SIGNAL(finished())); + connect(search,SIGNAL(finished()),search,SLOT(deleteLater())); + search->get(); +} + +void ComicVineAllVolumeComicsRetriever::appendVolumeComicsInfo(const QByteArray &data) +{ + QString json(data); + + jsonResponses.append(data); + + ResponseParser rp; + rp.loadJSONResponse(json); + + qint32 currentPage = rp.getCurrentPage(); + qint32 totalPages = rp.getTotalPages(); + + bool isLastResponse = currentPage == totalPages; + + if (!isLastResponse) { + getAllVolumeComics(currentPage * 100); + } + else + { + emit allVolumeComicsInfo(consolidateJSON()); + emit finished(); + } +} + +QString ComicVineAllVolumeComicsRetriever::consolidateJSON() +{ + QJsonObject consolidatedJSON; + QJsonArray comicsInfo; + + foreach (QByteArray json, jsonResponses) { + QJsonDocument doc = QJsonDocument::fromJson(json); + + if(doc.isNull() || !doc.isObject() || doc.isEmpty()) + { + continue; + } + + QJsonObject main = doc.object(); + QJsonValue error = main["error"]; + + if (error.isUndefined() || error.toString() != "OK") + { + continue; + } + else + { + QJsonValue results = main["results"]; + if (results.isUndefined() || !results.isArray()) + { + continue; + } + + QJsonArray resultsArray = results.toArray(); + foreach (const QJsonValue & v, resultsArray) + comicsInfo.append(v); + } + } + + consolidatedJSON["error"] = "OK"; + consolidatedJSON["status_code"] = 1; + consolidatedJSON["number_of_total_results"] = comicsInfo.size(); + consolidatedJSON["offset"] = 0; + consolidatedJSON["results"] = comicsInfo; + + QJsonDocument doc(consolidatedJSON); + return doc.toJson(QJsonDocument::Compact); +} + + diff --git a/YACReaderLibrary/comic_vine/comic_vine_all_volume_comics_retriever.h b/YACReaderLibrary/comic_vine/comic_vine_all_volume_comics_retriever.h new file mode 100644 index 00000000..ea90d5bd --- /dev/null +++ b/YACReaderLibrary/comic_vine/comic_vine_all_volume_comics_retriever.h @@ -0,0 +1,28 @@ +#ifndef COMIC_VINE_ALL_VOLUME_COMICS_RETRIEVER_H +#define COMIC_VINE_ALL_VOLUME_COMICS_RETRIEVER_H + +#include + +class ComicVineAllVolumeComicsRetriever : public QObject +{ + Q_OBJECT +public: + explicit ComicVineAllVolumeComicsRetriever(const QString &volumeURLString, QObject *parent = 0); + void getAllVolumeComics(); +protected: + void getAllVolumeComics(const int range); +signals: + void allVolumeComicsInfo(QString json); + void finished(); + void timeOut(); +protected slots: + void appendVolumeComicsInfo(const QByteArray &data); + +protected: + QString volumeURLString; + QList jsonResponses; + + QString consolidateJSON(); +}; + +#endif // COMIC_VINE_ALL_VOLUME_COMICS_RETRIEVER_H diff --git a/YACReaderLibrary/comic_vine/comic_vine_client.cpp b/YACReaderLibrary/comic_vine/comic_vine_client.cpp index 3af950c2..0f2616ee 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_client.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_client.cpp @@ -1,6 +1,8 @@ #include "comic_vine_client.h" #include "yacreader_global_gui.h" +#include "comic_vine_all_volume_comics_retriever.h" + //this is the API key used by YACReader to access Comic Vine //please, do not use it in your own software, get one for free at Comic Vine static const QString CV_API_KEY = "%CV_API_KEY%"; //get from settings @@ -22,7 +24,7 @@ static const QString CV_SERIES_DETAIL = CV_WEB_ADDRESS + "/volume/4050-%1/?api_k //gets info for comics in a volume id %1 static const QString CV_COMICS_INFO = CV_WEB_ADDRESS + "/issues/?api_key=" + CV_API_KEY + - "&format=json&field_list=name,issue_number,id,image&filter=volume:%1" + "&limit=1000&format=json&field_list=name,issue_number,id,image&filter=volume:%1" "&sort=cover_date:asc" //sorting by cover_date, because comic vine doesn't use natural sorting (issue_number -> 1 10 11 ... 100 2 20 21....) "&offset=%2"; @@ -47,7 +49,7 @@ ComicVineClient::ComicVineClient(QObject *parent) : { settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor settings->beginGroup("ComicVine"); - baseURL = settings->value(COMIC_VINE_BASE_URL, "http://comicvine.gamespot.com/api").toString(); + baseURL = settings->value(COMIC_VINE_BASE_URL, "https://comicvine.gamespot.com/api").toString(); } ComicVineClient::~ComicVineClient() @@ -115,11 +117,24 @@ void ComicVineClient::getSeriesCover(const QString & url) //CV_COMIC_IDS void ComicVineClient::getVolumeComicsInfo(const QString & idVolume, int page) { - HttpWorker * search = new HttpWorker(QString(CV_COMICS_INFO).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY,settings->value(COMIC_VINE_API_KEY,CV_API_KEY_DEFAULT).toString()).arg(idVolume).arg((page-1)*100)); //page on works for search, using offset instead + HttpWorker * search = new HttpWorker(QString(CV_COMICS_INFO).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY,settings->value(COMIC_VINE_API_KEY,CV_API_KEY_DEFAULT).toString()).arg(idVolume).arg((page-1)*100)); //page doesn't work for search, using offset instead connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(processVolumeComicsInfo(const QByteArray &))); connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut())); //TODO connect(search,SIGNAL(finished()),search,SLOT(deleteLater())); - search->get(); + search->get(); +} + +void ComicVineClient::getAllVolumeComicsInfo(const QString &idVolume) +{ + QString url = QString(CV_COMICS_INFO).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY,settings->value(COMIC_VINE_API_KEY,CV_API_KEY_DEFAULT).toString()).arg(idVolume); + ComicVineAllVolumeComicsRetriever * comicsRetriever = new ComicVineAllVolumeComicsRetriever(url); + + connect(comicsRetriever, &ComicVineAllVolumeComicsRetriever::allVolumeComicsInfo, this, &ComicVineClient::volumeComicsInfo); + connect(comicsRetriever, &ComicVineAllVolumeComicsRetriever::finished, this, &ComicVineClient::finished); + connect(comicsRetriever, &ComicVineAllVolumeComicsRetriever::finished, this, &ComicVineAllVolumeComicsRetriever::deleteLater); + connect(comicsRetriever, &ComicVineAllVolumeComicsRetriever::timeOut, this, &ComicVineClient::timeOut); + + comicsRetriever->getAllVolumeComics(); } //CV_COMIC_ID diff --git a/YACReaderLibrary/comic_vine/comic_vine_client.h b/YACReaderLibrary/comic_vine/comic_vine_client.h index f2702fc8..2208c6a7 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_client.h +++ b/YACReaderLibrary/comic_vine/comic_vine_client.h @@ -27,6 +27,7 @@ public slots: void getSeriesDetail(const QString & id); void getSeriesCover(const QString & url); void getVolumeComicsInfo(const QString & idVolume, int page=1); + void getAllVolumeComicsInfo(const QString & idVolume); QByteArray getComicDetail(const QString & id, bool &outError, bool &outTimeout); void getComicCover(const QString & url); diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp index 7afb47ee..cdb28424 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp @@ -1,4 +1,5 @@ #include "comic_vine_dialog.h" +#include #include #include #include @@ -36,6 +37,8 @@ ComicVineDialog::ComicVineDialog(QWidget *parent) : QDialog(parent) { + setWindowFlags(Qt::Window); + doLayout(); doStackedWidgets(); doConnections(); @@ -75,15 +78,13 @@ void ComicVineDialog::doLayout() buttonLayout->addWidget(closeButton); buttonLayout->setContentsMargins(0,0,0,0); - mainLayout->addWidget(titleHeader = new TitleHeader); - mainLayout->addWidget(content); - mainLayout->addStretch(); - mainLayout->addLayout(buttonLayout); + mainLayout->addWidget(titleHeader = new TitleHeader, 0); + mainLayout->addWidget(content, 1); + mainLayout->addLayout(buttonLayout, 0); mainLayout->setContentsMargins(26,16,26,11); setLayout(mainLayout); - setFixedSize(872,529); setWindowTitle("Comic Vine Scraper (beta)"); } @@ -197,7 +198,26 @@ void ComicVineDialog::goBack() void ComicVineDialog::setComics(const QList & comics) { - this->comics = comics; + this->comics = comics; +} + +QSize ComicVineDialog::sizeHint() const +{ + int heightDesktopResolution = QApplication::desktop()->screenGeometry().height(); + int widthDesktopResolution = QApplication::desktop()->screenGeometry().width(); + int height,width; + height = qMax(529, static_cast(heightDesktopResolution*0.5)); + width = height * 1.65; + + if (width > widthDesktopResolution) + return minimumSizeHint(); + + return QSize(width, height); +} + +QSize ComicVineDialog::minimumSizeHint() const +{ + return QSize(872, 529); } void ComicVineDialog::show() @@ -698,7 +718,7 @@ void ComicVineDialog::getVolumeComicsInfo(const QString &vID, int page) QLOG_TRACE() << vID; - comicVineClient->getVolumeComicsInfo(vID,page); + comicVineClient->getAllVolumeComicsInfo(vID); } void ComicVineDialog::launchSearchVolume() diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.h b/YACReaderLibrary/comic_vine/comic_vine_dialog.h index 6474afa1..1b303b45 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.h +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.h @@ -30,7 +30,8 @@ public: QString databasePath; QString basePath; void setComics(const QList & comics); - + QSize sizeHint() const; + QSize minimumSizeHint() const; signals: diff --git a/YACReaderLibrary/comic_vine/model/volume_comics_model.cpp b/YACReaderLibrary/comic_vine/model/volume_comics_model.cpp index 0a7a7e1c..ae59c41e 100644 --- a/YACReaderLibrary/comic_vine/model/volume_comics_model.cpp +++ b/YACReaderLibrary/comic_vine/model/volume_comics_model.cpp @@ -47,9 +47,16 @@ void VolumeComicsModel::load(const QString & json) } qSort(_data.begin(),_data.end(),lessThan); - } + } } +/*void VolumeComicsModel::load(const QStringList &jsonList) +{ + foreach (QString json, jsonList) { + load(json); + } +}*/ + QModelIndex VolumeComicsModel::parent(const QModelIndex &index) const { Q_UNUSED(index) diff --git a/YACReaderLibrary/comic_vine/model/volume_comics_model.h b/YACReaderLibrary/comic_vine/model/volume_comics_model.h index d9007891..8ccb416a 100644 --- a/YACReaderLibrary/comic_vine/model/volume_comics_model.h +++ b/YACReaderLibrary/comic_vine/model/volume_comics_model.h @@ -9,6 +9,7 @@ class VolumeComicsModel : public JSONModel public: explicit VolumeComicsModel(QObject *parent = 0); void load(const QString & json); + //void load(const QStringList & jsonList); QModelIndex parent(const QModelIndex &index) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; diff --git a/YACReaderLibrary/comic_vine/model/volumes_model.cpp b/YACReaderLibrary/comic_vine/model/volumes_model.cpp index e3bfff12..896f3f04 100644 --- a/YACReaderLibrary/comic_vine/model/volumes_model.cpp +++ b/YACReaderLibrary/comic_vine/model/volumes_model.cpp @@ -77,19 +77,36 @@ QVariant VolumesModel::data(const QModelIndex &index, int role) const if (role == Qt::DecorationRole) { - return QVariant(); + return QVariant(); } + + int row = index.row(); + int column = index.column(); + if (role == Qt::TextAlignmentRole) { - //TODO + switch(column) + { + case YEAR: + return QVariant(Qt::AlignRight | Qt::AlignVCenter); + case ISSUES: + return QVariant(Qt::AlignRight | Qt::AlignVCenter); + default: + return QVariant(Qt::AlignLeft | Qt::AlignVCenter); + } } - if(role != Qt::DisplayRole) + if(role != Qt::DisplayRole) return QVariant(); - int row = index.row(); - int column = index.column(); - return _data[row][column]; + if (column == YEAR || column == ISSUES) + { + return _data[row][column].toInt(); + } + else + { + return _data[row][column]; + } } Qt::ItemFlags VolumesModel::flags(const QModelIndex &index) const @@ -113,7 +130,7 @@ QVariant VolumesModel::headerData(int section, Qt::Orientation orientation, int case ISSUES: return QVariant(QString(tr("issues"))); case PUBLISHER: - return QVariant(QString(tr("publisher"))); + return QVariant(QString(tr("publisher"))); } } @@ -125,6 +142,8 @@ QVariant VolumesModel::headerData(int section, Qt::Orientation orientation, int return QVariant(Qt::AlignRight | Qt::AlignVCenter); case ISSUES: return QVariant(Qt::AlignRight | Qt::AlignVCenter); + default: + return QVariant(Qt::AlignLeft | Qt::AlignVCenter); } } diff --git a/YACReaderLibrary/comic_vine/model/volumes_model.h b/YACReaderLibrary/comic_vine/model/volumes_model.h index f8a2fe05..00c9e800 100644 --- a/YACReaderLibrary/comic_vine/model/volumes_model.h +++ b/YACReaderLibrary/comic_vine/model/volumes_model.h @@ -45,6 +45,9 @@ public: ID }; + enum Role { + SORT_ROLE = Qt::UserRole + }; }; #endif // VOLUMES_MODEL_H diff --git a/YACReaderLibrary/comic_vine/scraper_tableview.cpp b/YACReaderLibrary/comic_vine/scraper_tableview.cpp index 22dbbed1..58339d8f 100644 --- a/YACReaderLibrary/comic_vine/scraper_tableview.cpp +++ b/YACReaderLibrary/comic_vine/scraper_tableview.cpp @@ -5,7 +5,7 @@ ScraperTableView::ScraperTableView(QWidget *parent) : QTableView(parent) { - QString tableStylesheet = "QTableView {color:white; border:0px;alternate-background-color: #2E2E2E;background-color: #2B2B2B; outline: 0px;}" + QString tableStylesheet = "QTableView {color:white; border:0px;alternate-background-color: #2E2E2E;background-color: #2B2B2B; outline: 0px;}" "QTableView::item {outline: 0px; border: 0px; color:#FFFFFF;}" "QTableView::item:selected {outline: 0px; background-color: #555555; }" "QHeaderView::section:horizontal {background-color:#292929; border-bottom:1px solid #1F1F1F; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #292929, stop: 1 #1F1F1F); border-left:none; border-top:none; padding:4px; color:#ebebeb;}" @@ -33,8 +33,7 @@ ScraperTableView::ScraperTableView(QWidget *parent) : verticalHeader()->setResizeMode(QHeaderView::Fixed); #endif - //comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); - horizontalHeader()->setStretchLastSection(true); + horizontalHeader()->setStretchLastSection(true); #if QT_VERSION >= 0x050000 horizontalHeader()->setSectionsClickable(false); #else @@ -57,5 +56,5 @@ ScraperTableView::ScraperTableView(QWidget *parent) : verticalHeader()->hide(); - setSelectionMode(QAbstractItemView::SingleSelection); + setSelectionMode(QAbstractItemView::SingleSelection); } diff --git a/YACReaderLibrary/comic_vine/select_comic.cpp b/YACReaderLibrary/comic_vine/select_comic.cpp index 8105dfb1..9374c7b3 100644 --- a/YACReaderLibrary/comic_vine/select_comic.cpp +++ b/YACReaderLibrary/comic_vine/select_comic.cpp @@ -20,10 +20,7 @@ SelectComic::SelectComic(QWidget *parent) QVBoxLayout * l = new QVBoxLayout; QWidget * leftWidget = new QWidget; QVBoxLayout * left = new QVBoxLayout; - QVBoxLayout * right = new QVBoxLayout; - QHBoxLayout * content = new QHBoxLayout; - - right->setContentsMargins(0,0,0,0); + QGridLayout * content = new QGridLayout; //widgets cover = new QLabel(); @@ -41,23 +38,22 @@ SelectComic::SelectComic(QWidget *parent) left->addWidget(cover); left->addWidget(detailLabel,1); - left->addStretch(); leftWidget->setMaximumWidth(180); leftWidget->setLayout(left); left->setContentsMargins(0,0,0,0); leftWidget->setContentsMargins(0,0,0,0); - right->addWidget(tableComics,0,Qt::AlignRight|Qt::AlignTop); - right->addWidget(paginator); + content->addWidget(leftWidget, 0, 0); + content->addWidget(tableComics, 0, 1); + content->addWidget(paginator, 1, 1); - content->addWidget(leftWidget); - content->addLayout(right); + content->setColumnStretch(1, 1); + content->setRowStretch(0, 1);; l->addSpacing(15); l->addWidget(label); l->addSpacing(5); l->addLayout(content); - l->addStretch(); l->setContentsMargins(0,0,0,0); setLayout(l); @@ -70,8 +66,6 @@ void SelectComic::load(const QString &json, const QString & searchString) tempM->load(json); tableComics->setModel(tempM); - tableComics->setFixedSize(619,341); - if(model != 0) delete model; diff --git a/YACReaderLibrary/comic_vine/select_volume.cpp b/YACReaderLibrary/comic_vine/select_volume.cpp index 9650a7f7..d7716c6b 100644 --- a/YACReaderLibrary/comic_vine/select_volume.cpp +++ b/YACReaderLibrary/comic_vine/select_volume.cpp @@ -35,10 +35,7 @@ SelectVolume::SelectVolume(QWidget *parent) QVBoxLayout * l = new QVBoxLayout; QWidget * leftWidget = new QWidget; QVBoxLayout * left = new QVBoxLayout; - QVBoxLayout * right = new QVBoxLayout; - QHBoxLayout * content = new QHBoxLayout; - - right->setContentsMargins(0,0,0,0); + QGridLayout * content = new QGridLayout; //widgets cover = new QLabel(); @@ -46,9 +43,9 @@ SelectVolume::SelectVolume(QWidget *parent) cover->setAlignment(Qt::AlignTop|Qt::AlignHCenter); cover->setMinimumSize(168,168*5.0/3); cover->setStyleSheet("QLabel {background-color: #2B2B2B; color:white; font-size:12px; font-family:Arial; }"); - detailLabel = new ScraperScrollLabel(this); + detailLabel = new ScraperScrollLabel(); - tableVolumes = new ScraperTableView(this); + tableVolumes = new ScraperTableView(); tableVolumes->setSortingEnabled(true); #if QT_VERSION >= 0x050000 tableVolumes->horizontalHeader()->setSectionsClickable(true); @@ -64,23 +61,22 @@ SelectVolume::SelectVolume(QWidget *parent) left->addWidget(cover); left->addWidget(detailLabel,1); - left->addStretch(); leftWidget->setMaximumWidth(180); leftWidget->setLayout(left); left->setContentsMargins(0,0,0,0); leftWidget->setContentsMargins(0,0,0,0); - right->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop); - right->addWidget(paginator); + content->addWidget(leftWidget, 0, 0); + content->addWidget(tableVolumes, 0, 1); + content->addWidget(paginator, 1, 1); - content->addWidget(leftWidget); - content->addLayout(right); + content->setColumnStretch(1, 1); + content->setRowStretch(0, 1); - l->addSpacing(15); + l->addSpacing(15); l->addWidget(label); - l->addSpacing(5); - l->addLayout(content); - l->addStretch(); + l->addSpacing(5); + l->addLayout(content); l->setContentsMargins(0,0,0,0); setLayout(l); @@ -98,8 +94,6 @@ void SelectVolume::load(const QString & json, const QString & searchString) tableVolumes->sortByColumn(0,Qt::AscendingOrder); tableVolumes->resizeColumnsToContents(); - tableVolumes->setFixedSize(619,341); - if(model != 0) delete model; @@ -109,9 +103,9 @@ void SelectVolume::load(const QString & json, const QString & searchString) { tableVolumes->selectRow(0); loadVolumeInfo(proxyModel->index(0,0)); - } + } - tableVolumes->setColumnWidth(0,350); + tableVolumes->setColumnWidth(0,350); ScraperSelector::load(json,searchString); } diff --git a/YACReaderLibrary/comic_vine/sort_volume_comics.cpp b/YACReaderLibrary/comic_vine/sort_volume_comics.cpp index 16e7d782..c62ae6ca 100644 --- a/YACReaderLibrary/comic_vine/sort_volume_comics.cpp +++ b/YACReaderLibrary/comic_vine/sort_volume_comics.cpp @@ -38,7 +38,7 @@ SortVolumeComics::SortVolumeComics(QWidget *parent) : //connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveDownIL())); QVBoxLayout * l = new QVBoxLayout; - QHBoxLayout * content = new QHBoxLayout; + QGridLayout * content = new QGridLayout; QHBoxLayout * sortButtonsLayout = new QHBoxLayout; tableFiles = new ScraperTableView(); @@ -47,10 +47,6 @@ SortVolumeComics::SortVolumeComics(QWidget *parent) : tableFiles->setSelectionBehavior(QAbstractItemView::SelectRows); tableFiles->setSelectionMode(QAbstractItemView::ContiguousSelection); - tableFiles->setFixedSize(407,341); - tableVolumeComics->setFixedSize(407,341); - content->addWidget(tableFiles,0,Qt::AlignLeft|Qt::AlignTop); - content->addWidget(tableVolumeComics,0,Qt::AlignRight|Qt::AlignTop); //content->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop); connect(tableVolumeComics->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(synchronizeScroll(int))); @@ -66,22 +62,22 @@ SortVolumeComics::SortVolumeComics(QWidget *parent) : sortButtonsLayout->addWidget(ScrapperToolButton::getSeparator()); sortButtonsLayout->addWidget(moveDownButtonCL); sortButtonsLayout->addSpacing(10); - //sortButtonsLayout->addStretch(); sortButtonsLayout->addWidget(sortLabel); - sortButtonsLayout->addStretch(); - sortButtonsLayout->addWidget(paginator); - //sortButtonsLayout->addStretch(); - //sortButtonsLayout->addWidget(moveUpButtonIL); - //sortButtonsLayout->addWidget(ScrapperToolButton::getSeparator()); - //sortButtonsLayout->addWidget(moveDownButtonIL); - sortButtonsLayout->setSpacing(0); + sortButtonsLayout->addStretch(); + sortButtonsLayout->setSpacing(0); - l->addSpacing(15); - l->addWidget(label); + content->addWidget(tableFiles, 0, 0); + content->addWidget(tableVolumeComics, 0, 1); + content->addLayout(sortButtonsLayout, 1, 0); + content->addWidget(paginator, 1, 1); + + content->setRowStretch(0, 1); + + l->addSpacing(15); + l->addWidget(label, 0); l->addSpacing(5); - l->addLayout(content); - l->addLayout(sortButtonsLayout); - l->addStretch(); + l->addLayout(content, 1); + l->addLayout(sortButtonsLayout, 0); l->setContentsMargins(0,0,0,0); setLayout(l); diff --git a/YACReaderLibrary/comic_vine/sort_volume_comics.h b/YACReaderLibrary/comic_vine/sort_volume_comics.h index 92955f90..bd7b0687 100644 --- a/YACReaderLibrary/comic_vine/sort_volume_comics.h +++ b/YACReaderLibrary/comic_vine/sort_volume_comics.h @@ -67,7 +67,7 @@ public: signals: public slots: - void setData(QList & comics, const QString & json, const QString & vID); + void setData(QList & comics, const QString &json, const QString & vID); QList > getMatchingInfo(); protected slots: diff --git a/YACReaderLibrary/db/comic_model.cpp b/YACReaderLibrary/db/comic_model.cpp index cb9efa17..06fd397a 100644 --- a/YACReaderLibrary/db/comic_model.cpp +++ b/YACReaderLibrary/db/comic_model.cpp @@ -695,100 +695,47 @@ QString ComicModel::getComicPath(QModelIndex mi) void ComicModel::setupModelData(QSqlQuery &sqlquery) { - ComicItem * currentItem; - while (sqlquery.next()) + int numColumns = sqlquery.record().count(); + + while (sqlquery.next()) { QList data; - QSqlRecord record = sqlquery.record(); - for(int i=0;idata(ComicModel::FileName).toString(); - QString nameCurrent = currentItem->data(ComicModel::FileName).toString(); - int numberLast,numberCurrent; - int max = (std::numeric_limits::max)(); - numberLast = numberCurrent = max; + for(int i=0;idata(ComicModel::Number).isNull()) - numberLast = last->data(ComicModel::Number).toInt(); - - if(!currentItem->data(ComicModel::Number).isNull()) - numberCurrent = currentItem->data(ComicModel::Number).toInt(); - - QList::iterator i; - i = _data.end(); - i--; - - if(numberCurrent != max) //sort the current item by issue number - { - while ((lessThan =numberCurrent < numberLast) && i != _data.begin()) - { - i--; - numberLast = max; - - if(!(*i)->data(ComicModel::Number).isNull()) - numberLast = (*i)->data(ComicModel::Number).toInt(); - } - - if(lessThan) - _data.insert(i,currentItem); - else - { - if(numberCurrent == numberLast) - if(currentItem->data(ComicModel::IsBis).toBool()) - { - _data.insert(++i,currentItem); - } - else - _data.insert(i,currentItem); - else - _data.insert(++i,currentItem); - } - continue; - } - - else //sort the current item by title - { - while ((lessThan = naturalSortLessThanCI(nameCurrent,nameLast)) && i != _data.begin() && numberLast == max) - { - i--; - nameLast = (*i)->data(ComicModel::FileName).toString(); - numberLast = max; - - if(!(*i)->data(ComicModel::Number).isNull()) - numberLast = (*i)->data(ComicModel::Number).toInt(); - } - - if(numberLast != max) - _data.insert(++i,currentItem); - else - if(lessThan) - _data.insert(i,currentItem); - else - _data.insert(++i,currentItem); - continue; - - } - } + _data.append(new ComicItem(data)); } + + std::sort(_data.begin(), _data.end(), [](const ComicItem *c1, const ComicItem *c2) { + if(c1->data(ComicModel::Number).isNull() && c2->data(ComicModel::Number).isNull()) + { + return naturalSortLessThanCI(c1->data(ComicModel::FileName).toString(), c2->data(ComicModel::FileName).toString()); + } + else + { + if (c1->data(ComicModel::Number).isNull() == false && c2->data(ComicModel::Number).isNull() == false) + { + return c1->data(ComicModel::Number).toInt() < c2->data(ComicModel::Number).toInt(); + } + else + { + return c2->data(ComicModel::Number).isNull(); + } + } + }); } //comics are sorted by "ordering", the sorting is done in the sql query void ComicModel::setupModelDataForList(QSqlQuery &sqlquery) { + int numColumns = sqlquery.record().count(); + while (sqlquery.next()) { QList data; - QSqlRecord record = sqlquery.record(); - for(int i=0;i(index.internalPointer()); + if (role == Qt::ToolTipRole) + { + QString toolTip = item->data(FolderModel::Name).toString(); + int totalNumOfChildren = item->childCount() + item->comicNames.size(); + if(totalNumOfChildren > 0) + { + toolTip = toolTip + " - " + QString::number(totalNumOfChildren); + } + + return toolTip; + } + if (role == Qt::DecorationRole) #ifdef Q_OS_MAC @@ -175,8 +187,6 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const if (role != Qt::DisplayRole) return QVariant(); - - return item->data(index.column()); } //! [3] @@ -307,19 +317,27 @@ void FolderModel::setupModelData(QSqlQuery &sqlquery, FolderItem *parent) //se a�ade el nodo 0 items.insert(parent->id,parent); + QSqlRecord record = sqlquery.record(); + + int name = record.indexOf("name"); + int path = record.indexOf("path"); + int finished = record.indexOf("finished"); + int completed = record.indexOf("completed"); + int id = record.indexOf("id"); + int parentId = record.indexOf("parentId"); + while (sqlquery.next()) { QList data; - QSqlRecord record = sqlquery.record(); - data << record.value("name").toString(); - data << record.value("path").toString(); - data << record.value("finished").toBool(); - data << record.value("completed").toBool(); + data << sqlquery.value(name).toString(); + data << sqlquery.value(path).toString(); + data << sqlquery.value(finished).toBool(); + data << sqlquery.value(completed).toBool(); FolderItem * item = new FolderItem(data); - item->id = record.value("id").toULongLong(); + item->id = sqlquery.value(id).toULongLong(); //la inserci�n de hijos se hace de forma ordenada - FolderItem * parent = items.value(record.value("parentId").toULongLong()); + FolderItem * parent = items.value(sqlquery.value(parentId).toULongLong()); //if(parent !=0) //TODO if parent==0 the parent of item was removed from the DB and delete on cascade didn't work, ERROR. parent->appendChild(item); //se a�ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones @@ -331,20 +349,27 @@ void FolderModel::updateFolderModelData(QSqlQuery &sqlquery, FolderItem *parent) { Q_UNUSED(parent); - while (sqlquery.next()) { - QLOG_DEBUG () << "habia next"; - QList data; - QSqlRecord record = sqlquery.record(); + QSqlRecord record = sqlquery.record(); - data << record.value("name").toString(); - data << record.value("path").toString(); - data << record.value("finished").toBool(); - data << record.value("completed").toBool(); + int name = record.indexOf("name"); + int path = record.indexOf("path"); + int finished = record.indexOf("finished"); + int completed = record.indexOf("completed"); + int id = record.indexOf("id"); + int parentId = record.indexOf("parentId"); + + while (sqlquery.next()) { + QList data; + + data << sqlquery.value(name).toString(); + data << sqlquery.value(path).toString(); + data << sqlquery.value(finished).toBool(); + data << sqlquery.value(completed).toBool(); FolderItem * item = new FolderItem(data); - item->id = record.value("id").toULongLong(); + item->id = sqlquery.value(id).toULongLong(); //la inserci�n de hijos se hace de forma ordenada - FolderItem * parent = items.value(record.value("parentId").toULongLong()); + FolderItem * parent = items.value(sqlquery.value(parentId).toULongLong()); if(parent !=0) //TODO if parent==0 the parent of item was removed from the DB and delete on cascade didn't work, ERROR. parent->appendChild(item); //se a�ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones @@ -717,21 +742,28 @@ void FolderModelProxy::setupFilteredModelData(QSqlQuery &sqlquery, FolderItem *p //se a�ade el nodo 0 al modelo que representa el arbol de elementos que cumplen con el filtro filteredItems.insert(parent->id,parent); + QSqlRecord record = sqlquery.record(); + + int name = record.indexOf("name"); + int path = record.indexOf("path"); + int finished = record.indexOf("finished"); + int completed = record.indexOf("completed"); + int parentIdIndex = record.indexOf("parentId"); + while (sqlquery.next()) { //se procesan todos los folders que cumplen con el filtro //datos de la base de datos QList data; - QSqlRecord record = sqlquery.record(); - data << record.value("name").toString(); - data << record.value("path").toString(); - data << record.value("finished").toBool(); - data << record.value("completed").toBool(); + data << sqlquery.value(name).toString(); + data << sqlquery.value(path).toString(); + data << sqlquery.value(finished).toBool(); + data << sqlquery.value(completed).toBool(); FolderItem * item = new FolderItem(data); item->id = sqlquery.value(0).toULongLong(); //id del padre - quint64 parentId = record.value("parentId").toULongLong(); + quint64 parentId = sqlquery.value(parentIdIndex).toULongLong(); //se a�ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones if(!filteredItems.contains(item->id)) diff --git a/YACReaderLibrary/db/reading_list_model.cpp b/YACReaderLibrary/db/reading_list_model.cpp index c43193b9..5bff8e81 100644 --- a/YACReaderLibrary/db/reading_list_model.cpp +++ b/YACReaderLibrary/db/reading_list_model.cpp @@ -390,15 +390,9 @@ void ReadingListModel::addNewLabel(const QString &name, YACReader::LabelColors c QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath); qulonglong id = DBHelper::insertLabel(name, color, db); - Q_UNUSED(id); + int newPos = addLabelIntoList(new LabelItem(QList() << name << YACReader::colorToName(color) << id << color)); + beginInsertRows(QModelIndex(),specialLists.count()+1+newPos+1, specialLists.count()+1+newPos+1); - beginInsertRows(QModelIndex(),0, 0); - - // using the specfic row pos for inserting doesnt work - // int newPos = addLabelIntoList(new LabelItem(QList() << name << YACReader::colorToName(color) << id << color)); - // beginInsertRows(QModelIndex(),specialLists.count()+1+newPos+1, specialLists.count()+1+newPos+1); - - // endInsertRows(); endInsertRows(); @@ -596,21 +590,29 @@ void ReadingListModel::setupReadingListsData(QSqlQuery &sqlquery, ReadingListIte { items.insert(parent->getId(),parent); + QSqlRecord record = sqlquery.record(); + + int name = record.indexOf("name"); + int id = record.indexOf("id"); + int finished = record.indexOf("finished"); + int completed = record.indexOf("completed"); + int ordering = record.indexOf("ordering"); + int parentId = record.indexOf("parentId"); + while (sqlquery.next()) { - QSqlRecord record = sqlquery.record(); ReadingListItem * rli = new ReadingListItem(QList() - << record.value("name") - << record.value("id") - << record.value("finished") - << record.value("completed") - << record.value("ordering")); + << sqlquery.value(name) + << sqlquery.value(id) + << sqlquery.value(finished) + << sqlquery.value(completed) + << sqlquery.value(ordering)); ReadingListItem * currentParent; - if(record.value("parentId").isNull()) + if(sqlquery.value(parentId).isNull()) currentParent = rootItem; else - currentParent = items.value(record.value("parentId").toULongLong()); + currentParent = items.value(sqlquery.value(parentId).toULongLong()); currentParent->appendChild(rli); @@ -620,14 +622,19 @@ void ReadingListModel::setupReadingListsData(QSqlQuery &sqlquery, ReadingListIte QList ReadingListModel::setupSpecialLists(QSqlDatabase & db) { - QList list; + QList list; QSqlQuery selectQuery("SELECT * FROM default_reading_list ORDER BY id,name",db); + + QSqlRecord record = selectQuery.record(); + + int name = record.indexOf("name"); + int id = record.indexOf("id"); + while(selectQuery.next()) { - QSqlRecord record = selectQuery.record(); list << new SpecialListItem(QList() - << record.value("name") - << record.value("id")); + << selectQuery.value(name) + << selectQuery.value(id)); } //Reading after Favorites, Why? Because I want to :P @@ -638,14 +645,21 @@ QList ReadingListModel::setupSpecialLists(QSqlDatabase & db) void ReadingListModel::setupLabels(QSqlDatabase & db) { - QSqlQuery selectQuery("SELECT * FROM label ORDER BY ordering,name",db); //TODO add some kind of + QSqlQuery selectQuery("SELECT * FROM label ORDER BY ordering,name",db); + + QSqlRecord record = selectQuery.record(); + + int name = record.indexOf("name"); + int color = record.indexOf("color"); + int id = record.indexOf("id"); + int ordering = record.indexOf("ordering"); + while(selectQuery.next()) { - QSqlRecord record = selectQuery.record(); addLabelIntoList(new LabelItem(QList() - << record.value("name") - << record.value("color") - << record.value("id") - << record.value("ordering"))); + << selectQuery.value(name) + << selectQuery.value(color) + << selectQuery.value(id) + << selectQuery.value(ordering))); } //TEST diff --git a/YACReaderLibrary/db_helper.cpp b/YACReaderLibrary/db_helper.cpp index 6b1d995d..381de0e6 100644 --- a/YACReaderLibrary/db_helper.cpp +++ b/YACReaderLibrary/db_helper.cpp @@ -243,6 +243,9 @@ void DBHelper::update(qulonglong libraryId, ComicInfo & comicInfo) void DBHelper::update(ComicInfo * comicInfo, QSqlDatabase & db) { + if(comicInfo == nullptr) + return; + QSqlQuery updateComicInfo(db); updateComicInfo.prepare("UPDATE comic_info SET " "title = :title," @@ -384,8 +387,9 @@ void DBHelper::updateProgress(qulonglong libraryId, const ComicInfo &comicInfo) ComicDB comic = DBHelper::loadComic(comicInfo.id,db); comic.info.currentPage = comicInfo.currentPage; comic.info.hasBeenOpened = true; + comic.info.read = comic.info.read || comic.info.currentPage == comic.info.numPages; - DBHelper::update(&comic.info,db); + DBHelper::updateReadingRemoteProgress(comic.info,db); db.close(); QSqlDatabase::removeDatabase(libraryPath); @@ -407,6 +411,8 @@ void DBHelper::updateReadingRemoteProgress(const ComicInfo &comicInfo, QSqlDatab updateComicInfo.bindValue(":id", comicInfo.id); updateComicInfo.bindValue(":rating", comicInfo.rating); updateComicInfo.exec(); + + updateComicInfo.clear(); } @@ -568,12 +574,12 @@ qulonglong DBHelper::insert(ComicDB * comic, QSqlDatabase & db) comic->_hasCover = true; QSqlQuery query(db); - query.prepare("INSERT INTO comic (parentId, comicInfoId, fileName, path) " - "VALUES (:parentId,:comicInfoId,:name, :path)"); - query.bindValue(":parentId", comic->parentId); - query.bindValue(":comicInfoId", comic->info.id); - query.bindValue(":name", comic->name); - query.bindValue(":path", comic->path); + query.prepare("INSERT INTO comic (parentId, comicInfoId, fileName, path) " + "VALUES (:parentId,:comicInfoId,:name, :path)"); + query.bindValue(":parentId", comic->parentId); + query.bindValue(":comicInfoId", comic->info.id); + query.bindValue(":name", comic->name); + query.bindValue(":path", comic->path); query.exec(); return query.lastInsertId().toULongLong(); } @@ -616,8 +622,8 @@ void DBHelper::insertComicsInFavorites(const QList &comicsList, QSqlDat { QSqlQuery getNumComicsInFavoritesQuery("SELECT count(*) FROM comic_default_reading_list WHERE default_reading_list_id = 1;",db); getNumComicsInFavoritesQuery.next(); - QSqlRecord record = getNumComicsInFavoritesQuery.record(); - int numComics = record.value(0).toInt(); + + int numComics = getNumComicsInFavoritesQuery.value(0).toInt(); db.transaction(); @@ -639,8 +645,8 @@ void DBHelper::insertComicsInLabel(const QList &comicsList, qulonglong { QSqlQuery getNumComicsInFavoritesQuery(QString("SELECT count(*) FROM comic_label WHERE label_id = %1;").arg(labelId) ,db); getNumComicsInFavoritesQuery.next(); - QSqlRecord record = getNumComicsInFavoritesQuery.record(); - int numComics = record.value(0).toInt(); + + int numComics = getNumComicsInFavoritesQuery.value(0).toInt(); db.transaction(); @@ -663,8 +669,8 @@ void DBHelper::insertComicsInReadingList(const QList &comicsList, qulon { QSqlQuery getNumComicsInFavoritesQuery("SELECT count(*) FROM comic_reading_list;",db); getNumComicsInFavoritesQuery.next(); - QSqlRecord record = getNumComicsInFavoritesQuery.record(); - int numComics = record.value(0).toInt(); + + int numComics = getNumComicsInFavoritesQuery.value(0).toInt(); db.transaction(); @@ -688,19 +694,21 @@ QList DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDat QList list; QSqlQuery selectQuery(db); //TODO check - selectQuery.prepare("SELECT * FROM folder WHERE parentId = :parentId and id <> 1"); - selectQuery.bindValue(":parentId", parentId); + selectQuery.prepare("SELECT * FROM folder WHERE parentId = :parentId and id <> 1"); + selectQuery.bindValue(":parentId", parentId); selectQuery.exec(); - Folder * currentItem; + QSqlRecord record = selectQuery.record(); + + int name = record.indexOf("name"); + int path = record.indexOf("path"); + int id = record.indexOf("id"); + + Folder * currentItem; while (selectQuery.next()) { - QList data; - QSqlRecord record = selectQuery.record(); - for(int i=0;i DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDat list.insert(++i,currentItem); else list.insert(i,currentItem); - } } @@ -731,148 +738,194 @@ QList DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDat QList DBHelper::getSortedComicsFromParent(qulonglong parentId, QSqlDatabase & db) { - QList list; QSqlQuery selectQuery(db); - selectQuery.prepare("select c.id,c.parentId,c.fileName,c.path,ci.hash from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.parentId = :parentId"); - selectQuery.bindValue(":parentId", parentId); + + selectQuery.setForwardOnly(true); + selectQuery.prepare("select * from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.parentId = :parentId"); + selectQuery.bindValue(":parentId", parentId); selectQuery.exec(); + QSqlRecord record = selectQuery.record(); + + int id = record.indexOf("id"); + //int parentIdIndex = record.indexOf("parentId"); + int fileName = record.indexOf("fileName"); + int path = record.indexOf("path"); + + int hash = record.indexOf("hash"); + int comicInfoId = record.indexOf("comicInfoId"); + int read = record.indexOf("read"); + int edited = record.indexOf("edited"); + + //new 7.0 fields + int hasBeenOpened = record.indexOf("hasBeenOpened"); + int currentPage = record.indexOf("currentPage"); + int bookmark1 = record.indexOf("bookmark1"); + int bookmark2 = record.indexOf("bookmark2"); + int bookmark3 = record.indexOf("bookmark3"); + int brightness = record.indexOf("brightness"); + int contrast = record.indexOf("contrast"); + int gamma = record.indexOf("gamma"); + int rating = record.indexOf("rating"); + //-- + + int title = record.indexOf("title"); + int numPages = record.indexOf("numPages"); + + int coverPage = record.indexOf("coverPage"); + + int number = record.indexOf("number"); + int isBis = record.indexOf("isBis"); + int count = record.indexOf("count"); + + int volume = record.indexOf("volume"); + int storyArc = record.indexOf("storyArc"); + int arcNumber = record.indexOf("arcNumber"); + int arcCount = record.indexOf("arcCount"); + + int genere = record.indexOf("genere"); + + int writer = record.indexOf("writer"); + int penciller = record.indexOf("penciller"); + int inker = record.indexOf("inker"); + int colorist = record.indexOf("colorist"); + int letterer = record.indexOf("letterer"); + int coverArtist = record.indexOf("coverArtist"); + + int date = record.indexOf("date"); + int publisher = record.indexOf("publisher"); + int format = record.indexOf("format"); + int color = record.indexOf("color"); + int ageRating = record.indexOf("ageRating"); + + int synopsis = record.indexOf("synopsis"); + int characters = record.indexOf("characters"); + int notes = record.indexOf("notes"); + + int comicVineID = record.indexOf("comicVineID"); + ComicDB currentItem; while (selectQuery.next()) { - QList data; - QSqlRecord record = selectQuery.record(); - for(int i=0;i(list.back()); - QString nameLast = last.name; - QString nameCurrent = currentItem.name; + currentItem.info.hash = selectQuery.value(hash).toString(); + currentItem.info.id = selectQuery.value(comicInfoId).toULongLong(); + currentItem.info.read = selectQuery.value(read).toBool(); + currentItem.info.edited = selectQuery.value(edited).toBool(); - int numberLast,numberCurrent; - int max = (std::numeric_limits::max)(); - numberLast = numberCurrent = max; //TODO change by std limit + //new 7.0 fields + currentItem.info.hasBeenOpened = selectQuery.value(hasBeenOpened).toBool(); + currentItem.info.currentPage = selectQuery.value(currentPage).toInt(); + currentItem.info.bookmark1 = selectQuery.value(bookmark1).toInt(); + currentItem.info.bookmark2 = selectQuery.value(bookmark2).toInt(); + currentItem.info.bookmark3 = selectQuery.value(bookmark3).toInt(); + currentItem.info.brightness = selectQuery.value(brightness).toInt(); + currentItem.info.contrast = selectQuery.value(contrast).toInt(); + currentItem.info.gamma = selectQuery.value(gamma).toInt(); + currentItem.info.rating = selectQuery.value(rating).toInt(); + //-- - if(!last.info.number.isNull()) - numberLast = last.info.number.toInt(); + currentItem.info.title = selectQuery.value(title); + currentItem.info.numPages = selectQuery.value(numPages); - if(!currentItem.info.number.isNull()) - numberCurrent = currentItem.info.number.toInt(); + currentItem.info.coverPage = selectQuery.value(coverPage); - QList::iterator i; - i = list.end(); - i--; + currentItem.info.number = selectQuery.value(number); + currentItem.info.isBis = selectQuery.value(isBis); + currentItem.info.count = selectQuery.value(count); - if(numberCurrent != max) - { - while ((lessThan =numberCurrent < numberLast) && i != list.begin()) - { - i--; - numberLast = max; + currentItem.info.volume = selectQuery.value(volume); + currentItem.info.storyArc = selectQuery.value(storyArc); + currentItem.info.arcNumber = selectQuery.value(arcNumber); + currentItem.info.arcCount = selectQuery.value(arcCount); - if(!(*i).info.number.isNull()) - numberLast = (*i).info.number.toInt(); - } - } - else - { - while ((lessThan = naturalSortLessThanCI(nameCurrent,nameLast)) && i != list.begin() && numberLast == max) - { - i--; - nameLast = (*i).name; - numberLast = max; + currentItem.info.genere = selectQuery.value(genere); - if(!(*i).info.number.isNull()) - numberLast = (*i).info.number.toInt(); - } + currentItem.info.writer = selectQuery.value(writer); + currentItem.info.penciller = selectQuery.value(penciller); + currentItem.info.inker = selectQuery.value(inker); + currentItem.info.colorist = selectQuery.value(colorist); + currentItem.info.letterer = selectQuery.value(letterer); + currentItem.info.coverArtist = selectQuery.value(coverArtist); - } - if(!lessThan) //si se ha encontrado un elemento menor que current, se inserta justo después - { - if(numberCurrent != max) - { - if(numberCurrent == numberLast) - if(currentItem.info.isBis.toBool()) - { - list.insert(++i,currentItem); - } - else - list.insert(i,currentItem); - else - list.insert(++i,currentItem); - } - else - list.insert(++i,currentItem); - } - else - { - list.insert(i,currentItem); - } + currentItem.info.date = selectQuery.value(date); + currentItem.info.publisher = selectQuery.value(publisher); + currentItem.info.format = selectQuery.value(format); + currentItem.info.color = selectQuery.value(color); + currentItem.info.ageRating = selectQuery.value(ageRating); + + currentItem.info.synopsis = selectQuery.value(synopsis); + currentItem.info.characters = selectQuery.value(characters); + currentItem.info.notes = selectQuery.value(notes); + + currentItem.info.comicVineID = selectQuery.value(comicVineID); + + currentItem.info.existOnDb = true; + + list.append(currentItem); + } + + std::sort(list.begin(), list.end(), [](const ComicDB&c1, const ComicDB&c2) + { + if(c1.info.number.isNull() && c2.info.number.isNull()) + { + return naturalSortLessThanCI(c1.name, c2.name); + } + else + { + if (c1.info.number.isNull() == false && c2.info.number.isNull() == false) + { + return c1.info.number.toInt() < c2.info.number.toInt(); + } + else + { + return c2.info.number.isNull(); + } + } + }); - } - } //selectQuery.finish(); return list; } QList DBHelper::getComicsFromParent(qulonglong parentId, QSqlDatabase & db, bool sort) { - QList list; + QList list; QSqlQuery selectQuery(db); - selectQuery.prepare("select c.id,c.parentId,c.fileName,c.path,ci.hash from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.parentId = :parentId"); - selectQuery.bindValue(":parentId", parentId); + selectQuery.prepare("select c.id,c.parentId,c.fileName,c.path,ci.hash from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.parentId = :parentId"); + selectQuery.bindValue(":parentId", parentId); selectQuery.exec(); + QSqlRecord record = selectQuery.record(); + + int id = record.indexOf("id"); + ComicDB * currentItem; while (selectQuery.next()) { - QList data; - QSqlRecord record = selectQuery.record(); - for(int i=0;iid = record.value("id").toULongLong(); - currentItem->parentId = record.value(1).toULongLong(); - currentItem->name = record.value(2).toString(); - currentItem->path = record.value(3).toString(); - currentItem->info = DBHelper::loadComicInfo(record.value(4).toString(),db); - int lessThan = 0; - if(list.isEmpty() || !sort) - list.append(currentItem); - else - { - ComicDB * last = static_cast(list.back()); - QString nameLast = last->name; - QString nameCurrent = currentItem->name; - QList::iterator i; - i = list.end(); - i--; - while ((0 > (lessThan = nameCurrent.localeAwareCompare(nameLast))) && i != list.begin()) //se usa la misma ordenación que en QDir - { - i--; - nameLast = (*i)->name; - } - if(lessThan>0) //si se ha encontrado un elemento menor que current, se inserta justo después - list.insert(++i,currentItem); - else - list.insert(i,currentItem); + currentItem->id = selectQuery.value(id).toULongLong(); + currentItem->parentId = selectQuery.value(1).toULongLong(); + currentItem->name = selectQuery.value(2).toString(); + currentItem->path = selectQuery.value(3).toString(); + currentItem->info = DBHelper::loadComicInfo(selectQuery.value(4).toString(),db); - } + list.append(currentItem); } - //selectQuery.finish(); + + if (sort) + { + std::sort(list.begin(), list.end(), [](const LibraryItem * c1, const LibraryItem * c2){ + return c1->name.localeAwareCompare(c2->name) < 0; + }); + } + return list; } @@ -882,21 +935,29 @@ Folder DBHelper::loadFolder(qulonglong id, QSqlDatabase & db) Folder folder; QSqlQuery query(db); - query.prepare("SELECT * FROM folder WHERE id = :id"); - query.bindValue(":id",id); + query.prepare("SELECT * FROM folder WHERE id = :id"); + query.bindValue(":id",id); query.exec(); folder.id = id; folder.parentId = 0; + + QSqlRecord record = query.record(); + + int parentId = record.indexOf("parentId"); + int name = record.indexOf("name"); + int path = record.indexOf("path"); + int finished = record.indexOf("finished"); + int completed = record.indexOf("completed"); + if(query.next()) { - QSqlRecord record = query.record(); - folder.parentId = record.value("parentId").toULongLong(); - folder.name = record.value("name").toString(); - folder.path = record.value("path").toString(); + folder.parentId = query.value(parentId).toULongLong(); + folder.name = query.value(name).toString(); + folder.path = query.value(path).toString(); folder.knownId = true; //new 7.1 - folder.setFinished(record.value("finished").toBool()); - folder.setCompleted(record.value("completed").toBool()); + folder.setFinished(query.value(finished).toBool()); + folder.setCompleted(query.value(completed).toBool()); } return folder; @@ -906,26 +967,30 @@ Folder DBHelper::loadFolder(const QString &folderName, qulonglong parentId, QSql { Folder folder; - QLOG_DEBUG() << "Looking for folder with name = " << folderName << " and parent " << parentId; - QSqlQuery query(db); query.prepare("SELECT * FROM folder WHERE parentId = :parentId AND name = :folderName"); query.bindValue(":parentId",parentId); query.bindValue(":folderName", folderName); query.exec(); + QSqlRecord record = query.record(); + + int id = record.indexOf("id"); + int name = record.indexOf("name"); + int path = record.indexOf("path"); + int finished = record.indexOf("finished"); + int completed = record.indexOf("completed"); + folder.parentId = parentId; if(query.next()) { - QSqlRecord record = query.record(); - folder.id = record.value("id").toULongLong(); - folder.name = record.value("name").toString(); - folder.path = record.value("path").toString(); + folder.id = query.value(id).toULongLong(); + folder.name = query.value(name).toString(); + folder.path = query.value(path).toString(); folder.knownId = true; //new 7.1 - folder.setFinished(record.value("finished").toBool()); - folder.setCompleted(record.value("completed").toBool()); - QLOG_DEBUG() << "FOUND!!"; + folder.setFinished(query.value(finished).toBool()); + folder.setCompleted(query.value(completed).toBool()); } return folder; @@ -936,18 +1001,24 @@ ComicDB DBHelper::loadComic(qulonglong id, QSqlDatabase & db) ComicDB comic; QSqlQuery selectQuery(db); - selectQuery.prepare("select c.id,c.parentId,c.fileName,c.path,ci.hash from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.id = :id"); - selectQuery.bindValue(":id", id); + selectQuery.prepare("select c.id,c.parentId,c.fileName,c.path,ci.hash from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.id = :id"); + selectQuery.bindValue(":id", id); selectQuery.exec(); + + QSqlRecord record = selectQuery.record(); + + int parentId = record.indexOf("parentId"); + int name = record.indexOf("name"); + int path = record.indexOf("path"); + int hash = record.indexOf("hash"); + comic.id = id; if(selectQuery.next()) { - QSqlRecord record = selectQuery.record(); - //id = record.value("id").toULongLong(); - comic.parentId = record.value("parentId").toULongLong(); - comic.name = record.value("name").toString(); - comic.path = record.value("path").toString(); - comic.info = DBHelper::loadComicInfo(record.value("hash").toString(),db); + comic.parentId = selectQuery.value(parentId).toULongLong(); + comic.name = selectQuery.value(name).toString(); + comic.path = selectQuery.value(path).toString(); + comic.info = DBHelper::loadComicInfo(selectQuery.value(hash).toString(),db); } return comic; @@ -980,67 +1051,116 @@ ComicInfo DBHelper::loadComicInfo(QString hash, QSqlDatabase & db) ComicInfo comicInfo; QSqlQuery findComicInfo(db); - findComicInfo.prepare("SELECT * FROM comic_info WHERE hash = :hash"); - findComicInfo.bindValue(":hash", hash); + findComicInfo.prepare("SELECT * FROM comic_info WHERE hash = :hash"); + findComicInfo.bindValue(":hash", hash); findComicInfo.exec(); + QSqlRecord record = findComicInfo.record(); + + int id = record.indexOf("id"); + int read = record.indexOf("read"); + int edited = record.indexOf("edited"); + + //new 7.0 fields + int hasBeenOpened = record.indexOf("hasBeenOpened"); + int currentPage = record.indexOf("currentPage"); + int bookmark1 = record.indexOf("bookmark1"); + int bookmark2 = record.indexOf("bookmark2"); + int bookmark3 = record.indexOf("bookmark3"); + int brightness = record.indexOf("brightness"); + int contrast = record.indexOf("contrast"); + int gamma = record.indexOf("gamma"); + int rating = record.indexOf("rating"); + //-- + + int title = record.indexOf("title"); + int numPages = record.indexOf("numPages"); + + int coverPage = record.indexOf("coverPage"); + + int number = record.indexOf("number"); + int isBis = record.indexOf("isBis"); + int count = record.indexOf("count"); + + int volume = record.indexOf("volume"); + int storyArc = record.indexOf("storyArc"); + int arcNumber = record.indexOf("arcNumber"); + int arcCount = record.indexOf("arcCount"); + + int genere = record.indexOf("genere"); + + int writer = record.indexOf("writer"); + int penciller = record.indexOf("penciller"); + int inker = record.indexOf("inker"); + int colorist = record.indexOf("colorist"); + int letterer = record.indexOf("letterer"); + int coverArtist = record.indexOf("coverArtist"); + + int date = record.indexOf("date"); + int publisher = record.indexOf("publisher"); + int format = record.indexOf("format"); + int color = record.indexOf("color"); + int ageRating = record.indexOf("ageRating"); + + int synopsis = record.indexOf("synopsis"); + int characters = record.indexOf("characters"); + int notes = record.indexOf("notes"); + + int comicVineID = record.indexOf("comicVineID"); if(findComicInfo.next()) { comicInfo.hash = hash; - QSqlRecord record = findComicInfo.record(); - - comicInfo.hash = hash; - comicInfo.id = record.value("id").toULongLong(); - comicInfo.read = record.value("read").toBool(); - comicInfo.edited = record.value("edited").toBool(); + comicInfo.id = findComicInfo.value(id).toULongLong(); + comicInfo.read = findComicInfo.value(read).toBool(); + comicInfo.edited = findComicInfo.value(edited).toBool(); //new 7.0 fields - comicInfo.hasBeenOpened = record.value("hasBeenOpened").toBool(); - comicInfo.currentPage = record.value("currentPage").toInt(); - comicInfo.bookmark1 = record.value("bookmark1").toInt(); - comicInfo.bookmark2 = record.value("bookmark2").toInt(); - comicInfo.bookmark3 = record.value("bookmark3").toInt(); - comicInfo.brightness = record.value("brightness").toInt(); - comicInfo.contrast = record.value("contrast").toInt(); - comicInfo.gamma = record.value("gamma").toInt(); - comicInfo.rating = record.value("rating").toInt(); + comicInfo.hasBeenOpened = findComicInfo.value(hasBeenOpened).toBool(); + comicInfo.currentPage = findComicInfo.value(currentPage).toInt(); + comicInfo.bookmark1 = findComicInfo.value(bookmark1).toInt(); + comicInfo.bookmark2 = findComicInfo.value(bookmark2).toInt(); + comicInfo.bookmark3 = findComicInfo.value(bookmark3).toInt(); + comicInfo.brightness = findComicInfo.value(brightness).toInt(); + comicInfo.contrast = findComicInfo.value(contrast).toInt(); + comicInfo.gamma = findComicInfo.value(gamma).toInt(); + comicInfo.rating = findComicInfo.value(rating).toInt(); //-- - comicInfo.title = record.value("title"); - comicInfo.numPages = record.value("numPages"); + comicInfo.title = findComicInfo.value(title); + comicInfo.numPages = findComicInfo.value(numPages); - comicInfo.coverPage = record.value("coverPage"); + comicInfo.coverPage = findComicInfo.value(coverPage); - comicInfo.number = record.value("number"); - comicInfo.isBis = record.value("isBis"); - comicInfo.count = record.value("count"); + comicInfo.number = findComicInfo.value(number); + comicInfo.isBis = findComicInfo.value(isBis); + comicInfo.count = findComicInfo.value(count); - comicInfo.volume = record.value("volume"); - comicInfo.storyArc = record.value("storyArc"); - comicInfo.arcNumber = record.value("arcNumber"); - comicInfo.arcCount = record.value("arcCount"); + comicInfo.volume = findComicInfo.value(volume); + comicInfo.storyArc = findComicInfo.value(storyArc); + comicInfo.arcNumber = findComicInfo.value(arcNumber); + comicInfo.arcCount = findComicInfo.value(arcCount); - comicInfo.genere = record.value("genere"); + comicInfo.genere = findComicInfo.value(genere); - comicInfo.writer = record.value("writer"); - comicInfo.penciller = record.value("penciller"); - comicInfo.inker = record.value("inker"); - comicInfo.colorist = record.value("colorist"); - comicInfo.letterer = record.value("letterer"); - comicInfo.coverArtist = record.value("coverArtist"); + comicInfo.writer = findComicInfo.value(writer); + comicInfo.penciller = findComicInfo.value(penciller); + comicInfo.inker = findComicInfo.value(inker); + comicInfo.colorist = findComicInfo.value(colorist); + comicInfo.letterer = findComicInfo.value(letterer); + comicInfo.coverArtist = findComicInfo.value(coverArtist); - comicInfo.date = record.value("date"); - comicInfo.publisher = record.value("publisher"); - comicInfo.format = record.value("format"); - comicInfo.color = record.value("color"); - comicInfo.ageRating = record.value("ageRating"); + comicInfo.date = findComicInfo.value(date); + comicInfo.publisher = findComicInfo.value(publisher); + comicInfo.format = findComicInfo.value(format); + comicInfo.color = findComicInfo.value(color); + comicInfo.ageRating = findComicInfo.value(ageRating); - comicInfo.synopsis = record.value("synopsis"); - comicInfo.characters = record.value("characters"); - comicInfo.notes = record.value("notes"); + comicInfo.synopsis = findComicInfo.value(synopsis); + comicInfo.characters = findComicInfo.value(characters); + comicInfo.notes = findComicInfo.value(notes); - comicInfo.comicVineID = record.value("comicVineID"); + comicInfo.comicVineID = findComicInfo.value(comicVineID); comicInfo.existOnDb = true; } @@ -1057,8 +1177,11 @@ QList DBHelper::loadSubfoldersNames(qulonglong folderId, QSqlDatabase & selectQuery.prepare("SELECT name FROM folder WHERE parentId = :parentId AND id <> 1"); //do not select the root folder selectQuery.bindValue(":parentId", folderId); selectQuery.exec(); + + int name = selectQuery.record().indexOf("name"); + while(selectQuery.next()){ - result << selectQuery.record().value("name").toString(); + result << selectQuery.value(name).toString(); } return result; } diff --git a/YACReaderLibrary/empty_reading_list_widget.cpp b/YACReaderLibrary/empty_reading_list_widget.cpp index f325dc37..ddb13738 100644 --- a/YACReaderLibrary/empty_reading_list_widget.cpp +++ b/YACReaderLibrary/empty_reading_list_widget.cpp @@ -5,5 +5,5 @@ EmptyReadingListWidget::EmptyReadingListWidget(QWidget *parent) { setUpDefaultLayout(true); setPixmap(QPixmap(":/images/empty_reading_list")); - setText(tr("This reading list doesn't cotain comics yet")); + setText(tr("This reading list does not contain any comics yet")); } diff --git a/YACReaderLibrary/grid_comics_view.cpp b/YACReaderLibrary/grid_comics_view.cpp index 250cf55a..7b35b600 100644 --- a/YACReaderLibrary/grid_comics_view.cpp +++ b/YACReaderLibrary/grid_comics_view.cpp @@ -52,35 +52,87 @@ GridComicsView::GridComicsView(QWidget *parent) : QQmlContext *ctxt = view->rootContext(); + LibraryUITheme theme; + #ifdef Q_OS_MAC + theme = Light; + #else + theme = Dark; + #endif + + if(theme == Light) + { + ctxt->setContextProperty("backgroundColor", "#F6F6F6"); + ctxt->setContextProperty("cellColor", "#FFFFFF"); + ctxt->setContextProperty("selectedColor", "#FFFFFF"); + ctxt->setContextProperty("selectedBorderColor", "#007AFF"); + ctxt->setContextProperty("borderColor", "#DBDBDB"); + ctxt->setContextProperty("titleColor", "#121212"); + ctxt->setContextProperty("textColor", "#636363"); + //fonts settings + ctxt->setContextProperty("fontSize", 11); + ctxt->setContextProperty("fontFamily", QApplication::font().family()); + ctxt->setContextProperty("fontSpacing", 0.5); + + //info - copy/pasted from info_comics_view TODO create helpers for setting the UI config + ctxt->setContextProperty("infoBackgroundColor", "#FFFFFF"); + ctxt->setContextProperty("topShadow", QUrl()); + ctxt->setContextProperty("infoShadow", "info-shadow-light.png"); + ctxt->setContextProperty("infoIndicator", "info-indicator-light.png"); + + ctxt->setContextProperty("infoTextColor", "#404040"); + ctxt->setContextProperty("infoTitleColor", "#2E2E2E"); + + ctxt->setContextProperty("ratingUnselectedColor", "#DEDEDE"); + ctxt->setContextProperty("ratingSelectedColor", "#2B2B2B"); + + ctxt->setContextProperty("favUncheckedColor", "#DEDEDE"); + ctxt->setContextProperty("favCheckedColor", "#E84852"); + + ctxt->setContextProperty("readTickUncheckedColor", "#DEDEDE"); + ctxt->setContextProperty("readTickCheckedColor", "#E84852"); + } + else + { + ctxt->setContextProperty("backgroundColor", "#2A2A2A"); + ctxt->setContextProperty("cellColor", "#212121"); + ctxt->setContextProperty("selectedColor", "#121212"); + ctxt->setContextProperty("selectedBorderColor", "#121212"); + ctxt->setContextProperty("borderColor", "#121212"); + ctxt->setContextProperty("titleColor", "#FFFFFF"); + ctxt->setContextProperty("textColor", "#A8A8A8"); + ctxt->setContextProperty("dropShadow",false); + //fonts settings + int fontSize = QApplication::font().pointSize(); + if(fontSize == -1) + fontSize = QApplication::font().pixelSize(); + ctxt->setContextProperty("fontSize", fontSize); + ctxt->setContextProperty("fontFamily", QApplication::font().family()); + ctxt->setContextProperty("fontSpacing", 0.5); + + //info - copy/pasted from info_comics_view TODO create helpers for setting the UI config + ctxt->setContextProperty("infoBackgroundColor", "#2E2E2E"); + ctxt->setContextProperty("topShadow", "info-top-shadow.png"); + ctxt->setContextProperty("infoShadow", "info-shadow.png"); + ctxt->setContextProperty("infoIndicator", "info-indicator.png"); + + ctxt->setContextProperty("infoTextColor", "#B0B0B0"); + ctxt->setContextProperty("infoTitleColor", "#FFFFFF"); + + ctxt->setContextProperty("ratingUnselectedColor", "#1C1C1C"); + ctxt->setContextProperty("ratingSelectedColor", "#FFFFFF"); + + ctxt->setContextProperty("favUncheckedColor", "#1C1C1C"); + ctxt->setContextProperty("favCheckedColor", "#E84852"); + + ctxt->setContextProperty("readTickUncheckedColor", "#1C1C1C"); + ctxt->setContextProperty("readTickCheckedColor", "#E84852"); + } + #ifdef Q_OS_MAC - ctxt->setContextProperty("backgroundColor", "#F6F6F6"); - ctxt->setContextProperty("cellColor", "#FFFFFF"); - ctxt->setContextProperty("selectedColor", "#FFFFFF"); - ctxt->setContextProperty("selectedBorderColor", "#007AFF"); - ctxt->setContextProperty("borderColor", "#DBDBDB"); - ctxt->setContextProperty("titleColor", "#121212"); - ctxt->setContextProperty("textColor", "#636363"); - //fonts settings - ctxt->setContextProperty("fontSize", 11); - ctxt->setContextProperty("fontFamily", QApplication::font().family()); - ctxt->setContextProperty("fontSpacing", 0.5); + #else - ctxt->setContextProperty("backgroundColor", "#2A2A2A"); - ctxt->setContextProperty("cellColor", "#212121"); - ctxt->setContextProperty("selectedColor", "#121212"); - ctxt->setContextProperty("selectedBorderColor", "#121212"); - ctxt->setContextProperty("borderColor", "#121212"); - ctxt->setContextProperty("titleColor", "#FFFFFF"); - ctxt->setContextProperty("textColor", "#A8A8A8"); - ctxt->setContextProperty("dropShadow",false); - //fonts settings - int fontSize = QApplication::font().pointSize(); - if(fontSize == -1) - fontSize = QApplication::font().pixelSize(); - ctxt->setContextProperty("fontSize", fontSize); - ctxt->setContextProperty("fontFamily", QApplication::font().family()); - ctxt->setContextProperty("fontSpacing", 0.5); + #endif ctxt->setContextProperty("backgroundImage", QUrl()); diff --git a/YACReaderLibrary/icon.ico b/YACReaderLibrary/icon.ico index b2232648..32f8e29d 100644 Binary files a/YACReaderLibrary/icon.ico and b/YACReaderLibrary/icon.ico differ diff --git a/YACReaderLibrary/images_osx.qrc b/YACReaderLibrary/images_osx.qrc index 4cac9ddc..14398e66 100644 --- a/YACReaderLibrary/images_osx.qrc +++ b/YACReaderLibrary/images_osx.qrc @@ -15,6 +15,8 @@ ../images/main_toolbar/flow_osx@2x.png ../images/main_toolbar/grid_osx.png ../images/main_toolbar/grid_osx@2x.png + ../images/main_toolbar/info_osx.png + ../images/main_toolbar/info_osx@2x.png ../images/empty_folder_osx.png ../images/empty_search_osx.png ../images/iconSearch.png diff --git a/YACReaderLibrary/info_comics_view.cpp b/YACReaderLibrary/info_comics_view.cpp index 5912686b..44af8dc3 100644 --- a/YACReaderLibrary/info_comics_view.cpp +++ b/YACReaderLibrary/info_comics_view.cpp @@ -23,8 +23,55 @@ InfoComicsView::InfoComicsView(QWidget *parent) container->setFocusPolicy(Qt::StrongFocus); - view->setSource(QUrl("qrc:/qml/InfoComicsView.qml")); + QQmlContext *ctxt = view->rootContext(); + LibraryUITheme theme; + #ifdef Q_OS_MAC + theme = Light; + #else + theme = Dark; + #endif + + if(theme == Light) + { + ctxt->setContextProperty("infoBackgroundColor", "#FFFFFF"); + ctxt->setContextProperty("topShadow", QUrl()); + ctxt->setContextProperty("infoShadow", "info-shadow-light.png"); + ctxt->setContextProperty("infoIndicator", "info-indicator-light.png"); + + ctxt->setContextProperty("infoTextColor", "#404040"); + ctxt->setContextProperty("infoTitleColor", "#2E2E2E"); + + ctxt->setContextProperty("ratingUnselectedColor", "#DEDEDE"); + ctxt->setContextProperty("ratingSelectedColor", "#2B2B2B"); + + ctxt->setContextProperty("favUncheckedColor", "#DEDEDE"); + ctxt->setContextProperty("favCheckedColor", "#E84852"); + + ctxt->setContextProperty("readTickUncheckedColor", "#DEDEDE"); + ctxt->setContextProperty("readTickCheckedColor", "#E84852"); + } + else + { + ctxt->setContextProperty("infoBackgroundColor", "#2E2E2E"); + ctxt->setContextProperty("topShadow", "info-top-shadow.png"); + ctxt->setContextProperty("infoShadow", "info-shadow.png"); + ctxt->setContextProperty("infoIndicator", "info-indicator.png"); + + ctxt->setContextProperty("infoTextColor", "#B0B0B0"); + ctxt->setContextProperty("infoTitleColor", "#FFFFFF"); + + ctxt->setContextProperty("ratingUnselectedColor", "#1C1C1C"); + ctxt->setContextProperty("ratingSelectedColor", "#FFFFFF"); + + ctxt->setContextProperty("favUncheckedColor", "#1C1C1C"); + ctxt->setContextProperty("favCheckedColor", "#E84852"); + + ctxt->setContextProperty("readTickUncheckedColor", "#1C1C1C"); + ctxt->setContextProperty("readTickCheckedColor", "#E84852"); + } + + view->setSource(QUrl("qrc:/qml/InfoComicsView.qml")); QObject *rootObject = dynamic_cast(view->rootObject()); flow = rootObject->findChild("flow"); diff --git a/YACReaderLibrary/library_creator.cpp b/YACReaderLibrary/library_creator.cpp index 0fa37213..cac5569a 100644 --- a/YACReaderLibrary/library_creator.cpp +++ b/YACReaderLibrary/library_creator.cpp @@ -14,7 +14,7 @@ #include "compressed_archive.h" #include "comic.h" - +#include "pdf_comic.h" #include "yacreader_global.h" #include "QsLog.h" @@ -22,18 +22,6 @@ #include using namespace std; -#ifdef Q_OS_MAC - #include "pdf_comic.h" -#else - -#if QT_VERSION >= 0x050000 - #include "poppler-qt5.h" -#else - #include "poppler-qt4.h" -#endif - -#endif - //-------------------------------------------------------------------------------- LibraryCreator::LibraryCreator() :creation(false), partialUpdate(false) @@ -591,11 +579,10 @@ void ThumbnailCreator::create() QLOG_WARN() << "Extracting cover: file not found " << _fileSource; return; } - +#ifndef NO_PDF if(fi.suffix().compare("pdf",Qt::CaseInsensitive) == 0) { - -#ifdef Q_OS_MAC +#if defined Q_OS_MAC && defined USE_PDFKIT MacOSXPDFComic * pdfComic = new MacOSXPDFComic(); if(!pdfComic->openComic(_fileSource)) { @@ -603,41 +590,123 @@ void ThumbnailCreator::create() //QImage p; //p.load(":/images/notCover.png"); //p.save(_target); - return; - } + return; + } +#elif defined USE_PDFIUM + PdfiumComic * pdfComic = new PdfiumComic(); + if(!pdfComic->openComic(_fileSource)) + { + delete pdfComic; + return; + } #else Poppler::Document * pdfComic = Poppler::Document::load(_fileSource); #endif - if (!pdfComic) - { - QLOG_WARN() << "Extracting cover: unable to open PDF file " << _fileSource; - //delete pdfComic; //TODO check if the delete is needed - pdfComic = 0; - //QImage p; - //p.load(":/images/notCover.png"); - //p.save(_target); - return; - } -#ifndef Q_OS_MAC - //poppler only, not mac - if (pdfComic->isLocked()) - { - QLOG_WARN() << "Extracting cover: unable to open PDF file " << _fileSource; - delete pdfComic; - return; - } -#endif - _numPages = pdfComic->numPages(); - if(_numPages >= _coverPage) + + if (!pdfComic) { -#ifdef Q_OS_MAC - { //TODO is this "{" one too much? + QLOG_WARN() << "Extracting cover: unable to open PDF file " << _fileSource; + //delete pdfComic; //TODO check if the delete is needed + pdfComic = 0; + //QImage p; + //p.load(":/images/notCover.png"); + //p.save(_target); + return; + } +#if !defined USE_PDFKIT && !defined USE_PDFIUM + //poppler only, not mac + if (pdfComic->isLocked()) + { + QLOG_WARN() << "Extracting cover: unable to open PDF file " << _fileSource; + delete pdfComic; + return; + } +#endif + _numPages = pdfComic->numPages(); + if(_numPages >= _coverPage) + { +#if defined Q_OS_MAC || defined USE_PDFIUM QImage p = pdfComic->getPage(_coverPage-1); //TODO check if the page is valid #else QImage p = pdfComic->page(_coverPage-1)->renderToImage(72,72); -#endif - _cover = p; +#endif // + _cover = p; if(_target!="") + { + QImage scaled; + if(p.width()>p.height()) //landscape?? + { + scaled = p.scaledToWidth(640,Qt::SmoothTransformation); + } + else + { + scaled = p.scaledToWidth(480,Qt::SmoothTransformation); + } + scaled.save(_target,0,75); + } + else if(_target!="") + { + QLOG_WARN() << "Extracting cover: requested cover index greater than numPages " << _fileSource; + //QImage p; + //p.load(":/images/notCover.png"); + //p.save(_target); + } + delete pdfComic; + } + return; + } +#endif //NO_PDF + + if(crash) + { + return; + } + + CompressedArchive archive(_fileSource); + if(!archive.toolsLoaded()) + { + QLOG_WARN() << "Extracting cover: 7z lib not loaded"; + crash = true; + return; + } + if(!archive.isValid()) + { + QLOG_WARN() << "Extracting cover: file format not supported " << _fileSource; + } + //se filtran para obtener sólo los formatos soportados + QList order = archive.getFileNames(); + QList fileNames = FileComic::filter(order); + _numPages = fileNames.size(); + if(_numPages == 0) + { + QLOG_WARN() << "Extracting cover: empty comic " << _fileSource; + _cover.load(":/images/notCover.png"); + if(_target!="") + { + _cover.save(_target); + } + } + else + { + if(_coverPage > _numPages) + { + _coverPage = 1; + } + qSort(fileNames.begin(),fileNames.end(), naturalSortLessThanCI); + int index = order.indexOf(fileNames.at(_coverPage-1)); + + if(_target=="") + { + if(!_cover.loadFromData(archive.getRawDataAtIndex(index))) + { + QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource; + _cover.load(":/images/notCover.png"); + } + } + else + { + QImage p; + if(p.loadFromData(archive.getRawDataAtIndex(index))) { QImage scaled; if(p.width()>p.height()) //landscape?? @@ -650,92 +719,11 @@ void ThumbnailCreator::create() } scaled.save(_target,0,75); } -#ifdef Q_OS_MAC - } //TODO is this "{" one too much? - pdfComic->releaseLastPageData(); -#endif - } - else if(_target!="") - { - QLOG_WARN() << "Extracting cover: requested cover index greater than numPages " << _fileSource; - //QImage p; - //p.load(":/images/notCover.png"); - //p.save(_target); - } - - delete pdfComic; - } - else - { - - if(crash) - { - return; - } - - CompressedArchive archive(_fileSource); - if(!archive.toolsLoaded()) - { - QLOG_WARN() << "Extracting cover: 7z lib not loaded"; - crash = true; - return; - } - if(!archive.isValid()) - { - QLOG_WARN() << "Extracting cover: file format not supported " << _fileSource; - } - //se filtran para obtener sólo los formatos soportados - QList order = archive.getFileNames(); - QList fileNames = FileComic::filter(order); - _numPages = fileNames.size(); - if(_numPages == 0) - { - QLOG_WARN() << "Extracting cover: empty comic " << _fileSource; - _cover.load(":/images/notCover.png"); - if(_target!="") - { - _cover.save(_target); - } - } - else - { - if(_coverPage > _numPages) - { - _coverPage = 1; - } - qSort(fileNames.begin(),fileNames.end(), naturalSortLessThanCI); - int index = order.indexOf(fileNames.at(_coverPage-1)); - - if(_target=="") - { - if(!_cover.loadFromData(archive.getRawDataAtIndex(index))) - { - QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource; - _cover.load(":/images/notCover.png"); - } - } else { - QImage p; - if(p.loadFromData(archive.getRawDataAtIndex(index))) - { - QImage scaled; - if(p.width()>p.height()) //landscape?? - { - scaled = p.scaledToWidth(640,Qt::SmoothTransformation); - } - else - { - scaled = p.scaledToWidth(480,Qt::SmoothTransformation); - } - scaled.save(_target,0,75); - } - else - { - QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource; - //p.load(":/images/notCover.png"); - //p.save(_target); - } + QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource; + //p.load(":/images/notCover.png"); + //p.save(_target); } } } diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 9def54cf..95cc6293 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -114,8 +114,6 @@ LibraryWindow::LibraryWindow() void LibraryWindow::setupUI() { - setWindowIcon(QIcon(":/images/iconLibrary.png")); - setUnifiedTitleAndToolBarOnMac(true); libraryCreator = new LibraryCreator(); @@ -128,7 +126,7 @@ void LibraryWindow::setupUI() createActions(); doModels(); - + doDialogs(); doLayout(); createToolBars(); @@ -250,7 +248,7 @@ void LibraryWindow::doLayout() #else sHorizontal->addWidget(comicsViewsManager->containerWidget()); #endif - + sHorizontal->setStretchFactor(0,0); sHorizontal->setStretchFactor(1,1); mainWidget = new QStackedWidget(this); @@ -566,7 +564,7 @@ void LibraryWindow::createActions() expandAllNodesAction->setIcon(QIcon(":/images/sidebar/expand.png")); colapseAllNodesAction = new QAction(this); - colapseAllNodesAction->setToolTip(tr("Colapse all nodes")); + colapseAllNodesAction->setToolTip(tr("Collapse all nodes")); colapseAllNodesAction->setData(COLAPSE_ALL_NODES_ACTION_YL); colapseAllNodesAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(COLAPSE_ALL_NODES_ACTION_YL)); colapseAllNodesAction->setIcon(QIcon(":/images/sidebar/colapse.png")); @@ -654,7 +652,7 @@ void LibraryWindow::createActions() editSelectedComicsAction->setIcon(QIcon(":/images/comics_view_toolbar/editComic.png")); asignOrderAction = new QAction(this); - asignOrderAction->setText(tr("Asign current order to comics")); + asignOrderAction->setText(tr("Assign current order to comics")); asignOrderAction->setData(ASIGN_ORDER_ACTION_YL); asignOrderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ASIGN_ORDER_ACTION_YL)); asignOrderAction->setIcon(QIcon(":/images/comics_view_toolbar/asignNumber.png")); @@ -840,7 +838,7 @@ void LibraryWindow::createToolBars() libraryToolBar->attachToWindow(this->windowHandle()); - + #else libraryToolBar->backButton->setDefaultAction(backAction); libraryToolBar->forwardButton->setDefaultAction(forwardAction); @@ -858,9 +856,9 @@ void LibraryWindow::createToolBars() editInfoToolBar->addAction(editSelectedComicsAction); editInfoToolBar->addAction(getInfoAction); editInfoToolBar->addAction(asignOrderAction); - + editInfoToolBar->addSeparator(); - + editInfoToolBar->addAction(selectAllComicsAction); editInfoToolBar->addSeparator(); @@ -873,7 +871,7 @@ void LibraryWindow::createToolBars() editInfoToolBar->addAction(showHideMarksAction); editInfoToolBar->addSeparator(); - + editInfoToolBar->addAction(deleteComicsAction); @@ -897,7 +895,7 @@ void LibraryWindow::createMenus() foldersView->addAction(setFolderAsReadAction); foldersView->addAction(setFolderAsUnreadAction); - selectedLibrary->addAction(updateLibraryAction); + selectedLibrary->addAction(updateLibraryAction); selectedLibrary->addAction(renameLibraryAction); selectedLibrary->addAction(removeLibraryAction); YACReader::addSperator(selectedLibrary); @@ -911,7 +909,7 @@ void LibraryWindow::createMenus() - + //MacOSX app menus #ifdef Q_OS_MACX QMenuBar * menu = this->menuBar(); @@ -1120,7 +1118,7 @@ void LibraryWindow::createConnections() void LibraryWindow::loadLibrary(const QString & name) { if(!libraries.isEmpty()) //si hay bibliotecas... - { + { historyController->clear(); showRootWidget(); @@ -1230,7 +1228,7 @@ void LibraryWindow::loadLibrary(const QString & name) } else//si existe el path, puede ser que la librería sea alguna versión pre-5.0 ó que esté corrupta o que no haya drivers sql { - + if(d.exists(path+"/library.ydb")) { QSqlDatabase db = DataBaseManagement::loadDatabase(path); @@ -1310,7 +1308,7 @@ void LibraryWindow::copyAndImportComicsToFolder(const QList0) - { + { QModelIndex folderDestination = foldersModelProxy->mapToSource(miFolder); QString destFolderPath = QDir::cleanPath(currentPath()+foldersModel->getFolderPath(folderDestination)); @@ -1727,6 +1725,14 @@ void LibraryWindow::saveSelectedCoversTo() } } +void LibraryWindow::checkMaxNumLibraries() +{ + int numLibraries = libraries.getNames().length(); + if(numLibraries >= MAX_LIBRARIES_WARNING_NUM) { + QMessageBox::warning(this,tr("You are adding too many libraries."),tr("You are adding too many libraries.\n\nYou probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar.\n\nYACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low.")); + } +} + void LibraryWindow::selectSubfolder(const QModelIndex &mi, int child) { QModelIndex dest = foldersModel->index(child,0,mi); @@ -1765,17 +1771,29 @@ void LibraryWindow::openComic() quint64 comicId = comic.id; //TODO generate IDS for libraries... quint64 libraryId = libraries.getId(selectedLibrary->currentText()); - + // %1 %2 %3 NO-->%4 %5 %6 %7 %8 %9 %10 //Invoke YACReader comicPath comicId libraryId NO-->currentPage bookmark1 bookmark2 bookmark3 brightness contrast gamma bool yacreaderFound = false; -#ifdef Q_OS_MAC + QString comicIdS = QString("--comicId=") + QString("%1").arg(comicId); QString libraryIdS = QString("--libraryId=") + QString("%1").arg(libraryId); - QString yacreaderPath = QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app"); - if(yacreaderFound = QFileInfo(yacreaderPath).exists()) - QProcess::startDetached("open", QStringList() << "-n" << yacreaderPath << "--args" << path << comicIdS << libraryIdS ); /*<< page << bookmark1 << bookmark2 << bookmark3 << brightness << contrast << gamma*///,QStringList() << path); +#ifdef Q_OS_MAC + QStringList possiblePaths; + + possiblePaths.append(QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../")); + possiblePaths.append(QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation)); + for(auto && ypath: possiblePaths) + { + QString yacreaderPath = QDir::cleanPath(ypath + "/YACReader.app"); + if(QFileInfo(yacreaderPath).exists()) + { + yacreaderFound = true; + QProcess::startDetached("open", QStringList() << "-n" << yacreaderPath << "--args" << path << comicIdS << libraryIdS ); /*<< page << bookmark1 << bookmark2 << bookmark3 << brightness << contrast << gamma*///,QStringList() << path); + break; + } + } #endif #ifdef Q_OS_WIN /* \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\" \"%10\" */ @@ -1811,6 +1829,7 @@ void LibraryWindow::setCurrentComicUnreaded() { } void LibraryWindow::createLibrary() { + checkMaxNumLibraries(); createLibraryDialog->open(libraries); } @@ -1833,7 +1852,7 @@ void LibraryWindow::reloadCurrentLibrary() { void LibraryWindow::openLastCreated() { - + selectedLibrary->disconnect(); selectedLibrary->setCurrentIndex(selectedLibrary->findText(_lastAdded)); @@ -1843,22 +1862,23 @@ void LibraryWindow::openLastCreated() libraries.save(); connect(selectedLibrary,SIGNAL(currentIndexChanged(QString)),this,SLOT(loadLibrary(QString))); - + loadLibrary(_lastAdded); } void LibraryWindow::showAddLibrary() { + checkMaxNumLibraries(); addLibraryDialog->open(); } void LibraryWindow::openLibrary(QString path, QString name) -{ +{ if(!libraries.contains(name)) { //TODO: fix bug, /a/b/c/.yacreaderlibrary/d/e path.remove("/.yacreaderlibrary"); - QDir d; //TODO change this by static methods (utils class?? with delTree for example) + QDir d; //TODO change this by static methods (utils class?? with delTree for example) if(d.exists(path + "/.yacreaderlibrary")) { _lastAdded = name; @@ -1999,9 +2019,9 @@ void LibraryWindow::stopLibraryCreator() void LibraryWindow::setRootIndex() { if(!libraries.isEmpty()) - { + { QString path=libraries.getPath(selectedLibrary->currentText())+"/.yacreaderlibrary"; - QDir d; //TODO change this by static methods (utils class?? with delTree for example) + QDir d; //TODO change this by static methods (utils class?? with delTree for example) if(d.exists(path)) { navigationController->selectedFolder(QModelIndex()); @@ -2022,6 +2042,48 @@ void LibraryWindow::toggleFullScreen() fullscreen = !fullscreen; } +#ifdef Q_OS_WIN //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309 +void LibraryWindow::toFullScreen() +{ + fromMaximized = this->isMaximized(); + + sideBar->hide(); + libraryToolBar->hide(); + + previousWindowFlags = windowFlags(); + previousPos = pos(); + previousSize = size(); + + showNormal(); + setWindowFlags(previousWindowFlags | Qt::FramelessWindowHint); + + const QRect r = windowHandle()->screen()->geometry(); + + move(r.x(), r.y()); + resize(r.width(),r.height()+1); + show(); + + comicsViewsManager->comicsView->toFullScreen(); +} + +void LibraryWindow::toNormal() +{ + sideBar->show(); + libraryToolBar->show(); + + setWindowFlags(previousWindowFlags); + move(previousPos); + resize(previousSize); + show(); + + if(fromMaximized) + showMaximized(); + + comicsViewsManager->comicsView->toNormal(); +} + +#else + void LibraryWindow::toFullScreen() { fromMaximized = this->isMaximized(); @@ -2057,6 +2119,8 @@ void LibraryWindow::toNormal() } +#endif + void LibraryWindow::setSearchFilter(const YACReader::SearchModifiers modifier, QString filter) { if(!filter.isEmpty()) @@ -2100,7 +2164,7 @@ void LibraryWindow::showProperties() propertiesDialog->databasePath = foldersModel->getDatabase(); propertiesDialog->basePath = currentPath(); propertiesDialog->setComics(comics); - + propertiesDialog->show(); } @@ -2174,15 +2238,15 @@ void LibraryWindow::asignNumbers() if(indexList.count()>1) { bool ok; - int n = QInputDialog::getInt(this, tr("Asign comics numbers"), - tr("Asign numbers starting in:"), startingNumber,0,2147483647,1,&ok); + int n = QInputDialog::getInt(this, tr("Assign comics numbers"), + tr("Assign numbers starting in:"), startingNumber,0,2147483647,1,&ok); if (ok) startingNumber = n; else return; } qint64 edited = comicsModel->asignNumbers(indexList,startingNumber); - + //TODO add resorting without reloading navigationController->loadFolderInfo(foldersModelProxy->mapToSource(foldersView->currentIndex())); @@ -2216,7 +2280,7 @@ QFileInfo file = QDir::cleanPath(currentPath() + comicsModel->getComicPath(model args << "end tell"; QProcess::startDetached("osascript", args); #endif - + #ifdef Q_OS_WIN QString filePath = file.absoluteFilePath(); QString cmdArgs = QString("/select,\"") + QDir::toNativeSeparators(filePath) + QStringLiteral("\""); @@ -2503,7 +2567,7 @@ void LibraryWindow::showFoldersContextMenu(const QPoint &point) /* void LibraryWindow::showSocial() -{ +{ socialDialog->move(this->mapToGlobal(QPoint(width()-socialDialog->width()-10, centralWidget()->pos().y()+10))); QModelIndexList indexList = getSelectedComics(); diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 66588c41..98796e1a 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -375,6 +375,13 @@ public slots: void onAddComicsToLabel(); void setToolbarTitle(const QModelIndex & modelIndex); void saveSelectedCoversTo(); + void checkMaxNumLibraries(); + +private: + //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309 + Qt::WindowFlags previousWindowFlags; + QPoint previousPos; + QSize previousSize; }; #endif diff --git a/YACReaderLibrary/main.cpp b/YACReaderLibrary/main.cpp index dbdb3684..9e78a797 100644 --- a/YACReaderLibrary/main.cpp +++ b/YACReaderLibrary/main.cpp @@ -158,6 +158,9 @@ int main( int argc, char ** argv ) app.setApplicationVersion(VERSION); app.setAttribute(Qt::AA_UseHighDpiPixmaps); + if (QIcon::hasThemeIcon("YACReaderLibrary")) { + app.setWindowIcon(QIcon::fromTheme("YACReaderLibrary")); + } QString destLog = YACReader::getSettingsPath()+"/yacreaderlibrary.log"; QDir().mkpath(YACReader::getSettingsPath()); @@ -179,11 +182,11 @@ int main( int argc, char ** argv ) translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreaderlibrary_"+sufix); #endif app.installTranslator(&translator); - + QTranslator viewerTranslator; #if defined Q_OS_UNIX && !defined Q_OS_MAC viewerTranslator.load(QString(DATADIR)+"/yacreader/languages/yacreader_"+sufix); -#else +#else viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix); #endif app.installTranslator(&viewerTranslator); @@ -193,7 +196,7 @@ int main( int argc, char ** argv ) #ifdef SERVER_RELEASE QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat); //TODO unificar la creaci�n del fichero de config con el servidor settings->beginGroup("libraryConfig"); - + s = new Startup(); if(settings->value(SERVER_ON,true).toBool()) @@ -217,7 +220,7 @@ int main( int argc, char ** argv ) LibraryWindow * mw = new LibraryWindow(); - mw->connect(localServer,SIGNAL(comicUpdated(quint64, const ComicDB &)),mw,SLOT(updateComicsView(quint64, const ComicDB &))); + mw->connect(localServer,SIGNAL(comicUpdated(quint64, const ComicDB &)),mw,SLOT(updateComicsView(quint64, const ComicDB &)), Qt::QueuedConnection); //connections to localServer diff --git a/YACReaderLibrary/no_libraries_widget.cpp b/YACReaderLibrary/no_libraries_widget.cpp index 21dfb166..094024fb 100644 --- a/YACReaderLibrary/no_libraries_widget.cpp +++ b/YACReaderLibrary/no_libraries_widget.cpp @@ -23,7 +23,7 @@ NoLibrariesWidget::NoLibrariesWidget(QWidget *parent) : QLabel * lineLabel = new QLabel(); lineLabel->setPixmap(line); - QLabel * text = new QLabel(""+tr("You don't have any librarires yet")+""); + QLabel * text = new QLabel(""+tr("You don't have any libraries yet")+""); text->setStyleSheet("QLabel {font-size:25px;font-weight:bold;}"); QLabel * textDescription = new QLabel(""+tr("

You can create a library in any folder, YACReaderLibrary will import all comics and folders from this folder. If you have created any library in the past you can open them.

Don't forget that you can use YACReader as a stand alone application for reading the comics on your computer.

")+"
"); textDescription->setWordWrap(true); diff --git a/YACReaderLibrary/options_dialog.cpp b/YACReaderLibrary/options_dialog.cpp index 5c623a96..1bf6060a 100644 --- a/YACReaderLibrary/options_dialog.cpp +++ b/YACReaderLibrary/options_dialog.cpp @@ -63,7 +63,7 @@ OptionsDialog::OptionsDialog(QWidget * parent) backgroundImageBlurRadiusSlider = new QSlider(Qt::Horizontal); backgroundImageBlurRadiusSlider->setRange(0,100); - useCurrentComicCoverCheck = new QCheckBox(tr("Use selectec comic cover as background")); + useCurrentComicCoverCheck = new QCheckBox(tr("Use selected comic cover as background")); resetButton = new QPushButton(tr("Restore defautls")); diff --git a/YACReaderLibrary/properties_dialog.cpp b/YACReaderLibrary/properties_dialog.cpp index 8101c2a6..afa4fab8 100644 --- a/YACReaderLibrary/properties_dialog.cpp +++ b/YACReaderLibrary/properties_dialog.cpp @@ -89,7 +89,7 @@ void PropertiesDialog::createCoverBox() layout->addStretch(); coverPageEdit = new YACReaderFieldEdit(); - + showPreviousCoverPageButton = new QToolButton(); showPreviousCoverPageButton->setIcon(QIcon(":/images/previousCoverPage.png")); showPreviousCoverPageButton->setStyleSheet("QToolButton {border:none;}"); @@ -122,7 +122,7 @@ void PropertiesDialog::createCoverBox() connect(showPreviousCoverPageButton,SIGNAL(clicked()),this,SLOT(loadPreviousCover())); connect(showNextCoverPageButton,SIGNAL(clicked()),this,SLOT(loadNextCover())); - + } QFrame * createLine() @@ -145,7 +145,7 @@ void PropertiesDialog::createGeneralInfoBox() generalInfoLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); //generalInfoLayout->setRowWrapPolicy(QFormLayout::WrapAllRows); generalInfoLayout->addRow(tr("Title:"), title = new YACReaderFieldEdit()); - + QHBoxLayout * number = new QHBoxLayout; number->addWidget(numberEdit = new YACReaderFieldEdit()); @@ -161,7 +161,7 @@ void PropertiesDialog::createGeneralInfoBox() /*generalInfoLayout->addRow(tr("&Issue number:"), ); generalInfoLayout->addRow(tr("&Bis:"), );*/ generalInfoLayout->addRow(tr("Issue number:"), number); - + generalInfoLayout->addRow(tr("Volume:"), volumeEdit = new YACReaderFieldEdit()); QHBoxLayout * arc = new QHBoxLayout; @@ -176,9 +176,9 @@ void PropertiesDialog::createGeneralInfoBox() arcCountEdit->setValidator(&arcCountValidator); arc->addStretch(1); generalInfoLayout->addRow(tr("Story arc:"), arc); - - generalInfoLayout->addRow(tr("Genere:"), genereEdit = new YACReaderFieldEdit()); - + + generalInfoLayout->addRow(tr("Genre:"), genereEdit = new YACReaderFieldEdit()); + generalInfoLayout->addRow(tr("Size:"), size = new QLabel("size")); //generalInfoLayout->addRow(tr("Comic Vine link:"), comicVineLink = new QLabel("...")); @@ -196,7 +196,7 @@ void PropertiesDialog::createGeneralInfoBox() void PropertiesDialog::createAuthorsBox() { authorsBox = new QWidget; - + QVBoxLayout *authorsLayout = new QVBoxLayout; //authorsLayout->setRowWrapPolicy(QFormLayout::WrapAllRows); @@ -220,7 +220,7 @@ void PropertiesDialog::createAuthorsBox() vr2->addWidget(new QLabel(tr("Colorist(s):"))); vr2->addWidget(colorist = new YACReaderFieldPlainTextEdit()); h2->addLayout(vr2); - + //authorsLayout->addRow(tr("Inker(s):"), new YACReaderFieldPlainTextEdit()); //authorsLayout->addRow(tr("Colorist(s):"), new YACReaderFieldPlainTextEdit()); @@ -247,7 +247,7 @@ void PropertiesDialog::createAuthorsBox() void PropertiesDialog::createPublishingBox() { publishingBox = new QWidget; - + QFormLayout *publishingLayout = new QFormLayout; publishingLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); @@ -399,10 +399,10 @@ void PropertiesDialog::setComics(QList comics) int coverPage = comic.info.coverPage.toInt(); coverPageNumberLabel->setText(QString::number(coverPage)); coverPageNumberLabel->adjustSize(); - + showPreviousCoverPageButton->setEnabled(true); showNextCoverPageButton->setEnabled(true); - + if(coverPage == 1) showPreviousCoverPageButton->setDisabled(true); if(coverPage == comic.info.numPages.toInt()) @@ -496,7 +496,7 @@ void PropertiesDialog::setComics(QList comics) { if(itr->info.title.isNull() || itr->info.title.toString() != title->text()) title->clear(); - + if(itr->info.count.isNull() || itr->info.count.toString() != countEdit->text()) countEdit->clear(); @@ -605,7 +605,7 @@ void PropertiesDialog::setNumpages(int pagesNum) } void PropertiesDialog::setSize(float sizeFloat) { - + size->setText(QString::number(sizeFloat,'f',2) + " MB"); } @@ -813,7 +813,7 @@ void PropertiesDialog::closeEvent ( QCloseEvent * e ) synopsis->clear(); characters->clear(); notes->clear(); - + setDisableUniqueValues(false); tabBar->setCurrentIndex(0); @@ -850,7 +850,7 @@ void PropertiesDialog::loadNextCover() if(current < comics.at(0).info.numPages.toInt()) { updateCoverPageNumberLabel(current+1); - + ThumbnailCreator tc(basePath+comics[0].path,"",current+1); tc.create(); setCover(tc.getCover()); diff --git a/YACReaderLibrary/qml.qrc b/YACReaderLibrary/qml.qrc index 69bcc0fd..d3d279ea 100644 --- a/YACReaderLibrary/qml.qrc +++ b/YACReaderLibrary/qml.qrc @@ -10,6 +10,10 @@ qml/FlowView.qml qml/info-indicator.png qml/info-shadow.png + qml/info-indicator-light.png + qml/info-shadow-light.png + qml/info-indicator-light@2x.png + qml/info-shadow-light@2x.png qml/info-top-shadow.png qml/ComicInfo.qml qml/info-favorites.png diff --git a/YACReaderLibrary/qml/ComicInfo.qml b/YACReaderLibrary/qml/ComicInfo.qml index ce6f86e2..ea5b6ccb 100644 --- a/YACReaderLibrary/qml/ComicInfo.qml +++ b/YACReaderLibrary/qml/ComicInfo.qml @@ -15,7 +15,7 @@ Rectangle { height: info.height + 2 * topMargin - property string infoColor: "#b0b0b0" + property string infoColor: infoTextColor property font infoFont: Qt.font({ family: "Arial", @@ -136,7 +136,7 @@ Rectangle { id: title - color: "#ffffff" + color: infoTitleColor font.family: "Arial" font.bold: true font.pixelSize: mainContainer.compact ? 18 : 21; @@ -232,7 +232,7 @@ Rectangle { } Text { - id: showInComicVinw + id: showInComicVine font: mainContainer.infoFont color: "#ffcc00" text: "Show in Comic Vine" @@ -253,7 +253,7 @@ Rectangle { Layout.fillWidth: true id: sinopsis - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 wrapMode: Text.WordWrap @@ -267,7 +267,7 @@ Rectangle { Layout.bottomMargin: 5 id: authors_title - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 18 font.bold: true @@ -290,7 +290,7 @@ Rectangle { model: comicInfo.getWriters().length Column{ Text { - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -298,7 +298,7 @@ Rectangle { } Text { - color: "#b0b0b0" + color: infoTextColor font.family: "Arial" font.pixelSize: 13 font.italic: true @@ -312,7 +312,7 @@ Rectangle { model: comicInfo.getPencillers().length Column{ Text { - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -320,7 +320,7 @@ Rectangle { } Text { - color: "#b0b0b0" + color: infoTextColor font.family: "Arial" font.pixelSize: 13 font.italic: true @@ -334,7 +334,7 @@ Rectangle { model: comicInfo.getInkers().length Column{ Text { - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -342,7 +342,7 @@ Rectangle { } Text { - color: "#b0b0b0" + color: infoTextColor font.family: "Arial" font.pixelSize: 13 font.italic: true @@ -356,7 +356,7 @@ Rectangle { model: comicInfo.getColorists().length Column{ Text { - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -364,7 +364,7 @@ Rectangle { } Text { - color: "#b0b0b0" + color: infoTextColor font.family: "Arial" font.pixelSize: 13 font.italic: true @@ -378,7 +378,7 @@ Rectangle { model: comicInfo.getLetterers().length Column{ Text { - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -386,7 +386,7 @@ Rectangle { } Text { - color: "#b0b0b0" + color: infoTextColor font.family: "Arial" font.pixelSize: 13 font.italic: true @@ -400,7 +400,7 @@ Rectangle { model: comicInfo.getCoverArtists().length Column{ Text { - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -408,7 +408,7 @@ Rectangle { } Text { - color: "#b0b0b0" + color: infoTextColor font.family: "Arial" font.pixelSize: 13 font.italic: true @@ -422,7 +422,7 @@ Rectangle { Layout.topMargin: 25 id: publisher_title - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 18 font.bold: true @@ -439,7 +439,7 @@ Rectangle { Text { id: publisher - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -451,7 +451,7 @@ Rectangle { Text { id: format - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -463,7 +463,7 @@ Rectangle { Text { id: color - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -475,7 +475,7 @@ Rectangle { Text { id: age_rating - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 @@ -490,7 +490,7 @@ Rectangle { Layout.bottomMargin: 5 id: characters_title - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 18 font.bold: true @@ -508,7 +508,7 @@ Rectangle { model: comicInfo.getCharacters().length Text { - color: "white" + color: infoTitleColor font.family: "Arial" font.pixelSize: 15 diff --git a/YACReaderLibrary/qml/GridComicsView.qml b/YACReaderLibrary/qml/GridComicsView.qml index dc24bf83..56b45fde 100644 --- a/YACReaderLibrary/qml/GridComicsView.qml +++ b/YACReaderLibrary/qml/GridComicsView.qml @@ -587,7 +587,7 @@ Rectangle { Layout.maximumWidth: 960 height: parent.height - color: "#2e2e2e" + color: infoBackgroundColor visible: showInfo diff --git a/YACReaderLibrary/qml/InfoComicsView.qml b/YACReaderLibrary/qml/InfoComicsView.qml index 6ffb35c3..b6835de0 100644 --- a/YACReaderLibrary/qml/InfoComicsView.qml +++ b/YACReaderLibrary/qml/InfoComicsView.qml @@ -9,7 +9,7 @@ import com.yacreader.ComicModel 1.0 Rectangle { id: main - color: "#2e2e2e" + color: infoBackgroundColor width: parent.width height: parent.height @@ -29,7 +29,7 @@ Rectangle { Image { id: top_shadow - source: "info-top-shadow.png" + source: topShadow width: parent.width fillMode: Image.TileHorizontally } @@ -41,14 +41,14 @@ Rectangle { Image { id: indicator - source: "info-indicator.png" + source: infoIndicator } Image { id: bottom_shadow x: indicator.width width: parent.width - indicator.width - source: "info-shadow.png" + source: infoShadow fillMode: Image.TileHorizontally } } @@ -59,7 +59,7 @@ Rectangle { y: flow.height + flow.additionalBottomSpace - 6 height: parent.height - y - color: "#2e2e2e" + color: infoBackgroundColor ScrollView { __wheelAreaScrollSpeed: 75 diff --git a/YACReaderLibrary/qml/InfoFavorites.qml b/YACReaderLibrary/qml/InfoFavorites.qml index daf6b956..d490ab17 100644 --- a/YACReaderLibrary/qml/InfoFavorites.qml +++ b/YACReaderLibrary/qml/InfoFavorites.qml @@ -26,7 +26,7 @@ Item { ColorOverlay { anchors.fill: favorites_button_compact source: favorites_button_compact - color: active ? "#e84852" : "#1c1c1c" + color: active ? favCheckedColor : favUncheckedColor } } diff --git a/YACReaderLibrary/qml/InfoRating.qml b/YACReaderLibrary/qml/InfoRating.qml index 9a2e5e76..d865358b 100644 --- a/YACReaderLibrary/qml/InfoRating.qml +++ b/YACReaderLibrary/qml/InfoRating.qml @@ -24,7 +24,7 @@ Row { ColorOverlay { anchors.fill: star source: star - color: index < (mouseIndex > 0 ? mouseIndex : rating) ? "#ffffff" : "#1c1c1c" + color: index < (mouseIndex > 0 ? mouseIndex : rating) ? ratingSelectedColor : ratingUnselectedColor } MouseArea { diff --git a/YACReaderLibrary/qml/InfoTick.qml b/YACReaderLibrary/qml/InfoTick.qml index f52e5402..f91d65a8 100644 --- a/YACReaderLibrary/qml/InfoTick.qml +++ b/YACReaderLibrary/qml/InfoTick.qml @@ -23,7 +23,7 @@ Item { ColorOverlay { anchors.fill: read_compact source: read_compact - color: read ? "#e84852" : "#1c1c1c" + color: read ? readTickCheckedColor : readTickUncheckedColor } } diff --git a/YACReaderLibrary/qml/info-indicator-light.png b/YACReaderLibrary/qml/info-indicator-light.png new file mode 100644 index 00000000..b08a8ead Binary files /dev/null and b/YACReaderLibrary/qml/info-indicator-light.png differ diff --git a/YACReaderLibrary/qml/info-indicator-light@2x.png b/YACReaderLibrary/qml/info-indicator-light@2x.png new file mode 100644 index 00000000..38abb8c8 Binary files /dev/null and b/YACReaderLibrary/qml/info-indicator-light@2x.png differ diff --git a/YACReaderLibrary/qml/info-shadow-light.png b/YACReaderLibrary/qml/info-shadow-light.png new file mode 100644 index 00000000..e52f2c7a Binary files /dev/null and b/YACReaderLibrary/qml/info-shadow-light.png differ diff --git a/YACReaderLibrary/qml/info-shadow-light@2x.png b/YACReaderLibrary/qml/info-shadow-light@2x.png new file mode 100644 index 00000000..3abb75af Binary files /dev/null and b/YACReaderLibrary/qml/info-shadow-light@2x.png differ diff --git a/YACReaderLibrary/server/controllers/foldercontroller.cpp b/YACReaderLibrary/server/controllers/foldercontroller.cpp index 30aa657f..407880fe 100644 --- a/YACReaderLibrary/server/controllers/foldercontroller.cpp +++ b/YACReaderLibrary/server/controllers/foldercontroller.cpp @@ -10,6 +10,7 @@ #include "../static.h" #include "qnaturalsorting.h" +#include "yacreader_global.h" #include "QsLog.h" @@ -25,6 +26,11 @@ FolderController::FolderController() {} void FolderController::service(HttpRequest& request, HttpResponse& response) { + QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor + settings->beginGroup("libraryConfig"); + + bool showlessInfoPerFolder = settings->value(REMOTE_BROWSE_PERFORMANCE_WORKAROUND,false).toBool(); + HttpSession session=Static::sessionStore->getSession(request,response,false); response.setHeader("Content-Type", "text/html; charset=utf-8"); @@ -167,14 +173,21 @@ void FolderController::service(HttpRequest& request, HttpResponse& response) { t.setVariable(QString("element%1.class").arg(i),"folder"); - QList children = DBHelper::getFolderComicsFromLibrary(libraryId, item->id); - if(children.length()>0) + if(showlessInfoPerFolder) { - const ComicDB * comic = static_cast(children.at(0)); - t.setVariable(QString("element%1.image.url").arg(i),QString("/library/%1/cover/%2.jpg?folderCover=true").arg(libraryId).arg(comic->info.hash)); + t.setVariable(QString("element%1.image.url").arg(i),"/images/f.png"); } else - t.setVariable(QString("element%1.image.url").arg(i),"/images/f.png"); + { + QList children = DBHelper::getFolderComicsFromLibrary(libraryId, item->id); + if(children.length()>0) + { + const ComicDB * comic = static_cast(children.at(0)); + t.setVariable(QString("element%1.image.url").arg(i),QString("/library/%1/cover/%2.jpg?folderCover=true").arg(libraryId).arg(comic->info.hash)); + } + else + t.setVariable(QString("element%1.image.url").arg(i),"/images/f.png"); + } t.setVariable(QString("element%1.browse").arg(i),QString("BROWSE").arg(QString("/library/%1/folder/%2").arg(libraryId).arg(item->id))); t.setVariable(QString("element%1.cover.browse").arg(i),QString("").arg(QString("/library/%1/folder/%2").arg(libraryId).arg(item->id))); diff --git a/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp b/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp index 1bfe2f07..cfe9ccb0 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp +++ b/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp @@ -244,6 +244,7 @@ void HttpSession::dismissCurrentComic() { if(dataPtr->yacreaderSessionData.comic != 0) { + dataPtr->yacreaderSessionData.comic->invalidate(); dataPtr->yacreaderSessionData.comic->deleteLater(); dataPtr->yacreaderSessionData.comic = 0; } @@ -283,6 +284,7 @@ void HttpSession::dismissCurrentRemoteComic() { if(dataPtr->yacreaderSessionData.remoteComic != 0) { + dataPtr->yacreaderSessionData.remoteComic->invalidate(); dataPtr->yacreaderSessionData.remoteComic->deleteLater(); dataPtr->yacreaderSessionData.remoteComic = 0; } diff --git a/YACReaderLibrary/server_config_dialog.cpp b/YACReaderLibrary/server_config_dialog.cpp index 5ce706d1..58ae6a53 100644 --- a/YACReaderLibrary/server_config_dialog.cpp +++ b/YACReaderLibrary/server_config_dialog.cpp @@ -147,6 +147,10 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent) check->setText(tr("enable the server")); check->setStyleSheet("QCheckBox {color:#262626; font-size:13px; font-family: Arial;}"); + performanceWorkaroundCheck = new QCheckBox(this); + performanceWorkaroundCheck->move(332,354); + performanceWorkaroundCheck->setText(tr("display less information about folders in the browser\nto improve the performance")); + performanceWorkaroundCheck->setStyleSheet("QCheckBox {color:#262626; font-size:13px; font-family: Arial;}"); //accept->move(444, 242); //check->setLayoutDirection(Qt::RightToLeft); @@ -184,9 +188,12 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent) else check->setChecked(false); + performanceWorkaroundCheck->setChecked(settings->value(REMOTE_BROWSE_PERFORMANCE_WORKAROUND,false).toBool()); + settings->endGroup(); connect(check,SIGNAL(stateChanged(int)),this,SLOT(enableServer(int))); + connect(performanceWorkaroundCheck,SIGNAL(stateChanged(int)),this,SLOT(enableperformanceWorkaround(int))); } void ServerConfigDialog::enableServer(int status) @@ -208,7 +215,23 @@ void ServerConfigDialog::enableServer(int status) port->setText(""); settings->setValue(SERVER_ON,false); } - settings->endGroup(); + settings->endGroup(); +} + +void ServerConfigDialog::enableperformanceWorkaround(int status) +{ + QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor + settings->beginGroup("libraryConfig"); + + if(status == Qt::Checked) + { + settings->setValue(REMOTE_BROWSE_PERFORMANCE_WORKAROUND,true); + } + else + { + settings->setValue(REMOTE_BROWSE_PERFORMANCE_WORKAROUND,false); + } + settings->endGroup(); } void ServerConfigDialog::generateQR() diff --git a/YACReaderLibrary/server_config_dialog.h b/YACReaderLibrary/server_config_dialog.h index dfe441b5..54ed30b3 100644 --- a/YACReaderLibrary/server_config_dialog.h +++ b/YACReaderLibrary/server_config_dialog.h @@ -21,6 +21,7 @@ Q_OBJECT QLineEdit * port; QCheckBox * check; + QCheckBox * performanceWorkaroundCheck; QPushButton * close; QPushButton * accept; @@ -35,6 +36,7 @@ Q_OBJECT void regenerateQR(const QString & ip); void updateImage(); void enableServer(int status); + void enableperformanceWorkaround(int status); void updatePort(); signals: void portChanged(QString port); diff --git a/YACReaderLibrary/yacreader_comics_views_manager.cpp b/YACReaderLibrary/yacreader_comics_views_manager.cpp index 36991443..21c9fb26 100644 --- a/YACReaderLibrary/yacreader_comics_views_manager.cpp +++ b/YACReaderLibrary/yacreader_comics_views_manager.cpp @@ -12,6 +12,8 @@ #include "empty_reading_list_widget.h" #include "no_search_results_widget.h" +#include "yacreader_sidebar.h" + //-- #include "yacreader_search_line_edit.h" #include "options_dialog.h" @@ -71,6 +73,10 @@ QWidget * YACReaderComicsViewsManager::containerWidget() void YACReaderComicsViewsManager::showComicsView() { comicsViewStack->setCurrentWidget(comicsView); + + //BUG, ugly workaround for glitch when QOpenGLWidget (flow) is used just after any other widget in the views stack + //Somehow QOpenGLWidget is messing with the rendering of the side bar (wrong buffer swapping) + libraryWindow->sideBar->update(); } void YACReaderComicsViewsManager::showEmptyFolderView() diff --git a/YACReaderLibrary/yacreaderlibrary_de.ts b/YACReaderLibrary/yacreaderlibrary_de.ts index 3aca82fd..bca17c74 100644 --- a/YACReaderLibrary/yacreaderlibrary_de.ts +++ b/YACReaderLibrary/yacreaderlibrary_de.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -146,7 +146,7 @@ ClassicComicsView - + Hide comic flow Comic "Flow" verstecken @@ -154,47 +154,47 @@ ComicModel - + yes Ja - + no Nein - + Title Titel - + File Name File Name - + Pages Seiten - + Size Größe - + Read Lesen - + Current Page Aktuelle Seite - + Rating Bewertung @@ -202,52 +202,52 @@ ComicVineDialog - + skip überspringen - + back zurück - + next nächste - + search suche - + close schliessen - - - - - + + + + + Looking for volume... Suche nach Band.... - - + + comic %1 of %2 - %3 Comic %1 von %2 - %3 - + %1 comics selected %1 Comic ausgewählt - + Error connecting to ComicVine Fehler bei Verbindung zu ComicVine @@ -256,18 +256,18 @@ unbekannter Fehler - - + + Retrieving tags for : %1 Runterladen von Tags für : %1 - + Retrieving volume info... Runterladen von Ausgabe Info... - + Looking for comic... Suche nach Comic... @@ -333,12 +333,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -374,7 +374,8 @@ EmptyReadingListWidget - This reading list doesn't cotain comics yet + This reading list does not contain any comics yet + This reading list doesn't contain comics yet @@ -457,26 +458,34 @@ FileComic - + CRC error on page (%1): some of the pages will not be displayed correctly CRC Fehler auf Seite (%1): einige Seiten werden nicht korrekt dargestellt werden - + Unknown error opening the file Unbekannter Fehler beim Öffnen des Files - + 7z not found 7z nicht gefunden - + Format not supported Format wird nicht unterstützt + + GridComicsView + + + Show info + + + HelpAboutDialog @@ -592,12 +601,12 @@ LibraryWindow - + YACReader Library YACReader Bibliothek - + Library Bibliothek @@ -606,121 +615,121 @@ <font color='white'> drücke 'F' um Vollbildmodus zu schließen </font> - + Create a new library Neue Bibliothek erzeugen - + Open an existing library Eine existierende Bibliothek öffnen - - + + Export comics info Export Comics Info - - + + Import comics info Import Comics Info - + Pack covers Titelbild Paket erzeugen - + Pack the covers of the selected library Packe die Titelbilder der ausgewählten Bibliothek in ein Paket - + Unpack covers Titelbilder entpacken - + Unpack a catalog Katalog entpacken - + Update library Bibliothek updaten - + Update current library Aktuelle Bibliothek updaten - + Rename library Bibliothek umbenennen - + Rename current library Aktuelle Bibliothek umbenennen - + Remove library Bibliothek entfernen - + Remove current library from your collection Aktuelle Bibliothek aus der Sammlung entfernen - + Open current comic Aktuellen Comic öffnen - + Open current comic on YACReader Aktuellen Comic mit YACReader öffnen - + Save selected covers to... - + Save covers of the selected comics as JPG files - - + + Set as read Als gelesen markieren - + Set comic as read Comic als gelesen markieren - - + + Set as unread Als ungelesen markieren - + Set comic as unread Comic als ungelesen markieren - + Show/Hide marks Zeige/Verstecke Markierungen @@ -729,14 +738,14 @@ Zeige oder verstecke gelesene Markierungen - + Library not available Library ' Bibliothek nicht verfügbar - - + + Fullscreen mode on/off Vollbildmodus an/aus @@ -745,12 +754,12 @@ Vollbildmodus an/aus (F) - + Help, About YACReader Hilfe, Über YACReader - + Select root node Root Knoten auswählen @@ -759,7 +768,7 @@ + - + Expand all nodes Unterordner anzeigen @@ -769,67 +778,65 @@ - - Colapse all nodes - Unterordner verstecken + Unterordner verstecken - + Show options dialog Zeige den Optionen Dialog - + Show comics server options dialog Zeige den Comics Optionen Dialog - + Open folder... Öffne Ordner... - + Set as uncompleted Als nicht gelesen markieren - + Set as completed Als gelesen markieren - + Open containing folder... Öffne aktuellen Ordner... - + Reset comic rating Comic Bewertung zurücksetzen - + Select all comics Alle Comics auswählen - + Edit Editieren - Asign current order to comics - Bestimme die Abfolge der Comics + Bestimme die Abfolge der Comics - + Update cover Titelbild updaten - + Delete selected comics Ausgewählte Comics löschen @@ -838,343 +845,381 @@ Comic "Flow" verstecken - + Download tags from Comic Vine Tags von Comic Vine herunterladen - + Edit shortcuts - + Update folder - + Update current folder - + Add new reading list - + Add a new reading list to the current library - + Remove reading list - + Remove current reading list from the library - + Add new label - + Add a new label to this library - + Rename selected list - + Rename any selected labels or lists - + Add to... - + Favorites - + Add selected comics to favorites list - + Folder Ordner - + Comic Comic - + Update needed Update benötigt - + This library was created with a previous version of YACReaderLibrary. It needs to be updated. Update now? Diese Bibliothek wurde mit einer vorherigen Version von YACReader erzeugt. Sie muss geupdated werden. Jetzt updaten? - + Update failed Update fehlgeschlagen - + The current library can't be udpated. Check for write write permissions on: Die aktuelle Bibliothek kann nicht geupdated werden. Überprüfen Sie die Schreibrechte auf: - + Download new version Neue Version herunterladen - + This library was created with a newer version of YACReaderLibrary. Download the new version now? Die Bibliothek wurde mit einer neueren Version von YACReader erzeugt. Die neue Version jetzt herunterladen? - + Library '%1' is no longer available. Do you want to remove it? Bibliothek '%1' ist nicht länger verfügbar. Wollen Sie sie entfernen? - + Old library Alte Bibliothek - + Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now? Bibliothek '%1' ist mit einer älteren Version von YACREader erzeugt worden. Sie muss neu erzeugt werden. Wollen Sie die Bibliothek jetzt erzeugen? - - + + Copying comics... - - + + Moving comics... - + Folder name: - + No folder selected - + Please, select a folder first - + Error in path - + There was an error accessing the folder's path - + The selected folder and all its contents will be deleted from your disk. Are you sure? - + There was an issue trying to delete the selected folders. Please, check for write permissions and be sure that any applications are using these folders or any of the contained files. - + Add new reading lists - - + + List name: - + Delete list/label - + The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure? - + Rename list name - + Save covers - + + You are adding too many libraries. + + + + + You are adding too many libraries. + +You probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar. + +YACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low. + + + + YACReader not found YACReader nicht gefunden - + YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary. YACReader nicht gefunden. YACReader sollte in demselben Ordner installiert werden wie YACReaderLibrary. - + Library not found Bibliothek nicht gefunden - + The selected folder doesn't contain any library. Der ausgewählte Ordner enthält keine Bibliothek. - + Are you sure? Sind Sie sicher? - + Do you want remove Möchten Sie entfernen - + library? die Bibliothek? - + Remove and delete metadata Entferne und lösche Metadaten - - + + Assign comics numbers + + + + + Assign numbers starting in: + + + + + Unable to delete Löschen nicht möglich - + Show or hide read marks - - + + Add new folder - + Add new folder to the current library - + + + Delete folder + + + + Delete current folder from disk - - + + Collapse all nodes + + + + + Change between comics views - + + Assign current order to comics + + + + There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder. Es gab ein Problem beim löschen der ausgewählten Comics. Überprüfen Sie bitte die Schreibberechtigung für die ausgewählten Files oder Ordner. - Asign comics numbers - Comic Nummer setzen + Comic Nummer setzen - Asign numbers starting in: - Nummern setzen angefangen mit: + Nummern setzen angefangen mit: - + Error creating the library Fehler beim Erzeugen der Bibliothek - + Error updating the library Fehler beim Updaten der Bibliothek - + Error opening the library Fehler beim Öffnen der Bibliothek - + Delete comics Comics löschen - + All the selected comics will be deleted from your disk. Are you sure? Alle ausgewählten Comics werden von Ihrer Festplatte gelöscht. Sind Sie sicher? - + Remove comics - + Comics will only be deleted from the current label/list. Are you sure? - + Library name already exists Bibliothek Name existiert bereits - + There is another library with the name '%1'. Es gibt eine andere Bibliothek mit dem Namen '%1'. @@ -1182,7 +1227,7 @@ LocalComicListModel - + file name File Name @@ -1191,7 +1236,7 @@ NoLibrariesWidget - You don't have any librarires yet + You don't have any libraries yet Sie haben im Augenblick keine Bibliothek @@ -1239,7 +1284,7 @@ - Use selectec comic cover as background + Use selected comic cover as background @@ -1322,8 +1367,9 @@ - Genere: - Genre: + Genre: + Genere: + Genre: @@ -1528,22 +1574,22 @@ Bitte wählen Sie die richtige Comic Information. - + comics Comics - + loading cover Cover laden - + loading description Beschreibung laden - + description unavailable Beschreibung nicht verfügbar @@ -1556,22 +1602,22 @@ Bitte wählen Sie die richtige Serie für Ihre Comics. - + volumes Bände - + loading cover Titelbilder werden geladen - + loading description Beschreibung lädt - + description unavailable Beschreibung nicht verfügbar @@ -1652,7 +1698,13 @@ Server aktivieren - + + display less information about folders in the browser +to improve the performance + + + + QR generator error! QR Generator Fehler! @@ -1670,23 +1722,23 @@ Sortieren Sie die Comics um die Informationen zur Übereinstimmung zu bringen - + issues Ausgaben - + remove selected comics Löschen der ausgewählten Comics - + restore all removed comics Wiederherstellung der gelöschten Comics Wiederherstellen aller gelöschten Comics - + restore removed comics @@ -1759,7 +1811,7 @@ VolumeComicsModel - + title Titel @@ -1767,17 +1819,17 @@ VolumesModel - + year Jahr - + issues Bände - + publisher Herausgeber @@ -1969,12 +2021,12 @@ YACReaderNavigationController - + No favorites - + You are not reading anything yet, come on!! diff --git a/YACReaderLibrary/yacreaderlibrary_es.qm b/YACReaderLibrary/yacreaderlibrary_es.qm deleted file mode 100644 index 370934a5..00000000 Binary files a/YACReaderLibrary/yacreaderlibrary_es.qm and /dev/null differ diff --git a/YACReaderLibrary/yacreaderlibrary_es.ts b/YACReaderLibrary/yacreaderlibrary_es.ts index 3ddb0be3..137b8cf8 100644 --- a/YACReaderLibrary/yacreaderlibrary_es.ts +++ b/YACReaderLibrary/yacreaderlibrary_es.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -146,7 +146,7 @@ ClassicComicsView - + Hide comic flow Ocultar cómic flow @@ -154,47 +154,47 @@ ComicModel - + yes - + no no - + Title Título - + File Name Nombre de archivo - + Pages Páginas - + Size Tamaño - + Read Leído - + Current Page Página Actual - + Rating Nota @@ -202,52 +202,52 @@ ComicVineDialog - + skip omitir - + back atrás - + next siguiente - + search buscar - + close cerrar - - - - - + + + + + Looking for volume... Buscando volumen... - - + + comic %1 of %2 - %3 cómic %1 de %2 - %3 - + %1 comics selected %1 comics seleccionados - + Error connecting to ComicVine Error conectando a ComicVine @@ -256,18 +256,18 @@ error desconocido - - + + Retrieving tags for : %1 Recuperando etiquetas para : %1 - + Retrieving volume info... Recuperando imformación del volumen... - + Looking for comic... Buscando cómic... @@ -333,12 +333,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -374,7 +374,8 @@ EmptyReadingListWidget - This reading list doesn't cotain comics yet + This reading list does not contain any comics yet + This reading list doesn't contain comics yet @@ -457,26 +458,34 @@ FileComic - + Unknown error opening the file Error desconocido abriendo el archivo - + 7z not found 7z no encontrado - + Format not supported Formato no soportado - + CRC error on page (%1): some of the pages will not be displayed correctly Error CRC en la página (%1): algunas de las páginas no se mostrarán correctamente + + GridComicsView + + + Show info + + + HelpAboutDialog @@ -598,121 +607,121 @@ <font color='white'> presiona 'F' para salir de pantalla completa </font> - + YACReader Library YACReader Library - + Create a new library Crear una nueva biblioteca - + Open an existing library Abrir una biblioteca existente - - + + Export comics info Exportar información de los cómics - - + + Import comics info Importar información de cómics - + Pack covers Empaquetar portadas - + Pack the covers of the selected library Empaquetar las portadas de la biblioteca seleccionada - + Unpack covers Desempaquetar portadas - + Unpack a catalog Desempaquetar un catálogo - + Update library Actualizar biblioteca - + Update current library Actualizar la biblioteca seleccionada - + Rename library Renombrar biblioteca - + Rename current library Renombrar la biblioteca seleccionada - + Remove current library from your collection Eliminar biblioteca de la colección - + Open current comic Abrir cómic actual - + Open current comic on YACReader Abrir el cómic actual en YACReader - + Save selected covers to... - + Save covers of the selected comics as JPG files - - + + Set as read Marcar como leído - + Set comic as read Marcar cómic como leído - - + + Set as unread Marcar como no leído - + Set comic as unread Marcar cómic como no leído - + Show/Hide marks Mostrar/Ocultar marcas @@ -721,8 +730,8 @@ Mostrar u ocultar marcas - - + + Fullscreen mode on/off Modo a pantalla completa on/off @@ -731,12 +740,12 @@ Activar/desactivar modo a pantalla completa (F) - + Help, About YACReader Ayuda, A cerca de... YACReader - + Select root node Seleccionar el nodo raíz @@ -745,7 +754,7 @@ + - + Expand all nodes Expandir todos los nodos @@ -754,67 +763,65 @@ - - Colapse all nodes - Contraer todos los nodos + Contraer todos los nodos - + Show options dialog Mostrar opciones - + Show comics server options dialog - + Open folder... Abrir carpeta... - + Set as uncompleted Marcar como incompleto - + Set as completed Marcar como completo - + Open containing folder... Abrir carpeta contenedora... - + Reset comic rating Reseteal cómic rating - + Select all comics Seleccionar todos los cómics - + Edit Editar - Asign current order to comics - Asignar el orden actual a los cómics + Asignar el orden actual a los cómics - + Update cover Actualizar portada - + Delete selected comics Borrar los cómics seleccionados @@ -823,367 +830,405 @@ Ocultar cómic flow - + Download tags from Comic Vine Descargar etiquetas de Comic Vine - + Folder Carpeta - + Comic Cómic - + Library not available Library ' Biblioteca no disponible - + Library '%1' is no longer available. Do you want to remove it? La biblioteca '%1' no está disponible. ¿Deseas eliminarla? - + Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now? La biblioteca '%1' ha sido creada con una versión más antigua de YACReaderLibrary y debe ser creada de nuevo. ¿Deseas crear la biblioteca ahora? - + Old library Biblioteca antigua - + YACReader not found YACReader no encontrado - + YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary. YACReader no encontrado, YACReader debe estar instalado en el mismo directorio que YACReaderLibrary. - - + + Unable to delete No se ha podido borrar - + There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder. Ha habido algún problema intentando borrar los cómics selecionados. Por favor, verifica los permisos de escritura en los arhicovs seleccionados o los directorios que los conienen. - + + Assign comics numbers + + + + + Assign numbers starting in: + + + + Error creating the library Errar creando la biblioteca - + Error updating the library Error actualizando la biblioteca - + Error opening the library Error abriendo la biblioteca - + Delete comics Borrar cómics - + All the selected comics will be deleted from your disk. Are you sure? Todos los cómics seleccionados serán borrados de tu disco. ¿Estás seguro? - + Remove comics - + Comics will only be deleted from the current label/list. Are you sure? - + Library name already exists Ya existe el nombre de la biblioteca - + There is another library with the name '%1'. Hay otra biblioteca con el nombre '%1'. - + Library Librería - + Remove library Eliminar biblioteca - + Show or hide read marks - - + + Add new folder - + Add new folder to the current library - + + + Delete folder + + + + Delete current folder from disk - - + + Collapse all nodes + + + + + Change between comics views - + + Assign current order to comics + + + + Edit shortcuts - + Update folder - + Update current folder - + Add new reading list - + Add a new reading list to the current library - + Remove reading list - + Remove current reading list from the library - + Add new label - + Add a new label to this library - + Rename selected list - + Rename any selected labels or lists - + Add to... - + Favorites - + Add selected comics to favorites list - + Update needed Se necesita actualizar - + This library was created with a previous version of YACReaderLibrary. It needs to be updated. Update now? Esta biblioteca fue creada con una versión anterior de YACReaderLibrary. Es necesario que se actualice. ¿Deseas hacerlo ahora? - + Update failed La actualización ha fallado - + The current library can't be udpated. Check for write write permissions on: La librería actual no ha podido ser actualizada. Verifica que posees permisos de escritura en: - + Download new version Descargar la nueva versión - + This library was created with a newer version of YACReaderLibrary. Download the new version now? Esta biblioteca fue creada con una versión más nueva de YACReaderLibrary. ¿Deseas descargar la nueva versión ahora? - - + + Copying comics... - - + + Moving comics... - + Folder name: - + No folder selected - + Please, select a folder first - + Error in path - + There was an error accessing the folder's path - + The selected folder and all its contents will be deleted from your disk. Are you sure? - + There was an issue trying to delete the selected folders. Please, check for write permissions and be sure that any applications are using these folders or any of the contained files. - + Add new reading lists - - + + List name: - + Delete list/label - + The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure? - + Rename list name - + Save covers - + + You are adding too many libraries. + + + + + You are adding too many libraries. + +You probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar. + +YACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low. + + + + Library not found Biblioteca no encontrada - + The selected folder doesn't contain any library. La carpeta seleccionada no contiene ninguna biblioteca. - + Are you sure? ¿Estás seguro? - + library? ? - + Remove and delete metadata Eliminar y borrar metadatos - + Do you want remove ¿Deseas eliminar la biblioteca - Asign comics numbers - Asignar números de cómic + Asignar números de cómic - Asign numbers starting in: - Asignar números empezando en: + Asignar números empezando en: LocalComicListModel - + file name nombre de archivo @@ -1192,7 +1237,7 @@ NoLibrariesWidget - You don't have any librarires yet + You don't have any libraries yet Aún no tienes ninguna biblioteca @@ -1240,7 +1285,7 @@ - Use selectec comic cover as background + Use selected comic cover as background @@ -1323,8 +1368,9 @@ - Genere: - Género: + Genre: + Genere: + Género: @@ -1527,22 +1573,22 @@ Por favor, selecciona la información correcta. - + comics cómics - + loading cover cargando portada - + loading description cargando descripción - + description unavailable descripción no disponible @@ -1555,22 +1601,22 @@ Por favor, seleciona la serie correcta para tu cómic. - + volumes volúmenes - + loading cover cargando portada - + loading description cargando descripción - + description unavailable descripción no disponible @@ -1652,7 +1698,13 @@ activar el servidor - + + display less information about folders in the browser +to improve the performance + + + + QR generator error! ¡Error del generador QR! @@ -1670,22 +1722,22 @@ ordena los cómics para coincidir con la información - + issues números - + remove selected comics eliminar cómics seleccionados - + restore all removed comics restaurar todos los cómics eliminados - + restore removed comics restaurar cómics eliminados @@ -1758,7 +1810,7 @@ VolumeComicsModel - + title título @@ -1766,17 +1818,17 @@ VolumesModel - + year año - + issues números - + publisher editor @@ -1968,12 +2020,12 @@ YACReaderNavigationController - + No favorites - + You are not reading anything yet, come on!! diff --git a/YACReaderLibrary/yacreaderlibrary_fr.ts b/YACReaderLibrary/yacreaderlibrary_fr.ts index 1dbdeabe..5f78b92c 100644 --- a/YACReaderLibrary/yacreaderlibrary_fr.ts +++ b/YACReaderLibrary/yacreaderlibrary_fr.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -146,7 +146,7 @@ ClassicComicsView - + Hide comic flow Cacher le comic flow @@ -154,47 +154,47 @@ ComicModel - + yes oui - + no non - + Title Titre - + File Name Nom du fichier - + Pages Pages - + Size Taille - + Read Lu - + Current Page - + Rating @@ -202,68 +202,68 @@ ComicVineDialog - + skip - + back - + next - + search - + close - - - - - + + + + + Looking for volume... - - + + comic %1 of %2 - %3 - + %1 comics selected - + Error connecting to ComicVine - - + + Retrieving tags for : %1 - + Retrieving volume info... - + Looking for comic... @@ -329,12 +329,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -370,7 +370,8 @@ EmptyReadingListWidget - This reading list doesn't cotain comics yet + This reading list does not contain any comics yet + This reading list doesn't contain comics yet @@ -453,26 +454,34 @@ FileComic - + Unknown error opening the file - + 7z not found 7z introuvable - + Format not supported - + CRC error on page (%1): some of the pages will not be displayed correctly + + GridComicsView + + + Show info + + + HelpAboutDialog @@ -588,12 +597,12 @@ LibraryWindow - + YACReader Library Librairie de YACReader - + Library Librairie @@ -602,121 +611,121 @@ <font color='white'> appuyez sur 'F' pour quitter le mode plein écran </font> - + Create a new library Créer une nouvelle librairie - + Open an existing library Ouvrir une librairie existante - - + + Export comics info Exporter les infos des comics - - + + Import comics info Importer les infos des comics - + Pack covers Archiver les couvertures - + Pack the covers of the selected library Archiver les couvertures de la librairie sélectionnée - + Unpack covers Désarchiver les couvertures - + Unpack a catalog Désarchiver un catalogue - + Update library Mettre la librairie à jour - + Update current library Mettre à jour la librairie actuelle - + Rename library Renommer la librairie - + Rename current library Renommer la librairie actuelle - + Remove library Supprimer la librairie - + Remove current library from your collection Enlever cette librairie de votre collection - + Open current comic Ouvrir ce comic - + Open current comic on YACReader Ouvrir ce comic dans YACReader - + Save selected covers to... - + Save covers of the selected comics as JPG files - - + + Set as read Marquer comme lu - + Set comic as read Marquer ce comic comme lu - - + + Set as unread Marquer comme non-lu - + Set comic as unread Marquer ce comic comme non-lu - + Show/Hide marks Afficher/Cacher les marqueurs @@ -725,14 +734,14 @@ Afficher ou cacher les marqueurs pour les livres lus - + Library not available Library ' Librairie non disponible - - + + Fullscreen mode on/off Mode plein écran activé/désactivé @@ -741,12 +750,12 @@ Mode plein écran activé/désactivé (F) - + Help, About YACReader Aide, à propos de YACReader - + Select root node Allerà la racine @@ -755,7 +764,7 @@ + - + Expand all nodes Afficher tous les noeuds @@ -764,67 +773,65 @@ - - Colapse all nodes - Masquer tous les noeuds + Masquer tous les noeuds - + Show options dialog Ouvrir la boite de dialogue - + Show comics server options dialog Ouvrir la boite de dialogue du serveur - + Open folder... Ouvrir le dossier... - + Set as uncompleted - + Set as completed - + Open containing folder... Ouvrir le dossier... - + Reset comic rating - + Select all comics Sélectionner tous les comics - + Edit Editer - Asign current order to comics - Assigner l'ordre actuel à vos comics + Assigner l'ordre actuel à vos comics - + Update cover Mise à jour des couvertures - + Delete selected comics Supprimer le comics sélectionné @@ -833,343 +840,381 @@ Cacher le comic flow - + Download tags from Comic Vine - + Edit shortcuts - + Update folder - + Update current folder - + Add new reading list - + Add a new reading list to the current library - + Remove reading list - + Remove current reading list from the library - + Add new label - + Add a new label to this library - + Rename selected list - + Rename any selected labels or lists - + Add to... - + Favorites - + Add selected comics to favorites list - + Folder - + Comic - + Update needed Mise à jour requise - + This library was created with a previous version of YACReaderLibrary. It needs to be updated. Update now? Cette librairie a été créée avec une ancienne version de YACReaderLibrary. Mise à jour necessaire. Mettre à jour? - + Update failed Echec de la mise à jour - + The current library can't be udpated. Check for write write permissions on: Cette librairie ne peut pas être mise à jour. Vérifiez les droits d'accès: - + Download new version Téléchrger la nouvelle version - + This library was created with a newer version of YACReaderLibrary. Download the new version now? Cette librairie a été créée avec une version plus récente de YACReaderLibrary. Télécharger la nouvelle version? - + Library '%1' is no longer available. Do you want to remove it? La librarie '%1' n'est plus disponible. Voulez-vous la supprimer? - + Old library Ancienne librairie - + Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now? La librarie '%1' a été créée avec une ancienne version de YACReaderLibrary. Elle doit être re-créée. Voulez-vous créer la librairie? - - + + Copying comics... - - + + Moving comics... - + Folder name: - + No folder selected - + Please, select a folder first - + Error in path - + There was an error accessing the folder's path - + The selected folder and all its contents will be deleted from your disk. Are you sure? - + There was an issue trying to delete the selected folders. Please, check for write permissions and be sure that any applications are using these folders or any of the contained files. - + Add new reading lists - - + + List name: - + Delete list/label - + The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure? - + Rename list name - + Save covers - + + You are adding too many libraries. + + + + + You are adding too many libraries. + +You probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar. + +YACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low. + + + + YACReader not found - + YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary. - + Library not found Librairie introuvable - + The selected folder doesn't contain any library. Le dossier sélectionné ne contient aucune librairie. - + Are you sure? Êtes-vous sûr? - + Do you want remove Voulez-vous supprimer - + library? la librairie? - + Remove and delete metadata Supprimer les métadata - - + + Assign comics numbers + + + + + Assign numbers starting in: + + + + + Unable to delete - + Show or hide read marks - - + + Add new folder - + Add new folder to the current library - + + + Delete folder + + + + Delete current folder from disk - - + + Collapse all nodes + + + + + Change between comics views - + + Assign current order to comics + + + + There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder. - Asign comics numbers - Assigner les numéros aux comics + Assigner les numéros aux comics - Asign numbers starting in: - Assigner les numéros: + Assigner les numéros: - + Error creating the library Erreur lors de la création de la librairie - + Error updating the library Erreur lors de la mise à jour de la librairie - + Error opening the library Erreur lors de l'ouverture de la librairie - + Delete comics Supprimer les comics - + All the selected comics will be deleted from your disk. Are you sure? Tous les comics sélectionnés vont être supprimés de votre disque. Êtes-vous sûr? - + Remove comics - + Comics will only be deleted from the current label/list. Are you sure? - + Library name already exists Le nom de la librairie existe déjà - + There is another library with the name '%1'. Une autre librairie a le nom '%1'. @@ -1177,7 +1222,7 @@ LocalComicListModel - + file name @@ -1186,7 +1231,7 @@ NoLibrariesWidget - You don't have any librarires yet + You don't have any libraries yet Vous n'avez pas encore de librairie @@ -1234,7 +1279,7 @@ - Use selectec comic cover as background + Use selected comic cover as background @@ -1317,8 +1362,9 @@ - Genere: - Genre: + Genre: + Genere: + Genre: @@ -1520,22 +1566,22 @@ - + comics - + loading cover - + loading description - + description unavailable @@ -1548,22 +1594,22 @@ - + volumes - + loading cover - + loading description - + description unavailable @@ -1644,7 +1690,13 @@ Autoriser le serveur - + + display less information about folders in the browser +to improve the performance + + + + QR generator error! QR generator error! @@ -1662,22 +1714,22 @@ - + issues - + remove selected comics - + restore all removed comics - + restore removed comics @@ -1742,7 +1794,7 @@ VolumeComicsModel - + title @@ -1750,17 +1802,17 @@ VolumesModel - + year - + issues - + publisher @@ -1952,12 +2004,12 @@ YACReaderNavigationController - + No favorites - + You are not reading anything yet, come on!! diff --git a/YACReaderLibrary/yacreaderlibrary_nl.ts b/YACReaderLibrary/yacreaderlibrary_nl.ts index 4bdd9973..aa960f37 100644 --- a/YACReaderLibrary/yacreaderlibrary_nl.ts +++ b/YACReaderLibrary/yacreaderlibrary_nl.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -146,7 +146,7 @@ ClassicComicsView - + Hide comic flow Sluit de Omslagbrowser @@ -154,47 +154,47 @@ ComicModel - + yes Ja - + no neen - + Title Titel - + File Name Bestandsnaam - + Pages Pagina's - + Size Grootte(MB) - + Read Gelezen - + Current Page - + Rating @@ -202,68 +202,68 @@ ComicVineDialog - + skip - + back - + next - + search - + close - - - - - + + + + + Looking for volume... - - + + comic %1 of %2 - %3 - + %1 comics selected - + Error connecting to ComicVine - - + + Retrieving tags for : %1 - + Retrieving volume info... - + Looking for comic... @@ -329,12 +329,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -370,7 +370,8 @@ EmptyReadingListWidget - This reading list doesn't cotain comics yet + This reading list does not contain any comics yet + This reading list doesn't contain comics yet @@ -453,26 +454,34 @@ FileComic - + Unknown error opening the file - + 7z not found 7Z Archiefbestand niet gevonden - + Format not supported - + CRC error on page (%1): some of the pages will not be displayed correctly + + GridComicsView + + + Show info + + + HelpAboutDialog @@ -588,12 +597,12 @@ LibraryWindow - + YACReader Library YACReader Bibliotheek - + Library Bibliotheek @@ -602,121 +611,121 @@ <font color='white'>Druk op "F" om 'volledig scherm modus' te sluiten </font> - + Create a new library Maak een nieuwe Bibliotheek - + Open an existing library Open een bestaande Bibliotheek - - + + Export comics info Exporteren van strip info - - + + Import comics info Importeren van strip info - + Pack covers Inpakken strip voorbladen - + Pack the covers of the selected library Inpakken alle strip voorbladen van de geselecteerde Bibliotheek - + Unpack covers Uitpakken voorbladen - + Unpack a catalog Uitpaken van een catalogus - + Update library Bibliotheek bijwerken - + Update current library Huidige Bibliotheek bijwerken - + Rename library Bibliotheek hernoemen - + Rename current library Huidige Bibliotheek hernoemen - + Remove library Bibliotheek verwijderen - + Remove current library from your collection De huidige Bibliotheek verwijderen uit uw verzameling - + Open current comic Huidige strip openen - + Open current comic on YACReader Huidige strip openen in YACReader - + Save selected covers to... - + Save covers of the selected comics as JPG files - - + + Set as read Instellen als gelezen - + Set comic as read Strip Instellen als gelezen - - + + Set as unread Instellen als ongelezen - + Set comic as unread Strip Instellen als ongelezen - + Show/Hide marks Toon/Verberg markeringen @@ -725,14 +734,14 @@ Toon of Verberg gelezen markeringen - + Library not available Library ' Bibliotheek niet beschikbaar - - + + Fullscreen mode on/off Volledig scherm modus aan/of @@ -741,12 +750,12 @@ Volledig scherm modus aan/of (F) - + Help, About YACReader Help, Over YACReader - + Select root node Selecteer de hoofd categorie @@ -755,7 +764,7 @@ + - + Expand all nodes Alle categorieën uitklappen @@ -764,67 +773,65 @@ - - Colapse all nodes - Alle categorieën inklappen + Alle categorieën inklappen - + Show options dialog Toon opties dialoog - + Show comics server options dialog Toon strips-server opties dialoog - + Open folder... Map openen ... - + Set as uncompleted - + Set as completed - + Open containing folder... Open map ... - + Reset comic rating - + Select all comics Selecteer alle strips - + Edit Bewerken - Asign current order to comics - Nummeren van strips + Nummeren van strips - + Update cover Strip omslagen bijwerken - + Delete selected comics Geselecteerde strips verwijderen @@ -833,343 +840,381 @@ Sluit de Omslagbrowser - + Download tags from Comic Vine - + Edit shortcuts - + Update folder - + Update current folder - + Add new reading list - + Add a new reading list to the current library - + Remove reading list - + Remove current reading list from the library - + Add new label - + Add a new label to this library - + Rename selected list - + Rename any selected labels or lists - + Add to... - + Favorites - + Add selected comics to favorites list - + Folder - + Comic - + Update needed Bijwerken is nodig - + This library was created with a previous version of YACReaderLibrary. It needs to be updated. Update now? Deze bibliotheek is gemaakt met een vorige versie van YACReaderLibrary. Het moet worden bijgewerkt. Nu bijwerken? - + Update failed Bijwerken mislukt - + The current library can't be udpated. Check for write write permissions on: De huidige bibliotheek kan niet worden bijgewerkt. Controleer bij of u schrijfbevoegdheid hebt: - + Download new version Nieuwe versie ophalen - + This library was created with a newer version of YACReaderLibrary. Download the new version now? Deze bibliotheek is gemaakt met een nieuwere versie van YACReaderLibrary. Download de nieuwe versie? - + Library '%1' is no longer available. Do you want to remove it? Bibliotheek ' %1' is niet langer beschikbaar. Wilt u het verwijderen? - + Old library Oude Bibliotheek - + Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now? Bibliotheek ' %1' is gemaakt met een oudere versie van YACReaderLibrary. Zij moet opnieuw worden aangemaakt. Wilt u de bibliotheek nu aanmaken? - - + + Copying comics... - - + + Moving comics... - + Folder name: - + No folder selected - + Please, select a folder first - + Error in path - + There was an error accessing the folder's path - + The selected folder and all its contents will be deleted from your disk. Are you sure? - + There was an issue trying to delete the selected folders. Please, check for write permissions and be sure that any applications are using these folders or any of the contained files. - + Add new reading lists - - + + List name: - + Delete list/label - + The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure? - + Rename list name - + Save covers - + + You are adding too many libraries. + + + + + You are adding too many libraries. + +You probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar. + +YACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low. + + + + YACReader not found - + YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary. - + Library not found Bibliotheek niet gevonden - + The selected folder doesn't contain any library. De geselecteerde map bevat geen bibliotheek. - + Are you sure? Weet u het zeker? - + Do you want remove Wilt u verwijderen - + library? Bibliotheek? - + Remove and delete metadata Verwijder metagegevens - - + + Assign comics numbers + + + + + Assign numbers starting in: + + + + + Unable to delete - + Show or hide read marks - - + + Add new folder - + Add new folder to the current library - + + + Delete folder + + + + Delete current folder from disk - - + + Collapse all nodes + + + + + Change between comics views - + + Assign current order to comics + + + + There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder. - Asign comics numbers - Strips nummeren + Strips nummeren - Asign numbers starting in: - Strips nummeren beginnen bij: + Strips nummeren beginnen bij: - + Error creating the library Fout bij aanmaken Bibliotheek - + Error updating the library Fout bij bijwerken Bibliotheek - + Error opening the library Fout bij openen Bibliotheek - + Delete comics Strips verwijderen - + All the selected comics will be deleted from your disk. Are you sure? Alle geselecteerde strips worden verwijderd van uw schijf. Weet u het zeker? - + Remove comics - + Comics will only be deleted from the current label/list. Are you sure? - + Library name already exists Bibliotheek naam bestaat al - + There is another library with the name '%1'. Er is al een bibliotheek met de naam ' %1 '. @@ -1177,7 +1222,7 @@ LocalComicListModel - + file name @@ -1186,8 +1231,8 @@ NoLibrariesWidget - You don't have any librarires yet - Je hebt geen nog librarires + You don't have any libraries yet + Je hebt geen nog libraries @@ -1234,7 +1279,7 @@ - Use selectec comic cover as background + Use selected comic cover as background @@ -1317,7 +1362,8 @@ - Genere: + Genre: + Genere: Genre: @@ -1520,22 +1566,22 @@ - + comics - + loading cover - + loading description - + description unavailable @@ -1548,22 +1594,22 @@ - + volumes - + loading cover - + loading description - + description unavailable @@ -1644,7 +1690,13 @@ De server instellen - + + display less information about folders in the browser +to improve the performance + + + + QR generator error! QR generator fout! @@ -1662,22 +1714,22 @@ - + issues - + remove selected comics - + restore all removed comics - + restore removed comics @@ -1742,7 +1794,7 @@ VolumeComicsModel - + title @@ -1750,17 +1802,17 @@ VolumesModel - + year - + issues - + publisher @@ -1952,12 +2004,12 @@ YACReaderNavigationController - + No favorites - + You are not reading anything yet, come on!! diff --git a/YACReaderLibrary/yacreaderlibrary_pt.ts b/YACReaderLibrary/yacreaderlibrary_pt.ts index b757d226..9e70c4fa 100644 --- a/YACReaderLibrary/yacreaderlibrary_pt.ts +++ b/YACReaderLibrary/yacreaderlibrary_pt.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -146,7 +146,7 @@ ClassicComicsView - + Hide comic flow @@ -154,47 +154,47 @@ ComicModel - + yes - + no - + Title - + File Name - + Pages - + Size - + Read - + Current Page - + Rating @@ -202,68 +202,68 @@ ComicVineDialog - + skip - + back - + next - + search - + close - - - - - + + + + + Looking for volume... - - + + comic %1 of %2 - %3 - + %1 comics selected - + Error connecting to ComicVine - - + + Retrieving tags for : %1 - + Retrieving volume info... - + Looking for comic... @@ -329,12 +329,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -370,7 +370,8 @@ EmptyReadingListWidget - This reading list doesn't cotain comics yet + This reading list does not contain any comics yet + This reading list doesn't contain comics yet @@ -453,26 +454,34 @@ FileComic - + Unknown error opening the file - + 7z not found 7z não encontrado - + Format not supported - + CRC error on page (%1): some of the pages will not be displayed correctly + + GridComicsView + + + Show info + + + HelpAboutDialog @@ -594,122 +603,122 @@ <font color='white'> pressione 'F' para fechar o modo tela cheia </font> - + YACReader Library Biblioteca YACReader - + Create a new library Criar uma nova biblioteca - + Open an existing library Abrir uma biblioteca existente - - + + Export comics info - - + + Import comics info - + Pack covers - + Pack the covers of the selected library Pacote de capas da biblioteca selecionada - + Unpack covers - + Unpack a catalog Desempacotar um catálogo - + Update current library Atualizar biblioteca atual - + Rename library - + Rename current library Renomear biblioteca atual - + Remove current library from your collection Remover biblioteca atual da sua coleção - + Open current comic - + Open current comic on YACReader Abrir quadrinho atual no YACReader - + Save selected covers to... - + Save covers of the selected comics as JPG files - - + + Set as read - + Set comic as read - - + + Set as unread - + Set comic as unread - + Show/Hide marks - - + + Fullscreen mode on/off @@ -718,452 +727,476 @@ Modo tela cheia ligar/desligar (F) - + Help, About YACReader Ajuda, Sobre o YACReader - + Select root node Selecionar raiz - + Expand all nodes Expandir todos - Colapse all nodes - Contrair todos + Contrair todos - + Show options dialog Mostrar opções - + Show comics server options dialog - + Open folder... Abrir pasta... - + Set as uncompleted - + Set as completed - + Open containing folder... Abrir a pasta contendo... - + Reset comic rating - + Select all comics - + Edit - - Asign current order to comics - - - - + Update cover - + Delete selected comics - + Download tags from Comic Vine - + Folder - + Comic - + Library not available Library ' - + Old library - + YACReader not found - + YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary. - - + + Unable to delete - + There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder. - + + Assign comics numbers + + + + + Assign numbers starting in: + + + + Error creating the library - + Error updating the library - + Error opening the library - + Delete comics - + All the selected comics will be deleted from your disk. Are you sure? - + Remove comics - + Comics will only be deleted from the current label/list. Are you sure? - + Library name already exists - + There is another library with the name '%1'. - + Library Biblioteca - + Update library - + Remove library - + Show or hide read marks - - + + Add new folder - + Add new folder to the current library - + + + Delete folder + + + + Delete current folder from disk - - + + Collapse all nodes + + + + + Change between comics views - + + Assign current order to comics + + + + Edit shortcuts - + Update folder - + Update current folder - + Add new reading list - + Add a new reading list to the current library - + Remove reading list - + Remove current reading list from the library - + Add new label - + Add a new label to this library - + Rename selected list - + Rename any selected labels or lists - + Add to... - + Favorites - + Add selected comics to favorites list - + Update needed - + This library was created with a previous version of YACReaderLibrary. It needs to be updated. Update now? - + Update failed - + The current library can't be udpated. Check for write write permissions on: - + Download new version - + This library was created with a newer version of YACReaderLibrary. Download the new version now? - + Library '%1' is no longer available. Do you want to remove it? - + Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now? - - + + Copying comics... - - + + Moving comics... - + Folder name: - + No folder selected - + Please, select a folder first - + Error in path - + There was an error accessing the folder's path - + The selected folder and all its contents will be deleted from your disk. Are you sure? - + There was an issue trying to delete the selected folders. Please, check for write permissions and be sure that any applications are using these folders or any of the contained files. - + Add new reading lists - - + + List name: - + Delete list/label - + The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure? - + Rename list name - + Save covers - + + You are adding too many libraries. + + + + + You are adding too many libraries. + +You probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar. + +YACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low. + + + + Library not found - + The selected folder doesn't contain any library. - + Are you sure? Você tem certeza? - + library? - + Remove and delete metadata - + Do you want remove Você deseja remover - - - Asign comics numbers - - - - - Asign numbers starting in: - - LocalComicListModel - + file name @@ -1172,7 +1205,7 @@ NoLibrariesWidget - You don't have any librarires yet + You don't have any libraries yet @@ -1220,7 +1253,7 @@ - Use selectec comic cover as background + Use selected comic cover as background @@ -1303,7 +1336,8 @@ - Genere: + Genre: + Genere: @@ -1506,22 +1540,22 @@ - + comics - + loading cover - + loading description - + description unavailable @@ -1534,22 +1568,22 @@ - + volumes - + loading cover - + loading description - + description unavailable @@ -1610,7 +1644,13 @@ - + + display less information about folders in the browser +to improve the performance + + + + QR generator error! @@ -1628,22 +1668,22 @@ - + issues - + remove selected comics - + restore all removed comics - + restore removed comics @@ -1677,7 +1717,7 @@ VolumeComicsModel - + title @@ -1685,17 +1725,17 @@ VolumesModel - + year - + issues - + publisher @@ -1887,12 +1927,12 @@ YACReaderNavigationController - + No favorites - + You are not reading anything yet, come on!! diff --git a/YACReaderLibrary/yacreaderlibrary_ru.ts b/YACReaderLibrary/yacreaderlibrary_ru.ts index dbc6a422..1e7158c1 100644 --- a/YACReaderLibrary/yacreaderlibrary_ru.ts +++ b/YACReaderLibrary/yacreaderlibrary_ru.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -14,82 +14,82 @@ Label name: - + Название ярлыка: Choose a color: - + Выбрать цвет: red - + красный orange - + оранжевый yellow - + желтый green - + зеленый cyan - + голубой blue - + синий violet - + фиолетовый purple - + пурпурный pink - + розовый white - + белый light - + серый dark - + темный accept - + добавить cancel - + отменить @@ -97,12 +97,12 @@ Comics folder : - Папка комиксов: + Папка комиксов : Library Name : - Имя библиотеки: + Имя библиотеки : @@ -125,147 +125,147 @@ Before you can connect to Comic Vine, you need your own API key. Please, get one free <a href="http://www.comicvine.com/api/">here</a> - + Для подключения к Comic Vine вам потребуется ваш личный API ключ. Приобретите его бесплатно вот <a href="http://www.comicvine.com/api/">здесь</a> Paste here your Comic Vine API key - + Вставьте сюда ваш Comic Vine API ключ Accept - + Принять Cancel - + Отмена ClassicComicsView - + Hide comic flow - Не показывать поток комиксов + Не показывать поток комиксов ComicModel - + yes - + да - + no - + нет - + Title - Заголовок + Заголовок - + File Name - Имя файла + Имя файла - + Pages - Страницы + Страницы - + Size - + Размер - + Read - + Current Page - + Текущая страница - + Rating - + Рейтинг ComicVineDialog - - - skip - - - - - back - - - - - next - - - search - + skip + пропустить + back + назад + + + + next + дальше + + + + search + искать + + + close - + закрыть - - - - - + + + + + Looking for volume... - + Поиск информации... - - + + comic %1 of %2 - %3 - + комикс %1 of %2 - %3 - + %1 comics selected - + %1 было выбрано - + Error connecting to ComicVine - + Ошибка поключения к ComicVine - - + + Retrieving tags for : %1 - + Получение тегов для : %1 - + Retrieving volume info... - + Получение информации... - + Looking for comic... - + Поиск комикса... @@ -316,7 +316,7 @@ Restore defaults - + Вернуть к первоначальным значениям @@ -329,12 +329,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -345,17 +345,17 @@ Subfolders in this folder - + Подпапки в этой папке Empty folder - + Пустая папка Drag and drop folders and comics here - + Перетащите папки и комиксы сюда @@ -363,15 +363,16 @@ This label doesn't contain comics yet - + Этот ярлык пока ничего не содержит EmptyReadingListWidget - This reading list doesn't cotain comics yet - + This reading list does not contain any comics yet + This reading list doesn't contain comics yet + Этот список чтения пока ничего не содержит @@ -453,26 +454,34 @@ FileComic - + Unknown error opening the file - + Неизвестная ошибка при открытии файла - + 7z not found - 7z не найден + 7z не найден - + Format not supported - + Формат не поддерживается - + CRC error on page (%1): some of the pages will not be displayed correctly + + GridComicsView + + + Show info + Показать информацию + + HelpAboutDialog @@ -549,7 +558,7 @@ Compresed library covers (*.clc) - Сжатая библиотека обложек + Сжатая библиотека обложек (*.clc) @@ -557,40 +566,40 @@ Importing comics - + Импорт комиксов stop - + остановить Some of the comics being added... - + Некоторые из комиксов добавляются... <p>YACReaderLibrary is now creating a new library.</p><p>Create a library could take several minutes. You can stop the process and update the library later for completing the task.</p> Create a library could take several minutes. You can stop the process and update the library later for completing the task. - Создание библиотеки может занять несколько минут. Вы можете остановить процесс и обновить библиотеку позже для завершения задачи. + <p>YACReaderLibrary сейчас создает библиотеку.</p><p> Создание библиотеки может занять несколько минут. Вы можете остановить процесс и обновить библиотеку позже для завершения задачи.</p> Updating the library - + Обновление библиотеки <p>The current library is being updated. For faster updates, please, update your libraries frequently.</p><p>You can stop the process and continue updating this library later.</p> <p>The current library is being updated. For faster updates, please, update your libraries frequently.</p><p>You can stop the process and continue updating this library later. - + <p>Текущая библиотека обновляется. Для более быстрого обновления в дальнейшем старайтесь почаще обновлять вашу библиотеку после добавления новых комиксов.</p><p>Вы можете остановить этот процесс и продолжить обновление этой библиотеки позже.</p> LibraryWindow - + YACReader Library Библиотека YACReader @@ -599,585 +608,618 @@ <font color='white'> нажмите 'F' чтобы выйте из Полноэкранного режима </font> - + Create a new library Создать новую библиотеку - + Open an existing library Открыть существующую библиотеку - - + + Export comics info - Експорт комикса + Экспорт комикса - - + + Import comics info Импорт комикса - + Pack covers - Запакавать обложки + Запаковать обложки - + Pack the covers of the selected library - Запакавать обложки выбранной библиотеки + Запаковать обложки выбранной библиотеки - + Unpack covers - Распокавать обложки + Распаковать обложки - + Unpack a catalog - Распакавать каталог + Распаковать каталог - + Update library - Обновить библиотеку + Обновить библиотеку - + Update current library Обновить текущую библиотеку - + Rename library - + Переименовать библиотеку - + Rename current library - Переименовать текущую бибилиотеку + Переименовать текущую библиотеку - + Remove current library from your collection Удалите текущую библиотеку из своей коллекции - + Open current comic - + Открыть выбранный комикс - + Open current comic on YACReader - + Открыть выбранный комикс в YACReader - + Save selected covers to... - + Сохранить выбранные обложки в... - + Save covers of the selected comics as JPG files - + Сохранить обложки выбранных комиксов как JPG файлы - - + + Set as read - + Отметить как прочитано - + Set comic as read - + Отметить комикс как прочитано - - + + Set as unread - + Отметить как не прочитано - + Set comic as unread - + Отметить комикс как не прочитано - + Show/Hide marks - + Показать/Спрятать пометки - - + + Fullscreen mode on/off - Полноекранный режим включить/выключить + Полноэкранный режим включить/выключить Fullscreen mode on/off (F) полноекранный режим включить/выключить(F) - + Help, About YACReader - Справка, о программе YACReader + О программе - + Select root node - + Домашняя папка - + Expand all nodes - + Раскрыть все папки - - Colapse all nodes - - - - + Show options dialog - Показать настройки диаога + Настройки - + Show comics server options dialog - + Настройки сервера YACReader - + Open folder... Открыть папку... - + Set as uncompleted - + Отметить как не завершено - + Set as completed - + Отметить как завершено - + Open containing folder... - + Открыть содержащую папку... - + Reset comic rating - + Сбросить рейтинг комикса - + Select all comics Выбрать все комиксы - + Edit Редактировать - - Asign current order to comics - - - - + Update cover Обновить обложки - + Delete selected comics - + Удалить выбранные комиксы Hide comic flow Не показывать поток комиксов - + Download tags from Comic Vine - + Скачать теги из Comic Vine - + Folder - + Папка - + Comic - + Комикс - + Library not available Library ' - Библиотека не доступна + Библиотека не доступна - + Library '%1' is no longer available. Do you want to remove it? - + Библиотека '%1' больше не доступна. Вы хотите удалить ее? - + Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now? - + Библиотека '%1' была создана старой версией YACReaderLibrary. Она должна быть вновь создана. Вы хотите создать библиотеку сейчас? - + Old library - + YACReader not found - + YACReader не найден - + YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary. - + YACReader не найден, YACReader должен быть установлен в ту же папку что и YACReaderLibrary. - - + + Unable to delete - + Не удалось удалить - + There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder. + Возникла проблема при удалении выбранных комиксов. Пожалуйста, проверьте права на запись для выбранных файлов или содержащую их папку. + + + + Assign comics numbers - + + Assign numbers starting in: + + + + Error creating the library - + Ошибка создания библиотеки - + Error updating the library - + Ошибка обновления библиотеки - + Error opening the library - + Ошибка открытия библиотеки - + Delete comics - + Удалить комиксы - + All the selected comics will be deleted from your disk. Are you sure? - + Все выбранные комиксы будут удалены с вашего жёсткого диска. Вы уверены? - + Remove comics - + Comics will only be deleted from the current label/list. Are you sure? - + Комиксы будут удалены только из выбранного списка/ярлыка. Вы уверены? - + Library name already exists - + Имя папки уже используется - + There is another library with the name '%1'. - + Уже существует другая папка с именем '%1'. - + Library Библиотека - + Remove library - + Удалить библиотеку - + Show or hide read marks - + Показать или спрятать отметку прочтено - - + + Add new folder - + Добавить новую папку - + Add new folder to the current library - + Добавить новую папку в текущую библиотеку - + + + Delete folder + Удалить папку + + + Delete current folder from disk - + Удалить выбранную папку с жёсткого диска - - + + Collapse all nodes + Свернуть все папки + + + + Change between comics views + Может нужно поменять на другое выражение. + Изменение вида обзора комиксов + + + + Assign current order to comics - + Edit shortcuts - + Update folder - + Обновить папку - + Update current folder - + Обновить выбранную папку - + Add new reading list - + Создать новый список чтения - + Add a new reading list to the current library - + Создать новый список чтения в текущей библиотеке - + Remove reading list - + Удалить список чтения - + Remove current reading list from the library - + Удалить выбранный список чтения из библиотеки - + Add new label - + Создать новый ярлык - + Add a new label to this library - + Создать новый ярлык в этой библиотеке - + Rename selected list - + Переименовать выбранный список - + Rename any selected labels or lists - + Переименовать выбранный ярлык или список - + Add to... - + Добавить в... - + Favorites - + Избранное - + Add selected comics to favorites list - + Добавить выбранные комиксы в список избранного - + Update needed Необходимо обновление - + This library was created with a previous version of YACReaderLibrary. It needs to be updated. Update now? Эта библиотека была создана с предыдущей версией YACReaderLibrary. Она должна быть обновлена. Обновить сейчас? - + Update failed - Обновить неудалось + Обновить не удалось - + The current library can't be udpated. Check for write write permissions on: - В настоящее время библиотека не может быть обновлена. Проверьте права на чтение/запись: + В настоящее время библиотека не может быть обновлена. Проверьте права на чтение/запись: - + Download new version Загрузить новую версию - + This library was created with a newer version of YACReaderLibrary. Download the new version now? - Эта библиотека был создан при новой версией YACReaderLibrary. Скачать новую версию сейчас? + Эта библиотека была создана новой версией YACReaderLibrary. Скачать новую версию сейчас? - - + + Copying comics... - + Скопировать комиксы... - - + + Moving comics... - + Переместить комиксы... - + Folder name: - + Имя папки: - + No folder selected - + Ни одна папка не была выбрана - + Please, select a folder first - + Пожалуйста, сначала выберите папку - + Error in path - + Ошибка в пути - + There was an error accessing the folder's path - + Ошибка доступа к пути папки - + The selected folder and all its contents will be deleted from your disk. Are you sure? - + Выбранная папка и все ее содержимое будет удалено с вашего жёсткого диска. Вы уверены? - + There was an issue trying to delete the selected folders. Please, check for write permissions and be sure that any applications are using these folders or any of the contained files. - + Возникла проблема при удалении выбранных папок. Пожалуйста, проверьте права на запись и убедитесь что другие приложения не используют эти папки или файлы. - + Add new reading lists - + Добавить новый список чтения - - + + List name: - + Имя списка: - + Delete list/label - + Удалить список/ярлык - + The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure? - + Выбранные элементы будут удалены, ваши комиксы или папки НЕ БУДУТ удалены с вашего жёсткого диска. Вы уверены? - + Rename list name - + Изменить имя списка - + Save covers - + Сохранить обложки - + + You are adding too many libraries. + Вы добавляете слишком много библиотек. + + + + You are adding too many libraries. + +You probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar. + +YACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low. + Вы добавляете слишком много библиотек. + +Вероятно, вам нужна только одна библиотека в папке комиксов верхнего уровня, вы можете просматривать любые подпапки, используя раздел папок на левой боковой панели. + +YACReaderLibrary не помешает вам создать больше библиотек, но вы должны иметь не большое количество библиотек. + + + Library not found Библиотека не найдена - + The selected folder doesn't contain any library. Выбранная папка не содержит библиотеку. - + Are you sure? Вы уверены? - + library? - + библиотека? - + Remove and delete metadata - + Удаление метаданных - + Do you want remove - Вы хотите удалить + Вы хотите удалить - Asign comics numbers - Назначение номеров комикса + Назначение номеров комикса - Asign numbers starting in: - Назначьте номера, начинающиеся на: + Назначьте номера, начинающиеся на: LocalComicListModel - + file name - + имя файла NoLibrariesWidget - You don't have any librarires yet - + You don't have any libraries yet + У вас нет ни одной библиотеки @@ -1187,12 +1229,12 @@ create your first library - + создайте свою первую библиотеку add an existing one - + добавить уже существующую @@ -1200,31 +1242,31 @@ Edit Comic Vine API key - + Редактировать Comic Vine API ключ Comic Vine API key - + Comic Vine API ключ Enable background image - + Включить фоновое изображение Opacity level - + Уровень непрозрачности Blur level - + Eровень размытия - Use selectec comic cover as background + Use selected comic cover as background @@ -1250,7 +1292,7 @@ General - + Основные @@ -1307,7 +1349,8 @@ - Genere: + Genre: + Genere: @@ -1462,18 +1505,18 @@ Number of volumes found : %1 - + Количество найденных томов : %1 page %1 of %2 - + страница %1 из %2 Number of %1 found : %2 - + Количество из %1 найдено : %2 @@ -1481,7 +1524,7 @@ Please provide some additional information. - + Пожалуйста, введите инфомарцию для поиска. @@ -1510,22 +1553,22 @@ - + comics - + loading cover - + loading description - + description unavailable @@ -1538,22 +1581,22 @@ - + volumes - + loading cover - + loading description - + description unavailable @@ -1581,7 +1624,7 @@ set port - + указать порт @@ -1601,7 +1644,7 @@ Choose an IP address - + Выбрать IP адрес @@ -1611,10 +1654,16 @@ enable the server + активировать сервер + + + + display less information about folders in the browser +to improve the performance - + QR generator error! Ошибка QR генератора! @@ -1632,22 +1681,22 @@ - + issues - + remove selected comics - + restore all removed comics - + restore removed comics @@ -1696,7 +1745,7 @@ VolumeComicsModel - + title @@ -1704,19 +1753,19 @@ VolumesModel - + year - + год - + issues - + publisher - + издатель @@ -1772,7 +1821,7 @@ CoverFlow look - Предосмотр обложки + Предпросмотр обложки @@ -1906,14 +1955,14 @@ YACReaderNavigationController - + No favorites - + Нет избранного - + You are not reading anything yet, come on!! - + Вы пока ничего не читаете. Может самое время почитать? @@ -1949,7 +1998,7 @@ type to search - + начать поиск @@ -1957,32 +2006,32 @@ Libraries - + Библиотеки Folders - + Папки Reading Lists - + Списки чтения LIBRARIES - + БИБЛИОТЕКИ FOLDERS - + ПАПКИ READING LISTS - + СПИСКИ ЧТЕНИЯ diff --git a/YACReaderLibrary/yacreaderlibrary_source.ts b/YACReaderLibrary/yacreaderlibrary_source.ts index 00caa717..aaed3139 100644 --- a/YACReaderLibrary/yacreaderlibrary_source.ts +++ b/YACReaderLibrary/yacreaderlibrary_source.ts @@ -4,7 +4,7 @@ ActionsShortcutsModel - + None @@ -146,7 +146,7 @@ ClassicComicsView - + Hide comic flow @@ -154,47 +154,47 @@ ComicModel - + yes - + no - + Title - + File Name - + Pages - + Size - + Read - + Current Page - + Rating @@ -202,68 +202,68 @@ ComicVineDialog - + skip - + back - + next - + search - + close - - - - - + + + + + Looking for volume... - - + + comic %1 of %2 - %3 - + %1 comics selected - + Error connecting to ComicVine - - + + Retrieving tags for : %1 - + Retrieving volume info... - + Looking for comic... @@ -329,12 +329,12 @@ - + Shortcut in use - + The shortcut "%1" is already assigned to other function @@ -370,7 +370,8 @@ EmptyReadingListWidget - This reading list doesn't cotain comics yet + This reading list does not contain any comics yet + This reading list doesn't contain any comics yet @@ -453,26 +454,34 @@ FileComic - + CRC error on page (%1): some of the pages will not be displayed correctly - + Unknown error opening the file - + 7z not found - + Format not supported + + GridComicsView + + + Show info + + + HelpAboutDialog @@ -588,564 +597,584 @@ LibraryWindow - + YACReader Library - + Library - + Create a new library - + Open an existing library - - + + Export comics info - - + + Import comics info - + Pack covers - + Pack the covers of the selected library - + Unpack covers - + Unpack a catalog - + Update library - + Update current library - + Rename library - + Rename current library - + Remove library - + Remove current library from your collection - + Open current comic - + Open current comic on YACReader - + Save selected covers to... - + Save covers of the selected comics as JPG files - - + + Set as read - + Set comic as read - - + + Set as unread - + Set comic as unread - + Show/Hide marks - + + Collapse all nodes + + + + + Assign current order to comics + + + + Library not available Library ' - - + + Fullscreen mode on/off - + Help, About YACReader - + + + Delete folder + + + + Select root node - + Expand all nodes - - Colapse all nodes - - - - + Show options dialog - + Show comics server options dialog - + Open folder... - + Set as uncompleted - + Set as completed - + Open containing folder... - + Reset comic rating - + Select all comics - + Edit - - Asign current order to comics - - - - + Update cover - + Delete selected comics - + Download tags from Comic Vine - + Edit shortcuts - + Update folder - + Update current folder - + Add new reading list - + Add a new reading list to the current library - + Remove reading list - + Remove current reading list from the library - + Add new label - + Add a new label to this library - + Rename selected list - + Rename any selected labels or lists - + Add to... - + Favorites - + Add selected comics to favorites list - + Folder - + Comic - + Update needed - + This library was created with a previous version of YACReaderLibrary. It needs to be updated. Update now? - + Update failed - + The current library can't be udpated. Check for write write permissions on: - + Download new version - + This library was created with a newer version of YACReaderLibrary. Download the new version now? - + Library '%1' is no longer available. Do you want to remove it? - + Old library - + Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now? - - + + Copying comics... - - + + Moving comics... - + Folder name: - + No folder selected - + Please, select a folder first - + Error in path - + There was an error accessing the folder's path - + The selected folder and all its contents will be deleted from your disk. Are you sure? - + There was an issue trying to delete the selected folders. Please, check for write permissions and be sure that any applications are using these folders or any of the contained files. - + Add new reading lists - - + + List name: - + Delete list/label - + The selected item will be deleted, your comics or folders will NOT be deleted from your disk. Are you sure? - + Rename list name - + Save covers - + + You are adding too many libraries. + + + + + You are adding too many libraries. + +You probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar. + +YACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low. + + + + YACReader not found - + YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary. - + Library not found - + The selected folder doesn't contain any library. - + Are you sure? - + Do you want remove - + library? - + Remove and delete metadata - - + + Assign comics numbers + + + + + Assign numbers starting in: + + + + + Unable to delete - + Show or hide read marks - - + + Add new folder - + Add new folder to the current library - + Delete current folder from disk - - + + Change between comics views - + There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder. - - Asign comics numbers - - - - - Asign numbers starting in: - - - - + Error creating the library - + Error updating the library - + Error opening the library - + Delete comics - + All the selected comics will be deleted from your disk. Are you sure? - + Remove comics - + Comics will only be deleted from the current label/list. Are you sure? - + Library name already exists - + There is another library with the name '%1'. @@ -1153,7 +1182,7 @@ LocalComicListModel - + file name @@ -1162,7 +1191,7 @@ NoLibrariesWidget - You don't have any librarires yet + You don't have any libraries yet @@ -1210,7 +1239,7 @@ - Use selectec comic cover as background + Use selected comic cover as background @@ -1293,7 +1322,8 @@ - Genere: + Genre: + Genere: @@ -1496,22 +1526,22 @@ - + comics - + loading cover - + loading description - + description unavailable @@ -1524,22 +1554,22 @@ - + volumes - + loading cover - + loading description - + description unavailable @@ -1600,7 +1630,13 @@ - + + display less information about folders in the browser +to improve the performance + + + + QR generator error! @@ -1618,22 +1654,22 @@ - + issues - + remove selected comics - + restore all removed comics - + restore removed comics @@ -1667,7 +1703,7 @@ VolumeComicsModel - + title @@ -1675,17 +1711,17 @@ VolumesModel - + year - + issues - + publisher @@ -1877,12 +1913,12 @@ YACReaderNavigationController - + No favorites - + You are not reading anything yet, come on!! diff --git a/YACReaderLibrary/yacreaderlibrary_tr.ts b/YACReaderLibrary/yacreaderlibrary_tr.ts index 5eb4b9f0..6fa5410a 100644 --- a/YACReaderLibrary/yacreaderlibrary_tr.ts +++ b/YACReaderLibrary/yacreaderlibrary_tr.ts @@ -297,7 +297,7 @@ EmptyReadingListWidget - This reading list doesn't cotain comics yet + This reading list does not contain any comics yet @@ -426,6 +426,13 @@ + + GridComicsView + + Show info + + + HelpAboutDialog @@ -547,7 +554,7 @@ Asign current order to comics - Asignar el orden actual a los cómics + Asignar el orden actual a los cómics Error opening the library @@ -660,7 +667,7 @@ Asign comics numbers - Çizgi roman numaralarını değiştir + Çizgi roman numaralarını değiştir Delete selected comics @@ -696,7 +703,7 @@ Colapse all nodes - Tüm düğümleri daralt + Tüm düğümleri daralt YACReader Library @@ -732,7 +739,7 @@ Asign numbers starting in: - Başlangıç sayılarını düzenle: + Başlangıç sayılarını düzenle: Download new version @@ -1014,6 +1021,34 @@ Comics will only be deleted from the current label/list. Are you sure? + + You are adding too many libraries. + + + + You are adding too many libraries. + +You probably only need one library in your top level comics folder, you can browse any subfolders using the folders section in the left sidebar. + +YACReaderLibrary will not stop you from creating more libraries but you should keep the number of libraries low. + + + + Collapse all nodes + + + + Assign current order to comics + + + + Assign comics numbers + + + + Assign numbers starting in: + + LocalComicListModel @@ -1029,7 +1064,7 @@ İlk kütüphaneni oluştur - You don't have any librarires yet + You don't have any libraries yet Henüz bir kütüphaneye sahip değilsin @@ -1068,7 +1103,7 @@ - Use selectec comic cover as background + Use selected comic cover as background @@ -1212,7 +1247,7 @@ Genere: - Tür: + Tür: Letterer(s): @@ -1222,6 +1257,10 @@ Comic Vine link: <a style='color: #FFCB00; text-decoration:none; font-weight:bold;' href="http://www.comicvine.com/comic/4000-%1/"> view </a> + + Genre: + + QObject @@ -1405,6 +1444,11 @@ Choose an IP address + + display less information about folders in the browser +to improve the performance + + SortVolumeComics diff --git a/YACReaderLibraryServer/YACReaderLibraryServer.pro b/YACReaderLibraryServer/YACReaderLibraryServer.pro index b6673d2b..48ccda01 100644 --- a/YACReaderLibraryServer/YACReaderLibraryServer.pro +++ b/YACReaderLibraryServer/YACReaderLibraryServer.pro @@ -1,162 +1,161 @@ -###################################################################### -# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008 -###################################################################### - -TEMPLATE = app -TARGET = YACReaderLibraryServer -CONFIG += console -DEPENDPATH += ../YACReaderLibrary -INCLUDEPATH += ../YACReaderLibrary -INCLUDEPATH += ../common \ - ../YACReaderLibrary/server \ - ../YACReaderLibrary/db - -DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY QT_NO_DEBUG_OUTPUT -QMAKE_MAC_SDK = macosx10.11 -#load default build flags -#do a basic dependency check -include(headless_config.pri) - -win32 { - LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32 - LIBS += -lpoppler-qt5 - INCLUDEPATH += ../dependencies/poppler/include/qt5 - - QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL - QMAKE_LFLAGS_RELEASE += /LTCG - CONFIG -= embed_manifest_exe -} - -unix:!macx{ -INCLUDEPATH += /usr/include/poppler/qt5 -LIBS += -L/usr/lib -lpoppler-qt5 -} - -macx{ -LIBS += -framework Foundation -framework ApplicationServices -framework AppKit - -OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm -HEADERS += $$PWD/../common/pdf_comic.h -CONFIG += objective_c -} - -unix{ -CONFIG += c++11 -} - -#CONFIG += release -CONFIG -= flat -QT += core sql network - -# Input -HEADERS += ../YACReaderLibrary/library_creator.h \ - ../YACReaderLibrary/package_manager.h \ - ../YACReaderLibrary/bundle_creator.h \ - ../YACReaderLibrary/db_helper.h \ - ../YACReaderLibrary/db/data_base_management.h \ - ../common/comic_db.h \ - ../common/folder.h \ - ../common/library_item.h \ - ../common/comic.h \ - ../common/bookmarks.h \ - ../common/qnaturalsorting.h \ - ../common/yacreader_global.h \ - ../YACReaderLibrary/yacreader_local_server.h \ - ../YACReaderLibrary/comics_remover.h \ - ../common/http_worker.h \ - ../YACReaderLibrary/yacreader_libraries.h \ - ../YACReaderLibrary/comic_files_manager.h \ - console_ui_library_creator.h - - -SOURCES += ../YACReaderLibrary/library_creator.cpp \ - ../YACReaderLibrary/package_manager.cpp \ - ../YACReaderLibrary/bundle_creator.cpp \ - ../YACReaderLibrary/db_helper.cpp \ - ../YACReaderLibrary/db/data_base_management.cpp \ - ../common/comic_db.cpp \ - ../common/folder.cpp \ - ../common/library_item.cpp \ - ../common/comic.cpp \ - ../common/bookmarks.cpp \ - ../common/qnaturalsorting.cpp \ - ../YACReaderLibrary/yacreader_local_server.cpp \ - ../YACReaderLibrary/comics_remover.cpp \ - ../common/http_worker.cpp \ - ../common/yacreader_global.cpp \ - ../YACReaderLibrary/yacreader_libraries.cpp \ - ../YACReaderLibrary/comic_files_manager.cpp \ - console_ui_library_creator.cpp \ - main.cpp - - - -include(../YACReaderLibrary/server/server.pri) -CONFIG(7zip){ -include(../compressed_archive/wrapper.pri) -} else:CONFIG(unarr) { -include(../compressed_archive/unarr/unarr-wrapper.pri) -} else { - error(No compression backend specified. Did you mess with the build system?) -} -include(../QsLog/QsLog.pri) - - -TRANSLATIONS = yacreaderlibraryserver_es.ts \ - yacreaderlibraryserver_ru.ts \ - yacreaderlibraryserver_pt.ts \ - yacreaderlibraryserver_fr.ts \ - yacreaderlibraryserver_nl.ts \ - yacreaderlibraryserver_tr.ts \ - yacreaderlibraryserver_de.ts \ - yacreaderlibraryserver_source.ts - - -RESOURCES += images.qrc - - -Release:DESTDIR = ../release -Debug:DESTDIR = ../debug - - -unix:!macx { -#set install prefix if it's empty -isEmpty(PREFIX) { - PREFIX = /usr -} - -BINDIR = $$PREFIX/bin -LIBDIR = $$PREFIX/lib -DATADIR = $$PREFIX/share - -DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" - -#MAKE INSTALL -CONFIG(server_standalone) { - INSTALLS += bin server translation -} -else:CONFIG(server_bundled) { - INSTALLS += bin -} -else { - INSTALLS += bin server translation - message("No build type specified. Defaulting to standalone server build (CONFIG+=server_standalone).") - message("If you wish to run YACReaderLibraryServer on a system with an existing install of YACReaderLibrary, please specify CONFIG+=server_bundled as an option when running qmake.") -} - -bin.path = $$BINDIR -isEmpty(DESTDIR) { - bin.files = YACReaderLibraryServer -} else { - bin.files = $$DESTDIR/YACReaderLibraryServer -} - -server.path = $$DATADIR/yacreader -server.files = ../release/server - -translation.path = $$DATADIR/yacreader/languages -translation.files = ../release/languages/yacreaderlibrary_* - -#manpage.path = $$DATADIR/man/man1 -#manpage.files = ../YACReaderLibrary.1 -} +TEMPLATE = app +TARGET = YACReaderLibraryServer + +QMAKE_TARGET_BUNDLE_PREFIX = "com.yacreader" + +CONFIG += console +DEPENDPATH += ../YACReaderLibrary +INCLUDEPATH += ../YACReaderLibrary \ + ../common \ + ../YACReaderLibrary/server \ + ../YACReaderLibrary/db + +DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY QT_NO_DEBUG_OUTPUT +QMAKE_MAC_SDK = macosx10.12 +# load default build flags +# do a basic dependency check +include(headless_config.pri) +include(../dependencies/pdf_backend.pri) + +win32 { + LIBS += -loleaut32 -lole32 -lshell32 -luser32 + QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL + QMAKE_LFLAGS_RELEASE += /LTCG + CONFIG -= embed_manifest_exe +} + +macx { + LIBS += -framework Foundation -framework ApplicationServices -framework AppKit + CONFIG += objective_c +} + +unix { + CONFIG += c++11 +} + +unix:haiku { + DEFINES += _BSD_SOURCE + LIBS += -lnetwork -lbsd +} + +#CONFIG += release +CONFIG -= flat +QT += core sql network + +# Source files +HEADERS += ../YACReaderLibrary/library_creator.h \ + ../YACReaderLibrary/package_manager.h \ + ../YACReaderLibrary/bundle_creator.h \ + ../YACReaderLibrary/db_helper.h \ + ../YACReaderLibrary/db/data_base_management.h \ + ../common/comic_db.h \ + ../common/folder.h \ + ../common/library_item.h \ + ../common/comic.h \ + ../common/pdf_comic.h \ + ../common/bookmarks.h \ + ../common/qnaturalsorting.h \ + ../common/yacreader_global.h \ + ../YACReaderLibrary/yacreader_local_server.h \ + ../YACReaderLibrary/comics_remover.h \ + ../common/http_worker.h \ + ../YACReaderLibrary/yacreader_libraries.h \ + ../YACReaderLibrary/comic_files_manager.h \ + console_ui_library_creator.h + + +SOURCES += ../YACReaderLibrary/library_creator.cpp \ + ../YACReaderLibrary/package_manager.cpp \ + ../YACReaderLibrary/bundle_creator.cpp \ + ../YACReaderLibrary/db_helper.cpp \ + ../YACReaderLibrary/db/data_base_management.cpp \ + ../common/comic_db.cpp \ + ../common/folder.cpp \ + ../common/library_item.cpp \ + ../common/comic.cpp \ + ../common/bookmarks.cpp \ + ../common/qnaturalsorting.cpp \ + ../YACReaderLibrary/yacreader_local_server.cpp \ + ../YACReaderLibrary/comics_remover.cpp \ + ../common/http_worker.cpp \ + ../common/yacreader_global.cpp \ + ../YACReaderLibrary/yacreader_libraries.cpp \ + ../YACReaderLibrary/comic_files_manager.cpp \ + console_ui_library_creator.cpp \ + main.cpp + +include(../YACReaderLibrary/server/server.pri) +CONFIG(7zip) { +include(../compressed_archive/wrapper.pri) +} else:CONFIG(unarr) { +include(../compressed_archive/unarr/unarr-wrapper.pri) +} else { + error(No compression backend specified. Did you mess with the build system?) +} +include(../QsLog/QsLog.pri) + +TRANSLATIONS = yacreaderlibraryserver_es.ts \ + yacreaderlibraryserver_ru.ts \ + yacreaderlibraryserver_pt.ts \ + yacreaderlibraryserver_fr.ts \ + yacreaderlibraryserver_nl.ts \ + yacreaderlibraryserver_tr.ts \ + yacreaderlibraryserver_de.ts \ + yacreaderlibraryserver_source.ts + +RESOURCES += images.qrc + +contains(QMAKE_TARGET.arch, x86_64) { + Release:DESTDIR = ../release64 + Debug:DESTDIR = ../debug64 +} else { + Release:DESTDIR = ../release + Debug:DESTDIR = ../debug +} + +unix:!macx { +#set install prefix if it's empty +isEmpty(PREFIX) { + PREFIX = /usr +} + +BINDIR = $$PREFIX/bin +LIBDIR = $$PREFIX/lib +DATADIR = $$PREFIX/share + +DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" + +#make install +CONFIG(server_standalone) { + INSTALLS += bin server translation systemd +} +else:CONFIG(server_bundled) { + INSTALLS += bin systemd +} +else { + INSTALLS += bin server translation systemd + message("No build type specified. Defaulting to standalone server build (CONFIG+=server_standalone).") + message("If you wish to run YACReaderLibraryServer on a system with an existing install of YACReaderLibrary,\ + please specify CONFIG+=server_bundled as an option when running qmake.") +} + +bin.path = $$BINDIR +isEmpty(DESTDIR) { + bin.files = YACReaderLibraryServer +} else { + bin.files = $$DESTDIR/YACReaderLibraryServer +} + +server.path = $$DATADIR/yacreader +server.files = ../release/server + +systemd.path = $$LIBDIR/systemd/user +systemd.files = yacreaderlibraryserver.service + +translation.path = $$DATADIR/yacreader/languages +translation.files = ../release/languages/yacreaderlibrary_* + +# TODO: We need a manpage for yaclibserver +#manpage.path = $$DATADIR/man/man1 +#manpage.files = ../YACReaderLibrary.1 +} diff --git a/YACReaderLibraryServer/headless_config.pri b/YACReaderLibraryServer/headless_config.pri index fd5601b8..4e499be4 100644 --- a/YACReaderLibraryServer/headless_config.pri +++ b/YACReaderLibraryServer/headless_config.pri @@ -1,71 +1,37 @@ -#functions to automatically initialize some of YACReader's build options to -#default values if they're not set on build time -#for a more detailed description, see INSTALL.TXT +# functions to automatically initialize some of YACReaderLibraryServer's build +# options to default values if they're not set at build time +# for a more detailed description, see INSTALL.TXT -#check Qt version -QT_VERSION = $$[QT_VERSION] -QT_VERSION = $$split(QT_VERSION, ".") -QT_VER_MAJ = $$member(QT_VERSION, 0) -QT_VER_MIN = $$member(QT_VERSION, 1) +include (../config.pri) -lessThan(QT_VER_MAJ, 5) { -error(YACReader requires Qt 5 or newer but Qt $$[QT_VERSION] was detected.) - } -lessThan(QT_VER_MIN, 3){ - error ("You need at least Qt 5.3 to build YACReader or YACReaderLibrary") - } -!CONFIG(unarr):!CONFIG(7zip) { - unix { - !macx { - CONFIG+=unarr - } - else { - CONFIG+=7zip - } - - } - win32 { - CONFIG+=7zip - } -} - -unix { - !macx { +unix!macx { + !contains(QT_CONFIG, no-pkg-config) { packagesExist(Qt5Core) { message("Found Qt5Core") - } - else: { + } else: { message("Missing dependency: Qt5Core") } packagesExist(Qt5Gui) { message("Found Qt5Gui") - } - else: { + } else: { message("Missing dependency: Qt5Gui") } - packagesExist(poppler-qt5) { - message("Found poppler-qt5") - } - else: { - message("Missing dependency: poppler-qt5") - } packagesExist(Qt5Network) { message("Found Qt5Network") - } - else: { + } else: { message("Missing dependency: Qt5Network") } packagesExist(Qt5Sql) { message("Found Qt5Sql") - } - else: { + } else: { message("Missing dependency: Qt5Sql") } packagesExist(sqlite3) { message("Found sqlite3") - } - else: { + } else: { message("Missing dependency: sqlite3") } + } else { + message("Qmake was compiled without support for pkg-config. Skipping dependency checks.") } -} \ No newline at end of file +} diff --git a/YACReaderLibraryServer/systemd_instructions.txt b/YACReaderLibraryServer/systemd_instructions.txt new file mode 100644 index 00000000..b62e118c --- /dev/null +++ b/YACReaderLibraryServer/systemd_instructions.txt @@ -0,0 +1,32 @@ +Starting with YACReader 9.0.0 we supply a systemd service file for use with +YACReaderLibraryServer. To make use of it, follow these instructions: + +1. Open yacreaderlibraryserver.service in a text editor of your choice. + Change the path used in the ExecStart variable to the location where your headless + server binary resides. If yacreaderlibraryserver was installed as part of a + package you can probably skip this step. + +2. Copy the service file into ~/.local/share/systemd/user + +3. Enable the service file by running: + "systemctl --user enable yacreaderlibraryserver" + +4. Start the server by running: + "systemctl --user start yacreaderlibraryserver" + +5. Check the server status by running: + "systemctl --user status yacreaderlibraryserver" + +Important: Don't run this as root. None of these steps require root privileges. + +By the default, the service is configured to restart yacreaderlibraryserver in +case of a crash and will automatically restart even after a kill or reboot. +This might give you some trouble when running YACReaderLibrary on the same machine. + +To temporarily disable the server, run systemctl with the stop command: + +"systemctl --user stop yacreaderlibraryserver" + +To permanently disable it, use the "disable" command: + +"systemctl --user disable yacreaderlibraryserver" diff --git a/YACReaderLibraryServer/yacreaderlibraryserver.service b/YACReaderLibraryServer/yacreaderlibraryserver.service new file mode 100644 index 00000000..6ed9024d --- /dev/null +++ b/YACReaderLibraryServer/yacreaderlibraryserver.service @@ -0,0 +1,11 @@ +[Unit] +Description= YACReaderLibrary headless server +After=network.target + +[Service] +Type=simple +Restart=always +ExecStart=/usr/bin/YACReaderLibraryServer start + +[Install] +WantedBy=default.target diff --git a/cleanOSX.sh b/cleanOSX.sh index 5923cf7a..a1757f06 100755 --- a/cleanOSX.sh +++ b/cleanOSX.sh @@ -4,11 +4,14 @@ rm -R *.app rm -R YACReader-* rm -R *.dmg cd YACReader -make clean +make distclean rm -R YACReader.app cd .. cd YACReaderLibrary -make clean +make distclean rm -R YACReaderLibrary.app +cd .. +cd YACReaderLibraryServer +make distclean rm -R YACReaderLibraryServer.app cd .. diff --git a/common/comic.cpp b/common/comic.cpp index f5d8734a..dfe9d065 100644 --- a/common/comic.cpp +++ b/common/comic.cpp @@ -1,4 +1,4 @@ - #include "comic.h" +#include "comic.h" #include #include @@ -17,28 +17,34 @@ enum YACReaderPageSortingMode { - YACReaderNumericalSorting, - YACReaderHeuristicSorting, - YACReaderAlphabeticalSorting + YACReaderNumericalSorting, + YACReaderHeuristicSorting, + YACReaderAlphabeticalSorting }; void comic_pages_sort(QList & pageNames, YACReaderPageSortingMode sortingMode); - - const QStringList Comic::imageExtensions = QStringList() << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp" << "*.webp"; const QStringList Comic::literalImageExtensions = QStringList() << "jpg" << "jpeg" << "png" << "gif" << "tiff" << "tif" << "bmp" << "webp"; #ifndef use_unarr -const QStringList Comic::comicExtensions = QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar" << "*.pdf" << "*.7z" << "*.cb7" << "*.arj" << "*.cbt"; -const QStringList Comic::literalComicExtensions = QStringList() << "cbr" << "cbz" << "rar" << "zip" << "tar" << "pdf" << "7z" << "cb7" << "arj" << "cbt"; +const QStringList ComicArchiveExtensions = QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar" << "*.7z" << "*.cb7" << "*.arj" << "*.cbt"; +const QStringList LiteralComicArchiveExtensions = QStringList() << "cbr" << "cbz" << "rar" << "zip" << "tar" << "7z" << "cb7" << "arj" << "cbt"; #else -const QStringList Comic::comicExtensions = QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar" << "*.pdf" << "*.cbt"; -const QStringList Comic::literalComicExtensions = QStringList() << "cbr" << "cbz" << "rar" << "zip" << "tar" << "pdf" << "cbt"; -#endif +const QStringList ComicArchiveExtensions = QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar" << "*.cbt"; +const QStringList LiteralComicArchiveExtensions = QStringList() << "cbr" << "cbz" << "rar" << "zip" << "tar" << "cbt"; +#endif //use_unarr +#ifndef NO_PDF +const QStringList Comic::comicExtensions = QStringList() << ComicArchiveExtensions << "*.pdf"; +const QStringList Comic::literalComicExtensions = QStringList() << LiteralComicArchiveExtensions << "pdf"; +#else +const QStringList Comic::comicExtensions = ComicArchiveExtensions; +const QStringList Comic::literalComicExtensions = LiteralComicArchiveExtensions; +#endif //NO_PDF + //----------------------------------------------------------------------------- Comic::Comic() -:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false) +:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false),_invalidated(false) { setup(); } @@ -51,6 +57,7 @@ Comic::Comic(const QString & pathFile, int atPage ) //----------------------------------------------------------------------------- Comic::~Comic() { + emit destroyed(); delete bm; } //----------------------------------------------------------------------------- @@ -70,7 +77,9 @@ int Comic::nextPage() emit pageChanged(_index); } else + { emit isLast(); + } return _index; } //--------------------------------------------------------------------------- @@ -83,8 +92,9 @@ int Comic::previousPage() emit pageChanged(_index); } else + { emit isCover(); - + } return _index; } //----------------------------------------------------------------------------- @@ -92,12 +102,18 @@ void Comic::setIndex(unsigned int index) { int previousIndex = _index; if(static_cast(index)<_pages.size()-1) + { _index = index; + } else + { _index = _pages.size()-1; + } if(previousIndex != _index) + { emit pageChanged(_index); + } } //----------------------------------------------------------------------------- /*QPixmap * Comic::currentPage() @@ -183,72 +199,87 @@ void Comic::updateBookmarkImage(int index) //----------------------------------------------------------------------------- void Comic::setPageLoaded(int page) { - _loadedPages[page] = true; + _loadedPages[page] = true; +} + +void Comic::invalidate() +{ + _invalidated = true; + emit invalidated(); } //----------------------------------------------------------------------------- QByteArray Comic::getRawPage(int page) { if(page < 0 || page >= _pages.size()) + { return QByteArray(); + } return _pages[page]; } //----------------------------------------------------------------------------- bool Comic::pageIsLoaded(int page) { if(page < 0 || page >= _pages.size()) + { return false; - return _loadedPages[page]; + } + return _loadedPages[page]; } bool Comic::fileIsComic(const QString &path) { - QFileInfo info(path); - return literalComicExtensions.contains(info.suffix()); + QFileInfo info(path); + return literalComicExtensions.contains(info.suffix()); } QList Comic::findValidComicFiles(const QList &list) { - QLOG_DEBUG() << "-findValidComicFiles-"; - QList validComicFiles; - QString currentPath; - foreach (QUrl url, list) { - currentPath = url.toLocalFile(); - if(Comic::fileIsComic(currentPath)) - validComicFiles << currentPath; - else if(QFileInfo(currentPath).isDir()) - { - validComicFiles << findValidComicFilesInFolder(currentPath); - } - } - QLOG_DEBUG() << "-" << validComicFiles << "-"; - return validComicFiles; + QLOG_DEBUG() << "-findValidComicFiles-"; + QList validComicFiles; + QString currentPath; + foreach (QUrl url, list) + { + currentPath = url.toLocalFile(); + if(Comic::fileIsComic(currentPath)) + { + validComicFiles << currentPath; + } + else if(QFileInfo(currentPath).isDir()) + { + validComicFiles << findValidComicFilesInFolder(currentPath); + } + } + QLOG_DEBUG() << "-" << validComicFiles << "-"; + return validComicFiles; } QList Comic::findValidComicFilesInFolder(const QString &path) { - QLOG_DEBUG() << "-findValidComicFilesInFolder-" << path; + QLOG_DEBUG() << "-findValidComicFilesInFolder-" << path; - if(!QFileInfo(path).isDir()) - return QList(); + if(!QFileInfo(path).isDir()) + return QList(); - QList validComicFiles; - QDir folder(path); - folder.setNameFilters(Comic::comicExtensions); - folder.setFilter(QDir::AllDirs|QDir::Files|QDir::NoDotAndDotDot); - QFileInfoList folderContent = folder.entryInfoList(); + QList validComicFiles; + QDir folder(path); + folder.setNameFilters(Comic::comicExtensions); + folder.setFilter(QDir::AllDirs|QDir::Files|QDir::NoDotAndDotDot); + QFileInfoList folderContent = folder.entryInfoList(); - QString currentPath; - foreach (QFileInfo info, folderContent) { - currentPath = info.absoluteFilePath(); - if(info.isDir()) - validComicFiles << findValidComicFilesInFolder(currentPath); //find comics recursively - else if(Comic::fileIsComic(currentPath)) - { - validComicFiles << currentPath; - } - } - - return validComicFiles; + QString currentPath; + foreach (QFileInfo info, folderContent) + { + currentPath = info.absoluteFilePath(); + if(info.isDir()) + { + validComicFiles << findValidComicFilesInFolder(currentPath); //find comics recursively + } + else if(Comic::fileIsComic(currentPath)) + { + validComicFiles << currentPath; + } + } + return validComicFiles; } //////////////////////////////////////////////////////////////////////////////// @@ -312,7 +343,9 @@ bool FileComic::load(const QString & path, const ComicDB & comic) QList bookmarkIndexes; bookmarkIndexes << comic.info.bookmark1 << comic.info.bookmark2 << comic.info.bookmark3; if(bm->load(bookmarkIndexes,comic.info.currentPage-1)) + { emit bookmarksUpdated(); + } _firstPage = comic.info.currentPage-1; _path = QDir::cleanPath(path); return true; @@ -320,7 +353,7 @@ bool FileComic::load(const QString & path, const ComicDB & comic) else { //QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path); - moveToThread(QCoreApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return false; } @@ -347,7 +380,9 @@ QList FileComic::filter(const QList & src) } } if(fileAccepted) + { filtered.append(fileName); + } } return filtered; @@ -363,7 +398,9 @@ void FileComic::fileExtracted(int index, const QByteArray & rawData) //out << sortedIndex << " , "; //f.close(); if(sortedIndex == -1) + { return; + } _pages[sortedIndex] = rawData; emit imageLoaded(sortedIndex); emit imageLoaded(sortedIndex,_pages[sortedIndex]); @@ -378,10 +415,15 @@ void FileComic::crcError(int index) void FileComic::unknownError(int index) { Q_UNUSED(index) - emit errorOpening(tr("Unknown error opening the file")); + emit errorOpening(tr("Unknown error opening the file")); //emit errorOpening(); } +bool FileComic::isCancelled() +{ + return _invalidated; +} + //-------------------------------------- QList > FileComic::getSections(int & sectionIndex) @@ -423,15 +465,18 @@ QList > FileComic::getSections(int & sectionIndex) foreach(quint32 si,section) { if(si > FileComic::getSections(int & sectionIndex) } } else + { sections.append(section); - + } section = QVector (); //out << "---------------" << endl; section.append(i); @@ -451,32 +497,39 @@ QList > FileComic::getSections(int & sectionIndex) idx++; } - if(sectionIndex == sectionCount) //found + + if(sectionIndex == sectionCount) //found + { + if(section.indexOf(realIdx)!=0) + { + QVector section1; + QVector section2; + foreach(quint32 si,section) { - if(section.indexOf(realIdx)!=0) + if(si section1; - QVector section2; - foreach(quint32 si,section) - { - if(sithread()); - emit errorOpening(tr("7z not found")); + { + moveToThread(QCoreApplication::instance()->thread()); + emit errorOpening(tr("7z not found")); return; - } + } - if(!archive.isValid()) - { - moveToThread(QCoreApplication::instance()->thread()); - emit errorOpening(tr("Format not supported")); - return; - } + if(!archive.isValid()) + { + moveToThread(QCoreApplication::instance()->thread()); + emit errorOpening(tr("Format not supported")); + return; + } //se filtran para obtener s�lo los formatos soportados _order = archive.getFileNames(); @@ -506,7 +559,7 @@ void FileComic::process() if(_fileNames.size()==0) { //QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file")); - moveToThread(QCoreApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return; } @@ -523,14 +576,18 @@ void FileComic::process() _cfi=0; - //TODO, add a setting for choosing the type of page sorting used. - comic_pages_sort(_fileNames, YACReaderHeuristicSorting); + //TODO, add a setting for choosing the type of page sorting used. + comic_pages_sort(_fileNames, YACReaderHeuristicSorting); if(_firstPage == -1) + { _firstPage = bm->getLastPage(); + } - if(_firstPage >= _pages.length()) - _firstPage = 0; + if(_firstPage >= _pages.length()) + { + _firstPage = 0; + } _index = _firstPage; emit(openAt(_index)); @@ -539,9 +596,23 @@ void FileComic::process() QList > sections = getSections(sectionIndex); for(int i = sectionIndex; ithread()); + return; + } archive.getAllData(sections.at(i),this); + } for(int i = 0; ithread()); + return; + } archive.getAllData(sections.at(i),this); + } //archive.getAllData(QVector(),this); /* foreach(QString name,_fileNames) @@ -552,8 +623,8 @@ void FileComic::process() emit imageLoaded(sortedIndex); emit imageLoaded(sortedIndex,_pages[sortedIndex]); }*/ - moveToThread(QCoreApplication::instance()->thread()); - emit imagesLoaded(); + moveToThread(QCoreApplication::instance()->thread()); + emit imagesLoaded(); } @@ -600,8 +671,8 @@ void FolderComic::process() //d.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware); QFileInfoList list = d.entryInfoList(); - //don't fix double page files sorting, because the user can see how the SO sorts the files in the folder. - std::sort(list.begin(),list.end(),naturalSortLessThanCIFileInfo); + //don't fix double page files sorting, because the user can see how the SO sorts the files in the folder. + std::sort(list.begin(),list.end(),naturalSortLessThanCIFileInfo); int nPages = list.size(); _pages.clear(); @@ -612,16 +683,20 @@ void FolderComic::process() { //TODO emitir este mensaje en otro sitio //QMessageBox::critical(NULL,QObject::tr("No images found"),QObject::tr("There are not images on the selected folder")); - moveToThread(QCoreApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); } else { if(_firstPage == -1) + { _firstPage = bm->getLastPage(); + } - if(_firstPage >= _pages.length()) - _firstPage = 0; + if(_firstPage >= _pages.length()) + { + _firstPage = 0; + } _index = _firstPage; @@ -635,6 +710,12 @@ void FolderComic::process() int i=_firstPage; while(countthread()); + return; + } + QFile f(list.at(i).absoluteFilePath()); f.open(QIODevice::ReadOnly); _pages[i]=f.readAll(); @@ -642,7 +723,9 @@ void FolderComic::process() emit imageLoaded(i,_pages[i]); i++; if(i==nPages) + { i=0; + } count++; } } @@ -654,6 +737,8 @@ void FolderComic::process() //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// +#ifndef NO_PDF + PDFComic::PDFComic() :Comic() { @@ -689,7 +774,7 @@ bool PDFComic::load(const QString & path, int atPage) } else { - moveToThread(QCoreApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return false; } @@ -704,7 +789,9 @@ bool PDFComic::load(const QString & path, const ComicDB & comic) QList bookmarkIndexes; bookmarkIndexes << comic.info.bookmark1 << comic.info.bookmark2 << comic.info.bookmark3; if(bm->load(bookmarkIndexes,comic.info.currentPage-1)) + { emit bookmarksUpdated(); + } _firstPage = comic.info.currentPage-1; _path = QDir::cleanPath(path); return true; @@ -712,7 +799,7 @@ bool PDFComic::load(const QString & path, const ComicDB & comic) else { //QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path); - moveToThread(QCoreApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return false; } @@ -720,29 +807,35 @@ bool PDFComic::load(const QString & path, const ComicDB & comic) void PDFComic::process() { -#ifdef Q_OS_MAC - pdfComic = new MacOSXPDFComic(); - if(!pdfComic->openComic(_path)) - { - delete pdfComic; - emit errorOpening(); - return; - } +#if defined Q_OS_MAC && defined USE_PDFKIT + pdfComic = new MacOSXPDFComic(); + if(!pdfComic->openComic(_path)) + { + delete pdfComic; + emit errorOpening(); + return; + } +#elif defined USE_PDFIUM + pdfComic = new PdfiumComic(); + if(!pdfComic->openComic(_path)) + { + delete pdfComic; + emit errorOpening(); + return; + } #else - - pdfComic = Poppler::Document::load(_path); if (!pdfComic) { - //delete pdfComic; - //pdfComic = 0; - moveToThread(QCoreApplication::instance()->thread()); + //delete pdfComic; + //pdfComic = 0; + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return; } if (pdfComic->isLocked()) { - moveToThread(QCoreApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return; } @@ -762,10 +855,14 @@ void PDFComic::process() _loadedPages = QVector(nPages,false); if(_firstPage == -1) + { _firstPage = bm->getLastPage(); + } - if(_firstPage >= _pages.length()) - _firstPage = 0; + if(_firstPage >= _pages.length()) + { + _firstPage = 0; + } _index = _firstPage; emit(openAt(_index)); @@ -773,9 +870,26 @@ void PDFComic::process() //buffer index to avoid race conditions int buffered_index = _index; for(int i=buffered_index;ithread()); + return; + } + renderPage(i); + } for(int i=0;ithread()); + return; + } renderPage(i); + } delete pdfComic; moveToThread(QCoreApplication::instance()->thread()); @@ -784,36 +898,32 @@ void PDFComic::process() void PDFComic::renderPage(int page) { -#ifdef Q_OS_MAC - { - QImage img = pdfComic->getPage(page); - if(!img.isNull()) - { - QByteArray ba; - QBuffer buf(&ba); - img.save(&buf, "jpg"); - _pages[page] = ba; - emit imageLoaded(page); - emit imageLoaded(page,_pages[page]); - } - } - pdfComic->releaseLastPageData(); +#if defined Q_OS_MAC && defined USE_PDFKIT + QImage img = pdfComic->getPage(page); + if(!img.isNull()) + { +#elif defined USE_PDFIUM + QImage img = pdfComic->getPage(page); + if(!img.isNull()) + { #else Poppler::Page* pdfpage = pdfComic->page(page); if (pdfpage) { - QImage img = pdfpage->renderToImage(150,150); - delete pdfpage; + QImage img = pdfpage->renderToImage(150,150); + delete pdfpage; +#endif QByteArray ba; QBuffer buf(&ba); - img.save(&buf, "jpg"); + img.save(&buf, "jpg", 96); _pages[page] = ba; emit imageLoaded(page); emit imageLoaded(page,_pages[page]); } -#endif } +#endif //NO_PDF + Comic * FactoryComic::newComic(const QString & path) { @@ -821,18 +931,30 @@ Comic * FactoryComic::newComic(const QString & path) if(fi.exists()) { if(fi.isFile()) - { + { + #ifndef NO_PDF if(fi.suffix().compare("pdf",Qt::CaseInsensitive) == 0) + { return new PDFComic(); + } else + { return new FileComic(); + } + #else + return new FileComic(); + #endif } else { if(fi.isDir()) + { return new FolderComic(); + } else + { return NULL; + } } } else @@ -843,163 +965,185 @@ Comic * FactoryComic::newComic(const QString & path) bool is_double_page(const QString & pageName, const QString & commonPrefix, const int maxExpectedDoublePagesNumberLenght) { - if(pageName.startsWith(commonPrefix)) - { - QString substringContainingPageNumbers = pageName.mid(commonPrefix.length()); - QString pageNumbersSubString; - for(int i = 0 ; i < substringContainingPageNumbers.length() && substringContainingPageNumbers.at(i).isDigit(); i++) - pageNumbersSubString.append(substringContainingPageNumbers.at(i)); + if(pageName.startsWith(commonPrefix)) + { + QString substringContainingPageNumbers = pageName.mid(commonPrefix.length()); + QString pageNumbersSubString; + for(int i = 0 ; i < substringContainingPageNumbers.length() && substringContainingPageNumbers.at(i).isDigit(); i++) + { + pageNumbersSubString.append(substringContainingPageNumbers.at(i)); + } + if(pageNumbersSubString.length() < 3 || pageNumbersSubString.length() > maxExpectedDoublePagesNumberLenght || pageNumbersSubString.length() % 2 == 1) + { + return false; + } - if(pageNumbersSubString.length() < 3 || pageNumbersSubString.length() > maxExpectedDoublePagesNumberLenght || pageNumbersSubString.length() % 2 == 1) - return false; + int leftPageNumber = pageNumbersSubString.left(pageNumbersSubString.length() / 2).toInt(); + int rightPageNumber = pageNumbersSubString.mid(pageNumbersSubString.length() / 2).toInt(); - int leftPageNumber = pageNumbersSubString.left(pageNumbersSubString.length() / 2).toInt(); - int rightPageNumber = pageNumbersSubString.mid(pageNumbersSubString.length() / 2).toInt(); - - if(leftPageNumber == 0 || rightPageNumber == 0) - return false; - - if((rightPageNumber - leftPageNumber) == 1) - return true; - } - - return false; + if(leftPageNumber == 0 || rightPageNumber == 0) + { + return false; + } + if((rightPageNumber - leftPageNumber) == 1) + { + return true; + } + } + return false; } QString get_most_common_prefix(const QList & pageNames) { - if(pageNames.isEmpty()) - return ""; + if(pageNames.isEmpty()) + { + return ""; + } + QMap frequency; + int currentPrefixLenght = pageNames.at(0).split('/').last().length(); + int currentPrefixCount = 1; - QMap frequency; - int currentPrefixLenght = pageNames.at(0).split('/').last().length(); - int currentPrefixCount = 1; + int i; + QString previous; + QString current; + for(i = 1; i < pageNames.length(); i++) + { + int pos = 0; + previous = pageNames.at(i-1).split('/').last(); + current = pageNames.at(i).split('/').last(); + for(; pos < current.length() && previous[pos] == current[pos]; pos++); - int i; - QString previous; - QString current; - for(i = 1; i < pageNames.length(); i++) - { - int pos = 0; - previous = pageNames.at(i-1).split('/').last(); - current = pageNames.at(i).split('/').last(); - for(; pos < current.length() && previous[pos] == current[pos]; pos++); - - if(pos < currentPrefixLenght && pos > 0) - { - frequency.insert(previous.left(currentPrefixLenght), currentPrefixCount); - currentPrefixLenght = pos; - currentPrefixCount++; - } - /* + if(pos < currentPrefixLenght && pos > 0) + { + frequency.insert(previous.left(currentPrefixLenght), currentPrefixCount); + currentPrefixLenght = pos; + currentPrefixCount++; + } + /* else if(pos > currentPrefixLenght) { - frequency.insert(pageNames.at(i-1).left(currentPrefixLenght), currentPrefixCount - 1); - currentPrefixLenght = pos; - currentPrefixCount = 2; + frequency.insert(pageNames.at(i-1).left(currentPrefixLenght), currentPrefixCount - 1); + currentPrefixLenght = pos; + currentPrefixCount = 2; }*/ - else if(pos == 0) + else if(pos == 0) + { + frequency.insert(previous.left(currentPrefixLenght), currentPrefixCount); + currentPrefixLenght = current.length(); + currentPrefixCount = 1; + } + else + { + currentPrefixCount++; + } + } + + frequency.insert(previous.left(currentPrefixLenght), currentPrefixCount); + + uint maxFrequency = 0; + QString common_prefix = ""; + foreach(QString key, frequency.keys()) + { + if(maxFrequency < frequency.value(key)) + { + maxFrequency = frequency.value(key); + common_prefix = key; + } + } + + QRegExp allNumberRegExp("\\d+"); + if (allNumberRegExp.exactMatch(common_prefix)) + { + return ""; + } + + if(maxFrequency < pageNames.length() * 0.60) //the most common tipe of image file should a proper page, so we can asume that the common_prefix should be in, at least, the 60% of the pages { - frequency.insert(previous.left(currentPrefixLenght), currentPrefixCount); - currentPrefixLenght = current.length(); - currentPrefixCount = 1; - } - else - currentPrefixCount++; - } + return ""; + } - frequency.insert(previous.left(currentPrefixLenght), currentPrefixCount); - - uint maxFrequency = 0; - QString common_prefix = ""; - foreach(QString key, frequency.keys()) - { - if(maxFrequency < frequency.value(key)) - { - maxFrequency = frequency.value(key); - common_prefix = key; - } - } - - QRegExp allNumberRegExp("\\d+"); - if (allNumberRegExp.exactMatch(common_prefix)) - return ""; - - if(maxFrequency < pageNames.length() * 0.60) //the most common tipe of image file should a proper page, so we can asume that the common_prefix should be in, at least, the 60% of the pages - return ""; - - return common_prefix; + return common_prefix; } void get_double_pages(const QList & pageNames, QList & singlePageNames/*out*/, QList & doublePageNames/*out*/) { - uint maxExpectedDoublePagesNumberLenght = (int)(log10(pageNames.length())+1) * 2; + uint maxExpectedDoublePagesNumberLenght = (int)(log10(pageNames.length())+1) * 2; - QString mostCommonPrefix = get_most_common_prefix(pageNames); + QString mostCommonPrefix = get_most_common_prefix(pageNames); - foreach(const QString & pageName, pageNames) - { - if(is_double_page(pageName.split('/').last(), mostCommonPrefix, maxExpectedDoublePagesNumberLenght)) - doublePageNames.append(pageName); - else - singlePageNames.append(pageName); - } + foreach(const QString & pageName, pageNames) + { + if(is_double_page(pageName.split('/').last(), mostCommonPrefix, maxExpectedDoublePagesNumberLenght)) + { + doublePageNames.append(pageName); + } + else + { + singlePageNames.append(pageName); + } + } } QList merge_pages(QList & singlePageNames, QList & doublePageNames) { - //NOTE: this implementation doesn't differ from std::merge using a custom comparator, but it can be easily tweaked if merging requeries an additional heuristic behaviour - QList pageNames; + //NOTE: this implementation doesn't differ from std::merge using a custom comparator, but it can be easily tweaked if merging requeries an additional heuristic behaviour + QList pageNames; - int i = 0; - int j = 0; + int i = 0; + int j = 0; - while (i < singlePageNames.length() && j < doublePageNames.length()) - { - if (singlePageNames.at(i).compare(doublePageNames.at(j), Qt::CaseInsensitive) < 0) - pageNames.append(singlePageNames.at(i++)); - else - pageNames.append(doublePageNames.at(j++)); - } + while (i < singlePageNames.length() && j < doublePageNames.length()) + { + if (singlePageNames.at(i).compare(doublePageNames.at(j), Qt::CaseInsensitive) < 0) + { + pageNames.append(singlePageNames.at(i++)); + } + else + { + pageNames.append(doublePageNames.at(j++)); + } + } - while (i < singlePageNames.length()) - pageNames.append(singlePageNames.at(i++)); + while (i < singlePageNames.length()) + { + pageNames.append(singlePageNames.at(i++)); + } - while (j < doublePageNames.length()) - pageNames.append(doublePageNames.at(j++)); - - return pageNames; + while (j < doublePageNames.length()) + { + pageNames.append(doublePageNames.at(j++)); + } + + return pageNames; } void comic_pages_sort(QList & pageNames, YACReaderPageSortingMode sortingMode) { - switch(sortingMode) - { - case YACReaderNumericalSorting: - std::sort(pageNames.begin(), pageNames.end(), naturalSortLessThanCI); - break; + switch(sortingMode) + { + case YACReaderNumericalSorting: + std::sort(pageNames.begin(), pageNames.end(), naturalSortLessThanCI); + break; - case YACReaderHeuristicSorting: - { - std::sort(pageNames.begin(), pageNames.end(), naturalSortLessThanCI); + case YACReaderHeuristicSorting: + { + std::sort(pageNames.begin(), pageNames.end(), naturalSortLessThanCI); - QList singlePageNames; - QList doublePageNames; + QList singlePageNames; + QList doublePageNames; - get_double_pages(pageNames, singlePageNames, doublePageNames); + get_double_pages(pageNames, singlePageNames, doublePageNames); - if(doublePageNames.length() > 0) - { - pageNames = merge_pages(singlePageNames, doublePageNames); - } - - break; - } - - case YACReaderAlphabeticalSorting: - std::sort(pageNames.begin(), pageNames.end()); - break; - } + if(doublePageNames.length() > 0) + { + pageNames = merge_pages(singlePageNames, doublePageNames); + } + } + break; + + case YACReaderAlphabeticalSorting: + std::sort(pageNames.begin(), pageNames.end()); + break; + } } - diff --git a/common/comic.h b/common/comic.h index 2f633429..89e895be 100644 --- a/common/comic.h +++ b/common/comic.h @@ -7,30 +7,19 @@ #include #include "extract_delegate.h" - #include "bookmarks.h" - -#ifdef Q_OS_MAC - +#ifndef NO_PDF #include "pdf_comic.h" - -#else - -#if QT_VERSION >= 0x050000 - #include "poppler-qt5.h" -#else - #include "poppler-qt4.h" -#endif - -#endif - +#endif //NO_PDF class ComicDB; //#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp" Comic::getSupportedImageFormats() //#define EXTENSIONS_LITERAL << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp" //Comic::getSupportedImageLiteralFormats() - class Comic : public QObject - { +class Comic : public QObject +{ Q_OBJECT + protected: + //Comic pages, one QPixmap for each file. QVector _pages; QVector _loadedPages; @@ -49,14 +38,16 @@ class ComicDB; bool _isPDF; + bool _invalidated; + public: + + static const QStringList imageExtensions; + static const QStringList literalImageExtensions; + static const QStringList comicExtensions; + static const QStringList literalComicExtensions; - static const QStringList imageExtensions; - static const QStringList literalImageExtensions; - static const QStringList comicExtensions; - static const QStringList literalComicExtensions; - - Bookmarks * bm; + Bookmarks * bm; //Constructors Comic(); @@ -78,16 +69,17 @@ class ComicDB; //QPixmap * currentPage(); bool loaded(); //QPixmap * operator[](unsigned int index); - QVector * getRawData(){return &_pages;} + QVector * getRawData(){return &_pages;} QByteArray getRawPage(int page); bool pageIsLoaded(int page); - inline static QStringList getSupportedImageFormats() { return imageExtensions;} - inline static QStringList getSupportedImageLiteralFormats() { return literalImageExtensions;} + inline static QStringList getSupportedImageFormats() { return imageExtensions;} + inline static QStringList getSupportedImageLiteralFormats() { return literalImageExtensions;} - static bool fileIsComic(const QString &path); - static QList findValidComicFiles(const QList & list); - static QList findValidComicFilesInFolder(const QString &path); + static bool fileIsComic(const QString &path); + static QList findValidComicFiles(const QList & list); + static QList findValidComicFilesInFolder(const QString &path); + public slots: void loadFinished(); void setBookmark(); @@ -96,7 +88,11 @@ class ComicDB; void checkIsBookmark(int index); void updateBookmarkImage(int); void setPageLoaded(int page); + void invalidate(); + signals: + void invalidated(); + void destroyed(); void imagesLoaded(); void imageLoaded(int index); void imageLoaded(int index,const QByteArray & image); @@ -110,73 +106,91 @@ class ComicDB; void bookmarksUpdated(); void isCover(); void isLast(); - - }; +}; - class FileComic : public Comic, public ExtractDelegate - { - Q_OBJECT +class FileComic : public Comic, public ExtractDelegate +{ + Q_OBJECT + private: - QList > getSections(int & sectionIndex); + + QList > getSections(int & sectionIndex); + public: + FileComic(); FileComic(const QString & path, int atPage = -1); ~FileComic(); - void fileExtracted(int index, const QByteArray & rawData); virtual bool load(const QString & path, int atPage = -1); virtual bool load(const QString & path, const ComicDB & comic); + static QList filter(const QList & src); + + //ExtractDelegate + void fileExtracted(int index, const QByteArray & rawData); void crcError(int index); void unknownError(int index); - static QList filter(const QList & src); - public slots: - void process(); - }; + bool isCancelled(); - class FolderComic : public Comic - { - Q_OBJECT + public slots: + + void process(); +}; + +class FolderComic : public Comic +{ + Q_OBJECT + private: //void run(); + public: + FolderComic(); FolderComic(const QString & path, int atPage = -1); ~FolderComic(); virtual bool load(const QString & path, int atPage = -1); + public slots: + void process(); +}; - }; - - class PDFComic : public Comic - { - Q_OBJECT +#ifndef NO_PDF +class PDFComic : public Comic +{ + Q_OBJECT + private: + //pdf -#ifdef Q_OS_MAC - MacOSXPDFComic * pdfComic; -#else + #if defined Q_OS_MAC && defined USE_PDFKIT + MacOSXPDFComic * pdfComic; + #elif defined USE_PDFIUM + PdfiumComic * pdfComic; + #else Poppler::Document * pdfComic; -#endif + #endif void renderPage(int page); - //void run(); + public: + PDFComic(); PDFComic(const QString & path, int atPage = -1); ~PDFComic(); virtual bool load(const QString & path, int atPage = -1); virtual bool load(const QString & path, const ComicDB & comic); + public slots: + void process(); - }; - - class FactoryComic - { +}; +#endif //NO_PDF +class FactoryComic +{ public: static Comic * newComic(const QString & path); - }; - - +}; #endif diff --git a/common/gl/yacreader_flow_gl.cpp b/common/gl/yacreader_flow_gl.cpp index 7d9628cb..bec6ed92 100644 --- a/common/gl/yacreader_flow_gl.cpp +++ b/common/gl/yacreader_flow_gl.cpp @@ -200,7 +200,7 @@ struct Preset pressetYACReaderFlowDownConfig = { }; /*Constructor*/ YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p) - :QOpenGLWidget(/*QOpenGLWidget migration QGLFormat(QGL::SampleBuffers),*/ parent),numObjects(0),lazyPopulateObjects(-1),bUseVSync(false),hasBeenInitialized(false) + :QOpenGLWidget(/*QOpenGLWidget migration QGLFormat(QGL::SampleBuffers),*/ parent),numObjects(0),lazyPopulateObjects(-1),bUseVSync(false),hasBeenInitialized(false),flowRightToLeft(false) { updateCount = 0; config = p; @@ -385,7 +385,11 @@ void YACReaderFlowGL::udpatePerspective(int width, int height) /*Private*/ void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos) { - if(pos == 0){ + if(flowRightToLeft){ + pos = pos * -1; + } + + if(pos == 0){ image.current = centerPos; }else{ if(pos > 0){ @@ -1052,6 +1056,11 @@ void YACReaderFlowGL::render() //do nothing } +void YACReaderFlowGL::setFlowRightToLeft(bool b) +{ + flowRightToLeft = b; +} + //EVENTOS void YACReaderFlowGL::wheelEvent(QWheelEvent * event) @@ -1073,7 +1082,7 @@ void YACReaderFlowGL::wheelEvent(QWheelEvent * event) void YACReaderFlowGL::keyPressEvent(QKeyEvent *event) { - if(event->key() == Qt::Key_Left) + if((event->key() == Qt::Key_Left && !flowRightToLeft) || (event->key() == Qt::Key_Right && flowRightToLeft)) { if(event->modifiers() == Qt::ControlModifier) setCurrentIndex((currentSelected-10<0)?0:currentSelected-10); @@ -1083,7 +1092,7 @@ void YACReaderFlowGL::keyPressEvent(QKeyEvent *event) return; } - if(event->key() == Qt::Key_Right) + if((event->key() == Qt::Key_Right && !flowRightToLeft) || (event->key() == Qt::Key_Left && flowRightToLeft)) { if(event->modifiers() == Qt::ControlModifier) setCurrentIndex((currentSelected+10>=numObjects)?numObjects-1:currentSelected+10); @@ -1128,7 +1137,7 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); - if(posX >= 0.5) + if((posX >= 0.5 && !flowRightToLeft) || (posX <=-0.5 && flowRightToLeft)) { //int index = currentSelected+1; //while((cfImages[index].current.x-cfImages[index].width/(2.0*config.rotation)) < posX) @@ -1136,7 +1145,7 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) //setCurrentIndex(index-1); showNext(); } - else if(posX <=-0.5) + else if((posX <=-0.5 && !flowRightToLeft) || (posX >= 0.5 && flowRightToLeft) ) showPrevious(); } else QOpenGLWidget::mousePressEvent(event); @@ -1332,8 +1341,20 @@ YACReaderPageFlowGL::~YACReaderPageFlowGL() this->killTimer(timerId); //worker->deleteLater(); rawImages.clear(); - for(int i = 0;icontext() != nullptr && this->context()->isValid()) + { + for(int i = 0; itimerId()) updateGL(); - + //if(!worker->isRunning()) //worker->start(); } @@ -354,6 +354,9 @@ void YACReaderFlowGL::udpatePerspective(int width, int height) /*Private*/ void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos) { + if(flowRightToLeft){ + pos = pos * -1; + } if(pos == 0){ image.current = centerPos; }else{ @@ -414,7 +417,7 @@ void YACReaderFlowGL::drawCover(const YACReader3DImage & image) float w = image.width; float h = image.height; - //fadeout + //fadeout float opacity = 1-1/(config.animationFadeOutDist+config.viewRotateLightStrenght*fabs(viewRotate))*fabs(0-image.current.x); glLoadIdentity(); @@ -492,7 +495,7 @@ void YACReaderFlowGL::drawCover(const YACReader3DImage & image) glEnd(); glDisable(GL_TEXTURE_2D); - + if(showMarks && loaded[image.index] && marks[image.index] != Unread) { glEnable(GL_TEXTURE_2D); @@ -526,7 +529,7 @@ void YACReaderFlowGL::drawCover(const YACReader3DImage & image) glDisable(GL_TEXTURE_2D); } - + glPopMatrix(); } @@ -598,7 +601,7 @@ void YACReaderFlowGL::showPrevious() viewRotateActive = 1; - } + } } void YACReaderFlowGL::showNext() @@ -778,7 +781,7 @@ void YACReaderFlowGL::populate(int n) loaded = QVector(n,false); //marks = QVector(n,false); - + //worker->start(); } @@ -870,7 +873,7 @@ void YACReaderFlowGL::setCenter_Distance(int distance) config.centerDistance = distance/100.0; } -//sets the pushback amount +//sets the pushback amount void YACReaderFlowGL::setZ_Distance(int distance) { startAnimationTimer(); @@ -1025,6 +1028,11 @@ void YACReaderFlowGL::render() //do nothing } +void YACReaderFlowGL::setFlowRightToLeft(bool b) +{ + flowRightToLeft = b; +} + //EVENTOS void YACReaderFlowGL::wheelEvent(QWheelEvent * event) { @@ -1045,7 +1053,7 @@ void YACReaderFlowGL::wheelEvent(QWheelEvent * event) void YACReaderFlowGL::keyPressEvent(QKeyEvent *event) { - if(event->key() == Qt::Key_Left) + if((event->key() == Qt::Key_Left && !flowRightToLeft) || (event->key() == Qt::Key_Right && flowRightToLeft)) { if(event->modifiers() == Qt::ControlModifier) setCurrentIndex((currentSelected-10<0)?0:currentSelected-10); @@ -1055,7 +1063,7 @@ void YACReaderFlowGL::keyPressEvent(QKeyEvent *event) return; } - if(event->key() == Qt::Key_Right) + if((event->key() == Qt::Key_Right && !flowRightToLeft) || (event->key() == Qt::Key_Left && flowRightToLeft)) { if(event->modifiers() == Qt::ControlModifier) setCurrentIndex((currentSelected+10>=numObjects)?numObjects-1:currentSelected+10); @@ -1067,7 +1075,7 @@ void YACReaderFlowGL::keyPressEvent(QKeyEvent *event) if(event->key() == Qt::Key_Up) { - //emit selected(centerIndex()); + //emit selected(centerIndex()); return; } @@ -1098,7 +1106,7 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); - if(posX >= 0.5) + if((posX >= 0.5 && !flowRightToLeft) || (posX <=-0.5 && flowRightToLeft)) { //int index = currentSelected+1; //while((cfImages[index].current.x-cfImages[index].width/(2.0*config.rotation)) < posX) @@ -1106,7 +1114,7 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) //setCurrentIndex(index-1); showNext(); } - else if(posX <=-0.5) + else if((posX <=-0.5 && !flowRightToLeft) || (posX >= 0.5 && flowRightToLeft) ) showPrevious(); } else QGLWidget::mousePressEvent(event); @@ -1199,7 +1207,7 @@ void YACReaderComicFlowGL::updateImageData() } } - // try to load only few images on the left and right side + // try to load only few images on the left and right side // i.e. all visible ones plus some extra int count=8; switch(performance) @@ -1224,7 +1232,7 @@ void YACReaderComicFlowGL::updateImageData() { indexes[j*2+1] = center+j+1; indexes[j*2+2] = center-j-1; - } + } for(int c = 0; c < 2*count+1; c++) { int i = indexes[c]; @@ -1332,7 +1340,7 @@ void YACReaderPageFlowGL::updateImageData() } } - // try to load only few images on the left and right side + // try to load only few images on the left and right side // i.e. all visible ones plus some extra int count=8; switch(performance) @@ -1357,17 +1365,17 @@ void YACReaderPageFlowGL::updateImageData() { indexes[j*2+1] = center+j+1; indexes[j*2+2] = center-j-1; - } + } for(int c = 0; c < 2*count+1; c++) { int i = indexes[c]; if((i >= 0) && (i < numObjects)) if(rawImages.size()>0) - + if(!loaded[i]&&imagesReady[i])//slide(i).isNull()) { worker->generate(i, rawImages.at(i)); - + delete[] indexes; return; } @@ -1416,7 +1424,7 @@ QImage ImageLoaderGL::loadImage(const QString& fileName) return image; } -ImageLoaderGL::ImageLoaderGL(YACReaderFlowGL * flow): +ImageLoaderGL::ImageLoaderGL(YACReaderFlowGL * flow): QThread(),flow(flow),restart(false), working(false), idx(-1) { @@ -1433,7 +1441,7 @@ ImageLoaderGL::~ImageLoaderGL() bool ImageLoaderGL::busy() const { return isRunning() ? working : false; -} +} void ImageLoaderGL::generate(int index, const QString& fileName) { @@ -1491,9 +1499,9 @@ void ImageLoaderGL::run() } } -QImage ImageLoaderGL::result() -{ - return img; +QImage ImageLoaderGL::result() +{ + return img; } //----------------------------------------------------------------------------- @@ -1526,7 +1534,7 @@ QImage ImageLoaderByteArrayGL::loadImage(const QByteArray& raw) return image; } -ImageLoaderByteArrayGL::ImageLoaderByteArrayGL(YACReaderFlowGL * flow): +ImageLoaderByteArrayGL::ImageLoaderByteArrayGL(YACReaderFlowGL * flow): QThread(),flow(flow),restart(false), working(false), idx(-1) { @@ -1543,7 +1551,7 @@ ImageLoaderByteArrayGL::~ImageLoaderByteArrayGL() bool ImageLoaderByteArrayGL::busy() const { return isRunning() ? working : false; -} +} void ImageLoaderByteArrayGL::generate(int index, const QByteArray& raw) { @@ -1591,8 +1599,7 @@ void ImageLoaderByteArrayGL::run() } } -QImage ImageLoaderByteArrayGL::result() -{ - return img; +QImage ImageLoaderByteArrayGL::result() +{ + return img; } - diff --git a/common/gl_legacy/yacreader_flow_gl.h b/common/gl_legacy/yacreader_flow_gl.h index ba025253..65666f28 100644 --- a/common/gl_legacy/yacreader_flow_gl.h +++ b/common/gl_legacy/yacreader_flow_gl.h @@ -57,13 +57,13 @@ struct Preset{ float animationSpeedUp; //sets the maximum speed of the animation float animationStepMax; - //sets the distance of view + //sets the distance of view float animationFadeOutDist; //sets the rotation increasion float preRotation; - //sets the light strenght on rotation + //sets the light strenght on rotation float viewRotateLightStrenght; - //sets the speed of the rotation + //sets the speed of the rotation float viewRotateAdd; //sets the speed of reversing the rotation float viewRotateSub; @@ -71,17 +71,17 @@ struct Preset{ float viewAngle; /*** Position Configuration ***/ - //the X Position of the Coverflow + //the X Position of the Coverflow float cfX; - //the Y Position of the Coverflow + //the Y Position of the Coverflow float cfY; - //the Z Position of the Coverflow + //the Z Position of the Coverflow float cfZ; - //the X Rotation of the Coverflow + //the X Rotation of the Coverflow float cfRX; - //the Y Rotation of the Coverflow + //the Y Rotation of the Coverflow float cfRY; - //the Z Rotation of the Coverflow + //the Z Rotation of the Coverflow float cfRZ; //sets the rotation of each cover float rotation; @@ -89,7 +89,7 @@ struct Preset{ float xDistance; //sets the distance between the centered and the non centered covers float centerDistance; - //sets the pushback amount + //sets the pushback amount float zDistance; //sets the elevation amount float yDistance; @@ -122,7 +122,7 @@ protected: void drawCover(const YACReader3DImage & image); void udpatePerspective(int width, int height); - + int updateCount; WidgetLoader * loader; int fontSize; @@ -143,16 +143,19 @@ protected: QVector images; bool hasBeenInitialized; + // sets flow direction right-to-left (manga mode) + bool flowRightToLeft; + Performance performance; bool bUseVSync; /*** Animation Settings ***/ Preset config; - //sets/returns the curent selected cover + //sets/returns the curent selected cover int currentSelected; - //defines the position of the centered cover + //defines the position of the centered cover YACReader3DVector centerPos; /*** Style ***/ @@ -172,7 +175,7 @@ protected: void startAnimationTimer(); void stopAnimationTimer(); - + public: @@ -198,7 +201,7 @@ public: void draw(); //updates the coverflow void updatePositions(); - //inserts a new item to the coverflow + //inserts a new item to the coverflow //if item is set to a value > -1 it updates a already set value //otherwise a new entry is set void insert(const char *name, GLuint Tex, float x, float y,int item = -1); @@ -215,9 +218,9 @@ public: public slots: void setCF_RX(int value); - //the Y Rotation of the Coverflow + //the Y Rotation of the Coverflow void setCF_RY(int value); - //the Z Rotation of the Coverflow + //the Z Rotation of the Coverflow void setCF_RZ(int value); //perspective @@ -228,7 +231,7 @@ public: void setX_Distance(int distance); //sets the distance between the centered and the non centered covers void setCenter_Distance(int distance); - //sets the pushback amount + //sets the pushback amount void setZ_Distance(int distance); void setCF_Y(int value); @@ -248,6 +251,8 @@ public: void useVSync(bool b); + void setFlowRightToLeft(bool b); + virtual void updateImageData() = 0; void reset(); @@ -336,7 +341,7 @@ protected: private: QMutex mutex; QWaitCondition condition; - + bool restart; bool working; diff --git a/common/pdf_comic.cpp b/common/pdf_comic.cpp new file mode 100644 index 00000000..36dc4e89 --- /dev/null +++ b/common/pdf_comic.cpp @@ -0,0 +1,141 @@ +#include "comic.h" +#include "pdf_comic.h" + +#if defined USE_PDFIUM && !defined NO_PDF + +int pdfRead(void* param, + unsigned long position, + unsigned char* pBuf, + unsigned long size) { + + QFile *file = static_cast(param); + + file->seek(position); + + qint64 numBytesRead = file->read(reinterpret_cast(pBuf), size); + + if(numBytesRead > 0) + { + return numBytesRead; + } + + return 0; +} + +// pdfium is not threadsafe +// We need to use mutex locking & refcounting to avoid crashes + +int PdfiumComic::refcount = 0; +QMutex PdfiumComic::pdfmutex; + +PdfiumComic::PdfiumComic() +{ + QMutexLocker locker(&pdfmutex); + if (++refcount == 1) { + FPDF_InitLibrary(); + } +} + +PdfiumComic::~PdfiumComic() +{ + QMutexLocker locker(&pdfmutex); + if (doc) + { + FPDF_CloseDocument(doc); + } + if (--refcount == 0) { + FPDF_DestroyLibrary(); + } +} + +bool PdfiumComic::openComic(const QString & path) +{ + pdfFile.setFileName(path); + + if(pdfFile.open(QIODevice::ReadOnly) == false) + { + qDebug() << "unable to open file : " << path; + return false; + } + + fileAccess.m_FileLen = pdfFile.size(); + fileAccess.m_GetBlock = pdfRead; + fileAccess.m_Param = &pdfFile; + + QMutexLocker lock(&pdfmutex); + doc = FPDF_LoadCustomDocument(&fileAccess, NULL); + if (doc) + { + return true; + } + else + { + qDebug() << FPDF_GetLastError(); + return false; + } +} + +void PdfiumComic::closeComic() +{ + QMutexLocker locker(&pdfmutex); + FPDF_CloseDocument(doc); +} + +unsigned int PdfiumComic::numPages() +{ + if (doc) + { + QMutexLocker locker(&pdfmutex); + return FPDF_GetPageCount(doc); + } + else + { + return 0; //-1? + } +} + +QImage PdfiumComic::getPage(const int page) +{ + if (!doc) + { + return QImage(); + } + + QImage image; + FPDF_PAGE pdfpage; + FPDF_BITMAP bitmap; + + QMutexLocker locker(&pdfmutex); + pdfpage = FPDF_LoadPage(doc, page); + + if (!pdfpage) + { + // TODO report error + qDebug() << FPDF_GetLastError(); + return QImage(); + } + + // TODO: make target DPI configurable + QSize pagesize((FPDF_GetPageWidth(pdfpage)/72)*150, + (FPDF_GetPageHeight(pdfpage)/72)*150); + // TODO: max render size too + if (pagesize.width() > 3840 || pagesize.height() > 3840) { + pagesize.scale(3840, 3840, Qt::KeepAspectRatio); + } + image = QImage(pagesize, QImage::Format_ARGB32);// QImage::Format_RGBX8888); + if (image.isNull()) + { + // TODO report OOM error + qDebug() << "Image too large, OOM"; + return image; + } + image.fill(0xFFFFFFFF); + + bitmap = FPDFBitmap_CreateEx(image.width(), image.height(), FPDFBitmap_BGRA, image.scanLine(0), image.bytesPerLine()); + // TODO: make render flags costumizable + FPDF_RenderPageBitmap(bitmap, pdfpage, 0,0, image.width(), image.height(), 0, (FPDF_LCD_TEXT)); + FPDFBitmap_Destroy(bitmap); + FPDF_ClosePage(pdfpage); + return image; +} +#endif //USE_PDFIUM diff --git a/common/pdf_comic.h b/common/pdf_comic.h index 7c5d7f48..db9e4565 100644 --- a/common/pdf_comic.h +++ b/common/pdf_comic.h @@ -1,22 +1,50 @@ -#ifndef PDF_COMIC_H +#if !defined PDF_COMIC_H && !defined NO_PDF #define PDF_COMIC_H #include #include +#include +#include +#if defined Q_OS_MAC && defined USE_PDFKIT class MacOSXPDFComic { -public: - MacOSXPDFComic(); - ~MacOSXPDFComic(); - bool openComic(const QString & path); - void closeComic(); - unsigned int numPages(); - QImage getPage(const int page); - void releaseLastPageData(); -private: - void * document; - void * lastPageData; -}; + public: + MacOSXPDFComic(); + ~MacOSXPDFComic(); + bool openComic(const QString & path); + void closeComic(); + unsigned int numPages(); + QImage getPage(const int page); + //void releaseLastPageData(); + private: + void * document; + void * lastPageData; + }; + +#elif defined USE_PDFIUM +#include + +class PdfiumComic +{ + public: + PdfiumComic(); + ~PdfiumComic(); + bool openComic(const QString & path); + void closeComic(); + unsigned int numPages(); + QImage getPage(const int page); + + private: + static int refcount; + static QMutex pdfmutex; + FPDF_LIBRARY_CONFIG config; + FPDF_DOCUMENT doc; + FPDF_FILEACCESS fileAccess; + QFile pdfFile; +}; +#else +#include "poppler-qt5.h" +#endif // Q_OS_MAC #endif // PDF_COMIC_H diff --git a/common/pdf_comic.mm b/common/pdf_comic.mm index 3eda1c07..e0693a16 100644 --- a/common/pdf_comic.mm +++ b/common/pdf_comic.mm @@ -64,12 +64,15 @@ QImage MacOSXPDFComic::getPage(const int pageNum) pageRect.origin = CGPointZero; CGColorSpaceRef genericColorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef bitmapContext = CGBitmapContextCreate(NULL, + + QImage renderImage = QImage(pageRect.size.width, pageRect.size.height, QImage::Format_ARGB32_Premultiplied); + + CGContextRef bitmapContext = CGBitmapContextCreate(renderImage.scanLine(0), pageRect.size.width, pageRect.size.height, - 8, 0, + 8,renderImage.bytesPerLine(), genericColorSpace, - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little //may need to be changed to kCGBitmapByteOrder32Big ); CGContextSetInterpolationQuality(bitmapContext, kCGInterpolationHigh); @@ -89,13 +92,13 @@ QImage MacOSXPDFComic::getPage(const int pageNum) CGContextDrawPDFPage(bitmapContext, page); - CGImageRef image = CGBitmapContextCreateImage(bitmapContext); + //CGImageRef image = CGBitmapContextCreateImage(bitmapContext); - QImage qtImage; + //QImage qtImage; - CFDataRef dataRef = CGDataProviderCopyData(CGImageGetDataProvider(image)); + //CFDataRef dataRef = CGDataProviderCopyData(CGImageGetDataProvider(image)); - lastPageData = (void *)dataRef; + /*lastPageData = (void *)dataRef; if(!lastPageData) { @@ -109,18 +112,19 @@ QImage MacOSXPDFComic::getPage(const int pageNum) const uchar *bytes = (const uchar *)CFDataGetBytePtr(dataRef); qtImage = QImage(bytes, pageRect.size.width, pageRect.size.height, QImage::Format_ARGB32); - - CGImageRelease(image); + */ + //CGImageRelease(image); //CFRelease(dataRef); CGContextRelease(bitmapContext); //CGPDFPageRelease(page); CGColorSpaceRelease(genericColorSpace); - return qtImage; + //return qtImage; + return renderImage; } -void MacOSXPDFComic::releaseLastPageData() +/*void MacOSXPDFComic::releaseLastPageData() { CFRelease((CFDataRef)lastPageData); -} +}*/ diff --git a/common/pictureflow.cpp b/common/pictureflow.cpp index d92f4299..61fe2d60 100644 --- a/common/pictureflow.cpp +++ b/common/pictureflow.cpp @@ -207,6 +207,8 @@ public: QVector leftSlides; QVector rightSlides; int centerIndex; + + bool flowRightToLeft; }; class PictureFlowAnimator @@ -281,7 +283,7 @@ private: PictureFlowState::PictureFlowState(int a, float sr): backgroundColor(0), slideWidth(150), slideHeight(200), -reflectionEffect(PictureFlow::BlurredReflection), centerIndex(0) , rawAngle(a), spacingRatio(sr) +reflectionEffect(PictureFlow::BlurredReflection), centerIndex(0) , rawAngle(a), spacingRatio(sr), flowRightToLeft(false) { } @@ -327,7 +329,10 @@ void PictureFlowState::reset() si.angle = angle; si.cx = -(offsetX + spacing*(i)*PFREAL_ONE); si.cy = offsetY; - si.slideIndex = centerIndex-1-i; + if(!flowRightToLeft) + si.slideIndex = centerIndex-1-i; + else + si.slideIndex = centerIndex+1+i; si.blend = 200; if(i == (int)leftSlides.count()-2) si.blend = 128; @@ -344,7 +349,10 @@ void PictureFlowState::reset() si.angle = -angle; si.cx = offsetX + spacing*(i)*PFREAL_ONE; si.cy = offsetY; - si.slideIndex = centerIndex+1+i; + if(!flowRightToLeft) + si.slideIndex = centerIndex+1+i; + else + si.slideIndex = centerIndex-1-i; si.blend = 200; if(i == (int)rightSlides.count()-2) si.blend = 128; @@ -423,13 +431,31 @@ void PictureFlowAnimator::update() frame = index << 16; state->centerSlide.slideIndex = state->centerIndex; for(int i = 0; i < (int)state->leftSlides.count(); i++) - state->leftSlides[i].slideIndex = state->centerIndex-1-i; + { + if(!state->flowRightToLeft) + state->leftSlides[i].slideIndex = state->centerIndex-1-i; + else + state->leftSlides[i].slideIndex = state->centerIndex+1+i; + } for(int i = 0; i < (int)state->rightSlides.count(); i++) - state->rightSlides[i].slideIndex = state->centerIndex+1+i; + { + if(!state->flowRightToLeft) + state->rightSlides[i].slideIndex = state->centerIndex+1+i; + else + state->rightSlides[i].slideIndex = state->centerIndex-1-i; + } } - state->centerSlide.angle = (step * tick * state->angle) >> 16; - state->centerSlide.cx = -step * fmul(state->offsetX, ftick); + if(!state->flowRightToLeft) + { + state->centerSlide.angle = (step * tick * state->angle) >> 16; + state->centerSlide.cx = -step * fmul(state->offsetX, ftick); + } + else + { + state->centerSlide.angle = (-step * tick * state->angle) >> 16; + state->centerSlide.cx = step * fmul(state->offsetX, ftick); + } state->centerSlide.cy = fmul(state->offsetY, ftick); if(state->centerIndex == target) @@ -443,7 +469,10 @@ void PictureFlowAnimator::update() { SlideInfo& si = state->leftSlides[i]; si.angle = state->angle; - si.cx = -(state->offsetX + state->spacing*(i)*PFREAL_ONE + step*state->spacing*ftick); + if(!state->flowRightToLeft) + si.cx = -(state->offsetX + state->spacing*(i)*PFREAL_ONE + step*state->spacing*ftick); + else + si.cx = -(state->offsetX + state->spacing*(i)*PFREAL_ONE - step*state->spacing*ftick); si.cy = state->offsetY; } @@ -451,24 +480,41 @@ void PictureFlowAnimator::update() { SlideInfo& si = state->rightSlides[i]; si.angle = -state->angle; - si.cx = state->offsetX + state->spacing*(i)*PFREAL_ONE - step*state->spacing*ftick; + if(!state->flowRightToLeft) + si.cx = state->offsetX + state->spacing*(i)*PFREAL_ONE - step*state->spacing*ftick; + else + si.cx = state->offsetX + state->spacing*(i)*PFREAL_ONE + step*state->spacing*ftick; si.cy = state->offsetY; } - if(step > 0) + if(step > 0 && !state->flowRightToLeft) { PFreal ftick = (neg * PFREAL_ONE) >> 16; state->rightSlides[0].angle = -(neg * state->angle) >> 16; state->rightSlides[0].cx = fmul(state->offsetX, ftick); state->rightSlides[0].cy = fmul(state->offsetY, ftick); } - else + else if(!state->flowRightToLeft) { PFreal ftick = (pos * PFREAL_ONE) >> 16; state->leftSlides[0].angle = (pos * state->angle) >> 16; state->leftSlides[0].cx = -fmul(state->offsetX, ftick); state->leftSlides[0].cy = fmul(state->offsetY, ftick); } + else if(step < 0) + { + PFreal ftick = (pos * PFREAL_ONE) >> 16; + state->rightSlides[0].angle = -(pos * state->angle) >> 16; + state->rightSlides[0].cx = fmul(state->offsetX, ftick); + state->rightSlides[0].cy = fmul(state->offsetY, ftick); + } + else + { + PFreal ftick = (neg * PFREAL_ONE) >> 16; + state->leftSlides[0].angle = (neg * state->angle) >> 16; + state->leftSlides[0].cx = -fmul(state->offsetX, ftick); + state->leftSlides[0].cy = fmul(state->offsetY, ftick); + } // must change direction ? if(target < index) if(step > 0) @@ -1053,6 +1099,13 @@ void PictureFlow::setReflectionEffect(ReflectionEffect effect) triggerRender(); } +void PictureFlow::setFlowRightToLeft(bool b) +{ + d->state->flowRightToLeft = b; + d->state->reset(); + triggerRender(); +} + QImage PictureFlow::slide(int index) const { QImage* i = 0; @@ -1225,7 +1278,8 @@ void PictureFlow::showSlide(unsigned int index) void PictureFlow::keyPressEvent(QKeyEvent* event) { - if(event->key() == Qt::Key_Left) + if((event->key() == Qt::Key_Left && !(d->state->flowRightToLeft)) + || (event->key() == Qt::Key_Right && d->state->flowRightToLeft)) { /*if(event->modifiers() == Qt::ControlModifier) showSlide(centerIndex()-10); @@ -1235,7 +1289,8 @@ void PictureFlow::keyPressEvent(QKeyEvent* event) return; } - if(event->key() == Qt::Key_Right) + if((event->key() == Qt::Key_Right && !(d->state->flowRightToLeft)) + || (event->key() == Qt::Key_Left && d->state->flowRightToLeft)) { /*if(event->modifiers() == Qt::ControlModifier) showSlide(centerIndex()+10); @@ -1256,10 +1311,19 @@ void PictureFlow::keyPressEvent(QKeyEvent* event) void PictureFlow::mousePressEvent(QMouseEvent* event) { - if(event->x() > width()/2) + mousePressEvent(event, 0); +} + +void PictureFlow::mousePressEvent(QMouseEvent* event, int slideWidth) +{ + if((event->x() > (width() + slideWidth)/2 && !(d->state->flowRightToLeft)) + || (event->x() < (width() - slideWidth)/2 && d->state->flowRightToLeft)) showNext(); - else - showPrevious(); + else if((event->x() < (width() - slideWidth)/2 && !(d->state->flowRightToLeft)) + || (event->x() > (width() + slideWidth)/2 && d->state->flowRightToLeft)) + showPrevious(); + + //else (centered slide space) } void PictureFlow::paintEvent(QPaintEvent* event) diff --git a/common/pictureflow.h b/common/pictureflow.h index 0ac197d4..df071d2a 100644 --- a/common/pictureflow.h +++ b/common/pictureflow.h @@ -119,7 +119,12 @@ public: */ void setReflectionEffect(ReflectionEffect effect); + /*! + Sets the flow direction right-to-left (manga mode) + */ + void setFlowRightToLeft(bool b); + public slots: /*! @@ -213,6 +218,7 @@ public: void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent* event); void mousePressEvent(QMouseEvent* event); + void mousePressEvent(QMouseEvent* event, int slideWidth); void resizeEvent(QResizeEvent* event); private slots: diff --git a/common/yacreader_global.h b/common/yacreader_global.h index c55a04c3..9b436586 100644 --- a/common/yacreader_global.h +++ b/common/yacreader_global.h @@ -1,19 +1,17 @@ #ifndef __YACREADER_GLOBAL_H #define __YACREADER_GLOBAL_H -#if QT_VERSION >= 0x050000 - #include -#else - #include -#endif +#include -#define VERSION "8.6.0" +#define VERSION "9.0.0" #define USE_BACKGROUND_IMAGE_IN_GRID_VIEW "USE_BACKGROUND_IMAGE_IN_GRID_VIEW" #define OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW "OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW" #define BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW "BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW" #define USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW "USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW" +#define REMOTE_BROWSE_PERFORMANCE_WORKAROUND "REMOTE_BROWSE_PERFORMANCE_WORKAROUND" + #define NUM_DAYS_BETWEEN_VERSION_CHECKS "NUM_DAYS_BETWEEN_VERSION_CHECKS" #define LAST_VERSION_CHECK "LAST_VERSION_CHECK" @@ -21,6 +19,8 @@ #define LIBRARIES "LIBRARIES" +#define MAX_LIBRARIES_WARNING_NUM 10 + namespace YACReader { @@ -63,11 +63,10 @@ namespace YACReader YLight, YDark }; - + QString getSettingsPath(); QString colorToName(LabelColors colors); QString labelColorToRGBString(LabelColors color); } #endif - diff --git a/common/yacreader_global_gui.h b/common/yacreader_global_gui.h index 9c36bd56..6c3f6ac5 100644 --- a/common/yacreader_global_gui.h +++ b/common/yacreader_global_gui.h @@ -28,6 +28,7 @@ #define GAMMA "GAMMA" #define SHOW_INFO "SHOW_INFO" #define QUICK_NAVI_MODE "QUICK_NAVI_MODE" +#define DISABLE_MOUSE_OVER_GOTO_FLOW "DISABLE_MOUSE_OVER_GOTO_FLOW" #define FLOW_TYPE_GL "FLOW_TYPE_GL" #define Y_POSITION "Y_POSITION" @@ -91,6 +92,11 @@ static const QString YACReaderLibrarSubReadingListMimeDataFormat = "application/ //Text=0x05 }; + enum LibraryUITheme + { + Light, + Dark + }; void addSperator(QWidget * w); QAction * createSeparator(); diff --git a/compileOSX.sh b/compileOSX.sh index b5a34ed8..2c68cde3 100755 --- a/compileOSX.sh +++ b/compileOSX.sh @@ -1,52 +1,56 @@ #! /bin/bash -if [ $2 == "clean" ]; then + +VERSION=${1:-"8.6.0"} + +if [ "$2" == "clean" ]; then ./cleanOSX.sh fi +hash qmake 2>/dev/null || { echo >&2 "Qmake command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; } + echo "Compiling YACReader" -cd ./YACReader -/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/qmake YACReader.pro -spec macx-clang "CONFIG+=release" +cd YACReader +qmake make cd .. echo "Compiling YACReaderLibrary" -cd ./YACReaderLibrary -/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/qmake YACReaderLibrary.pro -spec macx-clang "CONFIG+=release" +cd YACReaderLibrary +qmake make cd .. echo "Compiling YACReaderLibraryServer" -cd ./YACReaderLibrary -make clean -/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/qmake YACReaderLibraryServer.pro -spec macx-clang "CONFIG+=release" +cd YACReaderLibraryServer +qmake make cd .. echo "Configuring release apps" -cp -R ./YACReader/YACReader.app ./YACReader.app -cp -R ./YACReaderLibrary/YACReaderLibrary.app ./YACReaderLibrary.app -cp -R ./YACReaderLibrary/YACReaderLibraryServer.app ./YACReaderLibraryServer.app +cp -R YACReader/YACReader.app YACReader.app +cp -R YACReaderLibrary/YACReaderLibrary.app YACReaderLibrary.app +cp -R YACReaderLibraryServer/YACReaderLibraryServer.app YACReaderLibraryServer.app ./releaseOSX.sh echo "Copying to destination folder" -dest='YACReader-'$1' MacOSX-Intel' -mkdir "$dest" -cp -R ./YACReader.app "./${dest}/YACReader.app" -cp -R ./YACReaderLibrary.app "./${dest}/YACReaderLibrary.app" -cp -R ./YACReaderLibraryServer.app "./${dest}/YACReaderLibraryServer" +dest="YACReader-$VERSION MacOSX-Intel" +mkdir -p "$dest" +cp -R YACReader.app "${dest}/YACReader.app" +cp -R YACReaderLibrary.app "${dest}/YACReaderLibrary.app" +cp -R YACReaderLibraryServer.app "${dest}/YACReaderLibraryServer" -cp ./COPYING.txt "./${dest}/" -cp ./README.txt "./${dest}/" +cp COPYING.txt "${dest}/" +cp README.txt "${dest}/" -#mkdir "./${dest}/icons/" -#cp ./images/db.png "./${dest}/icons/" -#cp ./images/coversPackage.png "./${dest}/icons/" +#mkdir -p "${dest}/icons/" +#cp images/db.png "${dest}/icons/" +#cp images/coversPackage.png "${dest}/icons/" echo "Creating dmg package" #tar -czf "${dest}".tar.gz "${dest}" #hdiutil create "${dest}".dmg -srcfolder "./${dest}" -ov -./create-dmg --volname 'YACReader '$1' Installer' --volicon icon.icns --window-size 600 403 --icon-size 128 --app-drop-link 485 90 --background background.png --icon YACReader 80 90 --icon YACReaderLibrary 235 90 --eula COPYING.txt --icon YACReaderLibraryServer 470 295 --icon README.txt 120 295 --icon COPYING.txt 290 295 "./${dest}.dmg" "./${dest}" +./dependencies/create-dmg/create-dmg --volname "YACReader $VERSION Installer" --volicon icon.icns --window-size 600 403 --icon-size 128 --app-drop-link 485 90 --background background.png --icon YACReader 80 90 --icon YACReaderLibrary 235 90 --eula COPYING.txt --icon YACReaderLibraryServer 470 295 --icon README.txt 120 295 --icon COPYING.txt 290 295 "$dest.dmg" "$dest" echo "Done!" diff --git a/compressed_archive/README_7zip.txt b/compressed_archive/README_7zip.txt index 1653bbdd..92c75ebe 100644 --- a/compressed_archive/README_7zip.txt +++ b/compressed_archive/README_7zip.txt @@ -1,13 +1,19 @@ -If you are trying to compile YACReader with a 7zip decompression backend, you need to download de source code of 7zip (Windows) or p7zip (Linux/MacOSX). +If you are trying to compile YACReader with a 7zip decompression backend, +you need to download de source code of 7zip (Windows) or p7zip (Linux/MacOSX). -Please extract it and rename the folder to lib7zip (Windows) or libp7zip (Linux/MacOSX), then copy it to $YACREADER_SRC/compressed_archive/ (this -folder). +Please extract it and rename the folder to lib7zip (Windows) or libp7zip (Linux/MacOSX), +then copy it to $YACREADER_SRC/compressed_archive/ (this folder). YACReader is compiled using 7zip/p7zip 9.20.1 and will not work with newer versions. -On Linux/Unix this means your YACReader installation will stop working if you update your installation of p7zip to a newer version. If you wish to keep using -p7zip with YACReader, you can copy 7z.so and Codecs/Rar29.so from p7zip 9.20.1 to "/usr/lib/yacreader/". YACReader will then detect these files and use -them instead of the system provided p7zip files which allows you to keep both YACReader and an up to date p7zip installation. +On Linux/Unix this means your YACReader installation will stop working if you +update your installation of p7zip to a newer version. If you wish to keep using +p7zip with YACReader, you can copy 7z.so and Codecs/Rar29.so from p7zip 9.20.1 +to "/usr/lib/yacreader/". YACReader will then detect these files and use +them instead of the system provided p7zip files which allows you to keep both +YACReader and an up to date p7zip installation. -Please keep in mind this is only a workaround that is provided for backwards compatibility and not intended as a long time solution. -It is recommended that you switch to unarr as a decompression backend instead (see README.txt in compressed_archive/unarr). \ No newline at end of file +Please keep in mind this is only a workaround that is provided for backwards +compatibility and not intended as a long time solution. +It is recommended that you switch to unarr as a decompression backend instead +(see README.txt in compressed_archive/unarr). diff --git a/compressed_archive/unarr/README.txt b/compressed_archive/unarr/README.txt index bc96eb93..7c2ff285 100644 --- a/compressed_archive/unarr/README.txt +++ b/compressed_archive/unarr/README.txt @@ -1,6 +1,17 @@ -To use unarr as a decompression engine when building YACReader, download https://github.com/zeniko/unarr/archive/master.zip and extract it in this folder. -This will build unarr as a part of YACReader (static build). +Starting with YACReader 9.0.0 all versions of YACReader use (lib)unarr >= 1.0.1 +as decompression backend. For Windows and MacOSX precompiled libraries +are available in the dependencies folder (not included in the source tarballs!). -If you're on a Linux/Unix system and prefer to use unarr as a shared library, have a look at https://github.com/selmf/unarr/ -This fork of unarr includes a CMake based build system that allows you to build and install unarr as a shared library. YACReader will detect and use -the installed library at build time if it is installed. \ No newline at end of file +For all other operating systems or users who wish to compile unarr themselves, +source code and build instructions are available at https://github.com/selmf/unarr/ + +For best performance it is recommended to build and install unarr as a shared +library. + +Users who prefer an embedded build can also download a snapshot from +https://github.com/selmf/unarr/archive/master.zip and extract it in this folder. +The build system will then detect the presence of the source code and include it +in the build process. However, as the embedded build option uses different +compiler flags and does not include any options to detect and make use of libraries +like zlib, bzip2 or lzma embedded builds will have slower extraction speed +and won't support zip files with bzip2 or xz compression. diff --git a/compressed_archive/unarr/compressed_archive.cpp b/compressed_archive/unarr/compressed_archive.cpp index b7594986..d9bfe53f 100644 --- a/compressed_archive/unarr/compressed_archive.cpp +++ b/compressed_archive/unarr/compressed_archive.cpp @@ -4,21 +4,22 @@ #include #include "extract_delegate.h" - -extern"C" { -#include "unarr.h" -} +#include CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) : QObject(parent),valid(false),tools(true),numFiles(0),ar(NULL),stream(NULL) { //open file - stream = ar_open_file(filePath.toStdString().c_str()); + #ifdef Q_OS_WIN + stream = ar_open_file_w((wchar_t *)filePath.utf16()); + #else + stream = ar_open_file(filePath.toLocal8Bit().constData()); + #endif if (!stream) { return; } - + //open archive ar = ar_open_rar_archive(stream); //TODO: build unarr with 7z support and test this! @@ -30,9 +31,9 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) { return; } - + //initial parse - while (ar_parse_entry(ar)) + while (ar_parse_entry(ar)) { //make sure we really got a file header if (ar_entry_get_size(ar) > 0) @@ -43,7 +44,7 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) } } if (!ar_at_eof(ar)) - { + { //fail if the initial parse didn't reach EOF //this might be a bit too drastic qDebug() << "Error while parsing archive"; @@ -84,14 +85,19 @@ int CompressedArchive::getNumFiles() void CompressedArchive::getAllData(const QVector & indexes, ExtractDelegate * delegate) { - if (indexes.isEmpty()) + if (indexes.isEmpty()) return; - + QByteArray buffer; - + int i=0; while (i < indexes.count()) { + if(delegate->isCancelled()) + { + return; + } + //use the offset list so we generated so we're not getting any non-page files ar_parse_entry_at(ar, offsets.at(indexes.at(i))); //set ar_entry to start of indexes buffer.resize(ar_entry_get_size(ar)); @@ -102,7 +108,7 @@ void CompressedArchive::getAllData(const QVector & indexes, ExtractDele else { delegate->crcError(indexes.at(i)); //we could not extract it... - } + } i++; } } diff --git a/compressed_archive/unarr/compressed_archive.h b/compressed_archive/unarr/compressed_archive.h index c0a99938..3aa4d3ab 100644 --- a/compressed_archive/unarr/compressed_archive.h +++ b/compressed_archive/unarr/compressed_archive.h @@ -4,7 +4,7 @@ #include #include "extract_delegate.h" extern"C" { -#include "unarr.h" +#include } class CompressedArchive : public QObject diff --git a/compressed_archive/unarr/extract_delegate.h b/compressed_archive/unarr/extract_delegate.h index 888d886a..1dbc8966 100644 --- a/compressed_archive/unarr/extract_delegate.h +++ b/compressed_archive/unarr/extract_delegate.h @@ -9,6 +9,7 @@ class ExtractDelegate virtual void fileExtracted(int index, const QByteArray & rawData) = 0; virtual void crcError(int index) = 0; virtual void unknownError(int index) = 0; + virtual bool isCancelled() = 0; }; #endif //EXTRACT_DELEGATE_H \ No newline at end of file diff --git a/compressed_archive/unarr/unarr-wrapper.pri b/compressed_archive/unarr/unarr-wrapper.pri index 2ba188c6..56cfe401 100644 --- a/compressed_archive/unarr/unarr-wrapper.pri +++ b/compressed_archive/unarr/unarr-wrapper.pri @@ -2,35 +2,53 @@ INCLUDEPATH += $$PWD DEPENDPATH += $$PWD HEADERS += $$PWD/extract_delegate.h \ - $$PWD/compressed_archive.h \ + $$PWD/compressed_archive.h -SOURCES += $$PWD/compressed_archive.cpp \ +SOURCES += $$PWD/compressed_archive.cpp -unix:!macx:exists (/usr/include/unarr.h) { - message(Using system provided unarr installation) - LIBS+=-lunarr - DEFINES+=use_unarr - } -else:macx:exists (../../dependencies/unarr/libunarr.dynlib) { - LIBS += -L../../dependencies/unarr/ -lunarr - DEFINES+=use_unarr - } +unix:!macx { + !contains(QT_CONFIG, no-pkg-config):packagesExist(libunarr) { + message(Using system provided unarr installation found by pkg-config.) + CONFIG += link_pkgconfig + PKGCONFIG += libunarr + DEFINES += use_unarr + } + else:exists(/usr/include/unarr.h):exists(/usr/lib/libunarr.so) { + message(Using system provided unarr installation.) + LIBS += -lunarr + DEFINES += use_unarr + } + } -else:win32:exists (../../dependencies/unarr/unarr.dll) { - LIBS += -L../../dependencies/unarr/ -lunarr - DEFINES+=use_unarr - } +else:macx:exists(../../dependencies/unarr/macx/libunarr.a) { + message(Found prebuilt unarr library in dependencies directory.) + INCLUDEPATH += $$PWD/../../dependencies/unarr/macx + LIBS += -L$$PWD/../../dependencies/unarr/macx -lunarr -lz -lbz2 + DEFINES += use_unarr + } + +else:win32:exists(../../dependencies/unarr/win/unarr.h) { + message(Found prebuilt unarr library in dependencies directory.) + INCLUDEPATH += $$PWD/../../dependencies/unarr/win + contains(QMAKE_TARGET.arch, x86_64): { + LIBS += -L$$PWD/../../dependencies/unarr/win/x64 -lunarr + } else { + LIBS += -L$$PWD/../../dependencies/unarr/win/x86 -lunarr + } + DEFINES += use_unarr UNARR_IS_SHARED_LIBRARY + } else:exists ($$PWD/unarr-master) { - message(Found unarr source-code) - message(Unarr will be build as a part of YACReader) - - #qmake based unarr build system - #this should only be used for testing or as a last resort - include(unarr.pro) - DEFINES+=use_unarr - } - else { - error(Missing dependency: unarr decrompression backend. Please install libunarr on your system\ - or provide a copy of the unarr source code in compressed_archive/unarr/unarr-master) - } \ No newline at end of file + message(Found unarr source-code) + message(Unarr will be build as a part of YACReader) + + # qmake based unarr build system + # this should only be used for testing or as a last resort + include(unarr.pro) + DEFINES += use_unarr + } + +else { + error(Missing dependency: unarr decrompression backend. Please install libunarr on your system\ + or provide a copy of the unarr source code in compressed_archive/unarr/unarr-master) + } diff --git a/config.pri b/config.pri index 0d4733bd..2f6564a1 100644 --- a/config.pri +++ b/config.pri @@ -1,8 +1,8 @@ -#functions to automatically initialize some of YACReader's build options to -#default values if they're not set on build time -#for a more detailed description, see INSTALL.TXT +# functions to automatically initialize some of YACReader's build options to +# default values if they're not set on build time +# for a more detailed description, see INSTALL.TXT -#check Qt version +# check Qt version QT_VERSION = $$[QT_VERSION] QT_VERSION = $$split(QT_VERSION, ".") QT_VER_MAJ = $$member(QT_VERSION, 0) @@ -10,31 +10,47 @@ QT_VER_MIN = $$member(QT_VERSION, 1) lessThan(QT_VER_MAJ, 5) { error(YACReader requires Qt 5 or newer but Qt $$[QT_VERSION] was detected.) - } -lessThan(QT_VER_MIN, 4):!CONFIG(no_opengl) { - CONFIG += legacy_gl_widget - message ("Qt < 5.4 detected. Using QGLWidget for coverflow.") - } -lessThan(QT_VER_MIN, 3){ - error ("You need at least Qt 5.3 to build YACReader or YACReaderLibrary") - } - -#build without opengl widget support -CONFIG(no_opengl) { - DEFINES += NO_OPENGL + } +lessThan(QT_VER_MIN, 6) { + warning ("Qt < 5.6 detected. Compilation will probably work, but some qml based components in YACReaderLibrary (GridView, InfoView) will fail at runtime.") + } +lessThan(QT_VER_MIN, 4):!CONFIG(no_opengl) { + CONFIG += legacy_gl_widget + warning ("Qt < 5.4 detected. Using QGLWidget for coverflow.") + warning ("QGLWidget based coverflow is scheduled for removal.") + } +lessThan(QT_VER_MIN, 3) { + error ("You need at least Qt 5.3 to compile YACReader or YACReaderLibrary.") + } + +# Disable coverflow for arm targets +isEmpty(QMAKE_TARGET.arch) { + QMAKE_TARGET.arch = $$QMAKE_HOST.arch +} +contains(QMAKE_TARGET.arch, arm.*) { + message("Building for ARM architecture. Disabling OpenGL coverflow ...") + CONFIG += no_opengl } +# build without opengl widget support +CONFIG(no_opengl) { + DEFINES += NO_OPENGL +} + +# default value for comic archive decompression backend !CONFIG(unarr):!CONFIG(7zip) { - unix { - !macx { - CONFIG+=unarr - } - else { - CONFIG+=7zip - } - - } - win32 { - CONFIG+=7zip - } -} \ No newline at end of file + CONFIG += unarr +} + +# default values for pdf render backend +win32:!CONFIG(poppler):!CONFIG(pdfium):!CONFIG(no_pdf) { + CONFIG += pdfium +} + +unix:!macx:!CONFIG(poppler):!CONFIG(pdfium):!CONFIG(no_pdf) { + CONFIG += poppler +} + +macx:!CONFIG(pdfkit):!CONFIG(pdfium):!CONFIG(no_pdf) { + CONFIG += pdfium +} diff --git a/create-dmg b/create-dmg deleted file mode 100755 index b581913f..00000000 --- a/create-dmg +++ /dev/null @@ -1,221 +0,0 @@ -#! /bin/bash - -# Create a read-only disk image of the contents of a folder - -set -e; - -function pure_version() { - echo '1.0.0.2' -} - -function version() { - echo "create-dmg $(pure_version)" -} - -function usage() { - version - echo "Creates a fancy DMG file." - echo "Usage: $(basename $0) options... image.dmg source_folder" - echo "All contents of source_folder will be copied into the disk image." - echo "Options:" - echo " --volname name" - echo " set volume name (displayed in the Finder sidebar and window title)" - echo " --volicon icon.icns" - echo " set volume icon" - echo " --background pic.png" - echo " set folder background image (provide png, gif, jpg)" - echo " --window-pos x y" - echo " set position the folder window" - echo " --window-size width height" - echo " set size of the folder window" - echo " --icon-size icon_size" - echo " set window icons size (up to 128)" - echo " --icon file_name x y" - echo " set position of the file's icon" - echo " --hide-extension file_name" - echo " hide the extension of file" - echo " --custom-icon file_name custom_icon_or_sample_file x y" - echo " set position and custom icon" - echo " --app-drop-link x y" - echo " make a drop link to Applications, at location x,y" - echo " --eula eula_file" - echo " attach a license file to the dmg" - echo " --no-internet-enable" - echo " disable automatic mount©" - echo " --version show tool version number" - echo " -h, --help display this help" - exit 0 -} - -WINX=10 -WINY=60 -WINW=500 -WINH=350 -ICON_SIZE=128 - -while test "${1:0:1}" = "-"; do - case $1 in - --volname) - VOLUME_NAME="$2" - shift; shift;; - --volicon) - VOLUME_ICON_FILE="$2" - shift; shift;; - --background) - BACKGROUND_FILE="$2" - BACKGROUND_FILE_NAME="$(basename $BACKGROUND_FILE)" - BACKGROUND_CLAUSE="set background picture of opts to file \".background:$BACKGROUND_FILE_NAME\"" - shift; shift;; - --icon-size) - ICON_SIZE="$2" - shift; shift;; - --window-pos) - WINX=$2; WINY=$3 - shift; shift; shift;; - --window-size) - WINW=$2; WINH=$3 - shift; shift; shift;; - --icon) - POSITION_CLAUSE="${POSITION_CLAUSE}set position of item \"$2\" to {$3, $4} -" - shift; shift; shift; shift;; - --hide-extension) - HIDING_CLAUSE="${HIDING_CLAUSE}set the extension hidden of item \"$2\" to true" - shift; shift;; - --custom-icon) - shift; shift; shift; shift; shift;; - -h | --help) - usage;; - --version) - version; exit 0;; - --pure-version) - pure_version; exit 0;; - --app-drop-link) - APPLICATION_LINK=$2 - APPLICATION_CLAUSE="set position of item \"Applications\" to {$2, $3} -" - shift; shift; shift;; - --eula) - EULA_RSRC=$2 - shift; shift;; - --no-internet-enable) - NOINTERNET=1 - shift;; - -*) - echo "Unknown option $1. Run with --help for help." - exit 1;; - esac -done - -test -z "$2" && { - echo "Not enough arguments. Invoke with --help for help." - exit 1 -} - -DMG_PATH="$1" -DMG_DIRNAME="$(dirname "$DMG_PATH")" -DMG_DIR="$(cd $DMG_DIRNAME > /dev/null; pwd)" -DMG_NAME="$(basename "$DMG_PATH")" -DMG_TEMP_NAME="$DMG_DIR/rw.${DMG_NAME}" -SRC_FOLDER="$(cd "$2" > /dev/null; pwd)" -test -z "$VOLUME_NAME" && VOLUME_NAME="$(basename "$DMG_PATH" .dmg)" - -AUX_PATH="$(dirname $0)/support" - -test -d "$AUX_PATH" || { - echo "Cannot find support directory: $AUX_PATH" - exit 1 -} - -if [ -f "$SRC_FOLDER/.DS_Store" ]; then - echo "Deleting any .DS_Store in source folder" - rm "$SRC_FOLDER/.DS_Store" -fi - -# Create the image -echo "Creating disk image..." -test -f "${DMG_TEMP_NAME}" && rm -f "${DMG_TEMP_NAME}" -ACTUAL_SIZE=`du -sm "$SRC_FOLDER" | sed -e 's/ .*//g'` -DISK_IMAGE_SIZE=$(expr $ACTUAL_SIZE + 20) -hdiutil create -srcfolder "$SRC_FOLDER" -volname "${VOLUME_NAME}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${DISK_IMAGE_SIZE}m "${DMG_TEMP_NAME}" - -# mount it -echo "Mounting disk image..." -MOUNT_DIR="/Volumes/${VOLUME_NAME}" - -# try unmount dmg if it was mounted previously (e.g. developer mounted dmg, installed app and forgot to unmount it) -echo "Unmounting disk image..." -DEV_NAME=$(hdiutil info | egrep '^/dev/' | sed 1q | awk '{print $1}') -test -d "${MOUNT_DIR}" && hdiutil detach "${DEV_NAME}" - -echo "Mount directory: $MOUNT_DIR" -DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}') -echo "Device name: $DEV_NAME" - -if ! test -z "$BACKGROUND_FILE"; then - echo "Copying background file..." - test -d "$MOUNT_DIR/.background" || mkdir "$MOUNT_DIR/.background" - cp "$BACKGROUND_FILE" "$MOUNT_DIR/.background/$BACKGROUND_FILE_NAME" -fi - -if ! test -z "$APPLICATION_LINK"; then - echo "making link to Applications dir" - echo $MOUNT_DIR - ln -s /Applications "$MOUNT_DIR/Applications" -fi - -if ! test -z "$VOLUME_ICON_FILE"; then - echo "Copying volume icon file '$VOLUME_ICON_FILE'..." - cp "$VOLUME_ICON_FILE" "$MOUNT_DIR/.VolumeIcon.icns" - SetFile -c icnC "$MOUNT_DIR/.VolumeIcon.icns" -fi - -# run applescript -APPLESCRIPT=$(mktemp -t createdmg) -cat "$AUX_PATH/template.applescript" | sed -e "s/WINX/$WINX/g" -e "s/WINY/$WINY/g" -e "s/WINW/$WINW/g" -e "s/WINH/$WINH/g" -e "s/BACKGROUND_CLAUSE/$BACKGROUND_CLAUSE/g" -e "s/ICON_SIZE/$ICON_SIZE/g" | perl -pe "s/POSITION_CLAUSE/$POSITION_CLAUSE/g" | perl -pe "s/APPLICATION_CLAUSE/$APPLICATION_CLAUSE/g" | perl -pe "s/HIDING_CLAUSE/$HIDING_CLAUSE/" >"$APPLESCRIPT" - -echo "Running Applescript: /usr/bin/osascript \"${APPLESCRIPT}\" \"${VOLUME_NAME}\"" -"/usr/bin/osascript" "${APPLESCRIPT}" "${VOLUME_NAME}" || true -echo "Done running the applescript..." -sleep 4 - -rm "$APPLESCRIPT" - -# make sure it's not world writeable -echo "Fixing permissions..." -chmod -Rf go-w "${MOUNT_DIR}" &> /dev/null || true -echo "Done fixing permissions." - -# make the top window open itself on mount: -echo "Blessing started" -bless --folder "${MOUNT_DIR}" --openfolder "${MOUNT_DIR}" -echo "Blessing finished" - -if ! test -z "$VOLUME_ICON_FILE"; then - # tell the volume that it has a special file attribute - SetFile -a C "$MOUNT_DIR" -fi - -# unmount -echo "Unmounting disk image..." -hdiutil detach "${DEV_NAME}" - -# compress image -echo "Compressing disk image..." -hdiutil convert "${DMG_TEMP_NAME}" -format UDZO -imagekey zlib-level=9 -o "${DMG_DIR}/${DMG_NAME}" -rm -f "${DMG_TEMP_NAME}" - -# adding EULA resources -if [ ! -z "${EULA_RSRC}" -a "${EULA_RSRC}" != "-null-" ]; then - echo "adding EULA resources" - "${AUX_PATH}/dmg-license.py" "${DMG_DIR}/${DMG_NAME}" "${EULA_RSRC}" -fi - -if [ ! -z "${NOINTERNET}" -a "${NOINTERNET}" == 1 ]; then - echo "not setting 'internet-enable' on the dmg" -else - hdiutil internet-enable -yes "${DMG_DIR}/${DMG_NAME}" -fi - -echo "Disk image done" -exit 0 diff --git a/custom_widgets/yacreader_flow.cpp b/custom_widgets/yacreader_flow.cpp index e40507d3..7da4715f 100644 --- a/custom_widgets/yacreader_flow.cpp +++ b/custom_widgets/yacreader_flow.cpp @@ -7,12 +7,7 @@ YACReaderFlow::YACReaderFlow(QWidget * parent,FlowType flowType) : PictureFlow(p void YACReaderFlow::mousePressEvent(QMouseEvent* event) { - if(event->x() > (width()+slideSize().width())/2) - showNext(); - else - if(event->x() < (width()-slideSize().width())/2) - showPrevious(); - //else (centered cover space) + PictureFlow::mousePressEvent(event, slideSize().width()); } void YACReaderFlow::mouseDoubleClickEvent(QMouseEvent* event) diff --git a/custom_widgets/yacreader_options_dialog.cpp b/custom_widgets/yacreader_options_dialog.cpp index db4d1f34..8e7af105 100644 --- a/custom_widgets/yacreader_options_dialog.cpp +++ b/custom_widgets/yacreader_options_dialog.cpp @@ -320,8 +320,14 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings) } //END FLOW CONFIG - #endif +#endif } + +void YACReaderOptionsDialog::restoreOptions() +{ + restoreOptions(settings); +} + #ifndef NO_OPENGL void YACReaderOptionsDialog::loadConfig() { @@ -356,46 +362,46 @@ void YACReaderOptionsDialog::setOverlappedStripeConfigSW() #ifndef NO_OPENGL void YACReaderOptionsDialog::setClassicConfig() { - settings->setValue(FLOW_TYPE_GL,CoverFlowLike); - gl->setValues(presetYACReaderFlowClassicConfig); saveFlowParameters(); + + settings->setValue(FLOW_TYPE_GL,CoverFlowLike); } void YACReaderOptionsDialog::setStripeConfig() { - settings->setValue(FLOW_TYPE_GL,Strip); - gl->setValues(presetYACReaderFlowStripeConfig); saveFlowParameters(); + + settings->setValue(FLOW_TYPE_GL,Strip); } void YACReaderOptionsDialog::setOverlappedStripeConfig() { - settings->setValue(FLOW_TYPE_GL,StripOverlapped); - gl->setValues(presetYACReaderFlowOverlappedStripeConfig); saveFlowParameters(); + + settings->setValue(FLOW_TYPE_GL,StripOverlapped); } void YACReaderOptionsDialog::setModernConfig() { - settings->setValue(FLOW_TYPE_GL,Modern); - gl->setValues(defaultYACReaderFlowConfig); saveFlowParameters(); + + settings->setValue(FLOW_TYPE_GL,Modern); } void YACReaderOptionsDialog::setRouletteConfig() { - settings->setValue(FLOW_TYPE_GL,Roulette); - gl->setValues(pressetYACReaderFlowDownConfig); saveFlowParameters(); + + settings->setValue(FLOW_TYPE_GL,Roulette); } #endif diff --git a/custom_widgets/yacreader_options_dialog.h b/custom_widgets/yacreader_options_dialog.h index 8921e661..ab73edc2 100644 --- a/custom_widgets/yacreader_options_dialog.h +++ b/custom_widgets/yacreader_options_dialog.h @@ -34,6 +34,7 @@ public: YACReaderOptionsDialog(QWidget * parent); public slots: virtual void restoreOptions(QSettings * settings); + virtual void restoreOptions(); virtual void saveOptions(); protected slots: #ifndef NO_OPENGL diff --git a/dependencies/pdf_backend.pri b/dependencies/pdf_backend.pri new file mode 100644 index 00000000..f0f9e4e6 --- /dev/null +++ b/dependencies/pdf_backend.pri @@ -0,0 +1,73 @@ +CONFIG(no_pdf) { + DEFINES += "NO_PDF" +} + +CONFIG(pdfium) { + DEFINES += "USE_PDFIUM" + SOURCES += ../common/pdf_comic.cpp + win32 { + INCLUDEPATH += $$PWD/pdfium/win/public + contains(QMAKE_TARGET.arch, x86_64): { + LIBS += -L$$PWD/pdfium/win/x64 -lpdfium + } else { + LIBS += -L$$PWD/pdfium/win/x86 -lpdfium + } + } + unix { + macx { + LIBS += -L$$PWD/pdfium/macx/bin -lpdfium + INCLUDEPATH += $$PWD/pdfium/macx/include + } + else:!contains(QT_CONFIG, no-pkg-config):packagesExist(libpdfium) { + message(Using system provided installation of libpdfium found by pkg-config.) + CONFIG += link_pkgconfig + PKGCONFIG += libpdfium + } else:exists(/usr/include/pdfium):exists(/usr/lib/libpdfium.so) { + message(Using libpdfium found at /usr/lib/pdfium) + INCLUDEPATH += /usr/include/pdfium + LIBS += -L/usr/lib/pdfium -lpdfium + } else { + error(Could not find libpdfium.) + } + } +} + +CONFIG(pdfkit) { + !macx { + error (Pdfkit is macOS only) + } else { + DEFINES += "USE_PDFKIT" + OBJECTIVE_SOURCES += ../common/pdf_comic.mm + } +} + +CONFIG(poppler) { + win32 { + contains(QMAKE_TARGET.arch, x86_64): { + error ("We currently don't ship precompiled poppler libraries for 64 bit builds on Windows") + } + INCLUDEPATH += $$PWD/poppler/include/qt5 + LIBS += -L$$PWD/poppler/lib -lpoppler-qt5 + # Add extra paths for dll dependencies so the executables don't crash when launching + # from QtCreator + LIBS += -L$$PWD/poppler/bin + LIBS += -L$$PWD/poppler/dependencies/bin + } + unix:!macx { + !contains(QT_CONFIG, no-pkg-config):packagesExist(poppler-qt5) { + message("Using system provided installation of poppler-qt5 found by pkg-config.") + CONFIG += link_pkgconfig + PKGCONFIG += poppler-qt5 + } else:!macx:exists(/usr/include/poppler/qt5):exists(/usr/lib/libpoppler-qt5) { + message("Using system provided installation of poppler-qt5.") + INCLUDEPATH += /usr/include/poppler/qt5 + LIBS += -L/usr/lib -lpoppler-qt5 + } else { + error("Could not find poppler-qt5") + } + + } + unix:macx { + error (Poppler backend is currently not supported on macOS) + } +} diff --git a/dependencies/pdfium/macx/VERSION b/dependencies/pdfium/macx/VERSION new file mode 100644 index 00000000..df9a9c77 --- /dev/null +++ b/dependencies/pdfium/macx/VERSION @@ -0,0 +1,18 @@ +YACReader for macOS uses a precompiled single static library version of pdfium. + +pdfium branch used for building: chromium/3071 (current beta) + +build parameters used (gn args): + +pdf_enable_xfa = false +pdf_enable_v8 = false +pdf_is_complete_lib = true +is_official_build = true +symbol_level = 0 + +Instructions on building pdfium can be found at https://pdfium.googlesource.com/pdfium + +It is recommended to always use the branch the current stable version of chromium uses. +To get the pdfium branch corresponding to Chromium stable, look at +http://omahaproxy.appspot.com and search for the true_branch variable associated with +the current stable dev channel of Chromium. diff --git a/dependencies/pdfium/macx/bin/libpdfium.a b/dependencies/pdfium/macx/bin/libpdfium.a new file mode 100644 index 00000000..4263fb3b Binary files /dev/null and b/dependencies/pdfium/macx/bin/libpdfium.a differ diff --git a/dependencies/pdfium/macx/include/DEPS b/dependencies/pdfium/macx/include/DEPS new file mode 100644 index 00000000..d0005cac --- /dev/null +++ b/dependencies/pdfium/macx/include/DEPS @@ -0,0 +1,8 @@ +include_rules = [ + # public/ needs to be standalone. Explicitly disallow everything. + '-core', + '-fpdfsdk', + '-testing', + '-third_party', + '-v8', +] diff --git a/dependencies/pdfium/macx/include/README b/dependencies/pdfium/macx/include/README new file mode 100644 index 00000000..b07d0f30 --- /dev/null +++ b/dependencies/pdfium/macx/include/README @@ -0,0 +1,13 @@ +public/ README + +The header files in this directory are the only ones that should ever be +included by an embedder of PDFium. If there arises a need for functionality +beyond what is present here, then a new API must be added here to provide it. + +These header files must be entirely contained in this directory; they must +never include other header files from outside of it. + +These files must compile cleanly without warnings on both C and C++ compilers. + +Changes to these files must be carefully considered to avoid breaking +compatibility. diff --git a/dependencies/pdfium/macx/include/cpp/fpdf_deleters.h b/dependencies/pdfium/macx/include/cpp/fpdf_deleters.h new file mode 100644 index 00000000..d56daf5c --- /dev/null +++ b/dependencies/pdfium/macx/include/cpp/fpdf_deleters.h @@ -0,0 +1,46 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PUBLIC_CPP_FPDF_DELETERS_H_ +#define PUBLIC_CPP_FPDF_DELETERS_H_ + +#include "public/fpdf_dataavail.h" +#include "public/fpdf_formfill.h" +#include "public/fpdf_structtree.h" +#include "public/fpdf_text.h" +#include "public/fpdfview.h" + +// Custom deleters for using FPDF_* types with std::unique_ptr<>. + +struct FPDFAvailDeleter { + inline void operator()(FPDF_AVAIL avail) { FPDFAvail_Destroy(avail); } +}; + +struct FPDFBitmapDeleter { + inline void operator()(FPDF_BITMAP bitmap) { FPDFBitmap_Destroy(bitmap); } +}; + +struct FPDFDocumentDeleter { + inline void operator()(FPDF_DOCUMENT doc) { FPDF_CloseDocument(doc); } +}; + +struct FPDFFormHandleDeleter { + inline void operator()(FPDF_FORMHANDLE form) { + FPDFDOC_ExitFormFillEnvironment(form); + } +}; + +struct FPDFTextPageDeleter { + inline void operator()(FPDF_TEXTPAGE text) { FPDFText_ClosePage(text); } +}; + +struct FPDFPageDeleter { + inline void operator()(FPDF_PAGE page) { FPDF_ClosePage(page); } +}; + +struct FPDFStructTreeDeleter { + inline void operator()(FPDF_STRUCTTREE tree) { FPDF_StructTree_Close(tree); } +}; + +#endif // PUBLIC_CPP_FPDF_DELETERS_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_dataavail.h b/dependencies/pdfium/macx/include/fpdf_dataavail.h new file mode 100644 index 00000000..2413e2be --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_dataavail.h @@ -0,0 +1,198 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_DATAAVAIL_H_ +#define PUBLIC_FPDF_DATAAVAIL_H_ + +#include + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#define PDF_LINEARIZATION_UNKNOWN -1 +#define PDF_NOT_LINEARIZED 0 +#define PDF_LINEARIZED 1 + +#define PDF_DATA_ERROR -1 +#define PDF_DATA_NOTAVAIL 0 +#define PDF_DATA_AVAIL 1 + +#define PDF_FORM_ERROR -1 +#define PDF_FORM_NOTAVAIL 0 +#define PDF_FORM_AVAIL 1 +#define PDF_FORM_NOTEXIST 2 + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Interface for checking whether sections of the file are available. +typedef struct _FX_FILEAVAIL { + // Version number of the interface. Must be 1. + int version; + + // Reports if the specified data section is currently available. A section is + // available if all bytes in the section are available. + // + // Interface Version: 1 + // Implementation Required: Yes + // + // pThis - pointer to the interface structure. + // offset - the offset of the data section in the file. + // size - the size of the data section. + // + // Returns true if the specified data section at |offset| of |size| + // is available. + FPDF_BOOL (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, + size_t offset, + size_t size); +} FX_FILEAVAIL; +typedef void* FPDF_AVAIL; + +// Create a document availability provider. +// +// file_avail - pointer to file availability interface. +// file - pointer to a file access interface. +// +// Returns a handle to the document availability provider, or NULL on error. +// +// |FPDFAvail_Destroy| must be called when done with the availability provider. +DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, + FPDF_FILEACCESS* file); + +// Destroy the |avail| document availability provider. +// +// avail - handle to document availability provider to be destroyed. +DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail); + +// Download hints interface. Used to receive hints for further downloading. +typedef struct _FX_DOWNLOADHINTS { + // Version number of the interface. Must be 1. + int version; + + // Add a section to be downloaded. + // + // Interface Version: 1 + // Implementation Required: Yes + // + // pThis - pointer to the interface structure. + // offset - the offset of the hint reported to be downloaded. + // size - the size of the hint reported to be downloaded. + // + // The |offset| and |size| of the section may not be unique. Part of the + // section might be already available. The download manager must deal with + // overlapping sections. + void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis, + size_t offset, + size_t size); +} FX_DOWNLOADHINTS; + +// Checks if the document is ready for loading, if not, gets download hints. +// +// avail - handle to document availability provider. +// hints - pointer to a download hints interface. +// +// Returns one of: +// PDF_DATA_ERROR: A common error is returned. Data availability unknown. +// PDF_DATA_NOTAVAIL: Data not yet available. +// PDF_DATA_AVAIL: Data available. +// +// Applications should call this function whenever new data arrives, and process +// all the generated download hints, if any, until the function returns +// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. +// +// Once all data is available, call |FPDFAvail_GetDocument| to get a document +// handle. +DLLEXPORT int STDCALL +FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints); + +// Get document from the availability provider. +// +// avail - handle to document availability provider. +// password - password for decrypting the PDF file. Optional. +// +// Returns a handle to the document. +// +// When |FPDFAvail_IsDocAvail| returns TRUE, call |FPDFAvail_GetDocument| to +// retrieve the document handle. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail, + FPDF_BYTESTRING password); + +// Get the page number for the first available page in a linearized PDF. +// +// doc - document handle. +// +// Returns the zero-based index for the first available page. +// +// For most linearized PDFs, the first available page will be the first page, +// however, some PDFs might make another page the first available page. +// For non-linearized PDFs, this function will always return zero. +DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc); + +// Check if |page_index| is ready for loading, if not, get the +// |FX_DOWNLOADHINTS|. +// +// avail - handle to document availability provider. +// page_index - index number of the page. Zero for the first page. +// hints - pointer to a download hints interface. Populated if +// |page_index| is not available. +// +// Returns one of: +// PDF_DATA_ERROR: A common error is returned. Data availability unknown. +// PDF_DATA_NOTAVAIL: Data not yet available. +// PDF_DATA_AVAIL: Data available. +// +// This function can be called only after |FPDFAvail_GetDocument| is called. +// Applications should call this function whenever new data arrives and process +// all the generated download |hints|, if any, until this function returns +// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page +// loading. +DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, + int page_index, + FX_DOWNLOADHINTS* hints); + +// Check if form data is ready for initialization, if not, get the +// |FX_DOWNLOADHINTS|. +// +// avail - handle to document availability provider. +// hints - pointer to a download hints interface. Populated if form is not +// ready for initialization. +// +// Returns one of: +// PDF_FORM_ERROR: A common eror, in general incorrect parameters. +// PDF_FORM_NOTAVAIL: Data not available. +// PDF_FORM_AVAIL: Data available. +// PDF_FORM_NOTEXIST: No form data. +// +// This function can be called only after |FPDFAvail_GetDocument| is called. +// The application should call this function whenever new data arrives and +// process all the generated download |hints|, if any, until the function +// |PDF_FORM_ERROR|, |PDF_FORM_AVAIL| or |PDF_FORM_NOTEXIST|. +// Applications can then perform page loading. It is recommend to call +// |FPDFDOC_InitFormFillEnvironment| when |PDF_FORM_AVAIL| is returned. +DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, + FX_DOWNLOADHINTS* hints); + +// Check whether a document is a linearized PDF. +// +// avail - handle to document availability provider. +// +// Returns one of: +// PDF_LINEARIZED +// PDF_NOT_LINEARIZED +// PDF_LINEARIZATION_UNKNOWN +// +// |FPDFAvail_IsLinearized| will return |PDF_LINEARIZED| or |PDF_NOT_LINEARIZED| +// when we have 1k of data. If the files size less than 1k, it returns +// |PDF_LINEARIZATION_UNKNOWN| as there is insufficient information to determine +// if the PDF is linearlized. +DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_DATAAVAIL_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_doc.h b/dependencies/pdfium/macx/include/fpdf_doc.h new file mode 100644 index 00000000..9d55a2e8 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_doc.h @@ -0,0 +1,325 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_DOC_H_ +#define PUBLIC_FPDF_DOC_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Unsupported action type. +#define PDFACTION_UNSUPPORTED 0 +// Go to a destination within current document. +#define PDFACTION_GOTO 1 +// Go to a destination within another document. +#define PDFACTION_REMOTEGOTO 2 +// URI, including web pages and other Internet resources. +#define PDFACTION_URI 3 +// Launch an application or open a file. +#define PDFACTION_LAUNCH 4 + +typedef struct _FS_QUADPOINTSF { + FS_FLOAT x1; + FS_FLOAT y1; + FS_FLOAT x2; + FS_FLOAT y2; + FS_FLOAT x3; + FS_FLOAT y3; + FS_FLOAT x4; + FS_FLOAT y4; +} FS_QUADPOINTSF; + +// Get the first child of |bookmark|, or the first top-level bookmark item. +// +// document - handle to the document. +// bookmark - handle to the current bookmark. Pass NULL for the first top +// level item. +// +// Returns a handle to the first child of |bookmark| or the first top-level +// bookmark item. NULL if no child or top-level bookmark found. +DLLEXPORT FPDF_BOOKMARK STDCALL +FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); + +// Get the next sibling of |bookmark|. +// +// document - handle to the document. +// bookmark - handle to the current bookmark. +// +// Returns a handle to the next sibling of |bookmark|, or NULL if this is the +// last bookmark at this level. +DLLEXPORT FPDF_BOOKMARK STDCALL +FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); + +// Get the title of |bookmark|. +// +// bookmark - handle to the bookmark. +// buffer - buffer for the title. May be NULL. +// buflen - the length of the buffer in bytes. May be 0. +// +// Returns the number of bytes in the title, including the terminating NUL +// character. The number of bytes is returned regardless of the |buffer| and +// |buflen| parameters. +// +// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The +// string is terminated by a UTF16 NUL character. If |buflen| is less than the +// required length, or |buffer| is NULL, |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, + void* buffer, + unsigned long buflen); + +// Find the bookmark with |title| in |document|. +// +// document - handle to the document. +// title - the UTF-16LE encoded Unicode title for which to search. +// +// Returns the handle to the bookmark, or NULL if |title| can't be found. +// +// |FPDFBookmark_Find| will always return the first bookmark found even if +// multiple bookmarks have the same |title|. +DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, + FPDF_WIDESTRING title); + +// Get the destination associated with |bookmark|. +// +// document - handle to the document. +// bookmark - handle to the bookmark. +// +// Returns the handle to the destination data, NULL if no destination is +// associated with |bookmark|. +DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, + FPDF_BOOKMARK bookmark); + +// Get the action associated with |bookmark|. +// +// bookmark - handle to the bookmark. +// +// Returns the handle to the action data, or NULL if no action is associated +// with |bookmark|. When NULL is returned, |FPDFBookmark_GetDest| should be +// called to get the |bookmark| destination data. +DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); + +// Get the type of |action|. +// +// action - handle to the action. +// +// Returns one of: +// PDFACTION_UNSUPPORTED +// PDFACTION_GOTO +// PDFACTION_REMOTEGOTO +// PDFACTION_URI +// PDFACTION_LAUNCH +DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action); + +// Get the destination of |action|. +// +// document - handle to the document. +// action - handle to the action. |action| must be a |PDFACTION_GOTO| or +// |PDFACTION_REMOTEGOTO|. +// +// Returns a handle to the destination data. +// +// In the case of |PDFACTION_REMOTEGOTO|, you should first call +// |FPDFAction_GetFilePath| then load that document, the document handle from +// that document should pass as |document| to |FPDFAction_GetDest|. +DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, + FPDF_ACTION action); + +// Get file path of a |PDFACTION_REMOTEGOTO| |action|. +// +// action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or +// |PDFACTION_REMOTEGOTO| +// buffer - a buffer for output the path string. May be NULL. +// buflen - the length of the buffer, in bytes. May be 0. +// +// Returns the number of bytes in the file path, including the trailing UTF16 +// NUL character. +// +// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. +// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer| +// will not be modified. +DLLEXPORT unsigned long STDCALL +FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen); + +// Get the URI path of a |PDFACTION_URI| |action|. +// +// document - handle to the document. +// action - handle to the action. Must be a |PDFACTION_URI|. +// buffer - a buffer for the path string. May be NULL. +// buflen - the length of the buffer, in bytes. May be 0. +// +// Returns the number of bytes in the URI path, including trailing zeros. +// +// The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the +// returned length, or |buffer| is NULL, |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, + FPDF_ACTION action, + void* buffer, + unsigned long buflen); + +// Get the page index of |dest|. +// +// document - handle to the document. +// dest - handle to the destination. +// +// Returns the page index containing |dest|. Page indices start from 0. +DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, + FPDF_DEST dest); + +// Get the (x, y, zoom) location of |dest| in the destination page, if the +// destination is in [page /XYZ x y zoom] syntax. +// +// dest - handle to the destination. +// hasXVal - out parameter; true if the x value is not null +// hasYVal - out parameter; true if the y value is not null +// hasZoomVal - out parameter; true if the zoom value is not null +// x - out parameter; the x coordinate, in page coordinates. +// y - out parameter; the y coordinate, in page coordinates. +// zoom - out parameter; the zoom value. +// Returns TRUE on successfully reading the /XYZ value. +// +// Note the [x, y, zoom] values are only set if the corresponding hasXVal, +// hasYVal or hasZoomVal flags are true. +DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST dest, + FPDF_BOOL* hasXCoord, + FPDF_BOOL* hasYCoord, + FPDF_BOOL* hasZoom, + FS_FLOAT* x, + FS_FLOAT* y, + FS_FLOAT* zoom); + +// Find a link at point (|x|,|y|) on |page|. +// +// page - handle to the document page. +// x - the x coordinate, in the page coordinate system. +// y - the y coordinate, in the page coordinate system. +// +// Returns a handle to the link, or NULL if no link found at the given point. +// +// You can convert coordinates from screen coordinates to page coordinates using +// |FPDF_DeviceToPage|. +DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, + double x, + double y); + +// Find the Z-order of link at point (|x|,|y|) on |page|. +// +// page - handle to the document page. +// x - the x coordinate, in the page coordinate system. +// y - the y coordinate, in the page coordinate system. +// +// Returns the Z-order of the link, or -1 if no link found at the given point. +// Larger Z-order numbers are closer to the front. +// +// You can convert coordinates from screen coordinates to page coordinates using +// |FPDF_DeviceToPage|. +DLLEXPORT int STDCALL +FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y); + +// Get destination info for |link|. +// +// document - handle to the document. +// link - handle to the link. +// +// Returns a handle to the destination, or NULL if there is no destination +// associated with the link. In this case, you should call |FPDFLink_GetAction| +// to retrieve the action associated with |link|. +DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, + FPDF_LINK link); + +// Get action info for |link|. +// +// link - handle to the link. +// +// Returns a handle to the action associated to |link|, or NULL if no action. +DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link); + +// Enumerates all the link annotations in |page|. +// +// page - handle to the page. +// startPos - the start position, should initially be 0 and is updated with +// the next start position on return. +// linkAnnot - the link handle for |startPos|. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, + int* startPos, + FPDF_LINK* linkAnnot); + +// Get the rectangle for |linkAnnot|. +// +// linkAnnot - handle to the link annotation. +// rect - the annotation rectangle. +// +// Returns true on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, + FS_RECTF* rect); + +// Get the count of quadrilateral points to the |linkAnnot|. +// +// linkAnnot - handle to the link annotation. +// +// Returns the count of quadrilateral points. +DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot); + +// Get the quadrilateral points for the specified |quadIndex| in |linkAnnot|. +// +// linkAnnot - handle to the link annotation. +// quadIndex - the specified quad point index. +// quadPoints - receives the quadrilateral points. +// +// Returns true on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, + int quadIndex, + FS_QUADPOINTSF* quadPoints); + +// Get meta-data |tag| content from |document|. +// +// document - handle to the document. +// tag - the tag to retrieve. The tag can be one of: +// Title, Author, Subject, Keywords, Creator, Producer, +// CreationDate, or ModDate. +// For detailed explanations of these tags and their respective +// values, please refer to PDF Reference 1.6, section 10.2.1, +// 'Document Information Dictionary'. +// buffer - a buffer for the tag. May be NULL. +// buflen - the length of the buffer, in bytes. May be 0. +// +// Returns the number of bytes in the tag, including trailing zeros. +// +// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two +// bytes of zeros indicating the end of the string. If |buflen| is less than +// the returned length, or |buffer| is NULL, |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document, + FPDF_BYTESTRING tag, + void* buffer, + unsigned long buflen); + +// Get the page label for |page_index| from |document|. +// +// document - handle to the document. +// page_index - the 0-based index of the page. +// buffer - a buffer for the page label. May be NULL. +// buflen - the length of the buffer, in bytes. May be 0. +// +// Returns the number of bytes in the page label, including trailing zeros. +// +// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two +// bytes of zeros indicating the end of the string. If |buflen| is less than +// the returned length, or |buffer| is NULL, |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL FPDF_GetPageLabel(FPDF_DOCUMENT document, + int page_index, + void* buffer, + unsigned long buflen); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_DOC_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_edit.h b/dependencies/pdfium/macx/include/fpdf_edit.h new file mode 100644 index 00000000..4d06c2a0 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_edit.h @@ -0,0 +1,466 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_EDIT_H_ +#define PUBLIC_FPDF_EDIT_H_ + +#include + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#define FPDF_ARGB(a, r, g, b) \ + ((uint32_t)(((uint32_t)(b)&0xff) | (((uint32_t)(g)&0xff) << 8) | \ + (((uint32_t)(r)&0xff) << 16) | (((uint32_t)(a)&0xff) << 24))) +#define FPDF_GetBValue(argb) ((uint8_t)(argb)) +#define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8)) +#define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16)) +#define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24)) + +// The page object constants. +#define FPDF_PAGEOBJ_UNKNOWN 0 +#define FPDF_PAGEOBJ_TEXT 1 +#define FPDF_PAGEOBJ_PATH 2 +#define FPDF_PAGEOBJ_IMAGE 3 +#define FPDF_PAGEOBJ_SHADING 4 +#define FPDF_PAGEOBJ_FORM 5 + +#define FPDF_FILLMODE_ALTERNATE 1 +#define FPDF_FILLMODE_WINDING 2 + +#define FPDF_FONT_TYPE1 1 +#define FPDF_FONT_TRUETYPE 2 + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Create a new PDF document. +// +// Returns a handle to a new document, or NULL on failure. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument(); + +// Create a new PDF page. +// +// document - handle to document. +// page_index - suggested index of the page to create. If it is larger than +// document's current last index(L), the created page index is +// the next available index -- L+1. +// width - the page width. +// height - the page height. +// +// Returns the handle to the new page. +// +// The page should be closed with CPDF_ClosePage() when finished as +// with any other page in the document. +DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, + int page_index, + double width, + double height); + +// Delete the page at |page_index|. +// +// document - handle to document. +// page_index - the index of the page to delete. +DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index); + +// Get the rotation of |page|. +// +// page - handle to a page +// +// Returns one of the following indicating the page rotation: +// 0 - No rotation. +// 1 - Rotated 90 degrees clockwise. +// 2 - Rotated 180 degrees clockwise. +// 3 - Rotated 270 degrees clockwise. +DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page); + +// Set rotation for |page|. +// +// page - handle to a page. +// rotate - the rotation value, one of: +// 0 - No rotation. +// 1 - Rotated 90 degrees clockwise. +// 2 - Rotated 180 degrees clockwise. +// 3 - Rotated 270 degrees clockwise. +DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate); + +// Insert |page_obj| into |page|. +// +// page - handle to a page +// page_obj - handle to a page object. The |page_obj| will be automatically +// freed. +DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, + FPDF_PAGEOBJECT page_obj); + +// Get number of page objects inside |page|. +// +// page - handle to a page. +// +// Returns the number of objects in |page|. +DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page); + +// Get object in |page| at |index|. +// +// page - handle to a page. +// index - the index of a page object. +// +// Returns the handle to the page object, or NULL on failed. +DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index); + +// Checks if |page| contains transparency. +// +// page - handle to a page. +// +// Returns TRUE if |page| contains transparency. +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page); + +// Generate the content of |page|. +// +// page - handle to a page. +// +// Returns TRUE on success. +// +// Before you save the page to a file, or reload the page, you must call +// |FPDFPage_GenerateContent| or any changes to |page| will be lost. +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page); + +// Checks if |pageObject| contains transparency. +// +// pageObject - handle to a page object. +// +// Returns TRUE if |pageObject| contains transparency. +DLLEXPORT FPDF_BOOL STDCALL +FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject); + +// Get type of |pageObject|. +// +// pageObject - handle to a page object. +// +// Returns one of the FPDF_PAGEOBJ_* values on success, FPDF_PAGEOBJ_UNKNOWN on +// error. +DLLEXPORT int STDCALL FPDFPageObj_GetType(FPDF_PAGEOBJECT pageObject); + +// Transform |pageObject| by the given matrix. +// +// page_object - handle to a page object. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and can be used to scale, rotate, shear and translate the |page_object|. +DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, + double a, + double b, + double c, + double d, + double e, + double f); + +// Transform all annotations in |page|. +// +// page - handle to a page. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and can be used to scale, rotate, shear and translate the |page| annotations. +DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, + double a, + double b, + double c, + double d, + double e, + double f); + +// Create a new image object. +// +// document - handle to a document. +// +// Returns a handle to a new image object. +DLLEXPORT FPDF_PAGEOBJECT STDCALL +FPDFPageObj_NewImageObj(FPDF_DOCUMENT document); + +// Create a new image object. +// DEPRECATED. Please use FPDFPageObj_NewImageObj() above. +// +// document - handle to a document. +// +// Returns a handle to a new image object. +DLLEXPORT FPDF_PAGEOBJECT STDCALL +FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document); + +// Load an image from a JPEG image file and then set it into |image_object|. +// +// pages - pointer to the start of all loaded pages, may be NULL. +// nCount - number of |pages|, may be 0. +// image_object - handle to an image object. +// fileAccess - file access handler which specifies the JPEG image file. +// +// Returns TRUE on success. +// +// The image object might already have an associated image, which is shared and +// cached by the loaded pages. In that case, we need to clear the cached image +// for all the loaded pages. Pass |pages| and page count (|nCount|) to this API +// to clear the image cache. If the image is not previously shared, or NULL is a +// valid |pages| value. +DLLEXPORT FPDF_BOOL STDCALL +FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, + int nCount, + FPDF_PAGEOBJECT image_object, + FPDF_FILEACCESS* fileAccess); + +// Load an image from a JPEG image file and then set it into |image_object|. +// +// pages - pointer to the start of all loaded pages, may be NULL. +// nCount - number of |pages|, may be 0. +// image_object - handle to an image object. +// fileAccess - file access handler which specifies the JPEG image file. +// +// Returns TRUE on success. +// +// The image object might already have an associated image, which is shared and +// cached by the loaded pages. In that case, we need to clear the cached image +// for all the loaded pages. Pass |pages| and page count (|nCount|) to this API +// to clear the image cache. If the image is not previously shared, or NULL is a +// valid |pages| value. This function loads the JPEG image inline, so the image +// content is copied to the file. This allows |fileAccess| and its associated +// data to be deleted after this function returns. +DLLEXPORT FPDF_BOOL STDCALL +FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages, + int nCount, + FPDF_PAGEOBJECT image_object, + FPDF_FILEACCESS* fileAccess); + +// Set the transform matrix of |image_object|. +// +// image_object - handle to an image object. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and can be used to scale, rotate, shear and translate the |page| annotations. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, + double a, + double b, + double c, + double d, + double e, + double f); + +// Set |bitmap| to |image_object|. +// +// pages - pointer to the start of all loaded pages, may be NULL. +// nCount - number of |pages|, may be 0. +// image_object - handle to an image object. +// bitmap - handle of the bitmap. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, + int nCount, + FPDF_PAGEOBJECT image_object, + FPDF_BITMAP bitmap); + +// Create a new path object at an initial position. +// +// x - initial horizontal position. +// y - initial vertical position. +// +// Returns a handle to a new path object. +DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_CreateNewPath(float x, float y); + +// Create a closed path consisting of a rectangle. +// +// x - horizontal position for the left boundary of the rectangle. +// y - vertical position for the bottom boundary of the rectangle. +// w - width of the rectangle. +// h - height of the rectangle. +// +// Returns a handle to the new path object. +DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_CreateNewRect(float x, + float y, + float w, + float h); + +// Set the stroke RGBA of a path. Range of values: 0 - 255. +// +// path - the handle to the path object. +// R - the red component for the path stroke color. +// G - the green component for the path stroke color. +// B - the blue component for the path stroke color. +// A - the stroke alpha for the path. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL FPDFPath_SetStrokeColor(FPDF_PAGEOBJECT path, + unsigned int R, + unsigned int G, + unsigned int B, + unsigned int A); + +// Set the stroke width of a path. +// +// path - the handle to the path object. +// width - the width of the stroke. +// +// Returns TRUE on success +DLLEXPORT FPDF_BOOL FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width); + +// Set the fill RGBA of a path. Range of values: 0 - 255. +// +// path - the handle to the path object. +// R - the red component for the path fill color. +// G - the green component for the path fill color. +// B - the blue component for the path fill color. +// A - the fill alpha for the path. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL FPDFPath_SetFillColor(FPDF_PAGEOBJECT path, + unsigned int R, + unsigned int G, + unsigned int B, + unsigned int A); + +// Get the fill RGBA of a path. Range of values: 0 - 255. +// +// path - the handle to the path object. +// R - the red component of the path fill color. +// G - the green component of the path fill color. +// B - the blue component of the path fill color. +// A - the fill alpha of the path. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL FPDFPath_GetFillColor(FPDF_PAGEOBJECT path, + unsigned int* R, + unsigned int* G, + unsigned int* B, + unsigned int* A); + +// Move a path's current point. +// +// path - the handle to the path object. +// x - the horizontal position of the new current point. +// y - the vertical position of the new current point. +// +// Note that no line will be created between the previous current point and the +// new one. +// +// Returns TRUE on success +DLLEXPORT FPDF_BOOL FPDFPath_MoveTo(FPDF_PAGEOBJECT path, float x, float y); + +// Add a line between the current point and a new point in the path. +// +// path - the handle to the path object. +// x - the horizontal position of the new point. +// y - the vertical position of the new point. +// +// The path's current point is changed to (x, y). +// +// Returns TRUE on success +DLLEXPORT FPDF_BOOL FPDFPath_LineTo(FPDF_PAGEOBJECT path, float x, float y); + +// Add a cubic Bezier curve to the given path, starting at the current point. +// +// path - the handle to the path object. +// x1 - the horizontal position of the first Bezier control point. +// y1 - the vertical position of the first Bezier control point. +// x2 - the horizontal position of the second Bezier control point. +// y2 - the vertical position of the second Bezier control point. +// x3 - the horizontal position of the ending point of the Bezier curve. +// y3 - the vertical position of the ending point of the Bezier curve. +// +// Returns TRUE on success +DLLEXPORT FPDF_BOOL FPDFPath_BezierTo(FPDF_PAGEOBJECT path, + float x1, + float y1, + float x2, + float y2, + float x3, + float y3); + +// Close the current subpath of a given path. +// +// path - the handle to the path object. +// +// This will add a line between the current point and the initial point of the +// subpath, thus terminating the current subpath. +// +// Returns TRUE on success +DLLEXPORT FPDF_BOOL FPDFPath_Close(FPDF_PAGEOBJECT path); + +// Set the drawing mode of a path. +// +// path - the handle to the path object. +// fillmode - the filling mode to be set: 0 for no fill, 1 for alternate, 2 for +// winding. +// stroke - a boolean specifying if the path should be stroked or not. +// +// Returns TRUE on success +DLLEXPORT FPDF_BOOL FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, + int fillmode, + FPDF_BOOL stroke); + +// Create a new text object using one of the standard PDF fonts. +// +// document - handle to the document. +// font - string containing the font name, without spaces. +// font_size - the font size for the new text object. +// +// Returns a handle to a new text object, or NULL on failure +DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewTextObj(FPDF_DOCUMENT document, + FPDF_BYTESTRING font, + float font_size); + +// Set the text for a textobject. If it had text, it will be replaced. +// +// text_object - handle to the text object. +// text - string containing the text to be added. +// +// Returns TRUE on success +DLLEXPORT FPDF_BOOL STDCALL FPDFText_SetText(FPDF_PAGEOBJECT text_object, + FPDF_BYTESTRING text); + +// Returns a font object loaded from a stream of data. The font is loaded +// into the document. The caller does not need to free the returned object. +// +// document - handle to the document. +// data - the stream of data, which will be copied by the font object. +// size - size of the stream, in bytes. +// font_type - FPDF_FONT_TYPE1 or FPDF_FONT_TRUETYPE depending on the font +// type. +// cid - a boolean specifying if the font is a CID font or not. +// +// Returns NULL on failure +DLLEXPORT FPDF_FONT STDCALL FPDFText_LoadFont(FPDF_DOCUMENT document, + const uint8_t* data, + uint32_t size, + int font_type, + FPDF_BOOL cid); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_EDIT_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_ext.h b/dependencies/pdfium/macx/include/fpdf_ext.h new file mode 100644 index 00000000..34658789 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_ext.h @@ -0,0 +1,98 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_EXT_H_ +#define PUBLIC_FPDF_EXT_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Unsupported XFA form. +#define FPDF_UNSP_DOC_XFAFORM 1 +// Unsupported portable collection. +#define FPDF_UNSP_DOC_PORTABLECOLLECTION 2 +// Unsupported attachment. +#define FPDF_UNSP_DOC_ATTACHMENT 3 +// Unsupported security. +#define FPDF_UNSP_DOC_SECURITY 4 +// Unsupported shared review. +#define FPDF_UNSP_DOC_SHAREDREVIEW 5 +// Unsupported shared form, acrobat. +#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT 6 +// Unsupported shared form, filesystem. +#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM 7 +// Unsupported shared form, email. +#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL 8 +// Unsupported 3D annotation. +#define FPDF_UNSP_ANNOT_3DANNOT 11 +// Unsupported movie annotation. +#define FPDF_UNSP_ANNOT_MOVIE 12 +// Unsupported sound annotation. +#define FPDF_UNSP_ANNOT_SOUND 13 +// Unsupported screen media annotation. +#define FPDF_UNSP_ANNOT_SCREEN_MEDIA 14 +// Unsupported screen rich media annotation. +#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA 15 +// Unsupported attachment annotation. +#define FPDF_UNSP_ANNOT_ATTACHMENT 16 +// Unsupported signature annotation. +#define FPDF_UNSP_ANNOT_SIG 17 + +// Interface for unsupported feature notifications. +typedef struct _UNSUPPORT_INFO { + // Version number of the interface. Must be 1. + int version; + + // Unsupported object notification function. + // Interface Version: 1 + // Implementation Required: Yes + // + // pThis - pointer to the interface structure. + // nType - the type of unsupported object. One of the |FPDF_UNSP_*| entries. + void (*FSDK_UnSupport_Handler)(struct _UNSUPPORT_INFO* pThis, int nType); +} UNSUPPORT_INFO; + +// Setup an unsupported object handler. +// +// unsp_info - Pointer to an UNSUPPORT_INFO structure. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL +FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); + +// Unknown page mode. +#define PAGEMODE_UNKNOWN -1 +// Document outline, and thumbnails hidden. +#define PAGEMODE_USENONE 0 +// Document outline visible. +#define PAGEMODE_USEOUTLINES 1 +// Thumbnail images visible. +#define PAGEMODE_USETHUMBS 2 +// Full-screen mode, no menu bar, window controls, or other decorations visible. +#define PAGEMODE_FULLSCREEN 3 +// Optional content group panel visible. +#define PAGEMODE_USEOC 4 +// Attachments panel visible. +#define PAGEMODE_USEATTACHMENTS 5 + +// Get the document's PageMode. +// +// doc - Handle to document. +// +// Returns one of the |PAGEMODE_*| flags defined above. +// +// The page mode defines how the document should be initially displayed. +DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_EXT_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_flatten.h b/dependencies/pdfium/macx/include/fpdf_flatten.h new file mode 100644 index 00000000..c1e354e9 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_flatten.h @@ -0,0 +1,44 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_FLATTEN_H_ +#define PUBLIC_FPDF_FLATTEN_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +// Flatten operation failed. +#define FLATTEN_FAIL 0 +// Flatten operation succeed. +#define FLATTEN_SUCCESS 1 +// Nothing to be flattened. +#define FLATTEN_NOTHINGTODO 2 + +// Flatten for normal display. +#define FLAT_NORMALDISPLAY 0 +// Flatten for print. +#define FLAT_PRINT 1 + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Flatten annotations and form fields into the page contents. +// +// page - handle to the page. +// nFlag - One of the |FLAT_*| values denoting the page usage. +// +// Returns one of the |FLATTEN_*| values. +// +// Currently, all failures return |FLATTEN_FAIL| with no indication of the +// cause. +DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_FLATTEN_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_formfill.h b/dependencies/pdfium/macx/include/fpdf_formfill.h new file mode 100644 index 00000000..09b80eaf --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_formfill.h @@ -0,0 +1,1764 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_FORMFILL_H_ +#define PUBLIC_FPDF_FORMFILL_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +typedef void* FPDF_FORMHANDLE; + +#ifdef PDF_ENABLE_XFA +#define DOCTYPE_PDF 0 // Normal pdf Document +#define DOCTYPE_DYNAMIC_XFA 1 // Dynamic xfa Document Type +#define DOCTYPE_STATIC_XFA 2 // Static xfa Document Type +#endif // PDF_ENABLE_XFA + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _IPDF_JsPlatform { + /** + * Version number of the interface. Currently must be 2. + **/ + int version; + + /* Version 1. */ + + /** + * Method: app_alert + * pop up a dialog to show warning or hint. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * Msg - A string containing the message to be displayed. + * Title - The title of the dialog. + * Type - The stype of button group. + * 0-OK(default); + * 1-OK,Cancel; + * 2-Yes,NO; + * 3-Yes, NO, Cancel. + * nIcon - The Icon type. + * 0-Error(default); + * 1-Warning; + * 2-Question; + * 3-Status. + * 4-Asterisk + * Return Value: + * The return value could be the folowing type: + * 1-OK; + * 2-Cancel; + * 3-NO; + * 4-Yes; + */ + int (*app_alert)(struct _IPDF_JsPlatform* pThis, + FPDF_WIDESTRING Msg, + FPDF_WIDESTRING Title, + int Type, + int Icon); + + /** + * Method: app_beep + * Causes the system to play a sound. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * nType - The sound type. + * 0 - Error + * 1 - Warning + * 2 - Question + * 3 - Status + * 4 - Default (default value) + * Return Value: + * None + */ + void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType); + + /** + * Method: app_response + * Displays a dialog box containing a question and an entry field for + * the user to reply to the question. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * Question - The question to be posed to the user. + * Title - The title of the dialog box. + * Default - A default value for the answer to the question. If + * not specified, no default value is presented. + * cLabel - A short string to appear in front of and on the + * same line as the edit text field. + * bPassword - If true, indicates that the user's response should + * show as asterisks (*) or bullets (?) to mask the response, which might be + * sensitive information. The default is false. + * response - A string buffer allocated by SDK, to receive the + * user's response. + * length - The length of the buffer, number of bytes. + * Currently, It's always be 2048. + * Return Value: + * Number of bytes the complete user input would actually require, not + * including trailing zeros, regardless of the value of the length + * parameter or the presence of the response buffer. + * Comments: + * No matter on what platform, the response buffer should be always + * written using UTF-16LE encoding. If a response buffer is + * present and the size of the user input exceeds the capacity of the + * buffer as specified by the length parameter, only the + * first "length" bytes of the user input are to be written to the + * buffer. + */ + int (*app_response)(struct _IPDF_JsPlatform* pThis, + FPDF_WIDESTRING Question, + FPDF_WIDESTRING Title, + FPDF_WIDESTRING Default, + FPDF_WIDESTRING cLabel, + FPDF_BOOL bPassword, + void* response, + int length); + + /* + * Method: Doc_getFilePath + * Get the file path of the current document. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * filePath - The string buffer to receive the file path. Can be + * NULL. + * length - The length of the buffer, number of bytes. Can be + * 0. + * Return Value: + * Number of bytes the filePath consumes, including trailing zeros. + * Comments: + * The filePath should be always input in local encoding. + * + * The return value always indicated number of bytes required for the + * buffer , even when there is no buffer specified, or the buffer size is + * less than required. In this case, the buffer will not be modified. + */ + int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis, + void* filePath, + int length); + + /* + * Method: Doc_mail + * Mails the data buffer as an attachment to all recipients, with or + * without user interaction. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * mailData - Pointer to the data buffer to be sent.Can be NULL. + * length - The size,in bytes, of the buffer pointed by + * mailData parameter.Can be 0. + * bUI - If true, the rest of the parameters are used in a + * compose-new-message window that is displayed to the user. If false, the cTo + * parameter is required and all others are optional. + * To - A semicolon-delimited list of recipients for the + * message. + * Subject - The subject of the message. The length limit is 64 + * KB. + * CC - A semicolon-delimited list of CC recipients for + * the message. + * BCC - A semicolon-delimited list of BCC recipients for + * the message. + * Msg - The content of the message. The length limit is 64 + * KB. + * Return Value: + * None. + * Comments: + * If the parameter mailData is NULL or length is 0, the current + * document will be mailed as an attachment to all recipients. + */ + void (*Doc_mail)(struct _IPDF_JsPlatform* pThis, + void* mailData, + int length, + FPDF_BOOL bUI, + FPDF_WIDESTRING To, + FPDF_WIDESTRING Subject, + FPDF_WIDESTRING CC, + FPDF_WIDESTRING BCC, + FPDF_WIDESTRING Msg); + + /* + * Method: Doc_print + * Prints all or a specific number of pages of the document. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * bUI - If true, will cause a UI to be presented to the + * user to obtain printing information and confirm the action. + * nStart - A 0-based index that defines the start of an + * inclusive range of pages. + * nEnd - A 0-based index that defines the end of an + * inclusive page range. + * bSilent - If true, suppresses the cancel dialog box while + * the document is printing. The default is false. + * bShrinkToFit - If true, the page is shrunk (if necessary) to + * fit within the imageable area of the printed page. + * bPrintAsImage - If true, print pages as an image. + * bReverse - If true, print from nEnd to nStart. + * bAnnotations - If true (the default), annotations are + * printed. + */ + void (*Doc_print)(struct _IPDF_JsPlatform* pThis, + FPDF_BOOL bUI, + int nStart, + int nEnd, + FPDF_BOOL bSilent, + FPDF_BOOL bShrinkToFit, + FPDF_BOOL bPrintAsImage, + FPDF_BOOL bReverse, + FPDF_BOOL bAnnotations); + + /* + * Method: Doc_submitForm + * Send the form data to a specified URL. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * formData - Pointer to the data buffer to be sent. + * length - The size,in bytes, of the buffer pointed by + * formData parameter. + * URL - The URL to send to. + * Return Value: + * None. + * + */ + void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis, + void* formData, + int length, + FPDF_WIDESTRING URL); + + /* + * Method: Doc_gotoPage + * Jump to a specified page. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * nPageNum - The specified page number, zero for the first + * page. + * Return Value: + * None. + * + */ + void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum); + /* + * Method: Field_browse + * Show a file selection dialog, and return the selected file path. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * filePath - Pointer to the data buffer to receive the file + * path.Can be NULL. + * length - The length of the buffer, number of bytes. Can be + * 0. + * Return Value: + * Number of bytes the filePath consumes, including trailing zeros. + * Comments: + * The filePath shoule be always input in local encoding. + */ + int (*Field_browse)(struct _IPDF_JsPlatform* pThis, + void* filePath, + int length); + + /** + * pointer to FPDF_FORMFILLINFO interface. + **/ + void* m_pFormfillinfo; + + /* Version 2. */ + + void* m_isolate; /* Unused in v3, retain for compatibility. */ + unsigned int m_v8EmbedderSlot; /* Unused in v3, retain for compatibility. */ + + /* Version 3. */ + /* Version 3 moves m_Isolate and m_v8EmbedderSlot to FPDF_LIBRARY_CONFIG. */ +} IPDF_JSPLATFORM; + +// Flags for Cursor type +#define FXCT_ARROW 0 +#define FXCT_NESW 1 +#define FXCT_NWSE 2 +#define FXCT_VBEAM 3 +#define FXCT_HBEAM 4 +#define FXCT_HAND 5 + +/** + * Function signature for the callback function passed to the FFI_SetTimer + * method. + * Parameters: + * idEvent - Identifier of the timer. + * Return value: + * None. + **/ +typedef void (*TimerCallback)(int idEvent); + +/** + * Declares of a struct type to the local system time. +**/ +typedef struct _FPDF_SYSTEMTIME { + unsigned short wYear; /* years since 1900 */ + unsigned short wMonth; /* months since January - [0,11] */ + unsigned short wDayOfWeek; /* days since Sunday - [0,6] */ + unsigned short wDay; /* day of the month - [1,31] */ + unsigned short wHour; /* hours since midnight - [0,23] */ + unsigned short wMinute; /* minutes after the hour - [0,59] */ + unsigned short wSecond; /* seconds after the minute - [0,59] */ + unsigned short wMilliseconds; /* milliseconds after the second - [0,999] */ +} FPDF_SYSTEMTIME; + +#ifdef PDF_ENABLE_XFA +// XFA +/** + * @name Pageview event flags + */ +/*@{*/ +/** @brief After a new pageview is added. */ +#define FXFA_PAGEVIEWEVENT_POSTADDED 1 +/** @brief After a pageview is removed. */ +#define FXFA_PAGEVIEWEVENT_POSTREMOVED 3 +/*@}*/ + +// menu +/** + * @name Macro Definitions for Right Context Menu Features Of XFA Fields + */ +/*@{*/ +#define FXFA_MENU_COPY 1 +#define FXFA_MENU_CUT 2 +#define FXFA_MENU_SELECTALL 4 +#define FXFA_MENU_UNDO 8 +#define FXFA_MENU_REDO 16 +#define FXFA_MENU_PASTE 32 +/*@}*/ + +// file type +/** + * @name Macro Definitions for File Type. + */ +/*@{*/ +#define FXFA_SAVEAS_XML 1 +#define FXFA_SAVEAS_XDP 2 +/*@}*/ +#endif // PDF_ENABLE_XFA + +typedef struct _FPDF_FORMFILLINFO { + /** + * Version number of the interface. Currently must be 1 (when PDFium is built + * without the XFA module) or must be 2 (when built with the XFA module). + **/ + int version; + + /* Version 1. */ + /** + *Method: Release + * Give implementation a chance to release any data after the + * interface is no longer used + *Interface Version: + * 1 + *Implementation Required: + * No + *Comments: + * Called by Foxit SDK during the final cleanup process. + *Parameters: + * pThis - Pointer to the interface structure itself + *Return Value: + * None + */ + void (*Release)(struct _FPDF_FORMFILLINFO* pThis); + + /** + * Method: FFI_Invalidate + * Invalidate the client area within the specified rectangle. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * left - Left position of the client area in PDF page + *coordinate. + * top - Top position of the client area in PDF page + *coordinate. + * right - Right position of the client area in PDF page + *coordinate. + * bottom - Bottom position of the client area in PDF page + *coordinate. + * Return Value: + * None. + * + *comments: + * All positions are measured in PDF "user space". + * Implementation should call FPDF_RenderPageBitmap() function for + *repainting a specified page area. + */ + void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_OutputSelectedRect + * When user is taking the mouse to select texts on a form field, + * this callback function will keep + * returning the selected areas to the implementation. + * + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * left - Left position of the client area in PDF page + * coordinate. + * top - Top position of the client area in PDF page + * coordinate. + * right - Right position of the client area in PDF page + * coordinate. + * bottom - Bottom position of the client area in PDF page + * coordinate. + * Return Value: + * None. + * + * comments: + * This CALLBACK function is useful for implementing special text + * selection effect. Implementation should + * first records the returned rectangles, then draw them one by one + * at the painting period, last,remove all + * the recorded rectangles when finish painting. + */ + void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_SetCursor + * Set the Cursor shape. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * nCursorType - Cursor type. see Flags for Cursor type for the + * details. + * Return value: + * None. + * */ + void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType); + + /** + * Method: FFI_SetTimer + * This method installs a system timer. An interval value is specified, + * and every time that interval elapses, the system must call into the + * callback function with the timer ID as returned by this function. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * uElapse - Specifies the time-out value, in milliseconds. + * lpTimerFunc - A pointer to the callback function-TimerCallback. + * Return value: + * The timer identifier of the new timer if the function is successful. + * An application passes this value to the FFI_KillTimer method to kill + * the timer. Nonzero if it is successful; otherwise, it is zero. + * */ + int (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis, + int uElapse, + TimerCallback lpTimerFunc); + + /** + * Method: FFI_KillTimer + * This method uninstalls a system timer identified by nIDEvent, as + * set by an earlier call to FFI_SetTimer. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * nTimerID - The timer ID returned by FFI_SetTimer function. + * Return value: + * None. + * */ + void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID); + + /** + * Method: FFI_GetLocalTime + * This method receives the current local time on the system. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * Return value: + * None. + * */ + FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis); + + /** + * Method: FFI_OnChange + * This method will be invoked to notify implementation when the + * value of any FormField on the document had been changed. + * Interface Version: + * 1 + * Implementation Required: + * no + * Parameters: + * pThis - Pointer to the interface structure itself. + * Return value: + * None. + * */ + void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis); + + /** + * Method: FFI_GetPage + * This method receives the page pointer associated with a specified + * page index. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + * function. + * nPageIndex - Index number of the page. 0 for the first page. + * Return value: + * Handle to the page. Returned by FPDF_LoadPage function. + * Comments: + * In some cases, the document-level JavaScript action may refer to a + * page which hadn't been loaded yet. + * To successfully run the javascript action, implementation need to load + * the page for SDK. + * */ + FPDF_PAGE (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + int nPageIndex); + + /** + * Method: FFI_GetCurrentPage + * This method receives the current page pointer. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + * function. + * Return value: + * Handle to the page. Returned by FPDF_LoadPage function. + * */ + FPDF_PAGE (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document); + + /** + * Method: FFI_GetRotation + * This method receives currently rotation of the page view. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage function. + * Return value: + * The page rotation. Should be 0(0 degree),1(90 degree),2(180 + * degree),3(270 degree), in a clockwise direction. + * + * Note: Unused. + * */ + int (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page); + + /** + * Method: FFI_ExecuteNamedAction + * This method will execute an named action. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * namedAction - A byte string which indicates the named action, + * terminated by 0. + * Return value: + * None. + * Comments: + * See the named actions description of <> + * for more details. + * */ + void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_BYTESTRING namedAction); + /** + * @brief This method will be called when a text field is getting or losing a + * focus. + * + * @param[in] pThis Pointer to the interface structure itself. + * @param[in] value The string value of the form field, in UTF-16LE + * format. + * @param[in] valueLen The length of the string value, number of characters + * (not bytes). + * @param[in] is_focus True if the form field is getting a focus, False for + * losing a focus. + * + * @return None. + * + * @note Currently,only support text field and combobox field. + * */ + void (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING value, + FPDF_DWORD valueLen, + FPDF_BOOL is_focus); + + /** + * Method: FFI_DoURIAction + * This action resolves to a uniform resource identifier. + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * bsURI - A byte string which indicates the uniform resource + * identifier, terminated by 0. + * Return value: + * None. + * Comments: + * See the URI actions description of <> for + * more details. + * */ + void (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_BYTESTRING bsURI); + + /** + * Method: FFI_DoGoToAction + * This action changes the view to a specified destination. + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * nPageIndex - The index of the PDF page. + * zoomMode - The zoom mode for viewing page. See below. + * fPosArray - The float array which carries the position info. + * sizeofArray - The size of float array. + * + * PDFZoom values: + * - XYZ = 1 + * - FITPAGE = 2 + * - FITHORZ = 3 + * - FITVERT = 4 + * - FITRECT = 5 + * - FITBBOX = 6 + * - FITBHORZ = 7 + * - FITBVERT = 8 + * + * Return value: + * None. + * Comments: + * See the Destinations description of <> in + *8.2.1 for more details. + **/ + void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, + int nPageIndex, + int zoomMode, + float* fPosArray, + int sizeofArray); + + /** + * pointer to IPDF_JSPLATFORM interface + **/ + IPDF_JSPLATFORM* m_pJsPlatform; + +#ifdef PDF_ENABLE_XFA + /* Version 2. */ + /** + * Method: FFI_DisplayCaret + * This method will show the caret at specified position. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * left - Left position of the client area in PDF page + *coordinate. + * top - Top position of the client area in PDF page + *coordinate. + * right - Right position of the client area in PDF page + *coordinate. + * bottom - Bottom position of the client area in PDF page + *coordinate. + * Return value: + * None. + **/ + void (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + FPDF_BOOL bVisible, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_GetCurrentPageIndex + * This method will get the current page index. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * Return value: + * The index of current page. + **/ + int (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document); + + /** + * Method: FFI_SetCurrentPage + * This method will set the current page. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * iCurPage - The index of the PDF page. + * Return value: + * None. + **/ + void (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + int iCurPage); + + /** + * Method: FFI_GotoURL + * This method will link to the specified URL. + * Interface Version: + * 2 + * Implementation Required: + * no + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * wsURL - The string value of the URL, in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + FPDF_WIDESTRING wsURL); + + /** + * Method: FFI_GetPageViewRect + * This method will get the current page view rectangle. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * left - The pointer to receive left position of the page + *view area in PDF page coordinate. + * top - The pointer to receive top position of the page + *view area in PDF page coordinate. + * right - The pointer to receive right position of the + *client area in PDF page coordinate. + * bottom - The pointer to receive bottom position of the + *client area in PDF page coordinate. + * Return value: + * None. + **/ + void (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double* left, + double* top, + double* right, + double* bottom); + + /** + * Method: FFI_PageEvent + * This method fires when pages have been added to or deleted from the XFA + * document. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page_count - The number of pages to be added to or deleted from the + * document. + * event_type - See FXFA_PAGEVIEWEVENT_* above. + * Return value: + * None. + * Comments: + * The pages to be added or deleted always start from the last page + * of document. This means that if parameter page_count is 2 and + * event type is FXFA_PAGEVIEWEVENT_POSTADDED, 2 new pages have been + * appended to the tail of document; If page_count is 2 and + * event type is FXFA_PAGEVIEWEVENT_POSTREMOVED, the last 2 pages + * have been deleted. + **/ + void (*FFI_PageEvent)(struct _FPDF_FORMFILLINFO* pThis, + int page_count, + FPDF_DWORD event_type); + + /** + * Method: FFI_PopupMenu + * This method will track the right context menu for XFA fields. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * hWidget - Handle to XFA fields. + * menuFlag - The menu flags. Please refer to macro definition + *of FXFA_MENU_XXX and this can be one or a combination of these macros. + * x - X position of the client area in PDF page + *coordinate. + * y - Y position of the client area in PDF page + *coordinate. + * Return value: + * TRUE indicates success; otherwise false. + **/ + FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + FPDF_WIDGET hWidget, + int menuFlag, + float x, + float y); + + /** + * Method: FFI_OpenFile + * This method will open the specified file with the specified mode. + * Interface Version + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * fileFlag - The file flag.Please refer to macro definition of + *FXFA_SAVEAS_XXX and this can be one of these macros. + * wsURL - The string value of the file URL, in UTF-16LE + *format. + * mode - The mode for open file. + * Return value: + * The handle to FPDF_FILEHANDLER. + **/ + FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis, + int fileFlag, + FPDF_WIDESTRING wsURL, + const char* mode); + + /** + * Method: FFI_EmailTo + * This method will email the specified file stream to the specified + *contacter. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * pFileHandler - Handle to the FPDF_FILEHANDLER. + * pTo - A semicolon-delimited list of recipients for the + *message,in UTF-16LE format. + * pSubject - The subject of the message,in UTF-16LE format. + * pCC - A semicolon-delimited list of CC recipients for + *the message,in UTF-16LE format. + * pBcc - A semicolon-delimited list of BCC recipients for + *the message,in UTF-16LE format. + * pMsg - Pointer to the data buffer to be sent.Can be + *NULL,in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_EmailTo)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_FILEHANDLER* fileHandler, + FPDF_WIDESTRING pTo, + FPDF_WIDESTRING pSubject, + FPDF_WIDESTRING pCC, + FPDF_WIDESTRING pBcc, + FPDF_WIDESTRING pMsg); + + /** + * Method: FFI_UploadTo + * This method will get upload the specified file stream to the + *specified URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * pFileHandler - Handle to the FPDF_FILEHANDLER. + * fileFlag - The file flag.Please refer to macro definition of + *FXFA_SAVEAS_XXX and this can be one of these macros. + * uploadTo - Pointer to the URL path, in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_FILEHANDLER* fileHandler, + int fileFlag, + FPDF_WIDESTRING uploadTo); + + /** + * Method: FFI_GetPlatform + * This method will get the current platform. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * platform - Pointer to the data buffer to receive the + *platform.Can be NULL,in UTF-16LE format. + * length - The length of the buffer, number of bytes. Can be + *0. + * Return value: + * The length of the buffer, number of bytes. + **/ + int (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis, + void* platform, + int length); + + /** + * Method: FFI_GetLanguage + * This method will get the current language. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * language - Pointer to the data buffer to receive the current + *language.Can be NULL. + * length - The length of the buffer, number of bytes. Can be + *0. + * Return value: + * The length of the buffer, number of bytes. + **/ + int (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis, + void* language, + int length); + + /** + * Method: FFI_DownloadFromURL + * This method will download the specified file from the URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * URL - The string value of the file URL, in UTF-16LE + *format. + * Return value: + * The handle to FPDF_FILEHANDLER. + **/ + FPDF_LPFILEHANDLER (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING URL); + /** + * Method: FFI_PostRequestURL + * This method will post the request to the server URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * wsURL - The string value of the server URL, in UTF-16LE + *format. + * wsData - The post data,in UTF-16LE format. + * wsContentType - The content type of the request data,in UTF-16LE + *format. + * wsEncode - The encode type,in UTF-16LE format. + * wsHeader - The request header,in UTF-16LE format. + * response - Pointer to the FPDF_BSTR to receive the response + *data from server,,in UTF-16LE format. + * Return value: + * TRUE indicates success, otherwise FALSE. + **/ + FPDF_BOOL (*FFI_PostRequestURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING wsURL, + FPDF_WIDESTRING wsData, + FPDF_WIDESTRING wsContentType, + FPDF_WIDESTRING wsEncode, + FPDF_WIDESTRING wsHeader, + FPDF_BSTR* respone); + + /** + * Method: FFI_PutRequestURL + * This method will put the request to the server URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * wsURL - The string value of the server URL, in UTF-16LE + *format. + * wsData - The put data, in UTF-16LE format. + * wsEncode - The encode type, in UTR-16LE format. + * Return value: + * TRUE indicates success, otherwise FALSE. + **/ + FPDF_BOOL (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING wsURL, + FPDF_WIDESTRING wsData, + FPDF_WIDESTRING wsEncode); +#endif // PDF_ENABLE_XFA +} FPDF_FORMFILLINFO; + +/** + * Function: FPDFDOC_InitFormFillEnvironment + * Init form fill environment. + * Comments: + * This function should be called before any form fill operation. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * pFormFillInfo - Pointer to a FPDF_FORMFILLINFO structure. + * Return Value: + * Return handler to the form fill module. NULL means fails. + **/ +DLLEXPORT FPDF_FORMHANDLE STDCALL +FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, + FPDF_FORMFILLINFO* formInfo); + +/** + * Function: FPDFDOC_ExitFormFillEnvironment + * Exit form fill environment. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NULL. + **/ +DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle); + +/** + * Function: FORM_OnAfterLoadPage + * This method is required for implementing all the form related + *functions. Should be invoked after user + * successfully loaded a PDF page, and method + *FPDFDOC_InitFormFillEnvironment had been invoked. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle); + +/** + * Function: FORM_OnBeforeClosePage + * This method is required for implementing all the form related + *functions. Should be invoked before user + * close the PDF page. + * Parameters: + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle); + +/** +* Function: FORM_DoDocumentJSAction +* This method is required for performing Document-level JavaScript +*action. It should be invoked after the PDF document +* had been loaded. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* Return Value: +* NONE +* Comments: +* If there is Document-level JavaScript action embedded in the +*document, this method will execute the javascript action; +* otherwise, the method will do nothing. +**/ +DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle); + +/** +* Function: FORM_DoDocumentOpenAction +* This method is required for performing open-action when the document +*is opened. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* Return Value: +* NONE +* Comments: +* This method will do nothing if there is no open-actions embedded in +*the document. +**/ +DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle); + +// additional actions type of document. +#define FPDFDOC_AACTION_WC \ + 0x10 // WC, before closing document, JavaScript action. +#define FPDFDOC_AACTION_WS \ + 0x11 // WS, before saving document, JavaScript action. +#define FPDFDOC_AACTION_DS 0x12 // DS, after saving document, JavaScript + // action. +#define FPDFDOC_AACTION_WP \ + 0x13 // WP, before printing document, JavaScript action. +#define FPDFDOC_AACTION_DP \ + 0x14 // DP, after printing document, JavaScript action. + +/** +* Function: FORM_DoDocumentAAction +* This method is required for performing the document's +*additional-action. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* aaType - The type of the additional-actions which defined +*above. +* Return Value: +* NONE +* Comments: +* This method will do nothing if there is no document +*additional-action corresponding to the specified aaType. +**/ + +DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, + int aaType); + +// Additional-action types of page object +#define FPDFPAGE_AACTION_OPEN \ + 0 // /O -- An action to be performed when the page is opened +#define FPDFPAGE_AACTION_CLOSE \ + 1 // /C -- An action to be performed when the page is closed + +/** +* Function: FORM_DoPageAAction +* This method is required for performing the page object's +*additional-action when opened or closed. +* Parameters: +* page - Handle to the page. Returned by FPDF_LoadPage +*function. +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* aaType - The type of the page object's additional-actions +*which defined above. +* Return Value: +* NONE +* Comments: +* This method will do nothing if no additional-action corresponding to +*the specified aaType exists. +**/ +DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle, + int aaType); + +/** + * Function: FORM_OnMouseMove + * You can call this member function when the mouse cursor moves. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in PDF user + *space. + * page_y - Specifies the y-coordinate of the cursor in PDF user + *space. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +/** + * Function: FORM_OnLButtonDown + * You can call this member function when the user presses the left + *mouse button. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in PDF user + *space. + * page_y - Specifies the y-coordinate of the cursor in PDF user + *space. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +/** + * Function: FORM_OnLButtonUp + * You can call this member function when the user releases the left + *mouse button. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in device. + * page_y - Specifies the y-coordinate of the cursor in device. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +#ifdef PDF_ENABLE_XFA +DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); +DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); +#endif // PDF_ENABLE_XFA + +/** + * Function: FORM_OnKeyDown + * You can call this member function when a nonsystem key is pressed. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nKeyCode - Indicates whether various virtual keys are down. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nKeyCode, + int modifier); + +/** + * Function: FORM_OnKeyUp + * You can call this member function when a nonsystem key is released. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nKeyCode - The virtual-key code of the given key. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nKeyCode, + int modifier); + +/** + * Function: FORM_OnChar + * You can call this member function when a keystroke translates to a + *nonsystem character. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nChar - The character code value of the key. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nChar, + int modifier); + +/** + * Function: FORM_ForceToKillFocus. + * You can call this member function to force to kill the focus of the + *form field which got focus. + * It would kill the focus on the form field, save the value of form + *field if it's changed by user. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle); + +// Field Types +#define FPDF_FORMFIELD_UNKNOWN 0 // Unknown. +#define FPDF_FORMFIELD_PUSHBUTTON 1 // push button type. +#define FPDF_FORMFIELD_CHECKBOX 2 // check box type. +#define FPDF_FORMFIELD_RADIOBUTTON 3 // radio button type. +#define FPDF_FORMFIELD_COMBOBOX 4 // combo box type. +#define FPDF_FORMFIELD_LISTBOX 5 // list box type. +#define FPDF_FORMFIELD_TEXTFIELD 6 // text field type. +#ifdef PDF_ENABLE_XFA +#define FPDF_FORMFIELD_XFA 7 // text field type. +#endif // PDF_ENABLE_XFA + +/** + * Function: FPDFPage_HasFormFieldAtPoint + * Get the form field type by point. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment(). + * page - Handle to the page. Returned by FPDF_LoadPage(). + * page_x - X position in PDF "user space". + * page_y - Y position in PDF "user space". + * Return Value: + * Return the type of the form field; -1 indicates no field. + * See field types above. + **/ +DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDPage_HasFormFieldAtPoint + * DEPRECATED. Please use FPDFPage_HasFormFieldAtPoint. + **/ +DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDFPage_FormFieldZOrderAtPoint + * Get the form field z-order by point. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment(). + * page - Handle to the page. Returned by FPDF_LoadPage(). + * page_x - X position in PDF "user space". + * page_y - Y position in PDF "user space". + * Return Value: + * Return the z-order of the form field; -1 indicates no field. + * Higher numbers are closer to the front. + **/ +DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDF_SetFormFieldHighlightColor + * Set the highlight color of specified or all the form fields in the + *document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * doc - Handle to the document. Returned by + *FPDF_LoadDocument function. + * fieldType - A 32-bit integer indicating the type of a form + *field(defined above). + * color - The highlight color of the form field.Constructed by + *0xxxrrggbb. + * Return Value: + * NONE. + * Comments: + * When the parameter fieldType is set to zero, the highlight color + *will be applied to all the form fields in the + * document. + * Please refresh the client window to show the highlight immediately + *if necessary. + **/ +DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, + int fieldType, + unsigned long color); + +/** + * Function: FPDF_SetFormFieldHighlightAlpha + * Set the transparency of the form field highlight color in the + *document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * doc - Handle to the document. Returned by + *FPDF_LoadDocument function. + * alpha - The transparency of the form field highlight color. + *between 0-255. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, + unsigned char alpha); + +/** + * Function: FPDF_RemoveFormFieldHighlight + * Remove the form field highlight color in the document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + * Comments: + * Please refresh the client window to remove the highlight immediately + *if necessary. + **/ +DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); + +/** +* Function: FPDF_FFLDraw +* Render FormFields and popup window on a page to a device independent +*bitmap. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* bitmap - Handle to the device independent bitmap (as the +*output buffer). +* Bitmap handle can be created by FPDFBitmap_Create +*function. +* page - Handle to the page. Returned by FPDF_LoadPage +*function. +* start_x - Left pixel position of the display area in the +*device coordinate. +* start_y - Top pixel position of the display area in the device +*coordinate. +* size_x - Horizontal size (in pixels) for displaying the page. +* size_y - Vertical size (in pixels) for displaying the page. +* rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees +*clockwise), +* 2 (rotated 180 degrees), 3 (rotated 90 degrees +*counter-clockwise). +* flags - 0 for normal display, or combination of flags +*defined above. +* Return Value: +* None. +* Comments: +* This function is designed to render annotations that are +*user-interactive, which are widget annotation (for FormFields) and popup +*annotation. +* With FPDF_ANNOT flag, this function will render popup annotation +*when users mouse-hover on non-widget annotation. Regardless of FPDF_ANNOT flag, +*this function will always render widget annotations for FormFields. +* In order to implement the FormFill functions, implementation should +*call this function after rendering functions, such as FPDF_RenderPageBitmap or +*FPDF_RenderPageBitmap_Start, finish rendering the page contents. +**/ +DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, + FPDF_BITMAP bitmap, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); + +#ifdef _SKIA_SUPPORT_ +DLLEXPORT void STDCALL FPDF_FFLRecord(FPDF_FORMHANDLE hHandle, + FPDF_RECORDER recorder, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); +#endif + +#ifdef PDF_ENABLE_XFA +/** + * Function: FPDF_HasXFAField + * This method is designed to check whether a pdf document + *has XFA fields. + * Parameters: + * document - Handle to document. + *Returned by FPDF_LoadDocument function. + * docType - Document type defined as + *DOCTYPE_xxx. + * Return Value: + * TRUE indicates that the input document has XFA fields, + *otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, + int* docType); + +/** + * Function: FPDF_LoadXFA + * If the document consists of XFA fields, there should call this + *method to load XFA fields. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * Return Value: + * TRUE indicates success,otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document); + +/** + * Function: FPDF_Widget_Undo + * This method will implement the undo feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_Redo + * This method will implement the redo feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_SelectAll + * This method will implement the select all feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_Copy + * This method will implement the copy feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - Pointer to data buffer to receive the copied + *data, in UTF-16LE format. + * size - The data buffer size. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD* size); +/** + * Function: FPDF_Widget_Cut + * This method will implement the cut feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - Pointer to data buffer to receive the cut + *data,in UTF-16LE format. + * size - The data buffer size,not the byte number. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD* size); +/** + * Function: FPDF_Widget_Paste + * This method will implement the paste feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - The paste text buffer, in UTF-16LE format. + * size - The data buffer size,not the byte number. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD size); +/** + * Function: FPDF_Widget_ReplaceSpellCheckWord + * This method will implement the spell check feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * x - The x value of the specified point. + * y - The y value of the specified point. + * bsText - The text buffer needed to be speck check, in + *UTF-16LE format. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL +FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + float x, + float y, + FPDF_BYTESTRING bsText); +/** + * Function: FPDF_Widget_GetSpellCheckWords + * This method will implement the spell check feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * x - The x value of the specified point. + * y - The y value of the specified point. + * stringHandle - Pointer to FPDF_STRINGHANDLE to receive the + *speck check text buffer, in UTF-16LE format. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL +FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + float x, + float y, + FPDF_STRINGHANDLE* stringHandle); +/** + * Function: FPDF_StringHandleCounts + * This method will get the count of the text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * Return Value: + * None. + **/ +DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE stringHandle); +/** + * Function: FPDF_StringHandleGetStringByIndex + * This method will get the specified index of the text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * index - The specified index of text buffer. + * bsText - Pointer to data buffer to receive the text + *buffer, in UTF-16LE format. + * size - The byte size of data buffer. + * Return Value: + * TRUE indicates success, otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL +FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE stringHandle, + int index, + FPDF_BYTESTRING bsText, + FPDF_DWORD* size); +/** + * Function: FPDF_StringHandleRelease + * This method will release the FPDF_STRINGHANDLE. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle); +/** + * Function: FPDF_StringHandleAddString + * This method will add the specified text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * bsText - Pointer to data buffer of the text buffer, in + *UTF-16LE format. + * size - The byte size of data buffer. + * Return Value: + * TRUE indicates success, otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL +FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, + FPDF_BYTESTRING bsText, + FPDF_DWORD size); +#endif // PDF_ENABLE_XFA + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_FORMFILL_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_fwlevent.h b/dependencies/pdfium/macx/include/fpdf_fwlevent.h new file mode 100644 index 00000000..591484a5 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_fwlevent.h @@ -0,0 +1,284 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_FWLEVENT_H_ +#define PUBLIC_FPDF_FWLEVENT_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +typedef int FPDF_INT32; +typedef unsigned int FPDF_UINT32; +typedef float FPDF_FLOAT; + +// Event types. +typedef enum { + FWL_EVENTTYPE_Mouse = 0, + FWL_EVENTTYPE_MouseWheel, + FWL_EVENTTYPE_Key, +} FWL_EVENTTYPE; + +// Key flags. +typedef enum { + FWL_EVENTFLAG_ShiftKey = 1 << 0, + FWL_EVENTFLAG_ControlKey = 1 << 1, + FWL_EVENTFLAG_AltKey = 1 << 2, + FWL_EVENTFLAG_MetaKey = 1 << 3, + FWL_EVENTFLAG_KeyPad = 1 << 4, + FWL_EVENTFLAG_AutoRepeat = 1 << 5, + FWL_EVENTFLAG_LeftButtonDown = 1 << 6, + FWL_EVENTFLAG_MiddleButtonDown = 1 << 7, + FWL_EVENTFLAG_RightButtonDown = 1 << 8, +} FWL_EVENTFLAG; + +// Mouse messages. +typedef enum { + FWL_EVENTMOUSECMD_LButtonDown = 1, + FWL_EVENTMOUSECMD_LButtonUp, + FWL_EVENTMOUSECMD_LButtonDblClk, + FWL_EVENTMOUSECMD_RButtonDown, + FWL_EVENTMOUSECMD_RButtonUp, + FWL_EVENTMOUSECMD_RButtonDblClk, + FWL_EVENTMOUSECMD_MButtonDown, + FWL_EVENTMOUSECMD_MButtonUp, + FWL_EVENTMOUSECMD_MButtonDblClk, + FWL_EVENTMOUSECMD_MouseMove, + FWL_EVENTMOUSECMD_MouseEnter, + FWL_EVENTMOUSECMD_MouseHover, + FWL_EVENTMOUSECMD_MouseLeave, +} FWL_EVENT_MOUSECMD; + +// Mouse events. +struct FWL_EVENT_MOUSE { + FPDF_UINT32 command; + FPDF_DWORD flag; + FPDF_FLOAT x; + FPDF_FLOAT y; +}; + +// Mouse wheel events. +struct FWL_EVENT_MOUSEWHEEL { + FPDF_DWORD flag; + FPDF_FLOAT x; + FPDF_FLOAT y; + FPDF_FLOAT deltaX; + FPDF_FLOAT deltaY; +}; + +// Virtual keycodes. +typedef enum { + FWL_VKEY_Back = 0x08, + FWL_VKEY_Tab = 0x09, + FWL_VKEY_NewLine = 0x0A, + FWL_VKEY_Clear = 0x0C, + FWL_VKEY_Return = 0x0D, + FWL_VKEY_Shift = 0x10, + FWL_VKEY_Control = 0x11, + FWL_VKEY_Menu = 0x12, + FWL_VKEY_Pause = 0x13, + FWL_VKEY_Capital = 0x14, + FWL_VKEY_Kana = 0x15, + FWL_VKEY_Hangul = 0x15, + FWL_VKEY_Junja = 0x17, + FWL_VKEY_Final = 0x18, + FWL_VKEY_Hanja = 0x19, + FWL_VKEY_Kanji = 0x19, + FWL_VKEY_Escape = 0x1B, + FWL_VKEY_Convert = 0x1C, + FWL_VKEY_NonConvert = 0x1D, + FWL_VKEY_Accept = 0x1E, + FWL_VKEY_ModeChange = 0x1F, + FWL_VKEY_Space = 0x20, + FWL_VKEY_Prior = 0x21, + FWL_VKEY_Next = 0x22, + FWL_VKEY_End = 0x23, + FWL_VKEY_Home = 0x24, + FWL_VKEY_Left = 0x25, + FWL_VKEY_Up = 0x26, + FWL_VKEY_Right = 0x27, + FWL_VKEY_Down = 0x28, + FWL_VKEY_Select = 0x29, + FWL_VKEY_Print = 0x2A, + FWL_VKEY_Execute = 0x2B, + FWL_VKEY_Snapshot = 0x2C, + FWL_VKEY_Insert = 0x2D, + FWL_VKEY_Delete = 0x2E, + FWL_VKEY_Help = 0x2F, + FWL_VKEY_0 = 0x30, + FWL_VKEY_1 = 0x31, + FWL_VKEY_2 = 0x32, + FWL_VKEY_3 = 0x33, + FWL_VKEY_4 = 0x34, + FWL_VKEY_5 = 0x35, + FWL_VKEY_6 = 0x36, + FWL_VKEY_7 = 0x37, + FWL_VKEY_8 = 0x38, + FWL_VKEY_9 = 0x39, + FWL_VKEY_A = 0x41, + FWL_VKEY_B = 0x42, + FWL_VKEY_C = 0x43, + FWL_VKEY_D = 0x44, + FWL_VKEY_E = 0x45, + FWL_VKEY_F = 0x46, + FWL_VKEY_G = 0x47, + FWL_VKEY_H = 0x48, + FWL_VKEY_I = 0x49, + FWL_VKEY_J = 0x4A, + FWL_VKEY_K = 0x4B, + FWL_VKEY_L = 0x4C, + FWL_VKEY_M = 0x4D, + FWL_VKEY_N = 0x4E, + FWL_VKEY_O = 0x4F, + FWL_VKEY_P = 0x50, + FWL_VKEY_Q = 0x51, + FWL_VKEY_R = 0x52, + FWL_VKEY_S = 0x53, + FWL_VKEY_T = 0x54, + FWL_VKEY_U = 0x55, + FWL_VKEY_V = 0x56, + FWL_VKEY_W = 0x57, + FWL_VKEY_X = 0x58, + FWL_VKEY_Y = 0x59, + FWL_VKEY_Z = 0x5A, + FWL_VKEY_LWin = 0x5B, + FWL_VKEY_Command = 0x5B, + FWL_VKEY_RWin = 0x5C, + FWL_VKEY_Apps = 0x5D, + FWL_VKEY_Sleep = 0x5F, + FWL_VKEY_NumPad0 = 0x60, + FWL_VKEY_NumPad1 = 0x61, + FWL_VKEY_NumPad2 = 0x62, + FWL_VKEY_NumPad3 = 0x63, + FWL_VKEY_NumPad4 = 0x64, + FWL_VKEY_NumPad5 = 0x65, + FWL_VKEY_NumPad6 = 0x66, + FWL_VKEY_NumPad7 = 0x67, + FWL_VKEY_NumPad8 = 0x68, + FWL_VKEY_NumPad9 = 0x69, + FWL_VKEY_Multiply = 0x6A, + FWL_VKEY_Add = 0x6B, + FWL_VKEY_Separator = 0x6C, + FWL_VKEY_Subtract = 0x6D, + FWL_VKEY_Decimal = 0x6E, + FWL_VKEY_Divide = 0x6F, + FWL_VKEY_F1 = 0x70, + FWL_VKEY_F2 = 0x71, + FWL_VKEY_F3 = 0x72, + FWL_VKEY_F4 = 0x73, + FWL_VKEY_F5 = 0x74, + FWL_VKEY_F6 = 0x75, + FWL_VKEY_F7 = 0x76, + FWL_VKEY_F8 = 0x77, + FWL_VKEY_F9 = 0x78, + FWL_VKEY_F10 = 0x79, + FWL_VKEY_F11 = 0x7A, + FWL_VKEY_F12 = 0x7B, + FWL_VKEY_F13 = 0x7C, + FWL_VKEY_F14 = 0x7D, + FWL_VKEY_F15 = 0x7E, + FWL_VKEY_F16 = 0x7F, + FWL_VKEY_F17 = 0x80, + FWL_VKEY_F18 = 0x81, + FWL_VKEY_F19 = 0x82, + FWL_VKEY_F20 = 0x83, + FWL_VKEY_F21 = 0x84, + FWL_VKEY_F22 = 0x85, + FWL_VKEY_F23 = 0x86, + FWL_VKEY_F24 = 0x87, + FWL_VKEY_NunLock = 0x90, + FWL_VKEY_Scroll = 0x91, + FWL_VKEY_LShift = 0xA0, + FWL_VKEY_RShift = 0xA1, + FWL_VKEY_LControl = 0xA2, + FWL_VKEY_RControl = 0xA3, + FWL_VKEY_LMenu = 0xA4, + FWL_VKEY_RMenu = 0xA5, + FWL_VKEY_BROWSER_Back = 0xA6, + FWL_VKEY_BROWSER_Forward = 0xA7, + FWL_VKEY_BROWSER_Refresh = 0xA8, + FWL_VKEY_BROWSER_Stop = 0xA9, + FWL_VKEY_BROWSER_Search = 0xAA, + FWL_VKEY_BROWSER_Favorites = 0xAB, + FWL_VKEY_BROWSER_Home = 0xAC, + FWL_VKEY_VOLUME_Mute = 0xAD, + FWL_VKEY_VOLUME_Down = 0xAE, + FWL_VKEY_VOLUME_Up = 0xAF, + FWL_VKEY_MEDIA_NEXT_Track = 0xB0, + FWL_VKEY_MEDIA_PREV_Track = 0xB1, + FWL_VKEY_MEDIA_Stop = 0xB2, + FWL_VKEY_MEDIA_PLAY_Pause = 0xB3, + FWL_VKEY_MEDIA_LAUNCH_Mail = 0xB4, + FWL_VKEY_MEDIA_LAUNCH_MEDIA_Select = 0xB5, + FWL_VKEY_MEDIA_LAUNCH_APP1 = 0xB6, + FWL_VKEY_MEDIA_LAUNCH_APP2 = 0xB7, + FWL_VKEY_OEM_1 = 0xBA, + FWL_VKEY_OEM_Plus = 0xBB, + FWL_VKEY_OEM_Comma = 0xBC, + FWL_VKEY_OEM_Minus = 0xBD, + FWL_VKEY_OEM_Period = 0xBE, + FWL_VKEY_OEM_2 = 0xBF, + FWL_VKEY_OEM_3 = 0xC0, + FWL_VKEY_OEM_4 = 0xDB, + FWL_VKEY_OEM_5 = 0xDC, + FWL_VKEY_OEM_6 = 0xDD, + FWL_VKEY_OEM_7 = 0xDE, + FWL_VKEY_OEM_8 = 0xDF, + FWL_VKEY_OEM_102 = 0xE2, + FWL_VKEY_ProcessKey = 0xE5, + FWL_VKEY_Packet = 0xE7, + FWL_VKEY_Attn = 0xF6, + FWL_VKEY_Crsel = 0xF7, + FWL_VKEY_Exsel = 0xF8, + FWL_VKEY_Ereof = 0xF9, + FWL_VKEY_Play = 0xFA, + FWL_VKEY_Zoom = 0xFB, + FWL_VKEY_NoName = 0xFC, + FWL_VKEY_PA1 = 0xFD, + FWL_VKEY_OEM_Clear = 0xFE, + FWL_VKEY_Unknown = 0, +} FWL_VKEYCODE; + +// Key event commands. +typedef enum { + FWL_EVENTKEYCMD_KeyDown = 1, + FWL_EVENTKEYCMD_KeyUp, + FWL_EVENTKEYCMD_Char, +} FWL_EVENTKEYCMD; + +// Key events. +struct FWL_EVENT_KEY { + FPDF_UINT32 command; + FPDF_DWORD flag; + union { + // Virtual key code. + FPDF_UINT32 vkcode; + // Character code. + FPDF_DWORD charcode; + } code; +}; + +// Event types. +struct FWL_EVENT { + // Structure size. + FPDF_UINT32 size; + // FWL_EVENTTYPE. + FPDF_UINT32 type; + union { + struct FWL_EVENT_MOUSE mouse; + struct FWL_EVENT_MOUSEWHEEL wheel; + struct FWL_EVENT_KEY key; + } s; +}; + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_FWLEVENT_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_ppo.h b/dependencies/pdfium/macx/include/fpdf_ppo.h new file mode 100644 index 00000000..d9c83002 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_ppo.h @@ -0,0 +1,44 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_PPO_H_ +#define PUBLIC_FPDF_PPO_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Import pages to a FPDF_DOCUMENT. +// +// dest_doc - The destination document for the pages. +// src_doc - The document to be imported. +// pagerange - A page range string, Such as "1,3,5-7". If |pagerange| is NULL, +// all pages from |src_doc| are imported. +// index - The page index to insert at. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc, + FPDF_DOCUMENT src_doc, + FPDF_BYTESTRING pagerange, + int index); + +// Copy the viewer preferences from |src_doc| into |dest_doc|. +// +// dest_doc - Document to write the viewer preferences into. +// src_doc - Document to read the viewer preferences from. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, + FPDF_DOCUMENT src_doc); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_PPO_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_progressive.h b/dependencies/pdfium/macx/include/fpdf_progressive.h new file mode 100644 index 00000000..0c3d5013 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_progressive.h @@ -0,0 +1,120 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_PROGRESSIVE_H_ +#define PUBLIC_FPDF_PROGRESSIVE_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +// Flags for progressive process status. +#define FPDF_RENDER_READER 0 +#define FPDF_RENDER_TOBECOUNTINUED 1 +#define FPDF_RENDER_DONE 2 +#define FPDF_RENDER_FAILED 3 + +#ifdef __cplusplus +extern "C" { +#endif + +// IFPDF_RENDERINFO interface. +typedef struct _IFSDK_PAUSE { + /** + * Version number of the interface. Currently must be 1. + **/ + int version; + + /* + * Method: NeedToPauseNow + * Check if we need to pause a progressive process now. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * Return Value: + * Non-zero for pause now, 0 for continue. + * + */ + FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis); + + // A user defined data pointer, used by user's application. Can be NULL. + void* user; +} IFSDK_PAUSE; + +// Function: FPDF_RenderPageBitmap_Start +// Start to render page contents to a device independent bitmap +// progressively. +// Parameters: +// bitmap - Handle to the device independent bitmap (as the +// output buffer). +// Bitmap handle can be created by FPDFBitmap_Create +// function. +// page - Handle to the page. Returned by FPDF_LoadPage +// function. +// start_x - Left pixel position of the display area in the +// bitmap coordinate. +// start_y - Top pixel position of the display area in the bitmap +// coordinate. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees +// clockwise), +// 2 (rotated 180 degrees), 3 (rotated 90 degrees +// counter-clockwise). +// flags - 0 for normal display, or combination of flags +// defined in fpdfview.h. With FPDF_ANNOT flag, it +// renders all annotations that does not require +// user-interaction, which are all annotations except +// widget and popup annotations. +// pause - The IFSDK_PAUSE interface.A callback mechanism +// allowing the page rendering process +// Return value: +// Rendering Status. See flags for progressive process status for the +// details. +// +DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags, + IFSDK_PAUSE* pause); + +// Function: FPDF_RenderPage_Continue +// Continue rendering a PDF page. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage +// function. +// pause - The IFSDK_PAUSE interface.A callback mechanism +// allowing the page rendering process +// to be paused before it's finished. This can be NULL +// if you don't want to pause. +// Return value: +// The rendering status. See flags for progressive process status for +// the details. +DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, + IFSDK_PAUSE* pause); + +// Function: FPDF_RenderPage_Close +// Release the resource allocate during page rendering. Need to be +// called after finishing rendering or +// cancel the rendering. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage +// function. +// Return value: +// NULL +DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_PROGRESSIVE_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_save.h b/dependencies/pdfium/macx/include/fpdf_save.h new file mode 100644 index 00000000..c34e2bc6 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_save.h @@ -0,0 +1,87 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_SAVE_H_ +#define PUBLIC_FPDF_SAVE_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Structure for custom file write +typedef struct FPDF_FILEWRITE_ { + // + // Version number of the interface. Currently must be 1. + // + int version; + + // + // Method: WriteBlock + // Output a block of data in your custom way. + // Interface Version: + // 1 + // Implementation Required: + // Yes + // Comments: + // Called by function FPDF_SaveDocument + // Parameters: + // pThis - Pointer to the structure itself + // pData - Pointer to a buffer to output + // size - The size of the buffer. + // Return value: + // Should be non-zero if successful, zero for error. + // + int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis, + const void* pData, + unsigned long size); +} FPDF_FILEWRITE; + +/** @brief Incremental. */ +#define FPDF_INCREMENTAL 1 +/** @brief No Incremental. */ +#define FPDF_NO_INCREMENTAL 2 +/** @brief Remove security. */ +#define FPDF_REMOVE_SECURITY 3 + +// Function: FPDF_SaveAsCopy +// Saves the copy of specified document in custom way. +// Parameters: +// document - Handle to document. Returned by +// FPDF_LoadDocument and FPDF_CreateNewDocument. +// pFileWrite - A pointer to a custom file write structure. +// flags - The creating flags. +// Return value: +// TRUE for succeed, FALSE for failed. +// +DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, + FPDF_FILEWRITE* pFileWrite, + FPDF_DWORD flags); + +// Function: FPDF_SaveWithVersion +// Same as function ::FPDF_SaveAsCopy, except the file version of the +// saved document could be specified by user. +// Parameters: +// document - Handle to document. +// pFileWrite - A pointer to a custom file write structure. +// flags - The creating flags. +// fileVersion - The PDF file version. File version: 14 for 1.4, +// 15 for 1.5, ... +// Return value: +// TRUE if succeed, FALSE if failed. +// +DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, + FPDF_FILEWRITE* pFileWrite, + FPDF_DWORD flags, + int fileVersion); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_SAVE_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_searchex.h b/dependencies/pdfium/macx/include/fpdf_searchex.h new file mode 100644 index 00000000..a795a523 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_searchex.h @@ -0,0 +1,39 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_SEARCHEX_H_ +#define PUBLIC_FPDF_SEARCHEX_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Get the character index in |text_page| internal character list. +// +// text_page - a text page information structure. +// nTextIndex - index of the text returned from |FPDFText_GetText|. +// +// Returns the index of the character in internal character list. -1 for error. +DLLEXPORT int STDCALL +FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex); + +// Get the text index in |text_page| internal character list. +// +// text_page - a text page information structure. +// nCharIndex - index of the character in internal character list. +// +// Returns the index of the text returned from |FPDFText_GetText|. -1 for error. +DLLEXPORT int STDCALL +FPDFText_GetTextIndexFromCharIndex(FPDF_TEXTPAGE text_page, int nCharIndex); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_SEARCHEX_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_structtree.h b/dependencies/pdfium/macx/include/fpdf_structtree.h new file mode 100644 index 00000000..9cf46cc3 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_structtree.h @@ -0,0 +1,143 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_STRUCTTREE_H_ +#define PUBLIC_FPDF_STRUCTTREE_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Function: FPDF_StructTree_GetForPage +// Get the structure tree for a page. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage +// function. +// Return value: +// A handle to the structure tree or NULL on error. +DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page); + +// Function: FPDF_StructTree_Close +// Release the resource allocate by FPDF_StructTree_GetForPage. +// Parameters: +// struct_tree - Handle to the struct tree. Returned by +// FPDF_StructTree_LoadPage function. +// Return value: +// NULL +DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree); + +// Function: FPDF_StructTree_CountChildren +// Count the number of children for the structure tree. +// Parameters: +// struct_tree - Handle to the struct tree. Returned by +// FPDF_StructTree_LoadPage function. +// Return value: +// The number of children, or -1 on error. +DLLEXPORT int STDCALL +FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree); + +// Function: FPDF_StructTree_GetChildAtIndex +// Get a child in the structure tree. +// Parameters: +// struct_tree - Handle to the struct tree. Returned by +// FPDF_StructTree_LoadPage function. +// index - The index for the child, 0-based. +// Return value: +// The child at the n-th index or NULL on error. +DLLEXPORT FPDF_STRUCTELEMENT STDCALL +FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index); + +// Function: FPDF_StructElement_GetAltText +// Get the alt text for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// buffer - A buffer for output the alt text. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. +// Return value: +// The number of bytes in the title, including the terminating NUL +// character. The number of bytes is returned regardless of the +// |buffer| and |buflen| parameters. +// Comments: +// Regardless of the platform, the |buffer| is always in UTF-16LE +// encoding. The string is terminated by a UTF16 NUL character. If +// |buflen| is less than the required length, or |buffer| is NULL, +// |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL +FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element, + void* buffer, + unsigned long buflen); + +// Function: FPDF_StructElement_GetType +// Get the type (/S) for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// buffer - A buffer for output. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. +// Return value: +// The number of bytes in the type, including the terminating NUL +// character. The number of bytes is returned regardless of the +// |buffer| and |buflen| parameters. +// Comments: +// Regardless of the platform, the |buffer| is always in UTF-16LE +// encoding. The string is terminated by a UTF16 NUL character. If +// |buflen| is less than the required length, or |buffer| is NULL, +// |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL +FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element, + void* buffer, + unsigned long buflen); + +// Function: FPDF_StructElement_GetTitle +// Get the title (/T) for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// buffer - A buffer for output. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. +// Return value: +// The number of bytes in the title, including the terminating NUL +// character. The number of bytes is returned regardless of the +// |buffer| and |buflen| parameters. +// Comments: +// Regardless of the platform, the |buffer| is always in UTF-16LE +// encoding. The string is terminated by a UTF16 NUL character. If +// |buflen| is less than the required length, or |buffer| is NULL, +// |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL +FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element, + void* buffer, + unsigned long buflen); + +// Function: FPDF_StructElement_CountChildren +// Count the number of children for the structure element. +// Parameters: +// struct_element - Handle to the struct element. +// Return value: +// The number of children, or -1 on error. +DLLEXPORT int STDCALL +FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element); + +// Function: FPDF_StructElement_GetChildAtIndex +// Get a child in the structure element. +// Parameters: +// struct_tree - Handle to the struct element. +// index - The index for the child, 0-based. +// Return value: +// The child at the n-th index or NULL on error. +// Comments: +// If the child exists but is not an element, then this function will +// return NULL. This will also return NULL for out of bounds indices. +DLLEXPORT FPDF_STRUCTELEMENT STDCALL +FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element, + int index); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // PUBLIC_FPDF_STRUCTTREE_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_sysfontinfo.h b/dependencies/pdfium/macx/include/fpdf_sysfontinfo.h new file mode 100644 index 00000000..a0edffff --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_sysfontinfo.h @@ -0,0 +1,316 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_SYSFONTINFO_H_ +#define PUBLIC_FPDF_SYSFONTINFO_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +/* Character sets for the font */ +#define FXFONT_ANSI_CHARSET 0 +#define FXFONT_DEFAULT_CHARSET 1 +#define FXFONT_SYMBOL_CHARSET 2 +#define FXFONT_SHIFTJIS_CHARSET 128 +#define FXFONT_HANGEUL_CHARSET 129 +#define FXFONT_GB2312_CHARSET 134 +#define FXFONT_CHINESEBIG5_CHARSET 136 + +/* Font pitch and family flags */ +#define FXFONT_FF_FIXEDPITCH 1 +#define FXFONT_FF_ROMAN (1 << 4) +#define FXFONT_FF_SCRIPT (4 << 4) + +/* Typical weight values */ +#define FXFONT_FW_NORMAL 400 +#define FXFONT_FW_BOLD 700 + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Interface: FPDF_SYSFONTINFO + * Interface for getting system font information and font mapping + */ +typedef struct _FPDF_SYSFONTINFO { + /** + * Version number of the interface. Currently must be 1. + **/ + int version; + + /** + * Method: Release + * Give implementation a chance to release any data after the + * interface is no longer used + * Interface Version: + * 1 + * Implementation Required: + * No + * Comments: + * Called by Foxit SDK during the final cleanup process. + * Parameters: + * pThis - Pointer to the interface structure itself + * Return Value: + * None + */ + void (*Release)(struct _FPDF_SYSFONTINFO* pThis); + + /** + * Method: EnumFonts + * Enumerate all fonts installed on the system + * Interface Version: + * 1 + * Implementation Required: + * No + * Comments: + * Implementation should call FPDF_AddIntalledFont() function for + * each font found. + * Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK. + * Parameters: + * pThis - Pointer to the interface structure itself + * pMapper - An opaque pointer to internal font mapper, used + * when calling FPDF_AddInstalledFont + * Return Value: + * None + */ + void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper); + + /** + * Method: MapFont + * Use the system font mapper to get a font handle from requested + *parameters + * Interface Version: + * 1 + * Implementation Required: + * Yes only if GetFont method is not implemented. + * Comments: + * If the system supports native font mapper (like Windows), + *implementation can implement this method to get a font handle. + * Otherwise, Foxit SDK will do the mapping and then call GetFont + *method. + * Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK. + * Parameters: + * pThis - Pointer to the interface structure itself + * weight - Weight of the requested font. 400 is normal and + *700 is bold. + * bItalic - Italic option of the requested font, TRUE or + *FALSE. + * charset - Character set identifier for the requested font. + *See above defined constants. + * pitch_family - A combination of flags. See above defined + *constants. + * face - Typeface name. Currently use system local encoding + *only. + * bExact - Pointer to a boolean value receiving the indicator + *whether mapper found the exact match. + * If mapper is not sure whether it's exact match, + *ignore this paramter. + * Return Value: + * An opaque pointer for font handle, or NULL if system mapping is + *not supported. + **/ + void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, + int weight, + FPDF_BOOL bItalic, + int charset, + int pitch_family, + const char* face, + FPDF_BOOL* bExact); + + /** + * Method: GetFont + * Get a handle to a particular font by its internal ID + * Interface Version: + * 1 + * Implementation Required: + * Yes only if MapFont method is not implemented. + * Comments: + * If the system mapping not supported, Foxit SDK will do the font + *mapping and use this method to get a font handle. + * Parameters: + * pThis - Pointer to the interface structure itself + * face - Typeface name. Currently use system local encoding + *only. + * Return Value: + * An opaque pointer for font handle. + **/ + void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face); + + /** + * Method: GetFontData + * Get font data from a font + * Interface Version: + * 1 + * Implementation Required: + * Yes + * Comments: + * Can read either full font file, or a particular TrueType/OpenType + *table + * Parameters: + * pThis - Pointer to the interface structure itself + * hFont - Font handle returned by MapFont or GetFont method + * table - TrueType/OpenType table identifier (refer to + *TrueType specification). + * 0 for the whole font file. + * buffer - The buffer receiving the font data. Can be NULL if + *not provided + * buf_size - Buffer size, can be zero if not provided + * Return Value: + * Number of bytes needed, if buffer not provided or not large + *enough, + * or number of bytes written into buffer otherwise. + **/ + unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis, + void* hFont, + unsigned int table, + unsigned char* buffer, + unsigned long buf_size); + + /** + * Method: GetFaceName + * Get face name from a font handle + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself + * hFont - Font handle returned by MapFont or GetFont method + * buffer - The buffer receiving the face name. Can be NULL if + *not provided + * buf_size - Buffer size, can be zero if not provided + * Return Value: + * Number of bytes needed, if buffer not provided or not large + *enough, + * or number of bytes written into buffer otherwise. + **/ + unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis, + void* hFont, + char* buffer, + unsigned long buf_size); + + /** + * Method: GetFontCharset + * Get character set information for a font handle + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself + * hFont - Font handle returned by MapFont or GetFont method + * Return Value: + * Character set identifier. See defined constants above. + **/ + int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); + + /** + * Method: DeleteFont + * Delete a font handle + * Interface Version: + * 1 + * Implementation Required: + * Yes + * Parameters: + * pThis - Pointer to the interface structure itself + * hFont - Font handle returned by MapFont or GetFont method + * Return Value: + * None + **/ + void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); +} FPDF_SYSFONTINFO; + +/** + * Struct: FPDF_CharsetFontMap + * Provides the name of a font to use for a given charset value. + **/ +typedef struct FPDF_CharsetFontMap_ { + int charset; // Character Set Enum value, see FXFONT_*_CHARSET above. + const char* fontname; // Name of default font to use with that charset. +} FPDF_CharsetFontMap; + +/** + * Function: FPDF_GetDefaultTTFMap + * Returns a pointer to the default character set to TT Font name map. The + * map is an array of FPDF_CharsetFontMap structs, with its end indicated + * by a { -1, NULL } entry. + * Parameters: + * None. + * Return Value: + * Pointer to the Charset Font Map. + **/ +DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap(); + +/** + * Function: FPDF_AddInstalledFont + * Add a system font to the list in Foxit SDK. + * Comments: + * This function is only called during the system font list building + *process. + * Parameters: + * mapper - Opaque pointer to Foxit font mapper + * face - The font face name + * charset - Font character set. See above defined constants. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, + const char* face, + int charset); + +/** + * Function: FPDF_SetSystemFontInfo + * Set the system font info interface into Foxit SDK + * Comments: + * Platform support implementation should implement required methods of + *FFDF_SYSFONTINFO interface, + * then call this function during SDK initialization process. + * Parameters: + * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure + * Return Value: + * None + **/ +DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); + +/** + * Function: FPDF_GetDefaultSystemFontInfo + * Get default system font info interface for current platform + * Comments: + * For some platforms Foxit SDK implement a default version of system + *font info interface. + * The default implementation can be used in FPDF_SetSystemFontInfo + *function. + * Parameters: + * None + * Return Value: + * Pointer to a FPDF_SYSFONTINFO structure describing the default + *interface. + * Or NULL if the platform doesn't have a default interface. + * Application should call FPDF_FreeDefaultSystemFontInfo to free the + *returned pointer. + **/ +DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo(); + +/** + * Function: FPDF_FreeDefaultSystemFontInfo + * Free a default system font info interface + * Comments: + * This function should be called on the output from + *FPDF_SetSystemFontInfo once it is no longer needed by the client. + * Parameters: + * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure + * Return Value: + * None + **/ +DLLEXPORT void FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_SYSFONTINFO_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_text.h b/dependencies/pdfium/macx/include/fpdf_text.h new file mode 100644 index 00000000..5c241527 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_text.h @@ -0,0 +1,425 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_TEXT_H_ +#define PUBLIC_FPDF_TEXT_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +// Function: FPDFText_LoadPage +// Prepare information about all characters in a page. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage function +// (in FPDFVIEW module). +// Return value: +// A handle to the text page information structure. +// NULL if something goes wrong. +// Comments: +// Application must call FPDFText_ClosePage to release the text page +// information. +// +DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page); + +// Function: FPDFText_ClosePage +// Release all resources allocated for a text page information +// structure. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// Return Value: +// None. +// +DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); + +// Function: FPDFText_CountChars +// Get number of characters in a page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// Return value: +// Number of characters in the page. Return -1 for error. +// Generated characters, like additional space characters, new line +// characters, are also counted. +// Comments: +// Characters in a page form a "stream", inside the stream, each +// character has an index. +// We will use the index parameters in many of FPDFTEXT functions. The +// first character in the page +// has an index value of zero. +// +DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page); + +// Function: FPDFText_GetUnicode +// Get Unicode of a character in a page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// Return value: +// The Unicode of the particular character. +// If a character is not encoded in Unicode and Foxit engine can't +// convert to Unicode, +// the return value will be zero. +// +DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, + int index); + +// Function: FPDFText_GetFontSize +// Get the font size of a particular character. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// Return value: +// The font size of the particular character, measured in points (about +// 1/72 inch). +// This is the typographic size of the font (so called "em size"). +// +DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, + int index); + +// Function: FPDFText_GetCharBox +// Get bounding box of a particular character. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// left - Pointer to a double number receiving left position +// of the character box. +// right - Pointer to a double number receiving right position +// of the character box. +// bottom - Pointer to a double number receiving bottom position +// of the character box. +// top - Pointer to a double number receiving top position of +// the character box. +// Return Value: +// None. +// Comments: +// All positions are measured in PDF "user space". +// +DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, + int index, + double* left, + double* right, + double* bottom, + double* top); + +// Function: FPDFText_GetCharIndexAtPos +// Get the index of a character at or nearby a certain position on the +// page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// x - X position in PDF "user space". +// y - Y position in PDF "user space". +// xTolerance - An x-axis tolerance value for character hit +// detection, in point unit. +// yTolerance - A y-axis tolerance value for character hit +// detection, in point unit. +// Return Value: +// The zero-based index of the character at, or nearby the point (x,y). +// If there is no character at or nearby the point, return value will +// be -1. +// If an error occurs, -3 will be returned. +// +DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, + double x, + double y, + double xTolerance, + double yTolerance); + +// Function: FPDFText_GetText +// Extract unicode text string from the page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// start_index - Index for the start characters. +// count - Number of characters to be extracted. +// result - A buffer (allocated by application) receiving the +// extracted unicodes. +// The size of the buffer must be able to hold the +// number of characters plus a terminator. +// Return Value: +// Number of characters written into the result buffer, including the +// trailing terminator. +// Comments: +// This function ignores characters without unicode information. +// +DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, + int start_index, + int count, + unsigned short* result); + +// Function: FPDFText_CountRects +// Count number of rectangular areas occupied by a segment of texts. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// start_index - Index for the start characters. +// count - Number of characters. +// Return value: +// Number of rectangles. Zero for error. +// Comments: +// This function, along with FPDFText_GetRect can be used by +// applications to detect the position +// on the page for a text segment, so proper areas can be highlighted +// or something. +// FPDFTEXT will automatically merge small character boxes into bigger +// one if those characters +// are on the same line and use same font settings. +// +DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, + int start_index, + int count); + +// Function: FPDFText_GetRect +// Get a rectangular area from the result generated by +// FPDFText_CountRects. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// rect_index - Zero-based index for the rectangle. +// left - Pointer to a double value receiving the rectangle +// left boundary. +// top - Pointer to a double value receiving the rectangle +// top boundary. +// right - Pointer to a double value receiving the rectangle +// right boundary. +// bottom - Pointer to a double value receiving the rectangle +// bottom boundary. +// Return Value: +// None. +// +DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, + int rect_index, + double* left, + double* top, + double* right, + double* bottom); + +// Function: FPDFText_GetBoundedText +// Extract unicode text within a rectangular boundary on the page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// left - Left boundary. +// top - Top boundary. +// right - Right boundary. +// bottom - Bottom boundary. +// buffer - A unicode buffer. +// buflen - Number of characters (not bytes) for the buffer, +// excluding an additional terminator. +// Return Value: +// If buffer is NULL or buflen is zero, return number of characters +// (not bytes) of text present within +// the rectangle, excluding a terminating NUL. Generally you should +// pass a buffer at least one larger +// than this if you want a terminating NUL, which will be provided if +// space is available. +// Otherwise, return number of characters copied into the buffer, +// including the terminating NUL +// when space for it is available. +// Comment: +// If the buffer is too small, as much text as will fit is copied into +// it. +// +DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, + double left, + double top, + double right, + double bottom, + unsigned short* buffer, + int buflen); + +// Flags used by FPDFText_FindStart function. +#define FPDF_MATCHCASE \ + 0x00000001 // If not set, it will not match case by default. +#define FPDF_MATCHWHOLEWORD \ + 0x00000002 // If not set, it will not match the whole word by default. + +// Function: FPDFText_FindStart +// Start a search. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// findwhat - A unicode match pattern. +// flags - Option flags. +// start_index - Start from this character. -1 for end of the page. +// Return Value: +// A handle for the search context. FPDFText_FindClose must be called +// to release this handle. +// +DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, + FPDF_WIDESTRING findwhat, + unsigned long flags, + int start_index); + +// Function: FPDFText_FindNext +// Search in the direction from page start to end. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// Whether a match is found. +// +DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle); + +// Function: FPDFText_FindPrev +// Search in the direction from page end to start. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// Whether a match is found. +// +DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle); + +// Function: FPDFText_GetSchResultIndex +// Get the starting character index of the search result. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// Index for the starting character. +// +DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); + +// Function: FPDFText_GetSchCount +// Get the number of matched characters in the search result. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// Number of matched characters. +// +DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle); + +// Function: FPDFText_FindClose +// Release a search context. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// None. +// +DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); + +// Function: FPDFLink_LoadWebLinks +// Prepare information about weblinks in a page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// Return Value: +// A handle to the page's links information structure. +// NULL if something goes wrong. +// Comments: +// Weblinks are those links implicitly embedded in PDF pages. PDF also +// has a type of +// annotation called "link", FPDFTEXT doesn't deal with that kind of +// link. +// FPDFTEXT weblink feature is useful for automatically detecting links +// in the page +// contents. For example, things like "http://www.foxitsoftware.com" +// will be detected, +// so applications can allow user to click on those characters to +// activate the link, +// even the PDF doesn't come with link annotations. +// +// FPDFLink_CloseWebLinks must be called to release resources. +// +DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); + +// Function: FPDFLink_CountWebLinks +// Count number of detected web links. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// Return Value: +// Number of detected web links. +// +DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); + +// Function: FPDFLink_GetURL +// Fetch the URL information for a detected web link. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// link_index - Zero-based index for the link. +// buffer - A unicode buffer for the result. +// buflen - Number of characters (not bytes) for the buffer, +// including an additional terminator. +// Return Value: +// If |buffer| is NULL or |buflen| is zero, return the number of +// characters (not bytes) needed to buffer the result (an additional +// terminator is included in this count). +// Otherwise, copy the result into |buffer|, truncating at |buflen| if +// the result is too large to fit, and return the number of characters +// actually copied into the buffer (the additional terminator is also +// included in this count). +// If |link_index| does not correspond to a valid link, then the result +// is an empty string. +// +DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, + int link_index, + unsigned short* buffer, + int buflen); + +// Function: FPDFLink_CountRects +// Count number of rectangular areas for the link. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// link_index - Zero-based index for the link. +// Return Value: +// Number of rectangular areas for the link. If |link_index| does +// not correspond to a valid link, then 0 is returned. +// +DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, + int link_index); + +// Function: FPDFLink_GetRect +// Fetch the boundaries of a rectangle for a link. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// link_index - Zero-based index for the link. +// rect_index - Zero-based index for a rectangle. +// left - Pointer to a double value receiving the rectangle +// left boundary. +// top - Pointer to a double value receiving the rectangle +// top boundary. +// right - Pointer to a double value receiving the rectangle +// right boundary. +// bottom - Pointer to a double value receiving the rectangle +// bottom boundary. +// Return Value: +// None. If |link_index| does not correspond to a valid link, then +// |left|, |top|, |right|, and |bottom| remain unmodified. +// +DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, + int link_index, + int rect_index, + double* left, + double* top, + double* right, + double* bottom); + +// Function: FPDFLink_CloseWebLinks +// Release resources used by weblink feature. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// Return Value: +// None. +// +DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_TEXT_H_ diff --git a/dependencies/pdfium/macx/include/fpdf_transformpage.h b/dependencies/pdfium/macx/include/fpdf_transformpage.h new file mode 100644 index 00000000..66271fcd --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_transformpage.h @@ -0,0 +1,161 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_TRANSFORMPAGE_H_ +#define PUBLIC_FPDF_TRANSFORMPAGE_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* FPDF_PAGEARCSAVER; +typedef void* FPDF_PAGEARCLOADER; + +/** +* Set "MediaBox" entry to the page dictionary. +* @param[in] page - Handle to a page. +* @param[in] left - The left of the rectangle. +* @param[in] bottom - The bottom of the rectangle. +* @param[in] right - The right of the rectangle. +* @param[in] top - The top of the rectangle. +* @retval None. +*/ +DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); + +/** +* Set "CropBox" entry to the page dictionary. +* @param[in] page - Handle to a page. +* @param[in] left - The left of the rectangle. +* @param[in] bottom - The bottom of the rectangle. +* @param[in] right - The right of the rectangle. +* @param[in] top - The top of the rectangle. +* @retval None. +*/ +DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); + +/** Get "MediaBox" entry from the page dictionary. +* @param[in] page - Handle to a page. +* @param[in] left - Pointer to a double value receiving the left of the +* rectangle. +* @param[in] bottom - Pointer to a double value receiving the bottom of the +* rectangle. +* @param[in] right - Pointer to a double value receiving the right of the +* rectangle. +* @param[in] top - Pointer to a double value receiving the top of the +* rectangle. +* @retval True if success,else fail. +*/ +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** Get "CropBox" entry from the page dictionary. +* @param[in] page - Handle to a page. +* @param[in] left - Pointer to a double value receiving the left of the +* rectangle. +* @param[in] bottom - Pointer to a double value receiving the bottom of the +* rectangle. +* @param[in] right - Pointer to a double value receiving the right of the +* rectangle. +* @param[in] top - Pointer to a double value receiving the top of the +* rectangle. +* @retval True if success,else fail. +*/ +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** +* Transform the whole page with a specified matrix, then clip the page content +* region. +* +* @param[in] page - A page handle. +* @param[in] matrix - The transform matrix. +* @param[in] clipRect - A rectangle page area to be clipped. +* @Note. This function will transform the whole page, and would take effect to +* all the objects in the page. +*/ +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, + FS_MATRIX* matrix, + FS_RECTF* clipRect); + +/** +* Transform (scale, rotate, shear, move) the clip path of page object. +* @param[in] page_object - Handle to a page object. Returned by +* FPDFPageObj_NewImageObj. +* @param[in] a - The coefficient "a" of the matrix. +* @param[in] b - The coefficient "b" of the matrix. +* @param[in] c - The coefficient "c" of the matrix. +* @param[in] d - The coefficient "d" of the matrix. +* @param[in] e - The coefficient "e" of the matrix. +* @param[in] f - The coefficient "f" of the matrix. +* @retval None. +*/ +DLLEXPORT void STDCALL +FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, + double a, + double b, + double c, + double d, + double e, + double f); + +/** +* Create a new clip path, with a rectangle inserted. +* +* @param[in] left - The left of the clip box. +* @param[in] bottom - The bottom of the clip box. +* @param[in] right - The right of the clip box. +* @param[in] top - The top of the clip box. +* @retval a handle to the clip path. +*/ +DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, + float bottom, + float right, + float top); + +/** +* Destroy the clip path. +* +* @param[in] clipPath - A handle to the clip path. +* Destroy the clip path. +* @retval None. +*/ +DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath); + +/** +* Clip the page content, the page content that outside the clipping region +* become invisible. +* +* @param[in] page - A page handle. +* @param[in] clipPath - A handle to the clip path. +* @Note. A clip path will be inserted before the page content stream or content +* array. In this way, the page content will be clipped +* by this clip path. +*/ +DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, + FPDF_CLIPPATH clipPath); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_TRANSFORMPAGE_H_ diff --git a/dependencies/pdfium/macx/include/fpdfview.h b/dependencies/pdfium/macx/include/fpdfview.h new file mode 100644 index 00000000..0ed9187f --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdfview.h @@ -0,0 +1,1035 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +// NOTE: External docs refer to this file as "fpdfview.h", so do not rename +// despite lack of consistency with other public files. + +#ifndef PUBLIC_FPDFVIEW_H_ +#define PUBLIC_FPDFVIEW_H_ + +#if defined(_WIN32) && !defined(__WINDOWS__) +#include +#endif + +#ifdef PDF_ENABLE_XFA +// PDF_USE_XFA is set in confirmation that this version of PDFium can support +// XFA forms as requested by the PDF_ENABLE_XFA setting. +#define PDF_USE_XFA +#endif // PDF_ENABLE_XFA + +// PDF types +typedef void* FPDF_ACTION; +typedef void* FPDF_BITMAP; +typedef void* FPDF_BOOKMARK; +typedef void* FPDF_CLIPPATH; +typedef void* FPDF_DEST; +typedef void* FPDF_DOCUMENT; +typedef void* FPDF_FONT; +typedef void* FPDF_LINK; +typedef void* FPDF_PAGE; +typedef void* FPDF_PAGELINK; +typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) +typedef void* FPDF_PAGERANGE; +typedef void* FPDF_RECORDER; +typedef void* FPDF_SCHHANDLE; +typedef void* FPDF_STRUCTELEMENT; +typedef void* FPDF_STRUCTTREE; +typedef void* FPDF_TEXTPAGE; + +#ifdef PDF_ENABLE_XFA +typedef void* FPDF_STRINGHANDLE; +typedef void* FPDF_WIDGET; +#endif // PDF_ENABLE_XFA + +// Basic data types +typedef int FPDF_BOOL; +typedef int FPDF_ERROR; +typedef unsigned long FPDF_DWORD; +typedef float FS_FLOAT; + +#ifdef PDF_ENABLE_XFA +typedef void* FPDF_LPVOID; +typedef void const* FPDF_LPCVOID; +typedef char const* FPDF_LPCSTR; +typedef int FPDF_RESULT; +#endif + +// Duplex types +typedef enum _FPDF_DUPLEXTYPE_ { + DuplexUndefined = 0, + Simplex, + DuplexFlipShortEdge, + DuplexFlipLongEdge +} FPDF_DUPLEXTYPE; + +// String types +typedef unsigned short FPDF_WCHAR; +typedef unsigned char const* FPDF_LPCBYTE; + +// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE +// encoded), and platform dependent string +typedef const char* FPDF_BYTESTRING; + +// FPDFSDK always uses UTF-16LE encoded wide strings, each character uses 2 +// bytes (except surrogation), with the low byte first. +typedef const unsigned short* FPDF_WIDESTRING; + +#ifdef PDF_ENABLE_XFA +// Structure for a byte string. +// Note, a byte string commonly means a UTF-16LE formated string. +typedef struct _FPDF_BSTR { + // String buffer. + char* str; + // Length of the string, in bytes. + int len; +} FPDF_BSTR; +#endif // PDF_ENABLE_XFA + +// For Windows programmers: In most cases it's OK to treat FPDF_WIDESTRING as a +// Windows unicode string, however, special care needs to be taken if you +// expect to process Unicode larger than 0xffff. +// +// For Linux/Unix programmers: most compiler/library environments use 4 bytes +// for a Unicode character, and you have to convert between FPDF_WIDESTRING and +// system wide string by yourself. +typedef const char* FPDF_STRING; + +// Matrix for transformation. +typedef struct _FS_MATRIX_ { + float a; + float b; + float c; + float d; + float e; + float f; +} FS_MATRIX; + +// Rectangle area(float) in device or page coordinate system. +typedef struct _FS_RECTF_ { + // The x-coordinate of the left-top corner. + float left; + // The y-coordinate of the left-top corner. + float top; + // The x-coordinate of the right-bottom corner. + float right; + // The y-coordinate of the right-bottom corner. + float bottom; +} * FS_LPRECTF, FS_RECTF; + +// Const Pointer to FS_RECTF structure. +typedef const FS_RECTF* FS_LPCRECTF; + +#if defined(_WIN32) && defined(FPDFSDK_EXPORTS) +// On Windows system, functions are exported in a DLL +#define DLLEXPORT __declspec(dllexport) +#define STDCALL __stdcall +#else +#define DLLEXPORT +#define STDCALL +#endif + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +// Function: FPDF_InitLibrary +// Initialize the FPDFSDK library +// Parameters: +// None +// Return value: +// None. +// Comments: +// Convenience function to call FPDF_InitLibraryWithConfig() for +// backwards comatibility purposes. +DLLEXPORT void STDCALL FPDF_InitLibrary(); + +// Process-wide options for initializing the library. +typedef struct FPDF_LIBRARY_CONFIG_ { + // Version number of the interface. Currently must be 2. + int version; + + // Array of paths to scan in place of the defaults when using built-in + // FXGE font loading code. The array is terminated by a NULL pointer. + // The Array may be NULL itself to use the default paths. May be ignored + // entirely depending upon the platform. + const char** m_pUserFontPaths; + + // Version 2. + + // pointer to the v8::Isolate to use, or NULL to force PDFium to create one. + void* m_pIsolate; + + // The embedder data slot to use in the v8::Isolate to store PDFium's + // per-isolate data. The value needs to be between 0 and + // v8::Internals::kNumIsolateDataLots (exclusive). Note that 0 is fine + // for most embedders. + unsigned int m_v8EmbedderSlot; +} FPDF_LIBRARY_CONFIG; + +// Function: FPDF_InitLibraryWithConfig +// Initialize the FPDFSDK library +// Parameters: +// config - configuration information as above. +// Return value: +// None. +// Comments: +// You have to call this function before you can call any PDF +// processing functions. +DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( + const FPDF_LIBRARY_CONFIG* config); + +// Function: FPDF_DestroyLibary +// Release all resources allocated by the FPDFSDK library. +// Parameters: +// None. +// Return value: +// None. +// Comments: +// You can call this function to release all memory blocks allocated by +// the library. +// After this function is called, you should not call any PDF +// processing functions. +DLLEXPORT void STDCALL FPDF_DestroyLibrary(); + +// Policy for accessing the local machine time. +#define FPDF_POLICY_MACHINETIME_ACCESS 0 + +// Function: FPDF_SetSandBoxPolicy +// Set the policy for the sandbox environment. +// Parameters: +// policy - The specified policy for setting, for example: +// FPDF_POLICY_MACHINETIME_ACCESS. +// enable - True to enable, false to disable the policy. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, + FPDF_BOOL enable); + +#if defined(_WIN32) +#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) +// Pointer to a helper function to make |font| with |text| of |text_length| +// accessible when printing text with GDI. This is useful in sandboxed +// environments where PDFium's access to GDI may be restricted. +typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, + const wchar_t* text, + size_t text_length); + +// Function: FPDF_SetTypefaceAccessibleFunc +// Set the function pointer that makes GDI fonts available in sandboxed +// environments. Experimental API. +// Parameters: +// func - A function pointer. See description above. +// Return value: +// None. +DLLEXPORT void STDCALL +FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); + +// Function: FPDF_SetPrintTextWithGDI +// Set whether to use GDI to draw fonts when printing on Windows. +// Experimental API. +// Parameters: +// use_gdi - Set to true to enable printing text with GDI. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi); +#endif // PDFIUM_PRINT_TEXT_WITH_GDI + +// Function: FPDF_SetPrintPostscriptLevel +// Set postscript printing level when printing on Windows. +// Experimental API. +// Parameters: +// postscript_level - 0 to disable postscript printing, +// 2 to print with postscript level 2, +// 3 to print with postscript level 3. +// All other values are invalid. +// Return value: +// True if successful, false if unsucessful (typically invalid input). +DLLEXPORT FPDF_BOOL STDCALL +FPDF_SetPrintPostscriptLevel(FPDF_BOOL postscript_level); +#endif // defined(_WIN32) + +// Function: FPDF_LoadDocument +// Open and load a PDF document. +// Parameters: +// file_path - Path to the PDF file (including extension). +// password - A string used as the password for the PDF file. +// If no password is needed, empty or NULL can be used. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// Loaded document can be closed by FPDF_CloseDocument(). +// If this function fails, you can use FPDF_GetLastError() to retrieve +// the reason why it failed. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, + FPDF_BYTESTRING password); + +// Function: FPDF_LoadMemDocument +// Open and load a PDF document from memory. +// Parameters: +// data_buf - Pointer to a buffer containing the PDF document. +// size - Number of bytes in the PDF document. +// password - A string used as the password for the PDF file. +// If no password is needed, empty or NULL can be used. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// The memory buffer must remain valid when the document is open. +// The loaded document can be closed by FPDF_CloseDocument. +// If this function fails, you can use FPDF_GetLastError() to retrieve +// the reason why it failed. +// Notes: +// If PDFium is built with the XFA module, the application should call +// FPDF_LoadXFA() function after the PDF document loaded to support XFA +// fields defined in the fpdfformfill.h file. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, + int size, + FPDF_BYTESTRING password); + +// Structure for custom file access. +typedef struct { + // File length, in bytes. + unsigned long m_FileLen; + + // A function pointer for getting a block of data from a specific position. + // Position is specified by byte offset from the beginning of the file. + // The position and size will never go out of range of the file length. + // It may be possible for FPDFSDK to call this function multiple times for + // the same position. + // Return value: should be non-zero if successful, zero for error. + int (*m_GetBlock)(void* param, + unsigned long position, + unsigned char* pBuf, + unsigned long size); + + // A custom pointer for all implementation specific data. This pointer will + // be used as the first parameter to the m_GetBlock callback. + void* m_Param; +} FPDF_FILEACCESS; + +#ifdef PDF_ENABLE_XFA +/** + * @brief Structure for file reading or writing (I/O). + * + * @note This is a handler and should be implemented by callers. + */ +typedef struct _FPDF_FILEHANDLER { + /** + * @brief User-defined data. + * @note Callers can use this field to track controls. + */ + FPDF_LPVOID clientData; + /** + * @brief Callback function to release the current file stream object. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return None. + */ + void (*Release)(FPDF_LPVOID clientData); + /** + * @brief Callback function to retrieve the current file stream size. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return Size of file stream. + */ + FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData); + /** + * @brief Callback function to read data from the current file stream. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] offset Offset position starts from the beginning of file + * stream. This parameter indicates reading position. + * @param[in] buffer Memory buffer to store data which are read from + * file stream. This parameter should not be NULL. + * @param[in] size Size of data which should be read from file + * stream, in bytes. The buffer indicated by the parameter buffer + * should be enough to store specified data. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, + FPDF_DWORD offset, + FPDF_LPVOID buffer, + FPDF_DWORD size); + /** + * @brief Callback function to write data into the current file stream. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] offset Offset position starts from the beginning of file + * stream. This parameter indicates writing position. + * @param[in] buffer Memory buffer contains data which is written into + * file stream. This parameter should not be NULL. + * @param[in] size Size of data which should be written into file + * stream, in bytes. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, + FPDF_DWORD offset, + FPDF_LPCVOID buffer, + FPDF_DWORD size); + /** + * @brief Callback function to flush all internal accessing buffers. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*Flush)(FPDF_LPVOID clientData); + /** + * @brief Callback function to change file size. + * + * @details This function is called under writing mode usually. Implementer + * can determine whether to realize it based on application requests. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] size New size of file stream, in bytes. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); +} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; + +#endif +// Function: FPDF_LoadCustomDocument +// Load PDF document from a custom access descriptor. +// Parameters: +// pFileAccess - A structure for accessing the file. +// password - Optional password for decrypting the PDF file. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// The application must keep the file resources valid until the PDF +// document is closed. +// +// The loaded document can be closed with FPDF_CloseDocument. +// Notes: +// If PDFium is built with the XFA module, the application should call +// FPDF_LoadXFA() function after the PDF document loaded to support XFA +// fields defined in the fpdfformfill.h file. +DLLEXPORT FPDF_DOCUMENT STDCALL +FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); + +// Function: FPDF_GetFileVersion +// Get the file version of the given PDF document. +// Parameters: +// doc - Handle to a document. +// fileVersion - The PDF file version. File version: 14 for 1.4, 15 +// for 1.5, ... +// Return value: +// True if succeeds, false otherwise. +// Comments: +// If the document was created by FPDF_CreateNewDocument, +// then this function will always fail. +DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, + int* fileVersion); + +#define FPDF_ERR_SUCCESS 0 // No error. +#define FPDF_ERR_UNKNOWN 1 // Unknown error. +#define FPDF_ERR_FILE 2 // File not found or could not be opened. +#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. +#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. +#define FPDF_ERR_SECURITY 5 // Unsupported security scheme. +#define FPDF_ERR_PAGE 6 // Page not found or content error. +#ifdef PDF_ENABLE_XFA +#define FPDF_ERR_XFALOAD 7 // Load XFA error. +#define FPDF_ERR_XFALAYOUT 8 // Layout XFA error. +#endif // PDF_ENABLE_XFA + +// Function: FPDF_GetLastError +// Get last error code when a function fails. +// Parameters: +// None. +// Return value: +// A 32-bit integer indicating error code as defined above. +// Comments: +// If the previous SDK call succeeded, the return value of this +// function is not defined. +DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); + +// Function: FPDF_GetDocPermission +// Get file permission flags of the document. +// Parameters: +// document - Handle to a document. Returned by FPDF_LoadDocument. +// Return value: +// A 32-bit integer indicating permission flags. Please refer to the +// PDF Reference for detailed descriptions. If the document is not +// protected, 0xffffffff will be returned. +DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); + +// Function: FPDF_GetSecurityHandlerRevision +// Get the revision for the security handler. +// Parameters: +// document - Handle to a document. Returned by FPDF_LoadDocument. +// Return value: +// The security handler revision number. Please refer to the PDF +// Reference for a detailed description. If the document is not +// protected, -1 will be returned. +DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); + +// Function: FPDF_GetPageCount +// Get total number of pages in the document. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument. +// Return value: +// Total number of pages in the document. +DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); + +// Function: FPDF_LoadPage +// Load a page inside the document. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument +// page_index - Index number of the page. 0 for the first page. +// Return value: +// A handle to the loaded page, or NULL if page load fails. +// Comments: +// The loaded page can be rendered to devices using FPDF_RenderPage. +// The loaded page can be closed using FPDF_ClosePage. +DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, + int page_index); + +// Function: FPDF_GetPageWidth +// Get page width. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// Return value: +// Page width (excluding non-displayable area) measured in points. +// One point is 1/72 inch (around 0.3528 mm). +DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); + +// Function: FPDF_GetPageHeight +// Get page height. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// Return value: +// Page height (excluding non-displayable area) measured in points. +// One point is 1/72 inch (around 0.3528 mm) +DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); + +// Function: FPDF_GetPageSizeByIndex +// Get the size of the page at the given index. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument. +// page_index - Page index, zero for the first page. +// width - Pointer to a double to receive the page width +// (in points). +// height - Pointer to a double to receive the page height +// (in points). +// Return value: +// Non-zero for success. 0 for error (document or page not found). +DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, + int page_index, + double* width, + double* height); + +// Page rendering flags. They can be combined with bit-wise OR. +// +// Set if annotations are to be rendered. +#define FPDF_ANNOT 0x01 +// Set if using text rendering optimized for LCD display. +#define FPDF_LCD_TEXT 0x02 +// Don't use the native text output available on some platforms +#define FPDF_NO_NATIVETEXT 0x04 +// Grayscale output. +#define FPDF_GRAYSCALE 0x08 +// Set if you want to get some debug info. +#define FPDF_DEBUG_INFO 0x80 +// Set if you don't want to catch exceptions. +#define FPDF_NO_CATCH 0x100 +// Limit image cache size. +#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 +// Always use halftone for image stretching. +#define FPDF_RENDER_FORCEHALFTONE 0x400 +// Render for printing. +#define FPDF_PRINTING 0x800 +// Set to disable anti-aliasing on text. +#define FPDF_RENDER_NO_SMOOTHTEXT 0x1000 +// Set to disable anti-aliasing on images. +#define FPDF_RENDER_NO_SMOOTHIMAGE 0x2000 +// Set to disable anti-aliasing on paths. +#define FPDF_RENDER_NO_SMOOTHPATH 0x4000 +// Set whether to render in a reverse Byte order, this flag is only used when +// rendering to a bitmap. +#define FPDF_REVERSE_BYTE_ORDER 0x10 + +#ifdef _WIN32 +// Function: FPDF_RenderPage +// Render contents of a page to a device (screen, bitmap, or printer). +// This function is only supported on Windows. +// Parameters: +// dc - Handle to the device context. +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: +// 0 (normal) +// 1 (rotated 90 degrees clockwise) +// 2 (rotated 180 degrees) +// 3 (rotated 90 degrees counter-clockwise) +// flags - 0 for normal display, or combination of flags +// defined above. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); +#endif + +// Function: FPDF_RenderPageBitmap +// Render contents of a page to a device independent bitmap. +// Parameters: +// bitmap - Handle to the device independent bitmap (as the +// output buffer). The bitmap handle can be created +// by FPDFBitmap_Create. +// page - Handle to the page. Returned by FPDF_LoadPage +// start_x - Left pixel position of the display area in +// bitmap coordinates. +// start_y - Top pixel position of the display area in bitmap +// coordinates. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: +// 0 (normal) +// 1 (rotated 90 degrees clockwise) +// 2 (rotated 180 degrees) +// 3 (rotated 90 degrees counter-clockwise) +// flags - 0 for normal display, or combination of the Page +// Rendering flags defined above. With the FPDF_ANNOT +// flag, it renders all annotations that do not require +// user-interaction, which are all annotations except +// widget and popup annotations. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); + +// Function: FPDF_RenderPageBitmapWithMatrix +// Render contents of a page to a device independent bitmap. +// Parameters: +// bitmap - Handle to the device independent bitmap (as the +// output buffer). The bitmap handle can be created +// by FPDFBitmap_Create. +// page - Handle to the page. Returned by FPDF_LoadPage +// matrix - The transform matrix. +// clipping - The rect to clip to. +// flags - 0 for normal display, or combination of the Page +// Rendering flags defined above. With the FPDF_ANNOT +// flag, it renders all annotations that do not require +// user-interaction, which are all annotations except +// widget and popup annotations. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, + FPDF_PAGE page, + const FS_MATRIX* matrix, + const FS_RECTF* clipping, + int flags); + +#ifdef _SKIA_SUPPORT_ +DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, + int size_x, + int size_y); +#endif + +// Function: FPDF_ClosePage +// Close a loaded PDF page. +// Parameters: +// page - Handle to the loaded page. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); + +// Function: FPDF_CloseDocument +// Close a loaded PDF document. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); + +// Function: FPDF_DeviceToPage +// Convert the screen coordinates of a point to page coordinates. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: +// 0 (normal) +// 1 (rotated 90 degrees clockwise) +// 2 (rotated 180 degrees) +// 3 (rotated 90 degrees counter-clockwise) +// device_x - X value in device coordinates to be converted. +// device_y - Y value in device coordinates to be converted. +// page_x - A pointer to a double receiving the converted X +// value in page coordinates. +// page_y - A pointer to a double receiving the converted Y +// value in page coordinates. +// Return value: +// None. +// Comments: +// The page coordinate system has its origin at the left-bottom corner +// of the page, with the X-axis on the bottom going to the right, and +// the Y-axis on the left side going up. +// +// NOTE: this coordinate system can be altered when you zoom, scroll, +// or rotate a page, however, a point on the page should always have +// the same coordinate values in the page coordinate system. +// +// The device coordinate system is device dependent. For screen device, +// its origin is at the left-top corner of the window. However this +// origin can be altered by the Windows coordinate transformation +// utilities. +// +// You must make sure the start_x, start_y, size_x, size_y +// and rotate parameters have exactly same values as you used in +// the FPDF_RenderPage() function call. +DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int device_x, + int device_y, + double* page_x, + double* page_y); + +// Function: FPDF_PageToDevice +// Convert the page coordinates of a point to screen coordinates. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: +// 0 (normal) +// 1 (rotated 90 degrees clockwise) +// 2 (rotated 180 degrees) +// 3 (rotated 90 degrees counter-clockwise) +// page_x - X value in page coordinates. +// page_y - Y value in page coordinate. +// device_x - A pointer to an integer receiving the result X +// value in device coordinates. +// device_y - A pointer to an integer receiving the result Y +// value in device coordinates. +// Return value: +// None. +// Comments: +// See comments for FPDF_DeviceToPage(). +DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + double page_x, + double page_y, + int* device_x, + int* device_y); + +// Function: FPDFBitmap_Create +// Create a device independent bitmap (FXDIB). +// Parameters: +// width - The number of pixels in width for the bitmap. +// Must be greater than 0. +// height - The number of pixels in height for the bitmap. +// Must be greater than 0. +// alpha - A flag indicating whether the alpha channel is used. +// Non-zero for using alpha, zero for not using. +// Return value: +// The created bitmap handle, or NULL if a parameter error or out of +// memory. +// Comments: +// The bitmap always uses 4 bytes per pixel. The first byte is always +// double word aligned. +// +// The byte order is BGRx (the last byte unused if no alpha channel) or +// BGRA. +// +// The pixels in a horizontal line are stored side by side, with the +// left most pixel stored first (with lower memory address). +// Each line uses width * 4 bytes. +// +// Lines are stored one after another, with the top most line stored +// first. There is no gap between adjacent lines. +// +// This function allocates enough memory for holding all pixels in the +// bitmap, but it doesn't initialize the buffer. Applications can use +// FPDFBitmap_FillRect to fill the bitmap using any color. +DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, + int height, + int alpha); + +// More DIB formats +// Gray scale bitmap, one byte per pixel. +#define FPDFBitmap_Gray 1 +// 3 bytes per pixel, byte order: blue, green, red. +#define FPDFBitmap_BGR 2 +// 4 bytes per pixel, byte order: blue, green, red, unused. +#define FPDFBitmap_BGRx 3 +// 4 bytes per pixel, byte order: blue, green, red, alpha. +#define FPDFBitmap_BGRA 4 + +// Function: FPDFBitmap_CreateEx +// Create a device independent bitmap (FXDIB) +// Parameters: +// width - The number of pixels in width for the bitmap. +// Must be greater than 0. +// height - The number of pixels in height for the bitmap. +// Must be greater than 0. +// format - A number indicating for bitmap format, as defined +// above. +// first_scan - A pointer to the first byte of the first line if +// using an external buffer. If this parameter is NULL, +// then the a new buffer will be created. +// stride - Number of bytes for each scan line, for external +// buffer only. +// Return value: +// The bitmap handle, or NULL if parameter error or out of memory. +// Comments: +// Similar to FPDFBitmap_Create function, but allows for more formats +// and an external buffer is supported. The bitmap created by this +// function can be used in any place that a FPDF_BITMAP handle is +// required. +// +// If an external buffer is used, then the application should destroy +// the buffer by itself. FPDFBitmap_Destroy function will not destroy +// the buffer. +DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, + int height, + int format, + void* first_scan, + int stride); + +// Function: FPDFBitmap_FillRect +// Fill a rectangle in a bitmap. +// Parameters: +// bitmap - The handle to the bitmap. Returned by +// FPDFBitmap_Create. +// left - The left position. Starting from 0 at the +// left-most pixel. +// top - The top position. Starting from 0 at the +// top-most line. +// width - Width in pixels to be filled. +// height - Height in pixels to be filled. +// color - A 32-bit value specifing the color, in 8888 ARGB +// format. +// Return value: +// None. +// Comments: +// This function sets the color and (optionally) alpha value in the +// specified region of the bitmap. +// +// NOTE: If the alpha channel is used, this function does NOT +// composite the background with the source color, instead the +// background will be replaced by the source color and the alpha. +// +// If the alpha channel is not used, the alpha parameter is ignored. +DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, + int left, + int top, + int width, + int height, + FPDF_DWORD color); + +// Function: FPDFBitmap_GetBuffer +// Get data buffer of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The pointer to the first byte of the bitmap buffer. +// Comments: +// The stride may be more than width * number of bytes per pixel +// +// Applications can use this function to get the bitmap buffer pointer, +// then manipulate any color and/or alpha values for any pixels in the +// bitmap. +// +// The data is in BGRA format. Where the A maybe unused if alpha was +// not specified. +DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetWidth +// Get width of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The width of the bitmap in pixels. +DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetHeight +// Get height of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The height of the bitmap in pixels. +DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetStride +// Get number of bytes for each line in the bitmap buffer. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The number of bytes for each line in the bitmap buffer. +// Comments: +// The stride may be more than width * number of bytes per pixel. +DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_Destroy +// Destroy a bitmap and release all related buffers. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// None. +// Comments: +// This function will not destroy any external buffers provided when +// the bitmap was created. +DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); + +// Function: FPDF_VIEWERREF_GetPrintScaling +// Whether the PDF document prefers to be scaled or not. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// None. +DLLEXPORT FPDF_BOOL STDCALL +FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetNumCopies +// Returns the number of copies to be printed. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The number of copies to be printed. +DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetPrintPageRange +// Page numbers to initialize print dialog box when file is printed. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The print page range to be used for printing. +DLLEXPORT FPDF_PAGERANGE STDCALL +FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetDuplex +// Returns the paper handling option to be used when printing from +// the print dialog. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The paper handling option to be used when printing. +DLLEXPORT FPDF_DUPLEXTYPE STDCALL +FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetName +// Gets the contents for a viewer ref, with a given key. The value must +// be of type "name". +// Parameters: +// document - Handle to the loaded document. +// key - Name of the key in the viewer pref dictionary. +// buffer - A string to write the contents of the key to. +// length - Length of the buffer. +// Return value: +// The number of bytes in the contents, including the NULL terminator. +// Thus if the return value is 0, then that indicates an error, such +// as when |document| is invalid or |buffer| is NULL. If |length| is +// less than the returned length, or |buffer| is NULL, |buffer| will +// not be modified. +DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, + FPDF_BYTESTRING key, + char* buffer, + unsigned long length); + +// Function: FPDF_CountNamedDests +// Get the count of named destinations in the PDF document. +// Parameters: +// document - Handle to a document +// Return value: +// The count of named destinations. +DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); + +// Function: FPDF_GetNamedDestByName +// Get a the destination handle for the given name. +// Parameters: +// document - Handle to the loaded document. +// name - The name of a destination. +// Return value: +// The handle to the destination. +DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, + FPDF_BYTESTRING name); + +// Function: FPDF_GetNamedDest +// Get the named destination by index. +// Parameters: +// document - Handle to a document +// index - The index of a named destination. +// buffer - The buffer to store the destination name, +// used as wchar_t*. +// buflen [in/out] - Size of the buffer in bytes on input, +// length of the result in bytes on output +// or -1 if the buffer is too small. +// Return value: +// The destination handle for a given index, or NULL if there is no +// named destination corresponding to |index|. +// Comments: +// Call this function twice to get the name of the named destination: +// 1) First time pass in |buffer| as NULL and get buflen. +// 2) Second time pass in allocated |buffer| and buflen to retrieve +// |buffer|, which should be used as wchar_t*. +// +// If buflen is not sufficiently large, it will be set to -1 upon +// return. +DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, + int index, + void* buffer, + long* buflen); + +#ifdef PDF_ENABLE_XFA +// Function: FPDF_BStr_Init +// Helper function to initialize a byte string. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str); + +// Function: FPDF_BStr_Set +// Helper function to set string data. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, + FPDF_LPCSTR bstr, + int length); + +// Function: FPDF_BStr_Clear +// Helper function to clear a byte string. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str); +#endif // PDF_ENABLE_XFA + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDFVIEW_H_ diff --git a/dependencies/pdfium/win/public/README b/dependencies/pdfium/win/public/README new file mode 100644 index 00000000..b07d0f30 --- /dev/null +++ b/dependencies/pdfium/win/public/README @@ -0,0 +1,13 @@ +public/ README + +The header files in this directory are the only ones that should ever be +included by an embedder of PDFium. If there arises a need for functionality +beyond what is present here, then a new API must be added here to provide it. + +These header files must be entirely contained in this directory; they must +never include other header files from outside of it. + +These files must compile cleanly without warnings on both C and C++ compilers. + +Changes to these files must be carefully considered to avoid breaking +compatibility. diff --git a/dependencies/pdfium/win/public/fpdf_dataavail.h b/dependencies/pdfium/win/public/fpdf_dataavail.h new file mode 100644 index 00000000..2413e2be --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_dataavail.h @@ -0,0 +1,198 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_DATAAVAIL_H_ +#define PUBLIC_FPDF_DATAAVAIL_H_ + +#include + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#define PDF_LINEARIZATION_UNKNOWN -1 +#define PDF_NOT_LINEARIZED 0 +#define PDF_LINEARIZED 1 + +#define PDF_DATA_ERROR -1 +#define PDF_DATA_NOTAVAIL 0 +#define PDF_DATA_AVAIL 1 + +#define PDF_FORM_ERROR -1 +#define PDF_FORM_NOTAVAIL 0 +#define PDF_FORM_AVAIL 1 +#define PDF_FORM_NOTEXIST 2 + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Interface for checking whether sections of the file are available. +typedef struct _FX_FILEAVAIL { + // Version number of the interface. Must be 1. + int version; + + // Reports if the specified data section is currently available. A section is + // available if all bytes in the section are available. + // + // Interface Version: 1 + // Implementation Required: Yes + // + // pThis - pointer to the interface structure. + // offset - the offset of the data section in the file. + // size - the size of the data section. + // + // Returns true if the specified data section at |offset| of |size| + // is available. + FPDF_BOOL (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, + size_t offset, + size_t size); +} FX_FILEAVAIL; +typedef void* FPDF_AVAIL; + +// Create a document availability provider. +// +// file_avail - pointer to file availability interface. +// file - pointer to a file access interface. +// +// Returns a handle to the document availability provider, or NULL on error. +// +// |FPDFAvail_Destroy| must be called when done with the availability provider. +DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, + FPDF_FILEACCESS* file); + +// Destroy the |avail| document availability provider. +// +// avail - handle to document availability provider to be destroyed. +DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail); + +// Download hints interface. Used to receive hints for further downloading. +typedef struct _FX_DOWNLOADHINTS { + // Version number of the interface. Must be 1. + int version; + + // Add a section to be downloaded. + // + // Interface Version: 1 + // Implementation Required: Yes + // + // pThis - pointer to the interface structure. + // offset - the offset of the hint reported to be downloaded. + // size - the size of the hint reported to be downloaded. + // + // The |offset| and |size| of the section may not be unique. Part of the + // section might be already available. The download manager must deal with + // overlapping sections. + void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis, + size_t offset, + size_t size); +} FX_DOWNLOADHINTS; + +// Checks if the document is ready for loading, if not, gets download hints. +// +// avail - handle to document availability provider. +// hints - pointer to a download hints interface. +// +// Returns one of: +// PDF_DATA_ERROR: A common error is returned. Data availability unknown. +// PDF_DATA_NOTAVAIL: Data not yet available. +// PDF_DATA_AVAIL: Data available. +// +// Applications should call this function whenever new data arrives, and process +// all the generated download hints, if any, until the function returns +// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. +// +// Once all data is available, call |FPDFAvail_GetDocument| to get a document +// handle. +DLLEXPORT int STDCALL +FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints); + +// Get document from the availability provider. +// +// avail - handle to document availability provider. +// password - password for decrypting the PDF file. Optional. +// +// Returns a handle to the document. +// +// When |FPDFAvail_IsDocAvail| returns TRUE, call |FPDFAvail_GetDocument| to +// retrieve the document handle. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail, + FPDF_BYTESTRING password); + +// Get the page number for the first available page in a linearized PDF. +// +// doc - document handle. +// +// Returns the zero-based index for the first available page. +// +// For most linearized PDFs, the first available page will be the first page, +// however, some PDFs might make another page the first available page. +// For non-linearized PDFs, this function will always return zero. +DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc); + +// Check if |page_index| is ready for loading, if not, get the +// |FX_DOWNLOADHINTS|. +// +// avail - handle to document availability provider. +// page_index - index number of the page. Zero for the first page. +// hints - pointer to a download hints interface. Populated if +// |page_index| is not available. +// +// Returns one of: +// PDF_DATA_ERROR: A common error is returned. Data availability unknown. +// PDF_DATA_NOTAVAIL: Data not yet available. +// PDF_DATA_AVAIL: Data available. +// +// This function can be called only after |FPDFAvail_GetDocument| is called. +// Applications should call this function whenever new data arrives and process +// all the generated download |hints|, if any, until this function returns +// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page +// loading. +DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, + int page_index, + FX_DOWNLOADHINTS* hints); + +// Check if form data is ready for initialization, if not, get the +// |FX_DOWNLOADHINTS|. +// +// avail - handle to document availability provider. +// hints - pointer to a download hints interface. Populated if form is not +// ready for initialization. +// +// Returns one of: +// PDF_FORM_ERROR: A common eror, in general incorrect parameters. +// PDF_FORM_NOTAVAIL: Data not available. +// PDF_FORM_AVAIL: Data available. +// PDF_FORM_NOTEXIST: No form data. +// +// This function can be called only after |FPDFAvail_GetDocument| is called. +// The application should call this function whenever new data arrives and +// process all the generated download |hints|, if any, until the function +// |PDF_FORM_ERROR|, |PDF_FORM_AVAIL| or |PDF_FORM_NOTEXIST|. +// Applications can then perform page loading. It is recommend to call +// |FPDFDOC_InitFormFillEnvironment| when |PDF_FORM_AVAIL| is returned. +DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, + FX_DOWNLOADHINTS* hints); + +// Check whether a document is a linearized PDF. +// +// avail - handle to document availability provider. +// +// Returns one of: +// PDF_LINEARIZED +// PDF_NOT_LINEARIZED +// PDF_LINEARIZATION_UNKNOWN +// +// |FPDFAvail_IsLinearized| will return |PDF_LINEARIZED| or |PDF_NOT_LINEARIZED| +// when we have 1k of data. If the files size less than 1k, it returns +// |PDF_LINEARIZATION_UNKNOWN| as there is insufficient information to determine +// if the PDF is linearlized. +DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_DATAAVAIL_H_ diff --git a/dependencies/pdfium/win/public/fpdf_doc.h b/dependencies/pdfium/win/public/fpdf_doc.h new file mode 100644 index 00000000..9d55a2e8 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_doc.h @@ -0,0 +1,325 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_DOC_H_ +#define PUBLIC_FPDF_DOC_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Unsupported action type. +#define PDFACTION_UNSUPPORTED 0 +// Go to a destination within current document. +#define PDFACTION_GOTO 1 +// Go to a destination within another document. +#define PDFACTION_REMOTEGOTO 2 +// URI, including web pages and other Internet resources. +#define PDFACTION_URI 3 +// Launch an application or open a file. +#define PDFACTION_LAUNCH 4 + +typedef struct _FS_QUADPOINTSF { + FS_FLOAT x1; + FS_FLOAT y1; + FS_FLOAT x2; + FS_FLOAT y2; + FS_FLOAT x3; + FS_FLOAT y3; + FS_FLOAT x4; + FS_FLOAT y4; +} FS_QUADPOINTSF; + +// Get the first child of |bookmark|, or the first top-level bookmark item. +// +// document - handle to the document. +// bookmark - handle to the current bookmark. Pass NULL for the first top +// level item. +// +// Returns a handle to the first child of |bookmark| or the first top-level +// bookmark item. NULL if no child or top-level bookmark found. +DLLEXPORT FPDF_BOOKMARK STDCALL +FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); + +// Get the next sibling of |bookmark|. +// +// document - handle to the document. +// bookmark - handle to the current bookmark. +// +// Returns a handle to the next sibling of |bookmark|, or NULL if this is the +// last bookmark at this level. +DLLEXPORT FPDF_BOOKMARK STDCALL +FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); + +// Get the title of |bookmark|. +// +// bookmark - handle to the bookmark. +// buffer - buffer for the title. May be NULL. +// buflen - the length of the buffer in bytes. May be 0. +// +// Returns the number of bytes in the title, including the terminating NUL +// character. The number of bytes is returned regardless of the |buffer| and +// |buflen| parameters. +// +// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The +// string is terminated by a UTF16 NUL character. If |buflen| is less than the +// required length, or |buffer| is NULL, |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, + void* buffer, + unsigned long buflen); + +// Find the bookmark with |title| in |document|. +// +// document - handle to the document. +// title - the UTF-16LE encoded Unicode title for which to search. +// +// Returns the handle to the bookmark, or NULL if |title| can't be found. +// +// |FPDFBookmark_Find| will always return the first bookmark found even if +// multiple bookmarks have the same |title|. +DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, + FPDF_WIDESTRING title); + +// Get the destination associated with |bookmark|. +// +// document - handle to the document. +// bookmark - handle to the bookmark. +// +// Returns the handle to the destination data, NULL if no destination is +// associated with |bookmark|. +DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, + FPDF_BOOKMARK bookmark); + +// Get the action associated with |bookmark|. +// +// bookmark - handle to the bookmark. +// +// Returns the handle to the action data, or NULL if no action is associated +// with |bookmark|. When NULL is returned, |FPDFBookmark_GetDest| should be +// called to get the |bookmark| destination data. +DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); + +// Get the type of |action|. +// +// action - handle to the action. +// +// Returns one of: +// PDFACTION_UNSUPPORTED +// PDFACTION_GOTO +// PDFACTION_REMOTEGOTO +// PDFACTION_URI +// PDFACTION_LAUNCH +DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action); + +// Get the destination of |action|. +// +// document - handle to the document. +// action - handle to the action. |action| must be a |PDFACTION_GOTO| or +// |PDFACTION_REMOTEGOTO|. +// +// Returns a handle to the destination data. +// +// In the case of |PDFACTION_REMOTEGOTO|, you should first call +// |FPDFAction_GetFilePath| then load that document, the document handle from +// that document should pass as |document| to |FPDFAction_GetDest|. +DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, + FPDF_ACTION action); + +// Get file path of a |PDFACTION_REMOTEGOTO| |action|. +// +// action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or +// |PDFACTION_REMOTEGOTO| +// buffer - a buffer for output the path string. May be NULL. +// buflen - the length of the buffer, in bytes. May be 0. +// +// Returns the number of bytes in the file path, including the trailing UTF16 +// NUL character. +// +// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. +// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer| +// will not be modified. +DLLEXPORT unsigned long STDCALL +FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen); + +// Get the URI path of a |PDFACTION_URI| |action|. +// +// document - handle to the document. +// action - handle to the action. Must be a |PDFACTION_URI|. +// buffer - a buffer for the path string. May be NULL. +// buflen - the length of the buffer, in bytes. May be 0. +// +// Returns the number of bytes in the URI path, including trailing zeros. +// +// The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the +// returned length, or |buffer| is NULL, |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, + FPDF_ACTION action, + void* buffer, + unsigned long buflen); + +// Get the page index of |dest|. +// +// document - handle to the document. +// dest - handle to the destination. +// +// Returns the page index containing |dest|. Page indices start from 0. +DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, + FPDF_DEST dest); + +// Get the (x, y, zoom) location of |dest| in the destination page, if the +// destination is in [page /XYZ x y zoom] syntax. +// +// dest - handle to the destination. +// hasXVal - out parameter; true if the x value is not null +// hasYVal - out parameter; true if the y value is not null +// hasZoomVal - out parameter; true if the zoom value is not null +// x - out parameter; the x coordinate, in page coordinates. +// y - out parameter; the y coordinate, in page coordinates. +// zoom - out parameter; the zoom value. +// Returns TRUE on successfully reading the /XYZ value. +// +// Note the [x, y, zoom] values are only set if the corresponding hasXVal, +// hasYVal or hasZoomVal flags are true. +DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST dest, + FPDF_BOOL* hasXCoord, + FPDF_BOOL* hasYCoord, + FPDF_BOOL* hasZoom, + FS_FLOAT* x, + FS_FLOAT* y, + FS_FLOAT* zoom); + +// Find a link at point (|x|,|y|) on |page|. +// +// page - handle to the document page. +// x - the x coordinate, in the page coordinate system. +// y - the y coordinate, in the page coordinate system. +// +// Returns a handle to the link, or NULL if no link found at the given point. +// +// You can convert coordinates from screen coordinates to page coordinates using +// |FPDF_DeviceToPage|. +DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, + double x, + double y); + +// Find the Z-order of link at point (|x|,|y|) on |page|. +// +// page - handle to the document page. +// x - the x coordinate, in the page coordinate system. +// y - the y coordinate, in the page coordinate system. +// +// Returns the Z-order of the link, or -1 if no link found at the given point. +// Larger Z-order numbers are closer to the front. +// +// You can convert coordinates from screen coordinates to page coordinates using +// |FPDF_DeviceToPage|. +DLLEXPORT int STDCALL +FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y); + +// Get destination info for |link|. +// +// document - handle to the document. +// link - handle to the link. +// +// Returns a handle to the destination, or NULL if there is no destination +// associated with the link. In this case, you should call |FPDFLink_GetAction| +// to retrieve the action associated with |link|. +DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, + FPDF_LINK link); + +// Get action info for |link|. +// +// link - handle to the link. +// +// Returns a handle to the action associated to |link|, or NULL if no action. +DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link); + +// Enumerates all the link annotations in |page|. +// +// page - handle to the page. +// startPos - the start position, should initially be 0 and is updated with +// the next start position on return. +// linkAnnot - the link handle for |startPos|. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, + int* startPos, + FPDF_LINK* linkAnnot); + +// Get the rectangle for |linkAnnot|. +// +// linkAnnot - handle to the link annotation. +// rect - the annotation rectangle. +// +// Returns true on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, + FS_RECTF* rect); + +// Get the count of quadrilateral points to the |linkAnnot|. +// +// linkAnnot - handle to the link annotation. +// +// Returns the count of quadrilateral points. +DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot); + +// Get the quadrilateral points for the specified |quadIndex| in |linkAnnot|. +// +// linkAnnot - handle to the link annotation. +// quadIndex - the specified quad point index. +// quadPoints - receives the quadrilateral points. +// +// Returns true on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, + int quadIndex, + FS_QUADPOINTSF* quadPoints); + +// Get meta-data |tag| content from |document|. +// +// document - handle to the document. +// tag - the tag to retrieve. The tag can be one of: +// Title, Author, Subject, Keywords, Creator, Producer, +// CreationDate, or ModDate. +// For detailed explanations of these tags and their respective +// values, please refer to PDF Reference 1.6, section 10.2.1, +// 'Document Information Dictionary'. +// buffer - a buffer for the tag. May be NULL. +// buflen - the length of the buffer, in bytes. May be 0. +// +// Returns the number of bytes in the tag, including trailing zeros. +// +// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two +// bytes of zeros indicating the end of the string. If |buflen| is less than +// the returned length, or |buffer| is NULL, |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document, + FPDF_BYTESTRING tag, + void* buffer, + unsigned long buflen); + +// Get the page label for |page_index| from |document|. +// +// document - handle to the document. +// page_index - the 0-based index of the page. +// buffer - a buffer for the page label. May be NULL. +// buflen - the length of the buffer, in bytes. May be 0. +// +// Returns the number of bytes in the page label, including trailing zeros. +// +// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two +// bytes of zeros indicating the end of the string. If |buflen| is less than +// the returned length, or |buffer| is NULL, |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL FPDF_GetPageLabel(FPDF_DOCUMENT document, + int page_index, + void* buffer, + unsigned long buflen); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_DOC_H_ diff --git a/dependencies/pdfium/win/public/fpdf_edit.h b/dependencies/pdfium/win/public/fpdf_edit.h new file mode 100644 index 00000000..640d97ed --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_edit.h @@ -0,0 +1,267 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_EDIT_H_ +#define PUBLIC_FPDF_EDIT_H_ + +#include + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#define FPDF_ARGB(a, r, g, b) \ + ((uint32_t)(((uint32_t)(b)&0xff) | (((uint32_t)(g)&0xff) << 8) | \ + (((uint32_t)(r)&0xff) << 16) | (((uint32_t)(a)&0xff) << 24))) +#define FPDF_GetBValue(argb) ((uint8_t)(argb)) +#define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8)) +#define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16)) +#define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24)) + +// The page object constants. +#define FPDF_PAGEOBJ_TEXT 1 +#define FPDF_PAGEOBJ_PATH 2 +#define FPDF_PAGEOBJ_IMAGE 3 +#define FPDF_PAGEOBJ_SHADING 4 +#define FPDF_PAGEOBJ_FORM 5 + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Create a new PDF document. +// +// Returns a handle to a new document, or NULL on failure. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument(); + +// Create a new PDF page. +// +// document - handle to document. +// page_index - suggested index of the page to create. If it is larger than +// document's current last index(L), the created page index is +// the next available index -- L+1. +// width - the page width. +// height - the page height. +// +// Returns the handle to the new page. +// +// The page should be closed with CPDF_ClosePage() when finished as +// with any other page in the document. +DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, + int page_index, + double width, + double height); + +// Delete the page at |page_index|. +// +// document - handle to document. +// page_index - the index of the page to delete. +DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index); + +// Get the rotation of |page|. +// +// page - handle to a page +// +// Returns one of the following indicating the page rotation: +// 0 - No rotation. +// 1 - Rotated 90 degrees clockwise. +// 2 - Rotated 180 degrees clockwise. +// 3 - Rotated 270 degrees clockwise. +DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page); + +// Set rotation for |page|. +// +// page - handle to a page. +// rotate - the rotation value, one of: +// 0 - No rotation. +// 1 - Rotated 90 degrees clockwise. +// 2 - Rotated 180 degrees clockwise. +// 3 - Rotated 270 degrees clockwise. +DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate); + +// Insert |page_obj| into |page|. +// +// page - handle to a page +// page_obj - handle to a page object. The |page_obj| will be automatically +// freed. +DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, + FPDF_PAGEOBJECT page_obj); + +// Get number of page objects inside |page|. +// +// page - handle to a page. +// +// Returns the number of objects in |page|. +DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page); + +// Get object in |page| at |index|. +// +// page - handle to a page. +// index - the index of a page object. +// +// Returns the handle to the page object, or NULL on failed. +DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index); + +// Checks if |page| contains transparency. +// +// page - handle to a page. +// +// Returns TRUE if |page| contains transparency. +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page); + +// Generate the content of |page|. +// +// page - handle to a page. +// +// Returns TRUE on success. +// +// Before you save the page to a file, or reload the page, you must call +// |FPDFPage_GenerateContent| or any changes to |page| will be lost. +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page); + +// Checks if |pageObject| contains transparency. +// +// pageObject - handle to a page object. +// +// Returns TRUE if |pageObject| contains transparency. +DLLEXPORT FPDF_BOOL STDCALL +FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject); + +// Transform |pageObject| by the given matrix. +// +// page_object - handle to a page object. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and can be used to scale, rotate, shear and translate the |page_object|. +DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, + double a, + double b, + double c, + double d, + double e, + double f); + +// Transform all annotations in |page|. +// +// page - handle to a page. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and can be used to scale, rotate, shear and translate the |page| annotations. +DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, + double a, + double b, + double c, + double d, + double e, + double f); + +// Create a new image object. +// +// document - handle to a document. +// +// Returns a handle to a new image object. +DLLEXPORT FPDF_PAGEOBJECT STDCALL +FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document); + +// Load an image from a JPEG image file and then set it into |image_object|. +// +// pages - pointer to the start of all loaded pages, may be NULL. +// nCount - number of |pages|, may be 0. +// image_object - handle to an image object. +// fileAccess - file access handler which specifies the JPEG image file. +// +// Returns TRUE on success. +// +// The image object might already have an associated image, which is shared and +// cached by the loaded pages. In that case, we need to clear the cached image +// for all the loaded pages. Pass |pages| and page count (|nCount|) to this API +// to clear the image cache. If the image is not previously shared, or NULL is a +// valid |pages| value. +DLLEXPORT FPDF_BOOL STDCALL +FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, + int nCount, + FPDF_PAGEOBJECT image_object, + FPDF_FILEACCESS* fileAccess); + +// Load an image from a JPEG image file and then set it into |image_object|. +// +// pages - pointer to the start of all loaded pages, may be NULL. +// nCount - number of |pages|, may be 0. +// image_object - handle to an image object. +// fileAccess - file access handler which specifies the JPEG image file. +// +// Returns TRUE on success. +// +// The image object might already have an associated image, which is shared and +// cached by the loaded pages. In that case, we need to clear the cached image +// for all the loaded pages. Pass |pages| and page count (|nCount|) to this API +// to clear the image cache. If the image is not previously shared, or NULL is a +// valid |pages| value. This function loads the JPEG image inline, so the image +// content is copied to the file. This allows |fileAccess| and its associated +// data to be deleted after this function returns. +DLLEXPORT FPDF_BOOL STDCALL +FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages, + int nCount, + FPDF_PAGEOBJECT image_object, + FPDF_FILEACCESS* fileAccess); + +// Set the transform matrix of |image_object|. +// +// image_object - handle to an image object. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and can be used to scale, rotate, shear and translate the |page| annotations. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, + double a, + double b, + double c, + double d, + double e, + double f); + +// Set |bitmap| to |image_object|. +// +// pages - pointer to the start of all loaded pages, may be NULL. +// nCount - number of |pages|, may be 0. +// image_object - handle to an image object. +// bitmap - handle of the bitmap. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, + int nCount, + FPDF_PAGEOBJECT image_object, + FPDF_BITMAP bitmap); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_EDIT_H_ diff --git a/dependencies/pdfium/win/public/fpdf_ext.h b/dependencies/pdfium/win/public/fpdf_ext.h new file mode 100644 index 00000000..34658789 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_ext.h @@ -0,0 +1,98 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_EXT_H_ +#define PUBLIC_FPDF_EXT_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Unsupported XFA form. +#define FPDF_UNSP_DOC_XFAFORM 1 +// Unsupported portable collection. +#define FPDF_UNSP_DOC_PORTABLECOLLECTION 2 +// Unsupported attachment. +#define FPDF_UNSP_DOC_ATTACHMENT 3 +// Unsupported security. +#define FPDF_UNSP_DOC_SECURITY 4 +// Unsupported shared review. +#define FPDF_UNSP_DOC_SHAREDREVIEW 5 +// Unsupported shared form, acrobat. +#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT 6 +// Unsupported shared form, filesystem. +#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM 7 +// Unsupported shared form, email. +#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL 8 +// Unsupported 3D annotation. +#define FPDF_UNSP_ANNOT_3DANNOT 11 +// Unsupported movie annotation. +#define FPDF_UNSP_ANNOT_MOVIE 12 +// Unsupported sound annotation. +#define FPDF_UNSP_ANNOT_SOUND 13 +// Unsupported screen media annotation. +#define FPDF_UNSP_ANNOT_SCREEN_MEDIA 14 +// Unsupported screen rich media annotation. +#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA 15 +// Unsupported attachment annotation. +#define FPDF_UNSP_ANNOT_ATTACHMENT 16 +// Unsupported signature annotation. +#define FPDF_UNSP_ANNOT_SIG 17 + +// Interface for unsupported feature notifications. +typedef struct _UNSUPPORT_INFO { + // Version number of the interface. Must be 1. + int version; + + // Unsupported object notification function. + // Interface Version: 1 + // Implementation Required: Yes + // + // pThis - pointer to the interface structure. + // nType - the type of unsupported object. One of the |FPDF_UNSP_*| entries. + void (*FSDK_UnSupport_Handler)(struct _UNSUPPORT_INFO* pThis, int nType); +} UNSUPPORT_INFO; + +// Setup an unsupported object handler. +// +// unsp_info - Pointer to an UNSUPPORT_INFO structure. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL +FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); + +// Unknown page mode. +#define PAGEMODE_UNKNOWN -1 +// Document outline, and thumbnails hidden. +#define PAGEMODE_USENONE 0 +// Document outline visible. +#define PAGEMODE_USEOUTLINES 1 +// Thumbnail images visible. +#define PAGEMODE_USETHUMBS 2 +// Full-screen mode, no menu bar, window controls, or other decorations visible. +#define PAGEMODE_FULLSCREEN 3 +// Optional content group panel visible. +#define PAGEMODE_USEOC 4 +// Attachments panel visible. +#define PAGEMODE_USEATTACHMENTS 5 + +// Get the document's PageMode. +// +// doc - Handle to document. +// +// Returns one of the |PAGEMODE_*| flags defined above. +// +// The page mode defines how the document should be initially displayed. +DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_EXT_H_ diff --git a/dependencies/pdfium/win/public/fpdf_flatten.h b/dependencies/pdfium/win/public/fpdf_flatten.h new file mode 100644 index 00000000..c1e354e9 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_flatten.h @@ -0,0 +1,44 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_FLATTEN_H_ +#define PUBLIC_FPDF_FLATTEN_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +// Flatten operation failed. +#define FLATTEN_FAIL 0 +// Flatten operation succeed. +#define FLATTEN_SUCCESS 1 +// Nothing to be flattened. +#define FLATTEN_NOTHINGTODO 2 + +// Flatten for normal display. +#define FLAT_NORMALDISPLAY 0 +// Flatten for print. +#define FLAT_PRINT 1 + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Flatten annotations and form fields into the page contents. +// +// page - handle to the page. +// nFlag - One of the |FLAT_*| values denoting the page usage. +// +// Returns one of the |FLATTEN_*| values. +// +// Currently, all failures return |FLATTEN_FAIL| with no indication of the +// cause. +DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_FLATTEN_H_ diff --git a/dependencies/pdfium/win/public/fpdf_formfill.h b/dependencies/pdfium/win/public/fpdf_formfill.h new file mode 100644 index 00000000..09b80eaf --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_formfill.h @@ -0,0 +1,1764 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_FORMFILL_H_ +#define PUBLIC_FPDF_FORMFILL_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +typedef void* FPDF_FORMHANDLE; + +#ifdef PDF_ENABLE_XFA +#define DOCTYPE_PDF 0 // Normal pdf Document +#define DOCTYPE_DYNAMIC_XFA 1 // Dynamic xfa Document Type +#define DOCTYPE_STATIC_XFA 2 // Static xfa Document Type +#endif // PDF_ENABLE_XFA + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _IPDF_JsPlatform { + /** + * Version number of the interface. Currently must be 2. + **/ + int version; + + /* Version 1. */ + + /** + * Method: app_alert + * pop up a dialog to show warning or hint. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * Msg - A string containing the message to be displayed. + * Title - The title of the dialog. + * Type - The stype of button group. + * 0-OK(default); + * 1-OK,Cancel; + * 2-Yes,NO; + * 3-Yes, NO, Cancel. + * nIcon - The Icon type. + * 0-Error(default); + * 1-Warning; + * 2-Question; + * 3-Status. + * 4-Asterisk + * Return Value: + * The return value could be the folowing type: + * 1-OK; + * 2-Cancel; + * 3-NO; + * 4-Yes; + */ + int (*app_alert)(struct _IPDF_JsPlatform* pThis, + FPDF_WIDESTRING Msg, + FPDF_WIDESTRING Title, + int Type, + int Icon); + + /** + * Method: app_beep + * Causes the system to play a sound. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * nType - The sound type. + * 0 - Error + * 1 - Warning + * 2 - Question + * 3 - Status + * 4 - Default (default value) + * Return Value: + * None + */ + void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType); + + /** + * Method: app_response + * Displays a dialog box containing a question and an entry field for + * the user to reply to the question. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * Question - The question to be posed to the user. + * Title - The title of the dialog box. + * Default - A default value for the answer to the question. If + * not specified, no default value is presented. + * cLabel - A short string to appear in front of and on the + * same line as the edit text field. + * bPassword - If true, indicates that the user's response should + * show as asterisks (*) or bullets (?) to mask the response, which might be + * sensitive information. The default is false. + * response - A string buffer allocated by SDK, to receive the + * user's response. + * length - The length of the buffer, number of bytes. + * Currently, It's always be 2048. + * Return Value: + * Number of bytes the complete user input would actually require, not + * including trailing zeros, regardless of the value of the length + * parameter or the presence of the response buffer. + * Comments: + * No matter on what platform, the response buffer should be always + * written using UTF-16LE encoding. If a response buffer is + * present and the size of the user input exceeds the capacity of the + * buffer as specified by the length parameter, only the + * first "length" bytes of the user input are to be written to the + * buffer. + */ + int (*app_response)(struct _IPDF_JsPlatform* pThis, + FPDF_WIDESTRING Question, + FPDF_WIDESTRING Title, + FPDF_WIDESTRING Default, + FPDF_WIDESTRING cLabel, + FPDF_BOOL bPassword, + void* response, + int length); + + /* + * Method: Doc_getFilePath + * Get the file path of the current document. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * filePath - The string buffer to receive the file path. Can be + * NULL. + * length - The length of the buffer, number of bytes. Can be + * 0. + * Return Value: + * Number of bytes the filePath consumes, including trailing zeros. + * Comments: + * The filePath should be always input in local encoding. + * + * The return value always indicated number of bytes required for the + * buffer , even when there is no buffer specified, or the buffer size is + * less than required. In this case, the buffer will not be modified. + */ + int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis, + void* filePath, + int length); + + /* + * Method: Doc_mail + * Mails the data buffer as an attachment to all recipients, with or + * without user interaction. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * mailData - Pointer to the data buffer to be sent.Can be NULL. + * length - The size,in bytes, of the buffer pointed by + * mailData parameter.Can be 0. + * bUI - If true, the rest of the parameters are used in a + * compose-new-message window that is displayed to the user. If false, the cTo + * parameter is required and all others are optional. + * To - A semicolon-delimited list of recipients for the + * message. + * Subject - The subject of the message. The length limit is 64 + * KB. + * CC - A semicolon-delimited list of CC recipients for + * the message. + * BCC - A semicolon-delimited list of BCC recipients for + * the message. + * Msg - The content of the message. The length limit is 64 + * KB. + * Return Value: + * None. + * Comments: + * If the parameter mailData is NULL or length is 0, the current + * document will be mailed as an attachment to all recipients. + */ + void (*Doc_mail)(struct _IPDF_JsPlatform* pThis, + void* mailData, + int length, + FPDF_BOOL bUI, + FPDF_WIDESTRING To, + FPDF_WIDESTRING Subject, + FPDF_WIDESTRING CC, + FPDF_WIDESTRING BCC, + FPDF_WIDESTRING Msg); + + /* + * Method: Doc_print + * Prints all or a specific number of pages of the document. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * bUI - If true, will cause a UI to be presented to the + * user to obtain printing information and confirm the action. + * nStart - A 0-based index that defines the start of an + * inclusive range of pages. + * nEnd - A 0-based index that defines the end of an + * inclusive page range. + * bSilent - If true, suppresses the cancel dialog box while + * the document is printing. The default is false. + * bShrinkToFit - If true, the page is shrunk (if necessary) to + * fit within the imageable area of the printed page. + * bPrintAsImage - If true, print pages as an image. + * bReverse - If true, print from nEnd to nStart. + * bAnnotations - If true (the default), annotations are + * printed. + */ + void (*Doc_print)(struct _IPDF_JsPlatform* pThis, + FPDF_BOOL bUI, + int nStart, + int nEnd, + FPDF_BOOL bSilent, + FPDF_BOOL bShrinkToFit, + FPDF_BOOL bPrintAsImage, + FPDF_BOOL bReverse, + FPDF_BOOL bAnnotations); + + /* + * Method: Doc_submitForm + * Send the form data to a specified URL. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * formData - Pointer to the data buffer to be sent. + * length - The size,in bytes, of the buffer pointed by + * formData parameter. + * URL - The URL to send to. + * Return Value: + * None. + * + */ + void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis, + void* formData, + int length, + FPDF_WIDESTRING URL); + + /* + * Method: Doc_gotoPage + * Jump to a specified page. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * nPageNum - The specified page number, zero for the first + * page. + * Return Value: + * None. + * + */ + void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum); + /* + * Method: Field_browse + * Show a file selection dialog, and return the selected file path. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * filePath - Pointer to the data buffer to receive the file + * path.Can be NULL. + * length - The length of the buffer, number of bytes. Can be + * 0. + * Return Value: + * Number of bytes the filePath consumes, including trailing zeros. + * Comments: + * The filePath shoule be always input in local encoding. + */ + int (*Field_browse)(struct _IPDF_JsPlatform* pThis, + void* filePath, + int length); + + /** + * pointer to FPDF_FORMFILLINFO interface. + **/ + void* m_pFormfillinfo; + + /* Version 2. */ + + void* m_isolate; /* Unused in v3, retain for compatibility. */ + unsigned int m_v8EmbedderSlot; /* Unused in v3, retain for compatibility. */ + + /* Version 3. */ + /* Version 3 moves m_Isolate and m_v8EmbedderSlot to FPDF_LIBRARY_CONFIG. */ +} IPDF_JSPLATFORM; + +// Flags for Cursor type +#define FXCT_ARROW 0 +#define FXCT_NESW 1 +#define FXCT_NWSE 2 +#define FXCT_VBEAM 3 +#define FXCT_HBEAM 4 +#define FXCT_HAND 5 + +/** + * Function signature for the callback function passed to the FFI_SetTimer + * method. + * Parameters: + * idEvent - Identifier of the timer. + * Return value: + * None. + **/ +typedef void (*TimerCallback)(int idEvent); + +/** + * Declares of a struct type to the local system time. +**/ +typedef struct _FPDF_SYSTEMTIME { + unsigned short wYear; /* years since 1900 */ + unsigned short wMonth; /* months since January - [0,11] */ + unsigned short wDayOfWeek; /* days since Sunday - [0,6] */ + unsigned short wDay; /* day of the month - [1,31] */ + unsigned short wHour; /* hours since midnight - [0,23] */ + unsigned short wMinute; /* minutes after the hour - [0,59] */ + unsigned short wSecond; /* seconds after the minute - [0,59] */ + unsigned short wMilliseconds; /* milliseconds after the second - [0,999] */ +} FPDF_SYSTEMTIME; + +#ifdef PDF_ENABLE_XFA +// XFA +/** + * @name Pageview event flags + */ +/*@{*/ +/** @brief After a new pageview is added. */ +#define FXFA_PAGEVIEWEVENT_POSTADDED 1 +/** @brief After a pageview is removed. */ +#define FXFA_PAGEVIEWEVENT_POSTREMOVED 3 +/*@}*/ + +// menu +/** + * @name Macro Definitions for Right Context Menu Features Of XFA Fields + */ +/*@{*/ +#define FXFA_MENU_COPY 1 +#define FXFA_MENU_CUT 2 +#define FXFA_MENU_SELECTALL 4 +#define FXFA_MENU_UNDO 8 +#define FXFA_MENU_REDO 16 +#define FXFA_MENU_PASTE 32 +/*@}*/ + +// file type +/** + * @name Macro Definitions for File Type. + */ +/*@{*/ +#define FXFA_SAVEAS_XML 1 +#define FXFA_SAVEAS_XDP 2 +/*@}*/ +#endif // PDF_ENABLE_XFA + +typedef struct _FPDF_FORMFILLINFO { + /** + * Version number of the interface. Currently must be 1 (when PDFium is built + * without the XFA module) or must be 2 (when built with the XFA module). + **/ + int version; + + /* Version 1. */ + /** + *Method: Release + * Give implementation a chance to release any data after the + * interface is no longer used + *Interface Version: + * 1 + *Implementation Required: + * No + *Comments: + * Called by Foxit SDK during the final cleanup process. + *Parameters: + * pThis - Pointer to the interface structure itself + *Return Value: + * None + */ + void (*Release)(struct _FPDF_FORMFILLINFO* pThis); + + /** + * Method: FFI_Invalidate + * Invalidate the client area within the specified rectangle. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * left - Left position of the client area in PDF page + *coordinate. + * top - Top position of the client area in PDF page + *coordinate. + * right - Right position of the client area in PDF page + *coordinate. + * bottom - Bottom position of the client area in PDF page + *coordinate. + * Return Value: + * None. + * + *comments: + * All positions are measured in PDF "user space". + * Implementation should call FPDF_RenderPageBitmap() function for + *repainting a specified page area. + */ + void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_OutputSelectedRect + * When user is taking the mouse to select texts on a form field, + * this callback function will keep + * returning the selected areas to the implementation. + * + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * left - Left position of the client area in PDF page + * coordinate. + * top - Top position of the client area in PDF page + * coordinate. + * right - Right position of the client area in PDF page + * coordinate. + * bottom - Bottom position of the client area in PDF page + * coordinate. + * Return Value: + * None. + * + * comments: + * This CALLBACK function is useful for implementing special text + * selection effect. Implementation should + * first records the returned rectangles, then draw them one by one + * at the painting period, last,remove all + * the recorded rectangles when finish painting. + */ + void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_SetCursor + * Set the Cursor shape. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * nCursorType - Cursor type. see Flags for Cursor type for the + * details. + * Return value: + * None. + * */ + void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType); + + /** + * Method: FFI_SetTimer + * This method installs a system timer. An interval value is specified, + * and every time that interval elapses, the system must call into the + * callback function with the timer ID as returned by this function. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * uElapse - Specifies the time-out value, in milliseconds. + * lpTimerFunc - A pointer to the callback function-TimerCallback. + * Return value: + * The timer identifier of the new timer if the function is successful. + * An application passes this value to the FFI_KillTimer method to kill + * the timer. Nonzero if it is successful; otherwise, it is zero. + * */ + int (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis, + int uElapse, + TimerCallback lpTimerFunc); + + /** + * Method: FFI_KillTimer + * This method uninstalls a system timer identified by nIDEvent, as + * set by an earlier call to FFI_SetTimer. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * nTimerID - The timer ID returned by FFI_SetTimer function. + * Return value: + * None. + * */ + void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID); + + /** + * Method: FFI_GetLocalTime + * This method receives the current local time on the system. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * Return value: + * None. + * */ + FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis); + + /** + * Method: FFI_OnChange + * This method will be invoked to notify implementation when the + * value of any FormField on the document had been changed. + * Interface Version: + * 1 + * Implementation Required: + * no + * Parameters: + * pThis - Pointer to the interface structure itself. + * Return value: + * None. + * */ + void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis); + + /** + * Method: FFI_GetPage + * This method receives the page pointer associated with a specified + * page index. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + * function. + * nPageIndex - Index number of the page. 0 for the first page. + * Return value: + * Handle to the page. Returned by FPDF_LoadPage function. + * Comments: + * In some cases, the document-level JavaScript action may refer to a + * page which hadn't been loaded yet. + * To successfully run the javascript action, implementation need to load + * the page for SDK. + * */ + FPDF_PAGE (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + int nPageIndex); + + /** + * Method: FFI_GetCurrentPage + * This method receives the current page pointer. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + * function. + * Return value: + * Handle to the page. Returned by FPDF_LoadPage function. + * */ + FPDF_PAGE (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document); + + /** + * Method: FFI_GetRotation + * This method receives currently rotation of the page view. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage function. + * Return value: + * The page rotation. Should be 0(0 degree),1(90 degree),2(180 + * degree),3(270 degree), in a clockwise direction. + * + * Note: Unused. + * */ + int (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page); + + /** + * Method: FFI_ExecuteNamedAction + * This method will execute an named action. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * namedAction - A byte string which indicates the named action, + * terminated by 0. + * Return value: + * None. + * Comments: + * See the named actions description of <> + * for more details. + * */ + void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_BYTESTRING namedAction); + /** + * @brief This method will be called when a text field is getting or losing a + * focus. + * + * @param[in] pThis Pointer to the interface structure itself. + * @param[in] value The string value of the form field, in UTF-16LE + * format. + * @param[in] valueLen The length of the string value, number of characters + * (not bytes). + * @param[in] is_focus True if the form field is getting a focus, False for + * losing a focus. + * + * @return None. + * + * @note Currently,only support text field and combobox field. + * */ + void (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING value, + FPDF_DWORD valueLen, + FPDF_BOOL is_focus); + + /** + * Method: FFI_DoURIAction + * This action resolves to a uniform resource identifier. + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * bsURI - A byte string which indicates the uniform resource + * identifier, terminated by 0. + * Return value: + * None. + * Comments: + * See the URI actions description of <> for + * more details. + * */ + void (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_BYTESTRING bsURI); + + /** + * Method: FFI_DoGoToAction + * This action changes the view to a specified destination. + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * nPageIndex - The index of the PDF page. + * zoomMode - The zoom mode for viewing page. See below. + * fPosArray - The float array which carries the position info. + * sizeofArray - The size of float array. + * + * PDFZoom values: + * - XYZ = 1 + * - FITPAGE = 2 + * - FITHORZ = 3 + * - FITVERT = 4 + * - FITRECT = 5 + * - FITBBOX = 6 + * - FITBHORZ = 7 + * - FITBVERT = 8 + * + * Return value: + * None. + * Comments: + * See the Destinations description of <> in + *8.2.1 for more details. + **/ + void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, + int nPageIndex, + int zoomMode, + float* fPosArray, + int sizeofArray); + + /** + * pointer to IPDF_JSPLATFORM interface + **/ + IPDF_JSPLATFORM* m_pJsPlatform; + +#ifdef PDF_ENABLE_XFA + /* Version 2. */ + /** + * Method: FFI_DisplayCaret + * This method will show the caret at specified position. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * left - Left position of the client area in PDF page + *coordinate. + * top - Top position of the client area in PDF page + *coordinate. + * right - Right position of the client area in PDF page + *coordinate. + * bottom - Bottom position of the client area in PDF page + *coordinate. + * Return value: + * None. + **/ + void (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + FPDF_BOOL bVisible, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_GetCurrentPageIndex + * This method will get the current page index. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * Return value: + * The index of current page. + **/ + int (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document); + + /** + * Method: FFI_SetCurrentPage + * This method will set the current page. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * iCurPage - The index of the PDF page. + * Return value: + * None. + **/ + void (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + int iCurPage); + + /** + * Method: FFI_GotoURL + * This method will link to the specified URL. + * Interface Version: + * 2 + * Implementation Required: + * no + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * wsURL - The string value of the URL, in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + FPDF_WIDESTRING wsURL); + + /** + * Method: FFI_GetPageViewRect + * This method will get the current page view rectangle. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * left - The pointer to receive left position of the page + *view area in PDF page coordinate. + * top - The pointer to receive top position of the page + *view area in PDF page coordinate. + * right - The pointer to receive right position of the + *client area in PDF page coordinate. + * bottom - The pointer to receive bottom position of the + *client area in PDF page coordinate. + * Return value: + * None. + **/ + void (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double* left, + double* top, + double* right, + double* bottom); + + /** + * Method: FFI_PageEvent + * This method fires when pages have been added to or deleted from the XFA + * document. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page_count - The number of pages to be added to or deleted from the + * document. + * event_type - See FXFA_PAGEVIEWEVENT_* above. + * Return value: + * None. + * Comments: + * The pages to be added or deleted always start from the last page + * of document. This means that if parameter page_count is 2 and + * event type is FXFA_PAGEVIEWEVENT_POSTADDED, 2 new pages have been + * appended to the tail of document; If page_count is 2 and + * event type is FXFA_PAGEVIEWEVENT_POSTREMOVED, the last 2 pages + * have been deleted. + **/ + void (*FFI_PageEvent)(struct _FPDF_FORMFILLINFO* pThis, + int page_count, + FPDF_DWORD event_type); + + /** + * Method: FFI_PopupMenu + * This method will track the right context menu for XFA fields. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * hWidget - Handle to XFA fields. + * menuFlag - The menu flags. Please refer to macro definition + *of FXFA_MENU_XXX and this can be one or a combination of these macros. + * x - X position of the client area in PDF page + *coordinate. + * y - Y position of the client area in PDF page + *coordinate. + * Return value: + * TRUE indicates success; otherwise false. + **/ + FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + FPDF_WIDGET hWidget, + int menuFlag, + float x, + float y); + + /** + * Method: FFI_OpenFile + * This method will open the specified file with the specified mode. + * Interface Version + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * fileFlag - The file flag.Please refer to macro definition of + *FXFA_SAVEAS_XXX and this can be one of these macros. + * wsURL - The string value of the file URL, in UTF-16LE + *format. + * mode - The mode for open file. + * Return value: + * The handle to FPDF_FILEHANDLER. + **/ + FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis, + int fileFlag, + FPDF_WIDESTRING wsURL, + const char* mode); + + /** + * Method: FFI_EmailTo + * This method will email the specified file stream to the specified + *contacter. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * pFileHandler - Handle to the FPDF_FILEHANDLER. + * pTo - A semicolon-delimited list of recipients for the + *message,in UTF-16LE format. + * pSubject - The subject of the message,in UTF-16LE format. + * pCC - A semicolon-delimited list of CC recipients for + *the message,in UTF-16LE format. + * pBcc - A semicolon-delimited list of BCC recipients for + *the message,in UTF-16LE format. + * pMsg - Pointer to the data buffer to be sent.Can be + *NULL,in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_EmailTo)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_FILEHANDLER* fileHandler, + FPDF_WIDESTRING pTo, + FPDF_WIDESTRING pSubject, + FPDF_WIDESTRING pCC, + FPDF_WIDESTRING pBcc, + FPDF_WIDESTRING pMsg); + + /** + * Method: FFI_UploadTo + * This method will get upload the specified file stream to the + *specified URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * pFileHandler - Handle to the FPDF_FILEHANDLER. + * fileFlag - The file flag.Please refer to macro definition of + *FXFA_SAVEAS_XXX and this can be one of these macros. + * uploadTo - Pointer to the URL path, in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_FILEHANDLER* fileHandler, + int fileFlag, + FPDF_WIDESTRING uploadTo); + + /** + * Method: FFI_GetPlatform + * This method will get the current platform. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * platform - Pointer to the data buffer to receive the + *platform.Can be NULL,in UTF-16LE format. + * length - The length of the buffer, number of bytes. Can be + *0. + * Return value: + * The length of the buffer, number of bytes. + **/ + int (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis, + void* platform, + int length); + + /** + * Method: FFI_GetLanguage + * This method will get the current language. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * language - Pointer to the data buffer to receive the current + *language.Can be NULL. + * length - The length of the buffer, number of bytes. Can be + *0. + * Return value: + * The length of the buffer, number of bytes. + **/ + int (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis, + void* language, + int length); + + /** + * Method: FFI_DownloadFromURL + * This method will download the specified file from the URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * URL - The string value of the file URL, in UTF-16LE + *format. + * Return value: + * The handle to FPDF_FILEHANDLER. + **/ + FPDF_LPFILEHANDLER (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING URL); + /** + * Method: FFI_PostRequestURL + * This method will post the request to the server URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * wsURL - The string value of the server URL, in UTF-16LE + *format. + * wsData - The post data,in UTF-16LE format. + * wsContentType - The content type of the request data,in UTF-16LE + *format. + * wsEncode - The encode type,in UTF-16LE format. + * wsHeader - The request header,in UTF-16LE format. + * response - Pointer to the FPDF_BSTR to receive the response + *data from server,,in UTF-16LE format. + * Return value: + * TRUE indicates success, otherwise FALSE. + **/ + FPDF_BOOL (*FFI_PostRequestURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING wsURL, + FPDF_WIDESTRING wsData, + FPDF_WIDESTRING wsContentType, + FPDF_WIDESTRING wsEncode, + FPDF_WIDESTRING wsHeader, + FPDF_BSTR* respone); + + /** + * Method: FFI_PutRequestURL + * This method will put the request to the server URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * wsURL - The string value of the server URL, in UTF-16LE + *format. + * wsData - The put data, in UTF-16LE format. + * wsEncode - The encode type, in UTR-16LE format. + * Return value: + * TRUE indicates success, otherwise FALSE. + **/ + FPDF_BOOL (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING wsURL, + FPDF_WIDESTRING wsData, + FPDF_WIDESTRING wsEncode); +#endif // PDF_ENABLE_XFA +} FPDF_FORMFILLINFO; + +/** + * Function: FPDFDOC_InitFormFillEnvironment + * Init form fill environment. + * Comments: + * This function should be called before any form fill operation. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * pFormFillInfo - Pointer to a FPDF_FORMFILLINFO structure. + * Return Value: + * Return handler to the form fill module. NULL means fails. + **/ +DLLEXPORT FPDF_FORMHANDLE STDCALL +FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, + FPDF_FORMFILLINFO* formInfo); + +/** + * Function: FPDFDOC_ExitFormFillEnvironment + * Exit form fill environment. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NULL. + **/ +DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle); + +/** + * Function: FORM_OnAfterLoadPage + * This method is required for implementing all the form related + *functions. Should be invoked after user + * successfully loaded a PDF page, and method + *FPDFDOC_InitFormFillEnvironment had been invoked. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle); + +/** + * Function: FORM_OnBeforeClosePage + * This method is required for implementing all the form related + *functions. Should be invoked before user + * close the PDF page. + * Parameters: + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle); + +/** +* Function: FORM_DoDocumentJSAction +* This method is required for performing Document-level JavaScript +*action. It should be invoked after the PDF document +* had been loaded. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* Return Value: +* NONE +* Comments: +* If there is Document-level JavaScript action embedded in the +*document, this method will execute the javascript action; +* otherwise, the method will do nothing. +**/ +DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle); + +/** +* Function: FORM_DoDocumentOpenAction +* This method is required for performing open-action when the document +*is opened. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* Return Value: +* NONE +* Comments: +* This method will do nothing if there is no open-actions embedded in +*the document. +**/ +DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle); + +// additional actions type of document. +#define FPDFDOC_AACTION_WC \ + 0x10 // WC, before closing document, JavaScript action. +#define FPDFDOC_AACTION_WS \ + 0x11 // WS, before saving document, JavaScript action. +#define FPDFDOC_AACTION_DS 0x12 // DS, after saving document, JavaScript + // action. +#define FPDFDOC_AACTION_WP \ + 0x13 // WP, before printing document, JavaScript action. +#define FPDFDOC_AACTION_DP \ + 0x14 // DP, after printing document, JavaScript action. + +/** +* Function: FORM_DoDocumentAAction +* This method is required for performing the document's +*additional-action. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* aaType - The type of the additional-actions which defined +*above. +* Return Value: +* NONE +* Comments: +* This method will do nothing if there is no document +*additional-action corresponding to the specified aaType. +**/ + +DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, + int aaType); + +// Additional-action types of page object +#define FPDFPAGE_AACTION_OPEN \ + 0 // /O -- An action to be performed when the page is opened +#define FPDFPAGE_AACTION_CLOSE \ + 1 // /C -- An action to be performed when the page is closed + +/** +* Function: FORM_DoPageAAction +* This method is required for performing the page object's +*additional-action when opened or closed. +* Parameters: +* page - Handle to the page. Returned by FPDF_LoadPage +*function. +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* aaType - The type of the page object's additional-actions +*which defined above. +* Return Value: +* NONE +* Comments: +* This method will do nothing if no additional-action corresponding to +*the specified aaType exists. +**/ +DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle, + int aaType); + +/** + * Function: FORM_OnMouseMove + * You can call this member function when the mouse cursor moves. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in PDF user + *space. + * page_y - Specifies the y-coordinate of the cursor in PDF user + *space. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +/** + * Function: FORM_OnLButtonDown + * You can call this member function when the user presses the left + *mouse button. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in PDF user + *space. + * page_y - Specifies the y-coordinate of the cursor in PDF user + *space. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +/** + * Function: FORM_OnLButtonUp + * You can call this member function when the user releases the left + *mouse button. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in device. + * page_y - Specifies the y-coordinate of the cursor in device. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +#ifdef PDF_ENABLE_XFA +DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); +DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); +#endif // PDF_ENABLE_XFA + +/** + * Function: FORM_OnKeyDown + * You can call this member function when a nonsystem key is pressed. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nKeyCode - Indicates whether various virtual keys are down. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nKeyCode, + int modifier); + +/** + * Function: FORM_OnKeyUp + * You can call this member function when a nonsystem key is released. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nKeyCode - The virtual-key code of the given key. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nKeyCode, + int modifier); + +/** + * Function: FORM_OnChar + * You can call this member function when a keystroke translates to a + *nonsystem character. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nChar - The character code value of the key. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nChar, + int modifier); + +/** + * Function: FORM_ForceToKillFocus. + * You can call this member function to force to kill the focus of the + *form field which got focus. + * It would kill the focus on the form field, save the value of form + *field if it's changed by user. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle); + +// Field Types +#define FPDF_FORMFIELD_UNKNOWN 0 // Unknown. +#define FPDF_FORMFIELD_PUSHBUTTON 1 // push button type. +#define FPDF_FORMFIELD_CHECKBOX 2 // check box type. +#define FPDF_FORMFIELD_RADIOBUTTON 3 // radio button type. +#define FPDF_FORMFIELD_COMBOBOX 4 // combo box type. +#define FPDF_FORMFIELD_LISTBOX 5 // list box type. +#define FPDF_FORMFIELD_TEXTFIELD 6 // text field type. +#ifdef PDF_ENABLE_XFA +#define FPDF_FORMFIELD_XFA 7 // text field type. +#endif // PDF_ENABLE_XFA + +/** + * Function: FPDFPage_HasFormFieldAtPoint + * Get the form field type by point. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment(). + * page - Handle to the page. Returned by FPDF_LoadPage(). + * page_x - X position in PDF "user space". + * page_y - Y position in PDF "user space". + * Return Value: + * Return the type of the form field; -1 indicates no field. + * See field types above. + **/ +DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDPage_HasFormFieldAtPoint + * DEPRECATED. Please use FPDFPage_HasFormFieldAtPoint. + **/ +DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDFPage_FormFieldZOrderAtPoint + * Get the form field z-order by point. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment(). + * page - Handle to the page. Returned by FPDF_LoadPage(). + * page_x - X position in PDF "user space". + * page_y - Y position in PDF "user space". + * Return Value: + * Return the z-order of the form field; -1 indicates no field. + * Higher numbers are closer to the front. + **/ +DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDF_SetFormFieldHighlightColor + * Set the highlight color of specified or all the form fields in the + *document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * doc - Handle to the document. Returned by + *FPDF_LoadDocument function. + * fieldType - A 32-bit integer indicating the type of a form + *field(defined above). + * color - The highlight color of the form field.Constructed by + *0xxxrrggbb. + * Return Value: + * NONE. + * Comments: + * When the parameter fieldType is set to zero, the highlight color + *will be applied to all the form fields in the + * document. + * Please refresh the client window to show the highlight immediately + *if necessary. + **/ +DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, + int fieldType, + unsigned long color); + +/** + * Function: FPDF_SetFormFieldHighlightAlpha + * Set the transparency of the form field highlight color in the + *document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * doc - Handle to the document. Returned by + *FPDF_LoadDocument function. + * alpha - The transparency of the form field highlight color. + *between 0-255. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, + unsigned char alpha); + +/** + * Function: FPDF_RemoveFormFieldHighlight + * Remove the form field highlight color in the document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + * Comments: + * Please refresh the client window to remove the highlight immediately + *if necessary. + **/ +DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); + +/** +* Function: FPDF_FFLDraw +* Render FormFields and popup window on a page to a device independent +*bitmap. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* bitmap - Handle to the device independent bitmap (as the +*output buffer). +* Bitmap handle can be created by FPDFBitmap_Create +*function. +* page - Handle to the page. Returned by FPDF_LoadPage +*function. +* start_x - Left pixel position of the display area in the +*device coordinate. +* start_y - Top pixel position of the display area in the device +*coordinate. +* size_x - Horizontal size (in pixels) for displaying the page. +* size_y - Vertical size (in pixels) for displaying the page. +* rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees +*clockwise), +* 2 (rotated 180 degrees), 3 (rotated 90 degrees +*counter-clockwise). +* flags - 0 for normal display, or combination of flags +*defined above. +* Return Value: +* None. +* Comments: +* This function is designed to render annotations that are +*user-interactive, which are widget annotation (for FormFields) and popup +*annotation. +* With FPDF_ANNOT flag, this function will render popup annotation +*when users mouse-hover on non-widget annotation. Regardless of FPDF_ANNOT flag, +*this function will always render widget annotations for FormFields. +* In order to implement the FormFill functions, implementation should +*call this function after rendering functions, such as FPDF_RenderPageBitmap or +*FPDF_RenderPageBitmap_Start, finish rendering the page contents. +**/ +DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, + FPDF_BITMAP bitmap, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); + +#ifdef _SKIA_SUPPORT_ +DLLEXPORT void STDCALL FPDF_FFLRecord(FPDF_FORMHANDLE hHandle, + FPDF_RECORDER recorder, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); +#endif + +#ifdef PDF_ENABLE_XFA +/** + * Function: FPDF_HasXFAField + * This method is designed to check whether a pdf document + *has XFA fields. + * Parameters: + * document - Handle to document. + *Returned by FPDF_LoadDocument function. + * docType - Document type defined as + *DOCTYPE_xxx. + * Return Value: + * TRUE indicates that the input document has XFA fields, + *otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, + int* docType); + +/** + * Function: FPDF_LoadXFA + * If the document consists of XFA fields, there should call this + *method to load XFA fields. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * Return Value: + * TRUE indicates success,otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document); + +/** + * Function: FPDF_Widget_Undo + * This method will implement the undo feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_Redo + * This method will implement the redo feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_SelectAll + * This method will implement the select all feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_Copy + * This method will implement the copy feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - Pointer to data buffer to receive the copied + *data, in UTF-16LE format. + * size - The data buffer size. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD* size); +/** + * Function: FPDF_Widget_Cut + * This method will implement the cut feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - Pointer to data buffer to receive the cut + *data,in UTF-16LE format. + * size - The data buffer size,not the byte number. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD* size); +/** + * Function: FPDF_Widget_Paste + * This method will implement the paste feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - The paste text buffer, in UTF-16LE format. + * size - The data buffer size,not the byte number. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD size); +/** + * Function: FPDF_Widget_ReplaceSpellCheckWord + * This method will implement the spell check feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * x - The x value of the specified point. + * y - The y value of the specified point. + * bsText - The text buffer needed to be speck check, in + *UTF-16LE format. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL +FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + float x, + float y, + FPDF_BYTESTRING bsText); +/** + * Function: FPDF_Widget_GetSpellCheckWords + * This method will implement the spell check feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * x - The x value of the specified point. + * y - The y value of the specified point. + * stringHandle - Pointer to FPDF_STRINGHANDLE to receive the + *speck check text buffer, in UTF-16LE format. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL +FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + float x, + float y, + FPDF_STRINGHANDLE* stringHandle); +/** + * Function: FPDF_StringHandleCounts + * This method will get the count of the text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * Return Value: + * None. + **/ +DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE stringHandle); +/** + * Function: FPDF_StringHandleGetStringByIndex + * This method will get the specified index of the text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * index - The specified index of text buffer. + * bsText - Pointer to data buffer to receive the text + *buffer, in UTF-16LE format. + * size - The byte size of data buffer. + * Return Value: + * TRUE indicates success, otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL +FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE stringHandle, + int index, + FPDF_BYTESTRING bsText, + FPDF_DWORD* size); +/** + * Function: FPDF_StringHandleRelease + * This method will release the FPDF_STRINGHANDLE. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle); +/** + * Function: FPDF_StringHandleAddString + * This method will add the specified text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * bsText - Pointer to data buffer of the text buffer, in + *UTF-16LE format. + * size - The byte size of data buffer. + * Return Value: + * TRUE indicates success, otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL +FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, + FPDF_BYTESTRING bsText, + FPDF_DWORD size); +#endif // PDF_ENABLE_XFA + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_FORMFILL_H_ diff --git a/dependencies/pdfium/win/public/fpdf_fwlevent.h b/dependencies/pdfium/win/public/fpdf_fwlevent.h new file mode 100644 index 00000000..591484a5 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_fwlevent.h @@ -0,0 +1,284 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_FWLEVENT_H_ +#define PUBLIC_FPDF_FWLEVENT_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +typedef int FPDF_INT32; +typedef unsigned int FPDF_UINT32; +typedef float FPDF_FLOAT; + +// Event types. +typedef enum { + FWL_EVENTTYPE_Mouse = 0, + FWL_EVENTTYPE_MouseWheel, + FWL_EVENTTYPE_Key, +} FWL_EVENTTYPE; + +// Key flags. +typedef enum { + FWL_EVENTFLAG_ShiftKey = 1 << 0, + FWL_EVENTFLAG_ControlKey = 1 << 1, + FWL_EVENTFLAG_AltKey = 1 << 2, + FWL_EVENTFLAG_MetaKey = 1 << 3, + FWL_EVENTFLAG_KeyPad = 1 << 4, + FWL_EVENTFLAG_AutoRepeat = 1 << 5, + FWL_EVENTFLAG_LeftButtonDown = 1 << 6, + FWL_EVENTFLAG_MiddleButtonDown = 1 << 7, + FWL_EVENTFLAG_RightButtonDown = 1 << 8, +} FWL_EVENTFLAG; + +// Mouse messages. +typedef enum { + FWL_EVENTMOUSECMD_LButtonDown = 1, + FWL_EVENTMOUSECMD_LButtonUp, + FWL_EVENTMOUSECMD_LButtonDblClk, + FWL_EVENTMOUSECMD_RButtonDown, + FWL_EVENTMOUSECMD_RButtonUp, + FWL_EVENTMOUSECMD_RButtonDblClk, + FWL_EVENTMOUSECMD_MButtonDown, + FWL_EVENTMOUSECMD_MButtonUp, + FWL_EVENTMOUSECMD_MButtonDblClk, + FWL_EVENTMOUSECMD_MouseMove, + FWL_EVENTMOUSECMD_MouseEnter, + FWL_EVENTMOUSECMD_MouseHover, + FWL_EVENTMOUSECMD_MouseLeave, +} FWL_EVENT_MOUSECMD; + +// Mouse events. +struct FWL_EVENT_MOUSE { + FPDF_UINT32 command; + FPDF_DWORD flag; + FPDF_FLOAT x; + FPDF_FLOAT y; +}; + +// Mouse wheel events. +struct FWL_EVENT_MOUSEWHEEL { + FPDF_DWORD flag; + FPDF_FLOAT x; + FPDF_FLOAT y; + FPDF_FLOAT deltaX; + FPDF_FLOAT deltaY; +}; + +// Virtual keycodes. +typedef enum { + FWL_VKEY_Back = 0x08, + FWL_VKEY_Tab = 0x09, + FWL_VKEY_NewLine = 0x0A, + FWL_VKEY_Clear = 0x0C, + FWL_VKEY_Return = 0x0D, + FWL_VKEY_Shift = 0x10, + FWL_VKEY_Control = 0x11, + FWL_VKEY_Menu = 0x12, + FWL_VKEY_Pause = 0x13, + FWL_VKEY_Capital = 0x14, + FWL_VKEY_Kana = 0x15, + FWL_VKEY_Hangul = 0x15, + FWL_VKEY_Junja = 0x17, + FWL_VKEY_Final = 0x18, + FWL_VKEY_Hanja = 0x19, + FWL_VKEY_Kanji = 0x19, + FWL_VKEY_Escape = 0x1B, + FWL_VKEY_Convert = 0x1C, + FWL_VKEY_NonConvert = 0x1D, + FWL_VKEY_Accept = 0x1E, + FWL_VKEY_ModeChange = 0x1F, + FWL_VKEY_Space = 0x20, + FWL_VKEY_Prior = 0x21, + FWL_VKEY_Next = 0x22, + FWL_VKEY_End = 0x23, + FWL_VKEY_Home = 0x24, + FWL_VKEY_Left = 0x25, + FWL_VKEY_Up = 0x26, + FWL_VKEY_Right = 0x27, + FWL_VKEY_Down = 0x28, + FWL_VKEY_Select = 0x29, + FWL_VKEY_Print = 0x2A, + FWL_VKEY_Execute = 0x2B, + FWL_VKEY_Snapshot = 0x2C, + FWL_VKEY_Insert = 0x2D, + FWL_VKEY_Delete = 0x2E, + FWL_VKEY_Help = 0x2F, + FWL_VKEY_0 = 0x30, + FWL_VKEY_1 = 0x31, + FWL_VKEY_2 = 0x32, + FWL_VKEY_3 = 0x33, + FWL_VKEY_4 = 0x34, + FWL_VKEY_5 = 0x35, + FWL_VKEY_6 = 0x36, + FWL_VKEY_7 = 0x37, + FWL_VKEY_8 = 0x38, + FWL_VKEY_9 = 0x39, + FWL_VKEY_A = 0x41, + FWL_VKEY_B = 0x42, + FWL_VKEY_C = 0x43, + FWL_VKEY_D = 0x44, + FWL_VKEY_E = 0x45, + FWL_VKEY_F = 0x46, + FWL_VKEY_G = 0x47, + FWL_VKEY_H = 0x48, + FWL_VKEY_I = 0x49, + FWL_VKEY_J = 0x4A, + FWL_VKEY_K = 0x4B, + FWL_VKEY_L = 0x4C, + FWL_VKEY_M = 0x4D, + FWL_VKEY_N = 0x4E, + FWL_VKEY_O = 0x4F, + FWL_VKEY_P = 0x50, + FWL_VKEY_Q = 0x51, + FWL_VKEY_R = 0x52, + FWL_VKEY_S = 0x53, + FWL_VKEY_T = 0x54, + FWL_VKEY_U = 0x55, + FWL_VKEY_V = 0x56, + FWL_VKEY_W = 0x57, + FWL_VKEY_X = 0x58, + FWL_VKEY_Y = 0x59, + FWL_VKEY_Z = 0x5A, + FWL_VKEY_LWin = 0x5B, + FWL_VKEY_Command = 0x5B, + FWL_VKEY_RWin = 0x5C, + FWL_VKEY_Apps = 0x5D, + FWL_VKEY_Sleep = 0x5F, + FWL_VKEY_NumPad0 = 0x60, + FWL_VKEY_NumPad1 = 0x61, + FWL_VKEY_NumPad2 = 0x62, + FWL_VKEY_NumPad3 = 0x63, + FWL_VKEY_NumPad4 = 0x64, + FWL_VKEY_NumPad5 = 0x65, + FWL_VKEY_NumPad6 = 0x66, + FWL_VKEY_NumPad7 = 0x67, + FWL_VKEY_NumPad8 = 0x68, + FWL_VKEY_NumPad9 = 0x69, + FWL_VKEY_Multiply = 0x6A, + FWL_VKEY_Add = 0x6B, + FWL_VKEY_Separator = 0x6C, + FWL_VKEY_Subtract = 0x6D, + FWL_VKEY_Decimal = 0x6E, + FWL_VKEY_Divide = 0x6F, + FWL_VKEY_F1 = 0x70, + FWL_VKEY_F2 = 0x71, + FWL_VKEY_F3 = 0x72, + FWL_VKEY_F4 = 0x73, + FWL_VKEY_F5 = 0x74, + FWL_VKEY_F6 = 0x75, + FWL_VKEY_F7 = 0x76, + FWL_VKEY_F8 = 0x77, + FWL_VKEY_F9 = 0x78, + FWL_VKEY_F10 = 0x79, + FWL_VKEY_F11 = 0x7A, + FWL_VKEY_F12 = 0x7B, + FWL_VKEY_F13 = 0x7C, + FWL_VKEY_F14 = 0x7D, + FWL_VKEY_F15 = 0x7E, + FWL_VKEY_F16 = 0x7F, + FWL_VKEY_F17 = 0x80, + FWL_VKEY_F18 = 0x81, + FWL_VKEY_F19 = 0x82, + FWL_VKEY_F20 = 0x83, + FWL_VKEY_F21 = 0x84, + FWL_VKEY_F22 = 0x85, + FWL_VKEY_F23 = 0x86, + FWL_VKEY_F24 = 0x87, + FWL_VKEY_NunLock = 0x90, + FWL_VKEY_Scroll = 0x91, + FWL_VKEY_LShift = 0xA0, + FWL_VKEY_RShift = 0xA1, + FWL_VKEY_LControl = 0xA2, + FWL_VKEY_RControl = 0xA3, + FWL_VKEY_LMenu = 0xA4, + FWL_VKEY_RMenu = 0xA5, + FWL_VKEY_BROWSER_Back = 0xA6, + FWL_VKEY_BROWSER_Forward = 0xA7, + FWL_VKEY_BROWSER_Refresh = 0xA8, + FWL_VKEY_BROWSER_Stop = 0xA9, + FWL_VKEY_BROWSER_Search = 0xAA, + FWL_VKEY_BROWSER_Favorites = 0xAB, + FWL_VKEY_BROWSER_Home = 0xAC, + FWL_VKEY_VOLUME_Mute = 0xAD, + FWL_VKEY_VOLUME_Down = 0xAE, + FWL_VKEY_VOLUME_Up = 0xAF, + FWL_VKEY_MEDIA_NEXT_Track = 0xB0, + FWL_VKEY_MEDIA_PREV_Track = 0xB1, + FWL_VKEY_MEDIA_Stop = 0xB2, + FWL_VKEY_MEDIA_PLAY_Pause = 0xB3, + FWL_VKEY_MEDIA_LAUNCH_Mail = 0xB4, + FWL_VKEY_MEDIA_LAUNCH_MEDIA_Select = 0xB5, + FWL_VKEY_MEDIA_LAUNCH_APP1 = 0xB6, + FWL_VKEY_MEDIA_LAUNCH_APP2 = 0xB7, + FWL_VKEY_OEM_1 = 0xBA, + FWL_VKEY_OEM_Plus = 0xBB, + FWL_VKEY_OEM_Comma = 0xBC, + FWL_VKEY_OEM_Minus = 0xBD, + FWL_VKEY_OEM_Period = 0xBE, + FWL_VKEY_OEM_2 = 0xBF, + FWL_VKEY_OEM_3 = 0xC0, + FWL_VKEY_OEM_4 = 0xDB, + FWL_VKEY_OEM_5 = 0xDC, + FWL_VKEY_OEM_6 = 0xDD, + FWL_VKEY_OEM_7 = 0xDE, + FWL_VKEY_OEM_8 = 0xDF, + FWL_VKEY_OEM_102 = 0xE2, + FWL_VKEY_ProcessKey = 0xE5, + FWL_VKEY_Packet = 0xE7, + FWL_VKEY_Attn = 0xF6, + FWL_VKEY_Crsel = 0xF7, + FWL_VKEY_Exsel = 0xF8, + FWL_VKEY_Ereof = 0xF9, + FWL_VKEY_Play = 0xFA, + FWL_VKEY_Zoom = 0xFB, + FWL_VKEY_NoName = 0xFC, + FWL_VKEY_PA1 = 0xFD, + FWL_VKEY_OEM_Clear = 0xFE, + FWL_VKEY_Unknown = 0, +} FWL_VKEYCODE; + +// Key event commands. +typedef enum { + FWL_EVENTKEYCMD_KeyDown = 1, + FWL_EVENTKEYCMD_KeyUp, + FWL_EVENTKEYCMD_Char, +} FWL_EVENTKEYCMD; + +// Key events. +struct FWL_EVENT_KEY { + FPDF_UINT32 command; + FPDF_DWORD flag; + union { + // Virtual key code. + FPDF_UINT32 vkcode; + // Character code. + FPDF_DWORD charcode; + } code; +}; + +// Event types. +struct FWL_EVENT { + // Structure size. + FPDF_UINT32 size; + // FWL_EVENTTYPE. + FPDF_UINT32 type; + union { + struct FWL_EVENT_MOUSE mouse; + struct FWL_EVENT_MOUSEWHEEL wheel; + struct FWL_EVENT_KEY key; + } s; +}; + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_FWLEVENT_H_ diff --git a/dependencies/pdfium/win/public/fpdf_ppo.h b/dependencies/pdfium/win/public/fpdf_ppo.h new file mode 100644 index 00000000..d9c83002 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_ppo.h @@ -0,0 +1,44 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_PPO_H_ +#define PUBLIC_FPDF_PPO_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Import pages to a FPDF_DOCUMENT. +// +// dest_doc - The destination document for the pages. +// src_doc - The document to be imported. +// pagerange - A page range string, Such as "1,3,5-7". If |pagerange| is NULL, +// all pages from |src_doc| are imported. +// index - The page index to insert at. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc, + FPDF_DOCUMENT src_doc, + FPDF_BYTESTRING pagerange, + int index); + +// Copy the viewer preferences from |src_doc| into |dest_doc|. +// +// dest_doc - Document to write the viewer preferences into. +// src_doc - Document to read the viewer preferences from. +// +// Returns TRUE on success. +DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, + FPDF_DOCUMENT src_doc); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_PPO_H_ diff --git a/dependencies/pdfium/win/public/fpdf_progressive.h b/dependencies/pdfium/win/public/fpdf_progressive.h new file mode 100644 index 00000000..0c3d5013 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_progressive.h @@ -0,0 +1,120 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_PROGRESSIVE_H_ +#define PUBLIC_FPDF_PROGRESSIVE_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +// Flags for progressive process status. +#define FPDF_RENDER_READER 0 +#define FPDF_RENDER_TOBECOUNTINUED 1 +#define FPDF_RENDER_DONE 2 +#define FPDF_RENDER_FAILED 3 + +#ifdef __cplusplus +extern "C" { +#endif + +// IFPDF_RENDERINFO interface. +typedef struct _IFSDK_PAUSE { + /** + * Version number of the interface. Currently must be 1. + **/ + int version; + + /* + * Method: NeedToPauseNow + * Check if we need to pause a progressive process now. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * Return Value: + * Non-zero for pause now, 0 for continue. + * + */ + FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis); + + // A user defined data pointer, used by user's application. Can be NULL. + void* user; +} IFSDK_PAUSE; + +// Function: FPDF_RenderPageBitmap_Start +// Start to render page contents to a device independent bitmap +// progressively. +// Parameters: +// bitmap - Handle to the device independent bitmap (as the +// output buffer). +// Bitmap handle can be created by FPDFBitmap_Create +// function. +// page - Handle to the page. Returned by FPDF_LoadPage +// function. +// start_x - Left pixel position of the display area in the +// bitmap coordinate. +// start_y - Top pixel position of the display area in the bitmap +// coordinate. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees +// clockwise), +// 2 (rotated 180 degrees), 3 (rotated 90 degrees +// counter-clockwise). +// flags - 0 for normal display, or combination of flags +// defined in fpdfview.h. With FPDF_ANNOT flag, it +// renders all annotations that does not require +// user-interaction, which are all annotations except +// widget and popup annotations. +// pause - The IFSDK_PAUSE interface.A callback mechanism +// allowing the page rendering process +// Return value: +// Rendering Status. See flags for progressive process status for the +// details. +// +DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags, + IFSDK_PAUSE* pause); + +// Function: FPDF_RenderPage_Continue +// Continue rendering a PDF page. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage +// function. +// pause - The IFSDK_PAUSE interface.A callback mechanism +// allowing the page rendering process +// to be paused before it's finished. This can be NULL +// if you don't want to pause. +// Return value: +// The rendering status. See flags for progressive process status for +// the details. +DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, + IFSDK_PAUSE* pause); + +// Function: FPDF_RenderPage_Close +// Release the resource allocate during page rendering. Need to be +// called after finishing rendering or +// cancel the rendering. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage +// function. +// Return value: +// NULL +DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_PROGRESSIVE_H_ diff --git a/dependencies/pdfium/win/public/fpdf_save.h b/dependencies/pdfium/win/public/fpdf_save.h new file mode 100644 index 00000000..c34e2bc6 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_save.h @@ -0,0 +1,87 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_SAVE_H_ +#define PUBLIC_FPDF_SAVE_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Structure for custom file write +typedef struct FPDF_FILEWRITE_ { + // + // Version number of the interface. Currently must be 1. + // + int version; + + // + // Method: WriteBlock + // Output a block of data in your custom way. + // Interface Version: + // 1 + // Implementation Required: + // Yes + // Comments: + // Called by function FPDF_SaveDocument + // Parameters: + // pThis - Pointer to the structure itself + // pData - Pointer to a buffer to output + // size - The size of the buffer. + // Return value: + // Should be non-zero if successful, zero for error. + // + int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis, + const void* pData, + unsigned long size); +} FPDF_FILEWRITE; + +/** @brief Incremental. */ +#define FPDF_INCREMENTAL 1 +/** @brief No Incremental. */ +#define FPDF_NO_INCREMENTAL 2 +/** @brief Remove security. */ +#define FPDF_REMOVE_SECURITY 3 + +// Function: FPDF_SaveAsCopy +// Saves the copy of specified document in custom way. +// Parameters: +// document - Handle to document. Returned by +// FPDF_LoadDocument and FPDF_CreateNewDocument. +// pFileWrite - A pointer to a custom file write structure. +// flags - The creating flags. +// Return value: +// TRUE for succeed, FALSE for failed. +// +DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, + FPDF_FILEWRITE* pFileWrite, + FPDF_DWORD flags); + +// Function: FPDF_SaveWithVersion +// Same as function ::FPDF_SaveAsCopy, except the file version of the +// saved document could be specified by user. +// Parameters: +// document - Handle to document. +// pFileWrite - A pointer to a custom file write structure. +// flags - The creating flags. +// fileVersion - The PDF file version. File version: 14 for 1.4, +// 15 for 1.5, ... +// Return value: +// TRUE if succeed, FALSE if failed. +// +DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, + FPDF_FILEWRITE* pFileWrite, + FPDF_DWORD flags, + int fileVersion); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_SAVE_H_ diff --git a/dependencies/pdfium/win/public/fpdf_searchex.h b/dependencies/pdfium/win/public/fpdf_searchex.h new file mode 100644 index 00000000..7c1b3184 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_searchex.h @@ -0,0 +1,30 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_SEARCHEX_H_ +#define PUBLIC_FPDF_SEARCHEX_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Get the character index in |text_page| internal character list. +// +// text_page - a text page information structure. +// nTextIndex - index of the text returned from |FPDFText_GetText|. +// +// Returns the index of the character in internal character list. -1 for error. +DLLEXPORT int STDCALL +FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // PUBLIC_FPDF_SEARCHEX_H_ diff --git a/dependencies/pdfium/win/public/fpdf_structtree.h b/dependencies/pdfium/win/public/fpdf_structtree.h new file mode 100644 index 00000000..3d4da402 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_structtree.h @@ -0,0 +1,103 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_STRUCTTREE_H_ +#define PUBLIC_FPDF_STRUCTTREE_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Function: FPDF_StructTree_GetForPage +// Get the structure tree for a page. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage +// function. +// Return value: +// A handle to the structure tree or NULL on error. +DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page); + +// Function: FPDF_StructTree_Close +// Release the resource allocate by FPDF_StructTree_GetForPage. +// Parameters: +// struct_tree - Handle to the struct tree. Returned by +// FPDF_StructTree_LoadPage function. +// Return value: +// NULL +DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree); + +// Function: FPDF_StructTree_CountChildren +// Count the number of children for the structure tree. +// Parameters: +// struct_tree - Handle to the struct tree. Returned by +// FPDF_StructTree_LoadPage function. +// Return value: +// The number of children, or -1 on error. +DLLEXPORT int STDCALL +FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree); + +// Function: FPDF_StructTree_GetChildAtIndex +// Get a child in the structure tree. +// Parameters: +// struct_tree - Handle to the struct tree. Returned by +// FPDF_StructTree_LoadPage function. +// index - The index for the child, 0-based. +// Return value: +// The child at the n-th index or NULL on error. +DLLEXPORT FPDF_STRUCTELEMENT STDCALL +FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index); + +// Function: FPDF_StructElement_GetAltText +// Get the alt text for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// buffer - A buffer for output the alt text. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. +// Return value: +// The number of bytes in the title, including the terminating NUL +// character. The number of bytes is returned regardless of the +// |buffer| and |buflen| parameters. +// Comments: +// Regardless of the platform, the |buffer| is always in UTF-16LE +// encoding. The string is terminated by a UTF16 NUL character. If +// |buflen| is less than the required length, or |buffer| is NULL, +// |buffer| will not be modified. +DLLEXPORT unsigned long STDCALL +FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element, + void* buffer, + unsigned long buflen); + +// Function: FPDF_StructElement_CountChildren +// Count the number of children for the structure element. +// Parameters: +// struct_element - Handle to the struct element. +// Return value: +// The number of children, or -1 on error. +DLLEXPORT int STDCALL +FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element); + +// Function: FPDF_StructElement_GetChildAtIndex +// Get a child in the structure element. +// Parameters: +// struct_tree - Handle to the struct element. +// index - The index for the child, 0-based. +// Return value: +// The child at the n-th index or NULL on error. +// Comments: +// If the child exists but is not an element, then this function will +// return NULL. This will also return NULL for out of bounds indices. +DLLEXPORT FPDF_STRUCTELEMENT STDCALL +FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element, + int index); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_STRUCTTREE_H_ diff --git a/dependencies/pdfium/win/public/fpdf_sysfontinfo.h b/dependencies/pdfium/win/public/fpdf_sysfontinfo.h new file mode 100644 index 00000000..a0edffff --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_sysfontinfo.h @@ -0,0 +1,316 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_SYSFONTINFO_H_ +#define PUBLIC_FPDF_SYSFONTINFO_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +/* Character sets for the font */ +#define FXFONT_ANSI_CHARSET 0 +#define FXFONT_DEFAULT_CHARSET 1 +#define FXFONT_SYMBOL_CHARSET 2 +#define FXFONT_SHIFTJIS_CHARSET 128 +#define FXFONT_HANGEUL_CHARSET 129 +#define FXFONT_GB2312_CHARSET 134 +#define FXFONT_CHINESEBIG5_CHARSET 136 + +/* Font pitch and family flags */ +#define FXFONT_FF_FIXEDPITCH 1 +#define FXFONT_FF_ROMAN (1 << 4) +#define FXFONT_FF_SCRIPT (4 << 4) + +/* Typical weight values */ +#define FXFONT_FW_NORMAL 400 +#define FXFONT_FW_BOLD 700 + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Interface: FPDF_SYSFONTINFO + * Interface for getting system font information and font mapping + */ +typedef struct _FPDF_SYSFONTINFO { + /** + * Version number of the interface. Currently must be 1. + **/ + int version; + + /** + * Method: Release + * Give implementation a chance to release any data after the + * interface is no longer used + * Interface Version: + * 1 + * Implementation Required: + * No + * Comments: + * Called by Foxit SDK during the final cleanup process. + * Parameters: + * pThis - Pointer to the interface structure itself + * Return Value: + * None + */ + void (*Release)(struct _FPDF_SYSFONTINFO* pThis); + + /** + * Method: EnumFonts + * Enumerate all fonts installed on the system + * Interface Version: + * 1 + * Implementation Required: + * No + * Comments: + * Implementation should call FPDF_AddIntalledFont() function for + * each font found. + * Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK. + * Parameters: + * pThis - Pointer to the interface structure itself + * pMapper - An opaque pointer to internal font mapper, used + * when calling FPDF_AddInstalledFont + * Return Value: + * None + */ + void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper); + + /** + * Method: MapFont + * Use the system font mapper to get a font handle from requested + *parameters + * Interface Version: + * 1 + * Implementation Required: + * Yes only if GetFont method is not implemented. + * Comments: + * If the system supports native font mapper (like Windows), + *implementation can implement this method to get a font handle. + * Otherwise, Foxit SDK will do the mapping and then call GetFont + *method. + * Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK. + * Parameters: + * pThis - Pointer to the interface structure itself + * weight - Weight of the requested font. 400 is normal and + *700 is bold. + * bItalic - Italic option of the requested font, TRUE or + *FALSE. + * charset - Character set identifier for the requested font. + *See above defined constants. + * pitch_family - A combination of flags. See above defined + *constants. + * face - Typeface name. Currently use system local encoding + *only. + * bExact - Pointer to a boolean value receiving the indicator + *whether mapper found the exact match. + * If mapper is not sure whether it's exact match, + *ignore this paramter. + * Return Value: + * An opaque pointer for font handle, or NULL if system mapping is + *not supported. + **/ + void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, + int weight, + FPDF_BOOL bItalic, + int charset, + int pitch_family, + const char* face, + FPDF_BOOL* bExact); + + /** + * Method: GetFont + * Get a handle to a particular font by its internal ID + * Interface Version: + * 1 + * Implementation Required: + * Yes only if MapFont method is not implemented. + * Comments: + * If the system mapping not supported, Foxit SDK will do the font + *mapping and use this method to get a font handle. + * Parameters: + * pThis - Pointer to the interface structure itself + * face - Typeface name. Currently use system local encoding + *only. + * Return Value: + * An opaque pointer for font handle. + **/ + void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face); + + /** + * Method: GetFontData + * Get font data from a font + * Interface Version: + * 1 + * Implementation Required: + * Yes + * Comments: + * Can read either full font file, or a particular TrueType/OpenType + *table + * Parameters: + * pThis - Pointer to the interface structure itself + * hFont - Font handle returned by MapFont or GetFont method + * table - TrueType/OpenType table identifier (refer to + *TrueType specification). + * 0 for the whole font file. + * buffer - The buffer receiving the font data. Can be NULL if + *not provided + * buf_size - Buffer size, can be zero if not provided + * Return Value: + * Number of bytes needed, if buffer not provided or not large + *enough, + * or number of bytes written into buffer otherwise. + **/ + unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis, + void* hFont, + unsigned int table, + unsigned char* buffer, + unsigned long buf_size); + + /** + * Method: GetFaceName + * Get face name from a font handle + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself + * hFont - Font handle returned by MapFont or GetFont method + * buffer - The buffer receiving the face name. Can be NULL if + *not provided + * buf_size - Buffer size, can be zero if not provided + * Return Value: + * Number of bytes needed, if buffer not provided or not large + *enough, + * or number of bytes written into buffer otherwise. + **/ + unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis, + void* hFont, + char* buffer, + unsigned long buf_size); + + /** + * Method: GetFontCharset + * Get character set information for a font handle + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself + * hFont - Font handle returned by MapFont or GetFont method + * Return Value: + * Character set identifier. See defined constants above. + **/ + int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); + + /** + * Method: DeleteFont + * Delete a font handle + * Interface Version: + * 1 + * Implementation Required: + * Yes + * Parameters: + * pThis - Pointer to the interface structure itself + * hFont - Font handle returned by MapFont or GetFont method + * Return Value: + * None + **/ + void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); +} FPDF_SYSFONTINFO; + +/** + * Struct: FPDF_CharsetFontMap + * Provides the name of a font to use for a given charset value. + **/ +typedef struct FPDF_CharsetFontMap_ { + int charset; // Character Set Enum value, see FXFONT_*_CHARSET above. + const char* fontname; // Name of default font to use with that charset. +} FPDF_CharsetFontMap; + +/** + * Function: FPDF_GetDefaultTTFMap + * Returns a pointer to the default character set to TT Font name map. The + * map is an array of FPDF_CharsetFontMap structs, with its end indicated + * by a { -1, NULL } entry. + * Parameters: + * None. + * Return Value: + * Pointer to the Charset Font Map. + **/ +DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap(); + +/** + * Function: FPDF_AddInstalledFont + * Add a system font to the list in Foxit SDK. + * Comments: + * This function is only called during the system font list building + *process. + * Parameters: + * mapper - Opaque pointer to Foxit font mapper + * face - The font face name + * charset - Font character set. See above defined constants. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, + const char* face, + int charset); + +/** + * Function: FPDF_SetSystemFontInfo + * Set the system font info interface into Foxit SDK + * Comments: + * Platform support implementation should implement required methods of + *FFDF_SYSFONTINFO interface, + * then call this function during SDK initialization process. + * Parameters: + * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure + * Return Value: + * None + **/ +DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); + +/** + * Function: FPDF_GetDefaultSystemFontInfo + * Get default system font info interface for current platform + * Comments: + * For some platforms Foxit SDK implement a default version of system + *font info interface. + * The default implementation can be used in FPDF_SetSystemFontInfo + *function. + * Parameters: + * None + * Return Value: + * Pointer to a FPDF_SYSFONTINFO structure describing the default + *interface. + * Or NULL if the platform doesn't have a default interface. + * Application should call FPDF_FreeDefaultSystemFontInfo to free the + *returned pointer. + **/ +DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo(); + +/** + * Function: FPDF_FreeDefaultSystemFontInfo + * Free a default system font info interface + * Comments: + * This function should be called on the output from + *FPDF_SetSystemFontInfo once it is no longer needed by the client. + * Parameters: + * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure + * Return Value: + * None + **/ +DLLEXPORT void FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_SYSFONTINFO_H_ diff --git a/dependencies/pdfium/win/public/fpdf_text.h b/dependencies/pdfium/win/public/fpdf_text.h new file mode 100644 index 00000000..5c241527 --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_text.h @@ -0,0 +1,425 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_TEXT_H_ +#define PUBLIC_FPDF_TEXT_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +// Function: FPDFText_LoadPage +// Prepare information about all characters in a page. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage function +// (in FPDFVIEW module). +// Return value: +// A handle to the text page information structure. +// NULL if something goes wrong. +// Comments: +// Application must call FPDFText_ClosePage to release the text page +// information. +// +DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page); + +// Function: FPDFText_ClosePage +// Release all resources allocated for a text page information +// structure. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// Return Value: +// None. +// +DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); + +// Function: FPDFText_CountChars +// Get number of characters in a page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// Return value: +// Number of characters in the page. Return -1 for error. +// Generated characters, like additional space characters, new line +// characters, are also counted. +// Comments: +// Characters in a page form a "stream", inside the stream, each +// character has an index. +// We will use the index parameters in many of FPDFTEXT functions. The +// first character in the page +// has an index value of zero. +// +DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page); + +// Function: FPDFText_GetUnicode +// Get Unicode of a character in a page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// Return value: +// The Unicode of the particular character. +// If a character is not encoded in Unicode and Foxit engine can't +// convert to Unicode, +// the return value will be zero. +// +DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, + int index); + +// Function: FPDFText_GetFontSize +// Get the font size of a particular character. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// Return value: +// The font size of the particular character, measured in points (about +// 1/72 inch). +// This is the typographic size of the font (so called "em size"). +// +DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, + int index); + +// Function: FPDFText_GetCharBox +// Get bounding box of a particular character. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// left - Pointer to a double number receiving left position +// of the character box. +// right - Pointer to a double number receiving right position +// of the character box. +// bottom - Pointer to a double number receiving bottom position +// of the character box. +// top - Pointer to a double number receiving top position of +// the character box. +// Return Value: +// None. +// Comments: +// All positions are measured in PDF "user space". +// +DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, + int index, + double* left, + double* right, + double* bottom, + double* top); + +// Function: FPDFText_GetCharIndexAtPos +// Get the index of a character at or nearby a certain position on the +// page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// x - X position in PDF "user space". +// y - Y position in PDF "user space". +// xTolerance - An x-axis tolerance value for character hit +// detection, in point unit. +// yTolerance - A y-axis tolerance value for character hit +// detection, in point unit. +// Return Value: +// The zero-based index of the character at, or nearby the point (x,y). +// If there is no character at or nearby the point, return value will +// be -1. +// If an error occurs, -3 will be returned. +// +DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, + double x, + double y, + double xTolerance, + double yTolerance); + +// Function: FPDFText_GetText +// Extract unicode text string from the page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// start_index - Index for the start characters. +// count - Number of characters to be extracted. +// result - A buffer (allocated by application) receiving the +// extracted unicodes. +// The size of the buffer must be able to hold the +// number of characters plus a terminator. +// Return Value: +// Number of characters written into the result buffer, including the +// trailing terminator. +// Comments: +// This function ignores characters without unicode information. +// +DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, + int start_index, + int count, + unsigned short* result); + +// Function: FPDFText_CountRects +// Count number of rectangular areas occupied by a segment of texts. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// start_index - Index for the start characters. +// count - Number of characters. +// Return value: +// Number of rectangles. Zero for error. +// Comments: +// This function, along with FPDFText_GetRect can be used by +// applications to detect the position +// on the page for a text segment, so proper areas can be highlighted +// or something. +// FPDFTEXT will automatically merge small character boxes into bigger +// one if those characters +// are on the same line and use same font settings. +// +DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, + int start_index, + int count); + +// Function: FPDFText_GetRect +// Get a rectangular area from the result generated by +// FPDFText_CountRects. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// rect_index - Zero-based index for the rectangle. +// left - Pointer to a double value receiving the rectangle +// left boundary. +// top - Pointer to a double value receiving the rectangle +// top boundary. +// right - Pointer to a double value receiving the rectangle +// right boundary. +// bottom - Pointer to a double value receiving the rectangle +// bottom boundary. +// Return Value: +// None. +// +DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, + int rect_index, + double* left, + double* top, + double* right, + double* bottom); + +// Function: FPDFText_GetBoundedText +// Extract unicode text within a rectangular boundary on the page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// left - Left boundary. +// top - Top boundary. +// right - Right boundary. +// bottom - Bottom boundary. +// buffer - A unicode buffer. +// buflen - Number of characters (not bytes) for the buffer, +// excluding an additional terminator. +// Return Value: +// If buffer is NULL or buflen is zero, return number of characters +// (not bytes) of text present within +// the rectangle, excluding a terminating NUL. Generally you should +// pass a buffer at least one larger +// than this if you want a terminating NUL, which will be provided if +// space is available. +// Otherwise, return number of characters copied into the buffer, +// including the terminating NUL +// when space for it is available. +// Comment: +// If the buffer is too small, as much text as will fit is copied into +// it. +// +DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, + double left, + double top, + double right, + double bottom, + unsigned short* buffer, + int buflen); + +// Flags used by FPDFText_FindStart function. +#define FPDF_MATCHCASE \ + 0x00000001 // If not set, it will not match case by default. +#define FPDF_MATCHWHOLEWORD \ + 0x00000002 // If not set, it will not match the whole word by default. + +// Function: FPDFText_FindStart +// Start a search. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// findwhat - A unicode match pattern. +// flags - Option flags. +// start_index - Start from this character. -1 for end of the page. +// Return Value: +// A handle for the search context. FPDFText_FindClose must be called +// to release this handle. +// +DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, + FPDF_WIDESTRING findwhat, + unsigned long flags, + int start_index); + +// Function: FPDFText_FindNext +// Search in the direction from page start to end. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// Whether a match is found. +// +DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle); + +// Function: FPDFText_FindPrev +// Search in the direction from page end to start. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// Whether a match is found. +// +DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle); + +// Function: FPDFText_GetSchResultIndex +// Get the starting character index of the search result. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// Index for the starting character. +// +DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); + +// Function: FPDFText_GetSchCount +// Get the number of matched characters in the search result. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// Number of matched characters. +// +DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle); + +// Function: FPDFText_FindClose +// Release a search context. +// Parameters: +// handle - A search context handle returned by +// FPDFText_FindStart. +// Return Value: +// None. +// +DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); + +// Function: FPDFLink_LoadWebLinks +// Prepare information about weblinks in a page. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// Return Value: +// A handle to the page's links information structure. +// NULL if something goes wrong. +// Comments: +// Weblinks are those links implicitly embedded in PDF pages. PDF also +// has a type of +// annotation called "link", FPDFTEXT doesn't deal with that kind of +// link. +// FPDFTEXT weblink feature is useful for automatically detecting links +// in the page +// contents. For example, things like "http://www.foxitsoftware.com" +// will be detected, +// so applications can allow user to click on those characters to +// activate the link, +// even the PDF doesn't come with link annotations. +// +// FPDFLink_CloseWebLinks must be called to release resources. +// +DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); + +// Function: FPDFLink_CountWebLinks +// Count number of detected web links. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// Return Value: +// Number of detected web links. +// +DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); + +// Function: FPDFLink_GetURL +// Fetch the URL information for a detected web link. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// link_index - Zero-based index for the link. +// buffer - A unicode buffer for the result. +// buflen - Number of characters (not bytes) for the buffer, +// including an additional terminator. +// Return Value: +// If |buffer| is NULL or |buflen| is zero, return the number of +// characters (not bytes) needed to buffer the result (an additional +// terminator is included in this count). +// Otherwise, copy the result into |buffer|, truncating at |buflen| if +// the result is too large to fit, and return the number of characters +// actually copied into the buffer (the additional terminator is also +// included in this count). +// If |link_index| does not correspond to a valid link, then the result +// is an empty string. +// +DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, + int link_index, + unsigned short* buffer, + int buflen); + +// Function: FPDFLink_CountRects +// Count number of rectangular areas for the link. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// link_index - Zero-based index for the link. +// Return Value: +// Number of rectangular areas for the link. If |link_index| does +// not correspond to a valid link, then 0 is returned. +// +DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, + int link_index); + +// Function: FPDFLink_GetRect +// Fetch the boundaries of a rectangle for a link. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// link_index - Zero-based index for the link. +// rect_index - Zero-based index for a rectangle. +// left - Pointer to a double value receiving the rectangle +// left boundary. +// top - Pointer to a double value receiving the rectangle +// top boundary. +// right - Pointer to a double value receiving the rectangle +// right boundary. +// bottom - Pointer to a double value receiving the rectangle +// bottom boundary. +// Return Value: +// None. If |link_index| does not correspond to a valid link, then +// |left|, |top|, |right|, and |bottom| remain unmodified. +// +DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, + int link_index, + int rect_index, + double* left, + double* top, + double* right, + double* bottom); + +// Function: FPDFLink_CloseWebLinks +// Release resources used by weblink feature. +// Parameters: +// link_page - Handle returned by FPDFLink_LoadWebLinks. +// Return Value: +// None. +// +DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_TEXT_H_ diff --git a/dependencies/pdfium/win/public/fpdf_transformpage.h b/dependencies/pdfium/win/public/fpdf_transformpage.h new file mode 100644 index 00000000..66271fcd --- /dev/null +++ b/dependencies/pdfium/win/public/fpdf_transformpage.h @@ -0,0 +1,161 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef PUBLIC_FPDF_TRANSFORMPAGE_H_ +#define PUBLIC_FPDF_TRANSFORMPAGE_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* FPDF_PAGEARCSAVER; +typedef void* FPDF_PAGEARCLOADER; + +/** +* Set "MediaBox" entry to the page dictionary. +* @param[in] page - Handle to a page. +* @param[in] left - The left of the rectangle. +* @param[in] bottom - The bottom of the rectangle. +* @param[in] right - The right of the rectangle. +* @param[in] top - The top of the rectangle. +* @retval None. +*/ +DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); + +/** +* Set "CropBox" entry to the page dictionary. +* @param[in] page - Handle to a page. +* @param[in] left - The left of the rectangle. +* @param[in] bottom - The bottom of the rectangle. +* @param[in] right - The right of the rectangle. +* @param[in] top - The top of the rectangle. +* @retval None. +*/ +DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); + +/** Get "MediaBox" entry from the page dictionary. +* @param[in] page - Handle to a page. +* @param[in] left - Pointer to a double value receiving the left of the +* rectangle. +* @param[in] bottom - Pointer to a double value receiving the bottom of the +* rectangle. +* @param[in] right - Pointer to a double value receiving the right of the +* rectangle. +* @param[in] top - Pointer to a double value receiving the top of the +* rectangle. +* @retval True if success,else fail. +*/ +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** Get "CropBox" entry from the page dictionary. +* @param[in] page - Handle to a page. +* @param[in] left - Pointer to a double value receiving the left of the +* rectangle. +* @param[in] bottom - Pointer to a double value receiving the bottom of the +* rectangle. +* @param[in] right - Pointer to a double value receiving the right of the +* rectangle. +* @param[in] top - Pointer to a double value receiving the top of the +* rectangle. +* @retval True if success,else fail. +*/ +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** +* Transform the whole page with a specified matrix, then clip the page content +* region. +* +* @param[in] page - A page handle. +* @param[in] matrix - The transform matrix. +* @param[in] clipRect - A rectangle page area to be clipped. +* @Note. This function will transform the whole page, and would take effect to +* all the objects in the page. +*/ +DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, + FS_MATRIX* matrix, + FS_RECTF* clipRect); + +/** +* Transform (scale, rotate, shear, move) the clip path of page object. +* @param[in] page_object - Handle to a page object. Returned by +* FPDFPageObj_NewImageObj. +* @param[in] a - The coefficient "a" of the matrix. +* @param[in] b - The coefficient "b" of the matrix. +* @param[in] c - The coefficient "c" of the matrix. +* @param[in] d - The coefficient "d" of the matrix. +* @param[in] e - The coefficient "e" of the matrix. +* @param[in] f - The coefficient "f" of the matrix. +* @retval None. +*/ +DLLEXPORT void STDCALL +FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, + double a, + double b, + double c, + double d, + double e, + double f); + +/** +* Create a new clip path, with a rectangle inserted. +* +* @param[in] left - The left of the clip box. +* @param[in] bottom - The bottom of the clip box. +* @param[in] right - The right of the clip box. +* @param[in] top - The top of the clip box. +* @retval a handle to the clip path. +*/ +DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, + float bottom, + float right, + float top); + +/** +* Destroy the clip path. +* +* @param[in] clipPath - A handle to the clip path. +* Destroy the clip path. +* @retval None. +*/ +DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath); + +/** +* Clip the page content, the page content that outside the clipping region +* become invisible. +* +* @param[in] page - A page handle. +* @param[in] clipPath - A handle to the clip path. +* @Note. A clip path will be inserted before the page content stream or content +* array. In this way, the page content will be clipped +* by this clip path. +*/ +DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, + FPDF_CLIPPATH clipPath); + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_TRANSFORMPAGE_H_ diff --git a/dependencies/pdfium/win/public/fpdfview.h b/dependencies/pdfium/win/public/fpdfview.h new file mode 100644 index 00000000..843814ce --- /dev/null +++ b/dependencies/pdfium/win/public/fpdfview.h @@ -0,0 +1,1043 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +// NOTE: External docs refer to this file as "fpdfview.h", so do not rename +// despite lack of consistency with other public files. + +#ifndef PUBLIC_FPDFVIEW_H_ +#define PUBLIC_FPDFVIEW_H_ + +#if defined(_WIN32) && !defined(__WINDOWS__) +#include +#endif + +#ifdef PDF_ENABLE_XFA +// PDF_USE_XFA is set in confirmation that this version of PDFium can support +// XFA forms as requested by the PDF_ENABLE_XFA setting. +#define PDF_USE_XFA +#endif // PDF_ENABLE_XFA + +// PDF types +typedef void* FPDF_ACTION; +typedef void* FPDF_BITMAP; +typedef void* FPDF_BOOKMARK; +typedef void* FPDF_CLIPPATH; +typedef void* FPDF_DEST; +typedef void* FPDF_DOCSCHHANDLE; +typedef void* FPDF_DOCUMENT; +typedef void* FPDF_FONT; +typedef void* FPDF_HMODULE; +typedef void* FPDF_LINK; +typedef void* FPDF_MODULEMGR; +typedef void* FPDF_PAGE; +typedef void* FPDF_PAGELINK; +typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) +typedef void* FPDF_PAGERANGE; +typedef void* FPDF_PATH; +typedef void* FPDF_RECORDER; +typedef void* FPDF_SCHHANDLE; +typedef void* FPDF_STRUCTELEMENT; +typedef void* FPDF_STRUCTTREE; +typedef void* FPDF_TEXTPAGE; + +#ifdef PDF_ENABLE_XFA +typedef void* FPDF_STRINGHANDLE; +typedef void* FPDF_WIDGET; +#endif // PDF_ENABLE_XFA + +// Basic data types +typedef int FPDF_BOOL; +typedef int FPDF_ERROR; +typedef unsigned long FPDF_DWORD; +typedef float FS_FLOAT; + +#ifdef PDF_ENABLE_XFA +typedef void* FPDF_LPVOID; +typedef void const* FPDF_LPCVOID; +typedef char const* FPDF_LPCSTR; +typedef int FPDF_RESULT; +#endif + +// Duplex types +typedef enum _FPDF_DUPLEXTYPE_ { + DuplexUndefined = 0, + Simplex, + DuplexFlipShortEdge, + DuplexFlipLongEdge +} FPDF_DUPLEXTYPE; + +// String types +typedef unsigned short FPDF_WCHAR; +typedef unsigned char const* FPDF_LPCBYTE; + +// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE +// encoded), and platform dependent string +typedef const char* FPDF_BYTESTRING; + +// FPDFSDK always uses UTF-16LE encoded wide strings, each character uses 2 +// bytes (except surrogation), with the low byte first. +typedef const unsigned short* FPDF_WIDESTRING; + +#ifdef PDF_ENABLE_XFA +// Structure for a byte string. +// Note, a byte string commonly means a UTF-16LE formated string. +typedef struct _FPDF_BSTR { + // String buffer. + char* str; + // Length of the string, in bytes. + int len; +} FPDF_BSTR; +#endif // PDF_ENABLE_XFA + +// For Windows programmers: In most cases it's OK to treat FPDF_WIDESTRING as a +// Windows unicode string, however, special care needs to be taken if you +// expect to process Unicode larger than 0xffff. +// +// For Linux/Unix programmers: most compiler/library environments use 4 bytes +// for a Unicode character, and you have to convert between FPDF_WIDESTRING and +// system wide string by yourself. +typedef const char* FPDF_STRING; + +// Matrix for transformation. +typedef struct _FS_MATRIX_ { + float a; + float b; + float c; + float d; + float e; + float f; +} FS_MATRIX; + +// Rectangle area(float) in device or page coordinate system. +typedef struct _FS_RECTF_ { + // The x-coordinate of the left-top corner. + float left; + // The y-coordinate of the left-top corner. + float top; + // The x-coordinate of the right-bottom corner. + float right; + // The y-coordinate of the right-bottom corner. + float bottom; +} * FS_LPRECTF, FS_RECTF; + +// Const Pointer to FS_RECTF structure. +typedef const FS_RECTF* FS_LPCRECTF; + +#if defined(_WIN32) && defined (_MSC_VER) +#if defined(FPDFSDK_EXPORTS) +// On Windows system, functions are exported in a DLL +#define DLLEXPORT __declspec(dllexport) +#define STDCALL __stdcall +#else +#define DLLEXPORT __declspec(dllimport) +#define STDCALL __stdcall +#endif //FPDF_EXPORTS +#else +#define DLLEXPORT __declspec(dllimport) +#define STDCALL __stdcall +#endif //WIN32 + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +// Function: FPDF_InitLibrary +// Initialize the FPDFSDK library +// Parameters: +// None +// Return value: +// None. +// Comments: +// Convenience function to call FPDF_InitLibraryWithConfig() for +// backwards comatibility purposes. +DLLEXPORT void STDCALL FPDF_InitLibrary(); + +// Process-wide options for initializing the library. +typedef struct FPDF_LIBRARY_CONFIG_ { + // Version number of the interface. Currently must be 2. + int version; + + // Array of paths to scan in place of the defaults when using built-in + // FXGE font loading code. The array is terminated by a NULL pointer. + // The Array may be NULL itself to use the default paths. May be ignored + // entirely depending upon the platform. + const char** m_pUserFontPaths; + + // Version 2. + + // pointer to the v8::Isolate to use, or NULL to force PDFium to create one. + void* m_pIsolate; + + // The embedder data slot to use in the v8::Isolate to store PDFium's + // per-isolate data. The value needs to be between 0 and + // v8::Internals::kNumIsolateDataLots (exclusive). Note that 0 is fine + // for most embedders. + unsigned int m_v8EmbedderSlot; +} FPDF_LIBRARY_CONFIG; + +// Function: FPDF_InitLibraryWithConfig +// Initialize the FPDFSDK library +// Parameters: +// config - configuration information as above. +// Return value: +// None. +// Comments: +// You have to call this function before you can call any PDF +// processing functions. +DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( + const FPDF_LIBRARY_CONFIG* config); + +// Function: FPDF_DestroyLibary +// Release all resources allocated by the FPDFSDK library. +// Parameters: +// None. +// Return value: +// None. +// Comments: +// You can call this function to release all memory blocks allocated by +// the library. +// After this function is called, you should not call any PDF +// processing functions. +DLLEXPORT void STDCALL FPDF_DestroyLibrary(); + +// Policy for accessing the local machine time. +#define FPDF_POLICY_MACHINETIME_ACCESS 0 + +// Function: FPDF_SetSandBoxPolicy +// Set the policy for the sandbox environment. +// Parameters: +// policy - The specified policy for setting, for example: +// FPDF_POLICY_MACHINETIME_ACCESS. +// enable - True to enable, false to disable the policy. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, + FPDF_BOOL enable); + +#if defined(_WIN32) +#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) +// Pointer to a helper function to make |font| with |text| of |text_length| +// accessible when printing text with GDI. This is useful in sandboxed +// environments where PDFium's access to GDI may be restricted. +typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, + const wchar_t* text, + size_t text_length); + +// Function: FPDF_SetTypefaceAccessibleFunc +// Set the function pointer that makes GDI fonts available in sandboxed +// environments. Experimental API. +// Parameters: +// func - A function pointer. See description above. +// Return value: +// None. +DLLEXPORT void STDCALL +FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); + +// Function: FPDF_SetPrintTextWithGDI +// Set whether to use GDI to draw fonts when printing on Windows. +// Experimental API. +// Parameters: +// use_gdi - Set to true to enable printing text with GDI. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi); +#endif // PDFIUM_PRINT_TEXT_WITH_GDI + +// Function: FPDF_SetPrintPostscriptLevel +// Set postscript printing level when printing on Windows. +// Experimental API. +// Parameters: +// postscript_level - 0 to disable postscript printing, +// 2 to print with postscript level 2, +// 3 to print with postscript level 3. +// All other values are invalid. +// Return value: +// True if successful, false if unsucessful (typically invalid input). +DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintPostscriptLevel(FPDF_BOOL use_gdi); +#endif // defined(_WIN32) + +// Function: FPDF_LoadDocument +// Open and load a PDF document. +// Parameters: +// file_path - Path to the PDF file (including extension). +// password - A string used as the password for the PDF file. +// If no password is needed, empty or NULL can be used. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// Loaded document can be closed by FPDF_CloseDocument(). +// If this function fails, you can use FPDF_GetLastError() to retrieve +// the reason why it failed. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, + FPDF_BYTESTRING password); + +// Function: FPDF_LoadMemDocument +// Open and load a PDF document from memory. +// Parameters: +// data_buf - Pointer to a buffer containing the PDF document. +// size - Number of bytes in the PDF document. +// password - A string used as the password for the PDF file. +// If no password is needed, empty or NULL can be used. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// The memory buffer must remain valid when the document is open. +// The loaded document can be closed by FPDF_CloseDocument. +// If this function fails, you can use FPDF_GetLastError() to retrieve +// the reason why it failed. +// Notes: +// If PDFium is built with the XFA module, the application should call +// FPDF_LoadXFA() function after the PDF document loaded to support XFA +// fields defined in the fpdfformfill.h file. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, + int size, + FPDF_BYTESTRING password); + +// Structure for custom file access. +typedef struct { + // File length, in bytes. + unsigned long m_FileLen; + + // A function pointer for getting a block of data from a specific position. + // Position is specified by byte offset from the beginning of the file. + // The position and size will never go out of range of the file length. + // It may be possible for FPDFSDK to call this function multiple times for + // the same position. + // Return value: should be non-zero if successful, zero for error. + int (*m_GetBlock)(void* param, + unsigned long position, + unsigned char* pBuf, + unsigned long size); + + // A custom pointer for all implementation specific data. This pointer will + // be used as the first parameter to the m_GetBlock callback. + void* m_Param; +} FPDF_FILEACCESS; + +#ifdef PDF_ENABLE_XFA +/** + * @brief Structure for file reading or writing (I/O). + * + * @note This is a handler and should be implemented by callers. + */ +typedef struct _FPDF_FILEHANDLER { + /** + * @brief User-defined data. + * @note Callers can use this field to track controls. + */ + FPDF_LPVOID clientData; + /** + * @brief Callback function to release the current file stream object. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return None. + */ + void (*Release)(FPDF_LPVOID clientData); + /** + * @brief Callback function to retrieve the current file stream size. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return Size of file stream. + */ + FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData); + /** + * @brief Callback function to read data from the current file stream. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] offset Offset position starts from the beginning of file + * stream. This parameter indicates reading position. + * @param[in] buffer Memory buffer to store data which are read from + * file stream. This parameter should not be NULL. + * @param[in] size Size of data which should be read from file + * stream, in bytes. The buffer indicated by the parameter buffer + * should be enough to store specified data. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, + FPDF_DWORD offset, + FPDF_LPVOID buffer, + FPDF_DWORD size); + /** + * @brief Callback function to write data into the current file stream. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] offset Offset position starts from the beginning of file + * stream. This parameter indicates writing position. + * @param[in] buffer Memory buffer contains data which is written into + * file stream. This parameter should not be NULL. + * @param[in] size Size of data which should be written into file + * stream, in bytes. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, + FPDF_DWORD offset, + FPDF_LPCVOID buffer, + FPDF_DWORD size); + /** + * @brief Callback function to flush all internal accessing buffers. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*Flush)(FPDF_LPVOID clientData); + /** + * @brief Callback function to change file size. + * + * @details This function is called under writing mode usually. Implementer + * can determine whether to realize it based on application requests. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] size New size of file stream, in bytes. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); +} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; + +#endif +// Function: FPDF_LoadCustomDocument +// Load PDF document from a custom access descriptor. +// Parameters: +// pFileAccess - A structure for accessing the file. +// password - Optional password for decrypting the PDF file. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// The application must keep the file resources valid until the PDF +// document is closed. +// +// The loaded document can be closed with FPDF_CloseDocument. +// Notes: +// If PDFium is built with the XFA module, the application should call +// FPDF_LoadXFA() function after the PDF document loaded to support XFA +// fields defined in the fpdfformfill.h file. +DLLEXPORT FPDF_DOCUMENT STDCALL +FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); + +// Function: FPDF_GetFileVersion +// Get the file version of the given PDF document. +// Parameters: +// doc - Handle to a document. +// fileVersion - The PDF file version. File version: 14 for 1.4, 15 +// for 1.5, ... +// Return value: +// True if succeeds, false otherwise. +// Comments: +// If the document was created by FPDF_CreateNewDocument, +// then this function will always fail. +DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, + int* fileVersion); + +#define FPDF_ERR_SUCCESS 0 // No error. +#define FPDF_ERR_UNKNOWN 1 // Unknown error. +#define FPDF_ERR_FILE 2 // File not found or could not be opened. +#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. +#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. +#define FPDF_ERR_SECURITY 5 // Unsupported security scheme. +#define FPDF_ERR_PAGE 6 // Page not found or content error. +#ifdef PDF_ENABLE_XFA +#define FPDF_ERR_XFALOAD 7 // Load XFA error. +#define FPDF_ERR_XFALAYOUT 8 // Layout XFA error. +#endif // PDF_ENABLE_XFA + +// Function: FPDF_GetLastError +// Get last error code when a function fails. +// Parameters: +// None. +// Return value: +// A 32-bit integer indicating error code as defined above. +// Comments: +// If the previous SDK call succeeded, the return value of this +// function is not defined. +DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); + +// Function: FPDF_GetDocPermission +// Get file permission flags of the document. +// Parameters: +// document - Handle to a document. Returned by FPDF_LoadDocument. +// Return value: +// A 32-bit integer indicating permission flags. Please refer to the +// PDF Reference for detailed descriptions. If the document is not +// protected, 0xffffffff will be returned. +DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); + +// Function: FPDF_GetSecurityHandlerRevision +// Get the revision for the security handler. +// Parameters: +// document - Handle to a document. Returned by FPDF_LoadDocument. +// Return value: +// The security handler revision number. Please refer to the PDF +// Reference for a detailed description. If the document is not +// protected, -1 will be returned. +DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); + +// Function: FPDF_GetPageCount +// Get total number of pages in the document. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument. +// Return value: +// Total number of pages in the document. +DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); + +// Function: FPDF_LoadPage +// Load a page inside the document. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument +// page_index - Index number of the page. 0 for the first page. +// Return value: +// A handle to the loaded page, or NULL if page load fails. +// Comments: +// The loaded page can be rendered to devices using FPDF_RenderPage. +// The loaded page can be closed using FPDF_ClosePage. +DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, + int page_index); + +// Function: FPDF_GetPageWidth +// Get page width. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// Return value: +// Page width (excluding non-displayable area) measured in points. +// One point is 1/72 inch (around 0.3528 mm). +DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); + +// Function: FPDF_GetPageHeight +// Get page height. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// Return value: +// Page height (excluding non-displayable area) measured in points. +// One point is 1/72 inch (around 0.3528 mm) +DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); + +// Function: FPDF_GetPageSizeByIndex +// Get the size of the page at the given index. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument. +// page_index - Page index, zero for the first page. +// width - Pointer to a double to receive the page width +// (in points). +// height - Pointer to a double to receive the page height +// (in points). +// Return value: +// Non-zero for success. 0 for error (document or page not found). +DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, + int page_index, + double* width, + double* height); + +// Page rendering flags. They can be combined with bit-wise OR. +// +// Set if annotations are to be rendered. +#define FPDF_ANNOT 0x01 +// Set if using text rendering optimized for LCD display. +#define FPDF_LCD_TEXT 0x02 +// Don't use the native text output available on some platforms +#define FPDF_NO_NATIVETEXT 0x04 +// Grayscale output. +#define FPDF_GRAYSCALE 0x08 +// Set if you want to get some debug info. +#define FPDF_DEBUG_INFO 0x80 +// Set if you don't want to catch exceptions. +#define FPDF_NO_CATCH 0x100 +// Limit image cache size. +#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 +// Always use halftone for image stretching. +#define FPDF_RENDER_FORCEHALFTONE 0x400 +// Render for printing. +#define FPDF_PRINTING 0x800 +// Set to disable anti-aliasing on text. +#define FPDF_RENDER_NO_SMOOTHTEXT 0x1000 +// Set to disable anti-aliasing on images. +#define FPDF_RENDER_NO_SMOOTHIMAGE 0x2000 +// Set to disable anti-aliasing on paths. +#define FPDF_RENDER_NO_SMOOTHPATH 0x4000 +// Set whether to render in a reverse Byte order, this flag is only used when +// rendering to a bitmap. +#define FPDF_REVERSE_BYTE_ORDER 0x10 + +#ifdef _WIN32 +// Function: FPDF_RenderPage +// Render contents of a page to a device (screen, bitmap, or printer). +// This function is only supported on Windows. +// Parameters: +// dc - Handle to the device context. +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: +// 0 (normal) +// 1 (rotated 90 degrees clockwise) +// 2 (rotated 180 degrees) +// 3 (rotated 90 degrees counter-clockwise) +// flags - 0 for normal display, or combination of flags +// defined above. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); +#endif + +// Function: FPDF_RenderPageBitmap +// Render contents of a page to a device independent bitmap. +// Parameters: +// bitmap - Handle to the device independent bitmap (as the +// output buffer). The bitmap handle can be created +// by FPDFBitmap_Create. +// page - Handle to the page. Returned by FPDF_LoadPage +// start_x - Left pixel position of the display area in +// bitmap coordinates. +// start_y - Top pixel position of the display area in bitmap +// coordinates. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: +// 0 (normal) +// 1 (rotated 90 degrees clockwise) +// 2 (rotated 180 degrees) +// 3 (rotated 90 degrees counter-clockwise) +// flags - 0 for normal display, or combination of the Page +// Rendering flags defined above. With the FPDF_ANNOT +// flag, it renders all annotations that do not require +// user-interaction, which are all annotations except +// widget and popup annotations. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); + +// Function: FPDF_RenderPageBitmapWithMatrix +// Render contents of a page to a device independent bitmap. +// Parameters: +// bitmap - Handle to the device independent bitmap (as the +// output buffer). The bitmap handle can be created +// by FPDFBitmap_Create. +// page - Handle to the page. Returned by FPDF_LoadPage +// matrix - The transform matrix. +// clipping - The rect to clip to. +// flags - 0 for normal display, or combination of the Page +// Rendering flags defined above. With the FPDF_ANNOT +// flag, it renders all annotations that do not require +// user-interaction, which are all annotations except +// widget and popup annotations. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, + FPDF_PAGE page, + const FS_MATRIX* matrix, + const FS_RECTF* clipping, + int flags); + +#ifdef _SKIA_SUPPORT_ +DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, + int size_x, + int size_y); +#endif + +// Function: FPDF_ClosePage +// Close a loaded PDF page. +// Parameters: +// page - Handle to the loaded page. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); + +// Function: FPDF_CloseDocument +// Close a loaded PDF document. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); + +// Function: FPDF_DeviceToPage +// Convert the screen coordinates of a point to page coordinates. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: +// 0 (normal) +// 1 (rotated 90 degrees clockwise) +// 2 (rotated 180 degrees) +// 3 (rotated 90 degrees counter-clockwise) +// device_x - X value in device coordinates to be converted. +// device_y - Y value in device coordinates to be converted. +// page_x - A pointer to a double receiving the converted X +// value in page coordinates. +// page_y - A pointer to a double receiving the converted Y +// value in page coordinates. +// Return value: +// None. +// Comments: +// The page coordinate system has its origin at the left-bottom corner +// of the page, with the X-axis on the bottom going to the right, and +// the Y-axis on the left side going up. +// +// NOTE: this coordinate system can be altered when you zoom, scroll, +// or rotate a page, however, a point on the page should always have +// the same coordinate values in the page coordinate system. +// +// The device coordinate system is device dependent. For screen device, +// its origin is at the left-top corner of the window. However this +// origin can be altered by the Windows coordinate transformation +// utilities. +// +// You must make sure the start_x, start_y, size_x, size_y +// and rotate parameters have exactly same values as you used in +// the FPDF_RenderPage() function call. +DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int device_x, + int device_y, + double* page_x, + double* page_y); + +// Function: FPDF_PageToDevice +// Convert the page coordinates of a point to screen coordinates. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// size_x - Horizontal size (in pixels) for displaying the page. +// size_y - Vertical size (in pixels) for displaying the page. +// rotate - Page orientation: +// 0 (normal) +// 1 (rotated 90 degrees clockwise) +// 2 (rotated 180 degrees) +// 3 (rotated 90 degrees counter-clockwise) +// page_x - X value in page coordinates. +// page_y - Y value in page coordinate. +// device_x - A pointer to an integer receiving the result X +// value in device coordinates. +// device_y - A pointer to an integer receiving the result Y +// value in device coordinates. +// Return value: +// None. +// Comments: +// See comments for FPDF_DeviceToPage(). +DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + double page_x, + double page_y, + int* device_x, + int* device_y); + +// Function: FPDFBitmap_Create +// Create a device independent bitmap (FXDIB). +// Parameters: +// width - The number of pixels in width for the bitmap. +// Must be greater than 0. +// height - The number of pixels in height for the bitmap. +// Must be greater than 0. +// alpha - A flag indicating whether the alpha channel is used. +// Non-zero for using alpha, zero for not using. +// Return value: +// The created bitmap handle, or NULL if a parameter error or out of +// memory. +// Comments: +// The bitmap always uses 4 bytes per pixel. The first byte is always +// double word aligned. +// +// The byte order is BGRx (the last byte unused if no alpha channel) or +// BGRA. +// +// The pixels in a horizontal line are stored side by side, with the +// left most pixel stored first (with lower memory address). +// Each line uses width * 4 bytes. +// +// Lines are stored one after another, with the top most line stored +// first. There is no gap between adjacent lines. +// +// This function allocates enough memory for holding all pixels in the +// bitmap, but it doesn't initialize the buffer. Applications can use +// FPDFBitmap_FillRect to fill the bitmap using any color. +DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, + int height, + int alpha); + +// More DIB formats +// Gray scale bitmap, one byte per pixel. +#define FPDFBitmap_Gray 1 +// 3 bytes per pixel, byte order: blue, green, red. +#define FPDFBitmap_BGR 2 +// 4 bytes per pixel, byte order: blue, green, red, unused. +#define FPDFBitmap_BGRx 3 +// 4 bytes per pixel, byte order: blue, green, red, alpha. +#define FPDFBitmap_BGRA 4 + +// Function: FPDFBitmap_CreateEx +// Create a device independent bitmap (FXDIB) +// Parameters: +// width - The number of pixels in width for the bitmap. +// Must be greater than 0. +// height - The number of pixels in height for the bitmap. +// Must be greater than 0. +// format - A number indicating for bitmap format, as defined +// above. +// first_scan - A pointer to the first byte of the first line if +// using an external buffer. If this parameter is NULL, +// then the a new buffer will be created. +// stride - Number of bytes for each scan line, for external +// buffer only. +// Return value: +// The bitmap handle, or NULL if parameter error or out of memory. +// Comments: +// Similar to FPDFBitmap_Create function, but allows for more formats +// and an external buffer is supported. The bitmap created by this +// function can be used in any place that a FPDF_BITMAP handle is +// required. +// +// If an external buffer is used, then the application should destroy +// the buffer by itself. FPDFBitmap_Destroy function will not destroy +// the buffer. +DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, + int height, + int format, + void* first_scan, + int stride); + +// Function: FPDFBitmap_FillRect +// Fill a rectangle in a bitmap. +// Parameters: +// bitmap - The handle to the bitmap. Returned by +// FPDFBitmap_Create. +// left - The left position. Starting from 0 at the +// left-most pixel. +// top - The top position. Starting from 0 at the +// top-most line. +// width - Width in pixels to be filled. +// height - Height in pixels to be filled. +// color - A 32-bit value specifing the color, in 8888 ARGB +// format. +// Return value: +// None. +// Comments: +// This function sets the color and (optionally) alpha value in the +// specified region of the bitmap. +// +// NOTE: If the alpha channel is used, this function does NOT +// composite the background with the source color, instead the +// background will be replaced by the source color and the alpha. +// +// If the alpha channel is not used, the alpha parameter is ignored. +DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, + int left, + int top, + int width, + int height, + FPDF_DWORD color); + +// Function: FPDFBitmap_GetBuffer +// Get data buffer of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The pointer to the first byte of the bitmap buffer. +// Comments: +// The stride may be more than width * number of bytes per pixel +// +// Applications can use this function to get the bitmap buffer pointer, +// then manipulate any color and/or alpha values for any pixels in the +// bitmap. +// +// The data is in BGRA format. Where the A maybe unused if alpha was +// not specified. +DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetWidth +// Get width of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The width of the bitmap in pixels. +DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetHeight +// Get height of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The height of the bitmap in pixels. +DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetStride +// Get number of bytes for each line in the bitmap buffer. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The number of bytes for each line in the bitmap buffer. +// Comments: +// The stride may be more than width * number of bytes per pixel. +DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_Destroy +// Destroy a bitmap and release all related buffers. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// None. +// Comments: +// This function will not destroy any external buffers provided when +// the bitmap was created. +DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); + +// Function: FPDF_VIEWERREF_GetPrintScaling +// Whether the PDF document prefers to be scaled or not. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// None. +DLLEXPORT FPDF_BOOL STDCALL +FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetNumCopies +// Returns the number of copies to be printed. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The number of copies to be printed. +DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetPrintPageRange +// Page numbers to initialize print dialog box when file is printed. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The print page range to be used for printing. +DLLEXPORT FPDF_PAGERANGE STDCALL +FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetDuplex +// Returns the paper handling option to be used when printing from +// the print dialog. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The paper handling option to be used when printing. +DLLEXPORT FPDF_DUPLEXTYPE STDCALL +FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetName +// Gets the contents for a viewer ref, with a given key. The value must +// be of type "name". +// Parameters: +// document - Handle to the loaded document. +// key - Name of the key in the viewer pref dictionary. +// buffer - A string to write the contents of the key to. +// length - Length of the buffer. +// Return value: +// The number of bytes in the contents, including the NULL terminator. +// Thus if the return value is 0, then that indicates an error, such +// as when |document| is invalid or |buffer| is NULL. If |length| is +// less than the returned length, or |buffer| is NULL, |buffer| will +// not be modified. +DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, + FPDF_BYTESTRING key, + char* buffer, + unsigned long length); + +// Function: FPDF_CountNamedDests +// Get the count of named destinations in the PDF document. +// Parameters: +// document - Handle to a document +// Return value: +// The count of named destinations. +DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); + +// Function: FPDF_GetNamedDestByName +// Get a the destination handle for the given name. +// Parameters: +// document - Handle to the loaded document. +// name - The name of a destination. +// Return value: +// The handle to the destination. +DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, + FPDF_BYTESTRING name); + +// Function: FPDF_GetNamedDest +// Get the named destination by index. +// Parameters: +// document - Handle to a document +// index - The index of a named destination. +// buffer - The buffer to store the destination name, +// used as wchar_t*. +// buflen [in/out] - Size of the buffer in bytes on input, +// length of the result in bytes on output +// or -1 if the buffer is too small. +// Return value: +// The destination handle for a given index, or NULL if there is no +// named destination corresponding to |index|. +// Comments: +// Call this function twice to get the name of the named destination: +// 1) First time pass in |buffer| as NULL and get buflen. +// 2) Second time pass in allocated |buffer| and buflen to retrieve +// |buffer|, which should be used as wchar_t*. +// +// If buflen is not sufficiently large, it will be set to -1 upon +// return. +DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, + int index, + void* buffer, + long* buflen); + +#ifdef PDF_ENABLE_XFA +// Function: FPDF_BStr_Init +// Helper function to initialize a byte string. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str); + +// Function: FPDF_BStr_Set +// Helper function to set string data. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, + FPDF_LPCSTR bstr, + int length); + +// Function: FPDF_BStr_Clear +// Helper function to clear a byte string. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str); +#endif // PDF_ENABLE_XFA + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDFVIEW_H_ diff --git a/dependencies/pdfium/win/x64/pdfium.dll b/dependencies/pdfium/win/x64/pdfium.dll new file mode 100644 index 00000000..005b03fb Binary files /dev/null and b/dependencies/pdfium/win/x64/pdfium.dll differ diff --git a/dependencies/pdfium/win/x64/pdfium.lib b/dependencies/pdfium/win/x64/pdfium.lib new file mode 100644 index 00000000..49e8c538 Binary files /dev/null and b/dependencies/pdfium/win/x64/pdfium.lib differ diff --git a/dependencies/pdfium/win/x86/pdfium.dll b/dependencies/pdfium/win/x86/pdfium.dll new file mode 100644 index 00000000..e3cec0d0 Binary files /dev/null and b/dependencies/pdfium/win/x86/pdfium.dll differ diff --git a/dependencies/pdfium/win/x86/pdfium.lib b/dependencies/pdfium/win/x86/pdfium.lib new file mode 100644 index 00000000..fc28dc0c Binary files /dev/null and b/dependencies/pdfium/win/x86/pdfium.lib differ diff --git a/dependencies/unarr/macx/libunarr.a b/dependencies/unarr/macx/libunarr.a new file mode 100644 index 00000000..955f6954 Binary files /dev/null and b/dependencies/unarr/macx/libunarr.a differ diff --git a/dependencies/unarr/macx/unarr.h b/dependencies/unarr/macx/unarr.h new file mode 100644 index 00000000..4999fd55 --- /dev/null +++ b/dependencies/unarr/macx/unarr.h @@ -0,0 +1,130 @@ +/* Copyright 2015 the unarr project authors (see AUTHORS file). + License: LGPLv3 */ + +#ifndef unarr_h +#define unarr_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + + +/* macros for shared library usage */ + +#if defined (UNARR_IS_SHARED_LIBRARY) +#if defined (_WIN32) + +#if defined (UNARR_EXPORT_SYMBOLS) +#define UNARR_EXPORT __declspec(dllexport) +#else +#define UNARR_EXPORT __declspec(dllimport) +#endif // UNARR_EXPORT_SYMBOLS + +#else // _WIN32 + +#if defined (UNARR_EXPORT_SYMBOLS) +#define UNARR_EXPORT __attribute__((visibility("default"))) +#else +#define UNARR_EXPORT +#endif // UNARR_EXPORT_SYMBOLS +#endif // _WIN32 + +#else // defined UNARR_IS_SHARED_LIBRARY +#define UNARR_EXPORT + +#endif // UNARR_IS_SHARED_LIBRARY + + +typedef int64_t off64_t; +typedef int64_t time64_t; + +#define UNARR_API_VERSION 100 + +/***** common/stream *****/ + +typedef struct ar_stream_s ar_stream; + +/* opens a read-only stream for the given file path; returns NULL on error */ +UNARR_EXPORT ar_stream *ar_open_file(const char *path); +#ifdef _WIN32 +UNARR_EXPORT ar_stream *ar_open_file_w(const wchar_t *path); +#endif +/* opens a read-only stream for the given chunk of memory; the pointer must be valid until ar_close is called */ +UNARR_EXPORT ar_stream *ar_open_memory(const void *data, size_t datalen); +#ifdef _WIN32 +typedef struct IStream IStream; +/* opens a read-only stream based on the given IStream */ +UNARR_EXPORT ar_stream *ar_open_istream(IStream *stream); +#endif + +/* closes the stream and releases underlying resources */ +UNARR_EXPORT void ar_close(ar_stream *stream); +/* tries to read 'count' bytes into buffer, advancing the read offset pointer; returns the actual number of bytes read */ +UNARR_EXPORT size_t ar_read(ar_stream *stream, void *buffer, size_t count); +/* moves the read offset pointer (same as fseek); returns false on failure */ +UNARR_EXPORT bool ar_seek(ar_stream *stream, off64_t offset, int origin); +/* shortcut for ar_seek(stream, count, SEEK_CUR); returns false on failure */ +UNARR_EXPORT bool ar_skip(ar_stream *stream, off64_t count); +/* returns the current read offset (or 0 on error) */ +UNARR_EXPORT off64_t ar_tell(ar_stream *stream); + +/***** common/unarr *****/ + +typedef struct ar_archive_s ar_archive; + +/* frees all data stored for the given archive; does not close the underlying stream */ +UNARR_EXPORT void ar_close_archive(ar_archive *ar); +/* reads the next archive entry; returns false on error or at the end of the file (use ar_at_eof to distinguish the two cases) */ +UNARR_EXPORT bool ar_parse_entry(ar_archive *ar); +/* reads the archive entry at the given offset as returned by ar_entry_get_offset (offset 0 always restarts at the first entry); should always succeed */ +UNARR_EXPORT bool ar_parse_entry_at(ar_archive *ar, off64_t offset); +/* reads the (first) archive entry associated with the given name; returns false if the entry couldn't be found */ +UNARR_EXPORT bool ar_parse_entry_for(ar_archive *ar, const char *entry_name); +/* returns whether the last ar_parse_entry call has reached the file's expected end */ +UNARR_EXPORT bool ar_at_eof(ar_archive *ar); + +/* returns the name of the current entry as UTF-8 string; this pointer is only valid until the next call to ar_parse_entry; returns NULL on failure */ +UNARR_EXPORT const char *ar_entry_get_name(ar_archive *ar); +/* returns the stream offset of the current entry for use with ar_parse_entry_at */ +UNARR_EXPORT off64_t ar_entry_get_offset(ar_archive *ar); +/* returns the total size of uncompressed data of the current entry; read exactly that many bytes using ar_entry_uncompress */ +UNARR_EXPORT size_t ar_entry_get_size(ar_archive *ar); +/* returns the stored modification date of the current entry in 100ns since 1601/01/01 */ +UNARR_EXPORT time64_t ar_entry_get_filetime(ar_archive *ar); +/* WARNING: don't manually seek in the stream between ar_parse_entry and the last corresponding ar_entry_uncompress call! */ +/* uncompresses the next 'count' bytes of the current entry into buffer; returns false on error */ +UNARR_EXPORT bool ar_entry_uncompress(ar_archive *ar, void *buffer, size_t count); + +/* copies at most 'count' bytes of the archive's global comment (if any) into buffer; returns the actual amout of bytes copied (or, if 'buffer' is NULL, the required buffer size) */ +UNARR_EXPORT size_t ar_get_global_comment(ar_archive *ar, void *buffer, size_t count); + +/***** rar/rar *****/ + +/* checks whether 'stream' could contain RAR data and prepares for archive listing/extraction; returns NULL on failure */ +UNARR_EXPORT ar_archive *ar_open_rar_archive(ar_stream *stream); + +/***** tar/tar *****/ + +/* checks whether 'stream' could contain TAR data and prepares for archive listing/extraction; returns NULL on failure */ +UNARR_EXPORT ar_archive *ar_open_tar_archive(ar_stream *stream); + +/***** zip/zip *****/ + +/* checks whether 'stream' could contain ZIP data and prepares for archive listing/extraction; returns NULL on failure */ +/* set deflatedonly for extracting XPS, EPUB, etc. documents where non-Deflate compression methods are not supported by specification */ +UNARR_EXPORT ar_archive *ar_open_zip_archive(ar_stream *stream, bool deflatedonly); + +/***** _7z/_7z *****/ + +/* checks whether 'stream' could contain 7Z data and prepares for archive listing/extraction; returns NULL on failure */ +UNARR_EXPORT ar_archive *ar_open_7z_archive(ar_stream *stream); + +#ifdef __cplusplus +} +#endif + +#endif //unarr_h diff --git a/dependencies/unarr/win/unarr.h b/dependencies/unarr/win/unarr.h new file mode 100644 index 00000000..4999fd55 --- /dev/null +++ b/dependencies/unarr/win/unarr.h @@ -0,0 +1,130 @@ +/* Copyright 2015 the unarr project authors (see AUTHORS file). + License: LGPLv3 */ + +#ifndef unarr_h +#define unarr_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + + +/* macros for shared library usage */ + +#if defined (UNARR_IS_SHARED_LIBRARY) +#if defined (_WIN32) + +#if defined (UNARR_EXPORT_SYMBOLS) +#define UNARR_EXPORT __declspec(dllexport) +#else +#define UNARR_EXPORT __declspec(dllimport) +#endif // UNARR_EXPORT_SYMBOLS + +#else // _WIN32 + +#if defined (UNARR_EXPORT_SYMBOLS) +#define UNARR_EXPORT __attribute__((visibility("default"))) +#else +#define UNARR_EXPORT +#endif // UNARR_EXPORT_SYMBOLS +#endif // _WIN32 + +#else // defined UNARR_IS_SHARED_LIBRARY +#define UNARR_EXPORT + +#endif // UNARR_IS_SHARED_LIBRARY + + +typedef int64_t off64_t; +typedef int64_t time64_t; + +#define UNARR_API_VERSION 100 + +/***** common/stream *****/ + +typedef struct ar_stream_s ar_stream; + +/* opens a read-only stream for the given file path; returns NULL on error */ +UNARR_EXPORT ar_stream *ar_open_file(const char *path); +#ifdef _WIN32 +UNARR_EXPORT ar_stream *ar_open_file_w(const wchar_t *path); +#endif +/* opens a read-only stream for the given chunk of memory; the pointer must be valid until ar_close is called */ +UNARR_EXPORT ar_stream *ar_open_memory(const void *data, size_t datalen); +#ifdef _WIN32 +typedef struct IStream IStream; +/* opens a read-only stream based on the given IStream */ +UNARR_EXPORT ar_stream *ar_open_istream(IStream *stream); +#endif + +/* closes the stream and releases underlying resources */ +UNARR_EXPORT void ar_close(ar_stream *stream); +/* tries to read 'count' bytes into buffer, advancing the read offset pointer; returns the actual number of bytes read */ +UNARR_EXPORT size_t ar_read(ar_stream *stream, void *buffer, size_t count); +/* moves the read offset pointer (same as fseek); returns false on failure */ +UNARR_EXPORT bool ar_seek(ar_stream *stream, off64_t offset, int origin); +/* shortcut for ar_seek(stream, count, SEEK_CUR); returns false on failure */ +UNARR_EXPORT bool ar_skip(ar_stream *stream, off64_t count); +/* returns the current read offset (or 0 on error) */ +UNARR_EXPORT off64_t ar_tell(ar_stream *stream); + +/***** common/unarr *****/ + +typedef struct ar_archive_s ar_archive; + +/* frees all data stored for the given archive; does not close the underlying stream */ +UNARR_EXPORT void ar_close_archive(ar_archive *ar); +/* reads the next archive entry; returns false on error or at the end of the file (use ar_at_eof to distinguish the two cases) */ +UNARR_EXPORT bool ar_parse_entry(ar_archive *ar); +/* reads the archive entry at the given offset as returned by ar_entry_get_offset (offset 0 always restarts at the first entry); should always succeed */ +UNARR_EXPORT bool ar_parse_entry_at(ar_archive *ar, off64_t offset); +/* reads the (first) archive entry associated with the given name; returns false if the entry couldn't be found */ +UNARR_EXPORT bool ar_parse_entry_for(ar_archive *ar, const char *entry_name); +/* returns whether the last ar_parse_entry call has reached the file's expected end */ +UNARR_EXPORT bool ar_at_eof(ar_archive *ar); + +/* returns the name of the current entry as UTF-8 string; this pointer is only valid until the next call to ar_parse_entry; returns NULL on failure */ +UNARR_EXPORT const char *ar_entry_get_name(ar_archive *ar); +/* returns the stream offset of the current entry for use with ar_parse_entry_at */ +UNARR_EXPORT off64_t ar_entry_get_offset(ar_archive *ar); +/* returns the total size of uncompressed data of the current entry; read exactly that many bytes using ar_entry_uncompress */ +UNARR_EXPORT size_t ar_entry_get_size(ar_archive *ar); +/* returns the stored modification date of the current entry in 100ns since 1601/01/01 */ +UNARR_EXPORT time64_t ar_entry_get_filetime(ar_archive *ar); +/* WARNING: don't manually seek in the stream between ar_parse_entry and the last corresponding ar_entry_uncompress call! */ +/* uncompresses the next 'count' bytes of the current entry into buffer; returns false on error */ +UNARR_EXPORT bool ar_entry_uncompress(ar_archive *ar, void *buffer, size_t count); + +/* copies at most 'count' bytes of the archive's global comment (if any) into buffer; returns the actual amout of bytes copied (or, if 'buffer' is NULL, the required buffer size) */ +UNARR_EXPORT size_t ar_get_global_comment(ar_archive *ar, void *buffer, size_t count); + +/***** rar/rar *****/ + +/* checks whether 'stream' could contain RAR data and prepares for archive listing/extraction; returns NULL on failure */ +UNARR_EXPORT ar_archive *ar_open_rar_archive(ar_stream *stream); + +/***** tar/tar *****/ + +/* checks whether 'stream' could contain TAR data and prepares for archive listing/extraction; returns NULL on failure */ +UNARR_EXPORT ar_archive *ar_open_tar_archive(ar_stream *stream); + +/***** zip/zip *****/ + +/* checks whether 'stream' could contain ZIP data and prepares for archive listing/extraction; returns NULL on failure */ +/* set deflatedonly for extracting XPS, EPUB, etc. documents where non-Deflate compression methods are not supported by specification */ +UNARR_EXPORT ar_archive *ar_open_zip_archive(ar_stream *stream, bool deflatedonly); + +/***** _7z/_7z *****/ + +/* checks whether 'stream' could contain 7Z data and prepares for archive listing/extraction; returns NULL on failure */ +UNARR_EXPORT ar_archive *ar_open_7z_archive(ar_stream *stream); + +#ifdef __cplusplus +} +#endif + +#endif //unarr_h diff --git a/dependencies/unarr/win/x64/unarr.dll b/dependencies/unarr/win/x64/unarr.dll new file mode 100644 index 00000000..02ba76bb Binary files /dev/null and b/dependencies/unarr/win/x64/unarr.dll differ diff --git a/dependencies/unarr/win/x64/unarr.lib b/dependencies/unarr/win/x64/unarr.lib new file mode 100644 index 00000000..8307c439 Binary files /dev/null and b/dependencies/unarr/win/x64/unarr.lib differ diff --git a/dependencies/unarr/win/x86/unarr.dll b/dependencies/unarr/win/x86/unarr.dll new file mode 100644 index 00000000..8d04bddb Binary files /dev/null and b/dependencies/unarr/win/x86/unarr.dll differ diff --git a/dependencies/unarr/win/x86/unarr.lib b/dependencies/unarr/win/x86/unarr.lib new file mode 100644 index 00000000..d19b74cd Binary files /dev/null and b/dependencies/unarr/win/x86/unarr.lib differ diff --git a/generateVS2010Projects.bat b/generateVS2010Projects.bat deleted file mode 100644 index 23f8ce59..00000000 --- a/generateVS2010Projects.bat +++ /dev/null @@ -1,31 +0,0 @@ - -echo Setting up a Qt environment... - -set QTDIR=D:\Desarrollo\Qt\4.8.5 -echo -- QTDIR set to D:\Desarrollo\Qt\4.8.5 -set PATH=D:\Desarrollo\Qt\4.8.5\bin;%PATH% -echo -- Added D:\Desarrollo\Qt\4.8.5\bin to PATH -set QMAKESPEC=win32-msvc2010 -echo -- QMAKESPEC set to "win32-msvc2010" - -if not "%1"=="vsvars" goto ENDVSVARS -call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" -:ENDVSVARS - -if not "%1"=="vsstart" goto ENDVSSTART -call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" -devenv /useenv -:ENDVSSTART - - -cd YACReader -echo Entering YACReader -qmake -spec win32-msvc2010 -tp vc YACReader.pro -echo qmake -spec win32-msvc2010 -tp vc YACReader.pro -cd .. -echo leaving YACReader -cd YACReaderLibrary -echo Entering YACReaderLibrary -qmake -spec win32-msvc2010 -tp vc YACReaderLibrary.pro -echo qmake -spec win32-msvc2010 -tp vc YACReaderLibrary.pro -cd .. \ No newline at end of file diff --git a/images/YACReader.png b/images/YACReader.png new file mode 100644 index 00000000..32e007a3 Binary files /dev/null and b/images/YACReader.png differ diff --git a/images/YACReaderLibrary.png b/images/YACReaderLibrary.png new file mode 100644 index 00000000..f52e5dea Binary files /dev/null and b/images/YACReaderLibrary.png differ diff --git a/images/importBottomCoversDecoration.png b/images/importBottomCoversDecoration.png index 3e0b2906..7508ce17 100644 Binary files a/images/importBottomCoversDecoration.png and b/images/importBottomCoversDecoration.png differ diff --git a/images/main_toolbar/info_osx.png b/images/main_toolbar/info_osx.png new file mode 100644 index 00000000..17168990 Binary files /dev/null and b/images/main_toolbar/info_osx.png differ diff --git a/images/main_toolbar/info_osx@2x.png b/images/main_toolbar/info_osx@2x.png new file mode 100644 index 00000000..4f78fefb Binary files /dev/null and b/images/main_toolbar/info_osx@2x.png differ diff --git a/mktarball.sh b/mktarball.sh index 774cf038..f1ee73c5 100755 --- a/mktarball.sh +++ b/mktarball.sh @@ -2,11 +2,7 @@ #Script to create a source tarball for YACReader distribution and packaging #This should be run from YACReaders top source directory -YACVERSION=8.6 -if [ -f Makefile ] -then - make distclean -fi +YACVERSION=9.0.0-rc1 if [ ! -f "yacreader-${YACVERSION}-src.tar.xz" ] then echo "Building source tarball" @@ -14,9 +10,11 @@ else echo "Updating source tarball" rm yacreader-${YACVERSION}-src.tar* #delete old tarball, since tar can't update compressed archives fi -#Use tar's --exclude feature to make sure we get a pristine tar for distribution. -#Exclude all version control system related files and rename the top directory in the tarball using --transform. -tar cfJ yacreader-${YACVERSION}-src.tar.xz --exclude '*.rej' --exclude '*.orig' --exclude '*.gch' --exclude 'dependencies' --exclude '*.o' \ ---exclude 'yacreader*tar*' --exclude '.hg*' --exclude 'lib7zip' --exclude 'libp7zip' --exclude 'unarr-master' --exclude-vcs ./* --transform s/./yacreader-${YACVERSION}/ -#Calculate checksum to enable packagers to verify whether they are using the original tarball. -md5sum yacreader-${YACVERSION}-src.tar.xz > yacreader-${YACVERSION}-src.tar.xz.md5sum \ No newline at end of file + +hg archive -t tar -p yacreader-${YACVERSION} -X "dependencies/{unarr,pdfium,poppler}"\ + yacreader-${YACVERSION}-src.tar +xz -c yacreader-${YACVERSION}-src.tar > yacreader-${YACVERSION}-src.tar.xz +rm yacreader-${YACVERSION}-src.tar + +#Calculate checksum to enable packagers to verify whether they are using the original tarball. +md5sum yacreader-${YACVERSION}-src.tar.xz > yacreader-${YACVERSION}-src.tar.xz.md5sum diff --git a/release/languages/yacreader_de.qm b/release/languages/yacreader_de.qm index 0d4bdacd..8555ad8f 100644 Binary files a/release/languages/yacreader_de.qm and b/release/languages/yacreader_de.qm differ diff --git a/release/languages/yacreader_es.qm b/release/languages/yacreader_es.qm index b2cee2ed..dee4d73e 100644 Binary files a/release/languages/yacreader_es.qm and b/release/languages/yacreader_es.qm differ diff --git a/release/languages/yacreader_fr.qm b/release/languages/yacreader_fr.qm index cdce6a89..0865e7be 100644 Binary files a/release/languages/yacreader_fr.qm and b/release/languages/yacreader_fr.qm differ diff --git a/release/languages/yacreader_nl.qm b/release/languages/yacreader_nl.qm index aa7de11d..1f83ab78 100644 Binary files a/release/languages/yacreader_nl.qm and b/release/languages/yacreader_nl.qm differ diff --git a/release/languages/yacreader_pt.qm b/release/languages/yacreader_pt.qm index 7a52c016..6a80afc3 100644 Binary files a/release/languages/yacreader_pt.qm and b/release/languages/yacreader_pt.qm differ diff --git a/release/languages/yacreader_ru.qm b/release/languages/yacreader_ru.qm index 48657328..ebc56e18 100644 Binary files a/release/languages/yacreader_ru.qm and b/release/languages/yacreader_ru.qm differ diff --git a/release/languages/yacreader_tr.qm b/release/languages/yacreader_tr.qm index 6f965538..58ab806d 100644 Binary files a/release/languages/yacreader_tr.qm and b/release/languages/yacreader_tr.qm differ diff --git a/release/languages/yacreaderlibrary_de.qm b/release/languages/yacreaderlibrary_de.qm index 4fc47c8a..acdeea0e 100644 Binary files a/release/languages/yacreaderlibrary_de.qm and b/release/languages/yacreaderlibrary_de.qm differ diff --git a/release/languages/yacreaderlibrary_es.qm b/release/languages/yacreaderlibrary_es.qm index 370934a5..84b2eb73 100644 Binary files a/release/languages/yacreaderlibrary_es.qm and b/release/languages/yacreaderlibrary_es.qm differ diff --git a/release/languages/yacreaderlibrary_fr.qm b/release/languages/yacreaderlibrary_fr.qm index 52ac0747..5ddabbed 100644 Binary files a/release/languages/yacreaderlibrary_fr.qm and b/release/languages/yacreaderlibrary_fr.qm differ diff --git a/release/languages/yacreaderlibrary_nl.qm b/release/languages/yacreaderlibrary_nl.qm index ef8a4669..d918320f 100644 Binary files a/release/languages/yacreaderlibrary_nl.qm and b/release/languages/yacreaderlibrary_nl.qm differ diff --git a/release/languages/yacreaderlibrary_pt.qm b/release/languages/yacreaderlibrary_pt.qm index 1fcb82da..3612c878 100644 Binary files a/release/languages/yacreaderlibrary_pt.qm and b/release/languages/yacreaderlibrary_pt.qm differ diff --git a/release/languages/yacreaderlibrary_ru.qm b/release/languages/yacreaderlibrary_ru.qm index e3562bfc..133742cc 100644 Binary files a/release/languages/yacreaderlibrary_ru.qm and b/release/languages/yacreaderlibrary_ru.qm differ diff --git a/release/languages/yacreaderlibrary_tr.qm b/release/languages/yacreaderlibrary_tr.qm index f9493959..ec945b7b 100644 Binary files a/release/languages/yacreaderlibrary_tr.qm and b/release/languages/yacreaderlibrary_tr.qm differ diff --git a/releaseOSX.sh b/releaseOSX.sh index 6eafa3e9..30fd7a03 100755 --- a/releaseOSX.sh +++ b/releaseOSX.sh @@ -1,17 +1,42 @@ #!/bin/bash -/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/macdeployqt YACReader.app -/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/macdeployqt YACReaderLibrary.app -qmldir=./YACReaderLibrary/qml -/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/macdeployqt YACReaderLibraryServer.app +hash macdeployqt 2>/dev/null || { echo >&2 "Qmake command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; } -cp -R ./utils ./YACReader.app/Contents/MacOS/ -cp -R ./utils ./YACReaderLibrary.app/Contents/MacOS/ -cp -R ./utils ./YACReaderLibraryServer.app/Contents/MacOS/ -cp -R ./release/server ./YACReaderLibrary.app/Contents/MacOS/ -cp -R ./release/server ./YACReaderLibraryServer.app/Contents/MacOS/ -cp -R ./release/languages ./YACReader.app/Contents/MacOS/ -cp -R ./release/languages ./YACReaderLibrary.app/Contents/MacOS/ -cp -R ./release/languages ./YACReaderLibraryServer.app/Contents/MacOS/ +macdeployqt YACReader.app +macdeployqt YACReaderLibrary.app -qmldir=YACReaderLibrary/qml +macdeployqt YACReaderLibraryServer.app +#TODO: This copies unneeded stuff into the respective apps +#cp -R utils YACReader.app/Contents/MacOS/ +#cp -R utils YACReaderLibrary.app/Contents/MacOS/ +#cp -R utils YACReaderLibraryServer.app/Contents/MacOS/ + +mkdir -p YACReaderLibrary.app/Contents/MacOS/utils + +cp -L /usr/local/bin/qrencode YACReaderLibrary.app/Contents/MacOS/utils/ +#TODO: avoid using fixed paths here. Get the info from otool instead! + +cp /usr/local/Cellar/qrencode/3.4.4/lib/libqrencode.3.dylib \ +YACReaderLibrary.app/Contents/MacOS/utils + +cp /usr/local/opt/libpng/lib/libpng16.16.dylib \ +YACReaderLibrary.app/Contents/MacOS/utils + +chmod +w YACReaderLibrary.app/Contents/MacOS/utils/* + +install_name_tool -change /usr/local/Cellar/qrencode/3.4.4/lib/libqrencode.3.dylib \ +@executable_path/utils/libqrencode.3.dylib \ +YACReaderLibrary.app/Contents/MacOS/utils/qrencode + +install_name_tool -change /usr/local/opt/libpng/libpng16.16.dylib \ +@executable_path/utils/libpng16.16.dylib \ +YACReaderLibrary.app/Contents/MacOS/utils/qrencode + +cp -R release/server YACReaderLibrary.app/Contents/MacOS/ +cp -R release/server YACReaderLibraryServer.app/Contents/MacOS/ +cp -R release/languages YACReader.app/Contents/MacOS/ +cp -R release/languages YACReaderLibrary.app/Contents/MacOS/ +cp -R release/languages YACReaderLibraryServer.app/Contents/MacOS/ + +echo "Copied!" #./signapps.sh - diff --git a/shortcuts_management/shortcuts_manager.cpp b/shortcuts_management/shortcuts_manager.cpp index 33e5be92..9286b1ed 100644 --- a/shortcuts_management/shortcuts_manager.cpp +++ b/shortcuts_management/shortcuts_manager.cpp @@ -31,6 +31,7 @@ void ShortcutsManager::initDefaultShorcuts() //COMMANDS (used in keypressevent) #else defaultShorcuts.insert(OPEN_ACTION_Y, Qt::Key_O); + defaultShorcuts.insert(OPEN_LATEST_COMIC_Y, Qt::CTRL | Qt::Key_R); defaultShorcuts.insert(OPEN_FOLDER_ACTION_Y, Qt::CTRL | Qt::Key_O); defaultShorcuts.insert(OPEN_PREVIOUS_COMIC_ACTION_Y, Qt::CTRL | Qt::Key_Left); defaultShorcuts.insert(OPEN_NEXT_COMIC_ACTION_Y, Qt::CTRL | Qt::Key_Right); diff --git a/shortcuts_management/shortcuts_manager.h b/shortcuts_management/shortcuts_manager.h index 24aa40ef..3094339b 100644 --- a/shortcuts_management/shortcuts_manager.h +++ b/shortcuts_management/shortcuts_manager.h @@ -113,6 +113,7 @@ public: #define FIT_TO_PAGE_ACTION_Y "FIT_TO_PAGE_ACTION_Y" #define SHOW_FLOW_ACTION_Y "SHOW_FLOW_ACTION_Y" #define SHOW_EDIT_SHORTCUTS_ACTION_Y "SHOW_EDIT_SHORTCUTS_ACTION_Y" +#define OPEN_LATEST_COMIC_Y "OPEN_LATEST_COMIC_Y" //COMMANDS YACReader //main_viewer_window @@ -125,6 +126,10 @@ public: //viewer #define AUTO_SCROLL_FORWARD_ACTION_Y "AUTO_SCROLL_FORWARD_ACTION_Y" #define AUTO_SCROLL_BACKWARD_ACTION_Y "AUTO_SCROLL_BACKWARD_ACTION_Y" +#define AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y "AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y" +#define AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y "AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y" +#define AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y "AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y" +#define AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y "AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y" #define MOVE_DOWN_ACTION_Y "MOVE_DOWN_ACTION_Y" #define MOVE_UP_ACTION_Y "MOVE_UP_ACTION_Y" #define MOVE_LEFT_ACTION_Y "MOVE_LEFT_ACTION_Y"