diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2006-07-15 21:02:55 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2006-07-15 21:02:55 +0200 |
commit | 731e8384f681769209b11a3738fea16a02501d5a (patch) | |
tree | 3f35c35ca18fe09c23eb68a3206bc377e8b32776 | |
parent | 57a98d682ab085886202299b6e5cbc9ee68b5b1c (diff) |
only set modified flag if real changes have been made to the document
-rw-r--r-- | src/PSEditText.H | 2 | ||||
-rw-r--r-- | src/PSEditText.cxx | 4 | ||||
-rw-r--r-- | src/PSEditWidget.cxx | 10 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/PSEditText.H b/src/PSEditText.H index 7d3d1b8..fee463a 100644 --- a/src/PSEditText.H +++ b/src/PSEditText.H @@ -108,6 +108,8 @@ public: char *get_text(); + int is_empty(); + char *get_tag(); int set_tag(const char *t); diff --git a/src/PSEditText.cxx b/src/PSEditText.cxx index 0231807..2c572ff 100644 --- a/src/PSEditText.cxx +++ b/src/PSEditText.cxx @@ -113,6 +113,10 @@ char *PSEditText::get_text() { return s; } +int PSEditText::is_empty() { + return !s || !s[0]; +} + char *PSEditText::get_tag() { return tag; } diff --git a/src/PSEditWidget.cxx b/src/PSEditWidget.cxx index e3c1307..d1bf001 100644 --- a/src/PSEditWidget.cxx +++ b/src/PSEditWidget.cxx @@ -116,11 +116,13 @@ void PSEditWidget::new_text(int x1, int y1, const char *s, int p) { t_old = model->get_cur_text(); model->new_text(ps_x(x1), ps_y(y1), s, cur_size, p, &cur_text_color); - mod++; - + t = model->get_cur_text(); if (t) { + if (!t->is_empty()) { + mod++; + } damage(4, bb_x(t), bb_y(t), bb_w(t), bb_h(t)); } @@ -210,7 +212,9 @@ void PSEditWidget::move(int x1, int y1) { old_bbh = bb_h(t); model->move(ps_x(x1), ps_y(y1)); - mod++; + if (!t->is_empty() || t->get_tag()) { + mod++; + } damage(4, old_bbx, old_bby, old_bbw, old_bbh); damage(4, bb_x(t), bb_y(t), bb_w(t), bb_h(t)); |