X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Fmathml_editor%2Fsrc%2FTPushParser.cc;h=a3fb9772996a11becbd03e578b62b6badac40ca2;hb=8d15b9f68470945a45ce96dbc1c892742c85cb9c;hp=836be35a894eeacd5c11727e5aad6d01d794a6ae;hpb=6661b044574d16144dfa0db68708f64ee286fb00;p=helm.git diff --git a/helm/DEVEL/mathml_editor/src/TPushParser.cc b/helm/DEVEL/mathml_editor/src/TPushParser.cc index 836be35a8..a3fb97729 100644 --- a/helm/DEVEL/mathml_editor/src/TPushParser.cc +++ b/helm/DEVEL/mathml_editor/src/TPushParser.cc @@ -5,27 +5,36 @@ TPushParser::TPushParser(ALogger& l, const TDictionary& d) : APushParser(l), dictionary(d) { - reset(); + init(); } TPushParser::TPushParser(ALogger& l, AMathMLFactory& f, const TDictionary& d) : APushParser(l, f), dictionary(d) { - reset(); + init(); } TPushParser::~TPushParser() { } +void +TPushParser::init() +{ + cursor = doc.create("cursor"); + cursor["visible"] = "1"; + hiddenCursor = 0; + reset(); +} + void TPushParser::reset() { - APushParser::reset(); + cout << "passo di qui dentro pushparser " << factory << endl; nextId = 1; - cursor = doc.create("cursor"); - cursor["id"] = "I0"; - doc.clearDirty(); + if (cursor.parent()) cursor.remove(); + doc.reset(); doc.root().append(cursor); + if (factory) factory->documentModified(doc); } std::string @@ -1688,6 +1697,32 @@ TPushParser::setCursorHint(const std::string& c) } } +bool +TPushParser::hideCursor() +{ + if (hiddenCursor++ == 0) + { + cursor["visible"] = "0"; + if (factory && doc.dirtyNode() && !frozen()) factory->documentModified(doc); + return true; + } + else + return false; +} + +bool +TPushParser::showCursor() +{ + if (hiddenCursor > 0 && --hiddenCursor == 0) + { + cursor["visible"] = "1"; + if (factory && doc.dirtyNode() && !frozen()) factory->documentModified(doc); + return true; + } + else + return false; +} + bool TPushParser::thaw() {