diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GsWidget.H | 2 | ||||
-rw-r--r-- | src/GsWidget.cxx | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/GsWidget.H b/src/GsWidget.H index 95a3242..a5d0fd1 100644 --- a/src/GsWidget.H +++ b/src/GsWidget.H @@ -30,6 +30,8 @@ class GsWidget : public Fl_Widget { int zoom_percent; int initial_width, initial_height; int feeding; + + void resize(); protected: int page; diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx index 71537e9..ad516b7 100644 --- a/src/GsWidget.cxx +++ b/src/GsWidget.cxx @@ -93,8 +93,7 @@ GsWidget::GsWidget(int X,int Y,int W, int H) : Fl_Widget(X, Y, W, H) { ydpi = 75 * zoom_percent / 100; paper_x = 594; // DIN A4 paper_y = 841; // - initial_width = W; - initial_height = H; + resize(); in_fd = -1; reload_needed = 0; dsc = NULL; @@ -141,6 +140,8 @@ int GsWidget::open_file(int fd) { paper_y = 841; // } + resize(); + page = 0; return 0; @@ -396,11 +397,11 @@ int GsWidget::zoom(int p) { offscreen = 0; } - w(initial_width * zoom_percent / 100); - h(initial_height * zoom_percent / 100); - xdpi = 75 * zoom_percent / 100; ydpi = 75 * zoom_percent / 100; + + resize(); + reload(); return 0; @@ -414,3 +415,8 @@ GsWidget::get_pages() { return 0; } } + +void +GsWidget::resize() { + size(paper_x * xdpi / 72, paper_y * ydpi / 72); +} |