Esempio n. 1
0
void OnConf_Cpu(GtkMenuItem *menuitem, gpointer user_data)
{
	char str[512];

	CpuDlg = create_CpuDlg();
	gtk_window_set_title(GTK_WINDOW(CpuDlg), _("Configuration"));

	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_EERec")), !!CHECK_EEREC);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU0rec")), !!CHECK_VU0REC);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec")), !!CHECK_VU1REC);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS")), !!CHECK_MULTIGS);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_NORMAL);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitLimit")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_LIMIT);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitFS")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_SKIP);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_VUSkip")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_VUSKIP);

	sprintf(str, "Cpu Vendor:     %s", cpuinfo.x86ID);
	gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_CpuVendor")), str);
	sprintf(str, "Familly:   %s", cpuinfo.x86Fam);
	gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_Family")), str);
	sprintf(str, "Cpu Speed:   %d MHZ", cpuinfo.cpuspeed);
	gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_CpuSpeed")), str);

	strcpy(str, "Features:    ");
	if (cpucaps.hasMultimediaExtensions) strcat(str, "MMX");
	if (cpucaps.hasStreamingSIMDExtensions) strcat(str, ",SSE");
	if (cpucaps.hasStreamingSIMD2Extensions) strcat(str, ",SSE2");
	if (cpucaps.hasStreamingSIMD3Extensions) strcat(str, ",SSE3");
	if (cpucaps.hasAMD64BitArchitecture) strcat(str, ",x86-64");
	gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_Features")), str);

	gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "CustomFPSLimit")), (gdouble)Config.CustomFps);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FrameThreshold")), (gdouble)Config.CustomFrameSkip);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesBeforeSkipping")), (gdouble)Config.CustomConsecutiveFrames);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesToSkip")), (gdouble)Config.CustomConsecutiveSkip);

	gtk_widget_show_all(CpuDlg);
	if (MainWindow) gtk_widget_set_sensitive(MainWindow, FALSE);
	gtk_main();
}
Esempio n. 2
0
void
clear_text_page(gboolean add, gint *uncommitted)
{
    guint len;
    gint  ucm;

    ucm = *uncommitted;
    gtk_entry_set_text(GTK_ENTRY(sp->title_entry), "");
    if (add == TRUE)
    {
        time_label_set_time(TIME_LABEL(sp->tlabel_created), time(NULL));
    }
    else
    {
        time_label_set_time(TIME_LABEL(sp->tlabel_created), -1);
    }
    time_label_set_time(TIME_LABEL(sp->tlabel_changed), -1);
    if (add == TRUE)
    {
        gtk_label_set_text(GTK_LABEL(sp->label_changes), _("0"));
    }
    else
    {
        gtk_label_set_text(GTK_LABEL(sp->label_changes), "");
    }
    time_label_set_time(TIME_LABEL(sp->tlabel_expire), -1);
    gtk_entry_set_text(GTK_ENTRY(sp->note_id_entry), "");
    gnome_date_edit_set_time(GNOME_DATE_EDIT(sp->de_deadline), 0);
    gtk_entry_set_text(GTK_ENTRY(sp->prio_entry), "");
    gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(sp->todo_check), FALSE);
    gtk_adjustment_set_value(GTK_ADJUSTMENT(sp->ad_complete), 0);
    len = gtk_text_get_length(GTK_TEXT(sp->text_entry));
    if (len)
    {
        gtk_text_freeze(GTK_TEXT(sp->text_entry));
        gtk_text_set_point(GTK_TEXT(sp->text_entry), 0);
        gtk_text_forward_delete(GTK_TEXT(sp->text_entry), len);
        gtk_text_thaw(GTK_TEXT(sp->text_entry));
    }
    *uncommitted = ucm;
}
Esempio n. 3
0
/**
 * TBD		
 */
static void set_strategy( void ) {
    GtkWidget *btn = NULL;

    switch ( config.strategy ) {
        case STRATEGY1:
            btn = radiobtn_strategy_1;
            break;
        case STRATEGY2:
            btn = radiobtn_strategy_2;
            break;
        case STRATEGY3:
            btn = radiobtn_strategy_3;
            break;
        case STRATEGY4:
            btn = radiobtn_strategy_4;
            break;
        case STRATEGY5:
            btn = radiobtn_strategy_5;
            break;
    }
    gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( btn ), TRUE );
}                               // set_strategy
Esempio n. 4
0
/**
 * TBD		
 */
static void set_level( void ) {
    GtkWidget *btn = NULL;

    switch ( config.level ) {
        case LEVEL1:
            btn = radiobtn_level_1;
            break;
        case LEVEL2:
            btn = radiobtn_level_2;
            break;
        case LEVEL3:
            btn = radiobtn_level_3;
            break;
        case LEVEL4:
            btn = radiobtn_level_4;
            break;
        case LEVEL5:
            btn = radiobtn_level_5;
            break;
    }
    gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( btn ), TRUE );
}                               // set_level
Esempio n. 5
0
GtkWidget*
get_viewer_toolbar(GtkWidget *parent)
{
   GtkWidget *toolbar, *pixmap_wid, *button;
   GdkPixmap *pixmap;
   GdkBitmap *mask;
   GtkStyle *style;
   gboolean fit_screen;

   style = gtk_widget_get_style(parent);
   toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS);
   gtk_tooltips_set_colors(
      GTK_TOOLBAR(toolbar)->tooltips,
      get_viewer_tooltips_bgcolor(parent->window, gdk_window_get_colormap(parent->window)),
      &style->fg[GTK_STATE_NORMAL]);
   gtk_tooltips_set_delay(GTK_TOOLBAR(toolbar)->tooltips, 100);

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)browse_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL, _("Browse"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_browse),
      NULL);

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)fullscreen_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL, _("Full screen"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_full_screen),
      NULL);

   gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)save_image_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   saveimage_button = gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL, _("Save Image"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_save_image),
      NULL);

   gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)prev_image_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   prev_button = gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL, _("Previous Image"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_prev_image),
      NULL);

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)next_image_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   next_button = gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL, _("Next Image"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_next_image),
      NULL);

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)slideshow_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   slideshow_button = gtk_toolbar_append_element(
      GTK_TOOLBAR(toolbar),
      GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
      NULL,
      NULL,
      _("Stop/Resume Slideshow"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_slideshow_toggled),
      NULL);

   gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)refresh_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL, _("Refresh"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_refresh),
      NULL);

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)screen_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   button = gtk_toolbar_append_element(
      GTK_TOOLBAR(toolbar),
      GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
      NULL,
      NULL,
      _("Fit Screen"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_fitscreen_toggled),
      NULL);
   fit_screen = rc_get_boolean("fit_screen");
   gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), fit_screen);

   gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)rotate_left_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL,
      _("Rotate -90"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_rotate),
      (gint *) LEFT);

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)rotate_right_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL,
      _("Rotate +90"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_rotate),
      (gint *) RIGHT);

   gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)right_left_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL,
      _("Reflect Right/Left"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_reflect),
      (gint *) RIGHTLEFT);

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)up_down_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL,
      _("Reflect Up/Down"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(viewer_toolbar_reflect),
      (gint *) UPDOWN);

   gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));

   pixmap = gdk_pixmap_create_from_xpm_d(
      parent->window,
      &mask, &style->bg[GTK_STATE_NORMAL],
      (gchar **)exit_xpm);
   pixmap_wid = gtk_pixmap_new(pixmap, mask);
   gtk_widget_show(pixmap_wid);
   gtk_toolbar_append_item(
      GTK_TOOLBAR(toolbar),
      NULL,
      _("Exit"), NULL,
      pixmap_wid,
      GTK_SIGNAL_FUNC(close_gtksee),
      NULL);

   return toolbar;
}
Esempio n. 6
0
void
viewer_slideshow_set_state(gboolean e)
{
   gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(slideshow_button), e);
}
Esempio n. 7
0
GtkWidget* envelope_box_new(const gchar *label)
{
    EnvelopeBox *e;
    GtkWidget *box2, *thing, *box3, *box4;

    e = gtk_type_new(envelope_box_get_type());
    GTK_BOX(e)->spacing = 2;
    GTK_BOX(e)->homogeneous = FALSE;

    box2 = gtk_hbox_new(FALSE, 2);
    gtk_box_pack_start(GTK_BOX(e), box2, FALSE, TRUE, 0);
    gtk_widget_show(box2);

    thing = gtk_check_button_new_with_label(label);
    gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(thing), 0);
    gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0);
    gtk_widget_show(thing);
    gtk_signal_connect(GTK_OBJECT(thing), "toggled",
		       GTK_SIGNAL_FUNC(handle_toggle_button), e);
    e->enable = GTK_TOGGLE_BUTTON(thing);

    add_empty_hbox(box2);

    box2 = gtk_hbox_new(FALSE, 5);
    gtk_box_pack_start(GTK_BOX(e), box2, FALSE, TRUE, 0);
    gtk_widget_show(box2);

    /* Numerical list editing fields */
    box3 = gtk_vbox_new(FALSE, 2);
    gtk_box_pack_start(GTK_BOX(box2), box3, FALSE, TRUE, 0);
    gtk_widget_show(box3);

    put_labelled_spin_button(box3, "Env length", 1, 12, &e->spin_length, spin_length_changed, e);
    put_labelled_spin_button(box3, "Current pos", 0, 11, &e->spin_pos, spin_pos_changed, e);
    put_labelled_spin_button(box3, "Offset", 0, 65535, &e->spin_offset, spin_offset_changed, e);
    put_labelled_spin_button(box3, "Value", 0, 64, &e->spin_value, spin_value_changed, e);

    box4 = gtk_hbox_new(TRUE, 4);
    gtk_box_pack_start(GTK_BOX(box3), box4, FALSE, TRUE, 0);
    gtk_widget_show(box4);

    thing = gtk_button_new_with_label("Insert");
    gtk_box_pack_start(GTK_BOX(box4), thing, TRUE, TRUE, 0);
    gtk_widget_show(thing);
    gtk_signal_connect(GTK_OBJECT(thing), "clicked",
		       GTK_SIGNAL_FUNC(insert_clicked), e);
    
    thing = gtk_button_new_with_label("Delete");
    gtk_box_pack_start(GTK_BOX(box4), thing, TRUE, TRUE, 0);
    gtk_widget_show(thing);
    gtk_signal_connect(GTK_OBJECT(thing), "clicked",
		       GTK_SIGNAL_FUNC(delete_clicked), e);

    thing = gtk_vseparator_new();
    gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0);
    gtk_widget_show(thing);

#if 0    
    /* Graphical editing stuff to be inserted here */
    thing = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(box2), thing, TRUE, TRUE, 0);
    gtk_widget_show(thing);

    thing = gtk_vseparator_new();
    gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0);
    gtk_widget_show(thing);
#endif
    /* Sustain / Loop widgets */
    box3 = gtk_vbox_new(FALSE, 2);
    gtk_box_pack_start(GTK_BOX(box2), box3, FALSE, TRUE, 0);
    gtk_widget_show(box3);

    thing = gtk_check_button_new_with_label("Sustain");
    gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(thing), 0);
    gtk_box_pack_start(GTK_BOX(box3), thing, FALSE, TRUE, 0);
    gtk_widget_show(thing);
    gtk_signal_connect(GTK_OBJECT(thing), "toggled",
		       GTK_SIGNAL_FUNC(handle_toggle_button), e);
    e->sustain = GTK_TOGGLE_BUTTON(thing);

    put_labelled_spin_button(box3, "Point", 0, 11, &e->spin_sustain, handle_spin_button, e);

    thing = gtk_check_button_new_with_label("Loop");
    gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(thing), 0);
    gtk_box_pack_start(GTK_BOX(box3), thing, FALSE, TRUE, 0);
    gtk_widget_show(thing);
    gtk_signal_connect(GTK_OBJECT(thing), "toggled",
		       GTK_SIGNAL_FUNC(handle_toggle_button), e);
    e->loop = GTK_TOGGLE_BUTTON(thing);

    put_labelled_spin_button(box3, "Start", 0, 11, &e->spin_loop_start, handle_spin_button, e);
    put_labelled_spin_button(box3, "End", 0, 11, &e->spin_loop_end, handle_spin_button, e);

    return GTK_WIDGET(e);
}
Esempio n. 8
0
/*!
  \brief personality_choice() is called from a one shot timeout from main
  in order to open the window to ask the user what ECU family to deal with
  running.
  */
G_MODULE_EXPORT gboolean personality_choice(void)
{
	GtkWidget *dialog = NULL;
	GtkWidget *vbox = NULL;
	GtkWidget *hbox = NULL;
	GtkWidget *ebox = NULL;
	GtkWidget *sep = NULL;
	GtkWidget *button = NULL;
	GtkWidget *label = NULL;
	gchar ** dirs = NULL;
	gchar * filename = NULL;
	PersonaElement *element = NULL;
	gchar *tmpbuf = NULL;
	gboolean shouldjump = FALSE;
	gchar *name = NULL;
	GArray *classes = NULL;
	GSList *group = NULL;
	GList *p_list = NULL;
	GList *s_list = NULL;
	ConfigFile *cfgfile = NULL;
	guint i = 0;
	gint result = 0;
	gchar * pathstub = NULL;
	extern gconstpointer *global_data;

	pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",NULL);
	dirs = get_dirs((const gchar *)DATA_GET(global_data,"project_name"),pathstub,&classes);
	if (!dirs)
	{
		MTXDBG(CRITICAL,_("NO Interrogation profiles found, was MegaTunix installed properly?\n"));
		return FALSE;
	}
	i = 0;
	while (dirs[i])
	{
		tmpbuf = g_build_filename(dirs[i],"details.cfg",NULL);
		cfgfile = cfg_open_file(tmpbuf);
		if (!cfgfile)
		{
			/*MTXDBG(CRITICAL,_("\"%s\" file missing!, was MegaTunix installed properly?\n"),tmpbuf);*/
			i++;
			g_free(tmpbuf);
			continue;

		}
		g_free(tmpbuf);
		element = g_new0(PersonaElement, 1);
		cfg_read_string(cfgfile,"Family","sequence",&element->sequence);
		cfg_read_string(cfgfile,"Family","friendly_name",&element->name);
		cfg_read_string(cfgfile,"Family","persona",&element->persona);
		cfg_read_string(cfgfile,"Family","ecu_lib",&element->ecu_lib);
		cfg_read_string(cfgfile,"Family","common_lib",&element->common_lib);
		if (!cfg_read_string(cfgfile,"Family","baud",&element->baud_str))
			MTXDBG(CRITICAL,_("\"details.cfg\" baud string undefined!, was MegaTunix installed properly?\n"));
		element->dirname = g_strdup(dirs[i]);
		element->filename = g_path_get_basename(dirs[i]);
		if (g_strcasecmp(element->filename,(gchar *)DATA_GET(global_data,"last_ecu_family")) == 0)
			element->def = TRUE;
		if ((DATA_GET(global_data,"cli_persona")) && (element->persona))
		{
			if (g_strcasecmp(element->persona, (gchar *)DATA_GET(global_data,"cli_persona")) == 0)
			{
				button = gtk_toggle_button_new();
				gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
				persona_selection(button,(gpointer)element);
				g_object_ref_sink(button);
				g_object_unref(button);
				shouldjump = TRUE;
			}
		}

		if (g_array_index(classes,FileClass,i) == PERSONAL)
			p_list = g_list_prepend(p_list,(gpointer)element);
		if (g_array_index(classes,FileClass,i) == SYSTEM)
			s_list = g_list_prepend(s_list,(gpointer)element);
		g_free(name);
		i++;
		cfg_free(cfgfile);	
	}
	p_list = g_list_sort(p_list,persona_seq_sort);
	s_list = g_list_sort(s_list,persona_seq_sort);
	g_strfreev(dirs);
	g_array_free(classes,TRUE);
	if (shouldjump)
	{
		g_list_foreach(p_list,free_persona_element,NULL);
		g_list_foreach(s_list,free_persona_element,NULL);
		g_list_free(p_list);
		g_list_free(s_list);
		DATA_SET(global_data,"cli_persona",NULL);
		if (DATA_GET(global_data,"offline"))
			goto jumpahead_offline;
		else
			goto jumpahead;
	}

	set_title(g_strdup(_("Choose an ECU family?")));
	update_logbar("interr_view","warning",_("Prompting user for ECU family to interrogate...\n"),FALSE,FALSE,FALSE);

	dialog = gtk_dialog_new_with_buttons("Select ECU Personality",
			GTK_WINDOW(lookup_widget("main_window")),
			GTK_DIALOG_DESTROY_WITH_PARENT,
			"Exit MegaTunix",
			GTK_RESPONSE_CLOSE,
			"Go Offline",
			GTK_RESPONSE_CANCEL,
			"Find my ECU",
			GTK_RESPONSE_OK,
			NULL);
	vbox = gtk_vbox_new(TRUE,2);
	gtk_container_set_border_width(GTK_CONTAINER(vbox),5);
	//gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),vbox,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),vbox,TRUE,TRUE,0);
	if (g_list_length(p_list) > 0)
	{
		label = gtk_label_new("Custom (personal) Profiles");
		gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0);

		group = NULL;
		/* Cycle list for PERSONAL profile files */
		for (i=0;i<g_list_length(p_list);i++)
		{
			element = (PersonaElement *)g_list_nth_data(p_list,i);

			ebox = gtk_event_box_new();
			gtk_box_pack_start(GTK_BOX(vbox),ebox,TRUE,TRUE,0);
			hbox = gtk_hbox_new(FALSE,10);
			gtk_container_add(GTK_CONTAINER(ebox),hbox);
			label = gtk_label_new(element->name);
			gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,TRUE,0);
			if (!check_for_files (element->dirname,"prof"))
			{
				gtk_widget_set_sensitive(ebox,FALSE);
				button = gtk_radio_button_new(NULL);
			}
			else
			{
				button = gtk_radio_button_new(group);
				group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
			}
			g_signal_connect(button,
					"toggled",
					G_CALLBACK(persona_selection),
					element);
			gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0);
			if (element->def)
			{
				gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
				gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(button));
			}
		}

		sep = gtk_hseparator_new();
		gtk_box_pack_start(GTK_BOX(vbox),sep,TRUE,TRUE,0);
	}
	label = gtk_label_new("System Wide ECU Profiles");
	gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0);
	/* Cycle list for System interogation files */
	for (i=0;i<g_list_length(s_list);i++)
	{
		element = (PersonaElement *)g_list_nth_data(s_list,i);
		ebox = gtk_event_box_new();
		gtk_box_pack_start(GTK_BOX(vbox),ebox,TRUE,TRUE,0);
		hbox = gtk_hbox_new(FALSE,10);
		gtk_container_add(GTK_CONTAINER(ebox),hbox);
		label = gtk_label_new(element->name);
		gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,TRUE,0);
		if (!check_for_files (element->dirname,"prof"))
		{
			gtk_widget_set_sensitive(ebox,FALSE);
			button = gtk_radio_button_new(NULL);
		}
		else
		{
			button = gtk_radio_button_new(group);
			group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
		}
		g_signal_connect(button,
				"toggled",
				G_CALLBACK(persona_selection),
				element);
		gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0);
		if (element->def)
		{
			gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
			gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(button));
		}
	}

	gtk_widget_show_all(dialog);
	result = gtk_dialog_run(GTK_DIALOG(dialog));
	gtk_widget_destroy(dialog);
	g_list_foreach(p_list,free_persona_element,NULL);
	g_list_foreach(s_list,free_persona_element,NULL);
	g_list_free(p_list);
	g_list_free(s_list);
	switch (result)
	{
		case GTK_RESPONSE_CLOSE:
			leave(NULL,NULL);
			break;
		case GTK_RESPONSE_ACCEPT:
		case GTK_RESPONSE_OK: /* Normal mode */
jumpahead:
			plugins_init();
			pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"comm.xml",NULL);
			filename = get_file((const gchar *)DATA_GET(global_data,"project_name"),pathstub,NULL);
			g_free(pathstub);
			load_comm_xml(filename);
			g_free(filename);
			io_cmd("interrogation",NULL);
			break;
		default: /* Offline */
jumpahead_offline:
			plugins_init();
			pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"comm.xml",NULL);
			filename = get_file((const gchar *)DATA_GET(global_data,"project_name"),pathstub,NULL);
			g_free(pathstub);
			load_comm_xml(filename);
			g_free(filename);
			g_timeout_add(100,(GSourceFunc)set_offline_mode,NULL);
			return FALSE;
	}
	return FALSE;
}
Esempio n. 9
0
/*!
  \brief shows the tabe visibility chooser window
  \param widget is the widget clicked to get this to come up
  \param data is unused
  \return TRUE on success
  */
G_MODULE_EXPORT gboolean show_tab_visibility_window(GtkWidget * widget, gpointer data)
{
	GladeXML *main_xml = NULL;
	GladeXML *xml = NULL;
	GtkWidget *vbox = NULL;
	GtkWidget *notebook = NULL;
	GtkWidget *table = NULL;
	GtkWidget *child = NULL;
	GtkWidget *label = NULL;
	GtkWidget *button = NULL;
	gboolean *hidden_list = NULL;

	if (!(GTK_IS_WIDGET(vis_window)))
	{
		main_xml = (GladeXML *)DATA_GET(global_data,"main_xml");
		if (!main_xml)
			return FALSE;

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

		xml = glade_xml_new(main_xml->filename,"tab_visibility_top_vbox",NULL);

		vis_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
		gtk_window_set_transient_for(GTK_WINDOW(vis_window),GTK_WINDOW(lookup_widget("main_window")));
		gtk_window_set_title(GTK_WINDOW(vis_window),_("Tab Visibility"));
		gtk_window_set_default_size(GTK_WINDOW(vis_window),200,300);
		g_signal_connect(G_OBJECT(vis_window),"delete_event",
				G_CALLBACK(gtk_widget_hide),vis_window);

		vbox = glade_xml_get_widget(xml,"tab_visibility_top_vbox");
		if (GTK_IS_WIDGET(vbox))
			gtk_container_add(GTK_CONTAINER(vis_window),vbox);
		else
			printf(_("ERROR, glade element not found!\n"));

		gint rows = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook));
		DATA_SET(global_data,"notebook_rows",GINT_TO_POINTER(rows));
		table = glade_xml_get_widget(xml,"tab_visibility_table");
		gtk_table_resize(GTK_TABLE(table),rows,2);

		for (gint i=0;i<rows;i++)
		{
			child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),i);
			button = gtk_check_button_new();
			gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),hidden_list[i]);
			g_signal_connect(G_OBJECT(button),"toggled",
					G_CALLBACK(hide_tab),
					GINT_TO_POINTER(i));
			gtk_table_attach_defaults(GTK_TABLE(table),button,
					0,1,i+1,i+2);
			label = gtk_label_new(gtk_notebook_get_tab_label_text(GTK_NOTEBOOK(notebook),child));
			gtk_table_attach_defaults(GTK_TABLE(table),label,
					1,2,i+1,i+2);

		}
	}

	gtk_widget_show_all(vis_window);
	return TRUE;
}
Esempio n. 10
0
GtkWidget *atonal_if_new(atonal * mod)
{
	AtonalIF *atonal_if;
	GtkWidget *vbox2, *hbox;
	GtkWidget *button;
	GtkWidget *slider;
	gint i;
	gchar buf[4];

	atonal_if = gtk_type_new(atonal_if_get_type());

	modulewindow_set_module (MODULEWINDOW(atonal_if), (module *)mod);

#if 0
	button = gtk_button_new_with_label("Clear");
	gtk_box_pack_start(GTK_BOX(hbox2), button, TRUE, TRUE, 1);
	g_signal_connect(G_OBJECT(button), "clicked",
			 G_CALLBACK(at_clear_cb), atonal_if);
	gtk_widget_show(button);

	button = gtk_button_new_with_label("Chaos");
	gtk_box_pack_start(GTK_BOX(hbox2), button, TRUE, TRUE, 1);
	g_signal_connect(G_OBJECT(button), "clicked",
			 G_CALLBACK(at_chaos_cb), atonal_if);
	gtk_widget_show(button);
#endif

	/* S E Q U E N C E */

	hbox = gtk_hbox_new(FALSE, 2);
	gtk_box_pack_start(GTK_BOX(MODULEWINDOW(atonal_if)->mainbox), hbox, TRUE, TRUE, 1);
	gtk_widget_show(hbox);

#if 0
	button = gtk_label_new("Triggers:");
	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 3);
	gtk_widget_show(button);
#endif

#if 0
	slider = slider_int_new("", &(mod->vol), 0, 64, 0);
	gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, FALSE, 0);
	gtk_widget_show(slider);
#endif

	for (i = 0; i < AT_LENGTH; i++) {

		if (i && i % 4 == 0) {
			button = gtk_vseparator_new();
			gtk_box_pack_start(GTK_BOX(hbox), button, FALSE,
					   FALSE, 3);
			gtk_widget_show(button);
		}

		vbox2 = gtk_vbox_new(FALSE, 1);
		gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0);
		gtk_widget_show(vbox2);

		snprintf(buf, 4, "%d", i);
		slider =
		    slider_int_new(buf,
				   &(mod->sequence[i].note),
				   110, 660, 1);
		gtk_box_pack_start(GTK_BOX(vbox2), slider, TRUE, TRUE, 0);
		gtk_widget_show(slider);

		button = gtk_toggle_button_new();
		gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, FALSE,
				   1);
		gtk_widget_set_usize(button, 10, 10);
		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),
					    (mod->sequence[i].
					     trigger == 1));
		g_signal_connect(G_OBJECT(button), "clicked",
				 G_CALLBACK(atonal_if_set_note_cb),
				 atonal_if);
		gtk_widget_show(button);
		atonal_if->buttons[i].button = button;
	}

/*
    button = outputlabel_new((module *)mod, j);
    gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
    gtk_widget_show(button);
*/


	return GTK_WIDGET(atonal_if);
}
Esempio n. 11
0
void SoftDlgProc(void)
{
	char Text[32];

	ReadConfig();

	ConfDlg = create_Config();
#ifdef _SDL
	gtk_window_set_title(GTK_WINDOW(ConfDlg), "Configure the P.E.Op.S. PSX SDL Soft Renderer...");
#endif

	FullBtn = lookup_widget(ConfDlg, "GtkRadioButton_Fullscreen");
	WinBtn  = lookup_widget(ConfDlg, "GtkRadioButton_Windowed");
	EditW   = lookup_widget(ConfDlg, "GtkEntry_Width");
	EditH   = lookup_widget(ConfDlg, "GtkEntry_Height");
	EditF   = lookup_widget(ConfDlg, "GtkEntry_FPS");
	StretchComboModes = lookup_widget(ConfDlg, "GtkCombo_Stretching");
	DitherComboModes  = lookup_widget(ConfDlg, "GtkCombo_Dithering");
	ShowFpsBtn   = lookup_widget(ConfDlg, "GtkCheckButton_FPSdisplay");
	FpsLimitBtn  = lookup_widget(ConfDlg, "GtkCheckButton_FPSlimit");
	FrameSkipBtn = lookup_widget(ConfDlg, "GtkCheckButton_FPSskip");
	SSSPSXLimitBtn = lookup_widget(ConfDlg, "GtkCheckButton_SSSPSXLimit");
	AutoFpsBtn   = lookup_widget(ConfDlg, "GtkCheckButton_FPSauto");
	ScanLinesBtn = lookup_widget(ConfDlg, "GtkCheckButton_Scanlines");
	FixesBtn     = lookup_widget(ConfDlg, "GtkCheckButton_Fixes");

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FullBtn), iWindowMode != 1);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(WinBtn),  iWindowMode != 0);

	Modes = NULL;

#if !defined(_SDL) && defined(USE_XF86VM)
	{
		Display *display;
		int myscreen;

		// Open display
		display=XOpenDisplay(NULL);

		if (display)
		{
			int nmodes,iC;

			myscreen=DefaultScreen(display);
			XF86VidModeGetAllModeLines(display,myscreen,      // -> enum all mode infos
			                           &nmodes,&modes);
			if (modes)                                        // -> infos got?
			{
				for (iC=0;iC<nmodes;++iC)                       // -> loop modes
				{
					sprintf(modesl[iC], "%dx%d", modes[iC]->hdisplay, modes[iC]->vdisplay);
					Modes = g_list_append(Modes, modesl[iC]);
				}
			}
		}
	}
#else
	Modes = g_list_append(Modes, "320x240");
	Modes = g_list_append(Modes, "640x480");
	Modes = g_list_append(Modes, "800x600");
	Modes = g_list_append(Modes, "1024x768");
#endif

	ComboModes = lookup_widget(ConfDlg, "GtkCombo_Modes");
	gtk_combo_set_popdown_strings(GTK_COMBO(ComboModes), Modes);
	if (!iWindowMode)
	{
		sprintf (Text, "%dx%d", iResX, iResY);
		gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(ComboModes)->entry), Text);
	}

	sprintf(Text,"%d", iResX);
	gtk_entry_set_text(GTK_ENTRY(EditW), Text);

	sprintf(Text,"%d", iResY);
	gtk_entry_set_text(GTK_ENTRY(EditH), Text);

/////////
	SModes = NULL;
	SModes = g_list_append(SModes, (char *)&szStretchModes[0][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[1][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[2][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[3][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[4][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[5][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[6][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[7][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[8][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[9][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[10][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[11][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[12][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[13][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[14][0]);
	SModes = g_list_append(SModes, (char *)&szStretchModes[15][0]);

	gtk_combo_set_popdown_strings(GTK_COMBO(StretchComboModes), SModes);
	gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(StretchComboModes)->entry), (char *)&szStretchModes[iUseNoStretchBlt][0]);

	DModes = NULL;
	DModes = g_list_append(DModes, (char *)&szDitherModes[0][0]);
	DModes = g_list_append(DModes, (char *)&szDitherModes[1][0]);
	DModes = g_list_append(DModes, (char *)&szDitherModes[2][0]);

	gtk_combo_set_popdown_strings(GTK_COMBO(DitherComboModes), DModes);
	gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(DitherComboModes)->entry), (char *)&szDitherModes[iUseDither][0]);

	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(ShowFpsBtn),   iShowFPS);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(FpsLimitBtn),  UseFrameLimit);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(SSSPSXLimitBtn),  bSSSPSXLimit);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(FrameSkipBtn), UseFrameSkip);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(AutoFpsBtn),   iFrameLimit-1);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(ScanLinesBtn), iUseScanLines);
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(FixesBtn),     iUseFixes);

	sprintf(Text,"%.1f", fFrameRate);
	gtk_entry_set_text(GTK_ENTRY(EditF), Text);

	gtk_widget_show_all(ConfDlg);
	gtk_main ();
}
Esempio n. 12
0
void philips_cfg_page2 ( GtkWidget *notebook, struct P_CONFIG_CONTROLS *controls, PhilipsCfgInfo  *pcfginfo )
{
    GtkWidget	*frame;
    GtkWidget	*label;
    GtkWidget	*box, *vbox;
    GSList		*group;

    vbox = gtk_hbox_new ( FALSE, 5 );

    frame = gtk_frame_new ( "Resolution" );
    gtk_container_border_width ( GTK_CONTAINER(frame), 10 );
    gtk_widget_set_usize ( frame, 130, 75 );
    gtk_widget_show ( frame );

    box = gtk_vbox_new ( FALSE, 5 );
    if ( cameraid != 5000 ) {
        controls->res_640 = gtk_radio_button_new_with_label ( NULL, "640 x 480" );
        gtk_box_pack_start ( GTK_BOX(box), controls->res_640, FALSE, FALSE, 0 );
        if ( pcfginfo->resolution == 1 )
            gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON(controls->res_640), TRUE );
        gtk_widget_show ( controls->res_640 );
        group = gtk_radio_button_group ( GTK_RADIO_BUTTON(controls->res_640) );
    }
    if ( cameraid >= 4000 && cameraid != 5000 ) {
        controls->res_1280 = gtk_radio_button_new_with_label ( group, "1280 x 960" );
        gtk_box_pack_start ( GTK_BOX(box), controls->res_1280, FALSE, FALSE, 0 );
        if ( pcfginfo->resolution == 4 )
            gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON(controls->res_640), TRUE );
        gtk_widget_show ( controls->res_1280 );
        group = gtk_radio_button_group ( GTK_RADIO_BUTTON(controls->res_1280) );
    }
    if ( cameraid == 5000 ) {
        controls->res_900 = gtk_radio_button_new_with_label ( NULL, "900 x 600" );
        gtk_box_pack_start ( GTK_BOX(box), controls->res_900, FALSE, FALSE, 0 );
        if ( pcfginfo->resolution == 5 )
            gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON(controls->res_900), TRUE );
        gtk_widget_show ( controls->res_900 );
        group = gtk_radio_button_group ( GTK_RADIO_BUTTON(controls->res_900) );
        controls->res_1800 = gtk_radio_button_new_with_label ( NULL, "1800 x 900" );
        gtk_box_pack_start ( GTK_BOX(box), controls->res_1800, FALSE, FALSE, 0 );
        if ( pcfginfo->resolution == 6 )
            gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON(controls->res_1800), TRUE );
        gtk_widget_show ( controls->res_1800 );
        group = gtk_radio_button_group ( GTK_RADIO_BUTTON(controls->res_1800) );
    }
    gtk_container_add ( GTK_CONTAINER(frame), box );
    gtk_widget_show ( box );
    gtk_box_pack_start ( GTK_BOX(vbox), frame, FALSE, FALSE, 0 );
    gtk_widget_show ( vbox );

    frame = gtk_frame_new ( "Quality" );
    gtk_container_border_width ( GTK_CONTAINER(frame), 10 );
    gtk_widget_set_usize ( frame, 130, 75 );
    gtk_widget_show ( frame );

    box = gtk_vbox_new ( FALSE, 5 );
    controls->q_fine = gtk_radio_button_new_with_label ( NULL, "Fine" );
    gtk_box_pack_start ( GTK_BOX(box), controls->q_fine, FALSE, FALSE, 0 );
    gtk_widget_show ( controls->q_fine );
    group = gtk_radio_button_group ( GTK_RADIO_BUTTON(controls->q_fine) );
    controls->q_normal = gtk_radio_button_new_with_label ( group, "Normal" );
    gtk_box_pack_start ( GTK_BOX(box), controls->q_normal, FALSE, FALSE, 0 );
    gtk_widget_show ( controls->q_normal );
    group = gtk_radio_button_group ( GTK_RADIO_BUTTON(controls->q_normal) );
    controls->q_economy = gtk_radio_button_new_with_label ( group, "Economy" );
    gtk_box_pack_start ( GTK_BOX(box), controls->q_economy, FALSE, FALSE, 0 );
    gtk_widget_show ( controls->q_economy );
    group = gtk_radio_button_group ( GTK_RADIO_BUTTON(controls->q_economy) );
    gtk_container_add ( GTK_CONTAINER(frame), box );
    gtk_widget_show ( box );
    gtk_box_pack_start ( GTK_BOX(vbox), frame, FALSE, FALSE, 0 );

    label = gtk_label_new ( "Image Quality" );
    gtk_notebook_append_page ( GTK_NOTEBOOK(notebook), vbox, label );
}
Esempio n. 13
0
void update_general_controls()
{
	gfloat tmp1 = 0.0;
	GtkWidget * widget = NULL;
	MtxGaugeFace *g = NULL;
	GdkColor color;

	if (GTK_IS_WIDGET(gauge))
		g = MTX_GAUGE_FACE(gauge);
	else 
		return;

	if (!toplevel)
		return;

	hold_handlers = TRUE;

	mtx_gauge_face_get_attribute(g,ROTATION,&tmp1);
	if (tmp1 == MTX_ROT_CW)
		widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"cw_rbutton"));
	else if (tmp1 == MTX_ROT_CCW)
		widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"ccw_rbutton"));
	else
		widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"cw_rbutton"));
	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(widget),TRUE);

	mtx_gauge_face_get_attribute(g,ANTIALIAS,&tmp1);
	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"antialiased_check"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),(gint)tmp1);

	mtx_gauge_face_get_attribute(g,TATTLETALE,&tmp1);
	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"tattletale_check"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),(gint)tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"tattletale_alpha_spin"));
	mtx_gauge_face_get_attribute(g,TATTLETALE_ALPHA,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_length_spin"));
	mtx_gauge_face_get_attribute(g,NEEDLE_LENGTH,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_width_spin"));
	mtx_gauge_face_get_attribute(g,NEEDLE_WIDTH,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_tip_width_spin"));
	mtx_gauge_face_get_attribute(g,NEEDLE_TIP_WIDTH,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_tail_width_spin"));
	mtx_gauge_face_get_attribute(g,NEEDLE_TAIL_WIDTH,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_tail_spin"));
	mtx_gauge_face_get_attribute(g,NEEDLE_TAIL,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"start_angle_spin"));
	mtx_gauge_face_get_attribute(g,START_ANGLE,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"sweep_angle_spin"));
	mtx_gauge_face_get_attribute(g,SWEEP_ANGLE,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"lbound_spin"));
	mtx_gauge_face_get_attribute(g,LBOUND,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"ubound_spin"));
	mtx_gauge_face_get_attribute(g,UBOUND,&tmp1);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),tmp1);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"background_color_day_button"));
	(void)mtx_gauge_face_get_color(g,GAUGE_COL_BG_DAY, &color);
	gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"background_color_nite_button"));
	(void)mtx_gauge_face_get_color(g,GAUGE_COL_BG_NITE, &color);
	gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_color_day_button"));
	(void)mtx_gauge_face_get_color(g,GAUGE_COL_NEEDLE_DAY, &color);
	gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_color_nite_button"));
	(void)mtx_gauge_face_get_color(g,GAUGE_COL_NEEDLE_NITE, &color);
	gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"gradient_begin_color_day_button"));
	(void)mtx_gauge_face_get_color(g,GAUGE_COL_GRADIENT_BEGIN_DAY, &color);
	gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);
	
	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"gradient_begin_color_nite_button"));
	(void)mtx_gauge_face_get_color(g,GAUGE_COL_GRADIENT_BEGIN_NITE, &color);
	gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);
	
	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"gradient_end_color_day_button"));
	(void)mtx_gauge_face_get_color(g,GAUGE_COL_GRADIENT_END_DAY, &color);
	gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"gradient_end_color_nite_button"));
	(void)mtx_gauge_face_get_color(g,GAUGE_COL_GRADIENT_END_NITE, &color);
	gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);

	widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"daytime_radiobutton"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),mtx_gauge_face_get_daytime_mode(g));
	hold_handlers = FALSE;
}
Esempio n. 14
0
static gint
sobel_dialog ()
{
  GtkWidget *dlg;
  GtkWidget *button;
  GtkWidget *toggle;
  GtkWidget *frame;
  GtkWidget *vbox;
  GtkWidget *hbox;

  gchar **argv;
  gint argc;

  argc = 1;
  argv = g_new (gchar *, 1);
  argv[0] = g_strdup ("sobel");

  gtk_init (&argc, &argv);
  gtk_rc_parse (gimp_gtkrc ());

  dlg = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dlg), _("Sobel Edge Detection"));
  gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
  gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
		      (GtkSignalFunc) sobel_close_callback,
		      NULL);

  /*  Action area  */
  button = gtk_button_new_with_label (_("OK"));
  GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
  gtk_signal_connect (GTK_OBJECT (button), "clicked",
                      (GtkSignalFunc) sobel_ok_callback,
                      dlg);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button, TRUE, TRUE, 0);
  gtk_widget_grab_default (button);
  gtk_widget_show (button);

  button = gtk_button_new_with_label (_("Cancel"));
  GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
  gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
			     (GtkSignalFunc) gtk_widget_destroy,
			     GTK_OBJECT (dlg));
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button, TRUE, TRUE, 0);
  gtk_widget_show (button);

  /*  parameter settings  */
  frame = gtk_frame_new (_("Parameter Settings"));
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
  gtk_container_border_width (GTK_CONTAINER (frame), 10);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
  vbox = gtk_vbox_new (FALSE, 5);
  gtk_container_border_width (GTK_CONTAINER (vbox), 10);
  gtk_container_add (GTK_CONTAINER (frame), vbox);

  toggle = gtk_check_button_new_with_label (_("Sobel Horizontally"));
  gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
  gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
		      (GtkSignalFunc) sobel_toggle_update,
		      &bvals.horizontal);
  gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (toggle), bvals.horizontal);
  gtk_widget_show (toggle);

  toggle = gtk_check_button_new_with_label (_("Sobel Vertically"));
  gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
  gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
		      (GtkSignalFunc) sobel_toggle_update,
		      &bvals.vertical);
  gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
  gtk_widget_show (toggle);

  toggle = gtk_check_button_new_with_label (_("Keep sign of result (one direction only)"));
  gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
  gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
		      (GtkSignalFunc) sobel_toggle_update,
		      &bvals.keep_sign);
  gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
  gtk_widget_show (toggle);

  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);


  gtk_widget_show (hbox);
  gtk_widget_show (vbox);
  gtk_widget_show (frame);
  gtk_widget_show (dlg);

  gtk_main ();
  gdk_flush ();

  return bint.run;
}
static void showif_handler_foreach_callback(gpointer data, gpointer user_data)
{
	// Context: The current property box control item we're checking against
	// to see if this is the context belonging to the control that changed
	struct gui_generate_option_controls_context *context = (struct gui_generate_option_controls_context *)data;

	// showif_foreach_data: control that changed and related option set
	struct showif_handler_foreach_callback_data *showif_foreach_data = (struct showif_handler_foreach_callback_data *)user_data;

	// Don't check check_control against itself, and only proceed
	// if this control is referencing the check control's ID
	if(	(context->widget != showif_foreach_data->changed_control) &&
		(context->option_list->showif_id != NULL) &&
		(!strcasecmp(showif_foreach_data->changed_control_option->id, context->option_list->showif_id)) )
	{
		gboolean vis_current, vis_target;

		// At this point, we know that "check_control" references the id of
		// "changed_control", now we just need to see if the value matches;
		// if so, we show the control, otherwise we must hide it...
		GtkWidget *changed_control = showif_foreach_data->changed_control;

		// Get value of control we're checking
		unsigned char value = 0;

		if(GTK_IS_COMBO_BOX(changed_control))
			value = (unsigned char)gui_combobox_simple_get_index(changed_control);
		else if(GTK_IS_SPIN_BUTTON(changed_control))
			value = (unsigned char)gtk_spin_button_get_value(GTK_SPIN_BUTTON(changed_control));
		else if(GTK_IS_TOGGLE_BUTTON(changed_control))
			value = (unsigned char)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(changed_control)) ? 1 : 0;

		vis_current = gtk_widget_get_visible(context->widget);
		vis_target = (value == context->option_list->showif_val);

		// Only do anything if visibility is changing
		if(vis_current != vis_target)
		{
			GtkWidget *target_widget = context->widget;

			gtk_widget_set_visible(context->label, vis_target);
			gtk_widget_set_visible(target_widget, vis_target);

			// If control is becoming visible but previously was not,
			// set to minimum value because we can't be sure if the
			// current value in the mask is valid on switch and
			// probably wouldn't be useful even if it was...
			if(vis_target)
			{
				if(GTK_IS_COMBO_BOX(target_widget))
					gui_combobox_simple_set_selected(target_widget, context->option_list->options[0].value);
				else if(GTK_IS_SPIN_BUTTON(target_widget))
					gtk_spin_button_set_value(GTK_SPIN_BUTTON(target_widget), 0);
				else if(GTK_IS_TOGGLE_BUTTON(target_widget))
					gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(target_widget), 0);

				// Force change signal just in case the above doesn't actually change it
				g_signal_emit_by_name(target_widget, context->widget_signal_name, context->widget_signal_data);
			}
		}
	}
}
Esempio n. 16
0
gint
save_dialog                  (  ImageInfo       *info)
{
  GtkWidget *dlg;
  GtkWidget *toggle;
  GtkWidget *hbox;
  GtkWidget *vbox;
  GtkWidget *label;
  GtkWidget *entry;
  GtkWidget *frame;
  GtkWidget *toggle_vbox;
  GSList *group;
  gint use_none = (info->save_vals.compression == COMPRESSION_NONE);
  gint use_lzw = (info->save_vals.compression == COMPRESSION_LZW);
  gint use_packbits = (info->save_vals.compression == COMPRESSION_PACKBITS);
  gint use_deflate = (info->save_vals.compression == COMPRESSION_DEFLATE);
  gint use_sgilog = (info->save_vals.compression == COMPRESSION_SGILOG);
  gint use_pixarlog = (info->save_vals.compression == COMPRESSION_PIXARLOG);
  gint use_jpeg = (info->save_vals.compression == COMPRESSION_JPEG);
  gint use_jp2000 = (info->save_vals.compression == COMPRESSION_JP2000);
  gint use_adobe = (info->save_vals.compression == COMPRESSION_ADOBE_DEFLATE);
  gint use_lsb2msb = (info->save_vals.fillorder == FILLORDER_LSB2MSB);
  gint use_msb2lsb = (info->save_vals.fillorder == FILLORDER_MSB2LSB);
  gint use_sep_planar = (info->planar == PLANARCONFIG_SEPARATE);
  gint use_premultiply =(info->save_vals.premultiply == EXTRASAMPLE_ASSOCALPHA);
  gint use_notpremultiply = (info->save_vals.premultiply == EXTRASAMPLE_UNASSALPHA
                    || info->save_vals.premultiply == EXTRASAMPLE_UNSPECIFIED );
  gint use_icc_profile = (info->save_vals.use_icc_profile == TRUE);
  gint use_no_icc      = (info->save_vals.use_icc_profile == FALSE);
  long dircount;
  gchar text[256];

  gimp_ui_init ("save", TRUE);

  dlg = gimp_dialog_new (_("Save as Tiff"), "save",
                            gimp_standard_help_func, "filters/tiff.html",
                            GTK_WIN_POS_MOUSE,
                            FALSE, TRUE, FALSE,

                            _("OK"), ok_callback,
                            NULL, NULL, NULL, TRUE, FALSE,
                            _("Cancel"), cancel_callback,
                            NULL, 1, NULL, FALSE, TRUE,
 
                            NULL);

  gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
		      (GtkSignalFunc) close_callback,
		      NULL);

  /*  attach profile  */
  //LIST_FRAME (_("ICC Profile data"))
  frame = gtk_frame_new (_("ICC Profile data"));
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
  gtk_container_border_width (GTK_CONTAINER (frame), 10);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, FALSE, TRUE, 0);
  toggle_vbox = gtk_vbox_new (FALSE, 5);
  gtk_container_border_width (GTK_CONTAINER (toggle_vbox), 5);
  gtk_container_add (GTK_CONTAINER (frame), toggle_vbox);

  group = NULL;

  LIST_TOOGLE ( _("embedd ICC Profile"), use_icc_profile )
  LIST_TOOGLE ( _("dont attach ICC color data"), use_no_icc )

  gtk_widget_show (toggle_vbox);
  gtk_widget_show (frame);
  if (info->save_vals.use_icc_profile == -1)
    gtk_widget_set_sensitive (frame, FALSE); 

  /*  compression  */
  LIST_FRAME (_("Compression"))
  group = NULL;

  LIST_TOOGLE (_("None"), use_none)
#ifdef LZW_SUPPORT
  LIST_TOOGLE (_("LZW"), use_lzw)
#endif
#ifdef PACKBITS_SUPPORT
  LIST_TOOGLE (_("Pack Bits"), use_packbits)
#endif
/*#ifdef ZIP_SUPPORT */
  LIST_TOOGLE ( _("Deflate"), use_deflate)
/*#endif */
/*#ifdef LOGLUV_SUPPORT */
  LIST_TOOGLE (_("SGILOG (32-bit)") , use_sgilog)
  gtk_widget_set_sensitive (toggle, FALSE);
  if (info->bps >= 32 && SGILOGDATAFMT == SGILOGDATAFMT_FLOAT) {
    if (info->profile_size) {
      cmsHPROFILE p = cmsOpenProfileFromMem (info->icc_profile,
                                             info->profile_size);
      if (cmsGetColorSpace(p) == icSigXYZData
       || cmsGetColorSpace(p) == icSigRgbData)
        gtk_widget_set_sensitive (toggle, TRUE);
    }
  }
/*#endif */
#if 0
/*#ifdef PIXARLOG_SUPPORT */
  LIST_TOOGLE ( _("PixarLOG (11-bit)"), use_pixarlog)
  if (info->bps < 32 && SGILOGDATAFMT == SGILOGDATAFMT_FLOAT)
    gtk_widget_set_sensitive (toggle, FALSE); 
/*#endif */
#endif
/*#ifdef JPEG_SUPPORT */
  LIST_TOOGLE ( _("JPEG"), use_jpeg)
  if (info->bps > 8)
    gtk_widget_set_sensitive (toggle, FALSE); 
#if 0
  LIST_TOOGLE ( _("JP2000"), use_jp2000)
#endif
/*#endif */
  LIST_TOOGLE ( _("Adobe"), use_adobe)

  gtk_widget_show (toggle_vbox);
  gtk_widget_show (frame);

  /*  fillorder  */
  LIST_FRAME (_("Fill Order"))
  group = NULL;

  LIST_TOOGLE ( _("LSB to MSB"), use_lsb2msb )
  LIST_TOOGLE ( _("MSB to LSB"), use_msb2lsb )

  gtk_widget_show (toggle_vbox);
  gtk_widget_show (frame);

  /*  premultiply  */
  LIST_FRAME (_("Transparency Computation"))
  group = NULL;

  sprintf (text,_("Premultiply Colour (associate)"));
  if ( info->photomet == PHOTOMETRIC_RGB )
    sprintf (text,"%s - Standard", text);
  LIST_TOOGLE ( text, use_premultiply )
  LIST_TOOGLE ( _("Dont Premultiply"), use_notpremultiply )

  gtk_widget_show (toggle_vbox);
  gtk_widget_show (frame);

  /* separate planes */
  hbox = gtk_hbox_new (FALSE, 1);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
  gtk_widget_show (hbox);
 
  toggle = gtk_check_button_new_with_label (_("Write Separate Planes per Channel"));
  gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
  gtk_widget_show (toggle);

  gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
		      GTK_SIGNAL_FUNC (gimp_toggle_button_update),
		      &use_sep_planar);
  gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (toggle), use_sep_planar);

  vbox = gtk_vbox_new (FALSE, 2);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, FALSE, TRUE, 0);

  if (info->save_vals.premultiply == EXTRASAMPLE_UNSPECIFIED)
    gtk_widget_set_sensitive (frame, FALSE); 


  TEXT_ENTRY ( _("Artist:"), text_entry_callback , image_artist )
  TEXT_ENTRY ( _("Copyright:"), text_entry_callback , image_copyright )
  TEXT_ENTRY ( _("Comment:"), text_entry_callback , image_comment )

  gtk_widget_show (vbox);

  gtk_widget_show (frame);

  gtk_widget_show (dlg);

  gtk_main ();
  gdk_flush ();

  if (use_icc_profile)
    tsvals_.use_icc_profile = TRUE;
  else if (use_no_icc)
    tsvals_.use_icc_profile = FALSE;

  if (use_none)
    tsvals_.compression = COMPRESSION_NONE;
  else if (use_lzw)
    tsvals_.compression = COMPRESSION_LZW;
  else if (use_packbits)
    tsvals_.compression = COMPRESSION_PACKBITS;
  else if (use_deflate)
    tsvals_.compression = COMPRESSION_DEFLATE;
  else if (use_sgilog)
    tsvals_.compression = COMPRESSION_SGILOG;
  else if (use_pixarlog)
    tsvals_.compression = COMPRESSION_PIXARLOG;
  else if (use_jpeg)
    tsvals_.compression = COMPRESSION_JPEG;
  else if (use_jp2000)
    tsvals_.compression = COMPRESSION_JP2000;
  else if (use_adobe)
    tsvals_.compression = COMPRESSION_ADOBE_DEFLATE;

  if (use_lsb2msb)
    tsvals_.fillorder = FILLORDER_LSB2MSB;
  else if (use_msb2lsb)
    tsvals_.fillorder = FILLORDER_MSB2LSB;

  if(use_sep_planar)
    tsvals_.planar_separate = PLANARCONFIG_SEPARATE;
  else
    tsvals_.planar_separate = PLANARCONFIG_CONTIG;

  if (use_premultiply
   && info->save_vals.premultiply != EXTRASAMPLE_UNSPECIFIED) {
    tsvals_.premultiply = EXTRASAMPLE_ASSOCALPHA;
  } else if (use_notpremultiply
        && info->save_vals.premultiply != EXTRASAMPLE_UNSPECIFIED) {
    tsvals_.premultiply = EXTRASAMPLE_UNASSALPHA;
  }

  info = info->top;
  for (dircount=0; dircount < info->pagecount ; dircount++) {
    if (dircount > 0)
      info = info->next;
 
    info->save_vals.use_icc_profile = tsvals_.use_icc_profile;
    info->save_vals.compression = tsvals_.compression;
    info->save_vals.fillorder = tsvals_.fillorder;
    if (info->save_vals.premultiply != EXTRASAMPLE_UNSPECIFIED) {
      info->save_vals.premultiply = tsvals_.premultiply;
    }
    if (use_sgilog || use_pixarlog) {
      if (info->spp > 2)
        info->photomet = PHOTOMETRIC_LOGLUV;
      else
        info->photomet = PHOTOMETRIC_LOGL;
      if (use_sgilog)
        info->logDataFMT = SGILOGDATAFMT;
      else
        info->logDataFMT = PIXARLOGDATAFMT_FLOAT;
    }
    info->planar = tsvals_.planar_separate;
  }

  info = info->top;

  /*g_message ("%d",tsint.run); */
  return tsint.run;
}
Esempio n. 17
0
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
                         const wxPoint &pos, const wxSize &size,
                         int n, const wxString choices[], int majorDim,
                         long style, const wxValidator& validator,
                         const wxString &name )
{
    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxRadioBox creation failed") );
        return false;
    }

    m_widget = gtk_frame_new( wxGTK_CONV( title ) );

    // majorDim may be 0 if all trailing parameters were omitted, so don't
    // assert here but just use the correct value for it
    m_majorDim = majorDim == 0 ? n : majorDim;

    int num_per_major = (n - 1) / m_majorDim +1;

    int num_of_cols = 0;
    int num_of_rows = 0;
    if (HasFlag(wxRA_SPECIFY_COLS))
    {
        num_of_cols = m_majorDim;
        num_of_rows = num_per_major;
    }
    else
    {
        num_of_cols = num_per_major;
        num_of_rows = m_majorDim;
    }
    
    GtkRadioButton *m_radio = (GtkRadioButton*) NULL;

    GtkWidget *table = gtk_table_new( num_of_rows, num_of_cols, FALSE );
    gtk_table_set_col_spacings( GTK_TABLE(table), 1 );
    gtk_table_set_row_spacings( GTK_TABLE(table), 1 );
    gtk_widget_show( table );
    gtk_container_add( GTK_CONTAINER(m_widget), table );
    
    wxString label;
    GSList *radio_button_group = (GSList *) NULL;
    for (int i = 0; i < n; i++)
    {
        if ( i != 0 )
            radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );

        label.Empty();
        for ( const wxChar *pc = choices[i]; *pc; pc++ )
        {
            if ( *pc != wxT('&') )
                label += *pc;
        }

        m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, wxGTK_CONV( label ) ) );
        gtk_widget_show( GTK_WIDGET(m_radio) );

        gtk_signal_connect( GTK_OBJECT(m_radio), "key_press_event",
           GTK_SIGNAL_FUNC(gtk_radiobox_keypress_callback), (gpointer)this );

        m_boxes.Append( (wxObject*) m_radio );

        if (HasFlag(wxRA_SPECIFY_COLS))
        {
            int left = i%num_of_cols;
            int right = (i%num_of_cols) + 1;
            int top = i/num_of_cols;
            int bottom = (i/num_of_cols)+1;
            gtk_table_attach( GTK_TABLE(table), GTK_WIDGET(m_radio), left, right, top, bottom, 
                  GTK_FILL, GTK_FILL, 1, 1 ); 
        }
        else
        {
            int left = i/num_of_rows;
            int right = (i/num_of_rows) + 1;
            int top = i%num_of_rows;
            int bottom = (i%num_of_rows)+1;
            gtk_table_attach( GTK_TABLE(table), GTK_WIDGET(m_radio), left, right, top, bottom, 
                  GTK_FILL, GTK_FILL, 1, 1 ); 
        }

        ConnectWidget( GTK_WIDGET(m_radio) );

        if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );

        gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
            GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );

        gtk_signal_connect( GTK_OBJECT(m_radio), "focus_in_event",
            GTK_SIGNAL_FUNC(gtk_radiobutton_focus_in), (gpointer)this );

        gtk_signal_connect( GTK_OBJECT(m_radio), "focus_out_event",
            GTK_SIGNAL_FUNC(gtk_radiobutton_focus_out), (gpointer)this );
    }

    m_parent->DoAddChild( this );

    SetLabel( title );

    PostCreation(size);

    return true;
}
Esempio n. 18
0
void showchange(char *title, Trptr t, GtkSignalFunc func)
{
  GtkWidget *main_vbox;
  GtkWidget *ok_hbox;
  GtkWidget *hbox;
  GtkWidget *box1;
  GtkWidget *box2;
  GtkWidget *label;
  GtkWidget *button;
  GtkWidget *separator;
  GSList *group;
  GtkWidget *frame1, *frame2;

  cleanup=func;
  tcache=t;
  flags=t->flags;
  
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_grab_add(window);  

  gtk_signal_connect (GTK_OBJECT (window), "delete_event",
		      GTK_SIGNAL_FUNC(destroy_callback),
		      NULL);

  gtk_window_set_title (GTK_WINDOW (window), title);
  gtk_container_border_width (GTK_CONTAINER (window), 0);


  main_vbox = gtk_vbox_new (FALSE, 1);
  gtk_container_border_width (GTK_CONTAINER (main_vbox), 1);
  gtk_widget_show (main_vbox);

  label=gtk_label_new(t->name);
  gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, TRUE, 0);
  gtk_widget_show (label);

  separator = gtk_hseparator_new ();
  gtk_box_pack_start (GTK_BOX (main_vbox), separator, FALSE, TRUE, 0);
  gtk_widget_show (separator);


  hbox = gtk_hbutton_box_new ();
  gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);
  gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 5);
  gtk_widget_show (hbox);

  box2 = gtk_vbox_new (FALSE, 5);
  gtk_container_border_width (GTK_CONTAINER (box2), 5);
  gtk_widget_show (box2);

  button1 = gtk_radio_button_new_with_label (NULL, "Hex");
  gtk_box_pack_start (GTK_BOX (box2), button1, TRUE, TRUE, 0);
  if(flags&TR_HEX) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button1), TRUE);
  gtk_widget_show (button1);
  group = gtk_radio_button_group (GTK_RADIO_BUTTON (button1));

  button2 = gtk_radio_button_new_with_label(group, "Decimal");
  gtk_box_pack_start (GTK_BOX (box2), button2, TRUE, TRUE, 0);
  if(flags&TR_DEC) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button2), TRUE);
  gtk_widget_show (button2);
  group = gtk_radio_button_group (GTK_RADIO_BUTTON (button2));

  button5 = gtk_radio_button_new_with_label(group, "Signed Decimal");
  gtk_box_pack_start (GTK_BOX (box2), button5, TRUE, TRUE, 0);
  if(flags&TR_SIGNED) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button5), TRUE);
  gtk_widget_show (button5);
  group = gtk_radio_button_group (GTK_RADIO_BUTTON (button5));

  button3 = gtk_radio_button_new_with_label(group, "Binary");
  gtk_box_pack_start (GTK_BOX (box2), button3, TRUE, TRUE, 0);
  if(flags&TR_BIN) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button3), TRUE);
  gtk_widget_show (button3);
  group = gtk_radio_button_group (GTK_RADIO_BUTTON (button3));

  button4 = gtk_radio_button_new_with_label(group, "Octal");
  gtk_box_pack_start (GTK_BOX (box2), button4, TRUE, TRUE, 0);
  if(flags&TR_OCT) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button4), TRUE);
  gtk_widget_show (button4);
  group = gtk_radio_button_group (GTK_RADIO_BUTTON (button4));

  button6 = gtk_radio_button_new_with_label(group, "ASCII");
  gtk_box_pack_start (GTK_BOX (box2), button6, TRUE, TRUE, 0);
  if(flags&TR_ASCII) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button6), TRUE);
  gtk_widget_show (button6);

  frame2 = gtk_frame_new ("Base");
  gtk_container_border_width (GTK_CONTAINER (frame2), 3);
  gtk_container_add (GTK_CONTAINER (frame2), box2);
  gtk_widget_show (frame2);
  gtk_box_pack_start(GTK_BOX (hbox), frame2, TRUE, TRUE, 0);

/****************************************************************************************************/

  box1 = gtk_vbox_new (FALSE, 5);
  gtk_container_border_width (GTK_CONTAINER (box1), 5);
  gtk_widget_show (box1);


  frame1 = gtk_frame_new ("Attributes");
  gtk_container_border_width (GTK_CONTAINER (frame1), 3);
  gtk_container_add (GTK_CONTAINER (frame1), box1);
  gtk_box_pack_start(GTK_BOX (hbox), frame1, TRUE, TRUE, 0);
  gtk_widget_show (frame1);

  toggle1=gtk_check_button_new_with_label("Right Justify");
  gtk_box_pack_start (GTK_BOX (box1), toggle1, TRUE, TRUE, 0);
  if(flags&TR_RJUSTIFY)gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(toggle1), TRUE);
  gtk_widget_show (toggle1);
  gtk_signal_connect (GTK_OBJECT (toggle1), "toggled", GTK_SIGNAL_FUNC(toggle1_callback), NULL);

  toggle2=gtk_check_button_new_with_label("Invert");
  gtk_box_pack_start (GTK_BOX (box1), toggle2, TRUE, TRUE, 0);
  if(flags&TR_INVERT)gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(toggle2), TRUE);
  gtk_widget_show (toggle2);
  gtk_signal_connect (GTK_OBJECT (toggle2), "toggled", GTK_SIGNAL_FUNC(toggle2_callback), NULL);

  toggle3=gtk_check_button_new_with_label("Reverse");
  gtk_box_pack_start (GTK_BOX (box1), toggle3, TRUE, TRUE, 0);
  if(flags&TR_REVERSE)gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(toggle3), TRUE);
  gtk_widget_show (toggle3);
  gtk_signal_connect (GTK_OBJECT (toggle3), "toggled", GTK_SIGNAL_FUNC(toggle3_callback), NULL);

  toggle4=gtk_check_button_new_with_label("Exclude");
  gtk_box_pack_start (GTK_BOX (box1), toggle4, TRUE, TRUE, 0);
  if(flags&TR_EXCLUDE)gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(toggle4), TRUE);
  gtk_widget_show (toggle4);
  gtk_signal_connect (GTK_OBJECT (toggle4), "toggled", GTK_SIGNAL_FUNC(toggle4_callback), NULL);

  gtk_container_add (GTK_CONTAINER (main_vbox), hbox);

  separator = gtk_hseparator_new ();
  gtk_box_pack_start (GTK_BOX (main_vbox), separator, FALSE, TRUE, 0);
  gtk_widget_show (separator);

/****************************************************************************************************/

  ok_hbox = gtk_hbox_new (FALSE, 1);
  gtk_container_border_width (GTK_CONTAINER (ok_hbox), 1);
  gtk_widget_show (ok_hbox);

  button = gtk_button_new_with_label ("Cancel");
  gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                             GTK_SIGNAL_FUNC(destroy_callback),
                             GTK_OBJECT (window));
  gtk_box_pack_end (GTK_BOX (ok_hbox), button, TRUE, TRUE, 0);
  GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
  gtk_widget_show (button);

  gtk_container_add (GTK_CONTAINER (main_vbox), ok_hbox);

  button = gtk_button_new_with_label ("  OK  ");
  gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                             GTK_SIGNAL_FUNC(enter_callback),
                             GTK_OBJECT (window));

  gtk_signal_connect_object (GTK_OBJECT (button), 
                                "realize",
                             (GtkSignalFunc) gtk_widget_grab_default,
                             GTK_OBJECT (button));

  gtk_box_pack_end (GTK_BOX (ok_hbox), button, TRUE, TRUE, 0);
  GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
  gtk_widget_show (button);

/****************************************************************************************************/

  gtk_container_add (GTK_CONTAINER (window), main_vbox);
  gtk_widget_show (window);
}