Example #1
0
int main (int argc, char *argv[])
{
  GtkWidget *window;

  /* Init GTK stuffs */
  gtk_set_locale();
  gtk_init(&argc, &argv);

  /* Get command arguments */
  if ( argc > 1 )
    usage();

  /* Add pixmap search path */
  {
    char *home = get_home();
    char path[strlen(home)+10];
    snprintf(path, sizeof(path), "%s/icons", home);
    add_pixmap_directory(path);
  }
  add_pixmap_directory (".");

  /* Start Report Config gui */
  window = report_config_gui(NULL);
  gtk_signal_connect_object(GTK_OBJECT(window), "destroy",
                            GTK_SIGNAL_FUNC(gtk_main_quit), (gpointer) NULL);

  /* Setup control command handling */
  command_id = gdk_input_add(fileno(stdin), GDK_INPUT_READ,
			     (GdkInputFunction) command_handler, window);

  gtk_main();

  return 0;
}
Example #2
0
int
main(int argc, char *argv[]) {
  GtkWidget *main;

#ifdef ENABLE_NLS
  bindtextdomain(GETTEXT_PACKAGE, SETUP_LOCALE_DIR);
  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
  textdomain(GETTEXT_PACKAGE);
#endif /* ENABLE_NLS */

  gtk_set_locale();
  gtk_init(&argc, &argv);
  thunar_vfs_init();
  g_type_init();
  if (!g_thread_supported ()) {
    g_thread_init (NULL);
  }

  add_pixmap_directory(SETUP_DATA_DIR "/" PACKAGE_NAME "/pixmaps");
  add_pixmap_directory(SETUP_DATA_DIR "/" PACKAGE_NAME);

  xdiff_ext_preferences* p = xdiff_ext_preferences_instance();
  xdiff_ext_preferences_load(p);
  
  main = create_main ();
  gtk_widget_show (main);

  gtk_main ();
  
  g_object_unref(p);

  return 0;
}
Example #3
0
int
main (int argc, char *argv[])
{
  GtkWidget *mainwin;
  
#ifdef ENABLE_NLS
  bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
  textdomain (PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
  add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");
  add_pixmap_directory ("/usr/share/pixmaps");
  add_pixmap_directory ("/usr/share/dynebolic/pixmaps");

  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */

  mainwin = create_win_main();
  gtk_widget_show(mainwin);

  gtk_main ();
  return 0;
}
Example #4
0
/**
 * Program entry point. Initializes gtk+, calls the widget creating
 * functions and starts the main loop. Also connects 'popup-menu',
 * 'activate' and 'button-release-event' to the tray_icon.
 *
 * @param argc count of arguments
 * @param argv string array of arguments
 * @return 0 for success, otherwise error code
 */
int main (int argc, char *argv[]) {
  GError *error = NULL;
  GOptionContext *context;

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  DEBUG_PRINT("[Debugging Mode Build]\n");

  setlocale(LC_ALL, "");
  context = g_option_context_new (_("- A mixer for the system tray."));
  g_option_context_add_main_entries (context, args, GETTEXT_PACKAGE);
  g_option_context_add_group (context, gtk_get_option_group (TRUE));
  g_option_context_parse (context, &argc, &argv, &error);
  gtk_init (&argc, &argv);

  g_option_context_free(context);


  if (version) {
    printf(_("%s version: %s\n"),PACKAGE,VERSION);
    exit(0);
  }

  popup_window = NULL;
  status_icons[0] = status_icons[1] = status_icons[2] = status_icons[3] = NULL;

  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
  add_pixmap_directory ("./pixmaps");

  ensure_prefs_dir();
  load_prefs();
  cards = NULL; // so we don't try and free on first run
  alsa_init();
  init_libnotify();
  create_popups();
  add_filter();

  tray_icon = create_tray_icon();
  apply_prefs(0);

  g_signal_connect(G_OBJECT(tray_icon), "popup-menu",G_CALLBACK(popup_callback), popup_menu);
  g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(tray_icon_on_click), NULL);
  g_signal_connect(G_OBJECT(tray_icon), "button-release-event", G_CALLBACK(tray_icon_button), NULL);

  gtk_main ();
  uninit_libnotify();
  alsa_close();
  return 0;
}
Example #5
0
int
main (int argc, char *argv[])
{
  GtkWidget *Inicio_Sesion;

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);
  
  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
  
  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */
/*  caja = create_caja ();
  gtk_widget_show (caja);*/
		
  Inicio_Sesion = create_Inicio_Sesion();
  gtk_widget_show(Inicio_Sesion);
  gtk_main ();
  return 0;
}
Example #6
0
File: main.c Project: javarias/csat
int
main (int argc, char *argv[])
{
  GtkWidget *LpiShow;
  struct ccd cam;

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");

  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */
  setbuf(stdout,NULL);
  init("/dev/video0", &cam);
  LpiShow = create_LpiShow (&cam);
  gtk_widget_show (LpiShow);
 
  pthread_t controlThread;
  pthread_create(&controlThread, NULL, control_reset_level, (void *)&cam);
  gtk_main();
  dontFinish = 0;
  pthread_join(controlThread,NULL);
  free_ccd(&cam);
  return 0;
}
Example #7
0
int
main (int argc, char *argv[])
{
	if (geteuid() != 0) {
                //gksu_init(argc,argv);
                //gchar *cmdline = build_cmdline(argc,argv);
                //gksu_run(cmdline);
                //g_free(cmdline);
		fprintf(stderr,"Sorry, you need to be root to run this program\n");
                return 1;
	}
#ifdef ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#endif
	
	gtk_set_locale ();
	gtk_init (&argc, &argv);
	
	add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");

	MainWindow = create_MainWindow ();
	init_dtconf();
	gtk_widget_show (MainWindow);
	setup_dtconf();
	
	gtk_main ();
	return 0;
}
Example #8
0
int
main (int argc, char *argv[])
{
  gchar *path, *path1, *path2;
  
#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif
  
  gtk_set_locale ();
  gtk_init (&argc, &argv);

  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
  path = g_path_get_dirname(argv[0]);
  path1 = g_build_filename(path, "pixmaps", NULL);
  path2 = g_build_filename(path, "..", "pixmaps", NULL);
  add_pixmap_directory (path1);
  add_pixmap_directory (path2);
  add_pixmap_directory (path);
  g_free(path);
  g_free(path1);
  g_free(path2);

  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */
  winMain = create_winMain ();
  
  init_stuff (argc, argv);
  gtk_window_set_icon(GTK_WINDOW(winMain), create_pixbuf("xournal.png"));
  
  gtk_main ();
  
  if (bgpdf.status != STATUS_NOT_INIT) shutdown_bgpdf();

  save_mru_list();
  autosave_cleanup(&ui.autosave_filename_list);
  if (ui.auto_save_prefs) save_config_to_file();
  
  return 0;
}
Example #9
0
int
main (int argc, char *argv[])
{
  GtkWidget *window;

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  add_pixmap_directory ("/usr/share/icons/Tango/scalable/apps");
  add_pixmap_directory ("/usr/share/icons/Tango/scalable/devices");
  add_pixmap_directory (".");

  bm.window = create_window ();

  bm.has_bm = g_file_test ("/usr/sbin/boot-mode", G_FILE_TEST_IS_EXECUTABLE);
  bm.mode = get_mode ();

  bm.ignore_edits = TRUE;

  gtk_image_set_pixel_size (GTK_IMAGE (WIDGET ("normal_image")), 128);
  gtk_image_set_pixel_size (GTK_IMAGE (WIDGET ("update_image")), 128);

  VISIBLE ("warning_box", !bm.has_bm);
  ENABLED ("normal_button", bm.has_bm);
  ENABLED ("update_button", bm.has_bm);
  TOGGLED ("normal_button", bm.mode == NORMAL_MODE);
  TOGGLED ("update_button", bm.mode == UPDATE_MODE);

  bm.ignore_edits = FALSE;

  gtk_dialog_run (GTK_DIALOG (bm.window));

  if (bm.mode != (ISTOGGLED ("normal_button") ? NORMAL_MODE : UPDATE_MODE)) {
      update_boot_mode ();
  }
  
  return 0;
}
Example #10
0
int
main (int argc, char *argv[])
{
	void *p;

	g_thread_init(NULL);
	//g_log_set_fatal_mask("GLib",G_LOG_LEVEL_WARNING);
	//g_mem_set_vtable(glib_mem_profiler_table);
	//g_mem_set_vtable(&dbgtable);
#ifdef ENABLE_NLS
	p=bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	if (p==NULL) perror("bindtextdomain failed");
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#else
	printf("NLS disabled.\n");
#endif

#ifdef NOWOBSOLETE_NOTYET
	gnome_program_init ("linphone", LINPHONE_VERSION, LIBGNOMEUI_MODULE,
                      argc, argv,
                      GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR,
                      GNOME_PARAM_POPT_TABLE,&linphone_options,NULL);
#endif
	if (!gtk_init_with_args(&argc,&argv,_("A free SIP video-phone"),
				linphone_options,NULL,NULL))
		return -1;
	add_pixmap_directory(PACKAGE_DATA_DIR "/pixmaps/linphone");
	add_pixmap_directory("pixmaps");
	
	if (verbose) linphone_core_enable_logs(stdout);
	else linphone_core_disable_logs();
	linphone_gnome_init(&ui,&core);
	linphone_gnome_ui_show(&ui);
	gtk_main ();
	gdk_threads_leave(); /* it appears that the gdk lock is hold while exiting from gtk_main() */
	linphone_gnome_uninit(&ui);
	//g_mem_profile();
	exit(0);
	return 0;
}
Example #11
0
int
main (int argc, char *argv[])
{
	if(argc == 1)
	{
		  GtkWidget *window1;

		/*#ifdef ENABLE_NLS
		  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
		  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
		  textdomain (GETTEXT_PACKAGE);
		#endif
		*/
		  gtk_set_locale ();
		  gtk_init (&argc, &argv);

		//  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
		  add_pixmap_directory ("/home/vilhena/MCC/PL/trabalhos/trabalho1/pixmaps");
  		  add_pixmap_directory ("/home/biosystem/Desktop/trabalho1/pixmaps");

		  /*
		   * The following code was added by Glade to create one of each component
		   * (except popup menus), just so that you see something after building
		   * the project. Delete any components that you don't want shown initially.
		   */
		  window1 = create_window1 ();
		  gtk_widget_show (window1);

		  gtk_main ();
	}
	else 
	{
		char * temp = (char *)funcao(argc,argv);
		
		if(temp != NULL)
			printf("%s\n",temp);
			
		free(temp);
	}
  return 0;
}
Example #12
0
int
main (int argc, char *argv[])
{

#ifdef ENABLE_NLS
  bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
  textdomain (PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
  add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");

   e = evas_new();
   evas_set_output_method(e, RENDER_METHOD_ALPHA_SOFTWARE);
   {
     Visual *vis;
     Colormap cmap;
   
     vis = evas_get_optimal_visual(e, GDK_WINDOW_XDISPLAY(GDK_ROOT_PARENT()));
     gdk_vis = gdkx_visual_get(XVisualIDFromVisual(vis));
     cmap = evas_get_optimal_colormap(e, GDK_WINDOW_XDISPLAY(GDK_ROOT_PARENT()));
     gdk_cmap = gdkx_colormap_get(cmap);
     /* workaround for bug in gdk - well oversight in api */
     ((GdkColormapPrivate *)gdk_cmap)->visual = gdk_vis;
   }

  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */
  mainwin = create_mainwin ();
  gtk_widget_show (mainwin);

  gtk_main ();
  return 0;
}
Example #13
0
MalicRecogGui* malicrecog_gui_new (MalibGtkDisplay* display,
				   MalibSource* c_conf_filter,
				   MalicFaceGraphMeasure* fg_measure_filter){
  MalicRecogGui* gui;
  gui= malloc (sizeof (MalicRecogGui));
  assert(gui);

  /* add pixmap directory */
  add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
  add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");

  /* parms set to gui */
  gui->display         = display;
  gui->c_conf_filter    = c_conf_filter;
  gui->fg_measure_filter= fg_measure_filter;
  gui->window           = create_malicrecog_window();

  malicrecog_gui_setup(gui, NULL);
  gtk_widget_show(gui->window);

  return gui;
}
Example #14
0
static gboolean window_creation_hook(void *hook_data, void *call_data)
{
  g_debug("GUI window_creation_hook()");
#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&lttv_argc, &lttv_argv);

  add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps/" PACKAGE);
  add_pixmap_directory ("pixmaps");
  add_pixmap_directory ("../modules/gui/main/pixmaps");

  /* First window, use command line trace */
  create_main_window_with_trace_list(g_init_trace);

  gtk_main ();

  return FALSE;
}
Example #15
0
int main(int argc, char** argv){
   GdkPixbuf* pixbuf;
   GtkWidget* box, *image;
   EggTrayIcon* tray_icon;

#ifdef ENABLE_NLS
   bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
#endif

   gtk_set_locale();
   gtk_init(&argc, &argv);
   add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
   add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");

   mainWindow = create_mainWindow();
   initTimes();

   tray_icon = egg_tray_icon_new("prayertimes");
   box = gtk_event_box_new();
   image = gtk_image_new();
   g_signal_connect(box, "button-press-event", 
                    G_CALLBACK(icon_clicked_cb), NULL);
   gtk_container_add(GTK_CONTAINER(box), image);
   gtk_container_add(GTK_CONTAINER(tray_icon), box);
   gtk_widget_show_all(GTK_WIDGET(tray_icon));
   g_object_ref(tray_icon);
   pixbuf = create_pixbuf(TRAYICON_IMAGE);
   gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf);
   g_object_unref(pixbuf);

   gtk_widget_show(mainWindow);

   gtk_main();
   return 0;
}
Example #16
0
int
main (int argc, char *argv[])
{
  if(argc == 1) {
	  GtkWidget *MFmgr;

#ifdef ENABLE_NLS
	  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	  textdomain (GETTEXT_PACKAGE);
#endif

	  gtk_set_locale ();
	  gtk_init (&argc, &argv);

	  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");

	  /*
	   * The following code was added by Glade to create one of each component
	   * (except popup menus), just so that you see something after building
	   * the project. Delete any components that you don't want shown initially.
	   */
	  MFmgr = create_MFmgr ();
	  gtk_widget_show (MFmgr);

	  gtk_main ();
  } else if(argc == 4) {
	  writeFanSpeed(atoi(argv[1]));
	  writeKeypad(atoi(argv[2]));
	  switch(atoi(argv[3])) {
		  case 0:
			  system("synclient TouchpadOff=1");
			  break;
		  case 1:
			  system("synclient TouchpadOff=2");
			  break;
		  case 2:
			  system("synclient TouchpadOff=0");
			  break;
		  default: ;
	  }
  } else ;

	  return 0;
}
Example #17
0
int
main (int argc, char *argv[])
{
  GtkWidget *MainFrame;

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");

  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */
  MainFrame = create_MainFrame ();
  gtk_widget_show (MainFrame);
  GtkWidget* mylist = lookup_widget(MainFrame,"ls_box");
  char* box[5][1];
  int i;
  box[0][0] = "收件箱";
  box[1][0] = "已发邮件";
  box[2][0] = "垃圾箱";
  box[3][0] = "发件箱";
  box[4][0] = "草稿箱";


  for(i = 0; i < 5; i++)
  {
  	gtk_clist_append((GtkCList*)mylist,box[i]);
  }
  addfunc();
 // strcpy(storename,"10717365");
 // strcpy(storeaddress,"*****@*****.**");
 // strcpy(storepassword,"6188699");
  gtk_main ();
  return 0;
}
Example #18
0
int main(int argc, char *argv[])
{
#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

	gtk_set_locale();
	gtk_init(&argc, &argv);

	add_pixmap_directory(PACKAGE_PIXMAPS_DIR);

	xneur_restart();

	create_tray_icon(NULL, TRUE);

	gtk_main();

	return EXIT_SUCCESS;
}
Example #19
0
int
main (int argc, char *argv[])
{
  GtkWidget *window1;

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");

  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */
  window1 = create_window1 ();
  gtk_widget_show (window1);

  gtk_main ();
  return 0;
}
Example #20
0
int main(int argc, char *argv[])
{
	GdkPixbuf *icon;

	/* Redirect standard output to a file - printing to the Windows terminal slows operation down way too much */
#ifdef __WIN32__
	gchar *tmp;
	FILE *log_file;

	tmp = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, LOG_FILE, NULL);
	log_file = g_fopen(tmp, "wt");
	g_free(tmp);

	if (log_file != NULL)
		g_log_set_default_handler(&default_log_handler, log_file);
#endif

	// Force GLib 2.32+ to print info and debug messages like older versions did, unless this variable is already set.
	// No effect on earlier GLib versions.
	g_setenv("G_MESSAGES_DEBUG", "all", /* overwrite = */ FALSE);

	/* Init the tilp core */
	tilp_init(&argc, &argv);

	/* Init GTK+ */
	gtk_init(&argc, &argv);
	add_pixmap_directory(inst_paths.pixmap_dir);
	add_pixmap_directory(inst_paths.icon_dir);
	splash_screen_start();

	/*
		Get rid of glib, gdk, gtk warnings when compiled in Release mode
	*/
#if !defined(_DEBUG)
	g_log_set_handler ("GLib", 
		G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG,
		my_blackhole_log_handler, NULL);
	g_log_set_handler ("Gdk", 
		G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG,
		my_blackhole_log_handler, NULL);
	g_log_set_handler ("Gtk", 
		G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG,
		my_blackhole_log_handler, NULL);

	g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, 
		my_blackhole_log_handler, NULL);
#endif

	/* Init the GUI-independent functions */
	tilp_gif_set_gtk();
	tilp_update_set_gtk();

	/* Create the main window */
	if(!(working_mode & MODE_CMD))
	{
#if WITH_KDE
		splash_screen_set_label(_("Initializing KDE..."));
		sp_kde_init(argc, argv, "tilp", _("TiLP"), VERSION, _("Tilp Is a Linking Program"), "Copyright (c) 1999-2008 Romain Lievin", "http://lpg.ticalc.org/prj_tilp/", "*****@*****.**");
		atexit(sp_kde_finish);
		// Not needed unless we want to add a DCOP interface.
		// g_timeout_add(26, sp_kde_process_qt_events, NULL);
#endif

		splash_screen_set_label(_("Loading GUI..."));
		main_wnd = display_tilp_dbox();
	}

	/* Do a local directory list */
	g_free(local.cwdir);
	local.cwdir = g_get_current_dir();

	/* Update the local view (not visible yet) */
	if(!(working_mode & MODE_CMD))
	{
		clist_refresh();
		labels_refresh();
	}

	/* Inits are done ! */
	working_mode &= ~MODE_INI;
	tilp_err(0);		// pop errors (display console mode)

	/* In cmdline, does not display the entire window, only the pbar */
	if(!(working_mode & MODE_CMD))
	{
		gtk_widget_show(main_wnd);
		toolbar_refresh_buttons();
		icon = create_pixbuf("tilp.xpm");
		gtk_window_set_icon(GTK_WINDOW(main_wnd), icon);
		gdk_window_set_icon_name(main_wnd->window, _("TiLP2"));
	}

	/* 
	   If variables have been passed on the command line in GUI mode then
	   send them 
	 */
	if((working_mode & MODE_GUI) && (working_mode & MODE_CMD)) 
	{
		splash_screen_set_label(_("Command line..."));

		if(local.selection0 || local.selection2 || local.selection5)
			on_tilp_send("");
		else if(local.selection4)
			tilp_cmdline_send();
	}

	/* GTK main loop */
	splash_screen_stop();
	if(!(working_mode & MODE_CMD))
		gtk_main();
	tilp_exit();

	return 0;
}
Example #21
0
int
main (int argc, char *argv[])
{
	struct pollfd pfd;
	char line[4096], *p;
	char *name, *id, *polname, *filters;
	int nfilters, res;
	time_t curtime;
	GList *items = NULL;

	GtkWidget *systracewin;
	GtkWidget *processname;
	GtkWidget *policyname;
	GtkWidget *processid;
	GtkWidget *syscallinfo;
	GtkWidget *statusline;
	GtkWidget *timeline;
	GtkWidget *reviewbutton;
	GtkWidget *detachlabel;
	GtkWidget *filterentry;

	GtkStyle *default_style, *red_style;

	/* Set up required parameters */
	parameters();

	gtk_set_locale ();
	gtk_init (&argc, &argv);

	add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
	add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");

	/*
	 * The following code was added by Glade to create one of each component
	 * (except popup menus), just so that you see something after building
	 * the project. Delete any components that you don't want shown initially.
	 */
	systracewin = create_systracewin ();
	filterreview = create_filterreview();
	wizard = create_wizard();

	processname = lookup_widget(GTK_WIDGET(systracewin), "processname");
	processid = lookup_widget(GTK_WIDGET(systracewin), "processid");
	policyname = lookup_widget(GTK_WIDGET(systracewin), "policyname");
	syscallinfo = lookup_widget(GTK_WIDGET(systracewin), "syscallinfo");
	statusline = lookup_widget(GTK_WIDGET(systracewin), "statusline");
	timeline = lookup_widget(GTK_WIDGET(systracewin), "timeline");
	reviewbutton = lookup_widget(GTK_WIDGET(systracewin), "reviewbutton");
	wizardbutton = lookup_widget(GTK_WIDGET(systracewin), "wizardbutton");
	detachlabel = lookup_widget(GTK_WIDGET(systracewin), "detachlabel");
	filterentry = lookup_widget(GTK_WIDGET(systracewin), "filterentry");
	default_style = gtk_widget_get_style(processname);
	red_style = make_color(default_style, 0xd000, 0x1000, 0);
	red_style->private_font = gdk_font_load("-*-helvetica-bold-r-normal--*-140-*-*-*-*-iso8859-1");
	gtk_widget_set_style(processname, red_style);
	gtk_widget_set_style(processid, red_style);
	gtk_widget_set_style(policyname, red_style);
	gtk_widget_set_style(syscallinfo, red_style);

	/* Return key is not supposed to pop it up */
	gtk_combo_disable_activate(GTK_COMBO(filterentry));

	/* Connect to cradle server if requested */
	if (argc == 2 && strcmp(argv[1], "-C") == 0) {
		struct sockaddr_un sun;
		int s;
		char path[MAXPATHLEN];

		snprintf(path, sizeof(path), "/tmp/systrace-%d/%s",
		    getuid(), CRADLE_UI);

		if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
			err(1, "socket()");

		memset(&sun, 0, sizeof (sun));
		sun.sun_family = AF_UNIX;

		if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
		    sizeof(sun.sun_path))
			errx(1, "Path too long: %s", path);

		if (connect(s, (struct sockaddr *)&sun, sizeof(sun)) == -1)
			err(1, "connect()");

		if (dup2(s, fileno(stdin)) == -1)
			err(1, "dup2");
		if (dup2(s, fileno(stdout)) == -1)
			err(1, "dup2");
	}

	/* Make IO line buffered */
	setvbuf(stdin, NULL, _IONBF, 0);
	setvbuf(stdout, NULL, _IONBF, 0);
	while (1) {
		/* See if we can read from the file descriptor */
		memset(&pfd, 0, sizeof(pfd));
		pfd.fd = fileno(stdin);
		pfd.events = POLLIN;
		res = poll(&pfd, 1, 1000);
		if (res == -1) {
			if (errno == EINTR || errno == EAGAIN)
				break;
		} else if (res == 0) {
			while (gtk_events_pending())
				gtk_main_iteration();
			continue;
		}

		if (freadline(line, sizeof(line), stdin) == NULL)
			break;
		p = line;
		name = strsep(&p, ",");
		if (p == NULL || *p == '\0')
			errx(1, "Bad input line");
		p++;
		strsep(&p, " ");
		if (p == NULL || *p == '\0')
			errx(1, "Bad input line");
		id = strsep(&p, "(");
		if (p == NULL || *p == '\0')
			errx(1, "Bad input line");
		strsep(&p, ":");
		if (p == NULL || *p == '\0')
			errx(1, "Bad input line");
		p++;
		polname = strsep(&p, ",");
		if (p == NULL || *p == '\0')
			errx(1, "Bad input line");
		strsep(&p, ":");
		if (p == NULL || *p == '\0')
			errx(1, "Bad input line");
		p++;
		filters = strsep(&p, ",");
		if (p == NULL || *p == '\0')
			errx(1, "Bad input line");
		nfilters = atoi(filters);
		strsep(&p, ":");
		if (p == NULL || *p == '\0')
			errx(1, "Bad input line");
		p++;

		gtk_label_set_text(GTK_LABEL(processname), name);
		gtk_label_set_text(GTK_LABEL(processid), id);
		gtk_label_set_text(GTK_LABEL(policyname), polname);
		gtk_label_set_text(GTK_LABEL(syscallinfo), p);
		gtk_label_set_text(GTK_LABEL(statusline), "");

		items = make_policy_suggestion(p);

		curtime = time(NULL);
		snprintf(line, sizeof(line), "%.25s", ctime(&curtime));
		gtk_label_set_text(GTK_LABEL(timeline), line);

		if (nfilters) {
			gtk_widget_set_sensitive(wizardbutton, 0);
			gtk_widget_set_sensitive(reviewbutton, 1);
			gtk_label_set_text(GTK_LABEL(detachlabel), "Automatic");
		} else {
			gtk_widget_set_sensitive(wizardbutton, 1);
			gtk_widget_set_sensitive(reviewbutton, 0);
			gtk_label_set_text(GTK_LABEL(detachlabel), "Detach");
		}

		gtk_widget_show (systracewin);

		gtk_combo_set_popdown_strings (GTK_COMBO(filterentry), items);
		g_list_foreach(items, free_list, NULL);
		g_list_free(items);

		do {
			gtk_main ();
			while (freadline(line, sizeof(line), stdin)) {
				if (!strcmp(line, "OKAY"))
					goto done;
				if (!strcmp(line, "WRONG"))
					break;
				gtk_label_set_text(GTK_LABEL(statusline), line);
			}
		} while (1);

	done:
		gtk_widget_hide (systracewin);

		while (gtk_events_pending())
			gtk_main_iteration();
	}
	return 0;
}
Example #22
0
/*****************************************************************************
 * Run: Gtk+ thread
 *****************************************************************************
 * this part of the interface is in a separate thread so that we can call
 * gtk_main() from within it without annoying the rest of the program.
 *****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
#ifndef NEED_GTK2_MAIN
    /* gtk_init needs to know the command line. We don't care, so we
     * give it an empty one */
    char  *p_args[] = { "", NULL };
    char **pp_args  = p_args;
    int    i_args   = 1;
    int    i_dummy;
#endif
    playlist_t        *p_playlist;
    GtkCellRenderer   *p_renderer = NULL;
    GtkTreeViewColumn *p_column   = NULL;
    GtkListStore      *p_filelist = NULL;
    GtkListStore      *p_playlist_store = NULL;

#ifndef NEED_GTK2_MAIN
    gtk_set_locale ();
    msg_Dbg( p_intf, "Starting pda GTK2+ interface" );
    gtk_init( &i_args, &pp_args );
#else
    /* Initialize Gtk+ */
    msg_Dbg( p_intf, "Starting pda GTK2+ interface thread" );
    gdk_threads_enter();
#endif

    /* Create some useful widgets that will certainly be used */
/* FIXME: magic path */
    add_pixmap_directory("share");
    add_pixmap_directory("/usr/share/vlc");

    /* Path for pixmaps under linupy 1.4 */
    add_pixmap_directory("/usr/local/share/pixmaps/vlc");
    /* Path for pixmaps under linupy 2.0 */
    add_pixmap_directory("/usr/share/pixmaps/vlc");

    p_intf->p_sys->p_window = create_pda();
    if (p_intf->p_sys->p_window == NULL)
    {
        msg_Err( p_intf, "unable to create pda interface" );
    }

    /* Store p_intf to keep an eye on it */
    gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
                         "p_intf", p_intf );

    /* Set the title of the main window */
    gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
                          VOUT_TITLE " (PDA Linux interface)");

    /* Get the notebook object */
    p_intf->p_sys->p_notebook = GTK_NOTEBOOK( gtk_object_get_data(
        GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) );

    /* Get the slider object */
    p_intf->p_sys->p_slider = (GtkHScale*) lookup_widget( p_intf->p_sys->p_window, "timeSlider" );
    p_intf->p_sys->p_slider_label = (GtkLabel*) lookup_widget( p_intf->p_sys->p_window, "timeLabel" );
    if (p_intf->p_sys->p_slider == NULL)
        msg_Err( p_intf, "Time slider widget not found." );
    if (p_intf->p_sys->p_slider_label == NULL)
        msg_Err( p_intf, "Time label widget not found." );

    /* Connect the date display to the slider */
    p_intf->p_sys->p_adj = gtk_range_get_adjustment( GTK_RANGE(p_intf->p_sys->p_slider) );
    if (p_intf->p_sys->p_adj == NULL)
        msg_Err( p_intf, "Adjustment range not found." );
    g_signal_connect( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
                         G_CALLBACK( E_(GtkDisplayDate) ), p_intf );
    p_intf->p_sys->f_adj_oldvalue = 0;
    p_intf->p_sys->i_adj_oldvalue = 0;

    /* BEGIN OF FILEVIEW GTK_TREE_VIEW */
    p_intf->p_sys->p_tvfile = NULL;
    p_intf->p_sys->p_tvfile = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window,
                                                             "tvFileList");
    if (NULL == p_intf->p_sys->p_tvfile)
       msg_Err(p_intf, "Error obtaining pointer to File List");

    /* Insert columns 0 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 0, (gchar *) N_("Filename"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 0 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 0 );
    gtk_tree_view_column_set_sort_column_id(p_column, 0);
    /* Insert columns 1 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 1, (gchar *) N_("Permissions"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 1 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 1 );
    gtk_tree_view_column_set_sort_column_id(p_column, 1);
    /* Insert columns 2 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 2, (gchar *) N_("Size"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 2 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 2 );
    gtk_tree_view_column_set_sort_column_id(p_column, 2);
    /* Insert columns 3 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 3, (gchar *) N_("Owner"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 3 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 3 );
    gtk_tree_view_column_set_sort_column_id(p_column, 3);
    /* Insert columns 4 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 4, (gchar *) N_("Group"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 4 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 4 );
    gtk_tree_view_column_set_sort_column_id(p_column, 4);

    /* Get new directory listing */
    p_filelist = gtk_list_store_new (5,
                G_TYPE_STRING, /* Filename */
                G_TYPE_STRING, /* permissions */
                G_TYPE_UINT64, /* File size */
                G_TYPE_STRING, /* Owner */
                G_TYPE_STRING);/* Group */
    ReadDirectory(p_intf, p_filelist, ".");
    gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile), GTK_TREE_MODEL(p_filelist));
    g_object_unref(p_filelist);     /* Model will be released by GtkTreeView */
    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile)),GTK_SELECTION_MULTIPLE);

    /* Column properties */
    gtk_tree_view_set_headers_visible(p_intf->p_sys->p_tvfile, TRUE);
    gtk_tree_view_columns_autosize(p_intf->p_sys->p_tvfile);
    gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile),TRUE);
    /* END OF FILEVIEW GTK_TREE_VIEW */

    /* BEGIN OF PLAYLIST GTK_TREE_VIEW */
    p_intf->p_sys->p_tvplaylist = NULL;
    p_intf->p_sys->p_tvplaylist = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window, "tvPlaylist");
    if (NULL == p_intf->p_sys->p_tvplaylist)
       msg_Err(p_intf, "Error obtaining pointer to Play List");

    /* Columns 1 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 0, (gchar *) N_("Filename"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 0 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 0 );
    gtk_tree_view_column_set_sort_column_id(p_column, 0);
    /* Column 2 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 1, (gchar *) N_("Time"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 1 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 1 );
    gtk_tree_view_column_set_sort_column_id(p_column, 1);
#if 0
    /* Column 3 - is a hidden column used for reliable deleting items from the underlying playlist */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 2, (gchar *) N_("Index"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 2 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 2 );
    gtk_tree_view_column_set_sort_column_id(p_column, 2);
#endif
    /* update the playlist */
    p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
    p_playlist_store = gtk_list_store_new (3,
                G_TYPE_STRING, /* Filename */
                G_TYPE_STRING, /* Time */
                G_TYPE_UINT);  /* Hidden index */
    PlaylistRebuildListStore(p_playlist_store, p_playlist);
    gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist), GTK_TREE_MODEL(p_playlist_store));
    g_object_unref(p_playlist_store);
    vlc_object_release(p_playlist); /* Free the playlist */
    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist)),GTK_SELECTION_MULTIPLE);

    /* Column properties */
    gtk_tree_view_set_headers_visible(p_intf->p_sys->p_tvplaylist, TRUE);
    gtk_tree_view_columns_autosize(p_intf->p_sys->p_tvplaylist);
    gtk_tree_view_set_headers_clickable(p_intf->p_sys->p_tvplaylist, TRUE);
    /* END OF PLAYLIST GTK_TREE_VIEW */

    /* Hide the Preference TAB for now. */
    GtkWidget *p_preference_tab = NULL;
    p_preference_tab = gtk_notebook_get_nth_page(p_intf->p_sys->p_notebook,5);
    if (p_preference_tab != NULL)
      gtk_widget_hide(p_preference_tab);

    /* Show the control window */
    gtk_widget_show( p_intf->p_sys->p_window );

#ifdef NEED_GTK2_MAIN
    msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
    while( !p_intf->b_die )
    {
        Manage( p_intf );

        /* Sleep to avoid using all CPU - since some interfaces need to
         * access keyboard events, a 100ms delay is a good compromise */
        gdk_threads_leave();
        if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
            msleep( INTF_IDLE_SLEEP );
        else
            msleep( 1000 );
        gdk_threads_enter();
    }
#else
    msg_Dbg( p_intf, "Manage GTK keyboard events using timeouts" );
    /* Sleep to avoid using all CPU - since some interfaces needs to access
     * keyboard events, a 1000ms delay is a good compromise */
    if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
        i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, (GtkFunction)Manage, p_intf );
    else
        i_dummy = gtk_timeout_add( 1000, (GtkFunction)Manage, p_intf );

    /* Enter Gtk mode */
    gtk_main();
    /* Remove the timeout */
    gtk_timeout_remove( i_dummy );
#endif

    gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
#ifdef NEED_GTK2_MAIN
    gdk_threads_leave();
#endif
}
Example #23
0
int
main (int argc, char *argv[])
{
	GtkWidget *Universe_Viewer_2;

	int i, pid;
	char mess[32];
	pid=cree_fils(loading,0);
  gtk_set_locale ();
  gtk_init (&argc, &argv);
	//buff = g_strdup_printf ("Waiting ...");
	gdk_rgb_init();
  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");

	AGE_CST=(100.0/9.78)*h;
	read_quasar = read_txt_quasar;
	get_nb_quasar = get_txt_nb_quasar;

	data_filename=(char *) calloc(256,sizeof(char));
	if(argc==2) strcpy(data_filename,argv[1]);
	else strcpy(data_filename,"data/Burbridge.txt");
	init_abacus ();
	data_lenght = get_txt_nb_quasar (data_filename);
	data_lenght_max = data_lenght;
	quasar_pos 	= (Vector *) malloc(data_lenght*sizeof(Vector));
	quasar		= (Quasar *) malloc(data_lenght*sizeof(Quasar));
	graphT		= (Point*) malloc((data_lenght+1)*sizeof(Point));



	read_txt_quasar (data_filename,quasar);

	data_lenght=data_size;
		sprintf(mess,"%d objets lus\n", data_lenght);
	calc_quasar_tau (quasar, graphT);
	calc_quasar_pos(quasar,quasar_pos);
	init_projection_vectors ();
	init_graph();

	for(i=0;i<NBVIEWS;i++)
	{
		quasar_proj[i] =set_quasar_proj (quasar_pos,i);
		the_earth[i]=set_earth_proj(earth,i);
	}

	Universe_Viewer_2 = create_Universe_Viewer_2 (quasar_proj);
	kill(pid,SIGINT);
	gtk_widget_show (Universe_Viewer_2);
	alerte(mess);
	gtk_main();

	// penser à faire le ménage !!!

		free(grapheC0g);
		free(grapheC1g);
		free(grapheC2g);
		free(grapheC31g);
		free(grapheC32g);
		free(grapheC4g);

		//gtk_widget_destroy(Universe_Viewer_2);

	return 0;
}
Example #24
0
int main(int argc, char *argv[])
{
    unsigned int i;
    int opt;
    int help = 0;
    int console = 0;
    char port_name[32];
    pthread_t dt;
#ifdef HAVE_LASH
    lash_args_t *lash_args = lash_extract_args(&argc, &argv);
     lash_event_t *event;
#endif

    auto_begin_threshold = db2lin(DEFAULT_AUTO_BEGIN_THRESHOLD);
    auto_end_threshold = db2lin(DEFAULT_AUTO_END_THRESHOLD);

    while ((opt = getopt(argc, argv, "hic:t:n:p:f:sab:e:T:")) != -1) {
	switch (opt) {
	case 'h':
	    help = 1;
	    break;
	case 'i':
	    console = 1;
	    break;
	case 'c':
	    num_ports = atoi(optarg);
	    DEBUG(1, "ports: %d\n", num_ports);
	    break;
	case 't':
	    buf_length = atoi(optarg);
	    DEBUG(1, "buffer: %ds\n", buf_length);
	    break;
	case 'n':
	    client_name = optarg;
	    DEBUG(1, "client name: %s\n", client_name);
	    break;
	case 'p':
	    prefix = optarg;
	    DEBUG(1, "prefix: %s\n", prefix);
	    break;
	case 'f':
	    format_name = optarg;
	    break;
	case 's':
	    safe_filename = 1;
	    break;
	case 'a':
	    auto_record = 1;
	    break;
	case 'b':
	    auto_begin_threshold = db2lin(atof(optarg));
	    break;
	case 'e':
	    auto_end_threshold = db2lin(atof(optarg));
	    break;
	case 'T':
	    auto_end_time = atoi(optarg);
	    break;
	default:
	    num_ports = 0;
	    break;
	}
    }

    if (optind != argc) {
	num_ports = argc - optind;
    }

    if (num_ports < 1 || num_ports > MAX_PORTS || help) {
	fprintf(stderr, "Usage %s: [-h] [-i] [-c channels] [-n jack-name]\n\t"
			"[-t buffer-length] [-p file prefix] [-f format]\n\t"
			"[-a] [-b begin-threshold] [-e end-threshold] [-T end-time]\n\t"
			"[port-name ...]\n\n", argv[0]);
	fprintf(stderr, "\t-h\tshow this help\n");
	fprintf(stderr, "\t-i\tinteractive mode (console instead of X11) also enabled\n\t\tif DISPLAY is unset\n");
	fprintf(stderr, "\t-c\tspecify number of recording channels\n");
	fprintf(stderr, "\t-n\tspecify the JACK name timemachine will use\n");
	fprintf(stderr, "\t-t\tspecify the pre-recording buffer length\n");
	fprintf(stderr, "\t-p\tspecify the saved file prefix, may include path\n");
	fprintf(stderr, "\t-s\tuse safer characters in filename (windows compatibility)\n");
	fprintf(stderr, "\t-f\tspecify the saved file format\n");
	fprintf(stderr, "\t-a\tenable automatic sound-triggered recording\n");
	fprintf(stderr, "\t-b\tspecify threshold above which automatic recording will begin\n");
	fprintf(stderr, "\t-e\tspecify threshold below which automatic recording will end\n");
	fprintf(stderr, "\t-T\tspecify silence length before automatic recording ends\n");
	fprintf(stderr, "\n");
	fprintf(stderr, "\tchannels must be in the range 1-8, default %d\n",
			DEFAULT_NUM_PORTS);
	fprintf(stderr, "\tjack-name, default \"%s\"\n", DEFAULT_CLIENT_NAME);
	fprintf(stderr, "\tfile-prefix, default \"%s\"\n", DEFAULT_PREFIX);
	fprintf(stderr, "\tbuffer-length, default %d secs\n", DEFAULT_BUF_LENGTH);
	fprintf(stderr, "\tformat, default '%s', options: wav, w64\n", DEFAULT_FORMAT);
	fprintf(stderr, "\tbegin-threshold, default %.1f dB\n", DEFAULT_AUTO_BEGIN_THRESHOLD);
	fprintf(stderr, "\tend-threshold, default %.1f dB\n", DEFAULT_AUTO_END_THRESHOLD);
	fprintf(stderr, "\tend-time, default %d secs\n", DEFAULT_AUTO_END_TIME);
	fprintf(stderr, "\n");
	fprintf(stderr, "specifying port names to connect to on the command line overrides -c\n\n");
	exit(1);
    }

    if (!strcasecmp(format_name, "wav")) {
	format_sf = SF_FORMAT_WAV | SF_FORMAT_FLOAT;
    }
#ifdef HAVE_W64
    if (!strcasecmp(format_name, "w64")) {
	format_sf = SF_FORMAT_W64 | SF_FORMAT_FLOAT;
    }
#endif

    if (format_sf == 0) {
	fprintf(stderr, "Unknown format '%s'\n", format_name);
    }

    /* Register with jack */
    if ((client = jack_client_open(client_name, 0, NULL)) == 0) {
	DEBUG(0, "jack server not running?\n");
	exit(1);
    }
    DEBUG(1, "registering as %s\n", client_name);

    process_init(buf_length);

#ifdef HAVE_LASH
    lash_client = lash_init (lash_args, "TimeMachine",
                     0, /* would be LASH_Config_Data_Set etc. */
                     LASH_PROTOCOL (2,0));
    if (!lash_client) {
	DEBUG(1, "could not initialise LASH\n");
    }
    event = lash_event_new_with_type(LASH_Client_Name);
    lash_event_set_string(event, client_name);
    lash_send_event(lash_client, event);
#endif

    jack_set_process_callback(client, process, 0);

    if (jack_activate(client)) {
	DEBUG(0, "cannot activate JACK client");
	exit(1);
    }
#ifdef HAVE_LASH
    lash_jack_client_name(lash_client, client_name);
#endif

    /* Create the jack ports */
    for (i = 0; i < num_ports; i++) {
	jack_port_t *port;

	snprintf(port_name, 31, "in_%d", i + 1);
	ports[i] = jack_port_register(client, port_name,
				      JACK_DEFAULT_AUDIO_TYPE,
				      JackPortIsInput, 0);
	if (optind != argc) {
	    port = jack_port_by_name(client, argv[optind+i]);
	    if (port == NULL) {
		fprintf(stderr, "Can't find port '%s'\n", port_name);
		continue;
	    }
	    if (jack_connect(client, argv[optind+i], jack_port_name(ports[i]))) {
		fprintf(stderr, "Cannot connect port '%s' to '%s'\n",
			argv[optind+i], jack_port_name(ports[i]));
	    }
	}
    }

    /* Start the disk thread */
    pthread_create(&dt, NULL, (void *)&writer_thread, NULL);

#ifdef HAVE_LIBREADLINE
    if (console || !getenv("DISPLAY") || getenv("DISPLAY")[0] == '\0') {
#ifdef HAVE_LIBLO
      lo_server_thread st = lo_server_thread_new(OSC_PORT, NULL);
      if (st) {
	  lo_server_thread_add_method(st, "/start", "", osc_handler_nox, (void *)1);
	  lo_server_thread_add_method(st, "/stop", "", osc_handler_nox, (void *)0);
	  lo_server_thread_start(st);
	  printf("Listening for OSC requests on osc.udp://localhost:%s\n",
	    OSC_PORT);
      }
#endif

      int done = 0;
      while (!done) {
	char *line = readline("TimeMachine> ");
	if (!line) {
	  printf("EOF\n");
	  break;
	}
	if (line && *line) {
	  add_history(line);
	  if (strncmp(line, "q", 1) == 0) done = 1;
	  else if (strncmp(line, "start", 3) == 0) recording_start();
	  else if (strncmp(line, "stop", 3) == 0) recording_stop();
	  else if (strncmp(line, "help", 3) == 0) {
	    printf("Commands: start stop\n");
	  } else {
	    printf("Unknown command\n");
          }
	}
	free(line);
      }
    } else
#endif
    {
      gtk_init(&argc, &argv);

      add_pixmap_directory(PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
      add_pixmap_directory("pixmaps");
      add_pixmap_directory("../pixmaps");

      img_on = create_pixbuf("on.png");
      img_off = create_pixbuf("off.png");
      img_busy = create_pixbuf("busy.png");
      icon_on = create_pixbuf("on-icon.png");
      icon_off = create_pixbuf("off-icon.png");

      main_window = create_window(client_name);
      gtk_window_set_icon(GTK_WINDOW(main_window), icon_off);
      gtk_widget_show(main_window);

      bind_meters();
      g_timeout_add(100, meter_tick, NULL);

#ifdef HAVE_LIBLO
    lo_server_thread st = lo_server_thread_new(OSC_PORT, NULL);
    if (st) {
	lo_server_thread_add_method(st, "/start", "", osc_handler, (void *)1);
	lo_server_thread_add_method(st, "/stop", "", osc_handler, (void *)0);
	lo_server_thread_start(st);
	printf("Listening for OSC requests on osc.udp://localhost:%s\n",
	       OSC_PORT);
    }
#endif

#ifdef HAVE_LASH
      gtk_idle_add(idle_cb, lash_client);
#endif

      gtk_main();
    }

    cleanup();

    /* We can't ever get here, but it keeps gcc quiet */
    return 0;
}
Example #25
0
int main( int argc, char **argv ) {
    extern const char *source_modtime_str, *source_version_str;
    const char *load_prefs = getenv("FONTFORGE_LOADPREFS");
    int i;
    extern int splash;
    int recover=1;
    GtkWidget *notices, *ffsplash;
    gchar *home_dir, *rc_path;
    struct argcontext args;

#ifdef FONTFORGE_CONFIG_TYPE3
    fprintf( stderr, "Copyright (c) 2000-2012 by George Williams.\n Executable based on sources from %s-ML.\n",
	    source_modtime_str );
#else
    fprintf( stderr, "Copyright (c) 2000-2012 by George Williams.\n Executable based on sources from %s.\n",
	    source_modtime_str );
#endif
    fprintf( stderr, " Library based on sources from %s.\n", library_version_configuration.library_source_modtime_string );

    gtk_set_locale ();

    home_dir = (gchar*) g_get_home_dir();
    rc_path = g_strdup_printf("%s/.fontforgerc", home_dir);
    gtk_rc_add_default_file(rc_path);
    g_free(rc_path);

    gtk_init (&argc, &argv);

#if defined(SHAREDIR)
    add_pixmap_directory( SHAREDIR "/pixmaps");
#elif defined(PREFIX)
    add_pixmap_directory( PREFIX "/share/fontforge/pixmaps" );
#else
    add_pixmap_directory( "./pixmaps" );
#endif

    bind_textdomain_codeset("FontForge","UTF-8");
    bindtextdomain("FontForge", getLocaleDir());
    textdomain("FontForge");

#if defined(__Mac)
    /* Start X if they haven't already done so. Well... try anyway */
    /* Must be before we change DYLD_LIBRARY_PATH or X won't start */
    if ( uses_local_x(argc,argv) && getenv("DISPLAY")==NULL ) {
	system( "open /Applications/Utilities/X11.app/" );
	setenv("DISPLAY",":0.0",0);
    }
#endif

    FF_SetUiInterface(&gtk_ui_interface);
    FF_SetPrefsInterface(&gtk_prefs_interface);
    /*FF_SetSCInterface(&gtk_sc_interface);*/
    /*FF_SetCVInterface(&gtk_cv_interface);*/
    /*FF_SetBCInterface(&gtk_bc_interface);*/
    FF_SetFVInterface(&gtk_fv_interface);
    /*FF_SetFIInterface(&gtk_fi_interface);*/
    /*FF_SetMVInterface(&gtk_mv_interface);*/
    /*FF_SetClipInterface(&gtk_clip_interface);*/
#ifndef _NO_PYTHON
    PythonUI_Init();
#endif

    InitSimpleStuff();
    if ( load_prefs!=NULL && strcasecmp(load_prefs,"Always")==0 )
	LoadPrefs();
    if ( default_encoding==NULL )
	default_encoding=FindOrMakeEncoding("ISO8859-1");
    if ( default_encoding==NULL )
	default_encoding=&custom;	/* In case iconv is broken */
    CheckIsScript(argc,argv);		/* Will run the script and exit if it is a script */
					/* If there is no UI, there is always a script */
			                /*  and we will never return from the above */
    if ( load_prefs==NULL ||
	    (strcasecmp(load_prefs,"Always")!=0 &&	/* Already loaded */
	     strcasecmp(load_prefs,"Never")!=0 ))
	LoadPrefs();
    for ( i=1; i<argc; ++i ) {
	char *pt = argv[i];
	if ( pt[0]=='-' && pt[1]=='-' )
	    ++pt;

	if ( strcmp(pt,"-nosplash")==0 )
	    splash = 0;
	else if ( strcmp(pt,"-recover")==0 && i<argc-1 ) {
	    ++i;
	    if ( strcmp(argv[i],"none")==0 )
		recover=0;
	    else if ( strcmp(argv[i],"clean")==0 )
		recover= -1;
	    else if ( strcmp(argv[i],"auto")==0 )
		recover= 1;
	    else if ( strcmp(argv[i],"inquire")==0 )
		recover= 2;
	    else {
		fprintf( stderr, "Invalid argument to -recover, must be none, auto, inquire or clean\n" );
		dousage();
	    }
	} else if ( strcmp(pt,"-recover=none")==0 ) {
	    recover = 0;
	} else if ( strcmp(pt,"-recover=clean")==0 ) {
	    recover = -1;
	} else if ( strcmp(pt,"-recover=auto")==0 ) {
	    recover = 1;
	} else if ( strcmp(pt,"-recover=inquire")==0 ) {
	    recover = 2;
	} else if ( strcmp(pt,"-help")==0 )
	    dohelp();
	else if ( strcmp(pt,"-usage")==0 )
	    dousage();
	else if ( strcmp(pt,"-version")==0 )
	    doversion(source_version_str);
	else if ( strcmp(pt,"-library-status")==0 )
	    dolibrary();
    }

    InitCursors();
#ifndef _NO_PYTHON
    PyFF_ProcessInitFiles();
#endif

    if ( splash ) {
	splashw = create_FontForgeSplash ();
	splash_window_tooltip_fun( splashw );
	notices = lookup_widget(splashw,"Notices");
	if ( notices!=NULL )
	    gtk_widget_hide(notices);
	ffsplash = lookup_widget(splashw,"ffsplash2");
	if ( ffsplash!=NULL )
	    gtk_widget_hide(ffsplash);
	ffsplash = lookup_widget(splashw,"ffsplash3");
	if ( ffsplash!=NULL )
	    gtk_widget_hide(ffsplash);
	gtk_window_set_position(GTK_WINDOW(splashw),GTK_WIN_POS_CENTER_ALWAYS);
	gtk_widget_show (splashw);
	ff_progress_allow_events();
	gtk_timeout_add(1000,Splash_Changes,splashw);
    }

    gtk_timeout_add(30*1000,__DoAutoSaves,NULL);		/* Check for autosave every 30 seconds */

    args.argc = argc; args.argv = argv; args.recover = recover;
    gtk_timeout_add(100,ParseArgs,&args);
	/* Parse arguments within the main loop */

    gtk_main ();
return( 0 );
}
Example #26
0
int
main (int argc, char *argv[])
{
  int cnt;
  const char *p;
  char arg[128];
  
#ifdef __WIN32__
  HMODULE hModule;
  char *sBuffer;
  DWORD dWord;
  char *dirname;
  char *base_dir;
  char *pixmap_dir;
  char *locale_dir;
  
  // Init the path for the Windows version by getting the 
  // executable location.
  hModule = GetModuleHandle("skinedit.exe");
  sBuffer = (char *) malloc(4096 * sizeof(char));
  dWord = GetModuleFileName(hModule, sBuffer, 4096);
  dirname = g_dirname(sBuffer);
  base_dir = g_strconcat(dirname, "\\", NULL);
  g_free(dirname);
  free(sBuffer);
  
  pixmap_dir = g_strconcat(base_dir, "pixmaps\\", NULL);
  locale_dir = g_strconcat(base_dir, "locale\\", NULL);
#endif

#ifdef ENABLE_NLS
#ifndef __WIN32__
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#else
  bindtextdomain(PACKAGE, locale_dir);
  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

#ifndef __WIN32__
  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
#else
  add_pixmap_directory (pixmap_dir);
#endif

  signal(SIGINT, signal_handler);

  fprintf(stdout, _("SkinEdit v%s, (C) 2002-2003 Julien BLACHE <*****@*****.**>\n"), VERSION);
  fprintf(stdout, _("                  2004-2005 Romain Lievin <*****@*****.**>\n"));
  fprintf(stdout, "\n");
  fprintf(stdout, _("This program is free software; you can redistribute it and/or modify\n"));
  fprintf(stdout, _("it under the terms of the GNU General Public License as published by\n"));
  fprintf(stdout, _("the Free Software Foundation; version 2 of the License\n"));
  fprintf(stdout, _("This program is distributed in the hope that it will be useful,\n"));
  fprintf(stdout, _("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"));
  fprintf(stdout, _("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"));
  fprintf(stdout, _("GNU General Public License for more details.\n"));

  gtk_widget_show (main_wnd = create_main_window());

  sbar_print(_("Skinedit v%s -- Supported formats : TiEmu v2.00 (R/W), VTiv2.1 (R/W), VTiv2.5 (R/W)"), VERSION);

    // scan command line
    for (cnt = 1; cnt < argc; cnt++) {
      
      // get argument
      p = argv[cnt];
      if (*p == '-') {
	// argument
	p++;
      } else {
	// filename
	if(load_skin(p) == 0)
	  skin_infos.changed = 1;
      }
      
      strcpy(arg, p);
      
      if (strexact(arg, "-help") || strexact(arg, "h"))
	help();
      if (strexact(arg, "-version") || strexact(arg, "v"))
	exit(0);
    }
    
    gtk_main ();
    return 0;
}
Example #27
0
int
main (int argc, char *argv[])
{
    char printer_name[128];
    int mode = 0;

#ifdef ENABLE_NLS
    bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
#ifndef OLD_GTK
    /* changes for GTK2 */
    bind_textdomain_codeset(PACKAGE, "UTF-8");
#endif
    textdomain(PACKAGE);
#endif
    gtk_set_locale ();
    gtk_init (&argc, &argv);

    add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
#ifdef OLD_GTK
    /* changes for GTK2 */
    /* If it is necessary, "PACKAGE_SOURCE_DIR" is defined. */
    /* Example: add to configure.in                                */
    /*  dnl Set PACKAGE_SOURCE_DIR in config.h.                    */
    /*  packagesrcdir=`cd $srcdir && pwd`                          */
    /*  AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}") */
    add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");
#endif

    /*
     * The following code was added by Glade to create one of each component
     * (except popup menus), just so that you see something after building
     * the project. Delete any components that you don't want shown initially.
     */
    memset(printer_name, 0, sizeof(printer_name));
    mode = LaunchOption(argc, argv, printer_name);
    if(mode != -1) {
        UI_DEBUG("[%s]\n", printer_name);
        SigInit();
        g_status_window = CreateStatusWnd(printer_name, mode);
        if(g_status_window == NULL) {
            UI_DEBUG("Window Create Error\n");
            return -1;
        }
        gtk_widget_realize(UI_DIALOG(g_status_window)->window);

        switch(g_status_window->nIFVersion) {
        case CCPD_IF_VERSION_110:
            StartProcess2(mode);
            break;
        case CCPD_IF_VERSION_100:
            StartProcess(mode);
            break;
        default:
            break;
        }

        DisposeDialog(UI_DIALOG(g_status_window));
    }
    UI_DEBUG("Finish\n");

    return 0;
}
Example #28
0
GrmGui* gaborrg_maker_gui_new (MalibGtkDisplay** displays,
			       MalibBuffer* rgb2gray_buf,
			       MalibFilter* filter, MalicCVHaarDetectObj* haar_filter)
{
  GrmGui* gui;
  
  gui= malloc (sizeof (GrmGui));
  if (!(gui))
    g_error("memory error! in gaborrg_maker_gui_new()");
  memset (gui, 0, sizeof (GrmGui));

  /* gabor params set to gui */
  {
    int tmp_dirs[]= GABORRG_MAKER_DEFAULT_DIR_ARRAY;
    int tmp_rads[]= GABORRG_MAKER_DEFAULT_RAD_ARRAY;

    gui->displays= displays;
    gui->gray_buffer= rgb2gray_buf;
    gui->filter= filter;
    gui->haar_filter  = haar_filter;

    /*
    gui->gabor_dirs= malloc(sizeof(tmp_dirs));
    gui->gabor_radius= malloc(sizeof(tmp_rads));
    memcpy(gui->gabor_dirs, tmp_dirs, sizeof(tmp_dirs));
    memcpy(gui->gabor_radius, tmp_rads, sizeof(tmp_rads));
    */
    
    /* set number of malib_to_frames (dir * radius + 1)*/
    /* Fixme: forrow use DEFALT VALUE so rewrite to set from xml file */
    gui->num_tmp_malib_to_frames= GABOR_DIR_NUM * GABOR_RAD_NUM + 1; /* +1 for NULL */
    /* set parts names and num */
    /* Fixme: forrow use DEFAULT VALUE so rewrite to set from xml file */
    gaborrg_maker_set_parts_names_and_num_to_gui_from_default(gui);

    
    /* filtered data tmp buffers (use during display halt)*/
    gui->tmp_node_data=   NULL;
    gui->face_node_data=  NULL;
    /* filtered data stack (use after Enter button) */
    gui->face_node_data_stack= gaborrg_maker_face_node_data_stack_init();
  }
  /* setup ebgm params (jets too) */
  grm_ebgm_params_setup(gui);
  
  /* widget set to gui*/
  {
    GtkWidget * fixed1;
    /* generate all DIR and RAD of MalibGabor */
    gui->window= create_gaborrg_maker_window();
    
    fixed1= lookup_widget(gui->window, "fixed1");
    gui->statusbar1= lookup_widget(fixed1, "statusbar1");
  }
  /* create indicator gdk_pixmap */
  {
    GtkPixmap* tmp_gtk_pixmap;
    add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
    add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");

    tmp_gtk_pixmap= (GtkPixmap*)create_pixmap (gui->window, GABORRG_MAKER_INDICATOR_PIXMAP_NAME);
    gui->parts_button_indicator_pixmap= tmp_gtk_pixmap->pixmap;
    gui->parts_button_indicator_pixmap_mask= tmp_gtk_pixmap->mask;

    tmp_gtk_pixmap= (GtkPixmap*)create_pixmap (gui->window,
                                               GABORRG_MAKER_INDICATOR_DUMMY_PIXMAP_NAME);
    gui->parts_button_indicator_dummy_pixmap= tmp_gtk_pixmap->pixmap;
    gui->parts_button_indicator_dummy_pixmap_mask= tmp_gtk_pixmap->mask;
  }
  gaborrg_maker_gui_setup(gui, NULL);

  return gui;
}
Example #29
0
/*!
 * \brief The GTK GUI for the footprintwizard.
 *
 * \return 0 if successful.
 */
int
main
(
        int argc, /*!< : number of arguments.*/
        char *argv[] /*!< : array of argument variables.*/
)
{
        GtkWidget *pcb_gfpw;
        GtkWidget *about_dialog;
        gboolean debug = FALSE;
        /*!< Global for being verbose on debugging information. */
        gboolean silent = FALSE;
        /*!< Global for suppressing the logging of critical messages. */
        gboolean verbose = FALSE;
        /*!< Global for being verbose on logging of information. */
        gchar *fpw_filename;
        /*!< Filename of footprintwizard file. */
        gchar *footprint_filename = NULL;
        /*!< Filename of footprint file. */
        gchar *footprint_name = NULL;
        /*!< Name of the footprint. */
        int optc;
        /*!< Number of command line options. */

#ifdef ENABLE_NLS
        bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        textdomain (GETTEXT_PACKAGE);
#endif
        gtk_set_locale ();
        gtk_init (&argc, &argv);
        add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
        /* Find out how we are called today. */
        program_name = argv[0];
        /* Recognise long options. */
        static const struct option opts[] =
        {
                {"debug", no_argument, NULL, 'd'},
                {"help", no_argument, NULL, 'h'},
                {"version", no_argument, NULL, 'V'},
                {"verbose", no_argument, NULL, 'v'},
                {"quiet", no_argument, NULL, 'q'},
                {"silent", no_argument, NULL, 'q'},
                {"format", required_argument, NULL, 'f'},
                {"output", required_argument, NULL, 'o'},
                {0, 0, 0, 0}
        };
        while ((optc = getopt_long (argc, argv, "dhVvqqf:o:", opts, NULL)) != -1)
        {
                switch (optc)
                {
                        case 'd':
                                debug = TRUE;
                                break;
                        case 'h':
                                gfpw_print_usage ();
                                exit (EXIT_SUCCESS);
                        case 'V':
                                gfpw_print_version ();
                                exit (EXIT_SUCCESS);
                        case 'v':
                                verbose = TRUE;
                                break;
                        case 'q':
                                silent = TRUE;
                                verbose = FALSE; /* Just to be sure. */
                                break;
                        case 'f':
                                fpw_filename = strdup (optarg);
                                if (debug)
                                        fprintf (stderr, "fpw filename = %s\n", fpw_filename);
                                break;
                        case 'o':
                                footprint_name = strdup (optarg);
                                if (debug)
                                        fprintf (stderr, "footprint name = %s\n", footprint_name);
                                break;
                        case '?':
                                gfpw_print_usage ();
                                exit (EXIT_FAILURE);
                        default:
                                g_log ("", G_LOG_LEVEL_WARNING,
                                        _("unknown command line option encountered.\n"));
                                gfpw_print_usage ();
                                exit (EXIT_FAILURE);
                }
        }
        /*
         * The following code was added by Glade to create one of each
         * component (except popup menus), just so that you see something
         * after building the project.
         * Delete any components that you don't want shown initially.
         */
        /* Create and show the about dialog as a splash screen. */
        about_dialog = create_about_dialog ();
        gtk_widget_show (about_dialog);
        /* Now create the main dialog. */
        pcb_gfpw = create_pcb_gfpw ();
        /* Set the "Add license to footprint" checkbutton initially to
         * TRUE */
        GtkWidget *add_license_checkbutton = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "add_license_checkbutton");
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (add_license_checkbutton),
                TRUE);
        /* Set the initial state of the total pins and pads entry to
         * sensitive. The entry is to be used as a label for most packages
         * as the total amount of pins and pads can be caluculated.
         * However for some packages it might be needed to set a value here.
         */
        GtkWidget *number_total_pins_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "number_total_pins_entry");
        gtk_widget_set_sensitive (number_total_pins_entry, TRUE);
        GtkWidget *pin_pad_exceptions_button = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "pin_pad_exceptions_button");
        gtk_widget_set_sensitive (pin_pad_exceptions_button, FALSE);
        /* Set the initial state of the checkbutton for the thermal pad to false,
         * set the "length" entry for the thermal pad to insensitive,
         * set the "width" entry for the thermal pad to insensitive,
         * set the "clearance" entry for the thermal pad to insensitive,
         * and set the "solder mask clearance" entry for the thermal pad to insensitive.
         */
        GtkWidget *thermal_checkbutton = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "thermal_checkbutton");
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (thermal_checkbutton), FALSE);
        GtkWidget *thermal_nopaste_checkbutton = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "thermal_nopaste_checkbutton");
        gtk_widget_set_sensitive (GTK_WIDGET (thermal_nopaste_checkbutton), FALSE);
        GtkWidget *thermal_length_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "thermal_length_entry");
        gtk_widget_set_sensitive (thermal_length_entry, FALSE);
        GtkWidget *thermal_width_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "thermal_width_entry");
        gtk_widget_set_sensitive (thermal_width_entry, FALSE);
        GtkWidget *thermal_clearance_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "thermal_clearance_entry");
        gtk_widget_set_sensitive (thermal_clearance_entry, FALSE);
        GtkWidget *thermal_solder_mask_clearance_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "thermal_solder_mask_clearance_entry");
        gtk_widget_set_sensitive (thermal_solder_mask_clearance_entry, FALSE);
        /* Set the initial state of the checkbutton for the fiducial pads to
         * false, set the "fiducial pad diameter" entry to insensitive,
         * and set the "fiducial pad clearance" entry to insensitive,
         * and set the "fiducial pad solder mask clearance" entry to insensitive.
         */
        GtkWidget *fiducial_checkbutton = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "fiducial_checkbutton");
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fiducial_checkbutton), FALSE);
        GtkWidget *fiducial_pad_diameter_entry = lookup_widget
                (GTK_WIDGET (pcb_gfpw),
                "fiducial_pad_diameter_entry");
        gtk_widget_set_sensitive (fiducial_pad_diameter_entry, FALSE);
        GtkWidget *fiducial_pad_clearance_entry = lookup_widget
                (GTK_WIDGET (pcb_gfpw),
                "fiducial_pad_clearance_entry");
        gtk_widget_set_sensitive (fiducial_pad_clearance_entry, FALSE);
        GtkWidget *fiducial_pad_solder_mask_clearance_entry = lookup_widget
                (GTK_WIDGET (pcb_gfpw),
                "fiducial_pad_solder_mask_clearance_entry");
        gtk_widget_set_sensitive (fiducial_pad_solder_mask_clearance_entry,
                FALSE);
        /* Set the initial state of the checkbutton for the silkscreen to true,
         * set the "linewidth" entry for the silkscreen to sensitive.
         */
        GtkWidget *silkscreen_package_outline = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "silkscreen_package_outline_checkbutton");
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (silkscreen_package_outline), TRUE);
        GtkWidget *silkscreen_line_width_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "silkscreen_line_width_entry");
        gtk_widget_set_sensitive (silkscreen_line_width_entry, TRUE);
        /* Set the state of the check button for the courtyard to false,
         * set the "length" entry for the courtyard to insensitive,
         * set the "width" entry for the courtyard to insensitive,
         * set the "linewidth" entry for the courtyard to insensitive,
         * and set the "clearance to package" entry for the courtyard to
         * insensitive.
         */
        GtkWidget *courtyard_checkbutton = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "courtyard_checkbutton");
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (courtyard_checkbutton), FALSE);
        GtkWidget *courtyard_length_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "courtyard_length_entry");
        gtk_widget_set_sensitive (courtyard_length_entry, FALSE);
        GtkWidget *courtyard_width_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "courtyard_width_entry");
        gtk_widget_set_sensitive (courtyard_width_entry, FALSE);
        GtkWidget *courtyard_line_width_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "courtyard_line_width_entry");
        gtk_widget_set_sensitive (courtyard_line_width_entry, FALSE);
        GtkWidget *courtyard_clearance_with_package_entry = lookup_widget (GTK_WIDGET (pcb_gfpw),
                "courtyard_clearance_with_package_entry");
        gtk_widget_set_sensitive (courtyard_clearance_with_package_entry, FALSE);
        /* Set the initial state of the entries adjacent to the radiobuttons in
         * the notebook tab  "Heel & Toe goals".
         * These entries are for entering the C1, C2, G1, G2, Z1 and Z2
         * variables.
         */
        GtkWidget *C1_entry = lookup_widget (GTK_WIDGET (pcb_gfpw), "C1_entry");
        gtk_widget_set_sensitive (C1_entry, TRUE);
        GtkWidget *C2_entry = lookup_widget (GTK_WIDGET (pcb_gfpw), "C2_entry");
        gtk_widget_set_sensitive (C2_entry, TRUE);
        GtkWidget *G1_entry = lookup_widget (GTK_WIDGET (pcb_gfpw), "G1_entry");
        gtk_widget_set_sensitive (G1_entry, FALSE);
        GtkWidget *G2_entry = lookup_widget (GTK_WIDGET (pcb_gfpw), "G2_entry");
        gtk_widget_set_sensitive (G2_entry, FALSE);
        GtkWidget *Z1_entry = lookup_widget (GTK_WIDGET (pcb_gfpw), "Z1_entry");
        gtk_widget_set_sensitive (Z1_entry, FALSE);
        GtkWidget *Z2_entry = lookup_widget (GTK_WIDGET (pcb_gfpw), "Z2_entry");
        gtk_widget_set_sensitive (Z2_entry, FALSE);
        /* Now show the main dialog. */
        gtk_widget_show (pcb_gfpw);
        /* Now enter the main loop */
        gtk_main ();
        return 0;
}
Example #30
0
int main(int argc, char *argv[]) {
  extern GtkWidget *wndMain;
  int i;
  extern guint message_id;
  GtkWidget *output;
  GtkTextBuffer *outputbuf;

  gtk_set_locale();
  gtk_init(&argc, &argv);

  add_pixmap_directory(PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");

  /* initialize the message id */
  message_id = 0;

  /* locate the hydra binary */
  HYDRA_BIN = NULL;
  for (i = 0; i < argc - 1; i++) {
    if (!strcmp(argv[i], "--hydra-path")) {
      HYDRA_BIN = argv[i + 1];
      break;
    }
  }

  if ((HYDRA_BIN != NULL) && (g_file_test(HYDRA_BIN, G_FILE_TEST_IS_EXECUTABLE))) {
    /* just for obfuscation *g* */
  } else if (g_file_test(hydra_path1, G_FILE_TEST_IS_EXECUTABLE)) {
    HYDRA_BIN = hydra_path1;
  } else if (g_file_test(hydra_path2, G_FILE_TEST_IS_EXECUTABLE)) {
    HYDRA_BIN = hydra_path2;
  } else if (g_file_test(hydra_path3, G_FILE_TEST_IS_EXECUTABLE)) {
    HYDRA_BIN = hydra_path3;
  } else {
    g_error("Please tell me where hydra is, use --hydra-path\n");
    return -1;
  }

  /* create window and show it */
  wndMain = create_wndMain();
  gtk_widget_show(wndMain);


  /* if we cant use the new cool file chooser, the save button gets disabled */
#ifndef GTK_TYPE_FILE_CHOOSER
  GtkWidget *btnSave;

  btnSave = lookup_widget(GTK_WIDGET(wndMain), "btnSave");
  gtk_widget_set_sensitive(btnSave, FALSE);
#endif


  /* update the statusbar every now and then */
  g_timeout_add(600, update_statusbar, NULL);

  /* we want bold text in the output window */
  output = lookup_widget(GTK_WIDGET(wndMain), "txtOutput");
  outputbuf = gtk_text_view_get_buffer((GtkTextView *) output);
  gtk_text_buffer_create_tag(outputbuf, "bold", "weight", PANGO_WEIGHT_BOLD, NULL);

  /* he ho, lets go! */
  gtk_main();
  return 0;
}