1.1 --- a/ornamentedobj.cpp Fri Dec 08 20:18:56 2006 +0000
1.2 +++ b/ornamentedobj.cpp Sat Mar 31 09:28:27 2007 +0000
1.3 @@ -34,7 +34,6 @@
1.4 delete (heading);
1.5 delete (systemFlags);
1.6 delete (standardFlags);
1.7 -
1.8 }
1.9
1.10
1.11 @@ -45,6 +44,7 @@
1.12
1.13 note.setNote("");
1.14 note.setFontHint (textEditor->getFontHintDefault() );
1.15 + isNoteInEditor=false;
1.16
1.17 systemFlags=new FlagRowObj(scene);
1.18 systemFlags->clone(systemFlagsDefault);
1.19 @@ -175,28 +175,13 @@
1.20 void OrnamentedObj::setNote(QString s)
1.21 {
1.22 note.setNote(s);
1.23 - if (!note.isEmpty())
1.24 - systemFlags->activate("note");
1.25 - else
1.26 - systemFlags->deactivate("note");
1.27 - calcBBoxSize();
1.28 - positionBBox();
1.29 - move (absPos.x(), absPos.y() );
1.30 - forceReposition();
1.31 + updateNoteFlag();
1.32 }
1.33
1.34 void OrnamentedObj::setNote(NoteObj n)
1.35 {
1.36 note=n;
1.37 - if (!note.isEmpty())
1.38 - systemFlags->activate("note");
1.39 - else
1.40 - systemFlags->deactivate("note");
1.41 - calcBBoxSize();
1.42 - positionBBox();
1.43 - move (absPos.x(), absPos.y() );
1.44 - forceReposition();
1.45 -
1.46 + updateNoteFlag();
1.47 }
1.48
1.49 QString OrnamentedObj::getNote()
1.50 @@ -310,20 +295,38 @@
1.51 return false;
1.52 }
1.53
1.54 +void OrnamentedObj::getNoteFromTextEditor ()
1.55 +{
1.56 + note.setFilenameHint (textEditor->getFilename());
1.57 + note.setFontHint (textEditor->getFontHint() );
1.58 + setNote( textEditor->getText() );
1.59 +}
1.60 +
1.61 void OrnamentedObj::updateNoteFlag()
1.62 {
1.63 - if (selected)
1.64 - {
1.65 - // text in NoteEditor has changed, notify MapEditor
1.66 - mapEditor->setChanged();
1.67 + bool noteEmpty;
1.68 + if (isNoteInEditor)
1.69 + noteEmpty=textEditor->isEmpty();
1.70 + else
1.71 + noteEmpty=note.isEmpty();
1.72
1.73 - // save text
1.74 - setNote( textEditor->getText() );
1.75 + if (!noteEmpty)
1.76 + {
1.77 + if (systemFlags->isActive ("note")) return;
1.78 + systemFlags->activate("note");
1.79 + }
1.80 + else
1.81 + {
1.82 + if (!systemFlags->isActive ("note")) return;
1.83 + systemFlags->deactivate("note");
1.84 + }
1.85 + mapEditor->setChanged();
1.86 + calcBBoxSize();
1.87 + positionBBox();
1.88 + move (absPos.x(), absPos.y() );
1.89 + forceReposition();
1.90
1.91 - // save font
1.92 - note.setFontHint (textEditor->getFontHint() );
1.93 - }
1.94 -}
1.95 +}
1.96
1.97 void OrnamentedObj::updateFlagsToolbar()
1.98 {