mainwindow.cpp
changeset 261 790e3eff9980
parent 253 174dd40bf06a
child 266 7d91b35c1b6f
     1.1 --- a/mainwindow.cpp	Wed Mar 15 15:54:32 2006 +0000
     1.2 +++ b/mainwindow.cpp	Mon Mar 27 20:21:57 2006 +0000
     1.3 @@ -160,6 +160,7 @@
     1.4  extern QAction* actionSettingsPasteNewHeading;
     1.5  extern QAction* actionSettingsUseDelKey;
     1.6  extern QAction* actionSettingsUseFlagGroups;
     1.7 +extern QAction* actionSettingsUseHideExport;
     1.8  
     1.9  extern QPopupMenu* branchContextMenu;
    1.10  extern QPopupMenu* branchAddContextMenu;
    1.11 @@ -298,6 +299,7 @@
    1.12  	settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
    1.13  	settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
    1.14  	settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
    1.15 +	settings.writeEntry( "/vym/export/useHideExport",actionSettingsUseHideExport->isOn() );
    1.16  
    1.17  	QString s;
    1.18  	int maps=lastMaps.count();
    1.19 @@ -1057,6 +1059,12 @@
    1.20  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
    1.21      a->addTo( menu );
    1.22  	actionSettingsUseFlagGroups=a;
    1.23 +	
    1.24 +    a= new QAction( tr( "Use hide flag during exports " ), QPixmap(), tr( "Use hide flags" ), 0, this, "hideexport" );
    1.25 +	a->setToggleAction(true);
    1.26 +	a->setOn ( settings.readBoolEntry ("/vym/export/useHideExport",true) );
    1.27 +    a->addTo( menu );
    1.28 +	actionSettingsUseHideExport=a;
    1.29  }
    1.30  
    1.31  // Test Actions
    1.32 @@ -1863,7 +1871,8 @@
    1.33  
    1.34  void Main::fileExportHTML()
    1.35  {
    1.36 -	if (currentMapEditor())
    1.37 +	MapEditor *me=currentMapEditor();
    1.38 +	if (me)
    1.39  	{
    1.40  		ExportHTMLDialog dia(this);
    1.41  		
    1.42 @@ -1872,8 +1881,10 @@
    1.43  			QString dir=dia.getDir();
    1.44  			if (reallyWriteDirectory(dir) )
    1.45  			{
    1.46 -				currentMapEditor()->exportXML (dia.getDir() );
    1.47 -				dia.doExport(currentMapEditor()->getMapName() );
    1.48 +				me->setExportMode (true);
    1.49 +				me->exportXML (dia.getDir() );
    1.50 +				dia.doExport(me->getMapName() );
    1.51 +				me->setExportMode (false);
    1.52  			}	
    1.53  		}
    1.54  	}	
    1.55 @@ -1881,12 +1892,13 @@
    1.56  
    1.57  void Main::fileExportXHTML()
    1.58  {
    1.59 +	MapEditor *me=currentMapEditor();
    1.60  	QString dir;
    1.61 -	if (currentMapEditor())
    1.62 +	if (me)
    1.63  	{
    1.64  		ExportXHTMLDialog dia(this);
    1.65 -		dia.setFilePath (currentMapEditor()->getFilePath() );
    1.66 -		dia.setMapName (currentMapEditor()->getMapName() );
    1.67 +		dia.setFilePath (me->getFilePath() );
    1.68 +		dia.setMapName (me->getMapName() );
    1.69  		dia.readSettings();
    1.70  		
    1.71  		if (dia.exec()==QDialog::Accepted)
    1.72 @@ -1902,10 +1914,10 @@
    1.73  
    1.74  			if (ok)
    1.75  			{
    1.76 -				currentMapEditor()->exportXML (dia.getDir() );
    1.77 -				dia.doExport(currentMapEditor()->getMapName() );
    1.78 +				me->exportXML (dia.getDir() );
    1.79 +				dia.doExport(me->getMapName() );
    1.80  				if (dia.hasChanged())
    1.81 -					currentMapEditor()->setChanged();
    1.82 +					me->setChanged();
    1.83  			}	
    1.84  		}
    1.85  	}	
    1.86 @@ -1913,12 +1925,13 @@
    1.87  
    1.88  void Main::fileExportImage(int item)
    1.89  {
    1.90 -	if (currentMapEditor())
    1.91 +	MapEditor *me=currentMapEditor();
    1.92 +	if (me)
    1.93  	{
    1.94  		QString fn = QFileDialog::getSaveFileName( QString::null, "Image  (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
    1.95  							   this );
    1.96  		if ( !fn.isEmpty() ) 
    1.97 -			currentMapEditor()->exportImage(fn,item);
    1.98 +			me->exportImage(fn,item);
    1.99  		else 
   1.100  			statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
   1.101  		
   1.102 @@ -1927,34 +1940,47 @@
   1.103  
   1.104  void Main::fileExportASCII()
   1.105  {
   1.106 -	if (currentMapEditor())
   1.107 +	MapEditor *me=currentMapEditor();
   1.108 +	if (me)
   1.109  	{
   1.110  		ExportASCII ex;
   1.111 -		ex.setMapCenter(currentMapEditor()->getMapCenter());
   1.112 +		ex.setMapCenter(me->getMapCenter());
   1.113  		ex.addFilter ("TXT (*.txt)");
   1.114  		ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
   1.115 -		if (ex.execDialog() ) ex.doExport();
   1.116 +		if (ex.execDialog() ) 
   1.117 +		{
   1.118 +			me->setExportMode(true);
   1.119 +			ex.doExport();
   1.120 +			me->setExportMode(false);
   1.121 +		}
   1.122  	}
   1.123  }
   1.124  
   1.125  void Main::fileExportLaTeX()
   1.126  {
   1.127 -	if (currentMapEditor())
   1.128 +	MapEditor *me=currentMapEditor();
   1.129 +	if (me)
   1.130  	{
   1.131  		ExportLaTeX ex;
   1.132 -		ex.setMapCenter(currentMapEditor()->getMapCenter());
   1.133 +		ex.setMapCenter(me->getMapCenter());
   1.134  		ex.addFilter ("Tex (*.tex)");
   1.135  		ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
   1.136 -		if (ex.execDialog() ) ex.doExport();
   1.137 +		if (ex.execDialog() ) 
   1.138 +		{
   1.139 +			me->setExportMode(true);
   1.140 +			ex.doExport();
   1.141 +			me->setExportMode(false);
   1.142 +		}
   1.143  	}
   1.144  }
   1.145  
   1.146  void Main::fileExportKDEBookmarks()
   1.147  {
   1.148  	ExportKDEBookmarks ex;
   1.149 -	if (currentMapEditor())
   1.150 +	MapEditor *me=currentMapEditor();
   1.151 +	if (me)
   1.152  	{
   1.153 -		ex.setMapCenter (currentMapEditor()->getMapCenter() );
   1.154 +		ex.setMapCenter (me->getMapCenter() );
   1.155  		ex.doExport();
   1.156  	}	
   1.157  }
   1.158 @@ -1962,12 +1988,18 @@
   1.159  void Main::fileExportTaskjuggler()
   1.160  {
   1.161  	ExportTaskjuggler ex;
   1.162 -	if (currentMapEditor())
   1.163 +	MapEditor *me=currentMapEditor();
   1.164 +	if (me)
   1.165  	{
   1.166 -		ex.setMapCenter (currentMapEditor()->getMapCenter() );
   1.167 +		ex.setMapCenter (me->getMapCenter() );
   1.168  		ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
   1.169  		ex.addFilter ("Taskjuggler (*.tjp)");
   1.170 -		if (ex.execDialog()) ex.doExport();
   1.171 +		if (ex.execDialog() ) 
   1.172 +		{
   1.173 +			me->setExportMode(true);
   1.174 +			ex.doExport();
   1.175 +			me->setExportMode(false);
   1.176 +		}
   1.177  	}	
   1.178  }
   1.179