summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2004-10-21 18:12:36 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2004-10-21 18:12:36 +0000
commitef1117eb50a9a0e82825e961be8e59d203ebf650 (patch)
tree796d417f8fb64e63f81e9a8ddb827ac73cb02c94 /src
parent382846248e84c478f713deabbb05a18c1a0d6951 (diff)
reimplement drawing
reimplement drawing
Diffstat (limited to 'src')
-rw-r--r--src/PSEditModel.H3
-rw-r--r--src/PSEditModel.cxx6
-rw-r--r--src/PSEditText.H3
-rw-r--r--src/PSEditWidget.cxx29
4 files changed, 35 insertions, 6 deletions
diff --git a/src/PSEditModel.H b/src/PSEditModel.H
index 2d3f780..4398bec 100644
--- a/src/PSEditModel.H
+++ b/src/PSEditModel.H
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditModel.H,v 1.1 2004/10/21 19:55:36 hofmann Exp $"
+// "$Id: PSEditModel.H,v 1.2 2004/10/21 20:12:36 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -52,6 +52,7 @@ public:
int set_tag(const char *t);
int get_max_pages();
int set_cur_text(int x1, int y1, int p);
+ int is_cur_text(PSEditText *t);
PSEditText *get_text(int p);
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 9e12d7a..81e2bf4 100644
--- a/src/PSEditModel.cxx
+++ b/src/PSEditModel.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditModel.cxx,v 1.1 2004/10/21 19:55:36 hofmann Exp $"
+// "$Id: PSEditModel.cxx,v 1.2 2004/10/21 20:12:36 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -103,6 +103,10 @@ int PSEditModel::set_cur_text(int x1, int y1, int p) {
return 1;
}
+int PSEditModel::is_cur_text(PSEditText *t) {
+ return (t && t == cur_text);
+}
+
void PSEditModel::append_text(const char *s) {
if (cur_text && s) {
cur_text->append_text(s);
diff --git a/src/PSEditText.H b/src/PSEditText.H
index a695b5e..2724559 100644
--- a/src/PSEditText.H
+++ b/src/PSEditText.H
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditText.H,v 1.1 2004/10/21 19:55:36 hofmann Exp $"
+// "$Id: PSEditText.H,v 1.2 2004/10/21 20:12:36 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -50,7 +50,6 @@ public:
int get_color();
int get_x();
int get_y();
- void draw(int off_x,int off_y);
};
#endif
diff --git a/src/PSEditWidget.cxx b/src/PSEditWidget.cxx
index ef8431c..c0295fa 100644
--- a/src/PSEditWidget.cxx
+++ b/src/PSEditWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditWidget.cxx,v 1.18 2004/10/21 19:55:36 hofmann Exp $"
+// "$Id: PSEditWidget.cxx,v 1.19 2004/10/21 20:12:36 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -43,7 +43,31 @@ void PSEditWidget::clear_text() {
void PSEditWidget::draw() {
GsWidget::draw();
-
+ PSEditText *t = model->get_text(page);
+
+ while (t) {
+ fl_color((Fl_Color) t->get_color());
+ fl_font(FL_HELVETICA, t->get_size());
+ fl_draw(t->get_text(), t->get_x() + x(), t->get_y() + y());
+ if (model->is_cur_text(t)) {
+ fl_draw_box(FL_BORDER_FRAME,
+ t->get_x()+x()-1,
+ t->get_y()+y()-fl_height()+fl_descent(),
+ (int) fl_width(t->get_text())+2,
+ fl_height(),
+ FL_BLACK);
+ }
+
+ if (t->get_tag() && show_tags) {
+ int text_height = fl_height() - fl_descent();
+ fl_color(FL_BLUE);
+ fl_font(FL_COURIER, 10);
+ fl_draw(t->get_tag(), t->get_x() + x(),
+ t->get_y() + y() - text_height - 1);
+ }
+
+ t = t->get_next();
+ }
}
PSEditWidget::PSEditWidget(int X,int Y,int W, int H) : GsWidget(X, Y, W, H) {
@@ -132,6 +156,7 @@ void PSEditWidget::set_show_tags(int s) {
int PSEditWidget::set_tag(const char *t) {
if (model->set_tag(t) == 0) {
mod++;
+ redraw();
return 0;
} else {
return 1;