1.1 --- a/mapeditor.cpp Sat Apr 09 22:50:08 2005 +0000
1.2 +++ b/mapeditor.cpp Mon Apr 18 06:17:00 2005 +0000
1.3 @@ -17,7 +17,7 @@
1.4 #include <qinputdialog.h>
1.5
1.6 #include <iostream>
1.7 -#include <stdlib.h>
1.8 +#include <cstdlib>
1.9 #include <typeinfo>
1.10
1.11 #include "version.h"
1.12 @@ -29,7 +29,7 @@
1.13 #include "misc.h"
1.14 #include "mainwindow.h"
1.15 #include "extrainfodialog.h"
1.16 -#include "editlinkdialog.h"
1.17 +#include "editxlinkdialog.h"
1.18 #include "settings.h"
1.19
1.20 #include "icons/flag-note.xpm"
1.21 @@ -1449,43 +1449,9 @@
1.22 return selection;
1.23 }
1.24
1.25 -LinkableMapObj* MapEditor::findObj (QString s)
1.26 -{
1.27 - LinkableMapObj *lmo=mapCenter;
1.28 - QString part;
1.29 - QString typ;
1.30 - QString num;
1.31 - while (!s.isEmpty() )
1.32 - {
1.33 - part=s.section(",",0,0);
1.34 - typ=part.left (3);
1.35 - num=part.right(part.length() - 3);
1.36 -
1.37 - if (typ=="mc:")
1.38 - {
1.39 - if (num=="")
1.40 - break;
1.41 - else
1.42 - lmo=mapCenter->getBranchNum (num.toUInt());
1.43 - } else
1.44 - if (typ=="bo:")
1.45 - lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
1.46 - else
1.47 - if (typ=="fi:")
1.48 - lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
1.49 - if (!lmo) break;
1.50 -
1.51 - if (s.contains(","))
1.52 - s=s.right(s.length() - part.length() -1 );
1.53 - else
1.54 - break;
1.55 - }
1.56 - return lmo;
1.57 -}
1.58 -
1.59 bool MapEditor::select (const QString &s)
1.60 {
1.61 - LinkableMapObj *lmo=findObj(s);
1.62 + LinkableMapObj *lmo=mapCenter->findObj(s);
1.63
1.64 // Finally select the found object
1.65 if (lmo)
1.66 @@ -2104,8 +2070,7 @@
1.67 typeid(*selection) == typeid(MapCenterObj)) )
1.68 {
1.69 BranchObj *b=(BranchObj*)(selection);
1.70 - b->setURL ("http://bugzilla.suse.de/show_bug.cgi?id="+b->getHeading());
1.71 - b->setURL ("https://bugzilla.innerweb.novell.com/show_bug.cgi?id="+b->getHeading());
1.72 + b->setURL ("https://bugzilla.novell.com/show_bug.cgi?id="+b->getHeading());
1.73 updateActions();
1.74 setChanged();
1.75 }
1.76 @@ -2241,7 +2206,7 @@
1.77 {
1.78 BranchObj *bo=(BranchObj*)(selection);
1.79 // Take care of links
1.80 - if (bo->countLinks()==0)
1.81 + if (bo->countXLinks()==0)
1.82 {
1.83 branchLinksContextMenu->clear();
1.84 branchLinksContextMenu->insertItem ("No link available");
1.85 @@ -2254,9 +2219,9 @@
1.86 QString s;
1.87 branchLinksContextMenu->clear();
1.88 branchLinksContextMenuDup->clear();
1.89 - for (int i=0; i<=bo->countLinks();i++)
1.90 + for (int i=0; i<=bo->countXLinks();i++)
1.91 {
1.92 - bot=bo->linkTargetAt(i);
1.93 + bot=bo->XLinkTargetAt(i);
1.94 if (bot)
1.95 {
1.96 s=bot->getHeading();
1.97 @@ -2682,9 +2647,9 @@
1.98 }
1.99 }
1.100
1.101 -void MapEditor::followLink(int i)
1.102 +void MapEditor::followXLink(int i)
1.103 {
1.104 - BranchObj *bo=((BranchObj*)(selection))->linkTargetAt(i);
1.105 + BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i);
1.106 if (bo)
1.107 {
1.108 selection->unselect();
1.109 @@ -2694,16 +2659,16 @@
1.110 }
1.111 }
1.112
1.113 -void MapEditor::editLink(int i)
1.114 +void MapEditor::editXLink(int i)
1.115 {
1.116 - BranchObj *bo=((BranchObj*)(selection))->linkTargetAt(i);
1.117 + BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i);
1.118 if (bo)
1.119 {
1.120 - EditLinkDialog dia;
1.121 + EditXLinkDialog dia;
1.122 if (dia.exec() == QDialog::Accepted)
1.123 {
1.124 - if (dia.deleteLink())
1.125 - ((BranchObj*)(selection))->deleteLinkAt(i);
1.126 + if (dia.deleteXLink())
1.127 + ((BranchObj*)(selection))->deleteXLinkAt(i);
1.128 setChanged();
1.129 }
1.130 }
1.131 @@ -2712,40 +2677,9 @@
1.132 void MapEditor::testFunction()
1.133 {
1.134 cout << "MapEditor::testFunction() called\n";
1.135 - if (selection &&
1.136 - (typeid(*selection) == typeid(BranchObj) ||
1.137 - typeid(*selection) == typeid(MapCenterObj) ) )
1.138 - {
1.139 - BranchObj *bo=(BranchObj*)(selection);
1.140 - QPoint p = worldMatrix().map(QPoint (bo->x(),bo->y()));
1.141 - // lineedit->setGeometry(p.x()-contentsX(),p.y()-contentsY(),200,25);
1.142 - QPopupMenu *popupLinks=new QPopupMenu (this);
1.143 - if (bo->countLinks()==0)
1.144 - {
1.145 - popupLinks->clear();
1.146 - popupLinks->insertItem ("No link available");
1.147 -
1.148 - } else
1.149 - {
1.150 - BranchObj *bot;
1.151 - QString s;
1.152 - popupLinks->clear();
1.153 - for (int i=0; i<=bo->countLinks();i++)
1.154 - {
1.155 - bot=bo->linkTargetAt(i);
1.156 - if (bot)
1.157 - {
1.158 - s=bot->getHeading();
1.159 - if (s.length()>25)
1.160 - s=s.left(25)+"...";
1.161 - popupLinks->insertItem (s);
1.162 - }
1.163 - }
1.164 - }
1.165 - popupLinks->move(p);
1.166 - popupLinks->exec();
1.167 -
1.168 - }
1.169 + //cout <<((BranchObj*)(selection))->getSelectString()<<endl;
1.170 + QString tmpdir,prefix;
1.171 + cout << saveToDir(tmpdir,prefix,true,QPoint(0,0),CompleteMap)<<endl;
1.172 }
1.173
1.174 void MapEditor::ensureSelectionVisible()
1.175 @@ -2847,11 +2781,11 @@
1.176 {
1.177 drawingLink=true;
1.178 linkingObj_src=bo_begin;
1.179 - tmpLink=new LinkObj (mapCanvas);
1.180 - tmpLink->setBegin (bo_begin);
1.181 - tmpLink->setEnd (p);
1.182 - tmpLink->updateLink();
1.183 - tmpLink->setVisibility (true);
1.184 + tmpXLink=new XLinkObj (mapCanvas);
1.185 + tmpXLink->setBegin (bo_begin);
1.186 + tmpXLink->setEnd (p);
1.187 + tmpXLink->updateXLink();
1.188 + tmpXLink->setVisibility (true);
1.189 return;
1.190 }
1.191 }
1.192 @@ -3071,8 +3005,8 @@
1.193 // Draw a link from one branch to another
1.194 if (drawingLink)
1.195 {
1.196 - tmpLink->setEnd (p);
1.197 - tmpLink->updateLink();
1.198 + tmpXLink->setEnd (p);
1.199 + tmpXLink->updateXLink();
1.200 }
1.201
1.202 // Move CanvasView
1.203 @@ -3123,15 +3057,15 @@
1.204 dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), NULL);
1.205 if (dst && selection)
1.206 {
1.207 - tmpLink->setEnd ( ((BranchObj*)(dst)) );
1.208 - tmpLink->updateLink();
1.209 - tmpLink->activate();
1.210 + tmpXLink->setEnd ( ((BranchObj*)(dst)) );
1.211 + tmpXLink->updateXLink();
1.212 + tmpXLink->activate();
1.213 setChanged();
1.214
1.215 } else
1.216 {
1.217 - delete(tmpLink);
1.218 - tmpLink=NULL;
1.219 + delete(tmpXLink);
1.220 + tmpXLink=NULL;
1.221 }
1.222 return;
1.223 }