summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-02-10 19:19:35 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-02-10 19:19:35 +0100
commit76ef28f6e53027562e6cff645a5b1a9bca20b642 (patch)
tree81be791f9ebdfe0867a3cfd7765c920f3a9f24ba
parentd7f99c909c835c40db5c67a1844fd7de6f3dbe16 (diff)
parent5343bc1f787c4b7892f6a54ef4e946ef3d2b8efb (diff)
merge
-rw-r--r--NEWS1
-rw-r--r--src/GsWidget.cxx16
-rw-r--r--src/flpsed.cxx37
3 files changed, 37 insertions, 17 deletions
diff --git a/NEWS b/NEWS
index ab9a5b5..9afc912 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ flpsed-0.3.6
- Add support for PostScript Document Structure Convention.
- Pages can now be accessed in random order.
- Document sizes other than A4 are handled better.
+ - Add -geometry and -z (zoom) options.
flpsed-0.3.5
- Add text color support. Click on the (initially) black button and
diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx
index 0453f44..e92a71d 100644
--- a/src/GsWidget.cxx
+++ b/src/GsWidget.cxx
@@ -395,15 +395,15 @@ 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) {
+ // Clear widget with current size
+ fl_begin_offscreen(offscreen);
+ fl_color(FL_WHITE);
+ fl_rectf(0, 0, w(), h());
+ fl_end_offscreen();
+ redraw();
+
fl_delete_offscreen(offscreen);
offscreen = 0;
}
diff --git a/src/flpsed.cxx b/src/flpsed.cxx
index 0ea5930..1492c5d 100644
--- a/src/flpsed.cxx
+++ b/src/flpsed.cxx
@@ -390,16 +390,22 @@ Fl_Menu_Item size_menu[] = {
void usage() {
fprintf(stderr,
- "usage: flpsed [-hbd] [-t <tag>=<value>] [<infile>] [<outfile>]\n"
+ "usage: flpsed [-hbdz] [-t <tag>=<value>] [<infile>] [<outfile>]\n"
" -h print this message\n"
" -b batch mode (no gui)\n"
" -d dump tags and values from a document\n"
" to stdout (this implies -b)\n"
+ " -z <zoom> set the zoom percentage (e.g. 200)\n"
" -t <tag>=<value> set text to <value> where tag is <tag>\n"
" <infile> optional input file; in batch mode if no\n"
" input file is given, input is read from stdin\n"
" <outfile> optional output file for batch mode; if no\n"
- " output file is given, output is written to stdout\n");
+ " output file is given, output is written to stdout\n\n"
+ "additionally flpsed supports the following FLTK standard options:\n"
+ " -geometry WxH+X+Y\n"
+ " -iconic\n"
+ " -scheme string\n"
+ );
}
#define TV_LEN 256
@@ -407,14 +413,16 @@ void usage() {
int main(int argc, char** argv) {
char *sep, *tmp, **my_argv;
int c, err, bflag = 0, dflag = 0;
+ int i, n;
Fl_Window *win;
Fl_Menu_Bar *m;
struct {char *tag; char *value;} tv[TV_LEN];
int tv_idx = 0, my_argc;
FILE *in_fp = NULL, *out_fp = NULL;
+ int zoom_val = 0;
err = 0;
- while ((c = getopt(argc, argv, "hdbt:")) != -1) {
+ while ((c = getopt(argc, argv, "hdbt:z:g:d:f:i:s:")) != -1) {
switch (c) {
case 'h':
usage();
@@ -428,10 +436,6 @@ int main(int argc, char** argv) {
break;
case 't':
tmp = strdup(optarg);
- if (!tmp) {
- perror("strdup");
- exit(1);
- }
sep = strchr(tmp, '=');
if (!sep) {
fprintf(stderr, "Cannot parse %s\n", optarg);
@@ -450,8 +454,17 @@ int main(int argc, char** argv) {
}
free(tmp);
break;
+ case 'z':
+ zoom_val = atoi(optarg);
+ break;
default:
- err++;
+ i = optind -1;
+ n = Fl::arg(argc, argv, i);
+ if (n == 0) {
+ err++;
+ } else {
+ optind = i;
+ }
}
}
@@ -552,6 +565,7 @@ int main(int argc, char** argv) {
psed_p = new PSEditor(0, 0, 700, 900);
psed_p->property_changed_callback(property_changed_cb);
scroll->end();
+
fl_open_display();
Fl::add_handler(xev_handler);
@@ -561,7 +575,12 @@ int main(int argc, char** argv) {
win->end();
win->callback((Fl_Callback *)quit_cb);
win->show(1, argv);
-
+
+
+ if (zoom_val) {
+ psed_p->zoom(zoom_val);
+ }
+
if (in_fp) {
psed_p->open_file(in_fp);
psed_p->load();