1.8.64 various fixes
authorinsilmaril
Fri Jan 05 11:17:32 2007 +0000 (2007-01-05)
changeset 4171cc7bbf75f0b
parent 416 922d7f6c4e6c
child 418 27f3491e6831
1.8.64 various fixes
branchobj.cpp
branchobj.h
demos/todo.vym
floatimageobj.cpp
icons/formatcoloritem.png
icons/formatcoloritem.xpm
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
ornamentedobj.cpp
ornamentedobj.h
version.h
     1.1 --- a/branchobj.cpp	Fri Dec 29 13:52:19 2006 +0000
     1.2 +++ b/branchobj.cpp	Fri Jan 05 11:17:32 2007 +0000
     1.3 @@ -232,7 +232,7 @@
     1.4  	}	
     1.5  
     1.6  	// updateLink is called implicitly in move
     1.7 -	requestReposition();	// FIXME shouldn't be this a request?
     1.8 +	requestReposition();	
     1.9  }
    1.10  
    1.11  void BranchObj::unsetParObjTmp()
    1.12 @@ -370,11 +370,11 @@
    1.13  			LinkableMapObj::setLinkColor ();
    1.14  }
    1.15  
    1.16 -void BranchObj::setColorChilds (QColor col)
    1.17 +void BranchObj::setColorSubtree(QColor col)
    1.18  {
    1.19  	OrnamentedObj::setColor (col);
    1.20  	for (int i=0; i<branch.size(); ++i)
    1.21 -		branch.at(i)->setColorChilds(col);
    1.22 +		branch.at(i)->setColorSubtree(col);
    1.23  }
    1.24  
    1.25  BranchObj* BranchObj::first()
    1.26 @@ -452,7 +452,6 @@
    1.27  		if (itLast==branch.at(i))
    1.28  		{
    1.29  			// ok, we come from my own childs
    1.30 -			//xyz  //FIXME  need to proceed to NEXT child or up again
    1.31  			if (i<branch.size()-1)
    1.32  				bo=branch.at(i+1);
    1.33  			 else
    1.34 @@ -732,8 +731,12 @@
    1.35  
    1.36  QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
    1.37  {
    1.38 +	// Cloudy stuff can be hidden during exports
    1.39  	if (hidden) return "";
    1.40  
    1.41 +	// Update of note is usually done while unselecting a branch
    1.42 +	if (isNoteInEditor) getNoteFromTextEditor();
    1.43 +	
    1.44      QString s,a;
    1.45  	QString scrolledAttr;
    1.46  	if (scrolled) 
    1.47 @@ -1123,8 +1126,13 @@
    1.48  
    1.49  BranchObj* BranchObj::getLastSelectedBranch ()
    1.50  {
    1.51 -    if (lastSelectedBranch>=0 && branch.size()>0) 
    1.52 -		return branch.at(lastSelectedBranch);
    1.53 +    if (lastSelectedBranch>=0)
    1.54 +	{
    1.55 +		if ( branch.size()>lastSelectedBranch) 
    1.56 +			return branch.at(lastSelectedBranch);
    1.57 +		if (branch.size()>0)
    1.58 +			return branch.last();
    1.59 +	}	
    1.60      return NULL;
    1.61  }
    1.62  
    1.63 @@ -1335,7 +1343,6 @@
    1.64  		calcBBoxSizeWithChilds();
    1.65  		updateLink();	// This update is needed if the scene is resized 
    1.66  						// due to excessive moving of a FIO
    1.67 -						// FIXME really needed? reposition is also called from updateLink...
    1.68  
    1.69  	    alignRelativeTo ( QPointF (absPos.x(),
    1.70  			absPos.y()-(bboxTotal.height()-bbox.height())/2) );
    1.71 @@ -1453,6 +1460,7 @@
    1.72  	else	
    1.73  		textEditor->setFilenameHint(getHeading() );
    1.74  	textEditor->setFontHint (note.getFontHint() );
    1.75 +	isNoteInEditor=true;
    1.76  
    1.77      LinkableMapObj::select();
    1.78  	// Tell parent that I am selected now:
    1.79 @@ -1482,10 +1490,9 @@
    1.80  	// Delete any messages like vymLink in StatusBar
    1.81  	mainWindow->statusMessage ("");
    1.82  
    1.83 -	// save note from editor and set flag
    1.84 -	// text is done by updateNoteFlag(), just save
    1.85 -	// filename here
    1.86 -	note.setFilenameHint (textEditor->getFilename());
    1.87 +	// Save current note
    1.88 +	if (isNoteInEditor) getNoteFromTextEditor();
    1.89 +	isNoteInEditor=false;
    1.90  
    1.91  	// reset temporary unscroll, if we have scrolled parents somewhere
    1.92  	if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
     2.1 --- a/branchobj.h	Fri Dec 29 13:52:19 2006 +0000
     2.2 +++ b/branchobj.h	Fri Jan 05 11:17:32 2007 +0000
     2.3 @@ -43,7 +43,7 @@
     2.4  	virtual void setVisibility(bool,int);	// set visibility
     2.5      virtual void setVisibility(bool);	    // set vis. for w
     2.6  	virtual void setLinkColor();			// set the color of link
     2.7 -	virtual void setColorChilds(QColor);			// set the color of heading
     2.8 +	virtual void setColorSubtree(QColor);	// set the color of heading
     2.9  
    2.10  	BranchObj* first ();				// set Iterator to first LMO
    2.11  	BranchObj* next ();					// find next LMO after given one
     3.1 Binary file demos/todo.vym has changed
     4.1 --- a/floatimageobj.cpp	Fri Dec 29 13:52:19 2006 +0000
     4.2 +++ b/floatimageobj.cpp	Fri Jan 05 11:17:32 2007 +0000
     4.3 @@ -35,7 +35,7 @@
     4.4  
     4.5  FloatImageObj::~FloatImageObj ()
     4.6  {
     4.7 -	cout << "Destr FloatImageObj "<<this<<"\n";
     4.8 +//	cout << "Destr FloatImageObj "<<this<<"\n";
     4.9  	delete(icon);
    4.10  }
    4.11  
     5.1 Binary file icons/formatcoloritem.png has changed
     6.1 --- a/icons/formatcoloritem.xpm	Fri Dec 29 13:52:19 2006 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,31 +0,0 @@
     6.4 -/* XPM */
     6.5 -static char * formatcoloritem_xpm[] = {
     6.6 -"22 21 7 1",
     6.7 -" 	c None",
     6.8 -".	c #949194",
     6.9 -"+	c #DEDADE",
    6.10 -"@	c #000000",
    6.11 -"#	c #FFFFFF",
    6.12 -"$	c #FF0000",
    6.13 -"%	c #0000FF",
    6.14 -"      ..              ",
    6.15 -"     ....             ",
    6.16 -"    ..++..            ",
    6.17 -"    ..+@..            ",
    6.18 -"    ..@#..            ",
    6.19 -"    @@##..@$          ",
    6.20 -"    @##+..+@$$        ",
    6.21 -"   @##+#@.++@$$       ",
    6.22 -"  @##+#@+@++.$$$      ",
    6.23 -" @##+#++@++..$$$      ",
    6.24 -"@##+#+++++..@$$$      ",
    6.25 -"@#+#+++++..@ $$$      ",
    6.26 -" @#+++++..@  $$$      ",
    6.27 -"  @#+++..@   $$$      ",
    6.28 -"   @++..@    $$       ",
    6.29 -"    @..@     $        ",
    6.30 -"     @@               ",
    6.31 -"                      ",
    6.32 -"                      ",
    6.33 -"            %%%%%%%%%%",
    6.34 -"            %%%%%%%%%%"};
     7.1 --- a/mainwindow.cpp	Fri Dec 29 13:52:19 2006 +0000
     7.2 +++ b/mainwindow.cpp	Fri Jan 05 11:17:32 2007 +0000
     7.3 @@ -791,20 +791,20 @@
     7.4  	actionListBranches.append(a);
     7.5  	actionFormatPickColor=a;
     7.6  
     7.7 -    a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch","Edit menu" ), this);
     7.8 +    a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color &branch","Edit menu" ), this);
     7.9  	a->setStatusTip ( tr( "Color branch" ) );
    7.10  	a->setShortcut (Qt::CTRL + Qt::Key_I);
    7.11 -    connect( a, SIGNAL( triggered() ), this, SLOT( formatColorItem() ) );
    7.12 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) );
    7.13  	a->setEnabled (false);
    7.14      a->addTo( tb );
    7.15  	formatMenu->addAction (a);
    7.16  	actionListBranches.append(a);
    7.17 -	actionFormatColorBranch=a;
    7.18 -
    7.19 -    a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree","Edit menu" ), this);
    7.20 +	actionFormatColorSubtree=a;
    7.21 +
    7.22 +    a= new QAction(QPixmap(iconPath+"formatcolorsubtree.png"), tr( "Color sub&tree","Edit menu" ), this);
    7.23  	a->setStatusTip ( tr( "Color Subtree" ));
    7.24  	a->setShortcut (Qt::CTRL + Qt::Key_T);
    7.25 -    connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) );
    7.26 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatColorSubtree() ) );
    7.27  	a->setEnabled (false);
    7.28  	formatMenu->addAction (a);
    7.29      a->addTo( tb );
    7.30 @@ -2997,18 +2997,18 @@
    7.31  	currentColor=c;
    7.32  }
    7.33  
    7.34 -void Main::formatColorItem()
    7.35 -{
    7.36 -	if (currentMapEditor())
    7.37 -		currentMapEditor()->colorItem(currentColor);
    7.38 -}
    7.39 -
    7.40  void Main::formatColorBranch()
    7.41  {
    7.42  	if (currentMapEditor())
    7.43  		currentMapEditor()->colorBranch(currentColor);
    7.44  }
    7.45  
    7.46 +void Main::formatColorSubtree()
    7.47 +{
    7.48 +	if (currentMapEditor())
    7.49 +		currentMapEditor()->colorSubtree (currentColor);
    7.50 +}
    7.51 +
    7.52  void Main::formatLinkStyleLine()
    7.53  {
    7.54  	if (currentMapEditor())
    7.55 @@ -3093,7 +3093,6 @@
    7.56  		QMatrix m;
    7.57  		m.reset();
    7.58  		currentMapEditor()->setMatrix( m );
    7.59 -		currentMapEditor()->setViewCenter();
    7.60  	}	
    7.61  }
    7.62  
    7.63 @@ -3104,7 +3103,6 @@
    7.64  		QMatrix m = currentMapEditor()->matrix();
    7.65  		m.scale( 1.25, 1.25 );
    7.66  		currentMapEditor()->setMatrix( m );
    7.67 -		currentMapEditor()->setViewCenter();
    7.68  	}	
    7.69  }
    7.70  
    7.71 @@ -3115,7 +3113,6 @@
    7.72  		QMatrix m = currentMapEditor()->matrix();
    7.73  		m.scale( 0.8, 0.8 );
    7.74  		currentMapEditor()->setMatrix( m );
    7.75 -		currentMapEditor()->setViewCenter();
    7.76  	}	
    7.77  }
    7.78  
     8.1 --- a/mainwindow.h	Fri Dec 29 13:52:19 2006 +0000
     8.2 +++ b/mainwindow.h	Fri Jan 05 11:17:32 2007 +0000
     8.3 @@ -136,8 +136,8 @@
     8.4      void formatSelectColor();
     8.5      void formatPickColor();
     8.6      void colorChanged(QColor);
     8.7 -    void formatColorItem();
     8.8      void formatColorBranch();
     8.9 +    void formatColorSubtree();
    8.10  	void formatLinkStyleLine();
    8.11  	void formatLinkStyleParabel();
    8.12  	void formatLinkStylePolyLine();
     9.1 --- a/mapeditor.cpp	Fri Dec 29 13:52:19 2006 +0000
     9.2 +++ b/mapeditor.cpp	Fri Jan 05 11:17:32 2007 +0000
     9.3 @@ -62,7 +62,6 @@
     9.4  	//cout << "Constructor ME "<<this<<endl;
     9.5  	mapNum++;
     9.6  
     9.7 -    viewport()->setAcceptDrops(true);
     9.8  
     9.9  	mapScene= new QGraphicsScene(parent);
    9.10  	//mapScene= new QGraphicsScene(QRectF(0,0,width(),height()), parent);
    9.11 @@ -134,8 +133,7 @@
    9.12  	// Create temporary files
    9.13  	makeTmpDirs();
    9.14  
    9.15 -	// Initially set movingCentre
    9.16 -	updateViewCenter();
    9.17 +	setAcceptDrops (true);	
    9.18  
    9.19  	mapCenter->reposition();	//	for positioning heading
    9.20  
    9.21 @@ -522,20 +520,6 @@
    9.22  				addMapInsertInt(t,y);	
    9.23  			}
    9.24  		}
    9.25 -	} else if (com=="colorItem")
    9.26 -	{
    9.27 -		if (!selection)
    9.28 -		{
    9.29 -			api.setError (Aborted,"Nothing selected");
    9.30 -		} else if ( typeid(*selection) != typeid(BranchObj) && 
    9.31 -					typeid(*selection) != typeid(MapCenterObj))
    9.32 -		{				  
    9.33 -			api.setError (Aborted,"Type of selection is not a branch");
    9.34 -		} else if (api.checkParamCount(1))
    9.35 -		{	
    9.36 -			QColor c=api.parColor (ok,0);
    9.37 -			if (ok) colorItem (c);
    9.38 -		}	
    9.39  	} else if (com=="colorBranch")
    9.40  	{
    9.41  		if (!selection)
    9.42 @@ -550,6 +534,20 @@
    9.43  			QColor c=api.parColor (ok,0);
    9.44  			if (ok) colorBranch (c);
    9.45  		}	
    9.46 +	} else if (com=="colorSubtree")
    9.47 +	{
    9.48 +		if (!selection)
    9.49 +		{
    9.50 +			api.setError (Aborted,"Nothing selected");
    9.51 +		} else if ( typeid(*selection) != typeid(BranchObj) && 
    9.52 +					typeid(*selection) != typeid(MapCenterObj))
    9.53 +		{				  
    9.54 +			api.setError (Aborted,"Type of selection is not a branch");
    9.55 +		} else if (api.checkParamCount(1))
    9.56 +		{	
    9.57 +			QColor c=api.parColor (ok,0);
    9.58 +			if (ok) colorSubtree (c);
    9.59 +		}	
    9.60  	} else if (com=="cut")
    9.61  	{
    9.62  		if (!selection)
    9.63 @@ -1126,7 +1124,6 @@
    9.64  	{
    9.65  		QPainter pp(printer);
    9.66  
    9.67 -		//pp.setRenderHints(renderHints());
    9.68  		pp.setRenderHint(QPainter::Antialiasing,true);
    9.69  
    9.70  		// Don't print the visualisation of selection
    9.71 @@ -1140,79 +1137,49 @@
    9.72  		QRectF mapRect=totalBBox;
    9.73  		QGraphicsRectItem *frame=NULL;
    9.74  
    9.75 -		if (printFrame || printFooter)
    9.76 +		if (printFrame) 
    9.77  		{
    9.78 -			
    9.79 -			if (printFrame) 
    9.80 -			{
    9.81 -				// Print frame around map
    9.82 -				mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, 
    9.83 -					totalBBox.width()+20, totalBBox.height()+20);
    9.84 -				frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::NoBrush));
    9.85 -				frame->setZValue(0);
    9.86 -				frame->show();    
    9.87 -			}		
    9.88 -
    9.89 -			if (printFooter) 
    9.90 -			{
    9.91 -				// Print footer below map
    9.92 -				QFont font;		
    9.93 -				font.setPointSize(10);
    9.94 -				pp.setFont (font);
    9.95 -				QRectF footerBox(0,printer->height()-15,printer->width(),15);
    9.96 -				pp.drawText ( footerBox,Qt::AlignLeft,"VYM - " +fileName);
    9.97 -				pp.drawText ( footerBox, Qt::AlignRight, QDate::currentDate().toString(Qt::TextDate));
    9.98 -			}
    9.99 -		}
   9.100 -
   9.101 -		/*
   9.102 +			// Print frame around map
   9.103 +			mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, 
   9.104 +				totalBBox.width()+20, totalBBox.height()+20);
   9.105 +			frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::NoBrush));
   9.106 +			frame->setZValue(0);
   9.107 +			frame->show();    
   9.108 +		}		
   9.109 +
   9.110 +
   9.111  		double paperAspect = (double)printer->width()   / (double)printer->height();
   9.112  		double   mapAspect = (double)mapRect.width() / (double)mapRect.height();
   9.113 -		cout <<"mapAspect="<<mapAspect<<"   paperAspect"<<paperAspect<<endl;
   9.114 +		int viewBottom;
   9.115  		if (mapAspect>=paperAspect)
   9.116  		{
   9.117  			// Fit horizontally to paper width
   9.118 -			pp.setViewport(0,0, printer->width(),(int)(printer->width()/mapAspect) );	
   9.119 -			qWarning ("Fit hor");
   9.120 +			//pp.setViewport(0,0, printer->width(),(int)(printer->width()/mapAspect) );	
   9.121 +			viewBottom=(int)(printer->width()/mapAspect);	
   9.122  		}	else
   9.123  		{
   9.124  			// Fit vertically to paper height
   9.125 -			pp.setViewport(0,0,(int)(printer->height()*mapAspect),printer->height());	
   9.126 -			qWarning ("Fit ver");
   9.127 +			//pp.setViewport(0,0,(int)(printer->height()*mapAspect),printer->height());	
   9.128 +			viewBottom=printer->height();	
   9.129  		}	
   9.130 -		*/
   9.131 +		
   9.132 +		if (printFooter) 
   9.133 +		{
   9.134 +			// Print footer below map
   9.135 +			QFont font;		
   9.136 +			font.setPointSize(10);
   9.137 +			pp.setFont (font);
   9.138 +			QRectF footerBox(0,viewBottom,printer->width(),15);
   9.139 +			pp.drawText ( footerBox,Qt::AlignLeft,"VYM - " +fileName);
   9.140 +			pp.drawText ( footerBox, Qt::AlignRight, QDate::currentDate().toString(Qt::TextDate));
   9.141 +		}
   9.142  		mapScene->render (
   9.143  			&pp, 
   9.144 -			//pp.viewport(),
   9.145  			QRectF (0,0,printer->width(),printer->height()-15),
   9.146  			QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height())
   9.147  		);
   9.148  		
   9.149 -		//render (&pp,printer->pageRect(), QRect ((int)mapRect.x(),(int)mapRect.y(),400,400));
   9.150 -
   9.151 -		//pp.setWindow (QRect (mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height()));
   9.152 -		//mapScene->render(&pp);	// draw scene to printer
   9.153 -
   9.154  		// Viewport has paper dimension
   9.155 -		pp.drawLine (QLine (0,0,printer->width(),printer->height()));
   9.156 -		cout << "sceneRect: "
   9.157 -			<<mapScene->sceneRect().x()<<","
   9.158 -			<<mapScene->sceneRect().y()<<","
   9.159 -			<<mapScene->sceneRect().width()<<","
   9.160 -			<<mapScene->sceneRect().height()<<","<<endl;
   9.161 -		cout << "mapRect: "
   9.162 -			<<mapRect.x()<<","
   9.163 -			<<mapRect.y()<<","
   9.164 -			<<mapRect.width()<<","
   9.165 -			<<mapRect.height()<<","<<endl;
   9.166 -		cout << "pp.viewport: "
   9.167 -			<<pp.viewport().x()<<","
   9.168 -			<<pp.viewport().y()<<","
   9.169 -			<<pp.viewport().width()<<","
   9.170 -			<<pp.viewport().height()<<","<<endl;
   9.171 -		cout << "painter: w,h="<<pp.viewport().width()<<","<<pp.viewport().height()<<endl;
   9.172 -		cout << "printer: w,h="<<printer->width()<<","<<printer->height()<<endl;
   9.173 -
   9.174  		if (frame)  delete (frame);
   9.175  
   9.176  		// Restore selection
   9.177 @@ -1243,7 +1210,7 @@
   9.178  {
   9.179  /* FIXME getPixmap not ported yet to QT4
   9.180  	QRectF mapRect=mapCenter->getTotalBBox();
   9.181 -	QPixmap pix (mapRect.size());
   9.182 +	QPixmap pix ();
   9.183  	QPainter pp (&pix);
   9.184  
   9.185  	// Don't print the visualisation of selection
   9.186 @@ -1256,7 +1223,9 @@
   9.187  
   9.188  	pp.setWindow (mapRect);
   9.189  
   9.190 -	mapScene->drawArea(mapRect, &pp);	// draw scene to painter
   9.191 +	//mapScene->drawArea(mapRect, &pp);	// draw scene to painter
   9.192 +	mapScene->render(&pp);	// draw scene to painter
   9.193 +
   9.194  
   9.195  
   9.196  	// Restore selection
   9.197 @@ -1268,7 +1237,6 @@
   9.198  	
   9.199  	return pix;
   9.200  */
   9.201 -return QPixmap();
   9.202  }
   9.203  
   9.204  void MapEditor::setHideTmpMode (HideTmpMode mode)
   9.205 @@ -1885,7 +1853,7 @@
   9.206  		if (newbo)
   9.207  		{
   9.208  			saveState(
   9.209 -				selection,		// FIXME addNewBranch (int pos) sholdnt newbo be deleted here???
   9.210 +				newbo,		
   9.211  				"delete ()",
   9.212  				selection,
   9.213  				QString ("addBranch (%1)").arg(pos-2),
   9.214 @@ -2449,7 +2417,7 @@
   9.215  	return Qt::black;
   9.216  }
   9.217  
   9.218 -void MapEditor::colorItem(QColor c) 
   9.219 +void MapEditor::colorBranch (QColor c)
   9.220  {
   9.221  	if (selection) 
   9.222  	{
   9.223 @@ -2459,9 +2427,9 @@
   9.224  			BranchObj *bo=(BranchObj*)selection;
   9.225  			saveState(
   9.226  				selection, 
   9.227 -				QString ("colorItem (%1)").arg(bo->getColor().name()),
   9.228 +				QString ("colorBranch (%1)").arg(bo->getColor().name()),
   9.229  				selection,
   9.230 -				QString ("colorItem (%1)").arg(c.name()),
   9.231 +				QString ("colorBranch (%1)").arg(c.name()),
   9.232  				QString("Set color of %1 to %2").arg(getName(bo)).arg(c.name())
   9.233  			);	
   9.234  			bo->setColor(c); // color branch
   9.235 @@ -2469,7 +2437,7 @@
   9.236  	}
   9.237  }
   9.238  
   9.239 -void MapEditor::colorBranch(QColor c)
   9.240 +void MapEditor::colorSubtree (QColor c)
   9.241  {
   9.242  	if (selection) 
   9.243  	{
   9.244 @@ -2480,10 +2448,10 @@
   9.245  			saveStateChangingPart(
   9.246  				selection, 
   9.247  				selection,
   9.248 -				QString ("colorBranch (%1)").arg(c.name()),
   9.249 +				QString ("colorSubtree (%1)").arg(c.name()),
   9.250  				QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(c.name())
   9.251  			);	
   9.252 -			bo->setColorChilds(c); // color links, color childs
   9.253 +			bo->setColorSubtree (c); // color links, color childs
   9.254  		}    
   9.255  	}
   9.256  }
   9.257 @@ -2519,14 +2487,6 @@
   9.258  	}	
   9.259  }
   9.260  
   9.261 -void MapEditor::setViewCenter()
   9.262 -{
   9.263 -	// transform to sceneView Coord:
   9.264 -	QPointF p=matrix().map(movingCenter);
   9.265 -	//FIXME setViewCenter not ported yet to QT4 (center ist TextStream there)
   9.266 -	//center ( p.x(), p.y());
   9.267 -}
   9.268 -
   9.269  
   9.270  BranchObj* MapEditor::findText (QString s, bool cs)
   9.271  {
   9.272 @@ -3393,18 +3353,6 @@
   9.273  
   9.274  }
   9.275  
   9.276 -void MapEditor::updateViewCenter()
   9.277 -{
   9.278 -/* FIXME updateViewCenter still to port to QT4 inverseworldmatrix
   9.279 -	// Update movingCenter, so that we can zoom comfortably later
   9.280 -	QRectF rc = QRectF( contentsX(), contentsY(),
   9.281 -				  visibleWidth(), visibleHeight() );
   9.282 -	QRectF canvasRect = inverseWorldMatrix().mapRect(rc);
   9.283 -	movingCenter.setX((canvasRect.right() + canvasRect.left())/2);
   9.284 -	movingCenter.setY((canvasRect.top() + canvasRect.bottom())/2);
   9.285 -	*/
   9.286 -}
   9.287 -
   9.288  void MapEditor::contextMenuEvent ( QContextMenuEvent * e )
   9.289  {
   9.290  	// Lineedits are already closed by preceding
   9.291 @@ -3751,15 +3699,9 @@
   9.292  		if (dst && selection) 
   9.293  		{	
   9.294  			if (e->state() & Qt::ShiftModifier)
   9.295 -			{
   9.296 -				((BranchObj*)selection)->setColor (((BranchObj*)(dst))->getColor());
   9.297 -				((BranchObj*)selection)->setLinkColor ();
   9.298 -			}	
   9.299 +				colorBranch (((BranchObj*)(dst))->getColor());
   9.300  			else	
   9.301 -			{
   9.302 -				((BranchObj*)selection)->setColorChilds (((BranchObj*)(dst))->getColor());
   9.303 -				((BranchObj*)selection)->setLinkColor ();
   9.304 -			}	
   9.305 +				colorSubtree (((BranchObj*)(dst))->getColor());
   9.306  		} 
   9.307  		return;
   9.308  	}
   9.309 @@ -3921,48 +3863,81 @@
   9.310  
   9.311  void MapEditor::dragEnterEvent(QDragEnterEvent *event)
   9.312  {
   9.313 -  for (unsigned int i=0;event->format(i);i++) // Debug mime type
   9.314 -    cerr << event->format(i) << endl;
   9.315 -
   9.316 -	if (event->mimeData()->hasFormat("image/png"))
   9.317 -	event->acceptProposedAction();
   9.318 +	//for (unsigned int i=0;event->format(i);i++) // Debug mime type
   9.319 +	//	cerr << event->format(i) << endl;
   9.320 +
   9.321 +	if (event->mimeData()->hasImage())
   9.322 +		event->acceptProposedAction();
   9.323 +	else	
   9.324 +		if (event->mimeData()->hasUrls())
   9.325 +			event->acceptProposedAction();
   9.326 +}
   9.327 +
   9.328 +void MapEditor::dragMoveEvent(QDragMoveEvent *event)
   9.329 +{
   9.330 +}
   9.331 +
   9.332 +void MapEditor::dragLeaveEvent(QDragLeaveEvent *event)
   9.333 +{
   9.334 +	event->accept();
   9.335  }
   9.336  
   9.337  void MapEditor::dropEvent(QDropEvent *event)
   9.338  {
   9.339 -	if (event->mimeData()->hasFormat("image/png"))
   9.340 -}
   9.341 -
   9.342 -void MapEditor::contentsDropEvent(QDropEvent *event) 
   9.343 -{
   9.344 -	//FIXME dropEvent not ported to QT4 yet
   9.345  	if (selection && 
   9.346        (typeid(*selection) == typeid(BranchObj)) || 
   9.347        (typeid(*selection) == typeid(MapCenterObj))) 
   9.348  	{
   9.349 -		bool update=false;
   9.350 -		QStringList uris;
   9.351 -		QString heading;
   9.352 -
   9.353 -
   9.354 -		if (event->mimeData()->hasFormat("image/png"))
   9.355 +		QList <QUrl> uris;
   9.356 +		if (event->mimeData()->hasImage()) 
   9.357  		{
   9.358 -            event->acceptProposedAction();
   9.359 -			addFloatImageInt(event->mimeData()->imageData().value<QPixmap>());
   9.360 -			cout << "accepted drop\n";
   9.361 -		}	
   9.362 -
   9.363 -		/*
   9.364 -		if (event->provides("image/png")) 
   9.365 +			 QVariant imageData = event->mimeData()->imageData();
   9.366 +			 addFloatImageInt (qvariant_cast<QPixmap>(imageData));
   9.367 +		} else
   9.368 +		if (event->mimeData()->hasUrls())
   9.369 +			uris=event->mimeData()->urls();
   9.370 +
   9.371 +		if (uris.count()>0)
   9.372  		{
   9.373 -			QPixmap pix;
   9.374 -			if (Q3ImageDrag::decode(event, pix)) 
   9.375 +			QStringList files;
   9.376 +			QString s;
   9.377 +			QString heading;
   9.378 +			BranchObj *bo;
   9.379 +			for (int i=0; i<uris.count();++i)
   9.380  			{
   9.381 -				addFloatImageInt(pix);
   9.382 -				event->accept();
   9.383 -				update=true;
   9.384 -			} else
   9.385 -				event->ignore();
   9.386 +				bo=((BranchObj*)selection)->addBranch();
   9.387 +				if (bo)
   9.388 +				{
   9.389 +					s=uris.at(i).toLocalFile();
   9.390 +					if (!s.isEmpty()) 
   9.391 +					{
   9.392 +                       QString file = QDir::convertSeparators(s);
   9.393 +                       heading = QFileInfo(file).baseName();
   9.394 +                       files.append(file);
   9.395 +                       if (file.endsWith(".vym", false))
   9.396 +                           bo->setVymLink(file);
   9.397 +                       else
   9.398 +                           bo->setURL(uris.at(i).toString());
   9.399 +                   } else 
   9.400 +				   {
   9.401 +                       bo->setURL(uris.at(i).toString());
   9.402 +                   }
   9.403 +
   9.404 +                   if (!heading.isEmpty())
   9.405 +                       bo->setHeading(heading);
   9.406 +                   else
   9.407 +                       bo->setHeading(uris.at(i).toString());
   9.408 +				}
   9.409 +			}
   9.410 +		mapCenter->reposition();
   9.411 +		}
   9.412 +	}	
   9.413 +	event->acceptProposedAction();
   9.414 +}
   9.415 +
   9.416 +/*
   9.417 +void MapEditor::contentsDropEvent(QDropEvent *event) 
   9.418 +{
   9.419  
   9.420  		} else if (event->provides("application/x-moz-file-promise-url") && 
   9.421  			 event->provides("application/x-moz-nativeimage")) 
   9.422 @@ -4009,101 +3984,10 @@
   9.423  		  event->accept();
   9.424  		  update= true;
   9.425  		}
   9.426 +
   9.427  		*/
   9.428  
   9.429 -		/* not ported yet  QSTRINGLIST has no next... 
   9.430 -		if (uris.count()>0)
   9.431 -		{
   9.432 -			QStringList files;
   9.433 -			QStringList urls;
   9.434 -			QString s;
   9.435 -			BranchObj *bo;
   9.436 -			for (const char* u=uris.first(); u; u=uris.next())
   9.437 -			{
   9.438 -				bo=((BranchObj*)selection)->addBranch();
   9.439 -				if (bo)
   9.440 -				{
   9.441 -					s=Q3UriDrag::uriToLocalFile(u);
   9.442 -					if (!s.isEmpty()) 
   9.443 -					{
   9.444 -                       QString file = QDir::convertSeparators(s);
   9.445 -                       heading = QFileInfo(file).baseName();
   9.446 -                       files.append(file);
   9.447 -                       if (file.endsWith(".vym", false))
   9.448 -                           bo->setVymLink(file);
   9.449 -                       else
   9.450 -                           bo->setURL(u);
   9.451 -                   } else 
   9.452 -				   {
   9.453 -                       urls.append (u);
   9.454 -                       bo->setURL(u);
   9.455 -                   }
   9.456 -
   9.457 -                   if (!heading.isEmpty())
   9.458 -                       bo->setHeading(heading);
   9.459 -                   else
   9.460 -                       bo->setHeading(u);
   9.461 -				}
   9.462 -			}
   9.463 -			update=true;
   9.464 -		}
   9.465 -		*/
   9.466 -		if (update) 
   9.467 -		{
   9.468 -			//FIXME dropEvent: saveState has to be called earlier for each of the drops...
   9.469 -			//saveStateComplete("Drop Event");	//TODO undo Command
   9.470 -			mapCenter->reposition();
   9.471 -			scene()->update();
   9.472 -		}	
   9.473 -	}	
   9.474 -}
   9.475 -
   9.476 -
   9.477 -void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event) 
   9.478 -{
   9.479 -	//FIXME contentsDragEnterEvent not ported to QT4 yet
   9.480 -
   9.481 -//  for (unsigned int i=0;event->format(i);i++) // Debug mime type
   9.482 -//    cerr << event->format(i) << endl;
   9.483 -
   9.484 -  if (selection && 
   9.485 -      (typeid(*selection) == typeid(BranchObj)) || 
   9.486 -      (typeid(*selection) == typeid(MapCenterObj))) {
   9.487 -    
   9.488 -    // If QImageDrag can decode mime type 
   9.489 -    if (Q3ImageDrag::canDecode(event)) {
   9.490 -      event->accept();
   9.491 -      return;
   9.492 -    }
   9.493 -    
   9.494 -    // If image are dragged from firefox 
   9.495 -    if (event->provides("application/x-moz-file-promise-url") && 
   9.496 -	event->provides("application/x-moz-nativeimage")) {
   9.497 -      event->accept(true);
   9.498 -      return;
   9.499 -    }
   9.500 -
   9.501 -    // If QUriDrag can decode mime type 
   9.502 -    if (Q3UriDrag::canDecode(event)) {
   9.503 -      event->accept();
   9.504 -      return;
   9.505 -    }
   9.506 -    
   9.507 -	// If Uri are dragged from firefox 
   9.508 -    if (event->provides("_NETSCAPE_URL")){
   9.509 -      event->accept();
   9.510 -      return;
   9.511 -    }
   9.512 -
   9.513 -    // If QTextDrag can decode mime type
   9.514 -    if (Q3TextDrag::canDecode(event)) {
   9.515 -      event->accept();
   9.516 -      return;
   9.517 -    }
   9.518 -
   9.519 -  }
   9.520 -  event->ignore();
   9.521 -}
   9.522 +
   9.523  
   9.524  bool isUnicode16(const QByteArray &d) 
   9.525  {
    10.1 --- a/mapeditor.h	Fri Dec 29 13:52:19 2006 +0000
    10.2 +++ b/mapeditor.h	Fri Jan 05 11:17:32 2007 +0000
    10.3 @@ -126,10 +126,9 @@
    10.4      void setMapBackgroundColor(QColor);
    10.5      QColor getMapBackgroundColor();
    10.6      QColor getCurrentHeadingColor();
    10.7 -    void colorItem(QColor);
    10.8      void colorBranch(QColor);
    10.9 +    void colorSubtree(QColor);
   10.10  	void toggleStandardFlag(QString);
   10.11 -	virtual void setViewCenter();			// needed for zooming
   10.12      BranchObj* findText(QString,bool);		// Find object
   10.13      void findReset();						// Reset Find 
   10.14  	void setURL(const QString &);			// set the URL
   10.15 @@ -185,7 +184,6 @@
   10.16  
   10.17  protected:
   10.18  	void ensureSelectionVisible();		
   10.19 -	virtual void updateViewCenter();	// needed for zooming
   10.20  	virtual void contextMenuEvent ( QContextMenuEvent *e );
   10.21      virtual void keyPressEvent(QKeyEvent*);
   10.22      virtual void keyReleaseEvent(QKeyEvent*);
   10.23 @@ -194,11 +192,11 @@
   10.24      virtual void mouseDoubleClickEvent(QMouseEvent*);
   10.25      virtual void mouseMoveEvent(QMouseEvent*);
   10.26  
   10.27 -	virtual void dragEnterEvent (QDragEnterEvent *);
   10.28 -	virtual void dropEvent (QDropEvent *);
   10.29 +	void dragEnterEvent (QDragEnterEvent *);
   10.30 +	void dragMoveEvent (QDragMoveEvent *);
   10.31 +	void dragLeaveEvent (QDragLeaveEvent *);
   10.32 +	void dropEvent (QDropEvent *);
   10.33  
   10.34 -    virtual void contentsDragEnterEvent(QDragEnterEvent *event);
   10.35 -    virtual void contentsDropEvent(QDropEvent *event);
   10.36  private:
   10.37  	QGraphicsScene *mapScene;
   10.38      MapCenterObj* mapCenter;
   10.39 @@ -231,7 +229,6 @@
   10.40      QPointF movingObj_start;		// rel. pos of mouse to absPos 
   10.41      QPointF movingCont_start;		// inital pos of moving Content or
   10.42      QPointF movingVec;				// how far has Content moved
   10.43 -	QPointF movingCenter;			// used when zooming
   10.44      QPrinter* printer;				// Printing
   10.45  
   10.46      bool mapDefault;				// Flag if map is untouched
    11.1 --- a/ornamentedobj.cpp	Fri Dec 29 13:52:19 2006 +0000
    11.2 +++ b/ornamentedobj.cpp	Fri Jan 05 11:17:32 2007 +0000
    11.3 @@ -34,7 +34,6 @@
    11.4      delete (heading);
    11.5  	delete (systemFlags);
    11.6  	delete (standardFlags);
    11.7 -
    11.8  }
    11.9  
   11.10  
   11.11 @@ -45,6 +44,7 @@
   11.12  
   11.13  	note.setNote("");
   11.14  	note.setFontHint (textEditor->getFontHintDefault() );
   11.15 +	isNoteInEditor=false;
   11.16  
   11.17  	systemFlags=new FlagRowObj(scene);
   11.18  	systemFlags->clone(systemFlagsDefault);
   11.19 @@ -175,28 +175,13 @@
   11.20  void OrnamentedObj::setNote(QString s)
   11.21  {
   11.22  	note.setNote(s);
   11.23 -	if (!note.isEmpty())
   11.24 -		systemFlags->activate("note");
   11.25 -	else		
   11.26 -		systemFlags->deactivate("note");
   11.27 -	calcBBoxSize();
   11.28 -	positionBBox();	
   11.29 -	move (absPos.x(), absPos.y() );
   11.30 -	forceReposition();
   11.31 +	updateNoteFlag();
   11.32  }
   11.33  
   11.34  void OrnamentedObj::setNote(NoteObj n)
   11.35  {
   11.36  	note=n;
   11.37 -	if (!note.isEmpty())
   11.38 -		systemFlags->activate("note");
   11.39 -	else		
   11.40 -		systemFlags->deactivate("note");
   11.41 -	calcBBoxSize();
   11.42 -	positionBBox();	
   11.43 -	move (absPos.x(), absPos.y() );
   11.44 -	forceReposition();
   11.45 -	
   11.46 +	updateNoteFlag();
   11.47  }
   11.48  
   11.49  QString OrnamentedObj::getNote()
   11.50 @@ -310,20 +295,38 @@
   11.51  	return false;
   11.52  }
   11.53  
   11.54 +void OrnamentedObj::getNoteFromTextEditor ()
   11.55 +{
   11.56 +	note.setFilenameHint (textEditor->getFilename());
   11.57 +	note.setFontHint (textEditor->getFontHint() );
   11.58 +	setNote( textEditor->getText() );
   11.59 +}
   11.60 +
   11.61  void OrnamentedObj::updateNoteFlag()
   11.62  {
   11.63 -	if (selected) 
   11.64 -	{
   11.65 -		// text in NoteEditor has changed, notify MapEditor 
   11.66 -		mapEditor->setChanged();
   11.67 +	bool noteEmpty;
   11.68 +	if (isNoteInEditor)
   11.69 +		noteEmpty=textEditor->isEmpty();
   11.70 +	else	
   11.71 +		noteEmpty=note.isEmpty();
   11.72  
   11.73 -		// save text
   11.74 -		setNote( textEditor->getText() );
   11.75 +	if (!noteEmpty)
   11.76 +	{	
   11.77 +		if (systemFlags->isActive ("note")) return;
   11.78 +		systemFlags->activate("note");
   11.79 +	}	
   11.80 +	else		
   11.81 +	{	
   11.82 +		if (!systemFlags->isActive ("note")) return;
   11.83 +		systemFlags->deactivate("note");
   11.84 +	}	
   11.85 +	mapEditor->setChanged();
   11.86 +	calcBBoxSize();
   11.87 +	positionBBox();	
   11.88 +	move (absPos.x(), absPos.y() );
   11.89 +	forceReposition();
   11.90  	
   11.91 -		// save font   
   11.92 -		note.setFontHint (textEditor->getFontHint() );
   11.93 -	}	
   11.94 -}
   11.95 +}	
   11.96  
   11.97  void OrnamentedObj::updateFlagsToolbar()
   11.98  {
    12.1 --- a/ornamentedobj.h	Fri Dec 29 13:52:19 2006 +0000
    12.2 +++ b/ornamentedobj.h	Fri Jan 05 11:17:32 2007 +0000
    12.3 @@ -40,6 +40,7 @@
    12.4  	virtual QString getSystemFlagName (const QPointF &p);
    12.5  	virtual bool isActiveFlag(const QString&);	// check if flag is set
    12.6  	virtual void updateNoteFlag();
    12.7 +	virtual void getNoteFromTextEditor ();
    12.8  	virtual void updateFlagsToolbar();
    12.9  	virtual void setHideInExport(bool);		// set export of object (and childs)
   12.10  	virtual bool hideInExport();
   12.11 @@ -49,6 +50,7 @@
   12.12  protected:
   12.13      HeadingObj *heading;			// Heading
   12.14  	NoteObj note;					// Notes
   12.15 +	bool isNoteInEditor;			// true if TextEditor has this note
   12.16  	FlagRowObj *systemFlags;		// System Flags
   12.17  	FlagRowObj *standardFlags;		// Standard Flags
   12.18  	QRectF ornamentsBBox;			// bbox of flags and heading
    13.1 --- a/version.h	Fri Dec 29 13:52:19 2006 +0000
    13.2 +++ b/version.h	Fri Jan 05 11:17:32 2007 +0000
    13.3 @@ -4,8 +4,8 @@
    13.4  #include <QString>
    13.5  
    13.6  #define __VYM_NAME "VYM"
    13.7 -#define __VYM_VERSION "1.8.63"
    13.8 -#define __VYM_BUILD_DATE "December 21, 2006"
    13.9 +#define __VYM_VERSION "1.8.64"
   13.10 +#define __VYM_BUILD_DATE "January 2, 2007"
   13.11  
   13.12  
   13.13  bool checkVersion(const QString &);