diff -r ec8c73975c1a -r 31c6ce8efbc7 mapeditor.cpp --- a/mapeditor.cpp Thu Mar 24 20:48:58 2005 +0000 +++ b/mapeditor.cpp Thu Mar 24 21:10:38 2005 +0000 @@ -99,6 +99,7 @@ extern QActionGroup* actionGroupModModes; extern QAction* actionModModeColor; extern QAction* actionModModeLink; +extern QAction* actionModModeCopy; extern QActionGroup *actionGroupFormatFrameTypes; extern QAction *actionFormatFrameNone; @@ -155,27 +156,27 @@ FlagObj *fo = new FlagObj (mapCanvas); fo->load(QPixmap(flag_note_xpm)); fo->setName("note"); - fo->setToolTip(tr("Note")); + fo->setToolTip(tr("Note","Systemflag")); systemFlagsDefault->addFlag (fo); // makes deep copy fo->load(QPixmap(flag_url_xpm)); fo->setName("url"); - fo->setToolTip(tr("WWW Document (external)")); + fo->setToolTip(tr("WWW Document (external)","Systemflag")); systemFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_vymlink_xpm)); fo->setName("vymLink"); - fo->setToolTip(tr("Link to another vym map")); + fo->setToolTip(tr("Link to another vym map","Systemflag")); systemFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_scrolled_right_xpm)); fo->setName("scrolledright"); - fo->setToolTip(tr("subtree is scrolled")); + fo->setToolTip(tr("subtree is scrolled","Systemflag")); systemFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_tmpUnscrolled_right_xpm)); fo->setName("tmpUnscrolledright"); - fo->setToolTip(tr("subtree is temporary scrolled")); + fo->setToolTip(tr("subtree is temporary scrolled","Systemflag")); systemFlagsDefault->addFlag (fo); delete (fo); } @@ -188,82 +189,82 @@ FlagObj *fo = new FlagObj (mapCanvas); fo->load(QPixmap(flag_exclamationmark_xpm)); fo->setName("exclamationmark"); - fo->setToolTip(tr("Take care!")); + fo->setToolTip(tr("Take care!","Standardflag")); standardFlagsDefault->addFlag (fo); // makes deep copy fo->load(QPixmap(flag_questionmark_xpm)); fo->setName("questionmark"); - fo->setToolTip(tr("Really?")); + fo->setToolTip(tr("Really?","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_hook_green_xpm)); fo->setName("hook-green"); - fo->setToolTip(tr("ok!")); + fo->setToolTip(tr("ok!","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_cross_red_xpm)); fo->setName("cross-red"); - fo->setToolTip(tr("Not ok!")); + fo->setToolTip(tr("Not ok!","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_stopsign_xpm)); fo->setName("stopsign"); - fo->setToolTip(tr("This won't work!")); + fo->setToolTip(tr("This won't work!","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_smiley_good_xpm)); fo->setName("smiley-good"); - fo->setToolTip(tr("Good")); + fo->setToolTip(tr("Good","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_smiley_sad_xpm)); fo->setName("smiley-sad"); - fo->setToolTip(tr("Bad")); + fo->setToolTip(tr("Bad","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_clock_xpm)); fo->setName("clock"); - fo->setToolTip(tr("Time critical")); + fo->setToolTip(tr("Time critical","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_lamp_xpm)); fo->setName("lamp"); - fo->setToolTip(tr("Idea!")); + fo->setToolTip(tr("Idea!","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_arrow_up_xpm)); fo->setName("arrow-up"); - fo->setToolTip(tr("Important")); + fo->setToolTip(tr("Important","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_arrow_down_xpm)); fo->setName("arrow-down"); - fo->setToolTip(tr("Unimportant")); + fo->setToolTip(tr("Unimportant","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_thumb_up_xpm)); fo->setName("thumb-up"); - fo->setToolTip(tr("I like this")); + fo->setToolTip(tr("I like this","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_thumb_down_xpm)); fo->setName("thumb-down"); - fo->setToolTip(tr("I do not like this")); + fo->setToolTip(tr("I do not like this","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_heart_xpm)); fo->setName("heart"); - fo->setToolTip(tr("I just love... ")); + fo->setToolTip(tr("I just love... ","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_flash_xpm)); fo->setName("flash"); - fo->setToolTip(tr("Dangerous")); + fo->setToolTip(tr("Dangerous","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_lifebelt_xpm)); fo->setName("lifebelt"); - fo->setToolTip(tr("This will help")); + fo->setToolTip(tr("This will help","Standardflag")); standardFlagsDefault->addFlag (fo); delete (fo); @@ -272,7 +273,7 @@ mapCenter = new MapCenterObj(mapCanvas); mapCenter->setVisibility (true); mapCenter->setMapEditor (this); - mapCenter->setHeading (tr("New Map")); + mapCenter->setHeading (tr("New Map","Heading of mapcenter in new map")); printer=NULL; @@ -308,6 +309,7 @@ pickingColor=false; drawingLink=false; + copyingObj=false; editingBO=NULL; selection=NULL; @@ -1319,11 +1321,10 @@ saveState(PartOfMap,selection); ensureSelectionVisible(); - BranchObj *bo=(BranchObj*)(selection); editingBO=(BranchObj*)(selection); - QPoint p = worldMatrix().map(QPoint (bo->x(),bo->y())); + QPoint p = worldMatrix().map(QPoint (editingBO->x(),editingBO->y())); lineedit->setGeometry(p.x()-contentsX(),p.y()-contentsY(),200,25); - QString s=bo->getHeading(); + QString s=editingBO->getHeading(); lineedit->setText(s); lineedit->setCursorPosition(1); if (actionSettingsAutoselectText->isOn() && !s.isEmpty() && actionSettingsPasteNewHeading->isOn() ) @@ -2688,6 +2689,39 @@ void MapEditor::testFunction() { cout << "MapEditor::testFunction() called\n"; + if (selection && + (typeid(*selection) == typeid(BranchObj) || + typeid(*selection) == typeid(MapCenterObj) ) ) + { + BranchObj *bo=(BranchObj*)(selection); + QPoint p = worldMatrix().map(QPoint (bo->x(),bo->y())); + // lineedit->setGeometry(p.x()-contentsX(),p.y()-contentsY(),200,25); + QPopupMenu *popupLinks=new QPopupMenu (this); + if (bo->countLinks()==0) + { + popupLinks->clear(); + popupLinks->insertItem ("No link available"); + + } else + { + BranchObj *bot; + QString s; + popupLinks->clear(); + for (int i=0; i<=bo->countLinks();i++) + { + bot=bo->linkTargetAt(i); + if (bot) + { + s=bot->getHeading(); + if (s.length()>25) + s=s.left(25)+"..."; + popupLinks->insertItem (s); + } + } + } + popupLinks->exec(); + + } } void MapEditor::ensureSelectionVisible() @@ -2809,6 +2843,7 @@ selection->select(); adjustCanvasSize(); + } // Check, if systemFlag clicked @@ -2837,17 +2872,36 @@ // Left Button Move Branches if (e->button() == QMouseEvent::LeftButton ) { + // If modMode==copy, then we want to "move" the _new_ object around + // then we need the offset from p to the _old_ selection, because of tmp + if (actionModModeCopy->isOn() && + e->state() & QMouseEvent::ControlButton) + { + if (typeid(*selection)==typeid(BranchObj) ) + { + copyingObj=true; + movingObj_start.setX( p.x() - selection->x() ); + movingObj_start.setY( p.y() - selection->y() ); + mapCenter->addBranch ((BranchObj*)(selection)); + unselect(); + selection=mapCenter->getLastBranch(); + selection->select(); + selection->setParObjTmp ((BranchObj*)(selection),p,1); + selection->updateLink(); + } + } else + { + movingObj_start.setX( p.x() - selection->x() ); + movingObj_start.setY( p.y() - selection->y() ); + } + movingObj=selection; - movingObj_start.setX( p.x() - selection->x() ); - movingObj_start.setY( p.y() - selection->y() ); } else // Middle Button Toggle Scroll // (On Mac OS X this won't work, but we still have // a button in the toolbar) if (e->button() == QMouseEvent::MidButton ) - { toggleScroll(); - } updateActions(); } else { // No MapObj found, we are on the Canvas itself @@ -2972,12 +3026,15 @@ lmosel->setParObjTmp (lmo,p,0); } else { + lmosel->unsetParObjTmp(); + /* if (lmo &&(lmo==selection)) // Could link to myself (happens sometimes...) lmosel->unsetParObjTmp(); if (!lmo) // no Obj under selection, go back to original Parent lmosel->unsetParObjTmp(); + */ } } // depth>0 @@ -3078,8 +3135,24 @@ // Reset the temporary drawn link to the original one ((LinkableMapObj*)(selection))->unsetParObjTmp(); - if (dst ) - { + + if (!dst ) + { + if (copyingObj) + { + // remove the current selection, if we have no destination + selection->unselect(); + ((BranchObj*)(selection->getParObj()))->removeBranch ((BranchObj*)(selection)); + if (selectionLast) + { + selection=selectionLast; + selectionLast=NULL; + selection->select(); + } + copyingObj=false; + } + } else + { setChanged(); saveState(); // TODO we also could check, if dest and src are on same branch, @@ -3095,21 +3168,21 @@ ); //if (selection) selection->select(); } else - if (e->state() & QMouseEvent::ControlButton) - { - ((BranchObj*)(selection))->moveBranchTo - ( - (BranchObj*)(dst), - ((BranchObj*)(dst))->getNum()+1 - ); - //if (selection) selection->select(); - } else - { - ((BranchObj*)(selection))->moveBranchTo ((BranchObj*)(dst),-1); - if (dst->getDepth()==0) - ((BranchObj*)(selection))->move (savePos); - } - } + if (e->state() & QMouseEvent::ControlButton) + { + ((BranchObj*)(selection))->moveBranchTo + ( + (BranchObj*)(dst), + ((BranchObj*)(dst))->getNum()+1 + ); + //if (selection) selection->select(); + } else + { + ((BranchObj*)(selection))->moveBranchTo ((BranchObj*)(dst),-1); + if (dst->getDepth()==0) + ((BranchObj*)(selection))->move (savePos); + } + } // Draw the original link, before selection was moved around mapCenter->reposition(); }