diff -r c2a05fa925a1 -r 9ae68208e2ff ornamentedobj.cpp --- a/ornamentedobj.cpp Fri Dec 08 20:18:56 2006 +0000 +++ b/ornamentedobj.cpp Mon Feb 19 12:01:52 2007 +0000 @@ -34,7 +34,6 @@ delete (heading); delete (systemFlags); delete (standardFlags); - } @@ -45,6 +44,7 @@ note.setNote(""); note.setFontHint (textEditor->getFontHintDefault() ); + isNoteInEditor=false; systemFlags=new FlagRowObj(scene); systemFlags->clone(systemFlagsDefault); @@ -175,28 +175,13 @@ void OrnamentedObj::setNote(QString s) { note.setNote(s); - if (!note.isEmpty()) - systemFlags->activate("note"); - else - systemFlags->deactivate("note"); - calcBBoxSize(); - positionBBox(); - move (absPos.x(), absPos.y() ); - forceReposition(); + updateNoteFlag(); } void OrnamentedObj::setNote(NoteObj n) { note=n; - if (!note.isEmpty()) - systemFlags->activate("note"); - else - systemFlags->deactivate("note"); - calcBBoxSize(); - positionBBox(); - move (absPos.x(), absPos.y() ); - forceReposition(); - + updateNoteFlag(); } QString OrnamentedObj::getNote() @@ -310,20 +295,38 @@ return false; } +void OrnamentedObj::getNoteFromTextEditor () +{ + note.setFilenameHint (textEditor->getFilename()); + note.setFontHint (textEditor->getFontHint() ); + setNote( textEditor->getText() ); +} + void OrnamentedObj::updateNoteFlag() { - if (selected) - { - // text in NoteEditor has changed, notify MapEditor - mapEditor->setChanged(); + bool noteEmpty; + if (isNoteInEditor) + noteEmpty=textEditor->isEmpty(); + else + noteEmpty=note.isEmpty(); - // save text - setNote( textEditor->getText() ); + if (!noteEmpty) + { + if (systemFlags->isActive ("note")) return; + systemFlags->activate("note"); + } + else + { + if (!systemFlags->isActive ("note")) return; + systemFlags->deactivate("note"); + } + mapEditor->setChanged(); + calcBBoxSize(); + positionBBox(); + move (absPos.x(), absPos.y() ); + forceReposition(); - // save font - note.setFontHint (textEditor->getFontHint() ); - } -} +} void OrnamentedObj::updateFlagsToolbar() {