mapeditor.cpp
changeset 328 33310803546c
parent 309 1f41709aa387
child 329 8f04006214dc
     1.1 --- a/mapeditor.cpp	Mon Apr 24 11:31:16 2006 +0000
     1.2 +++ b/mapeditor.cpp	Mon May 15 07:32:10 2006 +0000
     1.3 @@ -36,6 +36,7 @@
     1.4  #include "misc.h"
     1.5  #include "settings.h"
     1.6  #include "texteditor.h"
     1.7 +#include "warningdialog.h"
     1.8  #include "xml.h"
     1.9  
    1.10  
    1.11 @@ -334,13 +335,19 @@
    1.12  
    1.13  QString MapEditor::getName (LinkableMapObj *lmo)
    1.14  {
    1.15 -	if (!lmo) return QString("NULL has no name!");
    1.16 +	QString s;
    1.17 +	if (!lmo) return QString("Error: NULL has no name!");
    1.18  
    1.19  	if ((typeid(*lmo) == typeid(BranchObj) ||
    1.20  				      typeid(*lmo) == typeid(MapCenterObj))) 
    1.21 -		return QString("branch (%1)").arg(((BranchObj*)lmo)->getHeading());
    1.22 +	{
    1.23 +		
    1.24 +		s=(((BranchObj*)lmo)->getHeading());
    1.25 +		if (s=="") s="unnamed";
    1.26 +		return QString("branch (<font color=\"#0000ff\">%1</font>)").arg(s);
    1.27 +	}	
    1.28  	if ((typeid(*lmo) == typeid(FloatImageObj) ))
    1.29 -		return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
    1.30 +		return QString ("floatimage [<font color=\"#0000ff\">%1</font>]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
    1.31  	return QString("Unknown type has no name!");
    1.32  }
    1.33  
    1.34 @@ -1426,6 +1433,7 @@
    1.35  	if (typeid(*selection) == typeid(BranchObj)  ) 
    1.36  	{
    1.37  		bo=(BranchObj*)selection;
    1.38 +		if (!bo->canMoveBranchUp()) return;
    1.39  		par=(BranchObj*)(bo->getParObj());
    1.40  		selection->unselect();
    1.41  		selection=par->moveBranchUp (bo);
    1.42 @@ -1446,6 +1454,7 @@
    1.43  	if (typeid(*selection) == typeid(BranchObj)  ) 
    1.44  	{
    1.45  		bo=(BranchObj*)selection;
    1.46 +		if (!bo->canMoveBranchDown()) return;
    1.47  		par=(BranchObj*)(bo->getParObj());
    1.48  		selection->unselect(); 
    1.49  		selection=par->moveBranchDown(bo);
    1.50 @@ -2183,7 +2192,7 @@
    1.51  		else
    1.52  			s="Set";
    1.53  		saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand	
    1.54 -		bo->toggleStandardFlag (f,actionSettingsUseFlagGroups);
    1.55 +		bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
    1.56  		adjustCanvasSize();
    1.57  	}	
    1.58  }
    1.59 @@ -2575,6 +2584,17 @@
    1.60  				actionEditOpenVymLink->setEnabled (true);
    1.61  				actionEditDeleteVymLink->setEnabled (true);
    1.62  			}	
    1.63 +
    1.64 +			if (bo->canMoveBranchUp()) 
    1.65 +				actionEditMoveUp->setEnabled (true);
    1.66 +			else	
    1.67 +				actionEditMoveUp->setEnabled (false);
    1.68 +			if (bo->canMoveBranchDown()) 
    1.69 +				actionEditMoveDown->setEnabled (true);
    1.70 +			else	
    1.71 +				actionEditMoveDown->setEnabled (false);
    1.72 +
    1.73 +
    1.74  			actionEditToggleHideExport->setEnabled (true);	
    1.75  			actionEditToggleHideExport->setOn (bo->hideInExport() );	
    1.76  
    1.77 @@ -2625,6 +2645,8 @@
    1.78  			actionEditDelete->setEnabled (true);
    1.79  			actionFormatHideLinkUnselected->setOn
    1.80  				( selection->getHideLinkUnselected());
    1.81 +			actionEditMoveUp->setEnabled (false);
    1.82 +			actionEditMoveDown->setEnabled (false);
    1.83  		}
    1.84  
    1.85  	} else
    1.86 @@ -2637,12 +2659,15 @@
    1.87  		for (a=actionListBranches.first();a;a=actionListBranches.next())
    1.88  			a->setEnabled(false);
    1.89  
    1.90 -		actionEditToggleScroll->setEnabled (true);
    1.91 +		actionEditToggleScroll->setEnabled (false);
    1.92  		actionEditOpenURL->setEnabled (false);
    1.93  		actionEditOpenVymLink->setEnabled (false);
    1.94  		actionEditDeleteVymLink->setEnabled (false);	
    1.95  		actionEditHeading2URL->setEnabled (false);	
    1.96  		actionEditDelete->setEnabled (false);
    1.97 +		actionEditMoveUp->setEnabled (false);
    1.98 +		actionEditMoveDown->setEnabled (false);
    1.99 +		actionEditToggleHideExport->setEnabled (false);	
   1.100  	}	
   1.101  }
   1.102  
   1.103 @@ -3047,6 +3072,16 @@
   1.104  void MapEditor::testFunction()
   1.105  {
   1.106  	cout << "MapEditor::testFunction() called\n";
   1.107 +
   1.108 +	WarningDialog dia;
   1.109 +	dia.setCancelButton (true);
   1.110 +	dia.setText("This is a longer \nWarning");
   1.111 +	dia.setCaption("Warning: Flux problem");
   1.112 +	dia.setShowAgainName("/vym/warnings/mapeditor");
   1.113 +	if (dia.exec()==QDialog::Accepted)
   1.114 +		cout << "accepted!\n";
   1.115 +	else	
   1.116 +		cout << "canceled!\n";
   1.117  	return;
   1.118  
   1.119  	QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";