Exemplo n.º 1
0
void ShellMenuAudioPressAccept()
{
	SOUND_CHANNELS = VarItem::GetInteger("shell.menu.audio.channels");
	SOUND_VOLUME_EFFECT = VarItem::GetInteger("shell.menu.audio.volume.effect") / 10.0f;
	SOUND_VOLUME_MUSIC = VarItem::GetInteger("shell.menu.audio.volume.music") / 10.0f;

	WritePreferences("preferences.xml");

	UpdateSoundVolume();

	shellmenu.Pop();
}
Exemplo n.º 2
0
void ShellMenuVideoPressAccept()
{
	SCREEN_WIDTH = shellmenuvideoresolutionlist[shellmenuvideoresolutionindex].w;
	SCREEN_HEIGHT = shellmenuvideoresolutionlist[shellmenuvideoresolutionindex].h;
	SCREEN_FULLSCREEN = VarItem::GetInteger("shell.menu.video.fullscreen") != 0;
	OPENGL_SWAPCONTROL = VarItem::GetInteger("shell.menu.video.verticalsync") != 0;
	OPENGL_MULTISAMPLE = VarItem::GetInteger("shell.menu.video.multisample");
	MOTIONBLUR_STEPS = VarItem::GetInteger("shell.menu.video.motionblur");
	MOTIONBLUR_TIME = VarItem::GetInteger("shell.menu.video.motionblurtime") / 600.0f;

	WritePreferences("preferences.xml");
	UpdateWindowAction();

	shellmenu.Pop();
}
Exemplo n.º 3
0
void MainWindow::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
    WritePreferences();
    this->Destroy();
}
Exemplo n.º 4
0
int main( int   argc, char *argv[] )
{

	#ifdef	__HYPHYMPI__
		  int 		   rank, 
		  			   size;
		  			   			   			 
		  MPI_Init	   (&argc, &argv);
		  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
		  MPI_Comm_size(MPI_COMM_WORLD, &size);
		  
		  _hy_mpi_node_rank = rank;
		  
		  setParameter  (mpiNodeID, (_Parameter)rank);
		  setParameter	(mpiNodeCount, (_Parameter)size);
		  
		  if (rank == 0)
	#endif
   
	gtk_init (&argc, &argv);

	/* set up globals */
	
	char curWd[4096];
	getcwd (curWd,4096);

	_String baseDir (curWd);
	baseDir=baseDir&'/';

	pathNames&& &baseDir;
	baseDirectory = baseDir;
	for (long i=1; i<argc;i++)
	{
		_String thisArg (argv[i]);
		if (thisArg.beginswith ("BASEPATH="))
		{
			baseDirectory = thisArg.Cut(9,-1);
			if (baseDirectory.sLength)
			{
				if (baseDirectory.sData[baseDirectory.sLength-1]!='/')
					baseDirectory = baseDirectory&"/";
			}
		}
		else
			if (thisArg.beginswith ("USEPATH="))
			{
				_String		baseArgDir 			(thisArg,8,-1);
				errorFileName					= baseArgDir & errorFileName;
				messageFileName					= baseArgDir & messageFileName;
				pathNames.Delete				(0);
				pathNames&&						&baseDir;
			}
			else
				if (thisArg.beginswith ("CPU="))
				{
					#ifdef __MP__
					_String cpus = thisArg.Cut(4,-1);
					systemCPUCount = cpus.toNum();
					if (systemCPUCount<1)
						systemCPUCount = 1;
					#ifdef __MP2__
						pthread_setconcurrency (systemCPUCount+1);
					#endif
					#endif
				}
				#ifdef	__HYPHYMPI__
					else
						if (thisArg == _String("MPIOPTIMIZER"))
						{
							mpiParallelOptimizer = true;
							setParameter	(mpiNodeCount, 0.0);
						}
						else
							if (thisArg == _String("MPIPARTITIONS"))
							{
								mpiPartitionOptimizer = true;
								setParameter	(mpiNodeCount, 0.0);
							}
				#endif
	}
	
	#ifdef	__HYPHYMPI__
	if (rank == 0)
	#endif
	{
		baseDir = baseDirectory & "GTKResources";
		_List scanRes;
		ScanDirectoryForFileNames(baseDir,scanRes,false);
		if (scanRes.lLength == 0)
		{
			GtkWidget * noRez = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "HYPHY_GTK was unable to find a required GTKResources directory in %s. Please use BASEPATH= command line option to specify where the installation directory of HyPhy can be found.", baseDirectory.sData);
			gtk_dialog_run (GTK_DIALOG (noRez));
			gtk_widget_destroy (noRez);
			return 1;
		}
		_String rcPath = baseDir & "/theme/theme.rc";
		//printf ("Loading res files from %s\n", rcPath.sData);
		gtk_rc_parse (rcPath.sData);
	}
	
 	GlobalStartup();

	#ifdef	__HYPHYMPI__
	if (rank == 0)
	{
	#endif
	GdkDisplay * defDisplay = gdk_screen_get_display (gdk_screen_get_default());
	hSizeCursor = gdk_cursor_new_for_display (defDisplay,GDK_SB_H_DOUBLE_ARROW);
	pickUpCursor = gdk_cursor_new_for_display (defDisplay,GDK_TARGET);
	dropOffCursor = gdk_cursor_new_for_display (defDisplay,GDK_TCROSS);
	
	screenPContext = gdk_pango_context_get_for_screen (gdk_screen_get_default());
	tablePDMenuIcon = (GdkPixbuf*)ProcureIconResource(4020);
		
	/*{
		GdkScreen * defD = gdk_screen_get_default();
		fontConversionFactor = 72.27 / (gdk_screen_get_height (defD) *25.4 / gdk_screen_get_height_mm(defD)); 
		printf ("Pango conversion factor computed at: %g\n", fontConversionFactor);
	}*/

		
	ReadInTemplateFiles ();
		
	hyphyConsoleWindow = new _HYConsoleWindow ("HYPHY Console");
	ReadPreferences		();
	SetStatusLine ("None","Idle","00:00:00");
	while (gtk_events_pending())
		gtk_main_iteration();

	SetPreferences		();
	ReadGeneticCodes	();	
	ReadModelTemplates	();
	ReadTreeProcessors ();
	MoveConsoleWindow  (consolePositionRectangle);
	StringToConsole (hyphyCiteString);
	hyphyConsoleWindow->BringToFront();

	#ifdef __HYPHYMPI__ 
	{
		char statBuffer[1024];
		sprintf (statBuffer,"MPI version of HyPhy running on %d nodes (a master and %d compute nodes) in %s mode\n",
							 size, 
							 size-1,
							 mpiPartitionOptimizer?"partition":(mpiParallelOptimizer?"rate heterogeneity":"normal"));
		BufferToConsole (statBuffer);
	}
	#endif
		
	g_timeout_add  (100,GlobalQueueTimer,nil);
	g_timeout_add  (1000,progressTimerFunction,nil);
	gtk_main ();

	WritePreferences();
	#ifdef	__HYPHYMPI__
	}
	else // slave node
	{
		if (mpiParallelOptimizer || mpiPartitionOptimizer)
			mpiOptimizerLoop (rank, size);
		else
			mpiNormalLoop (rank, size, baseDir);
	}
	#endif

	GlobalShutdown();
    return 0;
}