xml-vym.cpp
changeset 777 8acac4fade1b
parent 776 25e634a7e1dc
child 779 1fb50e79661c
     1.1 --- a/xml-vym.cpp	Mon Jun 08 11:36:56 2009 +0000
     1.2 +++ b/xml-vym.cpp	Mon Jun 29 10:27:42 2009 +0000
     1.3 @@ -279,13 +279,13 @@
     1.4  			mainWindow->removeProgressBar();
     1.5  			break;
     1.6          case StateMapCenter: 
     1.7 -			model->selectParent();
     1.8 +			model->selectParent();	// FIXME-3 really needed to "select"? Maybe optimize...
     1.9  			model->emitDataHasChanged (lastBranch);
    1.10  			lastBranch=(BranchItem*)(lastBranch->parent());
    1.11  			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
    1.12              break;
    1.13          case StateBranch: 
    1.14 -			model->selectParent();
    1.15 +			model->selectParent();// FIXME-3 really needed to "select"? Maybe optimize...
    1.16  			model->emitDataHasChanged (lastBranch);
    1.17  			lastBranch=(BranchItem*)(lastBranch->parent());
    1.18  			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
    1.19 @@ -382,36 +382,42 @@
    1.20  	return true;	
    1.21  }
    1.22  
    1.23 -bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)
    1.24 +bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)	// FIXME-4 does not work if there is no lmo for treeitem
    1.25  {
    1.26 -	bool ok;
    1.27 -	int x;
    1.28 -	/* FIXME-2 if (lastOO)
    1.29 +	if (lastMI)
    1.30  	{
    1.31 -		if (!a.value( "frameType").isEmpty() ) 
    1.32 -			lastOO->setFrameType (a.value("frameType"));
    1.33 -		if (!a.value( "penColor").isEmpty() ) 
    1.34 -			lastOO->setFramePenColor (a.value("penColor"));
    1.35 -		if (!a.value( "brushColor").isEmpty() ) 
    1.36 -			lastOO->setFrameBrushColor (a.value("brushColor"));
    1.37 -		if (!a.value( "padding").isEmpty() ) 
    1.38 +		OrnamentedObj* oo=(OrnamentedObj*)(lastMI->getLMO()); 
    1.39 +		if (oo)
    1.40  		{
    1.41 -			x=a.value("padding").toInt(&ok);
    1.42 -			if (ok) lastOO->setFramePadding(x);
    1.43 -		}	
    1.44 -		if (!a.value( "borderWidth").isEmpty() ) 
    1.45 -		{
    1.46 -			x=a.value("borderWidth").toInt(&ok);
    1.47 -			if (ok) lastOO->setFrameBorderWidth(x);
    1.48 -		}	
    1.49 -	}		
    1.50 -	*/
    1.51 -	return true;
    1.52 +			bool ok;
    1.53 +			int x;
    1.54 +			{
    1.55 +				if (!a.value( "frameType").isEmpty() ) 
    1.56 +					oo->setFrameType (a.value("frameType"));
    1.57 +				if (!a.value( "penColor").isEmpty() ) 
    1.58 +					oo->setFramePenColor (a.value("penColor"));
    1.59 +				if (!a.value( "brushColor").isEmpty() ) 
    1.60 +					oo->setFrameBrushColor (a.value("brushColor"));
    1.61 +				if (!a.value( "padding").isEmpty() ) 
    1.62 +				{
    1.63 +					x=a.value("padding").toInt(&ok);
    1.64 +					if (ok) oo->setFramePadding(x);
    1.65 +				}	
    1.66 +				if (!a.value( "borderWidth").isEmpty() ) 
    1.67 +				{
    1.68 +					x=a.value("borderWidth").toInt(&ok);
    1.69 +					if (ok) oo->setFrameBorderWidth(x);
    1.70 +				}	
    1.71 +			}		
    1.72 +			return true;
    1.73 +		}
    1.74 +	}
    1.75 +	return false;
    1.76  }
    1.77  
    1.78  bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
    1.79  {
    1.80 -	if (lastMI)
    1.81 +	if (lastMI)	//FIXME-1  below lastBranch is used, not lastMI. So it might not work for images
    1.82  	{
    1.83  		bool okx,oky;
    1.84  		float x,y;
    1.85 @@ -516,7 +522,6 @@
    1.86  		{
    1.87  			QMessageBox::warning( 0, "Warning: " ,
    1.88  				"Couldn't load image\n"+parseHREF(a.value ("href") ));
    1.89 -			//FIXME-0 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
    1.90  			lastImage=NULL;
    1.91  			return true;
    1.92  		}
    1.93 @@ -534,19 +539,14 @@
    1.94  			x=a.value("relPosX").toFloat (&okx);
    1.95  			y=a.value("relPosY").toFloat (&oky);
    1.96  			if (okx && oky) 
    1.97 -				
    1.98 -				{
    1.99 -					lastImage->setRelPos (QPointF (x,y) );
   1.100 -					// make sure floats in mapcenter are repositioned to relative pos
   1.101 -					//FIXME-0 if (lastBranch->depth()==0) lastBranch->positionContents();
   1.102 -				}
   1.103 +				lastImage->setRelPos (QPointF (x,y) );
   1.104  			else
   1.105  				// Couldn't read relPos
   1.106  				return false;  
   1.107  		}           
   1.108  	}	
   1.109  	
   1.110 -	if (!readOOAttr(a)) return false;
   1.111 +	//FIXME-3 if (!readOOAttr(a)) return false;
   1.112  
   1.113  	if (!a.value ("originalName").isEmpty() )
   1.114  	{