1.1 --- a/mapeditor.cpp Tue Jul 19 15:57:49 2005 +0000
1.2 +++ b/mapeditor.cpp Sat Jul 23 10:26:30 2005 +0000
1.3 @@ -592,6 +592,7 @@
1.4
1.5 void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom)
1.6 {
1.7 + setChanged();
1.8 if (savemode==UndoCommand)
1.9 {
1.10 undoCommand=undoCom;
1.11 @@ -832,7 +833,6 @@
1.12 // (map state is set later at end of load...)
1.13 } else
1.14 {
1.15 - setChanged();
1.16 saveState(selection);
1.17 }
1.18
1.19 @@ -1029,7 +1029,7 @@
1.20 l->setPen (QPen(QColor(black), 1));
1.21 l->setZ (200);
1.22 l->show();
1.23 - */
1.24 + */
1.25
1.26 if (printFooter)
1.27 {
1.28 @@ -1137,6 +1137,9 @@
1.29 void MapEditor::exportASCII()
1.30 {
1.31 // FIXME still experimental
1.32 + Export ex;
1.33 + ex.setMapCenter(mapCenter);
1.34 +
1.35 QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)"));
1.36 fd->addFilter ("TXT (*.txt)");
1.37 fd->setCaption("VYM - Export (ASCII) (still experimental)");
1.38 @@ -1162,21 +1165,14 @@
1.39 {
1.40 case QMessageBox::Yes:
1.41 // save
1.42 - if (!ex.setOutputDir ("out"))
1.43 - {
1.44 - QMessageBox::critical (0,tr("Critical Export Error "),tr("Couldn't create directory ") + "out");
1.45 - return;
1.46 - }
1.47 break;;
1.48 case QMessageBox::Cancel:
1.49 - // do nothing
1.50 + // return, do nothing
1.51 return;
1.52 break;
1.53 }
1.54 }
1.55 - Export ex;
1.56 ex.setPath (fd->selectedFile() );
1.57 - ex.setMapCenter(mapCenter);
1.58 ex.exportMap();
1.59 }
1.60 }
1.61 @@ -1288,15 +1284,6 @@
1.62 // Finish open lineEdits
1.63 if (lineedit) finishedLineEditNoSave();
1.64
1.65 - // Unselect
1.66 - /*FIXME testing
1.67 - if (selection)
1.68 - {
1.69 - selection->unselect();
1.70 - selection=NULL;
1.71 - }
1.72 - */
1.73 -
1.74 parseAtom (undoCommand);
1.75 mapCenter->reposition();
1.76
1.77 @@ -1414,7 +1401,6 @@
1.78
1.79 void MapEditor::paste()
1.80 {
1.81 - setChanged();
1.82 saveState(selection);
1.83 pasteNoSave();
1.84 mapCenter->reposition();
1.85 @@ -1423,7 +1409,6 @@
1.86
1.87 void MapEditor::cut()
1.88 {
1.89 - setChanged();
1.90 saveState(selection->getParObj());
1.91 copy();
1.92 cutNoSave();
1.93 @@ -1448,7 +1433,6 @@
1.94 BranchObj* par;
1.95 if (typeid(*selection) == typeid(BranchObj) )
1.96 {
1.97 - setChanged();
1.98 saveState("moveBranchDown ()");
1.99 bo=(BranchObj*)(selection);
1.100 par=(BranchObj*)(bo->getParObj());
1.101 @@ -1469,7 +1453,6 @@
1.102 BranchObj* par;
1.103 if (typeid(*selection) == typeid(BranchObj) )
1.104 {
1.105 - setChanged();
1.106 saveState("moveBranchUp ()");
1.107 bo=(BranchObj*)(selection);
1.108 par=(BranchObj*)(bo->getParObj());
1.109 @@ -1490,7 +1473,6 @@
1.110 (typeid(*selection) == typeid(BranchObj) ||
1.111 typeid(*selection) == typeid(MapCenterObj) ) )
1.112 {
1.113 - setChanged();
1.114 saveState("setHeading (\""+((BranchObj*)(selection))->getHeading()+"\")");
1.115
1.116 ensureSelectionVisible();
1.117 @@ -1532,7 +1514,6 @@
1.118 (typeid(*selection) == typeid(BranchObj) ||
1.119 typeid(*selection) == typeid(MapCenterObj) ) )
1.120 {
1.121 - setChanged();
1.122 saveState(selection);
1.123
1.124 BranchObj* bo1 = (BranchObj*) (selection);
1.125 @@ -1598,7 +1579,6 @@
1.126 if (selection &&
1.127 (typeid(*selection) == typeid(BranchObj) ) )
1.128 {
1.129 - setChanged();
1.130 saveState(selection);
1.131
1.132 BranchObj* bo1 = (BranchObj*) (selection);
1.133 @@ -1647,7 +1627,6 @@
1.134
1.135 if (selection && typeid(*selection) ==typeid(BranchObj) )
1.136 {
1.137 - setChanged();
1.138 saveState(selection->getParObj());
1.139 BranchObj* bo=dynamic_cast <BranchObj*> (selection);
1.140 BranchObj* par=(BranchObj*)(bo->getParObj());
1.141 @@ -1662,7 +1641,6 @@
1.142 }
1.143 if (selection && typeid(*selection) ==typeid(FloatImageObj) )
1.144 {
1.145 - setChanged();
1.146 saveState(selection->getParObj());
1.147 FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
1.148 BranchObj* par=(BranchObj*)(fio->getParObj());
1.149 @@ -2104,7 +2082,7 @@
1.150 QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
1.151 if ( !col.isValid() ) return;
1.152 setBackgroundColor( col );
1.153 - setChanged();
1.154 + saveState();
1.155 }
1.156
1.157 void MapEditor::setBackgroundColor(QColor c)
1.158 @@ -2133,7 +2111,6 @@
1.159 if (typeid(*selection) == typeid(BranchObj) ||
1.160 typeid(*selection) == typeid(MapCenterObj))
1.161 {
1.162 - setChanged();
1.163 saveState(selection);
1.164 BranchObj *bo=(BranchObj*)(selection);
1.165 bo->setColor(actColor, false); // color links, color childs
1.166 @@ -2148,7 +2125,6 @@
1.167 if (typeid(*selection) == typeid(BranchObj) ||
1.168 typeid(*selection) == typeid(MapCenterObj))
1.169 {
1.170 - setChanged();
1.171 saveState(selection);
1.172 BranchObj *bo=(BranchObj*)(selection);
1.173 bo->setColor(actColor, true); // color links, color childs
1.174 @@ -2161,7 +2137,6 @@
1.175 {
1.176 if (selection)
1.177 {
1.178 - setChanged();
1.179 saveState(selection);
1.180 ((BranchObj*)(selection))->toggleStandardFlag (f,actionSettingsUseFlagGroups);
1.181 }
1.182 @@ -2280,7 +2255,7 @@
1.183 // user entered something and pressed OK
1.184 ((BranchObj*)(selection))->setURL (text);
1.185 updateActions();
1.186 - setChanged();
1.187 + saveState(); //FIXME undoCommand
1.188 }
1.189 }
1.190 }
1.191 @@ -2293,7 +2268,7 @@
1.192 BranchObj *b=(BranchObj*)(selection);
1.193 b->setURL (b->getHeading());
1.194 updateActions();
1.195 - setChanged();
1.196 + saveState(); //FIXME undoCommand
1.197 }
1.198 }
1.199
1.200 @@ -2305,7 +2280,7 @@
1.201 BranchObj *b=(BranchObj*)(selection);
1.202 b->setURL ("https://bugzilla.novell.com/show_bug.cgi?id="+b->getHeading());
1.203 updateActions();
1.204 - setChanged();
1.205 + saveState(); //FIXME undoCommand
1.206 }
1.207 }
1.208
1.209 @@ -2328,7 +2303,7 @@
1.210 mapCenter->reposition();
1.211 adjustCanvasSize();
1.212 canvas()->update();
1.213 - setChanged();
1.214 + saveState(); //FIXME undoCommand
1.215 }
1.216 }
1.217
1.218 @@ -2342,7 +2317,7 @@
1.219 mapCenter->reposition();
1.220 adjustCanvasSize();
1.221 canvas()->update();
1.222 - setChanged();
1.223 + saveState(); //FIXME undoCommand
1.224 }
1.225 }
1.226
1.227 @@ -2361,7 +2336,6 @@
1.228 {
1.229 if (selection && (typeid(*selection) == typeid(BranchObj) ))
1.230 {
1.231 - setChanged();
1.232 saveState(selection->getParObj());
1.233 QString sel=selection->getSelectString();
1.234 BranchObj* bo=(BranchObj*)(selection);
1.235 @@ -2377,7 +2351,6 @@
1.236 {
1.237 if (selection && (typeid(*selection) == typeid(BranchObj) ))
1.238 {
1.239 - setChanged();
1.240 saveState(selection->getParObj());
1.241 ((BranchObj*)(selection))->removeChilds();
1.242 mapCenter->reposition();
1.243 @@ -2424,7 +2397,7 @@
1.244 {
1.245 mapCenter->setAuthor (dia.getAuthor() );
1.246 mapCenter->setComment (dia.getComment() );
1.247 - setChanged();
1.248 + saveState(); //FIXME undoCommand
1.249 }
1.250 }
1.251
1.252 @@ -2577,7 +2550,6 @@
1.253 {
1.254 linkstyle=ls;
1.255
1.256 - setChanged();
1.257 saveState();
1.258 BranchObj *bo;
1.259 bo=mapCenter->first();
1.260 @@ -2672,7 +2644,8 @@
1.261 QColor col = QColorDialog::getColor( defLinkColor, this );
1.262 if ( !col.isValid() ) return;
1.263 setLinkColor( col );
1.264 - setChanged();
1.265 + saveState(); //FIXME undoCommand
1.266 +
1.267 }
1.268
1.269 void MapEditor::toggleScroll()
1.270 @@ -2682,7 +2655,6 @@
1.271 BranchObj *bo=((BranchObj*)(selection));
1.272 if (bo->countBranches()==0) return;
1.273 if (bo->getDepth()==0) return;
1.274 - setChanged();
1.275 saveState(selection);
1.276 bo->toggleScroll();
1.277 adjustCanvasSize();
1.278 @@ -2722,7 +2694,6 @@
1.279 QString fn;
1.280 if ( fd->exec() == QDialog::Accepted )
1.281 {
1.282 - setChanged();
1.283 saveState(selection);
1.284 QString fn=fd->selectedFile();
1.285 lastImageDir=fn.left(fn.findRev ("/"));
1.286 @@ -2929,7 +2900,7 @@
1.287 }
1.288 if (dia.deleteXLink())
1.289 ((BranchObj*)(selection))->deleteXLinkAt(i);
1.290 - setChanged();
1.291 + saveState(); //FIXME undoCommand
1.292 }
1.293 }
1.294 }
1.295 @@ -3163,7 +3134,6 @@
1.296
1.297 if (typeid(*selection) == typeid(FloatImageObj))
1.298 {
1.299 - setChanged();
1.300 saveState("move "+qpointToString(movingObj_orgPos));
1.301 FloatObj *fo=(FloatObj*)(selection);
1.302 if (fo->getLinkStyle()==StyleUndef)
1.303 @@ -3185,6 +3155,7 @@
1.304 {
1.305 if (typeid(*fo) == typeid(FloatImageObj))
1.306 {
1.307 + saveState();
1.308 FloatImageObj *fio=(FloatImageObj*)(fo);
1.309 ((BranchObj*)(lmo))->addFloatImage (fio);
1.310 fio->unselect();
1.311 @@ -3215,7 +3186,6 @@
1.312 if (lmosel->getDepth()==1)
1.313 {
1.314 // depth==1, mainbranch
1.315 - setChanged();
1.316 saveState("move "+qpointToString(movingObj_orgPos));
1.317 lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
1.318 } else
1.319 @@ -3324,8 +3294,7 @@
1.320 tmpXLink->setEnd ( ((BranchObj*)(dst)) );
1.321 tmpXLink->updateXLink();
1.322 tmpXLink->activate();
1.323 - setChanged();
1.324 -
1.325 + saveState(); //FIXME undoCommand
1.326 } else
1.327 {
1.328 delete(tmpXLink);
1.329 @@ -3362,7 +3331,6 @@
1.330 if (dst )
1.331 {
1.332 BranchObj* bs=((BranchObj*)(selection));
1.333 - setChanged();
1.334 saveState ("linkBranchToPos (\""+
1.335 (bs->getParObj())->getSelectString()+
1.336 "\","+
1.337 @@ -3415,7 +3383,6 @@
1.338 if (selection) selection->unselect();
1.339 selection=lmo;
1.340 selection->select();
1.341 - setChanged();
1.342 saveState(selection);
1.343 editHeading();
1.344 }
1.345 @@ -3588,7 +3555,7 @@
1.346
1.347 if (update)
1.348 {
1.349 - setChanged();
1.350 + saveState(); //FIXME undo Command
1.351 mapCenter->reposition();
1.352 adjustCanvasSize();
1.353 canvas()->update();
1.354 @@ -3603,7 +3570,6 @@
1.355 (typeid(*selection) == typeid(MapCenterObj)) )
1.356 {
1.357 BranchObj *bo=((BranchObj*)(selection));
1.358 - setChanged();
1.359 saveState(selection);
1.360 //QString fn=fd->selectedFile();
1.361 //lastImageDir=fn.left(fn.findRev ("/"));