summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2004-11-10 18:21:06 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2004-11-10 18:21:06 +0000
commitdbcf5fcc56e85f372d3be40f725a8e526ef00ca1 (patch)
tree8bddbbe58005daa73547899294c9c03e67a23f80
parent9583092a2166fe6899c616dd2f52b73dba8d34bc (diff)
improve coordinate conversion methods doc updates
improve coordinate conversion methods doc updates
-rw-r--r--NEWS3
-rw-r--r--README36
-rw-r--r--src/PSEditWidget.cxx22
3 files changed, 37 insertions, 24 deletions
diff --git a/NEWS b/NEWS
index f02c20a..ae13277 100644
--- a/NEWS
+++ b/NEWS
@@ -3,8 +3,9 @@ flpsed ChangeLog
flpsed-0.3.1
- Fix redraw problem after scrolling.
- - Allow moving of text with arrow keys.
+ - Allow moving of text with arrow keys for better text positioning.
- Tab key now cycles through text fields.
+ - Various bug fixes.
flpsed-0.3.0
- Add support for tags (thanks to Reimar Bauer for his thoughts on this).
diff --git a/README b/README
index 3a82098..e3deb4a 100644
--- a/README
+++ b/README
@@ -9,21 +9,23 @@ existing documents.
It is useful for filling in forms etc.
Quick Start:
-- open an existing PostScript document.
-- click anywhere on the document and type a text line.
-- the frame around the text shows, which text line has the focus.
-- remove text, by hitting BackSpace.
-- click on the lower left corner of a text line, to focus it.
-- navigate within the document with the Page->Next or Page->First menu buttons.
-- save your document and preview it with ghostview or something similar.
-- if you reopen the document with flpsed, you can edit the added text lines.
+- Open an existing PostScript document.
+- Click anywhere on the document and type a text line.
+- The frame around the text shows, which text line has the focus.
+- Click on the lower left corner of a text line to focus it or use the
+ Tab-key to cycle through the text lines on the current page.
+- Remove text, by hitting BackSpace.
+- Move text lines by dragging them with the mouse or using the arrow keys.
+- Navigate within the document with the Page->Next or Page->First menu buttons.
+- Save your document and preview it with ghostview or something similar.
+- If you reopen the document with flpsed, you can edit the added text lines.
Features:
-- add arbitrary text to existing PostScript documents.
-- reedit text, that has been added with flpsed.
-- the overall structure of the PostScript document is not
+- Add arbitrary text to existing PostScript documents.
+- Reedit text, that has been added with flpsed.
+- The overall structure of the PostScript document is not
modified. flpsed only adds the additional text.
-- lines can be given names ("tags"). The text of these lines can
+- Lines can be given names ("tags"). The text of these lines can
be replaced in batch mode (no X11 required).
Restrictions:
@@ -34,15 +36,15 @@ Restrictions:
Building:
- flpsed only works on X11-based systems.
-- you need to have ghostscript installed.
-- you need to have fltk-1.1.x from www.fltk.org installed.
-- unpack the tarball and type "make".
+- You need to have ghostscript installed.
+- You need to have fltk-1.1.x from www.fltk.org installed.
+- Unpack the tarball and type "make".
Tags and Batch Mode:
-to use batch mode, add text lines to your PostScript document as usual.
+To use batch mode, add text lines to your PostScript document as usual.
Give all or some of the lines tag names (Tags->Edit Tag).
Save the document. Now you can replace the text of the tagged line in batch
mode using the -t flag (see usage).
@@ -58,4 +60,4 @@ flpsed -b -t name="Hans Meier" -t street="Haupstr. 14" letter-templ.ps out.ps
Johannes Hofmann
(Johannes.Hofmann@gmx.de)
-October 26, 2004
+November 10, 2004
diff --git a/src/PSEditWidget.cxx b/src/PSEditWidget.cxx
index 572f010..5861814 100644
--- a/src/PSEditWidget.cxx
+++ b/src/PSEditWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditWidget.cxx,v 1.30 2004/11/10 18:49:08 hofmann Exp $"
+// "$Id: PSEditWidget.cxx,v 1.31 2004/11/10 19:21:06 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -332,24 +332,34 @@ int PSEditWidget::bb_w(PSEditText *t) {
return w>=wt?w:wt;
}
+static int round_div(int a, int b) {
+ int r;
+
+ r = a / b;
+ if (a % b > b / 2) {
+ r++;
+ }
+
+ return r;
+}
+
int PSEditWidget::bb_h(PSEditText *t) {
fl_font(FLPSED_FONT, t->get_size());
return fl_height() + 30;
}
-
int PSEditWidget::ps_to_display_x(int x1) {
- return (x1 * xdpi) / 72;
+ return round_div(x1 * xdpi, 72);
}
int PSEditWidget::ps_to_display_y(int y1) {
- return ((paper_y - y1) * xdpi) / 72;
+ return round_div((paper_y - y1) * xdpi, 72);
}
int PSEditWidget::ps_x(int x1) {
- return (x1 * 72) / xdpi;
+ return round_div(x1 * 72, xdpi);
}
int PSEditWidget::ps_y(int y1) {
- return paper_y - (y1 * 72) / ydpi;
+ return paper_y - round_div(y1 * 72, ydpi);
}