diff -r 922d7f6c4e6c -r 1cc7bbf75f0b ornamentedobj.cpp --- a/ornamentedobj.cpp Fri Dec 29 13:52:19 2006 +0000 +++ b/ornamentedobj.cpp Fri Jan 05 11:17:32 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() {