Removed some FIXMEs. Added translations
authorinsilmaril
Fri Dec 29 13:52:17 2006 +0000 (2006-12-29)
changeset 4128059b6aa74d7
parent 411 910ba9fab728
child 413 c3f7beb4e9f4
Removed some FIXMEs. Added translations
branchobj.cpp
demos/todo.vym
exportxhtmldialog.cpp
file.cpp
linkablemapobj.cpp
mainwindow.cpp
mapeditor.cpp
mapeditor.h
mapobj.cpp
xml.cpp
     1.1 --- a/branchobj.cpp	Thu Dec 14 17:01:44 2006 +0000
     1.2 +++ b/branchobj.cpp	Fri Dec 29 13:52:17 2006 +0000
     1.3 @@ -232,7 +232,7 @@
     1.4  	}	
     1.5  
     1.6  	// updateLink is called implicitly in move
     1.7 -	reposition();	// FIXME shouldn't be this a request?
     1.8 +	requestReposition();	// FIXME shouldn't be this a request?
     1.9  }
    1.10  
    1.11  void BranchObj::unsetParObjTmp()
     2.1 Binary file demos/todo.vym has changed
     3.1 --- a/exportxhtmldialog.cpp	Thu Dec 14 17:01:44 2006 +0000
     3.2 +++ b/exportxhtmldialog.cpp	Fri Dec 29 13:52:17 2006 +0000
     3.3 @@ -57,7 +57,7 @@
     3.4  		useTextColor=false;
     3.5  	ui.textColorButton->setChecked(useTextColor);
     3.6  	
     3.7 -/* FIXME this was used in old html export, is not yet in new stylesheet
     3.8 +/* TODO this was used in old html export, is not yet in new stylesheet
     3.9  	if ( settings.readEntry ("/export/html/useHeading","no")=="yes")
    3.10  		useHeading=true;
    3.11  	else	
     4.1 --- a/file.cpp	Thu Dec 14 17:01:44 2006 +0000
     4.2 +++ b/file.cpp	Fri Dec 29 13:52:17 2006 +0000
     4.3 @@ -291,13 +291,13 @@
     4.4  		{
     4.5  			r=max_w / pix.width();
     4.6  			pix.resize(qRound(pix.width()*r), qRound(pix.height()*r));
     4.7 -			// FIXME not a resize, but a shrink/enlarge is needed here...
     4.8 +			// TODO not a resize, but a shrink/enlarge is needed here...
     4.9  		}
    4.10  		if (pix.height()>max_h)
    4.11  		{
    4.12  			r=max_h / pix.height();
    4.13  			pix.resize(qRound(pix.width()*r), qRound(pix.height()*r));
    4.14 -			// FIXME not a resize, but a shrink/enlarge is needed here...
    4.15 +			// TODO not a resize, but a shrink/enlarge is needed here...
    4.16  		}
    4.17          setPixmap( pix );
    4.18  	}	
     5.1 --- a/linkablemapobj.cpp	Thu Dec 14 17:01:44 2006 +0000
     5.2 +++ b/linkablemapobj.cpp	Fri Dec 29 13:52:17 2006 +0000
     5.3 @@ -72,7 +72,7 @@
     5.4  	linkpos=LinkBottom;
     5.5      arcsegs=13;
     5.6      
     5.7 -// FIXME instead of linkcolor pen.color() could be used	all around
     5.8 +// TODO instead of linkcolor pen.color() could be used	all around
     5.9  	pen.setWidth (1);
    5.10  	pen.setColor (linkcolor);
    5.11  	pen.setCapStyle ( Qt::RoundCap );
     6.1 --- a/mainwindow.cpp	Thu Dec 14 17:01:44 2006 +0000
     6.2 +++ b/mainwindow.cpp	Fri Dec 29 13:52:17 2006 +0000
     6.3 @@ -92,7 +92,6 @@
     6.4  
     6.5  	// Initialize history window;
     6.6  	historyWindow=new HistoryWindow();
     6.7 -	// FIXME historyWindow.setStepsTotal(stepsTotal);
     6.8  
     6.9  	// Initialize some settings, which are platform dependant
    6.10  	QString p,s;
    6.11 @@ -3095,7 +3094,6 @@
    6.12  		m.reset();
    6.13  		currentMapEditor()->setMatrix( m );
    6.14  		currentMapEditor()->setViewCenter();
    6.15 -		currentMapEditor()->adjustCanvasSize();
    6.16  	}	
    6.17  }
    6.18  
    6.19 @@ -3107,7 +3105,6 @@
    6.20  		m.scale( 1.25, 1.25 );
    6.21  		currentMapEditor()->setMatrix( m );
    6.22  		currentMapEditor()->setViewCenter();
    6.23 -		currentMapEditor()->adjustCanvasSize();
    6.24  	}	
    6.25  }
    6.26  
    6.27 @@ -3119,7 +3116,6 @@
    6.28  		m.scale( 0.8, 0.8 );
    6.29  		currentMapEditor()->setMatrix( m );
    6.30  		currentMapEditor()->setViewCenter();
    6.31 -		currentMapEditor()->adjustCanvasSize();
    6.32  	}	
    6.33  }
    6.34  
    6.35 @@ -3366,7 +3362,6 @@
    6.36  		if ( (typeid(*selection) == typeid(FloatImageObj)) )
    6.37  		{
    6.38  			FloatObj *fo=(FloatImageObj*)selection;
    6.39 -//FIXME do this in mainwindow					standardFlagsDefault->setEnabled (false);
    6.40  
    6.41  			actionEditOpenURL->setEnabled (false);
    6.42  			actionEditOpenVymLink->setEnabled (false);
     7.1 --- a/mapeditor.cpp	Thu Dec 14 17:01:44 2006 +0000
     7.2 +++ b/mapeditor.cpp	Fri Dec 29 13:52:17 2006 +0000
     7.3 @@ -3,7 +3,6 @@
     7.4  #include <q3dragobject.h>
     7.5  #include <q3urloperator.h>
     7.6  #include <q3networkprotocol.h>
     7.7 -#include <q3paintdevicemetrics.h>
     7.8  #include <q3filedialog.h>
     7.9  
    7.10  #include <iostream>
    7.11 @@ -72,13 +71,6 @@
    7.12  
    7.13      setScene (mapScene);
    7.14  	
    7.15 -    /* FIXME scrollview handles not needed in QT4? 
    7.16 -	// Maybe check QAbstractScrollArea...
    7.17 -	// Always show scroll bars (automatic would flicker sometimes)
    7.18 -	setVScrollBarMode ( QScrollView::AlwaysOn );
    7.19 -	setHScrollBarMode ( QScrollView::AlwaysOn );
    7.20 -	*/
    7.21 -
    7.22      mapCenter = new MapCenterObj(mapScene);
    7.23      mapCenter->setVisibility (true);
    7.24  	mapCenter->setMapEditor (this);
    7.25 @@ -170,73 +162,6 @@
    7.26      return mapScene;
    7.27  }
    7.28  
    7.29 -void MapEditor::adjustCanvasSize()
    7.30 -{
    7.31 -
    7.32 -/* FIXME QT4 adjustcanvassize probably not needed any longer!
    7.33 -
    7.34 -	// To adjust the scene to map, viewport size and position, we have to
    7.35 -	// do some coordinate magic...
    7.36 -	//
    7.37 -	// Get rectangle of (scroll-)view. 
    7.38 -	// We want to be in scene coords, so
    7.39 -	// we map. Important if view is zoomed...
    7.40 -	QRectF view = inverseWorldMatrix().mapRect( QRectF( contentsX(), contentsY(),
    7.41 -												visibleWidth(), visibleHeight()) );	
    7.42 -												
    7.43 -	// Now we need the bounding box of view AND map to calc the correct scene size.
    7.44 -	// Why? Because if the map itself is moved out of view, the view has to be enlarged
    7.45 -	// to avoid jumping aroung...
    7.46 -	QRectF map=mapCenter->getTotalBBox();
    7.47 -
    7.48 -	// right edge - left edge
    7.49 -	int cw= max(map.x() + map.width(),  view.x() + view.width())  - min(map.x(), view.x());
    7.50 -	int ch= max(map.y() + map.height(), view.y() + view.height()) - min(map.y(), view.y());
    7.51 -
    7.52 -
    7.53 -	if ( (cw!=mapScene->width()) || (ch!=mapScene->height()) ||
    7.54 -		!mapScene->onCanvas (map.topLeft()) || !mapScene->onCanvas (map.bottomRight())
    7.55 -	)	
    7.56 -	{	
    7.57 -		// move the map on scene (in order to not move it on screen) this is neccessary
    7.58 -		// a) if topleft corner of scene is left or above topleft corner of view and also left of
    7.59 -		//    above topleft corner of map. E.g. if map is completly inside view, but it would be possible 
    7.60 -		//    to scroll to an empty area of scene to the left.
    7.61 -		// b) if topleft corner of map left of or above topleft of scene
    7.62 -		int dx=0;
    7.63 -		int dy=0;
    7.64 -
    7.65 -		if (cw > mapScene->width() )
    7.66 -		{
    7.67 -			if (map.x()<0) dx=-map.x();	
    7.68 -		}
    7.69 -		if (cw <  mapScene->width() )
    7.70 -			dx=-min (view.x(),map.x());
    7.71 -		if (ch > mapScene->height() )
    7.72 -		{
    7.73 -			if (map.y()<0) dy=-map.y();	
    7.74 -		}
    7.75 -		if (ch <  mapScene->height() )
    7.76 -		{
    7.77 -			dy=-min (view.y(),map.y());
    7.78 -		}
    7.79 -		// We really have to resize now. Let's go...
    7.80 -		// FIXME old code mapScene->resize (cw,ch);
    7.81 -		mapScene->setSceneRect (QRectFF(0,0,cw,ch));
    7.82 -		if ( (dx!=0) || (dy!=0) ) 
    7.83 -		{
    7.84 -			mapCenter->moveAllBy(dx,dy);
    7.85 -			mapCenter->reposition();
    7.86 -//			mapCenter->positionBBox();	// To move float
    7.87 -
    7.88 -			// scroll the view (in order to not move map on screen)
    7.89 -			scrollBy (dx,dy);
    7.90 -		}	
    7.91 -	}
    7.92 -
    7.93 -	*/
    7.94 -}
    7.95 -
    7.96  bool MapEditor::isRepositionBlocked()
    7.97  {
    7.98  	return blockReposition;
    7.99 @@ -1108,7 +1033,6 @@
   7.100  		if ( ok ) 
   7.101  		{
   7.102  			mapCenter->reposition();
   7.103 -			adjustCanvasSize();
   7.104  			if (lmode==NewMap)
   7.105  			{
   7.106  				mapDefault=false;
   7.107 @@ -1179,6 +1103,8 @@
   7.108  		printer = new QPrinter;
   7.109  		printer->setColorMode (QPrinter::Color);
   7.110  		printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
   7.111 +		printer->setOutputFormat((QPrinter::OutputFormat)settings.value("/mainwindow/printerFormat",printer->outputFormat()).toInt());
   7.112 +		printer->setOutputFileName(settings.value("/mainwindow/printerFileName",printer->outputFileName()).toString());
   7.113  	}
   7.114  
   7.115  	QRectF totalBBox=mapCenter->getTotalBBox();
   7.116 @@ -1200,6 +1126,9 @@
   7.117  	{
   7.118  		QPainter pp(printer);
   7.119  
   7.120 +		//pp.setRenderHints(renderHints());
   7.121 +		pp.setRenderHint(QPainter::Antialiasing,true);
   7.122 +
   7.123  		// Don't print the visualisation of selection
   7.124  		LinkableMapObj *oldselection=NULL;
   7.125  		if (selection) 
   7.126 @@ -1208,22 +1137,9 @@
   7.127  			selection->unselect();
   7.128  		}
   7.129  
   7.130 -		// Handle sizes of map and paper:
   7.131 -		//
   7.132 -		// setWindow defines which part of the scene will be transformed 
   7.133 -		// setViewport defines area on paper in device coordinates (dpi)
   7.134 -		// e.g. (0,50,700,700) is upper part on A4
   7.135 -		// see also /usr/lib/qt3/doc/html/coordsys.html
   7.136 -
   7.137 -		Q3PaintDeviceMetrics metrics (printer);
   7.138 -
   7.139 -		double paperAspect = (double)metrics.width()   / (double)metrics.height();
   7.140 -		double   mapAspect = (double)totalBBox.width() / (double)totalBBox.height();
   7.141 -
   7.142  		QRectF mapRect=totalBBox;
   7.143  		QGraphicsRectItem *frame=NULL;
   7.144 -		QGraphicsTextItem *footerFN=NULL;
   7.145 -		QGraphicsTextItem *footerDate=NULL;
   7.146 +
   7.147  		if (printFrame || printFooter)
   7.148  		{
   7.149  			
   7.150 @@ -1232,63 +1148,72 @@
   7.151  				// Print frame around map
   7.152  				mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, 
   7.153  					totalBBox.width()+20, totalBBox.height()+20);
   7.154 -				frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::red));
   7.155 +				frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::NoBrush));
   7.156  				frame->setZValue(0);
   7.157  				frame->show();    
   7.158  			}		
   7.159 -			// TODO remove after testing 
   7.160 -			//QCanvasLine *l=new QCanvasLine (mapScene);
   7.161 -			//l->setPoints (0,0,mapRect.width(),mapRect.height());
   7.162 -			//l->setPen (QPen(QColor(black), 1));
   7.163 -			//l->setZ (200);
   7.164 -			//l->show();
   7.165  
   7.166  			if (printFooter) 
   7.167  			{
   7.168  				// Print footer below map
   7.169  				QFont font;		
   7.170  				font.setPointSize(10);
   7.171 -				footerFN=mapScene->addText ("VYM - " + fileName,font);
   7.172 -				footerFN->setPos (mapRect.x(), mapRect.y() + mapRect.height() );
   7.173 -				footerFN->setZValue (Z_TEXT);
   7.174 -				footerFN->show();    
   7.175 -				footerDate=mapScene->addText (QDate::currentDate().toString(Qt::TextDate),font);
   7.176 -				footerDate->setPos(mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
   7.177 -				footerDate->setZValue(Z_TEXT);
   7.178 -				footerDate->show();    
   7.179 +				pp.setFont (font);
   7.180 +				QRectF footerBox(0,printer->height()-15,printer->width(),15);
   7.181 +				pp.drawText ( footerBox,Qt::AlignLeft,"VYM - " +fileName);
   7.182 +				pp.drawText ( footerBox, Qt::AlignRight, QDate::currentDate().toString(Qt::TextDate));
   7.183  			}
   7.184 -			//pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
   7.185 -		}	else	
   7.186 -		{
   7.187 -			//pp.setWindow (mapRect);
   7.188 -			//pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
   7.189 -		}	
   7.190 -
   7.191 -/*
   7.192 +		}
   7.193 +
   7.194 +		/*
   7.195 +		double paperAspect = (double)printer->width()   / (double)printer->height();
   7.196 +		double   mapAspect = (double)mapRect.width() / (double)mapRect.height();
   7.197 +		cout <<"mapAspect="<<mapAspect<<"   paperAspect"<<paperAspect<<endl;
   7.198  		if (mapAspect>=paperAspect)
   7.199  		{
   7.200  			// Fit horizontally to paper width
   7.201 -			pp.setViewport(0,0, metrics.width(),(int)(metrics.width()/mapAspect) );	
   7.202 +			pp.setViewport(0,0, printer->width(),(int)(printer->width()/mapAspect) );	
   7.203 +			qWarning ("Fit hor");
   7.204  		}	else
   7.205  		{
   7.206  			// Fit vertically to paper height
   7.207 -			pp.setViewport(0,0,(int)(metrics.height()*mapAspect),metrics.height());	
   7.208 +			pp.setViewport(0,0,(int)(printer->height()*mapAspect),printer->height());	
   7.209 +			qWarning ("Fit ver");
   7.210  		}	
   7.211 -*/
   7.212 -		QRect viewport=rect();
   7.213 -		render (&pp, QRect(),QRect());
   7.214 -
   7.215 +		*/
   7.216 +		mapScene->render (
   7.217 +			&pp, 
   7.218 +			//pp.viewport(),
   7.219 +			QRectF (0,0,printer->width(),printer->height()-15),
   7.220 +			QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height())
   7.221 +		);
   7.222 +		
   7.223 +		//render (&pp,printer->pageRect(), QRect ((int)mapRect.x(),(int)mapRect.y(),400,400));
   7.224 +
   7.225 +		//pp.setWindow (QRect (mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height()));
   7.226  		//mapScene->render(&pp);	// draw scene to printer
   7.227  
   7.228 -/*
   7.229 -		// Delete Frame and footer
   7.230 -		if (footerFN) 
   7.231 -		{
   7.232 -			delete (footerFN);
   7.233 -			delete (footerDate);
   7.234 -		}	
   7.235 -*/		
   7.236 -//		if (frame)  delete (frame);
   7.237 +		// Viewport has paper dimension
   7.238 +		pp.drawLine (QLine (0,0,printer->width(),printer->height()));
   7.239 +		cout << "sceneRect: "
   7.240 +			<<mapScene->sceneRect().x()<<","
   7.241 +			<<mapScene->sceneRect().y()<<","
   7.242 +			<<mapScene->sceneRect().width()<<","
   7.243 +			<<mapScene->sceneRect().height()<<","<<endl;
   7.244 +		cout << "mapRect: "
   7.245 +			<<mapRect.x()<<","
   7.246 +			<<mapRect.y()<<","
   7.247 +			<<mapRect.width()<<","
   7.248 +			<<mapRect.height()<<","<<endl;
   7.249 +		cout << "pp.viewport: "
   7.250 +			<<pp.viewport().x()<<","
   7.251 +			<<pp.viewport().y()<<","
   7.252 +			<<pp.viewport().width()<<","
   7.253 +			<<pp.viewport().height()<<","<<endl;
   7.254 +		cout << "painter: w,h="<<pp.viewport().width()<<","<<pp.viewport().height()<<endl;
   7.255 +		cout << "printer: w,h="<<printer->width()<<","<<printer->height()<<endl;
   7.256 +
   7.257 +		if (frame)  delete (frame);
   7.258  
   7.259  		// Restore selection
   7.260  		if (oldselection) 
   7.261 @@ -1299,6 +1224,8 @@
   7.262  
   7.263  		// Save settings in vymrc
   7.264  		settings.writeEntry("/mainwindow/printerName",printer->printerName());
   7.265 +		settings.writeEntry("/mainwindow/printerFormat",printer->outputFormat());
   7.266 +		settings.writeEntry("/mainwindow/printerFileName",printer->outputFileName());
   7.267  	}
   7.268  }
   7.269  
   7.270 @@ -1349,7 +1276,6 @@
   7.271  	hidemode=mode;
   7.272  	mapCenter->setHideTmp (hidemode);
   7.273  	mapCenter->reposition();
   7.274 -	adjustCanvasSize();
   7.275  	scene()->update();
   7.276  }
   7.277  
   7.278 @@ -1749,7 +1675,6 @@
   7.279  			QString("Paste to %1").arg( getName(selection))
   7.280  		);
   7.281  		mapCenter->reposition();
   7.282 -		adjustCanvasSize();
   7.283  	}
   7.284  }
   7.285  
   7.286 @@ -1764,7 +1689,6 @@
   7.287  	copy();
   7.288  	cutNoSave();
   7.289  	mapCenter->reposition();
   7.290 -	adjustCanvasSize();
   7.291  }
   7.292  
   7.293  void MapEditor::move(const int &x, const int &y)
   7.294 @@ -1779,7 +1703,6 @@
   7.295  			QString("Move %1 to  %2").arg(getName(selection)).arg(ps));
   7.296  		selection->move(x,y);
   7.297  		mapCenter->reposition();
   7.298 -		adjustCanvasSize();
   7.299  	}
   7.300  
   7.301  }
   7.302 @@ -1798,7 +1721,6 @@
   7.303  			QString("Move %1 to relativ position %2").arg(getName(selection)).arg(ps));
   7.304  		((OrnamentedObj*)selection)->move2RelPos (x,y);
   7.305  		mapCenter->reposition();
   7.306 -		adjustCanvasSize();
   7.307  	}
   7.308  }
   7.309  
   7.310 @@ -1869,7 +1791,6 @@
   7.311  		editingBO->setHeading(s );
   7.312  		editingBO=NULL;
   7.313  		mapCenter->reposition();
   7.314 -		adjustCanvasSize();
   7.315  		ensureSelectionVisible();
   7.316  	}
   7.317  }
   7.318 @@ -1883,7 +1804,6 @@
   7.319  	{
   7.320  		((BranchObj*)selection)->setURL(s);
   7.321  		mapCenter->reposition();
   7.322 -		adjustCanvasSize();
   7.323  		ensureSelectionVisible();
   7.324  	}
   7.325  }
   7.326 @@ -1896,7 +1816,6 @@
   7.327  	{
   7.328  		((BranchObj*)selection)->setHeading(s);
   7.329  		mapCenter->reposition();
   7.330 -		adjustCanvasSize();
   7.331  		ensureSelectionVisible();
   7.332  	}
   7.333  }
   7.334 @@ -1910,7 +1829,6 @@
   7.335  	{
   7.336  		((BranchObj*)selection)->setVymLink(s);
   7.337  		mapCenter->reposition();
   7.338 -		adjustCanvasSize();
   7.339  		ensureSelectionVisible();
   7.340  	}
   7.341  }
   7.342 @@ -1967,14 +1885,13 @@
   7.343  		if (newbo)
   7.344  		{
   7.345  			saveState(
   7.346 -				selection,		// FIXME sholdnt newbo be deleted here???
   7.347 +				selection,		// FIXME addNewBranch (int pos) sholdnt newbo be deleted here???
   7.348  				"delete ()",
   7.349  				selection,
   7.350  				QString ("addBranch (%1)").arg(pos-2),
   7.351  				QString ("Add new branch to %1").arg(getName(bo)));	
   7.352  
   7.353  			mapCenter->reposition();
   7.354 -			adjustCanvasSize();
   7.355  		}
   7.356  	}	
   7.357  	return newbo;
   7.358 @@ -2007,7 +1924,6 @@
   7.359  				QString ("Add branch before %1").arg(getName(bo)));
   7.360  
   7.361  			mapCenter->reposition();
   7.362 -			adjustCanvasSize();
   7.363  		}
   7.364  	}	
   7.365  	return newbo;
   7.366 @@ -2027,7 +1943,6 @@
   7.367  		selection->select();
   7.368  		ensureSelectionVisible();
   7.369  		mapCenter->reposition();
   7.370 -		adjustCanvasSize();
   7.371  	}
   7.372  	if (selection  && typeid(*selection) ==typeid(FloatImageObj) ) 
   7.373  	{
   7.374 @@ -2046,7 +1961,6 @@
   7.375  		selection->select();
   7.376  		ensureSelectionVisible();
   7.377  		mapCenter->reposition();
   7.378 -		adjustCanvasSize();
   7.379  	}
   7.380  }
   7.381  
   7.382 @@ -2085,7 +1999,6 @@
   7.383  		if (selection) unselect();
   7.384  		selection=lmo;
   7.385  		selection->select();
   7.386 -		adjustCanvasSize();
   7.387  		ensureSelectionVisible();
   7.388  		return true;
   7.389  	} 
   7.390 @@ -2106,8 +2019,6 @@
   7.391  		if (selection) selection->unselect();
   7.392  		selection=lmo;
   7.393  		selection->select();
   7.394 -			
   7.395 -		adjustCanvasSize();
   7.396  	}
   7.397  }
   7.398  
   7.399 @@ -2328,7 +2239,6 @@
   7.400  					par->unselect();
   7.401  					selection=bo;
   7.402  					selection->select();
   7.403 -					adjustCanvasSize();
   7.404  					ensureSelectionVisible();
   7.405  				}
   7.406  			}	
   7.407 @@ -2343,7 +2253,6 @@
   7.408  					selection->unselect();
   7.409  					selection=par;
   7.410  					selection->select();
   7.411 -					adjustCanvasSize();
   7.412  					ensureSelectionVisible();
   7.413  				}
   7.414  			} else
   7.415 @@ -2356,7 +2265,6 @@
   7.416  						selection->unselect();
   7.417  						selection=bo;
   7.418  						selection->select();
   7.419 -						adjustCanvasSize();
   7.420  						ensureSelectionVisible();
   7.421  					}
   7.422  				}
   7.423 @@ -2400,7 +2308,6 @@
   7.424  					selection->unselect();
   7.425  					selection=par;
   7.426  					selection->select();
   7.427 -					adjustCanvasSize();
   7.428  					ensureSelectionVisible();
   7.429  				}
   7.430  			} else
   7.431 @@ -2413,7 +2320,6 @@
   7.432  						selection->unselect();
   7.433  						selection=bo;
   7.434  						selection->select();
   7.435 -						adjustCanvasSize();
   7.436  						ensureSelectionVisible();
   7.437  					}
   7.438  				}
   7.439 @@ -2440,7 +2346,6 @@
   7.440  				ensureSelectionVisible();
   7.441  			}
   7.442  		}		
   7.443 -		adjustCanvasSize();
   7.444  	}
   7.445  }
   7.446  
   7.447 @@ -2462,7 +2367,6 @@
   7.448  				ensureSelectionVisible();
   7.449  			}
   7.450  		}		
   7.451 -		adjustCanvasSize();
   7.452  	}
   7.453  }
   7.454  
   7.455 @@ -2481,7 +2385,7 @@
   7.456  
   7.457  	if ( fd->exec() == QDialog::Accepted )
   7.458  	{
   7.459 -		// FIXME in QT4 use:	lastImageDir=fd->directory();
   7.460 +		// TODO selectMapBackgroundImg in QT4 use:	lastImageDir=fd->directory();
   7.461  		lastImageDir=QDir (fd->dirPath());
   7.462  		setMapBackgroundImage (fd->selectedFile());
   7.463  	}
   7.464 @@ -2611,7 +2515,6 @@
   7.465  				QString("%1 (\"%2\")").arg(r).arg(f),
   7.466  				QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo)));
   7.467  			bo->toggleStandardFlag (f,mainWindow->useFlagGroups());
   7.468 -			adjustCanvasSize();
   7.469  		}
   7.470  	}	
   7.471  }
   7.472 @@ -2651,7 +2554,6 @@
   7.473  					if (selection) ((BranchObj*)selection)->unselect();
   7.474  					selection=itFind;
   7.475  					selection->select();
   7.476 -					adjustCanvasSize();
   7.477  					ensureSelectionVisible();
   7.478  				}
   7.479  				if (textEditor->findText(s,flags)) 
   7.480 @@ -2666,7 +2568,6 @@
   7.481  				if (selection) ((BranchObj*)selection)->unselect();
   7.482  				selection=itFind;
   7.483  				selection->select();
   7.484 -				adjustCanvasSize();
   7.485  				ensureSelectionVisible();
   7.486  				searching=false;
   7.487  			}
   7.488 @@ -2679,7 +2580,6 @@
   7.489  	}	
   7.490  	if (!searching)
   7.491  	{
   7.492 -		adjustCanvasSize();
   7.493  		return (BranchObj*)selection;
   7.494  	}	else
   7.495  		return NULL;
   7.496 @@ -2817,7 +2717,6 @@
   7.497  			bo->setVymLink (fd->selectedFile() );
   7.498  			updateActions();
   7.499  			mapCenter->reposition();
   7.500 -			adjustCanvasSize();
   7.501  			scene()->update();
   7.502  		}
   7.503  	}
   7.504 @@ -2839,7 +2738,6 @@
   7.505  		bo->setVymLink ("" );
   7.506  		updateActions();
   7.507  		mapCenter->reposition();
   7.508 -		adjustCanvasSize();
   7.509  		scene()->update();
   7.510  	}
   7.511  }
   7.512 @@ -2863,7 +2761,6 @@
   7.513  		);	
   7.514  		updateActions();
   7.515  		mapCenter->reposition();
   7.516 -		adjustCanvasSize();
   7.517  		scene()->update();
   7.518  	}
   7.519  }
   7.520 @@ -2925,7 +2822,6 @@
   7.521  		select (sel);
   7.522  		((BranchObj*)selection)->move2RelPos (p);
   7.523  		mapCenter->reposition();
   7.524 -		adjustCanvasSize();
   7.525  	}	
   7.526  }
   7.527  
   7.528 @@ -2987,7 +2883,7 @@
   7.529  void MapEditor::updateActions()
   7.530  {
   7.531  	mainWindow->updateActions();
   7.532 -	// FIXME maybe don't update if blockReposition is set
   7.533 +	// TODO maybe don't update if blockReposition is set
   7.534  }
   7.535  
   7.536  void MapEditor::updateNoteFlag()
   7.537 @@ -3166,7 +3062,6 @@
   7.538  			QString ("%1 %2").arg(r).arg(getName(bo))
   7.539  		);
   7.540  		bo->toggleScroll();
   7.541 -		adjustCanvasSize();
   7.542  		scene()->update();
   7.543  	}
   7.544  }
   7.545 @@ -3204,7 +3099,7 @@
   7.546  		QString fn;
   7.547  		if ( fd->exec() == QDialog::Accepted )
   7.548  		{
   7.549 -			// FIXME in QT4 use:	lastImageDir=fd->directory();
   7.550 +			// FIXME loadFIO in QT4 use:	lastImageDir=fd->directory();
   7.551  			lastImageDir=QDir (fd->dirPath());
   7.552  			QStringList flist = fd->selectedFiles();
   7.553  			QStringList::Iterator it = flist.begin();
   7.554 @@ -3215,7 +3110,7 @@
   7.555  				bo->addFloatImage();
   7.556  				fio=bo->getLastFloatImage();
   7.557  				fio->load(*it);
   7.558 -				// FIXME check if load of fio was successful
   7.559 +				// FIXME loadFIO check if load of fio was successful
   7.560  				saveState(
   7.561  					(LinkableMapObj*)fio,
   7.562  					"delete ()",
   7.563 @@ -3228,7 +3123,6 @@
   7.564  			}
   7.565  
   7.566  			mapCenter->reposition();
   7.567 -			adjustCanvasSize();
   7.568  			scene()->update();
   7.569  		}
   7.570  		delete (p);
   7.571 @@ -3392,7 +3286,6 @@
   7.572  			BranchObj *bo=((BranchObj*)selection);
   7.573  			importDirInt (bo,QDir(fd->selectedFile()) );
   7.574  			mapCenter->reposition();
   7.575 -			adjustCanvasSize();
   7.576  			scene()->update();
   7.577  		}
   7.578  	}	
   7.579 @@ -3436,7 +3329,7 @@
   7.580  				}
   7.581  				if (dia.deleteXLink())
   7.582  					((BranchObj*)selection)->deleteXLinkAt(i);
   7.583 -				//saveStateComplete("Edit xLink");	//FIXME undoCommand
   7.584 +				//saveStateComplete("Edit xLink");	//FIXME editXLink undoCommand
   7.585  			}
   7.586  		}	
   7.587  	}
   7.588 @@ -3502,7 +3395,7 @@
   7.589  
   7.590  void MapEditor::updateViewCenter()
   7.591  {
   7.592 -/* FIXME still to port to QT4 inverseworldmatrix
   7.593 +/* FIXME updateViewCenter still to port to QT4 inverseworldmatrix
   7.594  	// Update movingCenter, so that we can zoom comfortably later
   7.595  	QRectF rc = QRectF( contentsX(), contentsY(),
   7.596  				  visibleWidth(), visibleHeight() );
   7.597 @@ -3528,7 +3421,6 @@
   7.598  			if (selection) selection->unselect();
   7.599  			selection=lmo;
   7.600  			selection->select();
   7.601 -			adjustCanvasSize();
   7.602  		}
   7.603  		// Context Menu 
   7.604  		if (selection) 
   7.605 @@ -3705,8 +3597,6 @@
   7.606  		{
   7.607  			movingObj=NULL;	// move Content not Obj
   7.608  			movingObj_start=e->globalPos();
   7.609 -			// FIXME not ported to QT4 yet (move canvasView)
   7.610 -			//movingCont_start=QPointF (contentsX(), contentsY() );
   7.611  			movingCont_start=QPointF (
   7.612  				horizontalScrollBar()->value(),
   7.613  				verticalScrollBar()->value());
   7.614 @@ -3841,9 +3731,6 @@
   7.615  		QPointF p=e->globalPos();
   7.616  		movingVec.setX(-p.x() + movingObj_start.x() );
   7.617  		movingVec.setY(-p.y() + movingObj_start.y() );
   7.618 -		// FIXME not ported to QT4 yet (move canvasView)
   7.619 -		//setContentsPos( movingCont_start.x() + movingVec.x(),
   7.620 -	    //movingCont_start.y() + movingVec.y();
   7.621  		horizontalScrollBar()->setSliderPosition((int)( movingCont_start.x()+movingVec.x() ));
   7.622  		verticalScrollBar()->setSliderPosition((int)( movingCont_start.y()+movingVec.y() ) );
   7.623      }
   7.624 @@ -3913,7 +3800,6 @@
   7.625  				"moveRel "+pnow,
   7.626  				QString("Move %1 to relativ position %2").arg(getName(selection)).arg(pnow));
   7.627  
   7.628 -			// FIXME Why calling parObj here?
   7.629  			selection->getParObj()->requestReposition();
   7.630  			mapCenter->reposition();
   7.631  		}	
   7.632 @@ -3927,8 +3813,7 @@
   7.633  			dst=NULL;
   7.634  		
   7.635  		if (typeid(*selection) == typeid(MapCenterObj)  )
   7.636 -		{	// The MapCenter was moved
   7.637 -			cout << "FIXME missing savestate...\n";	
   7.638 +		{	// FIXME The MapCenter was moved, no savestate yet
   7.639  		}
   7.640  		
   7.641  		if (typeid(*selection) == typeid(BranchObj)  )
   7.642 @@ -4002,7 +3887,6 @@
   7.643  			mapCenter->reposition();
   7.644  		}
   7.645  		// Finally resize scene, if needed
   7.646 -		adjustCanvasSize();
   7.647  		scene()->update();
   7.648  		movingObj=NULL;		
   7.649  
   7.650 @@ -4033,68 +3917,25 @@
   7.651  void MapEditor::resizeEvent (QResizeEvent* e)
   7.652  {
   7.653  	QGraphicsView::resizeEvent( e );
   7.654 -	adjustCanvasSize();
   7.655  }
   7.656  
   7.657 -void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event) 
   7.658 +void MapEditor::dragEnterEvent(QDragEnterEvent *event)
   7.659  {
   7.660 -	//FIXME not ported to QT4 yet
   7.661 -
   7.662 -//  for (unsigned int i=0;event->format(i);i++) // Debug mime type
   7.663 -//    cerr << event->format(i) << endl;
   7.664 -
   7.665 -  if (selection && 
   7.666 -      (typeid(*selection) == typeid(BranchObj)) || 
   7.667 -      (typeid(*selection) == typeid(MapCenterObj))) {
   7.668 -    
   7.669 -    // If QImageDrag can decode mime type 
   7.670 -    if (Q3ImageDrag::canDecode(event)) {
   7.671 -      event->accept();
   7.672 -      return;
   7.673 -    }
   7.674 -    
   7.675 -    // If image are dragged from firefox 
   7.676 -    if (event->provides("application/x-moz-file-promise-url") && 
   7.677 -	event->provides("application/x-moz-nativeimage")) {
   7.678 -      event->accept(true);
   7.679 -      return;
   7.680 -    }
   7.681 -
   7.682 -    // If QUriDrag can decode mime type 
   7.683 -    if (Q3UriDrag::canDecode(event)) {
   7.684 -      event->accept();
   7.685 -      return;
   7.686 -    }
   7.687 -    
   7.688 -	// If Uri are dragged from firefox 
   7.689 -    if (event->provides("_NETSCAPE_URL")){
   7.690 -      event->accept();
   7.691 -      return;
   7.692 -    }
   7.693 -
   7.694 -    // If QTextDrag can decode mime type
   7.695 -    if (Q3TextDrag::canDecode(event)) {
   7.696 -      event->accept();
   7.697 -      return;
   7.698 -    }
   7.699 -
   7.700 -  }
   7.701 -  event->ignore();
   7.702 +  for (unsigned int i=0;event->format(i);i++) // Debug mime type
   7.703 +    cerr << event->format(i) << endl;
   7.704 +
   7.705 +	if (event->mimeData()->hasFormat("image/png"))
   7.706 +	event->acceptProposedAction();
   7.707  }
   7.708  
   7.709 -bool isUnicode16(const QByteArray &d) 
   7.710 +void MapEditor::dropEvent(QDropEvent *event)
   7.711  {
   7.712 -  // TODO: make more precise check for unicode 16.
   7.713 -  // Guess unicode16 if any of second bytes are zero
   7.714 -  unsigned int length = max(0,d.size()-2)/2;
   7.715 -  for (unsigned int i = 0; i<length ; i++)
   7.716 -    if (d.at(i*2+1)==0) return true;
   7.717 -  return false;
   7.718 +	if (event->mimeData()->hasFormat("image/png"))
   7.719  }
   7.720 -      
   7.721 +
   7.722  void MapEditor::contentsDropEvent(QDropEvent *event) 
   7.723  {
   7.724 -	//FIXME not ported to QT4 yet
   7.725 +	//FIXME dropEvent not ported to QT4 yet
   7.726  	if (selection && 
   7.727        (typeid(*selection) == typeid(BranchObj)) || 
   7.728        (typeid(*selection) == typeid(MapCenterObj))) 
   7.729 @@ -4170,7 +4011,7 @@
   7.730  		}
   7.731  		*/
   7.732  
   7.733 -		/* FIXME not ported yet  QSTRINGLIST has no next... 
   7.734 +		/* not ported yet  QSTRINGLIST has no next... 
   7.735  		if (uris.count()>0)
   7.736  		{
   7.737  			QStringList files;
   7.738 @@ -4209,15 +4050,71 @@
   7.739  		*/
   7.740  		if (update) 
   7.741  		{
   7.742 -			//FIXME saveState has to be called earlier for each of the drops...
   7.743 +			//FIXME dropEvent: saveState has to be called earlier for each of the drops...
   7.744  			//saveStateComplete("Drop Event");	//TODO undo Command
   7.745  			mapCenter->reposition();
   7.746 -			adjustCanvasSize();
   7.747  			scene()->update();
   7.748  		}	
   7.749  	}	
   7.750  }
   7.751  
   7.752 +
   7.753 +void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event) 
   7.754 +{
   7.755 +	//FIXME contentsDragEnterEvent not ported to QT4 yet
   7.756 +
   7.757 +//  for (unsigned int i=0;event->format(i);i++) // Debug mime type
   7.758 +//    cerr << event->format(i) << endl;
   7.759 +
   7.760 +  if (selection && 
   7.761 +      (typeid(*selection) == typeid(BranchObj)) || 
   7.762 +      (typeid(*selection) == typeid(MapCenterObj))) {
   7.763 +    
   7.764 +    // If QImageDrag can decode mime type 
   7.765 +    if (Q3ImageDrag::canDecode(event)) {
   7.766 +      event->accept();
   7.767 +      return;
   7.768 +    }
   7.769 +    
   7.770 +    // If image are dragged from firefox 
   7.771 +    if (event->provides("application/x-moz-file-promise-url") && 
   7.772 +	event->provides("application/x-moz-nativeimage")) {
   7.773 +      event->accept(true);
   7.774 +      return;
   7.775 +    }
   7.776 +
   7.777 +    // If QUriDrag can decode mime type 
   7.778 +    if (Q3UriDrag::canDecode(event)) {
   7.779 +      event->accept();
   7.780 +      return;
   7.781 +    }
   7.782 +    
   7.783 +	// If Uri are dragged from firefox 
   7.784 +    if (event->provides("_NETSCAPE_URL")){
   7.785 +      event->accept();
   7.786 +      return;
   7.787 +    }
   7.788 +
   7.789 +    // If QTextDrag can decode mime type
   7.790 +    if (Q3TextDrag::canDecode(event)) {
   7.791 +      event->accept();
   7.792 +      return;
   7.793 +    }
   7.794 +
   7.795 +  }
   7.796 +  event->ignore();
   7.797 +}
   7.798 +
   7.799 +bool isUnicode16(const QByteArray &d) 
   7.800 +{
   7.801 +  // TODO: make more precise check for unicode 16.
   7.802 +  // Guess unicode16 if any of second bytes are zero
   7.803 +  unsigned int length = max(0,d.size()-2)/2;
   7.804 +  for (unsigned int i = 0; i<length ; i++)
   7.805 +    if (d.at(i*2+1)==0) return true;
   7.806 +  return false;
   7.807 +}
   7.808 +      
   7.809  void MapEditor::addFloatImageInt (const QPixmap &img) 
   7.810  {
   7.811    if (selection && 
   7.812 @@ -4232,13 +4129,13 @@
   7.813      fio->load(img);
   7.814      fio->setOriginalFilename("Image added by Drag and Drop");
   7.815      mapCenter->reposition();
   7.816 -    adjustCanvasSize();
   7.817      scene()->update();
   7.818    }
   7.819  }
   7.820  
   7.821 -
   7.822 -void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation */*nop*/) 
   7.823 +/*
   7.824 +
   7.825 +void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation * / *nop* /) 
   7.826  {
   7.827    if (!imageBuffer) imageBuffer = new QBuffer();
   7.828    if (!imageBuffer->isOpen()) {
   7.829 @@ -4281,3 +4178,5 @@
   7.830  	  this, SLOT(imageDataFetched(const QByteArray &, Q3NetworkOperation *)));
   7.831    urlOperator->get();
   7.832  }
   7.833 +*/
   7.834 +
     8.1 --- a/mapeditor.h	Thu Dec 14 17:01:44 2006 +0000
     8.2 +++ b/mapeditor.h	Fri Dec 29 13:52:17 2006 +0000
     8.3 @@ -21,7 +21,6 @@
     8.4  	~MapEditor();
     8.5      MapCenterObj* getMapCenter();
     8.6  	QGraphicsScene * getScene();
     8.7 -	void adjustCanvasSize();// adjust canvas size to map and scrollview
     8.8  	bool isRepositionBlocked(); // block while load or undo
     8.9  	
    8.10  private:
    8.11 @@ -38,10 +37,12 @@
    8.12  private:
    8.13      void addFloatImageInt(const QPixmap &img);
    8.14  
    8.15 +/*
    8.16    private slots:
    8.17      void fetchImage(const QString &img);
    8.18      void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
    8.19      void imageDataFinished(Q3NetworkOperation *);
    8.20 +	*/
    8.21  
    8.22  public:
    8.23  	bool isDefault();		// false, if map was changed once
    8.24 @@ -193,6 +194,9 @@
    8.25      virtual void mouseDoubleClickEvent(QMouseEvent*);
    8.26      virtual void mouseMoveEvent(QMouseEvent*);
    8.27  
    8.28 +	virtual void dragEnterEvent (QDragEnterEvent *);
    8.29 +	virtual void dropEvent (QDropEvent *);
    8.30 +
    8.31      virtual void contentsDragEnterEvent(QDragEnterEvent *event);
    8.32      virtual void contentsDropEvent(QDropEvent *event);
    8.33  private:
     9.1 --- a/mapobj.cpp	Thu Dec 14 17:01:44 2006 +0000
     9.2 +++ b/mapobj.cpp	Fri Dec 29 13:52:17 2006 +0000
     9.3 @@ -104,13 +104,6 @@
     9.4  
     9.5  bool MapObj::inBox(const QPointF &p)
     9.6  {
     9.7 -/* FIXME testing QT4 only
     9.8 -	cout << "MO::inBox  "<<p<<"  "<<
     9.9 -		clickBox.left()<<","<<
    9.10 -		clickBox.right()<<","<<
    9.11 -		clickBox.top()<<","<<
    9.12 -		clickBox.bottom()<<endl;
    9.13 -		*/
    9.14      if (p.x() >= clickBox.left() && p.x() <= clickBox.right()  
    9.15  	&& p.y() <= clickBox.bottom() && p.y() >= clickBox.top() )
    9.16  		return true;
    10.1 --- a/xml.cpp	Thu Dec 14 17:01:44 2006 +0000
    10.2 +++ b/xml.cpp	Fri Dec 29 13:52:17 2006 +0000
    10.3 @@ -2,7 +2,6 @@
    10.4  
    10.5  #include <QMessageBox>
    10.6  #include <QColor>
    10.7 -// #include <q3stylesheet.h>
    10.8  #include <QTextStream>
    10.9  #include <iostream>
   10.10  
   10.11 @@ -528,21 +527,6 @@
   10.12  		}
   10.13  		file.close();
   10.14  
   10.15 -		/* TODO very likely not needed any longer
   10.16 -		// Convert to richtext
   10.17 -		if ( !Q3StyleSheet::mightBeRichText( lines ) )
   10.18 -		{
   10.19 -			// Here we are workarounding the QT conversion method:
   10.20 -			// convertFromPlainText does not generate valid xml, needed
   10.21 -			// for the parser, but just <p> and <br> without closing tags.
   10.22 -			// So we have to add those by ourselves
   10.23 -			//lines=quotemeta (lines);
   10.24 -			qWarning ("xml.cpp: Still using Q3StyleSheet::mightBeRichText");
   10.25 -			lines = Q3StyleSheet::convertFromPlainText( lines, Q3StyleSheetItem::WhiteSpaceNormal );
   10.26 -			lines.replace ("<br>","<br />");
   10.27 -		}	
   10.28 -		*/
   10.29 -
   10.30  		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
   10.31  		no.setNote (lines);
   10.32  	}