diff -r 31c6ce8efbc7 -r 6783e13bb05d mapeditor.cpp --- a/mapeditor.cpp Thu Mar 24 21:10:38 2005 +0000 +++ b/mapeditor.cpp Sat Apr 09 22:50:08 2005 +0000 @@ -29,6 +29,7 @@ #include "misc.h" #include "mainwindow.h" #include "extrainfodialog.h" +#include "editlinkdialog.h" #include "settings.h" #include "icons/flag-note.xpm" @@ -87,7 +88,6 @@ extern QAction *actionEditSelectLast; extern QAction *actionEditLoadImage; extern QAction *actionEditToggleFloatExport; -extern QAction *actionEditNoLink; extern QAction* actionFormatPickColor; extern QAction* actionFormatColorBranch; @@ -120,6 +120,7 @@ extern QPopupMenu *branchContextMenu; extern QPopupMenu *branchLinksContextMenu; +extern QPopupMenu *branchLinksContextMenuDup; extern QPopupMenu *floatimageContextMenu; extern QPopupMenu *saveImageFormatMenu; extern QPopupMenu *exportImageFormatMenu; @@ -521,6 +522,9 @@ if ( undoSelection && typeid(*undoSelection) == typeid(BranchObj) ) s+=((BranchObj*)(undoSelection))->saveToDir(tmpdir,prefix,offset); + else + if (selection && typeid(*selection)==typeid(BranchObj)) + s+=((BranchObj*)(selection))->saveToDir(tmpdir,prefix,offset); } // Save local settings @@ -550,8 +554,8 @@ // the xml data itself is kept in memory in backupXML // // For faster write/read of data, a part of the map can be - // written. Then the undoSelection will mark, which part of the - // map should be replaced if an undo is wanted later. + // written. Then the undoSelection will mark the part of the + // map which should be replaced if an undo is wanted later. if (mode==PartOfMap && part && (typeid(*part) == typeid (BranchObj) ) ) { @@ -773,7 +777,7 @@ if ( !file.open( IO_WriteOnly ) ) { // This should neverever happen - QMessageBox::critical(0, tr("Critcal save error"),"MapEditor::save() Couldn't open "+file.name()); + QMessageBox::critical(0, tr("Critcal Save error"),"MapEditor::save() Couldn't open "+file.name()); return 1; } @@ -2241,12 +2245,15 @@ { branchLinksContextMenu->clear(); branchLinksContextMenu->insertItem ("No link available"); + branchLinksContextMenuDup->clear(); + branchLinksContextMenuDup->insertItem ("No link available"); } else { BranchObj *bot; QString s; branchLinksContextMenu->clear(); + branchLinksContextMenuDup->clear(); for (int i=0; i<=bo->countLinks();i++) { bot=bo->linkTargetAt(i); @@ -2256,6 +2263,7 @@ if (s.length()>25) s=s.left(25)+"..."; branchLinksContextMenu->insertItem (s); + branchLinksContextMenuDup->insertItem (s); } } } @@ -2686,6 +2694,21 @@ } } +void MapEditor::editLink(int i) +{ + BranchObj *bo=((BranchObj*)(selection))->linkTargetAt(i); + if (bo) + { + EditLinkDialog dia; + if (dia.exec() == QDialog::Accepted) + { + if (dia.deleteLink()) + ((BranchObj*)(selection))->deleteLinkAt(i); + setChanged(); + } + } +} + void MapEditor::testFunction() { cout << "MapEditor::testFunction() called\n"; @@ -2719,6 +2742,7 @@ } } } + popupLinks->move(p); popupLinks->exec(); } @@ -3136,6 +3160,7 @@ ((LinkableMapObj*)(selection))->unsetParObjTmp(); + copyingObj=false; if (!dst ) { if (copyingObj) @@ -3149,7 +3174,6 @@ selectionLast=NULL; selection->select(); } - copyingObj=false; } } else {