diff --git a/CMakeLists.txt b/CMakeLists.txt index 568d73d7..451e7a33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,9 +117,13 @@ if (LSB_RELEASE_ID_SHORT STREQUAL "Ubuntu" AND LSB_RELEASE_NUMBER_SHORT STREQUAL message ("Automatically set BUILD_POPPLER ON on Ubuntu 16.04") endif() +set (POPPLER_MIN_VER "0.58") +set (POPPLER_MAX_VER "0.68") +set (POPPLER_BUILD_FROM "git" CACHE STRING "Source to build poppler from: git (default), tarball, sourcefolder") set (POPPLER_GIT_VER "0.61.1" CACHE STRING "Version of Poppler to build") -option (POPPLER_GIT "Use git version of Poppler" ON) -set(POPPLER_DIR "/path/to/poppler/source" CACHE STRING "Directory with poppler") +set (POPPLER_SRC_DIR "/path/to/poppler/source" CACHE STRING "Directory with poppler source") +set (POPPLER_SRC_TARXZ "/path/to/poppler.tar.xz" CACHE STRING "Tarball file location") + if (BUILD_POPPLER) # For documentation see https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling set(POPPLER_LIB_DIR ${CMAKE_INSTALL_PREFIX}/bin/xournalpplib) @@ -129,8 +133,7 @@ if (BUILD_POPPLER) include (ExternalProject) set (POPPLER_PREFIX "${CMAKE_BINARY_DIR}/poppler-prefix") set (POPPLER_CMAKE_ARGS "-DBUILD_QT5_TESTS=OFF -DENABLE_UTILS=OFF -DENABLE_QT5=OFF -DENABLE_QT4=OFF -DBUILD_QT4_TESTS=OFF") - if (POPPLER_GIT) - + if (POPPLER_BUILD_FROM STREQUAL "git") ExternalProject_Add (poppler GIT_REPOSITORY "git://git.freedesktop.org/git/poppler/poppler" GIT_TAG "poppler-${POPPLER_GIT_VER}" @@ -139,14 +142,24 @@ if (BUILD_POPPLER) CMAKE_ARGS ${POPPLER_CMAKE_ARGS} INSTALL_COMMAND "" ) - else () - ExternalProject_Add (poppler - SOURCE_DIR "${POPPLER_DIR}" + elseif (POPPLER_BUILD_FROM STREQUAL "sourcefolder") + ExternalProject_Add (poppler + SOURCE_DIR "${POPPLER_SRC_DIR}" PREFIX "${POPPLER_PREFIX}" CMAKE_ARGS ${POPPLER_CMAKE_ARGS} INSTALL_COMMAND "" ) + elseif (POPPLER_BUILD_FROM STREQUAL "tarball") + ExternalProject_Add (poppler + URL "${POPPLER_SRC_TARXZ}" + PREFIX "${POPPLER_PREFIX}" + + CMAKE_ARGS ${POPPLER_CMAKE_ARGS} + INSTALL_COMMAND "" + ) + else () + message (FATAL_ERROR "Source to build poppler from must be: git (default), sourcefolder or tarball") endif() # Additional packages required by Poppler @@ -207,9 +220,13 @@ if (BUILD_POPPLER) else () - find_package (Poppler 0.58.0) + find_package (Poppler) if (NOT POPPLER_FOUND) message (FATAL_ERROR "Poppler not found – you should enable BUILD_POPPLER CMake flag") + elseif (POPPLER_VERSION VERSION_LESS ${POPPLER_MIN_VER}) + message (FATAL_ERROR "Poppler too old - you should enable BUILD_POPPLER CMake flag") + elseif (POPPLER_VERSION VERSION_GREATER ${POPPLER_MAX_VER}) + message (FATAL_ERROR "Poppler too new, Xournalpp has not been adapted jet - you should enable BUILD_POPPLER CMake flag") endif (NOT POPPLER_FOUND) endif () diff --git a/src/gui/PageView.cpp b/src/gui/PageView.cpp index da92389d..56e91431 100644 --- a/src/gui/PageView.cpp +++ b/src/gui/PageView.cpp @@ -885,7 +885,7 @@ bool XojPageView::actionDelete() return false; } -void XojPageView::drawLoadingPage() +void XojPageView::drawLoadingPage(cairo_t* cr) { XOJ_CHECK_TYPE(XojPageView); @@ -895,24 +895,21 @@ void XojPageView::drawLoadingPage() int dispWidth = getDisplayWidth(); int dispHeight = getDisplayHeight(); - this->crBuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, dispWidth, dispHeight); - cairo_t* cr2 = cairo_create(this->crBuffer); - cairo_set_source_rgb(cr2, 1, 1, 1); - cairo_rectangle(cr2, 0, 0, dispWidth, dispHeight); - cairo_fill(cr2); + cairo_set_source_rgb(cr, 1, 1, 1); + cairo_rectangle(cr, 0, 0, dispWidth, dispHeight); + cairo_fill(cr); - cairo_scale(cr2, zoom, zoom); + cairo_scale(cr, zoom, zoom); + cairo_set_source_rgb(cr, 0.5, 0.5, 0.5); + cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); + cairo_set_font_size(cr, 32.0); cairo_text_extents_t ex; - cairo_set_source_rgb(cr2, 0.5, 0.5, 0.5); - cairo_select_font_face(cr2, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size(cr2, 32.0); - cairo_text_extents(cr2, txtLoading.c_str(), &ex); - cairo_move_to(cr2, (page->getWidth() - ex.width) / 2 - ex.x_bearing, - (page->getHeight() - ex.height) / 2 - ex.y_bearing); - cairo_show_text(cr2, txtLoading.c_str()); - - cairo_destroy(cr2); + cairo_text_extents(cr, txtLoading.c_str(), &ex); + cairo_move_to(cr, (page->getWidth() - ex.width) / 2 - ex.x_bearing, + (page->getHeight() - ex.height) / 2 - ex.y_bearing); + cairo_show_text(cr, txtLoading.c_str()); + rerenderPage(); } @@ -925,7 +922,8 @@ void XojPageView::paintPageSync(cairo_t* cr, GdkRectangle* rect) if (this->crBuffer == NULL) { - drawLoadingPage(); + drawLoadingPage(cr); + return; } double zoom = xournal->getZoom(); diff --git a/src/gui/PageView.h b/src/gui/PageView.h index d8c3701f..6b2412f4 100644 --- a/src/gui/PageView.h +++ b/src/gui/PageView.h @@ -168,7 +168,7 @@ private: void addRerenderRect(double x, double y, double width, double height); - void drawLoadingPage(); + void drawLoadingPage(cairo_t* cr); public: /** diff --git a/src/gui/dialog/SelectBackgroundColorDialog.cpp b/src/gui/dialog/SelectBackgroundColorDialog.cpp index eba9eaef..28257984 100644 --- a/src/gui/dialog/SelectBackgroundColorDialog.cpp +++ b/src/gui/dialog/SelectBackgroundColorDialog.cpp @@ -37,7 +37,7 @@ const int backgroundXournalCount = sizeof(backgroundXournal) / sizeof(GdkRGBA); SelectBackgroundColorDialog::SelectBackgroundColorDialog(Control* control) : control(control), - lastBackgroundColors({ + lastBackgroundColors{ RGBA_FROM_HEX(0xffffff), RGBA_FROM_HEX(0xffffff), RGBA_FROM_HEX(0xffffff), @@ -47,7 +47,7 @@ SelectBackgroundColorDialog::SelectBackgroundColorDialog(Control* control) RGBA_FROM_HEX(0xffffff), RGBA_FROM_HEX(0xffffff), RGBA_FROM_HEX(0xffffff) - }), + }, selected(-1) { XOJ_INIT_TYPE(SelectBackgroundColorDialog);