mapeditor.cpp
changeset 735 84ae10f6e3a3
parent 732 b77b56f707f1
child 736 21f115d48daf
     1.1 --- a/mapeditor.cpp	Thu Jan 15 00:52:35 2009 +0000
     1.2 +++ b/mapeditor.cpp	Tue Jan 20 15:23:16 2009 +0000
     1.3 @@ -271,7 +271,7 @@
     1.4  			QString("%1 (\"%2\")").arg(r).arg(f),
     1.5  			QString("Toggling standard flag \"%1\" of %2").arg(f).arg(model->getObjectName(bo)));
     1.6  		bo->toggleStandardFlag (f,mainWindow->useFlagGroups());
     1.7 -		model->updateSelection();
     1.8 +		model->updateSelection();	// geometry has changed
     1.9  	}
    1.10  }
    1.11  
    1.12 @@ -391,7 +391,7 @@
    1.13  	
    1.14      if (lmo) 
    1.15  	{	// MapObj was found
    1.16 -		if (model->getSelection() != lmo)
    1.17 +		if (model->getSelectedLMO() != lmo)
    1.18  		{
    1.19  			// select the MapObj
    1.20  			model->select(lmo);
    1.21 @@ -550,19 +550,6 @@
    1.22  		//QModelIndex ix=model->index( ti->row(), ti->column(), model->index (0,0,QModelIndex()) );
    1.23  		QModelIndex ix=model->index(ti);
    1.24  		model->getSelectionModel()->select (ix,QItemSelectionModel::ClearAndSelect  );
    1.25 -		/*
    1.26 -		if (model->getSelectionModel()->hasSelection() ) 
    1.27 -		{
    1.28 -			QModelIndex ixsel=model->getSelectionModel()->selectedIndexes().first();
    1.29 -			TreeItem *tisel= static_cast<TreeItem*>(ixsel.internalPointer());
    1.30 -	;
    1.31 -			cout << "  ti="<<ti<<"  tisel="<<tisel<<endl;
    1.32 -			if (ti!=tisel) int i=1/0;
    1.33 -		}
    1.34 -		else
    1.35 -			cout <<"MapEditor::mousePressed  No selection!!!\n";
    1.36 -		*/
    1.37 -
    1.38  
    1.39  		// Left Button	    Move Branches
    1.40  		if (e->button() == Qt::LeftButton )
    1.41 @@ -585,14 +572,14 @@
    1.42  				if (bo)
    1.43  				{
    1.44  					copyingObj=true;
    1.45 -					bo->addBranch ((BranchObj*)model->getSelection());
    1.46 +					bo->addBranch (model->getSelectedBranch());
    1.47  					model->unselect();
    1.48  					model->select(bo->getLastBranch());
    1.49  					model->reposition();
    1.50  				}
    1.51  			} 
    1.52  
    1.53 -			movingObj=model->getSelection();	
    1.54 +			movingObj=model->getSelectedLMO();	
    1.55  		} else
    1.56  			// Middle Button    Toggle Scroll
    1.57  			// (On Mac OS X this won't work, but we still have 
    1.58 @@ -620,7 +607,7 @@
    1.59  void MapEditor::mouseMoveEvent(QMouseEvent* e)
    1.60  {
    1.61      QPointF p = mapToScene(e->pos());
    1.62 -	LinkableMapObj *lmosel=model->getSelection();
    1.63 +	LinkableMapObj *lmosel=model->getSelectedLMO();
    1.64  
    1.65      // Move the selected MapObj
    1.66      if ( lmosel && movingObj) 
    1.67 @@ -649,7 +636,7 @@
    1.68  			fio->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
    1.69  			fio->setRelPos();
    1.70  			fio->updateLink(); //no need for reposition, if we update link here
    1.71 -			model->updateSelection();
    1.72 +			model->updateSelection();	// position has changed
    1.73  
    1.74  			// Relink float to new mapcenter or branch, if shift is pressed	
    1.75  			// Only relink, if selection really has a new parent
    1.76 @@ -736,7 +723,7 @@
    1.77  			} // depth>0
    1.78  
    1.79  			QItemSelection sel=model->getSelectionModel()->selection();
    1.80 -			updateSelection(sel,sel);
    1.81 +			updateSelection(sel,sel);	// position has changed
    1.82  
    1.83  		} // no FloatImageObj
    1.84  
    1.85 @@ -767,7 +754,7 @@
    1.86  {
    1.87      QPointF p = mapToScene(e->pos());
    1.88  	LinkableMapObj *dst;
    1.89 -	LinkableMapObj *lmosel=model->getSelection();
    1.90 +	LinkableMapObj *lmosel=model->getSelectedLMO();
    1.91  	// Have we been picking color?
    1.92  	if (pickingColor)
    1.93  	{
    1.94 @@ -1094,6 +1081,7 @@
    1.95  		index=newsel.indexes().at(i);
    1.96  		ti= static_cast<TreeItem*>(index.internalPointer());
    1.97  		lmo=ti->getLMO();
    1.98 +	cout << "  ME::updateSelection of "<<((BranchObj*)lmo)->getHeading().toStdString()<<"\n";
    1.99  		bbox=lmo->getBBox();
   1.100  		sb->setRect (
   1.101  			bbox.x(),bbox.y(), 
   1.102 @@ -1104,7 +1092,7 @@
   1.103  	}
   1.104  }
   1.105  
   1.106 -void MapEditor::updateCurrent (const QModelIndex &newsel,const QModelIndex &)
   1.107 +void MapEditor::updateCurrent (const QModelIndex &,const QModelIndex &)	//FIXME not used?
   1.108  {
   1.109  
   1.110  /* FIXME testing