From 731e8384f681769209b11a3738fea16a02501d5a Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sat, 15 Jul 2006 21:02:55 +0200 Subject: only set modified flag if real changes have been made to the document --- src/PSEditText.H | 2 ++ src/PSEditText.cxx | 4 ++++ 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)); -- cgit v1.2.3