# HG changeset patch # User insilmaril # Date 1167995852 0 # Node ID 1cc7bbf75f0bd31e5f73c2ba9bcf830abfa92827 # Parent 922d7f6c4e6c50a751a4f731ba4f2e020db37d7e 1.8.64 various fixes diff -r 922d7f6c4e6c -r 1cc7bbf75f0b branchobj.cpp --- a/branchobj.cpp Fri Dec 29 13:52:19 2006 +0000 +++ b/branchobj.cpp Fri Jan 05 11:17:32 2007 +0000 @@ -232,7 +232,7 @@ } // updateLink is called implicitly in move - requestReposition(); // FIXME shouldn't be this a request? + requestReposition(); } void BranchObj::unsetParObjTmp() @@ -370,11 +370,11 @@ LinkableMapObj::setLinkColor (); } -void BranchObj::setColorChilds (QColor col) +void BranchObj::setColorSubtree(QColor col) { OrnamentedObj::setColor (col); for (int i=0; i<branch.size(); ++i) - branch.at(i)->setColorChilds(col); + branch.at(i)->setColorSubtree(col); } BranchObj* BranchObj::first() @@ -452,7 +452,6 @@ if (itLast==branch.at(i)) { // ok, we come from my own childs - //xyz //FIXME need to proceed to NEXT child or up again if (i<branch.size()-1) bo=branch.at(i+1); else @@ -732,8 +731,12 @@ QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) { + // Cloudy stuff can be hidden during exports if (hidden) return ""; + // Update of note is usually done while unselecting a branch + if (isNoteInEditor) getNoteFromTextEditor(); + QString s,a; QString scrolledAttr; if (scrolled) @@ -1123,8 +1126,13 @@ BranchObj* BranchObj::getLastSelectedBranch () { - if (lastSelectedBranch>=0 && branch.size()>0) - return branch.at(lastSelectedBranch); + if (lastSelectedBranch>=0) + { + if ( branch.size()>lastSelectedBranch) + return branch.at(lastSelectedBranch); + if (branch.size()>0) + return branch.last(); + } return NULL; } @@ -1335,7 +1343,6 @@ calcBBoxSizeWithChilds(); updateLink(); // This update is needed if the scene is resized // due to excessive moving of a FIO - // FIXME really needed? reposition is also called from updateLink... alignRelativeTo ( QPointF (absPos.x(), absPos.y()-(bboxTotal.height()-bbox.height())/2) ); @@ -1453,6 +1460,7 @@ else textEditor->setFilenameHint(getHeading() ); textEditor->setFontHint (note.getFontHint() ); + isNoteInEditor=true; LinkableMapObj::select(); // Tell parent that I am selected now: @@ -1482,10 +1490,9 @@ // Delete any messages like vymLink in StatusBar mainWindow->statusMessage (""); - // save note from editor and set flag - // text is done by updateNoteFlag(), just save - // filename here - note.setFilenameHint (textEditor->getFilename()); + // Save current note + if (isNoteInEditor) getNoteFromTextEditor(); + isNoteInEditor=false; // reset temporary unscroll, if we have scrolled parents somewhere if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll(); diff -r 922d7f6c4e6c -r 1cc7bbf75f0b branchobj.h --- a/branchobj.h Fri Dec 29 13:52:19 2006 +0000 +++ b/branchobj.h Fri Jan 05 11:17:32 2007 +0000 @@ -43,7 +43,7 @@ virtual void setVisibility(bool,int); // set visibility virtual void setVisibility(bool); // set vis. for w virtual void setLinkColor(); // set the color of link - virtual void setColorChilds(QColor); // set the color of heading + virtual void setColorSubtree(QColor); // set the color of heading BranchObj* first (); // set Iterator to first LMO BranchObj* next (); // find next LMO after given one diff -r 922d7f6c4e6c -r 1cc7bbf75f0b demos/todo.vym Binary file demos/todo.vym has changed diff -r 922d7f6c4e6c -r 1cc7bbf75f0b floatimageobj.cpp --- a/floatimageobj.cpp Fri Dec 29 13:52:19 2006 +0000 +++ b/floatimageobj.cpp Fri Jan 05 11:17:32 2007 +0000 @@ -35,7 +35,7 @@ FloatImageObj::~FloatImageObj () { - cout << "Destr FloatImageObj "<<this<<"\n"; +// cout << "Destr FloatImageObj "<<this<<"\n"; delete(icon); } diff -r 922d7f6c4e6c -r 1cc7bbf75f0b icons/formatcoloritem.png Binary file icons/formatcoloritem.png has changed diff -r 922d7f6c4e6c -r 1cc7bbf75f0b icons/formatcoloritem.xpm --- a/icons/formatcoloritem.xpm Fri Dec 29 13:52:19 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* XPM */ -static char * formatcoloritem_xpm[] = { -"22 21 7 1", -" c None", -". c #949194", -"+ c #DEDADE", -"@ c #000000", -"# c #FFFFFF", -"$ c #FF0000", -"% c #0000FF", -" .. ", -" .... ", -" ..++.. ", -" ..+@.. ", -" ..@#.. ", -" @@##..@$ ", -" @##+..+@$$ ", -" @##+#@.++@$$ ", -" @##+#@+@++.$$$ ", -" @##+#++@++..$$$ ", -"@##+#+++++..@$$$ ", -"@#+#+++++..@ $$$ ", -" @#+++++..@ $$$ ", -" @#+++..@ $$$ ", -" @++..@ $$ ", -" @..@ $ ", -" @@ ", -" ", -" ", -" %%%%%%%%%%", -" %%%%%%%%%%"}; diff -r 922d7f6c4e6c -r 1cc7bbf75f0b mainwindow.cpp --- a/mainwindow.cpp Fri Dec 29 13:52:19 2006 +0000 +++ b/mainwindow.cpp Fri Jan 05 11:17:32 2007 +0000 @@ -791,20 +791,20 @@ actionListBranches.append(a); actionFormatPickColor=a; - a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch","Edit menu" ), this); + a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color &branch","Edit menu" ), this); a->setStatusTip ( tr( "Color branch" ) ); a->setShortcut (Qt::CTRL + Qt::Key_I); - connect( a, SIGNAL( triggered() ), this, SLOT( formatColorItem() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) ); a->setEnabled (false); a->addTo( tb ); formatMenu->addAction (a); actionListBranches.append(a); - actionFormatColorBranch=a; - - a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree","Edit menu" ), this); + actionFormatColorSubtree=a; + + a= new QAction(QPixmap(iconPath+"formatcolorsubtree.png"), tr( "Color sub&tree","Edit menu" ), this); a->setStatusTip ( tr( "Color Subtree" )); a->setShortcut (Qt::CTRL + Qt::Key_T); - connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) ); + connect( a, SIGNAL( triggered() ), this, SLOT( formatColorSubtree() ) ); a->setEnabled (false); formatMenu->addAction (a); a->addTo( tb ); @@ -2997,18 +2997,18 @@ currentColor=c; } -void Main::formatColorItem() -{ - if (currentMapEditor()) - currentMapEditor()->colorItem(currentColor); -} - void Main::formatColorBranch() { if (currentMapEditor()) currentMapEditor()->colorBranch(currentColor); } +void Main::formatColorSubtree() +{ + if (currentMapEditor()) + currentMapEditor()->colorSubtree (currentColor); +} + void Main::formatLinkStyleLine() { if (currentMapEditor()) @@ -3093,7 +3093,6 @@ QMatrix m; m.reset(); currentMapEditor()->setMatrix( m ); - currentMapEditor()->setViewCenter(); } } @@ -3104,7 +3103,6 @@ QMatrix m = currentMapEditor()->matrix(); m.scale( 1.25, 1.25 ); currentMapEditor()->setMatrix( m ); - currentMapEditor()->setViewCenter(); } } @@ -3115,7 +3113,6 @@ QMatrix m = currentMapEditor()->matrix(); m.scale( 0.8, 0.8 ); currentMapEditor()->setMatrix( m ); - currentMapEditor()->setViewCenter(); } } diff -r 922d7f6c4e6c -r 1cc7bbf75f0b mainwindow.h --- a/mainwindow.h Fri Dec 29 13:52:19 2006 +0000 +++ b/mainwindow.h Fri Jan 05 11:17:32 2007 +0000 @@ -136,8 +136,8 @@ void formatSelectColor(); void formatPickColor(); void colorChanged(QColor); - void formatColorItem(); void formatColorBranch(); + void formatColorSubtree(); void formatLinkStyleLine(); void formatLinkStyleParabel(); void formatLinkStylePolyLine(); diff -r 922d7f6c4e6c -r 1cc7bbf75f0b mapeditor.cpp --- a/mapeditor.cpp Fri Dec 29 13:52:19 2006 +0000 +++ b/mapeditor.cpp Fri Jan 05 11:17:32 2007 +0000 @@ -62,7 +62,6 @@ //cout << "Constructor ME "<<this<<endl; mapNum++; - viewport()->setAcceptDrops(true); mapScene= new QGraphicsScene(parent); //mapScene= new QGraphicsScene(QRectF(0,0,width(),height()), parent); @@ -134,8 +133,7 @@ // Create temporary files makeTmpDirs(); - // Initially set movingCentre - updateViewCenter(); + setAcceptDrops (true); mapCenter->reposition(); // for positioning heading @@ -522,20 +520,6 @@ addMapInsertInt(t,y); } } - } else if (com=="colorItem") - { - if (!selection) - { - api.setError (Aborted,"Nothing selected"); - } else if ( typeid(*selection) != typeid(BranchObj) && - typeid(*selection) != typeid(MapCenterObj)) - { - api.setError (Aborted,"Type of selection is not a branch"); - } else if (api.checkParamCount(1)) - { - QColor c=api.parColor (ok,0); - if (ok) colorItem (c); - } } else if (com=="colorBranch") { if (!selection) @@ -550,6 +534,20 @@ QColor c=api.parColor (ok,0); if (ok) colorBranch (c); } + } else if (com=="colorSubtree") + { + if (!selection) + { + api.setError (Aborted,"Nothing selected"); + } else if ( typeid(*selection) != typeid(BranchObj) && + typeid(*selection) != typeid(MapCenterObj)) + { + api.setError (Aborted,"Type of selection is not a branch"); + } else if (api.checkParamCount(1)) + { + QColor c=api.parColor (ok,0); + if (ok) colorSubtree (c); + } } else if (com=="cut") { if (!selection) @@ -1126,7 +1124,6 @@ { QPainter pp(printer); - //pp.setRenderHints(renderHints()); pp.setRenderHint(QPainter::Antialiasing,true); // Don't print the visualisation of selection @@ -1140,79 +1137,49 @@ QRectF mapRect=totalBBox; QGraphicsRectItem *frame=NULL; - if (printFrame || printFooter) + if (printFrame) { - - if (printFrame) - { - // Print frame around map - mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, - totalBBox.width()+20, totalBBox.height()+20); - frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::NoBrush)); - frame->setZValue(0); - frame->show(); - } - - if (printFooter) - { - // Print footer below map - QFont font; - font.setPointSize(10); - pp.setFont (font); - QRectF footerBox(0,printer->height()-15,printer->width(),15); - pp.drawText ( footerBox,Qt::AlignLeft,"VYM - " +fileName); - pp.drawText ( footerBox, Qt::AlignRight, QDate::currentDate().toString(Qt::TextDate)); - } - } - - /* + // Print frame around map + mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, + totalBBox.width()+20, totalBBox.height()+20); + frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::NoBrush)); + frame->setZValue(0); + frame->show(); + } + + double paperAspect = (double)printer->width() / (double)printer->height(); double mapAspect = (double)mapRect.width() / (double)mapRect.height(); - cout <<"mapAspect="<<mapAspect<<" paperAspect"<<paperAspect<<endl; + int viewBottom; if (mapAspect>=paperAspect) { // Fit horizontally to paper width - pp.setViewport(0,0, printer->width(),(int)(printer->width()/mapAspect) ); - qWarning ("Fit hor"); + //pp.setViewport(0,0, printer->width(),(int)(printer->width()/mapAspect) ); + viewBottom=(int)(printer->width()/mapAspect); } else { // Fit vertically to paper height - pp.setViewport(0,0,(int)(printer->height()*mapAspect),printer->height()); - qWarning ("Fit ver"); + //pp.setViewport(0,0,(int)(printer->height()*mapAspect),printer->height()); + viewBottom=printer->height(); } - */ + + if (printFooter) + { + // Print footer below map + QFont font; + font.setPointSize(10); + pp.setFont (font); + QRectF footerBox(0,viewBottom,printer->width(),15); + pp.drawText ( footerBox,Qt::AlignLeft,"VYM - " +fileName); + pp.drawText ( footerBox, Qt::AlignRight, QDate::currentDate().toString(Qt::TextDate)); + } mapScene->render ( &pp, - //pp.viewport(), QRectF (0,0,printer->width(),printer->height()-15), QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height()) ); - //render (&pp,printer->pageRect(), QRect ((int)mapRect.x(),(int)mapRect.y(),400,400)); - - //pp.setWindow (QRect (mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height())); - //mapScene->render(&pp); // draw scene to printer - // Viewport has paper dimension - pp.drawLine (QLine (0,0,printer->width(),printer->height())); - cout << "sceneRect: " - <<mapScene->sceneRect().x()<<"," - <<mapScene->sceneRect().y()<<"," - <<mapScene->sceneRect().width()<<"," - <<mapScene->sceneRect().height()<<","<<endl; - cout << "mapRect: " - <<mapRect.x()<<"," - <<mapRect.y()<<"," - <<mapRect.width()<<"," - <<mapRect.height()<<","<<endl; - cout << "pp.viewport: " - <<pp.viewport().x()<<"," - <<pp.viewport().y()<<"," - <<pp.viewport().width()<<"," - <<pp.viewport().height()<<","<<endl; - cout << "painter: w,h="<<pp.viewport().width()<<","<<pp.viewport().height()<<endl; - cout << "printer: w,h="<<printer->width()<<","<<printer->height()<<endl; - if (frame) delete (frame); // Restore selection @@ -1243,7 +1210,7 @@ { /* FIXME getPixmap not ported yet to QT4 QRectF mapRect=mapCenter->getTotalBBox(); - QPixmap pix (mapRect.size()); + QPixmap pix (); QPainter pp (&pix); // Don't print the visualisation of selection @@ -1256,7 +1223,9 @@ pp.setWindow (mapRect); - mapScene->drawArea(mapRect, &pp); // draw scene to painter + //mapScene->drawArea(mapRect, &pp); // draw scene to painter + mapScene->render(&pp); // draw scene to painter + // Restore selection @@ -1268,7 +1237,6 @@ return pix; */ -return QPixmap(); } void MapEditor::setHideTmpMode (HideTmpMode mode) @@ -1885,7 +1853,7 @@ if (newbo) { saveState( - selection, // FIXME addNewBranch (int pos) sholdnt newbo be deleted here??? + newbo, "delete ()", selection, QString ("addBranch (%1)").arg(pos-2), @@ -2449,7 +2417,7 @@ return Qt::black; } -void MapEditor::colorItem(QColor c) +void MapEditor::colorBranch (QColor c) { if (selection) { @@ -2459,9 +2427,9 @@ BranchObj *bo=(BranchObj*)selection; saveState( selection, - QString ("colorItem (%1)").arg(bo->getColor().name()), + QString ("colorBranch (%1)").arg(bo->getColor().name()), selection, - QString ("colorItem (%1)").arg(c.name()), + QString ("colorBranch (%1)").arg(c.name()), QString("Set color of %1 to %2").arg(getName(bo)).arg(c.name()) ); bo->setColor(c); // color branch @@ -2469,7 +2437,7 @@ } } -void MapEditor::colorBranch(QColor c) +void MapEditor::colorSubtree (QColor c) { if (selection) { @@ -2480,10 +2448,10 @@ saveStateChangingPart( selection, selection, - QString ("colorBranch (%1)").arg(c.name()), + QString ("colorSubtree (%1)").arg(c.name()), QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(c.name()) ); - bo->setColorChilds(c); // color links, color childs + bo->setColorSubtree (c); // color links, color childs } } } @@ -2519,14 +2487,6 @@ } } -void MapEditor::setViewCenter() -{ - // transform to sceneView Coord: - QPointF p=matrix().map(movingCenter); - //FIXME setViewCenter not ported yet to QT4 (center ist TextStream there) - //center ( p.x(), p.y()); -} - BranchObj* MapEditor::findText (QString s, bool cs) { @@ -3393,18 +3353,6 @@ } -void MapEditor::updateViewCenter() -{ -/* FIXME updateViewCenter still to port to QT4 inverseworldmatrix - // Update movingCenter, so that we can zoom comfortably later - QRectF rc = QRectF( contentsX(), contentsY(), - visibleWidth(), visibleHeight() ); - QRectF canvasRect = inverseWorldMatrix().mapRect(rc); - movingCenter.setX((canvasRect.right() + canvasRect.left())/2); - movingCenter.setY((canvasRect.top() + canvasRect.bottom())/2); - */ -} - void MapEditor::contextMenuEvent ( QContextMenuEvent * e ) { // Lineedits are already closed by preceding @@ -3751,15 +3699,9 @@ if (dst && selection) { if (e->state() & Qt::ShiftModifier) - { - ((BranchObj*)selection)->setColor (((BranchObj*)(dst))->getColor()); - ((BranchObj*)selection)->setLinkColor (); - } + colorBranch (((BranchObj*)(dst))->getColor()); else - { - ((BranchObj*)selection)->setColorChilds (((BranchObj*)(dst))->getColor()); - ((BranchObj*)selection)->setLinkColor (); - } + colorSubtree (((BranchObj*)(dst))->getColor()); } return; } @@ -3921,48 +3863,81 @@ void MapEditor::dragEnterEvent(QDragEnterEvent *event) { - for (unsigned int i=0;event->format(i);i++) // Debug mime type - cerr << event->format(i) << endl; - - if (event->mimeData()->hasFormat("image/png")) - event->acceptProposedAction(); + //for (unsigned int i=0;event->format(i);i++) // Debug mime type + // cerr << event->format(i) << endl; + + if (event->mimeData()->hasImage()) + event->acceptProposedAction(); + else + if (event->mimeData()->hasUrls()) + event->acceptProposedAction(); +} + +void MapEditor::dragMoveEvent(QDragMoveEvent *event) +{ +} + +void MapEditor::dragLeaveEvent(QDragLeaveEvent *event) +{ + event->accept(); } void MapEditor::dropEvent(QDropEvent *event) { - if (event->mimeData()->hasFormat("image/png")) -} - -void MapEditor::contentsDropEvent(QDropEvent *event) -{ - //FIXME dropEvent not ported to QT4 yet if (selection && (typeid(*selection) == typeid(BranchObj)) || (typeid(*selection) == typeid(MapCenterObj))) { - bool update=false; - QStringList uris; - QString heading; - - - if (event->mimeData()->hasFormat("image/png")) + QList <QUrl> uris; + if (event->mimeData()->hasImage()) { - event->acceptProposedAction(); - addFloatImageInt(event->mimeData()->imageData().value<QPixmap>()); - cout << "accepted drop\n"; - } - - /* - if (event->provides("image/png")) + QVariant imageData = event->mimeData()->imageData(); + addFloatImageInt (qvariant_cast<QPixmap>(imageData)); + } else + if (event->mimeData()->hasUrls()) + uris=event->mimeData()->urls(); + + if (uris.count()>0) { - QPixmap pix; - if (Q3ImageDrag::decode(event, pix)) + QStringList files; + QString s; + QString heading; + BranchObj *bo; + for (int i=0; i<uris.count();++i) { - addFloatImageInt(pix); - event->accept(); - update=true; - } else - event->ignore(); + bo=((BranchObj*)selection)->addBranch(); + if (bo) + { + s=uris.at(i).toLocalFile(); + if (!s.isEmpty()) + { + QString file = QDir::convertSeparators(s); + heading = QFileInfo(file).baseName(); + files.append(file); + if (file.endsWith(".vym", false)) + bo->setVymLink(file); + else + bo->setURL(uris.at(i).toString()); + } else + { + bo->setURL(uris.at(i).toString()); + } + + if (!heading.isEmpty()) + bo->setHeading(heading); + else + bo->setHeading(uris.at(i).toString()); + } + } + mapCenter->reposition(); + } + } + event->acceptProposedAction(); +} + +/* +void MapEditor::contentsDropEvent(QDropEvent *event) +{ } else if (event->provides("application/x-moz-file-promise-url") && event->provides("application/x-moz-nativeimage")) @@ -4009,101 +3984,10 @@ event->accept(); update= true; } + */ - /* not ported yet QSTRINGLIST has no next... - if (uris.count()>0) - { - QStringList files; - QStringList urls; - QString s; - BranchObj *bo; - for (const char* u=uris.first(); u; u=uris.next()) - { - bo=((BranchObj*)selection)->addBranch(); - if (bo) - { - s=Q3UriDrag::uriToLocalFile(u); - if (!s.isEmpty()) - { - QString file = QDir::convertSeparators(s); - heading = QFileInfo(file).baseName(); - files.append(file); - if (file.endsWith(".vym", false)) - bo->setVymLink(file); - else - bo->setURL(u); - } else - { - urls.append (u); - bo->setURL(u); - } - - if (!heading.isEmpty()) - bo->setHeading(heading); - else - bo->setHeading(u); - } - } - update=true; - } - */ - if (update) - { - //FIXME dropEvent: saveState has to be called earlier for each of the drops... - //saveStateComplete("Drop Event"); //TODO undo Command - mapCenter->reposition(); - scene()->update(); - } - } -} - - -void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event) -{ - //FIXME contentsDragEnterEvent not ported to QT4 yet - -// for (unsigned int i=0;event->format(i);i++) // Debug mime type -// cerr << event->format(i) << endl; - - if (selection && - (typeid(*selection) == typeid(BranchObj)) || - (typeid(*selection) == typeid(MapCenterObj))) { - - // If QImageDrag can decode mime type - if (Q3ImageDrag::canDecode(event)) { - event->accept(); - return; - } - - // If image are dragged from firefox - if (event->provides("application/x-moz-file-promise-url") && - event->provides("application/x-moz-nativeimage")) { - event->accept(true); - return; - } - - // If QUriDrag can decode mime type - if (Q3UriDrag::canDecode(event)) { - event->accept(); - return; - } - - // If Uri are dragged from firefox - if (event->provides("_NETSCAPE_URL")){ - event->accept(); - return; - } - - // If QTextDrag can decode mime type - if (Q3TextDrag::canDecode(event)) { - event->accept(); - return; - } - - } - event->ignore(); -} + bool isUnicode16(const QByteArray &d) { diff -r 922d7f6c4e6c -r 1cc7bbf75f0b mapeditor.h --- a/mapeditor.h Fri Dec 29 13:52:19 2006 +0000 +++ b/mapeditor.h Fri Jan 05 11:17:32 2007 +0000 @@ -126,10 +126,9 @@ void setMapBackgroundColor(QColor); QColor getMapBackgroundColor(); QColor getCurrentHeadingColor(); - void colorItem(QColor); void colorBranch(QColor); + void colorSubtree(QColor); void toggleStandardFlag(QString); - virtual void setViewCenter(); // needed for zooming BranchObj* findText(QString,bool); // Find object void findReset(); // Reset Find void setURL(const QString &); // set the URL @@ -185,7 +184,6 @@ protected: void ensureSelectionVisible(); - virtual void updateViewCenter(); // needed for zooming virtual void contextMenuEvent ( QContextMenuEvent *e ); virtual void keyPressEvent(QKeyEvent*); virtual void keyReleaseEvent(QKeyEvent*); @@ -194,11 +192,11 @@ virtual void mouseDoubleClickEvent(QMouseEvent*); virtual void mouseMoveEvent(QMouseEvent*); - virtual void dragEnterEvent (QDragEnterEvent *); - virtual void dropEvent (QDropEvent *); + void dragEnterEvent (QDragEnterEvent *); + void dragMoveEvent (QDragMoveEvent *); + void dragLeaveEvent (QDragLeaveEvent *); + void dropEvent (QDropEvent *); - virtual void contentsDragEnterEvent(QDragEnterEvent *event); - virtual void contentsDropEvent(QDropEvent *event); private: QGraphicsScene *mapScene; MapCenterObj* mapCenter; @@ -231,7 +229,6 @@ QPointF movingObj_start; // rel. pos of mouse to absPos QPointF movingCont_start; // inital pos of moving Content or QPointF movingVec; // how far has Content moved - QPointF movingCenter; // used when zooming QPrinter* printer; // Printing bool mapDefault; // Flag if map is untouched 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() { diff -r 922d7f6c4e6c -r 1cc7bbf75f0b ornamentedobj.h --- a/ornamentedobj.h Fri Dec 29 13:52:19 2006 +0000 +++ b/ornamentedobj.h Fri Jan 05 11:17:32 2007 +0000 @@ -40,6 +40,7 @@ virtual QString getSystemFlagName (const QPointF &p); virtual bool isActiveFlag(const QString&); // check if flag is set virtual void updateNoteFlag(); + virtual void getNoteFromTextEditor (); virtual void updateFlagsToolbar(); virtual void setHideInExport(bool); // set export of object (and childs) virtual bool hideInExport(); @@ -49,6 +50,7 @@ protected: HeadingObj *heading; // Heading NoteObj note; // Notes + bool isNoteInEditor; // true if TextEditor has this note FlagRowObj *systemFlags; // System Flags FlagRowObj *standardFlags; // Standard Flags QRectF ornamentsBBox; // bbox of flags and heading diff -r 922d7f6c4e6c -r 1cc7bbf75f0b version.h --- a/version.h Fri Dec 29 13:52:19 2006 +0000 +++ b/version.h Fri Jan 05 11:17:32 2007 +0000 @@ -4,8 +4,8 @@ #include <QString> #define __VYM_NAME "VYM" -#define __VYM_VERSION "1.8.63" -#define __VYM_BUILD_DATE "December 21, 2006" +#define __VYM_VERSION "1.8.64" +#define __VYM_BUILD_DATE "January 2, 2007" bool checkVersion(const QString &);