setObjectName("selectAngle");
		pangle->setMinimumWidth(80);
		pangle->setRange(0, 180);

		mainToolBar->addAction(actionSelectRect  );
		mainToolBar->addAction(actionSelectCircle);
		mainToolBar->addAction(actionSelectFree  );

		mainToolBar->addSeparator();
		mainToolBar->addAction(actionZoomSelected);
		mainToolBar->addAction(actionZoomExtents);

		// create the data field selector
		mainToolBar->addSeparator();
		selectData = new CDataFieldSelector;
		selectData->setWhatsThis("<font color=\"black\">Use this to select the current data variable that will be used to display the color map on the mesh.");
		selectData->setMinimumWidth(300);
//		selectData->setFixedHeight(23);
		selectData->setObjectName("selectData");

		mainToolBar->addWidget(selectData);
		mainToolBar->addAction(actionColorMap);

		mainToolBar->addAction(whatsThis);

		// --- Post Tool bar
		QToolBar* postToolbar = new QToolBar(MainWindow);
		postToolbar->setObjectName("postToolbar");
		postToolbar->setWindowTitle("Plot Toolbar");
		postToolbar->addAction(actionPlaneCut        );
		postToolbar->addAction(actionMirrorPlane     );
		postToolbar->addAction(actionVectorPlot      );
		postToolbar->addAction(actionTensorPlot      );
		postToolbar->addAction(actionIsosurfacePlot  );
		postToolbar->addAction(actionSlicePlot       );
		postToolbar->addAction(actionStreamLinePlot  );
		postToolbar->addAction(actionParticleFlowPlot);
		postToolbar->addAction(actionImageSlicer     );
		postToolbar->addAction(actionVolumeRender    );
		postToolbar->addAction(actionMarchingCubes   );
		postToolbar->addSeparator();
		postToolbar->addAction(actionGraph);
		postToolbar->addAction(actionIntegrate);
		MainWindow->addToolBar(Qt::TopToolBarArea, postToolbar);

		// Play tool bar
		playToolBar = new QToolBar(MainWindow);
        playToolBar->setObjectName(QStringLiteral("playToolBar"));
		playToolBar->setWindowTitle("Animate Toolbar");
        MainWindow->addToolBar(Qt::TopToolBarArea, playToolBar);

		QAction* actionFirst = addAction("first", "actionFirst", ":/icons/back.png");
		QAction* actionPrev  = addAction("previous", "actionPrev", ":/icons/prev.png");
		actionPlay = addAction("Play", "actionPlay", ":/icons/play.png"); actionPlay->setShortcut(Qt::Key_Space);
		actionPlay->setCheckable(true);
		QAction* actionNext = addAction("next", "actionNext", ":/icons/next.png");
		QAction* actionLast = addAction("last", "actionLast", ":/icons/forward.png");
		QAction* actionTime = addAction("Time settings", "actionTimeSettings", ":/icons/clock.png");

		playToolBar->addAction(actionFirst);
		playToolBar->addAction(actionPrev);
		playToolBar->addAction(actionPlay);
		playToolBar->addAction(actionNext);
		playToolBar->addAction(actionLast);

		actionFirst->setWhatsThis("<font color=\"black\">Click this to go to the first time step in the model.");
		actionPrev->setWhatsThis("<font color=\"black\">Click this to go to the previous time step in the model.");
		actionPlay->setWhatsThis("<font color=\"black\">Click this to toggle the animation on or off");
		actionNext->setWhatsThis("<font color=\"black\">Click this to go to the next time step");
		actionLast->setWhatsThis("<font color=\"black\">Click this to go to the last time step in the model.");
		actionTime->setWhatsThis("<font color=\"black\">Click this to open the Time Info dialog box.");

		playToolBar->addWidget(pspin = new QSpinBox); 
		pspin->setObjectName("selectTime");
		pspin->setMinimumWidth(80);
		pspin->setSuffix("/100");
		playToolBar->addAction(actionTime);
	
		playToolBar->setDisabled(true);

		// Font tool bar
		pFontToolBar = new QToolBar(MainWindow);
		pFontToolBar->setObjectName("FontToolBar");
		pFontToolBar->setWindowTitle("Font Toolbar");
		MainWindow->addToolBarBreak();
		MainWindow->addToolBar(Qt::TopToolBarArea, pFontToolBar);

		pFontToolBar->addWidget(pFontStyle = new QFontComboBox); pFontStyle->setObjectName("fontStyle");
		pFontToolBar->addWidget(pFontSize = new QSpinBox); pFontSize->setObjectName("fontSize");
		pFontToolBar->addAction(actionFontBold   = addAction("Bold" , "fontBold" , ":/icons/font_bold.png"  )); actionFontBold->setCheckable(true);
		pFontToolBar->addAction(actionFontItalic = addAction("Italic", "fontItalic", ":/icons/font_italic.png")); actionFontItalic->setCheckable(true);
		pFontToolBar->addAction(actionProperties);
		pFontToolBar->setEnabled(false);
	}

	void checkColormap(bool b)
	{
		actionColorMap->setChecked(b);
	}

	void updateFileList(QMenu* menu, QActionGroup* action, QStringList& recentFiles)
	{
		int N = recentFiles.count();
		if (N > MAX_RECENT_FILES) N = MAX_RECENT_FILES;
		for (int i = 0; i < N; ++i)
		{
			QString file = recentFiles.at(i);
			QAction* pa = menu->addAction(file);
			action->addAction(pa);
		}
	}

	void setRecentFiles(QStringList& recentFiles)
	{
		m_recentFiles = recentFiles;

		int N = m_recentFiles.count();
		if (N > MAX_RECENT_FILES) N = MAX_RECENT_FILES;

		updateFileList(menuRecentFiles, recentFilesActionGroup, recentFiles);
	}

	void setRecentSessions(QStringList& recentSessions)
	{
		m_recentSessions = recentSessions;

		int N = m_recentSessions.count();
		if (N > MAX_RECENT_FILES) N = MAX_RECENT_FILES;

		updateFileList(menuRecentSessions, recentSessionActionGroup, recentSessions);
	}

	void addToFileList(QStringList& dstList, const QString& file, QMenu* menu, QActionGroup* actionGroup)
	{
		QString fileName = file;

#ifdef WIN32
		// on windows, make sure that allfile names use backslashes
		fileName.replace('/', '\\');
#endif

		QList<QAction*> actionList = menu->actions();
		if (actionList.isEmpty())
		{
			dstList.append(fileName);
			QAction* action = menu->addAction(fileName);
			actionGroup->addAction(action);
		}
		else
		{
			// we need the first action so that we can insert before it
			QAction* firstAction = actionList.at(0);

			// see if the file already exists or not
			int n = dstList.indexOf(fileName);
			if (n >= 0)
			{
				// if the file exists, we move it to the top
				if (n!= 0)
				{
					QAction* action = actionList.at(n);
					menu->removeAction(action);
					menu->insertAction(firstAction, action);

					dstList.removeAt(n);
					dstList.push_front(fileName);
				}
			}
			else
			{
				int N = dstList.count();
				if (N >= MAX_RECENT_FILES)
				{
					// remove the last one
					dstList.removeLast();
					menu->removeAction(actionList.last());
				}

				// add a new file item
				dstList.push_front(fileName