summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2004-10-23 17:57:14 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2004-10-23 17:57:14 +0000
commitb68c113b7a5020ce0e0bb462fc8924e3739e7389 (patch)
treedefd7e334aac360508b874f010fbd50a232f66a4 /src
parent286afda711bcf74b3f923778db7ca574815dc9e7 (diff)
reduce flicker
reduce flicker
Diffstat (limited to 'src')
-rw-r--r--src/PSEditModel.H3
-rw-r--r--src/PSEditModel.cxx13
-rw-r--r--src/PSEditWidget.H4
-rw-r--r--src/PSEditWidget.cxx72
-rw-r--r--src/PSEditor.H4
-rw-r--r--src/PSEditor.cxx17
-rw-r--r--src/Postscript.cxx4
7 files changed, 97 insertions, 20 deletions
diff --git a/src/PSEditModel.H b/src/PSEditModel.H
index 2c94142..e601afc 100644
--- a/src/PSEditModel.H
+++ b/src/PSEditModel.H
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditModel.H,v 1.3 2004/10/21 21:02:05 hofmann Exp $"
+// "$Id: PSEditModel.H,v 1.4 2004/10/23 19:57:14 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -54,6 +54,7 @@ public:
int set_cur_text(int x1, int y1, int p);
int is_cur_text(PSEditText *t);
PSEditText *get_text(int p);
+ PSEditText *get_cur_text();
int replace_tag(char* tag, char* text);
int ps_to_display_x(int x1);
int ps_to_display_y(int y1);
diff --git a/src/PSEditModel.cxx b/src/PSEditModel.cxx
index a7542f2..368a667 100644
--- a/src/PSEditModel.cxx
+++ b/src/PSEditModel.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditModel.cxx,v 1.3 2004/10/21 21:02:05 hofmann Exp $"
+// "$Id: PSEditModel.cxx,v 1.4 2004/10/23 19:57:14 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -94,13 +94,16 @@ void PSEditModel::new_text(int x1, int y1, const char *s, int size, int p) {
}
int PSEditModel::set_cur_text(int x1, int y1, int p) {
+ PSEditText *t;
+
if (p < 0 || p >= max_pages) {
return 1;
}
if (text[p]) {
- cur_text = text[p]->get_match(x1, y1);
- if (cur_text) {
+ t = text[p]->get_match(x1, y1);
+ if (t) {
+ cur_text = t;
return 0;
}
}
@@ -111,6 +114,10 @@ int PSEditModel::is_cur_text(PSEditText *t) {
return (t && t == cur_text);
}
+PSEditText *PSEditModel::get_cur_text() {
+ return cur_text;
+}
+
void PSEditModel::append_text(const char *s) {
if (cur_text && s) {
cur_text->append_text(s);
diff --git a/src/PSEditWidget.H b/src/PSEditWidget.H
index 5f196cd..1811972 100644
--- a/src/PSEditWidget.H
+++ b/src/PSEditWidget.H
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditWidget.H,v 1.8 2004/10/21 19:55:36 hofmann Exp $"
+// "$Id: PSEditWidget.H,v 1.9 2004/10/23 19:57:14 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -48,7 +48,7 @@ public:
void new_text(int x1, int y1, const char *s);
int set_cur_text(int x1, int y1);
void append_text(const char *s);
- void move(int x1, int y1);
+ void move(int x1, int y1, int last_x, int last_y);
void rm_char();
int reload();
void set_cur_size(int s);
diff --git a/src/PSEditWidget.cxx b/src/PSEditWidget.cxx
index d8c9254..2eab468 100644
--- a/src/PSEditWidget.cxx
+++ b/src/PSEditWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditWidget.cxx,v 1.20 2004/10/21 21:02:05 hofmann Exp $"
+// "$Id: PSEditWidget.cxx,v 1.21 2004/10/23 19:57:14 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -79,11 +79,24 @@ PSEditWidget::PSEditWidget(int X,int Y,int W, int H) : GsWidget(X, Y, W, H) {
int PSEditWidget::next() {
model->set_page(page);
return GsWidget::next();
-}
+}
void PSEditWidget::new_text(int x1, int y1, const char *s, int p) {
+ PSEditText *t_old;
+
+ t_old = model->get_cur_text();
+
model->new_text(x1, y1, s, cur_size, p);
- redraw();
+
+ fl_font(FL_HELVETICA, cur_size);
+ damage(4, x1 - 10, y1 - fl_height() - 20,
+ fl_width(s) + 20, fl_height() + 30);
+
+ if (t_old) {
+ fl_font(FL_HELVETICA, t_old->get_size());
+ damage(4, t_old->get_x() - 10, t_old->get_y() - fl_height() - 20,
+ fl_width(t_old->get_text()) + 20, fl_height() + 30);
+ }
}
void PSEditWidget::new_text(int x1, int y1, const char *s) {
@@ -91,26 +104,69 @@ void PSEditWidget::new_text(int x1, int y1, const char *s) {
}
int PSEditWidget::set_cur_text(int x1, int y1) {
+ PSEditText *t_new, *t_old;
+
+ t_old = model->get_cur_text();
+
if (model->set_cur_text(x1, y1, page) == 0) {
- redraw();
+
+ t_new = model->get_cur_text();
+
+ if (t_new) {
+ fl_font(FL_HELVETICA, t_new->get_size());
+ damage(4, t_new->get_x() - 10, t_new->get_y() - fl_height() - 20,
+ fl_width(t_new->get_text()) + 20, fl_height() + 30);
+ }
+ if (t_old) {
+ fl_font(FL_HELVETICA, t_old->get_size());
+ damage(4, t_old->get_x() - 10, t_old->get_y() - fl_height() - 20,
+ fl_width(t_old->get_text()) + 20, fl_height() + 30);
+ }
return 0;
}
return 1;
}
void PSEditWidget::append_text(const char *s) {
+ PSEditText *t;
+
model->append_text(s);
- redraw();
+
+ t = model->get_cur_text();
+ if (t) {
+ fl_font(FL_HELVETICA, t->get_size());
+ damage(4, t->get_x() - 10, t->get_y() - fl_height() - 20, fl_width(t->get_text()) + 20, fl_height() + 30);
+ }
}
-void PSEditWidget::move(int x1, int y1) {
+void PSEditWidget::move(int x1, int y1, int last_x, int last_y) {
+ PSEditText *t;
+
model->move(x1, y1);
- redraw();
+ t = model->get_cur_text();
+ if (t) {
+ fl_font(FL_HELVETICA, t->get_size());
+ damage(4, x1 - 10, y1 - fl_height() - 20, fl_width(t->get_text()) + 20, fl_height() + 30);
+ damage(4, last_x - 10, last_y - fl_height() - 20, fl_width(t->get_text()) + 20, fl_height() + 30);
+
+ }
}
void PSEditWidget::rm_char() {
+ PSEditText *t;
+ int width;
+
+ t = model->get_cur_text();
+ if (t) {
+ fl_font(FL_HELVETICA, t->get_size());
+ width = fl_width(t->get_text());
+ }
+
model->rm_char();
- redraw();
+
+ if (t) {
+ damage(4, t->get_x() - 10, t->get_y() - fl_height() - 20, width + 20, fl_height() + 30);
+ }
}
diff --git a/src/PSEditor.H b/src/PSEditor.H
index 10adee6..b60696b 100644
--- a/src/PSEditor.H
+++ b/src/PSEditor.H
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditor.H,v 1.4 2004/10/12 20:52:23 hofmann Exp $"
+// "$Id: PSEditor.H,v 1.5 2004/10/23 19:57:14 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -28,9 +28,9 @@
class PSEditor : public PSEditWidget {
private:
- int mark_x, mark_y;
int tmp_fd;
int ps_level;
+ int x_last, y_last;
int handle(int event);
public:
diff --git a/src/PSEditor.cxx b/src/PSEditor.cxx
index 5412119..d263360 100644
--- a/src/PSEditor.cxx
+++ b/src/PSEditor.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditor.cxx,v 1.13 2004/10/21 21:02:05 hofmann Exp $"
+// "$Id: PSEditor.cxx,v 1.14 2004/10/23 19:57:14 hofmann Exp $"
//
// PSEditor routines.
//
@@ -33,6 +33,8 @@ PSEditor::PSEditor(int X,int Y,int W, int H) : PSEditWidget(X, Y, W, H) {
}
int PSEditor::handle(int event) {
+ int mark_x, mark_y;
+
switch(event) {
case FL_PUSH:
if (Fl::event_button() == 1) {
@@ -41,6 +43,9 @@ int PSEditor::handle(int event) {
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();
@@ -58,9 +63,17 @@ int PSEditor::handle(int event) {
Fl::paste(*this, 0);
return 1;
}
+
+ x_last = -1;
+ y_last = -1;
+
break;
case FL_DRAG:
- move(Fl::event_x()-x(), Fl::event_y()-y());
+ 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();
+
mod++;
return 1;
break;
diff --git a/src/Postscript.cxx b/src/Postscript.cxx
index 61021ce..654f8bd 100644
--- a/src/Postscript.cxx
+++ b/src/Postscript.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Postscript.cxx,v 1.10 2004/10/21 19:55:36 hofmann Exp $"
+// "$Id: Postscript.cxx,v 1.11 2004/10/23 19:57:14 hofmann Exp $"
//
// Postscript handling routines.
//
@@ -291,7 +291,7 @@ int PSWriter::write_text(FILE *out, PSEditText *t) {
s = t->get_text();
- if (strcmp(s, "") != 0) {
+ if (strcmp(s, "") != 0 || t->get_tag() != NULL) {
fprintf(out, size_format, t->get_size());
fprintf(out, pos_format,
pse->ps_x(t->get_x()),