summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2004-11-08 18:36:14 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2004-11-08 18:36:14 +0000
commite8cd2063669a04e3782b187fdd0be336efb157db (patch)
tree3deabee9930a8560a53b4fa7c20b5522b67152c5 /src
parent4ef45e532c786dc02b2c5f2141fb713264143c8c (diff)
fix move interface
fix move interface
Diffstat (limited to 'src')
-rw-r--r--src/PSEditWidget.H4
-rw-r--r--src/PSEditWidget.cxx20
-rw-r--r--src/PSEditor.H4
-rw-r--r--src/PSEditor.cxx24
-rw-r--r--src/flpsed.cxx5
5 files changed, 28 insertions, 29 deletions
diff --git a/src/PSEditWidget.H b/src/PSEditWidget.H
index 7319b3f..6261646 100644
--- a/src/PSEditWidget.H
+++ b/src/PSEditWidget.H
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditWidget.H,v 1.12 2004/11/08 18:10:34 hofmann Exp $"
+// "$Id: PSEditWidget.H,v 1.13 2004/11/08 19:36:14 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -61,7 +61,7 @@ public:
void append_text(const char *s);
- void move(int x1, int y1, int last_x, int last_y);
+ void move(int x1, int y1);
void rm_char();
diff --git a/src/PSEditWidget.cxx b/src/PSEditWidget.cxx
index 95ddbde..9d20618 100644
--- a/src/PSEditWidget.cxx
+++ b/src/PSEditWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditWidget.cxx,v 1.26 2004/11/08 18:56:00 hofmann Exp $"
+// "$Id: PSEditWidget.cxx,v 1.27 2004/11/08 19:36:14 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -75,7 +75,8 @@ void PSEditWidget::draw() {
}
}
-PSEditWidget::PSEditWidget(int X,int Y,int W, int H) : GsWidget(X, Y, W, H) {
+PSEditWidget::PSEditWidget(int X,int Y,int W, int H): GsWidget(X, Y, W, H) {
+
model = new PSEditModel(paper_x, paper_y, xdpi, ydpi);
cur_size = 12;
show_tags = 1;
@@ -161,15 +162,24 @@ void PSEditWidget::append_text(const char *s) {
}
}
-void PSEditWidget::move(int x1, int y1, int last_x, int last_y) {
+void PSEditWidget::move(int x1, int y1) {
PSEditText *t;
+ int old_bbx, old_bby, old_bbw, old_bbh;
+
+ t = model->get_cur_text();
+ if (t) {
+ old_bbx = bb_x(t);
+ old_bby = bb_y(t);
+ old_bbw = bb_w(t);
+ old_bbh = bb_h(t);
+ }
model->move(x1, y1);
mod++;
- t = model->get_cur_text();
+
if (t) {
+ damage(4, old_bbx, old_bby, old_bbw, old_bbh);
damage(4, bb_x(t), bb_y(t), bb_w(t), bb_h(t));
- damage(4, last_x - 10, last_y - fl_height() - 20, bb_w(t), bb_h(t));
}
}
diff --git a/src/PSEditor.H b/src/PSEditor.H
index 34873fe..2663701 100644
--- a/src/PSEditor.H
+++ b/src/PSEditor.H
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditor.H,v 1.7 2004/10/26 16:58:49 hofmann Exp $"
+// "$Id: PSEditor.H,v 1.8 2004/11/08 19:36:14 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -32,8 +32,6 @@ class PSEditor : public PSEditWidget {
int ps_level;
- int x_last, y_last;
-
int handle(int event);
public:
diff --git a/src/PSEditor.cxx b/src/PSEditor.cxx
index efd9b97..6e1c644 100644
--- a/src/PSEditor.cxx
+++ b/src/PSEditor.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditor.cxx,v 1.20 2004/11/08 18:10:34 hofmann Exp $"
+// "$Id: PSEditor.cxx,v 1.21 2004/11/08 19:36:14 hofmann Exp $"
//
// PSEditor routines.
//
@@ -43,10 +43,7 @@ int PSEditor::handle(int event) {
fl_beep();
return 0;
}
-
- x_last = Fl::event_x()-x();
- y_last = Fl::event_y()-y();
-
+
mark_x = Fl::event_x()-x();
mark_y = Fl::event_y()-y();
@@ -64,16 +61,9 @@ int PSEditor::handle(int event) {
return 1;
}
- x_last = -1;
- y_last = -1;
-
break;
case FL_DRAG:
- move(Fl::event_x()-x(), Fl::event_y()-y(), x_last-x(), y_last-y());
-
- x_last = Fl::event_x()-x();
- y_last = Fl::event_y()-y();
-
+ move(Fl::event_x()-x(), Fl::event_y()-y());
return 1;
break;
case FL_KEYBOARD:
@@ -87,28 +77,28 @@ int PSEditor::handle(int event) {
if (t) {
int x = t->get_x();
int y = t->get_y();
- move(x - 1, y, x, y);
+ move(x - 1, y);
}
} else if (key == FL_Right) {
PSEditText *t = model->get_cur_text();
if (t) {
int x = t->get_x();
int y = t->get_y();
- move(x + 1, y, x, y);
+ move(x + 1, y);
}
} else if (key == FL_Up) {
PSEditText *t = model->get_cur_text();
if (t) {
int x = t->get_x();
int y = t->get_y();
- move(x, y - 1, x, y);
+ move(x, y - 1);
}
} else if (key == FL_Down) {
PSEditText *t = model->get_cur_text();
if (t) {
int x = t->get_x();
int y = t->get_y();
- move(x, y + 1, x, y);
+ move(x, y + 1);
}
} else if (key == FL_Tab) {
next_text();
diff --git a/src/flpsed.cxx b/src/flpsed.cxx
index 7b766f9..6dc6a1b 100644
--- a/src/flpsed.cxx
+++ b/src/flpsed.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: flpsed.cxx,v 1.22 2004/10/26 16:58:49 hofmann Exp $"
+// "$Id: flpsed.cxx,v 1.23 2004/11/08 19:36:14 hofmann Exp $"
//
// flpsed program.
//
@@ -221,7 +221,8 @@ int main(int argc, char** argv) {
char c, *sep, *tmp, **my_argv;
int err, bflag = 0, dflag = 0;
Fl_Window *win;
- Fl_Menu_Bar* m;
+ Fl_Menu_Bar *m;
+ Fl_Int_Input *x_in, *y_in;
Fl_Scroll *scroll;
struct {char *tag; char *value;} tv[TV_LEN];
int tv_idx = 0, my_argc;