summaryrefslogtreecommitdiff
path: root/src/GsWidget.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2005-01-27 20:07:09 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2005-01-27 20:07:09 +0000
commite9defef906d2c31a1d03615a1a2ed31a89a81dc5 (patch)
treed7b6c03722af22614693ff04f66751213cfc82ea /src/GsWidget.cxx
parent37a96e693506ff169d6702d384405597f3ff54e1 (diff)
implement zoom
implement zoom
Diffstat (limited to 'src/GsWidget.cxx')
-rw-r--r--src/GsWidget.cxx36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx
index 590f6f5..3b7dc8e 100644
--- a/src/GsWidget.cxx
+++ b/src/GsWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: GsWidget.cxx,v 1.13 2004/11/14 20:04:09 hofmann Exp $"
+// "$Id: GsWidget.cxx,v 1.14 2005/01/27 21:07:09 hofmann Exp $"
//
// GsWidget routines.
//
@@ -100,10 +100,13 @@ GsWidget::GsWidget(int X,int Y,int W, int H) : Fl_Widget(X, Y, W, H) {
offscreen = 0;
gs_pid = 0;
page = 0;
- xdpi = 75;
- ydpi = 75;
+ zoom_percent = 100;
+ xdpi = 75 * zoom_percent / 100;
+ ydpi = 75 * zoom_percent / 100;
paper_x = 594; // DIN A4
paper_y = 841; //
+ initial_width = W;
+ initial_height = H;
in_fd = -1;
reload_needed = 0;
}
@@ -228,3 +231,30 @@ int GsWidget::handleX11(int ev) {
int GsWidget::get_page() {
return page;
}
+
+int GsWidget::zoom(int p) {
+ zoom_percent = p;
+
+ kill_gs();
+
+ // Clear widget
+ fl_begin_offscreen(offscreen);
+ fl_color(FL_WHITE);
+ fl_rectf(0, 0, w(), h());
+ fl_end_offscreen();
+ redraw();
+
+ if (offscreen) {
+ fl_delete_offscreen(offscreen);
+ offscreen = NULL;
+ }
+
+ w(initial_width * zoom_percent / 100);
+ h(initial_height * zoom_percent / 100);
+
+ xdpi = 75 * zoom_percent / 100;
+ ydpi = 75 * zoom_percent / 100;
+ reload();
+
+ return 0;
+}