Example #1
0
int startwin_puts(const char *str)
{
	GtkWidget *textview;
	GtkTextBuffer *textbuffer;
	GtkTextIter enditer;
	GtkTextMark *mark;
	const char *aptr, *bptr;

	if (!gtkenabled || !str) return 0;
	if (!startwin) return 1;
	if (!(textview = lookup_widget(startwin, "messagestext"))) return -1;
	textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));

	gtk_text_buffer_get_end_iter(textbuffer, &enditer);
	for (aptr = bptr = str; *aptr != 0; ) {
		switch (*bptr) {
			case '\b':
				if (bptr > aptr)
					gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
#if GTK_CHECK_VERSION(2,6,0)
				gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
#else
				{
				GtkTextIter iter2 = enditer;
				gtk_text_iter_backward_cursor_position(&iter2);
				//FIXME: this seems be deleting one too many chars somewhere!
				if (!gtk_text_iter_equal(&iter2, &enditer))
					gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE);
				}
#endif
				aptr = ++bptr;
				break;
			case 0:
				if (bptr > aptr)
					gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
				aptr = bptr;
				break;
			case '\r':	// FIXME
			default:
				bptr++;
				break;
		}
	}

	mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
	gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0);
	gtk_text_buffer_delete_mark(textbuffer, mark);

	return 0;
}
Example #2
0
void draw_graphcuts()
{
  int x = -1;
  int y = -1;
  int z = -1;

  glPushMatrix();

  if(flag_draw_XY)
    {
      GtkSpinButton* layer_XY_spin=GTK_SPIN_BUTTON(lookup_widget(GTK_WIDGET(ascEditor),"layer_XY_spin"));
      z = gtk_spin_button_get_value_as_int(layer_XY_spin);
      //glTranslatef(0.0f,0.0f,-0.2f);
    }
  else
  if(flag_draw_XZ)
    {
      GtkSpinButton* layer_XZ_spin=GTK_SPIN_BUTTON(lookup_widget(GTK_WIDGET(ascEditor),"layer_XZ_spin"));
      y = gtk_spin_button_get_value_as_int(layer_XZ_spin);
    }
  else
  if(flag_draw_YZ)
    {
      GtkSpinButton* layer_YZ_spin=GTK_SPIN_BUTTON(lookup_widget(GTK_WIDGET(ascEditor),"layer_YZ_spin"));
      x = gtk_spin_button_get_value_as_int(layer_YZ_spin);
    }


  for(vector< GraphCut<Point>* >::iterator itGraphCut = lGraphCuts.begin();
      itGraphCut != lGraphCuts.end(); itGraphCut++)
    {
      (*itGraphCut)->draw(x,y,z);
      (*itGraphCut)->drawSegmentation(x,y,z);
    }

  glPopMatrix();
}
Example #3
0
gboolean
on_gems_quit (GtkWidget * UNUSED(widget), GdkEvent * UNUSED(event), gpointer UNUSED(user_data))
{
    char *x;

    x = (char *)malloc (1024);
    sprintf (x, "%d",
	GTK_PANED (lookup_widget (gems, "hpaned1"))->handle_xpos + 2);
    db_pref_set ("GNOME_o_hpaned_pos", x);
    sprintf (x, "%d",
	GTK_PANED (lookup_widget (gems, "vpaned1"))->handle_ypos + 2);
    db_pref_set ("GNOME_o_vpaned_pos", x);
    sprintf (x, "%d", GTK_WIDGET (gems)->allocation.width);
    db_pref_set ("GNOME_o_gems_width", x);
    sprintf (x, "%d", GTK_WIDGET (gems)->allocation.height);
    db_pref_set ("GNOME_o_gems_height", x);
    sprintf (x, "%d", GTK_WIDGET (gems)->allocation.x);
    db_pref_set ("GNOME_o_gems_xpos", x);
    sprintf (x, "%d", GTK_WIDGET (gems)->allocation.y);
    db_pref_set ("GNOME_o_gems_ypos", x);
    sprintf (x, "%d", get_mboxlistbehavior());
    db_pref_set ("mboxdefaultaction", x);
    sprintf (x, "%d",
	GTK_CLIST (&
	    ((GTK_CTREE (lookup_widget (gems, "mailbox")))->
		clist))->column[0].width);
    db_pref_set ("GNOME_o_maillist_col1", x);
    sprintf (x, "%d",
	GTK_CLIST (&
	    ((GTK_CTREE (lookup_widget (gems, "mailbox")))->
		clist))->column[1].width);
    db_pref_set ("GNOME_o_maillist_col2", x);

    free (x);
    gtk_main_quit ();
    return FALSE;
}
Example #4
0
static void memorywin_new(running_machine &machine)
{
	win_i *mem;
	int item; //, cursel;
	device_t *curcpu = debug_cpu_get_visible_cpu(machine);
	GtkComboBox *       zone_w;

	mem = add_win_i(machine, WIN_TYPE_MEMORY);
	mem->win = create_memorywin();

	mem->views[0] = DVIEW(lookup_widget(mem->win, "memoryview"));
	dview_set_debug_view(mem->views[0], machine, DVT_MEMORY);

	zone_w   = GTK_COMBO_BOX(lookup_widget(mem->win, "zone"));

	edit_init(&mem->ed, lookup_widget(mem->win, "edit"), "0", 1, memorywin_process_string, mem);

	downcast<debug_view_memory *>(mem->views[0]->view)->set_expression("0");

	// populate the combobox
//  cursel = 0;
	item = 0;

	for (const debug_view_source *source = mem->views[0]->view->source_list().head(); source != NULL; source = source->next())
	{
		gtk_combo_box_append_text(zone_w, source->name());
		item++;
	}
	const debug_view_source *source = mem->views[0]->view->source_list().match_device(curcpu);
	gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().index(*source));
	mem->views[0]->view->set_source(*source);

	g_signal_connect(zone_w, "changed", G_CALLBACK(memorywin_zone_changed), mem);

	g_signal_connect(mem->win, "destroy", G_CALLBACK(memorywin_destroy), mem);
	gtk_widget_show_all(mem->win);
}
Example #5
0
void gaborrg_maker_gui_setup (GrmGui* gui, MalibObject* handler)
{
  MalibGtkDisplay** displays= gui->displays;

  /* window 1 */
  {
    GtkWidget * fixed1, * viewport2, * drawingarea1, * malib_drawingarea;
    gtk_widget_show(gui->window);

    gtk_signal_connect(GTK_OBJECT (gui->window), "delete_event",
		       GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

    fixed1=       lookup_widget(gui->window, "fixed1");
    viewport2=    lookup_widget(fixed1, "viewport2");
    drawingarea1= lookup_widget(viewport2, "drawingarea1");
    malib_drawingarea= GTK_WIDGET (malib_gtkdisplay_get_drawarea (displays[GRM_DEFAULT_DISPLAY_NUM]));
      
    gtk_container_remove(GTK_CONTAINER (viewport2), drawingarea1);
    
    gtk_container_add (GTK_CONTAINER (viewport2), malib_drawingarea);
    gtk_signal_connect (GTK_OBJECT (viewport2), "button_press_event",
			GTK_SIGNAL_FUNC (drawingarea1_clicked), gui);
    
    gtk_widget_ref(malib_drawingarea);
    gtk_object_set_data_full (GTK_OBJECT(gui->window), "drawingarea1", malib_drawingarea,
			      (GtkDestroyNotify) gtk_widget_unref);
    
    gtk_widget_set_usize(viewport2, BTTV_DEFAULT_WIDTH,BTTV_DEFAULT_HEIGHT);
    
    /* setup right scrollwindow*/
    right_scroll_window_setup(gui);
    gaborrg_maker_file_io_gui_setup(gui);
    /*gtk_button_new();*/
  }
  
  return ;
}
Example #6
0
static int
validate_command_edit () {
    const char *text;
    char message[256] = "";
    int valid = 1;

    text = gtk_entry_get_text(GTK_ENTRY(lookup_widget(edit_dlg, "name_entry")));
    if(is_empty(text) || name_exists(text, current_action)) {
        strcat(message, _("ID must be non-empty and unique.\n"));
        valid = 0;
    }

    text = gtk_entry_get_text(GTK_ENTRY(lookup_widget(edit_dlg, "title_entry")));
    if(is_empty(text)) {
        strcat(message, _("Title must be non-empty.\n"));
        valid = 0;
    }

    text = gtk_entry_get_text(GTK_ENTRY(lookup_widget(edit_dlg, "cmd_entry")));
    if(is_empty(text)) {
        strcat(message, _("Shell Command must be non-empty.\n"));
        valid = 0;
    }

    if(!valid) {
        GtkWidget *invalid_dlg = gtk_message_dialog_new (GTK_WINDOW(conf_dlg), GTK_DIALOG_MODAL,
                                                         GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
                                                         _("Invalid Values"));
        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (invalid_dlg),
                                                  "%s", message);
        gtk_window_set_transient_for(GTK_WINDOW (invalid_dlg), GTK_WINDOW (conf_dlg));
        gtk_window_set_title (GTK_WINDOW (invalid_dlg), _("Invalid Values"));
        gtk_dialog_run (GTK_DIALOG (invalid_dlg));
        gtk_widget_destroy(invalid_dlg);
    }
    return valid;
}
Example #7
0
/*!
  \brief hides a tab
  \param widget is the widget clicked to get this to come up
  \param data is the index to the tab to hide
  \return TRUE on success
  */
G_MODULE_EXPORT gboolean hide_tab(GtkWidget *widget, gpointer data)
{
	GtkWidget *child;
	GtkWidget *label;
	GtkWidget *notebook;
	GtkWidget *item = NULL;
	GladeXML *main_xml = NULL;
	extern GdkColor red;
	extern GdkColor black;
	gint index = (GINT)data;
	gint total = (GINT)DATA_GET(global_data,"notebook_rows");
	gint i = 0;
	gboolean hidden = FALSE;
	gint *hidden_list;

	ENTER();
	main_xml = (GladeXML *)DATA_GET(global_data,"main_xml");
	hidden_list = (gboolean *)DATA_GET(global_data,"hidden_list");
	notebook = glade_xml_get_widget(main_xml,"toplevel_notebook");

	child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),index);
	label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook),child);

	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
	{
		gtk_widget_hide(child);
		gtk_widget_hide(label);
		hidden_list[index] = TRUE;
	}
	else
	{
		gtk_widget_show(child);
		gtk_widget_show(label);
		hidden_list[index] = FALSE;
	}

	for (i=0;i<total;i++)
	{
		if (hidden_list[i])
			hidden = TRUE;
	}
	item = lookup_widget("show_tab_visibility_menuitem");
	if (hidden)
		 gtk_widget_modify_text(gtk_bin_get_child(GTK_BIN(item)),GTK_STATE_NORMAL,&red);
	else
		 gtk_widget_modify_text(gtk_bin_get_child(GTK_BIN(item)),GTK_STATE_NORMAL,&black);
	EXIT();
	return TRUE;
}
Example #8
0
void on_message_treeview_cursor_changed( GtkWidget *widget,
				     gpointer user_data)
{
  GtkTreeView *message_tree = (GtkTreeView *)lookup_widget( "message_treeview" );
  GtkTreeModel *model = gtk_tree_view_get_model( message_tree );

/* TODO - question: no gtk_tree_iter_new() ??? */
  GtkTreeIter iter;

  GtkTreeSelection *selection = gtk_tree_view_get_selection( message_tree );
  gtk_tree_selection_get_selected( selection, NULL, &iter );

  gint ident;

  gtk_tree_model_get(model, &iter, COL_IDENT, &ident, -1);
  if( ident >= 0 )
    message_reader_show_body( widget, user_data, ident-1 );



/*

  GwpMessages *messages = (GwpMessages *)
    g_object_get_data(G_OBJECT(lookup_widget("reader")), "message_instance");
  GtkTreeView *message_tree = (GtkTreeView *)lookup_widget( "message_treeview" );
  GtkTreeModel *model = gtk_tree_view_get_model( message_tree );
  GtkTreeIter iter;

  GtkTreeSelection *selection = gtk_tree_view_get_selection( message_tree );
  gtk_tree_selection_get_selected( selection, NULL, &iter );

//  gtk_tree_model_iter_next( model, &iter );
//  gtk_tree_model_
//  gtk_
g_message( "### 1: '%s'", gtk_tree_model_get_string_from_iter( model, &iter ) );
gtk_tree_model_iter_next( model, &iter );
g_message( "### 2: '%s'", gtk_tree_model_get_string_from_iter( model, &iter ) );

//  gint ident;

//  gtk_tree_model_get(model, &iter, COL_IDENT, &ident, -1);
//  if( ident >= 0 )
//    message_reader_show_body( widget, user_data, ident-1 );




*/
}
Example #9
0
void
show_window6()
{
	GladeXML *gladexml;
	GtkWidget *dialog;
	GtkWidget *entry14, *entry15, *combobox2;

	double lat, lon, lat_deg, lon_deg;
	char buf[64];

	gladexml = glade_xml_new (gladefile, "window6", GETTEXT_PACKAGE);
	glade_xml_signal_autoconnect (gladexml);
	dialog = glade_xml_get_widget (gladexml, "window6");
	g_signal_connect_swapped (dialog, "destroy",
				  G_CALLBACK (g_object_unref), gladexml);
	gtk_widget_show(dialog);
	new_dialog = TRUE;
	
	
	lat = pixel2lat(global_zoom, global_y+mouse_y);
	lon = pixel2lon(global_zoom, global_x+mouse_x);
	lat_deg = rad2deg(lat);
	lon_deg = rad2deg(lon);
	entry14 = lookup_widget(dialog, "entry14");
	entry15 = lookup_widget(dialog, "entry15");
	
	g_sprintf(buf, "%f", lat_deg);
	gtk_entry_set_text(GTK_ENTRY(entry14), buf);
	g_sprintf(buf, "%f", lon_deg);
	gtk_entry_set_text(GTK_ENTRY(entry15), buf);
	
	
	combobox2 = lookup_widget(dialog, "combobox2");
	gtk_combo_box_set_active(GTK_COMBO_BOX(combobox2), 0);

}
Example #10
0
void
on_ctrlButton_clicked              (GtkButton *__button, gpointer __user_data)
{
  int i;
  char name[64];
  for (i=0; i<7; i++)
    {
      snprintf (name, BUF_SIZE (name), "ctrlButton_%d", i);
      if (__button==(GtkButton*)lookup_widget (main_window, name))
        {
          exec_button_command (i);
          break;
        }
    }
}
Example #11
0
gboolean
on_weight_hruler_motion_notify_event   (GtkWidget       *widget,
                                        GdkEventMotion  *event,
                                        gpointer         user_data)
{
	GtkWidget *weight_hruler = lookup_widget( GTK_WIDGET( widget ), "weight_ahruler" );
	
	noisew = 1;//表示每次一次重新放重,其雜訊重新開始
	
	gtk_ruler_get_range( GTK_RULER( weight_adjuster ), NULL, NULL, &scale_value , NULL );
	
	adcur = (int)scale_value;
	
	return FALSE;
}
Example #12
0
void
on_toolbar_rule_clicked (GtkButton * UNUSED(button), gpointer UNUSED(user_data))
{
    GtkWidget *r;
    GList *gl = NULL;
    mboxs **mboxlist;
    int x;

    r = create_Rules ();
    gtk_widget_show (r);
    gtk_paned_set_position (GTK_PANED (lookup_widget (r, "hpaned2")), 150);
    gnome_o_put_the_damn_rules_in_the_box (r);
    mboxlist = (mboxs **) db_read_mboxlist ();
    x = 0;
    while (mboxlist[x] != NULL)
	gl = g_list_append (gl, mboxlist[x++]->name);
    gtk_combo_set_popdown_strings (GTK_COMBO (lookup_widget (r, "combo2")),
	gl);
    gtk_signal_connect (GTK_OBJECT
	(gtk_option_menu_get_menu
	    (GTK_OPTION_MENU
		(lookup_widget (r, "optionmenu2")))),
	"focus_out_event", face_gnome_o_rule_setpiece, NULL);
}
Example #13
0
void plugins_show_window(PluginType plugin_type)
{
  gchar *heading;

  GtkTreeViewColumn *column;
  switch(plugin_type) {
    case PLUGIN_TYPE_IMPORT :
      heading=g_strdup((gchar *)_("Import Plugins"));
      plugins_liststore=plugins_import_liststore;
      break;
    case PLUGIN_TYPE_EXPORT :
      heading=g_strdup((gchar *)_("Export Plugins"));
      plugins_liststore=plugins_export_liststore;
      break;
    case PLUGIN_TYPE_DOWNLOAD :
      heading=g_strdup((gchar *)_("Download Plugins"));
      plugins_liststore=plugins_download_liststore;
      break;
    case PLUGIN_TYPE_GENERAL :
      heading=g_strdup((gchar *)_("General Plugins"));
      plugins_liststore=plugins_general_liststore;
      break;
    }
  plugins_window=GTK_WIDGET(create_plugins_window());
  column=gtk_tree_view_column_new_with_attributes(heading,gtk_cell_renderer_text_new(),"text",PLUGIN_COL_DESCRIPTION,NULL);
  g_free(heading);
  widget_plugins_list=GTK_WIDGET(lookup_widget(GTK_WIDGET(plugins_window),"pluginslist"));
  gtk_tree_view_append_column(GTK_TREE_VIEW(widget_plugins_list),column);
  gtk_tree_view_column_set_sort_column_id(column, PLUGIN_COL_DESCRIPTION);
  gtk_tree_view_set_model(GTK_TREE_VIEW(widget_plugins_list),GTK_TREE_MODEL(plugins_liststore));
  gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget_plugins_list),gtk_tree_path_new_first(),NULL,FALSE);
  gtk_window_set_transient_for(GTK_WINDOW(plugins_window),GTK_WINDOW(main_window));
  gtk_widget_show(plugins_window);
  if(!gtk_tree_model_iter_n_children(GTK_TREE_MODEL(plugins_liststore),NULL))
    gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(GTK_WIDGET(plugins_window),"plugins_ok_btn")),FALSE);
}
Example #14
0
gboolean
on_metalist_button_press_event         (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{
    if (event->button == 3) {
        GtkWidget *menu = create_trkproperties_popup_menu ();
        if (numtracks != 1) {
            gtk_widget_set_sensitive (lookup_widget (menu, "trkproperties_edit"), FALSE);
        }
        gtk_menu_attach_to_widget (GTK_MENU (menu), GTK_WIDGET (widget), NULL);
        gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, gtk_get_current_event_time());
    }
    return FALSE;
}
Example #15
0
static void game_get_options(GtkMenuItem * menuitem, gpointer user_data)
{
	GtkWidget *dialog;
	GtkWidget *ok;

	dialog = create_options_dialog(back_color, last_color);
	gtk_widget_show_all(dialog);
	ok = lookup_widget(dialog, "ok_button");
	g_signal_connect(GTK_OBJECT(ok), "clicked",
			 GTK_SIGNAL_FUNC(update_options), dialog);
	g_signal_connect_data(ok, "clicked",
			      GTK_SIGNAL_FUNC(gtk_widget_destroy),
			      dialog, NULL,
			      G_CONNECT_SWAPPED | G_CONNECT_AFTER);
}
/*
 	\fn getFilterFromSelection
	\brief returns the tag of the selected filter
*/
VF_FILTERS getFilterFromSelection (void)
{
    uint32_t sel = 0;
	uint8_t ret = 0;
    VF_FILTERS tag = VF_INVALID;
    // 1- identify the current tab/treeview we are in
    int page = gtk_notebook_get_current_page(GTK_NOTEBOOK(lookup_widget(dialog,"notebook1")));
    // then get the selection
    page++;
    if ((ret = getSelectionNumber (max, trees[page], stores[page], &sel)))
	{
        tag = filterCategories[page-1][sel]->tag;
	}
    return tag;
}
gboolean
on_dialog_azel_graph_delete_event      (GtkWidget       *widget,
                                        GdkEvent        *event,
                                        gpointer         user_data)
{
  GtkWidget *mywidget;


  gtk_widget_hide( GTK_WIDGET( dialog_azel_graph ) );
  mywidget=lookup_widget( mainwindow, "bt_azelgraph" );
  gtk_widget_set_sensitive( mywidget, TRUE );
  azelgraph=FALSE;

  return TRUE;
}
Example #18
0
G_MODULE_EXPORT gboolean
on_window_contract_delete_event        (GtkWidget       *widget,
                                        GdkEvent        *event,
                                        gpointer         user_data)
{
#ifdef DEBUG
    printf("on_window_contract_delete_event\n");
#endif


    if(GTK_WIDGET_IS_SENSITIVE(lookup_widget(window.contract, "button_contract_cancel")))
	window_destroy(&window.contract);    

    return TRUE;
}
Example #19
0
void
gtk_c_on_menu_actions_list_attacks_activate (GtkMenuItem *menuitem, gpointer user_data)
{
   GtkWidget *window;
   GtkWidget *notebook;
   struct gtk_s_helper *helper;
   u_int8_t mode;

   helper = (struct gtk_s_helper *)user_data;
   notebook = lookup_widget(GTK_WIDGET(menuitem), "main_vhv2_notebook");
   mode = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));

   window = gtk_i_create_listattacksdialog(helper->node);
   gtk_widget_show(window);
}
Example #20
0
void on_remove_address_clicked(GtkButton *button,gpointer user_data)
{
	GtkTreeSelection *select;
	GtkTreeIter iter;
	GtkTreeModel *model;
	GtkWidget *address_list=lookup_widget(gtk_widget_get_toplevel(GTK_WIDGET(button)),"address_list");
	select = gtk_tree_view_get_selection (GTK_TREE_VIEW (address_list));
	if (gtk_tree_selection_get_selected (select, &model, &iter))
	{
		LinphoneFriend *lf=NULL;
		gtk_tree_model_get(model,&iter,FRIEND_REFERENCE,&lf,-1);
		linphone_core_remove_friend(get_core(),lf);
		gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
	}
}
void UI_focusAfterActivate(GtkMenuItem * menuitem, gpointer user_data)
{
	// return focus to window once Enter has been pressed
	UNUSED_ARG(menuitem);
    Action act;
    uint32_t aint;
    if(update_ui) return; // no event sent

    aint = (long int) user_data;
    act = (Action) aint;

	HandleAction(act);

	gtk_widget_grab_focus(lookup_widget(guiRootWindow, "menuBar"));
}
Example #22
0
void on_game_mgr_btn_unpack_clicked (GtkWidget *widget,
				     gpointer user_data)
{
  gint *race;
  gchar *game_dir;
  GtkTreeView *race_l = (GtkTreeView *) 
    lookup_widget("game_mgr_properties_race_list");

  race = (gint *) g_object_get_data(G_OBJECT(race_l),
				    "race_number");

  game_dir = 
    gtk_file_chooser_get_current_folder ((GtkFileChooser *)
					 lookup_widget("game_mgr_game_dir"));
  /* Unpack this game */
  vp_unpack(game_dir, *race);

  /* Disable button if all ok */
  if(! vp_can_unpack(game_dir, *race)) {
    GtkWidget *btn_unpack =
      lookup_widget("game_mgr_btn_unpack");
    gtk_widget_set_sensitive(btn_unpack, FALSE);    
  }
}
Example #23
0
void
on_play_button_clicked                 (GtkButton       *button,
                                        gpointer         user_data)
{
  GtkWidget * levelfile_textentry  = lookup_widget(GTK_WIDGET(button), "levelfile_textentry");
  GtkWidget * generate_level_radio = lookup_widget(GTK_WIDGET(button), "generate_level_radio");
  char * szFileName = (char *)gtk_entry_get_text(GTK_ENTRY(levelfile_textentry));
  char szTmp[525] = {0};

  /* so the executable will use our settings */
  write_bomns_rc();
  
  /* should we generate random level... */
  if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(generate_level_radio)))
    sprintf(szTmp, "bomns");

  /* ...or load level from a file */
  else
    sprintf(szTmp, "bomns %s", szFileName);

  /*g_free(szFileName);  causing crashes? */
  fprintf(stderr, "Launching bomns...\n");
  system(szTmp);
}
Example #24
0
/* +-----------------------------------+
 * | Help Menu Related Functions       |
 * +-----------------------------------+ */
void
on_menu_help_about_activate            (GtkMenuItem    *menuitem,
                                        gpointer        user_data)
{
    static char buf[1024];
    GtkWidget *label;

    if (!about_window)
    {
        about_window = create_about_window();

        // set version in window
        snprintf(buf, 1023, _("GOPchop %s (%s)"), VERSION, __DATE__);
        label = GTK_WIDGET(lookup_widget(GTK_WIDGET(about_window),
                                         "about_label_version"));
        gtk_label_set_text(GTK_LABEL(label), buf);

        label = GTK_WIDGET(lookup_widget(GTK_WIDGET(about_window),
                                         "about_label_cvsid"));
        gtk_label_set_text(GTK_LABEL(label), GOPchop_cvsid);
    }

    gtk_widget_show(about_window);
}
Example #25
0
void
on_menu_options_preferences_activate   (GtkMenuItem    *menuitem,
                                        gpointer        user_data)
{
    GtkToggleButton *button;
    GtkCombo        *combo;
    GtkRange        *range;
    GtkSpinButton   *spinner;
    GList           *items;
    int i;
    vo_driver_t const *drivers;
    
    items = NULL;

    if( !preferences_window ) {
        preferences_window = create_preferences_window();
    }

        /* set the combo box up with the correct values. */
        combo = GTK_COMBO(lookup_widget(GTK_WIDGET(preferences_window), "video_output_driver_combo" ));
        gchar * vidpref = NULL;
        drivers = vo_drivers();
        for( i = 0; drivers[i].name; i++ ) {
            items = g_list_append(items, drivers[i].name);

            // while looking through the list of available video drivers,
            // the prefered driver is xv2, followed by xv, and finally x11.
            // If the user hasn't selected one, this one will be used.
            if ( !strcmp(drivers[i].name,"xv2") ||
                 (!vidpref && !strcmp(drivers[i].name,"xv"))) {
                if (vidpref) free(vidpref);
                vidpref=g_strdup(drivers[i].name);
            }
        }
        if (!vidpref) vidpref=g_strdup("x11");

        gtk_combo_set_popdown_strings(combo, items);

        if( !options.video_driver_ptr ) options.video_driver_ptr = vidpref;
        else                            if (vidpref) free(vidpref);

        gtk_entry_set_text(GTK_ENTRY(combo->entry),
                           (const gchar*)options.video_driver_ptr);

    handle_simple_preferences(true);

    gtk_widget_show(preferences_window);
}
Example #26
0
void
change_key_program_user (	GtkWidget		*widget,
				char			*label_string,
				KEY_SETTINGS_LIST	*key_settings_list,
				char			*program_user        )
/*
input:
	widget			- This widget must be in the same tree a the widget from 
				  which the name is equal to label_string
	label_string		- This is the name of a label (widget) which contains the
				  name of the key to change the program_user element from
	key_settings_list	- A list containing all keys, of the current keyboard, with
				  their settings
	program_user	- The program_user element of the specified key will be changed to
			  this string
output:
	key_settings	- A list containing all keys, of the current keyboard, with their
			  settings. 
returns:
	-
description:
	This function changes the program_user (not the input variable) element of a key,
	in the key_settings list, to program_user (the input_variable). label_string is
	the name of a label (widget) which contains the name of the key to change. widget
	must be in the same tree as this label.
*/
{
	char *key_name;
	KEY_SETTINGS *selected_key;
	GtkWidget *key_name_label;

	key_name_label = lookup_widget(GTK_WIDGET(widget), label_string);
	if (key_name_label)
	{
		/* Get the name of the selected key */
		gtk_label_get (GTK_LABEL(key_name_label), &key_name);
		if (*key_name) /* If a listitem was selected */
		{
			/* Select the key in the linked list */
			selected_key = ksl_find_key( key_settings_list, key_name );
			if (selected_key) /* If the selected key exists */
			{
				/* Update the key settings */
				ks_set_program_user (selected_key, program_user);
			}
		}
	}
}
Example #27
0
File: pga.c Project: bert/pcb-fpw
/*!
 * \brief Set GUI constraints for the PGA package type.
 *
 * This function is only to be compiled for GUI targets.
 *
 * \return \c EXIT_SUCCESS when the function is completed.
 */
int
pga_set_gui_constraints ()
{
        /* Widgets on tab "Footprint" */
        GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
                "package_is_radial_checkbutton");
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
        gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);

        /* Widgets on tab "Pins/Pads" */
        GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
                "count_x_entry");
        gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
        gtk_widget_set_sensitive (count_x_entry, FALSE);
        GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
                "count_y_entry");
        gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
        gtk_widget_set_sensitive (count_y_entry, FALSE);
        GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
                "number_1_position_entry");
        gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), 1);
        gtk_widget_set_sensitive (number_1_position_entry, FALSE);
        GtkWidget *pin_pad_exceptions_button = lookup_widget (GTK_WIDGET (widget),
                "pin_pad_exceptions_button");
        gtk_widget_set_sensitive (pin_pad_exceptions_button, TRUE);
        GtkWidget *pad_shape_entry = lookup_widget (GTK_WIDGET (widget),
                "pad_shape_entry");
        gtk_combo_box_set_active (GTK_COMBO_BOX (pad_shape_entry), 1);
        gtk_widget_set_sensitive (pad_shape_entry, FALSE);
        GtkWidget *pad_length_entry = lookup_widget (GTK_WIDGET (widget),
                "pad_length_entry");
        gtk_entry_set_text (GTK_ENTRY (pad_length_entry), "");
        gtk_widget_set_sensitive (pad_length_entry, FALSE);
        GtkWidget *pad_width_entry = lookup_widget (GTK_WIDGET (widget),
                "pad_width_entry");
        gtk_entry_set_text (GTK_ENTRY (pad_width_entry), "");
        gtk_widget_set_sensitive (pad_width_entry, FALSE);

        /* Widgets on tab "Thermal Pad" */
        gui_constraints_disable_thermal_tab_widgets (widget);

        /* Widgets on tab "Heel & Toe goals" */
        gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
        return (EXIT_SUCCESS);
}
Example #28
0
void
on_ok_button_rom_path_clicked          (GtkButton       *button,
                                        gpointer         user_data)
{
	GtkEntry* temp_entry;
	
	gtk_widget_hide(fileselector_rom_path);
	strcpy (initial_path, gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fileselector_rom_path)));
	
	get_directory_from_filename(initial_path);
	
//	if (strrchr(initial_path, '/') != NULL)
//		*strrchr(initial_path, '/') = 0;
	temp_entry = (GtkEntry*)lookup_widget(general_settings_window, "entry_rom_basedir");
	gtk_entry_set_text(temp_entry, initial_path);
}
Example #29
0
void
on_edit_button_clicked(GtkButton *button, gpointer user_data) {
    GtkTreeView *treeview = GTK_TREE_VIEW(lookup_widget(conf_dlg, "command_treeview"));
    GtkTreeModel *treemodel = gtk_tree_view_get_model(treeview);
    GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
    GtkTreeIter iter;
    if(gtk_tree_selection_get_selected(selection, &treemodel, &iter)) {
        gtk_tree_model_get(treemodel, &iter, COL_META, &current_action, -1);
        edit_dlg = create_edit_dlg();
        // Set text fields
        gtk_entry_set_text(
            GTK_ENTRY(lookup_widget(edit_dlg, "name_entry")),
            current_action->parent.name);
        gtk_entry_set_text(
            GTK_ENTRY(lookup_widget(edit_dlg, "title_entry")),
            current_action->parent.title);
        gtk_entry_set_text(
            GTK_ENTRY(lookup_widget(edit_dlg, "cmd_entry")),
            current_action->shcommand);

        // Set check boxes
        gtk_toggle_button_set_active(
            GTK_TOGGLE_BUTTON(lookup_widget(edit_dlg, "single_check")),
            current_action->parent.flags & DB_ACTION_SINGLE_TRACK);
        gtk_toggle_button_set_active(
            GTK_TOGGLE_BUTTON(lookup_widget(edit_dlg, "multiple_check")),
            current_action->parent.flags & DB_ACTION_MULTIPLE_TRACKS);
        gtk_toggle_button_set_active(
            GTK_TOGGLE_BUTTON(lookup_widget(edit_dlg, "local_check")),
            current_action->shx_flags & SHX_ACTION_LOCAL_ONLY);
        gtk_toggle_button_set_active(
            GTK_TOGGLE_BUTTON(lookup_widget(edit_dlg, "remote_check")),
            current_action->shx_flags & SHX_ACTION_REMOTE_ONLY);
        gtk_toggle_button_set_active(
            GTK_TOGGLE_BUTTON(lookup_widget(edit_dlg, "common_check")),
            current_action->parent.flags & DB_ACTION_COMMON);

        gtk_widget_show(edit_dlg);
    }
}
Example #30
0
void on_save_entry_changed (GtkEditable *editable, gpointer user_data)
{
	GtkWidget *button;
	gchar     *text;
	
	button = lookup_widget (savedialog, "save_ok");
	text = g_strdup (gtk_entry_get_text (GTK_ENTRY (editable)));
	if (strlen (text) > 0)
	{
		gtk_widget_set_sensitive (button, TRUE);
	}
	else
	{
		gtk_widget_set_sensitive (button, FALSE);
	}
}