summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2004-10-12 14:41:43 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2004-10-12 14:41:43 +0000
commitdbac923494a608d03f9381687b2ee2a3056b6696 (patch)
tree6680da9b4266b150d78f2caf1d5e7f1fd8a09512
parent51bd38e8d2448350afe349f2f64367d1af9b27cc (diff)
finally implement loading from command line.
finally implement loading from command line.
-rw-r--r--src/GsWidget.H4
-rw-r--r--src/GsWidget.cxx15
-rw-r--r--src/flpsed.cxx10
3 files changed, 20 insertions, 9 deletions
diff --git a/src/GsWidget.H b/src/GsWidget.H
index 77a4e88..e572cc2 100644
--- a/src/GsWidget.H
+++ b/src/GsWidget.H
@@ -1,5 +1,5 @@
//
-// "$Id: GsWidget.H,v 1.1.1.1 2004/06/21 18:05:58 hofmann Exp $"
+// "$Id: GsWidget.H,v 1.2 2004/10/12 16:41:43 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -40,7 +40,7 @@ class GsWidget : public Fl_Widget {
Atom atoms[5];
pid_t gs_pid;
int display_x, display_y;
- int in_fd;
+ int in_fd, reload_needed;
protected:
int page;
diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx
index 2228650..31f9882 100644
--- a/src/GsWidget.cxx
+++ b/src/GsWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: GsWidget.cxx,v 1.6 2004/07/07 17:17:54 hofmann Exp $"
+// "$Id: GsWidget.cxx,v 1.7 2004/10/12 16:41:43 hofmann Exp $"
//
// GsWidget routines.
//
@@ -42,6 +42,11 @@ void GsWidget::draw() {
fl_color(FL_WHITE);
fl_rectf(0, 0, w(), h());
fl_end_offscreen();
+
+ if (reload_needed) {
+ reload();
+ reload_needed = 0;
+ }
}
fl_push_clip(x(), y(), w(), h());
fl_copy_offscreen(x(), y(), w(), h(), offscreen, 0, 0);
@@ -94,7 +99,6 @@ bool GsWidget::gs_active() {
}
GsWidget::GsWidget(int X,int Y,int W, int H) : Fl_Widget(X, Y, W, H) {
- int w, h;
offscreen = 0;
gs_pid = 0;
page = 0;
@@ -103,6 +107,7 @@ GsWidget::GsWidget(int X,int Y,int W, int H) : Fl_Widget(X, Y, W, H) {
paper_x = 594; // DIN A4
paper_y = 841; //
in_fd = -1;
+ reload_needed = 0;
}
GsWidget::~GsWidget() {
@@ -130,6 +135,12 @@ int GsWidget::load(int fd) {
fl_cursor(FL_CURSOR_WAIT);
kill_gs();
+
+ if (!offscreen) {
+ reload_needed = 1;
+ return 0;
+ }
+
setProps();
pid_t pid = fork();
diff --git a/src/flpsed.cxx b/src/flpsed.cxx
index 6482d9d..3ffda53 100644
--- a/src/flpsed.cxx
+++ b/src/flpsed.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: flpsed.cxx,v 1.13 2004/10/11 14:44:47 hofmann Exp $"
+// "$Id: flpsed.cxx,v 1.14 2004/10/12 16:41:43 hofmann Exp $"
//
// flpsed program.
//
@@ -198,10 +198,10 @@ int main(int argc, char** argv) {
window.show(1, argv);
- // for (int i=0; i<100; i++) Fl::check();
- // if (argc >= 2) {
- // gsw_p->load(argv[1]);
- // }
+
+ if (argc >= 2) {
+ gsw_p->load(argv[1]);
+ }
return Fl::run();
}