Compare commits

..

8 Commits

Author SHA1 Message Date
Jacopo De Simoi 440a91ee86 Use crosshairs instead of dots 5 years ago
Jacopo De Simoi 13bb9ad7f5 Draw dots closer together 5 years ago
Jacopo De Simoi e297f685c5 Pressure sensitivity from linear to exponential 5 years ago
Rémi Emonet 5dbd6f35f3 Linux build fix var name 5 years ago
Ulrich Huber 3b12856ea4
Merge pull request #2416 from xournalpp/revert-1808-master 5 years ago
Ulrich Huber 2e9e79e3e7 Revert "New icon app (#1808)" 5 years ago
rolandlo cf4000cf67 Fix scrolling bug after save 5 years ago
Luya Tshimbalanga c312a55be8
New icon app (#1808) 5 years ago
  1. 2
      readme/LinuxBuild.md
  2. 41
      src/control/FullscreenHandler.cpp
  3. 7
      src/control/jobs/BlockingJob.cpp
  4. 16
      src/control/zoom/ZoomControl.cpp
  5. 63
      src/gui/Layout.cpp
  6. 5
      src/gui/MainWindow.cpp
  7. 3
      src/gui/XournalView.cpp
  8. 3
      src/gui/inputdevices/AbstractInputHandler.cpp
  9. 4
      src/gui/widgets/XournalWidget.cpp
  10. 10
      src/view/background/DottedBackgroundPainter.cpp
  11. 2
      ui/main.glade

@ -114,7 +114,7 @@ package and then use that with the `azure-pipelines/util/build_appimage.sh`
script.
```bash
cmake .. -DPACK_GENERATOR="TGZ"
cmake .. -DCPACK_GENERATOR="TGZ"
cmake --build . --target package
../azure-pipelines/util/build_appimage.sh
```

@ -21,14 +21,33 @@ void FullscreenHandler::hideWidget(MainWindow* win, const string& widgetName) {
}
if ("mainMenubar" == widgetName) {
// If the menu is hidden, shortcuts are not working anymore
// therefore the menu is not hidden, it's displayed, but invisible
// this costs 1px at the bottom, even if the preferred size is 0px,
// 1px is used by GTK
GtkWidget* mainMenubar = win->get("mainMenubar");
GtkWidget* mainBox = win->get("mainBox");
if (mainMenubar == nullptr || !gtk_widget_is_visible(mainMenubar)) {
// Menu not visible (global menu or something like this)
return;
}
gtk_widget_hide(mainMenubar);
// Remove menu from parent
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(mainMenubar)), mainMenubar);
GtkWidget* fix = gtk_invisible_new();
gtk_widget_set_size_request(fix, 0, 0);
gtk_fixed_put(GTK_FIXED(fix), mainMenubar, 0, 0);
gtk_widget_show(fix);
gtk_box_pack_end(GTK_BOX(mainBox), fix, false, false, 0);
menubarHidden = true;
return;
}
}
@ -57,9 +76,23 @@ void FullscreenHandler::disableFullscreen(MainWindow* win) {
if (this->menubarHidden) {
GtkWidget* mainMenubar = win->get("mainMenubar");
if (mainMenubar != nullptr) {
gtk_widget_show(mainMenubar);
}
GtkWidget* mainBox = win->get("mainBox");
GtkWidget* parent = gtk_widget_get_parent(mainMenubar);
// Remove menu from parent
gtk_container_remove(GTK_CONTAINER(parent), mainMenubar);
gtk_box_pack_start(GTK_BOX(mainBox), mainMenubar, false, true, 0);
GValue value = G_VALUE_INIT;
g_value_init(&value, G_TYPE_INT);
g_value_set_int(&value, 0);
gtk_container_child_set_property(GTK_CONTAINER(mainBox), mainMenubar, "position", &value);
// not needed, will be recreated next time
gtk_widget_destroy(parent);
menubarHidden = false;
}
}

@ -2,6 +2,7 @@
#include "control/Control.h"
#include "control/xojfile/SaveHandler.h"
#include "gui/XournalView.h"
BlockingJob::BlockingJob(Control* control, const string& name): control(control) { control->block(name); }
@ -16,7 +17,11 @@ void BlockingJob::execute() {
auto BlockingJob::finished(Control* control) -> bool {
// "this" is not needed, "control" is in
// the closure, therefore no sync needed
Util::execInUiThread([=]() { control->unblock(); });
Util::execInUiThread([=]() {
control->unblock();
XournalView* xournal = control->getWindow()->getXournal();
gtk_widget_grab_focus(xournal->getWidget());
});
// do not call again
return false;

@ -142,8 +142,6 @@ void ZoomControl::setZoom100Value(double zoom100Val) {
auto ZoomControl::updateZoomFitValue(size_t pageNo) -> bool { return updateZoomFitValue(getVisibleRect(), pageNo); }
constexpr double SPACE_FOR_SCROLLBARS = 10.0;
auto ZoomControl::updateZoomFitValue(const Rectangle<double>& widget_rect, size_t pageNo) -> bool {
if (pageNo == 0) {
pageNo = view->getCurrentPage();
@ -153,7 +151,7 @@ auto ZoomControl::updateZoomFitValue(const Rectangle<double>& widget_rect, size_
return false;
}
double zoom_fit_width = widget_rect.width / (page->getWidth() + SPACE_FOR_SCROLLBARS);
double zoom_fit_width = widget_rect.width / (page->getWidth() + 20.0);
if (zoom_fit_width < this->zoomMin || zoom_fit_width > this->zoomMax) {
return false;
}
@ -176,8 +174,8 @@ auto ZoomControl::updateZoomPresentationValue(size_t pageNo) -> bool {
}
Rectangle widget_rect = getVisibleRect();
double zoom_fit_width = widget_rect.width / page->getWidth();
double zoom_fit_height = widget_rect.height / page->getHeight();
double zoom_fit_width = widget_rect.width / (page->getWidth() + 14.0);
double zoom_fit_height = widget_rect.height / (page->getHeight() + 14.0);
double zoom_presentation = zoom_fit_width < zoom_fit_height ? zoom_fit_width : zoom_fit_height;
if (zoom_presentation < this->zoomMin) {
return false;
@ -245,9 +243,13 @@ void ZoomControl::setZoomPresentationMode(bool isZoomPresentationMode) {
auto ZoomControl::isZoomPresentationMode() const -> bool { return this->zoomPresentationMode; }
void ZoomControl::setZoomStep(double zoomStep) { this->zoomStep = zoomStep * this->zoom100Value; }
void ZoomControl::setZoomStep(double zoomStep) {
this->zoomStep = zoomStep * this->zoom100Value;
}
void ZoomControl::setZoomStepScroll(double zoomStep) { this->zoomStepScroll = zoomStep * this->zoom100Value; }
void ZoomControl::setZoomStepScroll(double zoomStep) {
this->zoomStepScroll = zoomStep * this->zoom100Value;
}
void ZoomControl::pageSizeChanged(size_t page) {
updateZoomPresentationValue(page);

@ -133,17 +133,6 @@ inline auto sumIf(size_t base, size_t addend, bool predicate) -> size_t {
void Layout::recalculate() {
size_t padding = 0;
size_t paddingBetween = 0;
size_t roomForShadow = 0;
if (!view->getControl()->getZoomControl()->isZoomPresentationMode()) {
padding = XOURNAL_PADDING;
paddingBetween = XOURNAL_PADDING_BETWEEN;
roomForShadow = XOURNAL_ROOM_FOR_SHADOW;
}
auto* settings = view->getControl()->getSettings();
size_t len = view->viewPages.size();
mapper.configureFromSettings(len, settings);
@ -163,11 +152,13 @@ void Layout::recalculate() {
}
// add space around the entire page area to accomodate older Wacom tablets with limited sense area.
size_t const vPadding = sumIf(padding, settings->getAddVerticalSpaceAmount(), settings->getAddVerticalSpace());
size_t const hPadding = sumIf(padding, settings->getAddHorizontalSpaceAmount(), settings->getAddHorizontalSpace());
size_t const vPadding =
sumIf(XOURNAL_PADDING, settings->getAddVerticalSpaceAmount(), settings->getAddVerticalSpace());
size_t const hPadding =
sumIf(XOURNAL_PADDING, settings->getAddHorizontalSpaceAmount(), settings->getAddHorizontalSpace());
minWidth = 2 * hPadding + (widthCols.size() - 1) * paddingBetween;
minHeight = 2 * vPadding + (heightRows.size() - 1) * paddingBetween;
minWidth = 2 * hPadding + (widthCols.size() - 1) * XOURNAL_PADDING_BETWEEN;
minHeight = 2 * vPadding + (heightRows.size() - 1) * XOURNAL_PADDING_BETWEEN;
minWidth = std::accumulate(begin(widthCols), end(widthCols), minWidth);
minHeight = std::accumulate(begin(heightRows), end(heightRows), minHeight);
@ -182,16 +173,6 @@ void Layout::layoutPages(int width, int height) {
}
valid = false;
size_t padding = 0;
size_t paddingBetween = 0;
size_t roomForShadow = 0;
if (!view->getControl()->getZoomControl()->isZoomPresentationMode()) {
padding = XOURNAL_PADDING;
paddingBetween = XOURNAL_PADDING_BETWEEN;
roomForShadow = XOURNAL_ROOM_FOR_SHADOW;
}
size_t const len = this->view->viewPages.size();
Settings* settings = this->view->getControl()->getSettings();
@ -203,9 +184,10 @@ void Layout::layoutPages(int width, int height) {
// add space around the entire page area to accomodate older Wacom tablets with limited sense area.
int64_t const v_padding = sumIf(padding, settings->getAddVerticalSpaceAmount(), settings->getAddVerticalSpace());
int64_t const v_padding =
sumIf(XOURNAL_PADDING, settings->getAddVerticalSpaceAmount(), settings->getAddVerticalSpace());
int64_t const h_padding =
sumIf(padding, settings->getAddHorizontalSpaceAmount(), settings->getAddHorizontalSpace());
sumIf(XOURNAL_PADDING, settings->getAddHorizontalSpaceAmount(), settings->getAddHorizontalSpace());
int64_t const centeringXBorder = static_cast<int64_t>(width - minWidth) / 2;
int64_t const centeringYBorder = static_cast<int64_t>(height - minHeight) / 2;
@ -239,15 +221,15 @@ void Layout::layoutPages(int width, int height) {
// pair pages mode
if (c % 2 == 0) {
// align right
paddingLeft = paddingBetween - roomForShadow + columnPadding;
paddingRight = roomForShadow;
paddingLeft = XOURNAL_PADDING_BETWEEN - XOURNAL_ROOM_FOR_SHADOW + columnPadding;
paddingRight = XOURNAL_ROOM_FOR_SHADOW;
} else { // align left
paddingLeft = roomForShadow;
paddingRight = paddingBetween - roomForShadow + columnPadding;
paddingLeft = XOURNAL_ROOM_FOR_SHADOW;
paddingRight = XOURNAL_PADDING_BETWEEN - XOURNAL_ROOM_FOR_SHADOW + columnPadding;
}
} else { // not paired page mode - center
paddingLeft = paddingBetween / 2 + columnPadding / 2; // center justify
paddingRight = paddingBetween - paddingLeft + columnPadding / 2;
} else { // not paired page mode - center
paddingLeft = XOURNAL_PADDING_BETWEEN / 2 + columnPadding / 2; // center justify
paddingRight = XOURNAL_PADDING_BETWEEN - paddingLeft + columnPadding / 2;
}
x += paddingLeft;
@ -258,23 +240,23 @@ void Layout::layoutPages(int width, int height) {
x += vDisplayWidth + paddingRight;
}
} else {
x += this->widthCols[c] + paddingBetween;
x += this->widthCols[c] + XOURNAL_PADDING_BETWEEN;
}
}
x = borderX;
y += this->heightRows[r] + paddingBetween;
y += this->heightRows[r] + XOURNAL_PADDING_BETWEEN;
}
int64_t totalWidth = borderX;
for (auto&& widthCol: this->widthCols) {
// accumulated - absolute pixel location for use by getViewAt() and updateVisibility()
totalWidth += widthCol + paddingBetween;
totalWidth += widthCol + XOURNAL_PADDING_BETWEEN;
widthCol = totalWidth;
}
int64_t totalHeight = borderY;
for (auto&& heightRow: this->heightRows) {
totalHeight += heightRow + paddingBetween;
totalHeight += heightRow + XOURNAL_PADDING_BETWEEN;
heightRow = totalHeight;
}
}
@ -303,9 +285,8 @@ void Layout::scrollAbs(double x, double y) {
void Layout::ensureRectIsVisible(int x, int y, int width, int height) {
int offset = (this->view->getControl()->getSettings()->isPresentationMode()) ? 0 : XOURNAL_PADDING / 2;
gtk_adjustment_clamp_page(scrollHandling->getHorizontal(), x - offset, x + width + 2 * offset);
gtk_adjustment_clamp_page(scrollHandling->getVertical(), y - offset, y + height + 2 * offset);
gtk_adjustment_clamp_page(scrollHandling->getHorizontal(), x - 5, x + width + 10);
gtk_adjustment_clamp_page(scrollHandling->getVertical(), y - 5, y + height + 10);
}

@ -497,6 +497,11 @@ auto MainWindow::onKeyPressCallback(GtkWidget* widget, GdkEventKey* event, MainW
// editing text - give that control
return false;
}
if (event->keyval == GDK_KEY_Escape) {
win->getControl()->getSearchBar()->showSearchBar(false);
return true;
}
return false;
}

@ -139,8 +139,6 @@ auto XournalView::onKeyPressEvent(GdkEventKey* event) -> bool {
if (event->keyval == GDK_KEY_Escape) {
if (control->isFullscreen()) {
control->setFullscreen(false);
control->setViewPresentationMode(false);
control->getWindow()->setToolbarVisible(true);
return true;
}
}
@ -150,7 +148,6 @@ auto XournalView::onKeyPressEvent(GdkEventKey* event) -> bool {
if (!control->isFullscreen()) {
control->setViewPresentationMode(true);
control->setFullscreen(true);
control->getWindow()->setToolbarVisible(false);
return true;
}
}

@ -7,6 +7,7 @@
#include "gui/XournalppCursor.h"
#include "InputContext.h"
#include <cmath>
AbstractInputHandler::AbstractInputHandler(InputContext* inputContext) { this->inputContext = inputContext; }
@ -75,7 +76,7 @@ auto AbstractInputHandler::getInputDataRelativeToCurrentPage(XojPageView* page,
pos.pressure = Point::NO_PRESSURE;
if (this->inputContext->getSettings()->isPressureSensitivity()) {
pos.pressure = event.pressure;
pos.pressure = 1-exp(- event.pressure/0.2);
}
pos.state = this->inputContext->getModifierState();

@ -301,9 +301,7 @@ static auto gtk_xournal_draw(GtkWidget* widget, cairo_t* cr) -> gboolean {
continue;
}
if (!xournal->view->getControl()->getZoomControl()->isZoomPresentationMode()) {
gtk_xournal_draw_shadow(xournal, cr, px, py, pw, ph, pv->isSelected());
}
gtk_xournal_draw_shadow(xournal, cr, px, py, pw, ph, pv->isSelected());
cairo_save(cr);
cairo_translate(cr, px, py);

@ -8,8 +8,8 @@ DottedBackgroundPainter::~DottedBackgroundPainter() = default;
void DottedBackgroundPainter::resetConfig() {
this->foregroundColor1 = 0xBDBDBDU;
this->lineWidth = 1.5;
this->drawRaster1 = 14.17;
this->lineWidth = 1;
this->drawRaster1 = 10;
}
void DottedBackgroundPainter::paint() {
@ -26,8 +26,10 @@ void DottedBackgroundPainter::paintBackgroundDotted() {
auto pos = [dr1 = drawRaster1](int i) { return dr1 + i * dr1; };
for (int x = 0; pos(x) < width; ++x) {
for (int y = 0; pos(y) < height; ++y) {
cairo_move_to(cr, pos(x), pos(y));
cairo_line_to(cr, pos(x), pos(y));
cairo_move_to(cr, pos(x-lineWidth), pos(y));
cairo_line_to(cr, pos(x+lineWidth), pos(y));
cairo_move_to(cr, pos(x), pos(y-lineWidth));
cairo_line_to(cr, pos(x), pos(y+lineWidth));
}
}

@ -2284,7 +2284,7 @@
<child>
<object class="GtkBox" id="searchBar">
<property name="name">searchBar</property>
<property name="visible">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>

Loading…
Cancel
Save