1.1 --- a/mapeditor.cpp Mon Apr 18 06:37:48 2005 +0000
1.2 +++ b/mapeditor.cpp Thu Apr 21 19:14:38 2005 +0000
1.3 @@ -283,7 +283,8 @@
1.4 lineedit->hide();
1.5
1.6 actColor=black; setColor (actColor);
1.7 - deflinkcolor=QColor (0,0,255);
1.8 + defLinkColor=QColor (0,0,255);
1.9 + defXLinkColor=QColor (180,180,180);
1.10 linkcolorhint=DefaultColor;
1.11 linkstyle=StylePolyParabel;
1.12 mapCanvas->setBackgroundColor (white);
1.13 @@ -506,7 +507,9 @@
1.14 attribut("date",mapCenter->getDate()) +
1.15 attribut("backgroundColor", mapCanvas->backgroundColor().name() ) +
1.16 attribut("linkStyle", ls ) +
1.17 - attribut("linkColor", deflinkcolor.name() ) +
1.18 + attribut("linkColor", defLinkColor.name() ) +
1.19 + attribut("xlinkColor", defXLinkColor.name() ) +
1.20 + attribut("xlinkWidth", QString().setNum(defXLinkWidth,10) ) +
1.21 colhint;
1.22 s+=beginElement("vymmap",mapAttr);
1.23 incIndent();
1.24 @@ -2193,7 +2196,7 @@
1.25 QPixmap pix( 16, 16 );
1.26 pix.fill( mapCanvas->backgroundColor() );
1.27 actionFormatBackColor->setIconSet( pix );
1.28 - pix.fill( deflinkcolor );
1.29 + pix.fill( defLinkColor );
1.30 actionFormatLinkColor->setIconSet( pix );
1.31
1.32 actionEditUndo->setEnabled( mapChanged );
1.33 @@ -2377,7 +2380,7 @@
1.34
1.35 void MapEditor::setLinkColor(QColor c)
1.36 {
1.37 - deflinkcolor=c;
1.38 + defLinkColor=c;
1.39 updateActions();
1.40 }
1.41
1.42 @@ -2421,7 +2424,27 @@
1.43
1.44 QColor MapEditor::getDefLinkColor()
1.45 {
1.46 - return deflinkcolor;
1.47 + return defLinkColor;
1.48 +}
1.49 +
1.50 +void MapEditor::setDefXLinkColor(QColor col)
1.51 +{
1.52 + defXLinkColor=col;
1.53 +}
1.54 +
1.55 +QColor MapEditor::getDefXLinkColor()
1.56 +{
1.57 + return defXLinkColor;
1.58 +}
1.59 +
1.60 +void MapEditor::setDefXLinkWidth (int w)
1.61 +{
1.62 + defXLinkWidth=w;
1.63 +}
1.64 +
1.65 +int MapEditor::getDefXLinkWidth()
1.66 +{
1.67 + return defXLinkWidth;
1.68 }
1.69
1.70 void MapEditor::selectLinkColor()
1.71 @@ -2429,7 +2452,7 @@
1.72 // Finish open lineEdits
1.73 if (lineedit) finishedLineEditNoSave();
1.74
1.75 - QColor col = QColorDialog::getColor( deflinkcolor, this );
1.76 + QColor col = QColorDialog::getColor( defLinkColor, this );
1.77 if ( !col.isValid() ) return;
1.78 setLinkColor( col );
1.79 setChanged();
1.80 @@ -2649,29 +2672,45 @@
1.81
1.82 void MapEditor::followXLink(int i)
1.83 {
1.84 - BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i);
1.85 - if (bo)
1.86 + if (selection &&
1.87 + (typeid(*selection) == typeid(BranchObj)) ||
1.88 + (typeid(*selection) == typeid(MapCenterObj)) )
1.89 {
1.90 - selection->unselect();
1.91 - selection=bo;
1.92 - selection->select();
1.93 - ensureSelectionVisible();
1.94 + BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i);
1.95 + if (bo)
1.96 + {
1.97 + selection->unselect();
1.98 + selection=bo;
1.99 + selection->select();
1.100 + ensureSelectionVisible();
1.101 + }
1.102 }
1.103 }
1.104
1.105 void MapEditor::editXLink(int i)
1.106 {
1.107 - BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i);
1.108 - if (bo)
1.109 + if (selection &&
1.110 + (typeid(*selection) == typeid(BranchObj)) ||
1.111 + (typeid(*selection) == typeid(MapCenterObj)) )
1.112 {
1.113 - EditXLinkDialog dia;
1.114 - if (dia.exec() == QDialog::Accepted)
1.115 + XLinkObj *xlo=((BranchObj*)(selection))->XLinkAt(i);
1.116 + if (xlo)
1.117 {
1.118 - if (dia.deleteXLink())
1.119 - ((BranchObj*)(selection))->deleteXLinkAt(i);
1.120 - setChanged();
1.121 - }
1.122 - }
1.123 + EditXLinkDialog dia;
1.124 + dia.setXLink (xlo);
1.125 + if (dia.exec() == QDialog::Accepted)
1.126 + {
1.127 + if (dia.useSettingsGlobal() )
1.128 + {
1.129 + setDefXLinkColor (xlo->getColor() );
1.130 + setDefXLinkWidth (xlo->getWidth() );
1.131 + }
1.132 + if (dia.deleteXLink())
1.133 + ((BranchObj*)(selection))->deleteXLinkAt(i);
1.134 + setChanged();
1.135 + }
1.136 + }
1.137 + }
1.138 }
1.139
1.140 void MapEditor::testFunction()
1.141 @@ -2784,6 +2823,8 @@
1.142 tmpXLink=new XLinkObj (mapCanvas);
1.143 tmpXLink->setBegin (bo_begin);
1.144 tmpXLink->setEnd (p);
1.145 + tmpXLink->setColor(defXLinkColor);
1.146 + tmpXLink->setWidth(defXLinkWidth);
1.147 tmpXLink->updateXLink();
1.148 tmpXLink->setVisibility (true);
1.149 return;