diff -r 598768200cfa -r 0b048b6bb6f4 mapeditor.cpp --- a/mapeditor.cpp Mon Apr 18 06:37:48 2005 +0000 +++ b/mapeditor.cpp Thu Apr 21 19:14:38 2005 +0000 @@ -283,7 +283,8 @@ lineedit->hide(); actColor=black; setColor (actColor); - deflinkcolor=QColor (0,0,255); + defLinkColor=QColor (0,0,255); + defXLinkColor=QColor (180,180,180); linkcolorhint=DefaultColor; linkstyle=StylePolyParabel; mapCanvas->setBackgroundColor (white); @@ -506,7 +507,9 @@ attribut("date",mapCenter->getDate()) + attribut("backgroundColor", mapCanvas->backgroundColor().name() ) + attribut("linkStyle", ls ) + - attribut("linkColor", deflinkcolor.name() ) + + attribut("linkColor", defLinkColor.name() ) + + attribut("xlinkColor", defXLinkColor.name() ) + + attribut("xlinkWidth", QString().setNum(defXLinkWidth,10) ) + colhint; s+=beginElement("vymmap",mapAttr); incIndent(); @@ -2193,7 +2196,7 @@ QPixmap pix( 16, 16 ); pix.fill( mapCanvas->backgroundColor() ); actionFormatBackColor->setIconSet( pix ); - pix.fill( deflinkcolor ); + pix.fill( defLinkColor ); actionFormatLinkColor->setIconSet( pix ); actionEditUndo->setEnabled( mapChanged ); @@ -2377,7 +2380,7 @@ void MapEditor::setLinkColor(QColor c) { - deflinkcolor=c; + defLinkColor=c; updateActions(); } @@ -2421,7 +2424,27 @@ QColor MapEditor::getDefLinkColor() { - return deflinkcolor; + return defLinkColor; +} + +void MapEditor::setDefXLinkColor(QColor col) +{ + defXLinkColor=col; +} + +QColor MapEditor::getDefXLinkColor() +{ + return defXLinkColor; +} + +void MapEditor::setDefXLinkWidth (int w) +{ + defXLinkWidth=w; +} + +int MapEditor::getDefXLinkWidth() +{ + return defXLinkWidth; } void MapEditor::selectLinkColor() @@ -2429,7 +2452,7 @@ // Finish open lineEdits if (lineedit) finishedLineEditNoSave(); - QColor col = QColorDialog::getColor( deflinkcolor, this ); + QColor col = QColorDialog::getColor( defLinkColor, this ); if ( !col.isValid() ) return; setLinkColor( col ); setChanged(); @@ -2649,29 +2672,45 @@ void MapEditor::followXLink(int i) { - BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i); - if (bo) + if (selection && + (typeid(*selection) == typeid(BranchObj)) || + (typeid(*selection) == typeid(MapCenterObj)) ) { - selection->unselect(); - selection=bo; - selection->select(); - ensureSelectionVisible(); + BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i); + if (bo) + { + selection->unselect(); + selection=bo; + selection->select(); + ensureSelectionVisible(); + } } } void MapEditor::editXLink(int i) { - BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i); - if (bo) + if (selection && + (typeid(*selection) == typeid(BranchObj)) || + (typeid(*selection) == typeid(MapCenterObj)) ) { - EditXLinkDialog dia; - if (dia.exec() == QDialog::Accepted) + XLinkObj *xlo=((BranchObj*)(selection))->XLinkAt(i); + if (xlo) { - if (dia.deleteXLink()) - ((BranchObj*)(selection))->deleteXLinkAt(i); - setChanged(); - } - } + EditXLinkDialog dia; + dia.setXLink (xlo); + if (dia.exec() == QDialog::Accepted) + { + if (dia.useSettingsGlobal() ) + { + setDefXLinkColor (xlo->getColor() ); + setDefXLinkWidth (xlo->getWidth() ); + } + if (dia.deleteXLink()) + ((BranchObj*)(selection))->deleteXLinkAt(i); + setChanged(); + } + } + } } void MapEditor::testFunction() @@ -2784,6 +2823,8 @@ tmpXLink=new XLinkObj (mapCanvas); tmpXLink->setBegin (bo_begin); tmpXLink->setEnd (p); + tmpXLink->setColor(defXLinkColor); + tmpXLink->setWidth(defXLinkWidth); tmpXLink->updateXLink(); tmpXLink->setVisibility (true); return;