Exemple #1
0
static GtkWidget * surfadd_frq_dialog_new (gpointer hfo_ptr) {
//	Fine frequency control dialog
	GtkWidget *table, *vbox, *hbox, *button, *scale;
	GtkObject *adj;
	hf_options_struct *hf_options = (hf_options_struct *) hfo_ptr;
	if (!hfo_ptr)
		return gtk_label_new(_("No frequency control"));
	gpointer data = hf_options->hfw_ptr_ptr;

	table = gtk_table_new(6, 4, FALSE);
	gtk_widget_show(table);

	define_label_in_table("4096",table, 0, 1, 0, 1, 0);
 	define_label_in_table("2048",table, 0, 1, 1, 2, 0); 
	define_label_in_table("1024",table, 0, 1, 2, 3, 0);
 	define_label_in_table(" 512",table, 0, 1, 3, 4, 0); 
	define_label_in_table(" 256",table, 0, 1, 4, 5, 0);
 	define_label_in_table(" 128",table, 0, 1, 5, 6, 0);
 	define_label_in_table(" 64",table, 2, 3, 0, 1, 0);
 	define_label_in_table(" 32",table, 2, 3, 1, 2, 0); 
	define_label_in_table(" 16",table, 2, 3, 2, 3, 0);
 	define_label_in_table("  8",table, 2, 3, 3, 4, 0); 
	define_label_in_table("  4",table, 2, 3, 4, 5, 0);
 	define_label_in_table("  2",table, 2, 3, 5, 6, 0);
// 4096
	adj= gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[11], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,0,1,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj ), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[11]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[11] =adj;

// 2048
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[10], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,1,2,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[10]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[10]  = adj;
// 1024
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[9], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,2,3,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[9]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[9]  = adj;

// 512
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[8], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,3,4,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[8]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[8] =adj;
// 256
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[7], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,4,5,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[7]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[7] =adj;
// 128
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[6], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,5,6,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[6]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[6]  =adj;

// 64
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[5], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,0,1,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[5]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[5] =adj;
// 32
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[4], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,1,2,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[4]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[4] =adj;
// 16
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[3], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,2,3,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[3]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[3] =adj;

// 8
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[2], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,3,4,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[2]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[2] = adj;
// 4
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[1], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,4,5,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[1]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[1] =adj;
// 2
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[0], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,5,6,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[0]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[0]  = adj;

//	Adding fast reset buttons
	vbox = gtk_vbox_new(FALSE,0);
	gtk_widget_show(vbox);

	button = gtk_button_new_with_label ("0");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	button = gtk_button_new_with_label ("25");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	button = gtk_button_new_with_label ("50");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	button = gtk_button_new_with_label ("75");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	button = gtk_button_new_with_label ("100");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

	hbox = gtk_hbox_new(FALSE,0);

//	The default is to hide this dialog at the beginning, because it takes room
//	gtk_widget_show(hbox);

	gtk_box_pack_start(GTK_BOX(hbox), align_widget(vbox,0.5,0.5), FALSE,FALSE, DEF_PAD*0.5);
	
	gtk_box_pack_start(GTK_BOX(hbox), table, FALSE,FALSE, 0);

	return define_frame_with_hiding_arrows("Wave length control", hbox, hf_options->tools_window, FALSE);
}
Exemple #2
0
/*****************************************************************************
 * create_session_save_dialog()
 *****************************************************************************/
void
create_session_save_dialog(void)
{
    GError          *error  = NULL;
    GtkWidget       *hbox;
    GtkWidget       *label;
    int             new_adj = (session_io_start_adj == NULL);

    /* this should only need to happen once */
    if (session_save_dialog == NULL) {

        /* create dialog */
        session_save_dialog = gtk_file_chooser_dialog_new("PHASEX - Save Session",
                              GTK_WINDOW(main_window),
                              GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
                              GTK_STOCK_CANCEL,
                              GTK_RESPONSE_CANCEL,
                              GTK_STOCK_SAVE,
                              GTK_RESPONSE_ACCEPT,
                              NULL);
        gtk_window_set_wmclass(GTK_WINDOW(session_save_dialog), "phasex", "phasex-save");
        gtk_window_set_role(GTK_WINDOW(session_save_dialog), "session-save");
        gtk_file_chooser_set_preview_widget_active
        (GTK_FILE_CHOOSER(session_save_dialog), FALSE);

        /* create spinbutton control of session number */
        hbox = gtk_hbox_new(FALSE, 8);
        label = gtk_label_new("Save into session #:");
        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 8);

        if (new_adj) {
            session_io_start_adj = gtk_adjustment_new(0, 1, PATCH_BANK_SIZE, 1, 8, 0);
        }
        session_save_start_spin = gtk_spin_button_new(GTK_ADJUSTMENT(session_io_start_adj), 0, 0);
        gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(session_save_start_spin), TRUE);
        gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(session_save_start_spin),
                                          GTK_UPDATE_IF_VALID);
        gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(session_save_start_spin), TRUE);
        gtk_adjustment_set_value(GTK_ADJUSTMENT(session_io_start_adj), (session_io_start + 1));
        gtk_box_pack_start(GTK_BOX(hbox), session_save_start_spin, FALSE, FALSE, 8);

        if (new_adj) {
            g_signal_connect(GTK_OBJECT(session_save_start_spin), "value_changed",
                             GTK_SIGNAL_FUNC(set_session_io_start),
                             (gpointer) session_io_start_adj);
        }

        gtk_widget_show_all(hbox);
        gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(session_save_dialog), hbox);

        /* realize the file chooser before telling it about files */
        gtk_widget_realize(session_save_dialog);

#if GTK_CHECK_VERSION(2, 8, 0)
        /* this can go away once manual overwrite checks are proven to work properly */
        gtk_file_chooser_set_do_overwrite_confirmation
        (GTK_FILE_CHOOSER(session_save_dialog), TRUE);
#endif
#if GTK_CHECK_VERSION(2, 6, 0)
        gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(session_save_dialog), TRUE);
#endif

        /* add user session dir as shortcut folder (user cannot write to sys) */
        gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(session_save_dialog),
                                             user_session_dir, &error);
        if (error != NULL) {
            PHASEX_ERROR("Error %d: %s\n", error->code, error->message);
            g_error_free(error);
        }

        /* start in user session dir (usually ~/.phasex/user-sessions) */
        gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(session_save_dialog),
                                            user_session_dir);
    }
}
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *label3;
  GtkWidget *label4;
  GtkWidget *label5;
  GtkObject *spin_lumalock_adj;
  GtkWidget *spin_lumalock;
  GtkObject *spin_lumathresh_adj;
  GtkWidget *spin_lumathresh;
  GtkObject *spin_chromalock_adj;
  GtkWidget *spin_chromalock;
  GtkObject *spin_chromathresh_adj;
  GtkWidget *spin_chromathresh;
  GtkObject *spin_scene_adj;
  GtkWidget *spin_scene;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("Dynamic Noise Reduction"));

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  table1 = gtk_table_new (5, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0);

  label1 = gtk_label_new (_("Luma Lock"));
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  label2 = gtk_label_new (_("Luma Threshold"));
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

  label3 = gtk_label_new (_("Chroma Lock"));
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  label4 = gtk_label_new (_("Chroma Threshold"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  label5 = gtk_label_new (_("Scene change detect"));
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);

  spin_lumalock_adj = gtk_adjustment_new (1, 0, 255, 1, 10, 10);
  spin_lumalock = gtk_spin_button_new (GTK_ADJUSTMENT (spin_lumalock_adj), 1, 0);
  gtk_widget_show (spin_lumalock);
  gtk_table_attach (GTK_TABLE (table1), spin_lumalock, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_lumalock), TRUE);

  spin_lumathresh_adj = gtk_adjustment_new (1, 0, 255, 1, 10, 10);
  spin_lumathresh = gtk_spin_button_new (GTK_ADJUSTMENT (spin_lumathresh_adj), 1, 0);
  gtk_widget_show (spin_lumathresh);
  gtk_table_attach (GTK_TABLE (table1), spin_lumathresh, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_lumathresh), TRUE);

  spin_chromalock_adj = gtk_adjustment_new (1, 0, 255, 1, 10, 10);
  spin_chromalock = gtk_spin_button_new (GTK_ADJUSTMENT (spin_chromalock_adj), 1, 0);
  gtk_widget_show (spin_chromalock);
  gtk_table_attach (GTK_TABLE (table1), spin_chromalock, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_chromalock), TRUE);

  spin_chromathresh_adj = gtk_adjustment_new (1, 0, 255, 1, 10, 10);
  spin_chromathresh = gtk_spin_button_new (GTK_ADJUSTMENT (spin_chromathresh_adj), 1, 0);
  gtk_widget_show (spin_chromathresh);
  gtk_table_attach (GTK_TABLE (table1), spin_chromathresh, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_chromathresh), TRUE);

  spin_scene_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
  spin_scene = gtk_spin_button_new (GTK_ADJUSTMENT (spin_scene_adj), 1, 0);
  gtk_widget_show (spin_scene);
  gtk_table_attach (GTK_TABLE (table1), spin_scene, 1, 2, 4, 5,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_scene), TRUE);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialog1, label4, "label4");
  GLADE_HOOKUP_OBJECT (dialog1, label5, "label5");
  GLADE_HOOKUP_OBJECT (dialog1, spin_lumalock, "spin_lumalock");
  GLADE_HOOKUP_OBJECT (dialog1, spin_lumathresh, "spin_lumathresh");
  GLADE_HOOKUP_OBJECT (dialog1, spin_chromalock, "spin_chromalock");
  GLADE_HOOKUP_OBJECT (dialog1, spin_chromathresh, "spin_chromathresh");
  GLADE_HOOKUP_OBJECT (dialog1, spin_scene, "spin_scene");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Exemple #4
0
static GtkWidget *
glade_eprop_attrs_view (GladeEditorProperty *eprop)
{
  GladeEPropAttrs *eprop_attrs = GLADE_EPROP_ATTRS (eprop);
  GtkWidget *view_widget;
  GtkCellRenderer *renderer;
  GtkTreeViewColumn *column;
  GtkAdjustment *adjustment;

  eprop_attrs->model = (GtkTreeModel *) 
    gtk_list_store_new (NUM_COLUMNS,
			/* Main Data */
			G_TYPE_STRING,      // COLUMN_NAME
			G_TYPE_INT, // COLUMN_NAME_WEIGHT
			G_TYPE_INT, // COLUMN_TYPE
			G_TYPE_INT, // COLUMN_EDIT_TYPE
			G_TYPE_POINTER,     // COLUMN_VALUE
			G_TYPE_UINT,        // COLUMN_START
			G_TYPE_UINT,        // COLUMN_END
			/* Editor renderer related */
			G_TYPE_BOOLEAN,     // COLUMN_TOGGLE_ACTIVE
			G_TYPE_BOOLEAN,     // COLUMN_TOGGLE_DOWN
			G_TYPE_BOOLEAN,     // COLUMN_BUTTON_ACTIVE
			G_TYPE_STRING,      // COLUMN_TEXT
			G_TYPE_INT, // COLUMN_TEXT_STYLE
			G_TYPE_STRING,      // COLUMN_TEXT_FG
			G_TYPE_BOOLEAN,     // COLUMN_COMBO_ACTIVE
			GTK_TYPE_LIST_STORE,        // COLUMN_COMBO_MODEL
			G_TYPE_BOOLEAN,     // COLUMN_SPIN_ACTIVE
			G_TYPE_UINT);       // COLUMN_SPIN_DIGITS
  
  view_widget = gtk_tree_view_new_with_model (eprop_attrs->model);
  gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (view_widget), FALSE);
  gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view_widget), FALSE);

  /********************* attribute name column *********************/
  renderer = gtk_cell_renderer_text_new ();
  g_object_set (G_OBJECT (renderer), "editable", FALSE, NULL);
  column = gtk_tree_view_column_new_with_attributes
      (_("Attribute"), renderer,
       "text", COLUMN_NAME, "weight", COLUMN_NAME_WEIGHT, NULL);

  gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
  gtk_tree_view_append_column (GTK_TREE_VIEW (view_widget), column);

  /********************* attribute value column *********************/
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, _("Value"));

  /* Toggle renderer */
  renderer = gtk_cell_renderer_toggle_new ();
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_attributes (column, renderer,
                                       "activatable", COLUMN_TOGGLE_ACTIVE,
                                       "visible", COLUMN_TOGGLE_ACTIVE,
                                       "active", COLUMN_TOGGLE_DOWN, NULL);
  g_signal_connect (G_OBJECT (renderer), "toggled",
                    G_CALLBACK (value_toggled), eprop);


  /* Text renderer */
  renderer = gtk_cell_renderer_text_new ();
  g_object_set (G_OBJECT (renderer), "editable", FALSE, NULL);
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_attributes (column, renderer,
                                       "editable", COLUMN_BUTTON_ACTIVE,
                                       "visible", COLUMN_BUTTON_ACTIVE,
                                       "text", COLUMN_TEXT,
                                       "style", COLUMN_TEXT_STYLE,
                                       "foreground", COLUMN_TEXT_FG, NULL);

  /* Icon renderer */
  renderer = glade_cell_renderer_icon_new ();
  g_object_set (G_OBJECT (renderer), "icon-name", GTK_STOCK_EDIT, NULL);
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_attributes (column, renderer,
                                       "activatable", COLUMN_BUTTON_ACTIVE,
                                       "visible", COLUMN_BUTTON_ACTIVE, NULL);

  g_signal_connect (G_OBJECT (renderer), "activate",
                    G_CALLBACK (value_icon_activate), eprop);

  /* Combo renderer */
  renderer = gtk_cell_renderer_combo_new ();
  g_object_set (G_OBJECT (renderer), "text-column", 0, "has-entry", FALSE,
                NULL);
  gtk_tree_view_column_pack_start (column, renderer, TRUE);
  gtk_tree_view_column_set_attributes (column, renderer,
                                       "editable", COLUMN_COMBO_ACTIVE,
                                       "visible", COLUMN_COMBO_ACTIVE,
                                       "model", COLUMN_COMBO_MODEL,
                                       "text", COLUMN_TEXT,
                                       "style", COLUMN_TEXT_STYLE,
                                       "foreground", COLUMN_TEXT_FG, NULL);
  g_signal_connect (G_OBJECT (renderer), "edited",
                    G_CALLBACK (value_combo_spin_edited), eprop);


  /* Spin renderer */
  renderer = gtk_cell_renderer_spin_new ();
  adjustment =
      (GtkAdjustment *) gtk_adjustment_new (0, -G_MAXDOUBLE, G_MAXDOUBLE, 100,
                                            100, 100);
  g_object_set (G_OBJECT (renderer), "adjustment", adjustment, NULL);
  gtk_tree_view_column_pack_start (column, renderer, TRUE);
  gtk_tree_view_column_set_attributes (column, renderer,
                                       "visible", COLUMN_SPIN_ACTIVE,
                                       "editable", COLUMN_SPIN_ACTIVE,
                                       "text", COLUMN_TEXT,
                                       "style", COLUMN_TEXT_STYLE,
                                       "foreground", COLUMN_TEXT_FG,
                                       "digits", COLUMN_SPIN_DIGITS, NULL);
  g_signal_connect (G_OBJECT (renderer), "edited",
                    G_CALLBACK (value_combo_spin_edited), eprop);
  g_signal_connect (G_OBJECT (renderer), "editing-started",
                    G_CALLBACK (value_combo_spin_editing_started), NULL);

  gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
  gtk_tree_view_append_column (GTK_TREE_VIEW (view_widget), column);

  return view_widget;
}
static GtkWidget *
get_config_frame(PurplePlugin *plugin)
{

  GString
    *base_dir_name= NULL,
    *lang_dir_name= NULL;
  GtkObject *stretch_duration_adjustment;
  GtkObject *maxlength_adjustment;
  GtkWidget
    *parent,
    *config_vbox, *voices_vbox, *stretch_duration_hbox, *maxlength_hbox,
    *frame,
    *radio_button,
    *message_label,
    *stretch_duration_spinbutton,
    *maxlength_spinbutton,
    *prepend_who_checkbutton,
    *replace_url_checkbutton,
    *announce_events_checkbutton;
  GSList *radio_group=NULL;
  
  DIR *dir, *lang_dir;
  struct dirent *next_lang, *next_voice;
  int count_lang, count_voices;
  int can_activate_voice= FALSE;

  parent = gtk_vbox_new(FALSE,5);
  gtk_container_set_border_width(GTK_CONTAINER(parent), 12);

  config_vbox = (GtkWidget *) pidgin_make_frame(parent, _("Festival"));
  gtk_container_set_border_width(GTK_CONTAINER(config_vbox), 5);

  /*--------------- Available Voices -----------*/
  
  base_dir_name= g_string_new(FESTIVAL_VOICES_PATH);
  lang_dir_name= g_string_new("");
  message_label= gtk_label_new(_("Availables voices:"));
  gtk_box_pack_start(GTK_BOX(config_vbox),message_label,FALSE,TRUE,3);

  //Examine directory for voices
  dir= opendir(base_dir_name->str);
  if(!dir) {
    GString *error_name;
    error_name= g_string_new("");
    g_string_printf(error_name, _("Error opening voices directory: %s"), base_dir_name->str);
    message_label= gtk_label_new(error_name->str);
    g_string_free(error_name,TRUE);
    gtk_box_pack_start(GTK_BOX(config_vbox),message_label,FALSE,TRUE,3);
  }
  else {
    count_lang=0;
    while( ( next_lang = readdir(dir) ) !=0  ) {
      /* hide hidden files */
      if( *next_lang->d_name == '.' )
	continue;

      frame= gtk_frame_new(next_lang->d_name);
      gtk_box_pack_start(GTK_BOX(config_vbox),frame,FALSE,TRUE,3);
      voices_vbox= gtk_vbox_new(FALSE,5);
      gtk_container_set_border_width(GTK_CONTAINER(voices_vbox), 5);
      gtk_container_add(GTK_CONTAINER(frame),voices_vbox);

      g_string_printf(lang_dir_name,"%s/%s",base_dir_name->str,next_lang->d_name);
		
      lang_dir= opendir(lang_dir_name->str);
      if(!lang_dir) {
	GString *error_name;
	error_name= g_string_new("");
	g_string_printf( error_name,  _("Error opening voice directory: %s"), lang_dir_name->str);
	message_label= gtk_label_new(error_name->str);
	g_string_free(error_name,TRUE);
	gtk_box_pack_start( GTK_BOX(voices_vbox), message_label, FALSE, TRUE, 3);
	break;
      }

      count_voices=0;
      while( ( next_voice = readdir(lang_dir) )!=0  ) {
	GString *voice_name;
	/* hide hidden files */
        if( *next_voice->d_name == '.' )
          continue;

	radio_button= gtk_radio_button_new_with_label(radio_group,next_voice->d_name);
				
	if( purple_prefs_get_string("/plugins/gtk/festival/speaker/voice") && 
	    strcmp(purple_prefs_get_string("/plugins/gtk/festival/speaker/voice"),next_voice->d_name ) == 0) {
	  gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(radio_button),TRUE );
	  can_activate_voice= TRUE;
	}
				
	voice_name= g_string_new(next_voice->d_name);
	g_signal_connect(GTK_OBJECT(radio_button),"clicked", G_CALLBACK(on_radio_clicked), voice_name);
	g_signal_connect(GTK_OBJECT(radio_button),"destroy", G_CALLBACK(on_radio_destroy), voice_name);
	gtk_box_pack_start(GTK_BOX(voices_vbox), radio_button, FALSE, TRUE, 3);
	radio_group= gtk_radio_button_get_group( GTK_RADIO_BUTTON(radio_button) );
				
      }
      closedir(lang_dir);
    }
    closedir(dir);
  }

  g_string_free(base_dir_name,TRUE);
  g_string_free(lang_dir_name,TRUE);

  /*--------------- Replace URL -----------*/  
  replace_url_checkbutton = gtk_check_button_new_with_label( _("Replace \"http://www.someurl.com\" with URL"));
  if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/replace_url"))
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(replace_url_checkbutton), TRUE);
  g_signal_connect(G_OBJECT(replace_url_checkbutton), "clicked", 
		   G_CALLBACK(on_replace_url_checkbutton_clicked), NULL);
  gtk_box_pack_end(GTK_BOX(config_vbox),replace_url_checkbutton,FALSE,TRUE,3);

  /*--------------- Prepend Alias -----------*/  	
  prepend_who_checkbutton = gtk_check_button_new_with_label(_("Prepend Buddy Name (Alias) to message"));
  if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/prepend_who"))
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(prepend_who_checkbutton), TRUE);
  g_signal_connect(G_OBJECT(prepend_who_checkbutton), "clicked", 
		   G_CALLBACK(on_prepend_who_checkbutton_clicked), NULL);
  gtk_box_pack_end(GTK_BOX(config_vbox),prepend_who_checkbutton,FALSE,TRUE,3);

  /*--------------- Announce Events -----------*/  	
  announce_events_checkbutton = gtk_check_button_new_with_label(_("Announce events"));
  if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/announce_events"))
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(announce_events_checkbutton), TRUE);
  g_signal_connect(G_OBJECT(announce_events_checkbutton), "clicked", 
		   G_CALLBACK(on_announce_events_checkbutton_clicked), NULL);
  gtk_box_pack_end(GTK_BOX(config_vbox),announce_events_checkbutton,FALSE,TRUE,3);

  /*--------------- Duration -----------*/  	
  stretch_duration_hbox= gtk_hbox_new(FALSE,3);
  stretch_duration_adjustment= gtk_adjustment_new(1.0,0.3,10.0,0.1,1.0,1.0);
  stretch_duration_spinbutton= gtk_spin_button_new(GTK_ADJUSTMENT(stretch_duration_adjustment),0.1,1);
  g_signal_connect(G_OBJECT(stretch_duration_spinbutton), "value_changed", 
  		   G_CALLBACK(on_stretch_duration_spinbutton_changed), NULL);
  gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(stretch_duration_spinbutton),GTK_UPDATE_IF_VALID);
  gtk_entry_set_editable(GTK_ENTRY(stretch_duration_spinbutton),FALSE);
  gtk_box_pack_start(GTK_BOX(stretch_duration_hbox),gtk_label_new(_("Pitch")),FALSE,FALSE,3);
  gtk_box_pack_start(GTK_BOX(stretch_duration_hbox),stretch_duration_spinbutton,FALSE,FALSE,3);
  gtk_box_pack_end(GTK_BOX(config_vbox),stretch_duration_hbox,FALSE,TRUE,3);
  gtk_spin_button_set_value( GTK_SPIN_BUTTON(stretch_duration_spinbutton),
  			     atof (purple_prefs_get_string("/plugins/gtk/festival/speaker/duration")));

  /*--------------- Max Length -----------*/  	
  maxlength_hbox= gtk_hbox_new(FALSE,3);
  maxlength_adjustment= gtk_adjustment_new(256,0,1000,1,256,256);
  maxlength_spinbutton= gtk_spin_button_new(GTK_ADJUSTMENT(maxlength_adjustment),1,0);
  g_signal_connect(G_OBJECT(maxlength_spinbutton), "value_changed", 
  		   G_CALLBACK(on_maxlength_spinbutton_changed), NULL);
  gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(maxlength_spinbutton),GTK_UPDATE_IF_VALID);
  gtk_entry_set_editable(GTK_ENTRY(maxlength_spinbutton),FALSE);
  gtk_box_pack_start(GTK_BOX(maxlength_hbox),gtk_label_new(_("Max Length")),FALSE,FALSE,3);
  gtk_box_pack_start(GTK_BOX(maxlength_hbox),maxlength_spinbutton,FALSE,FALSE,3);
  gtk_box_pack_end(GTK_BOX(config_vbox),maxlength_hbox,FALSE,TRUE,3);
  gtk_spin_button_set_value( GTK_SPIN_BUTTON(maxlength_spinbutton),
  			     purple_prefs_get_int("/plugins/gtk/festival/speaker/maxlength"));

  if(!can_activate_voice && radio_group) {
    GtkRadioButton *default_radio;
    default_radio= GTK_RADIO_BUTTON( g_slist_nth(radio_group,0)->data );
    gtk_button_clicked( GTK_BUTTON(default_radio) );
  }

  gtk_widget_show_all(parent);
  return parent;
}
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *accellabel1;
  GtkWidget *hscale1;
  GtkWidget *label1;
  GtkWidget *hscale2;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbox1;
  GtkWidget *button_ok;
  GtkWidget *button_ko;
  GtkWidget *button_preview;

  dialog1 = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (dialog1), "dialog1", dialog1);
  gtk_window_set_title (GTK_WINDOW (dialog1), "Clean smoother");
  gtk_window_set_policy (GTK_WINDOW (dialog1), TRUE, TRUE, FALSE);
   gtk_window_set_modal(GTK_WINDOW(dialog1), TRUE);
  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_object_set_data (GTK_OBJECT (dialog1), "dialog_vbox1", dialog_vbox1);

  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  accellabel1 = gtk_accel_label_new ("Diameter");
  gtk_widget_ref (accellabel1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "accellabel1", accellabel1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (accellabel1);
  gtk_box_pack_start (GTK_BOX (vbox1), accellabel1, FALSE, FALSE, 0);

  radius_adj=gtk_adjustment_new (2, 2, 10, 1, 1, 1);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (radius_adj));
  gtk_widget_ref (hscale1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "hscale1", hscale1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);

  gtk_scale_set_digits(GTK_SCALE(hscale1),0);

  label1 = gtk_label_new ("Blend amount");
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);

  blend_adj= gtk_adjustment_new (1, 1, 10, 1, 1, 1);
  hscale2 = gtk_hscale_new (GTK_ADJUSTMENT (blend_adj));
  gtk_widget_ref (hscale2);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "hscale2", hscale2,
                            (GtkDestroyNotify) gtk_widget_unref);
   gtk_scale_set_digits(GTK_SCALE(hscale2),0);

  gtk_widget_show (hscale2);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale2, TRUE, TRUE, 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_object_set_data (GTK_OBJECT (dialog1), "dialog_action_area1", dialog_action_area1);
  gtk_widget_show (dialog_action_area1);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbox1, TRUE, TRUE, 0);

  button_ok = gtk_button_new_with_label ("OK");
  gtk_widget_ref (button_ok);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "button_ok", button_ok,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_ok);
  gtk_box_pack_start (GTK_BOX (hbox1), button_ok, FALSE, FALSE, 0);

  button_ko = gtk_button_new_with_label ("Cancel");
  gtk_widget_ref (button_ko);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "button_ko", button_ko,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_ko);
  gtk_box_pack_start (GTK_BOX (hbox1), button_ko, FALSE, FALSE, 0);

  button_preview = gtk_button_new_with_label ("Preview");
  gtk_widget_ref (button_preview);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "button_preview", button_preview,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_preview);
  gtk_box_pack_start (GTK_BOX (hbox1), button_preview, TRUE, FALSE, 0);

  gtk_signal_connect (GTK_OBJECT (button_ok), "clicked",
                      GTK_SIGNAL_FUNC (gui_ok),
                      (void *)1);
  gtk_signal_connect (GTK_OBJECT (button_ko), "clicked",
                      GTK_SIGNAL_FUNC (gui_ok),
                      (void *)0);



  return dialog1;
}
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *hbox1;
  GtkWidget *label1;
  GtkObject *spinbutton1_adj;
  GtkWidget *spinbutton1;
  GtkWidget *hscale1;
  GtkWidget *hbox2;
  GtkWidget *drawingarea1;
  GtkWidget *vscale1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Subtitle Size and Position"));
  gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);

  label1 = gtk_label_new (QT_TR_NOOP("Font Size:"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);

  spinbutton1_adj = gtk_adjustment_new (1, 6, 99, 1, 10, 10);
  spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 2);
  gtk_widget_show (spinbutton1);
  gtk_box_pack_start (GTK_BOX (hbox1), spinbutton1, FALSE, FALSE, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton1), TRUE);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 99, 1, 1, 1)));
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, FALSE, FALSE, 0);

  hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox2, TRUE, TRUE, 0);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (hbox2), drawingarea1, TRUE, TRUE, 0);

  vscale1 = gtk_vscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 100, 1, 1, 1, 1)));
  gtk_widget_show (vscale1);
  gtk_box_pack_start (GTK_BOX (hbox2), vscale1, FALSE, FALSE, 0);
  gtk_scale_set_digits (GTK_SCALE (vscale1), 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, spinbutton1, "spinbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1");
  GLADE_HOOKUP_OBJECT (dialog1, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT (dialog1, vscale1, "vscale1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Exemple #8
0
void create_kbm_window()
{
  if (hime_kbm_window) {
    gtk_window_present(GTK_WINDOW(hime_kbm_window));
    return;
  }

  load_setttings();

  hime_kbm_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(hime_kbm_window), GTK_WIN_POS_MOUSE);
  gtk_window_set_has_resize_grip(GTK_WINDOW(hime_kbm_window), FALSE);

  g_signal_connect (G_OBJECT (hime_kbm_window), "delete_event",
                    G_CALLBACK (close_kbm_window),
                    NULL);

  gtk_window_set_title (GTK_WINDOW (hime_kbm_window), _(_L("HIME 注音/詞音設定")));
  gtk_container_set_border_width (GTK_CONTAINER (hime_kbm_window), 1);

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 3);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_top), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER (hime_kbm_window), vbox_top);


  GtkWidget *hbox_lr = gtk_hbox_new (FALSE, 3);
  gtk_box_pack_start (GTK_BOX (vbox_top), hbox_lr, TRUE, TRUE, 0);


  GtkWidget *vbox_l = gtk_vbox_new (FALSE, 3);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_l), GTK_ORIENTATION_VERTICAL);
  gtk_box_pack_start (GTK_BOX (hbox_lr), vbox_l, TRUE, TRUE, 10);

  GtkWidget *vbox_r = gtk_vbox_new (FALSE, 3);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_r), GTK_ORIENTATION_VERTICAL);
  gtk_grid_set_row_homogeneous(GTK_GRID(vbox_r), TRUE);
  gtk_box_pack_start (GTK_BOX (hbox_lr), vbox_r, TRUE, TRUE, 10);


  GtkWidget *frame_kbm = gtk_frame_new(_(_L("鍵盤排列方式/選擇鍵/選單每列字數")));
  gtk_box_pack_start (GTK_BOX (vbox_l), frame_kbm, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame_kbm), 1);
  gtk_container_add (GTK_CONTAINER (frame_kbm), create_kbm_opts());

  gtk_box_pack_start (GTK_BOX (vbox_l), create_en_pho_key_sel(_(_L("(詞音) 切換[中/英]輸入"))), TRUE, TRUE, 0);

  GtkWidget *frame_tsin_space_opt = gtk_frame_new(_(_L("(詞音) 鍵入空白鍵")));
  gtk_box_pack_start (GTK_BOX (vbox_l), frame_tsin_space_opt, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_space_opt), 1);

  GtkWidget *box_tsin_space_opt = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(box_tsin_space_opt), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER (frame_tsin_space_opt), box_tsin_space_opt);
  gtk_container_set_border_width (GTK_CONTAINER (box_tsin_space_opt), 1);

  GSList *group_tsin_space_opt = NULL;
  int current_idx = get_currnet_tsin_space_option_idx();
  new_select_idx_tsin_space_opt = current_idx;

  gsize i;
  for(i=0; i< tsin_space_optionsN; i++) {
    GtkWidget *button = gtk_radio_button_new_with_label (group_tsin_space_opt, _(tsin_space_options[i].name));
    gtk_box_pack_start (GTK_BOX (box_tsin_space_opt), button, TRUE, TRUE, 0);

    group_tsin_space_opt = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));

    g_signal_connect (G_OBJECT (button), "clicked",
       G_CALLBACK (callback_button_clicked_tsin_space_opt), (gpointer) i);

    if (i==current_idx)
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
  }

  GtkWidget *hbox_tsin_phrase_pre_select = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_l), hbox_tsin_phrase_pre_select , TRUE, TRUE, 1);
  check_button_tsin_phrase_pre_select = gtk_check_button_new_with_label(_(_L("詞音輸入預選詞視窗")));
  gtk_box_pack_start (GTK_BOX (hbox_tsin_phrase_pre_select), check_button_tsin_phrase_pre_select, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_tsin_phrase_pre_select), tsin_phrase_pre_select);


  GtkWidget *hbox_phonetic_char_dynamic_sequence = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_l), hbox_phonetic_char_dynamic_sequence , TRUE, TRUE, 1);
  check_button_phonetic_char_dynamic_sequence = gtk_check_button_new_with_label(_(_L("依使用頻率調整字的順序")));
  gtk_box_pack_start (GTK_BOX (hbox_phonetic_char_dynamic_sequence), check_button_phonetic_char_dynamic_sequence, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_phonetic_char_dynamic_sequence), phonetic_char_dynamic_sequence);


  GtkWidget *hbox_pho_hide_row2 = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_l), hbox_pho_hide_row2 , TRUE, TRUE, 1);
  check_button_pho_hide_row2 = gtk_check_button_new_with_label(_(_L("注音隱藏第二列 (注音符號)")));
  gtk_box_pack_start (GTK_BOX (hbox_pho_hide_row2), check_button_pho_hide_row2, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_pho_hide_row2), pho_hide_row2);


  GtkWidget *hbox_pho_in_row1 = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_l), hbox_pho_in_row1 , TRUE, TRUE, 1);
  check_button_pho_in_row1 = gtk_check_button_new_with_label(_(_L("注音符號移至第一列")));
  gtk_box_pack_start (GTK_BOX (hbox_pho_in_row1), check_button_pho_in_row1, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_pho_in_row1), pho_in_row1);


  GtkWidget *hbox_phonetic_huge_tab = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_r), hbox_phonetic_huge_tab , TRUE, TRUE, 1);
  check_button_phonetic_huge_tab = gtk_check_button_new_with_label(_(_L("使用巨大 UTF-8 字集")));
  gtk_box_pack_start (GTK_BOX (hbox_phonetic_huge_tab), check_button_phonetic_huge_tab, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_phonetic_huge_tab), phonetic_huge_tab);


  GtkWidget *hbox_tsin_tone_char_input = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tone_char_input , TRUE, TRUE, 1);
  check_button_tsin_tone_char_input = gtk_check_button_new_with_label(_(_L("(詞音) 輸入注音聲調符號")));
  gtk_box_pack_start (GTK_BOX (hbox_tsin_tone_char_input), check_button_tsin_tone_char_input, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_tsin_tone_char_input), tsin_tone_char_input);


  GtkWidget *hbox_tsin_tab_phrase_end = gtk_hbox_new(FALSE, 1);
  gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tab_phrase_end , TRUE, TRUE, 1);
  check_button_tsin_tab_phrase_end = gtk_check_button_new_with_label(_(_L("(詞音) 使用 Escape/Tab 斷詞")));
  gtk_box_pack_start (GTK_BOX (hbox_tsin_tab_phrase_end), check_button_tsin_tab_phrase_end, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_tsin_tab_phrase_end), tsin_tab_phrase_end);

  GtkWidget *hbox_tsin_tail_select_key = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_tail_select_key , TRUE, TRUE, 1);
  check_button_tsin_tail_select_key = gtk_check_button_new_with_label(_(_L("選擇鍵顯示於候選字(詞)後方")));
  gtk_box_pack_start (GTK_BOX (hbox_tsin_tail_select_key), check_button_tsin_tail_select_key, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_tsin_tail_select_key), tsin_tail_select_key);

  GtkWidget *hbox_tsin_buffer_editing_mode = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_buffer_editing_mode , TRUE, TRUE, 1);
  check_button_tsin_buffer_editing_mode = gtk_check_button_new_with_label(_(_L("\\ 鍵可切換 jkx 鍵編輯模式")));
  gtk_box_pack_start (GTK_BOX (hbox_tsin_buffer_editing_mode), check_button_tsin_buffer_editing_mode, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_tsin_buffer_editing_mode), tsin_buffer_editing_mode);

  GtkWidget *hbox_tsin_use_pho_near = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_r), hbox_tsin_use_pho_near , TRUE, TRUE, 1);
  check_button_tsin_use_pho_near = gtk_check_button_new_with_label(_(_L("按下 ↑ 鍵查詢近似音")));
  gtk_box_pack_start (GTK_BOX (hbox_tsin_use_pho_near), check_button_tsin_use_pho_near, FALSE, FALSE, 0);
  gtk_toggle_button_set_active(
     GTK_TOGGLE_BUTTON(check_button_tsin_use_pho_near), tsin_use_pho_near);

  GtkWidget *frame_tsin_buffer_size = gtk_frame_new(_(_L("(詞音) 的編輯緩衝區大小")));
  gtk_box_pack_start (GTK_BOX (vbox_r), frame_tsin_buffer_size, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_buffer_size), 1);
  GtkAdjustment *adj_gtab_in =
   (GtkAdjustment *) gtk_adjustment_new (tsin_buffer_size, 10.0, MAX_PH_BF, 1.0, 1.0, 0.0);
  spinner_tsin_buffer_size = gtk_spin_button_new (adj_gtab_in, 0, 0);
  gtk_container_add (GTK_CONTAINER (frame_tsin_buffer_size), spinner_tsin_buffer_size);

  GtkWidget *frame_tsin_cursor_color = gtk_frame_new(_(_L("詞音游標的顏色")));
  gtk_box_pack_start (GTK_BOX (vbox_r), frame_tsin_cursor_color, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame_tsin_cursor_color), 1);
  GtkWidget *button_tsin_cursor_color = gtk_button_new();
  g_signal_connect (G_OBJECT (button_tsin_cursor_color), "clicked",
                    G_CALLBACK (cb_tsin_cursor_color), G_OBJECT (hime_kbm_window));
  da_cursor =  gtk_drawing_area_new();
  gtk_container_add (GTK_CONTAINER (button_tsin_cursor_color), da_cursor);
  gdk_color_parse(tsin_cursor_color, &tsin_cursor_gcolor);
#if !GTK_CHECK_VERSION(2,91,6)
  gtk_widget_modify_bg(da_cursor, GTK_STATE_NORMAL, &tsin_cursor_gcolor);
#else
  GdkRGBA rgbbg;
  gdk_rgba_parse(&rgbbg, gdk_color_to_string(&tsin_cursor_gcolor));
  gtk_widget_override_background_color(da_cursor, GTK_STATE_FLAG_NORMAL, &rgbbg);
#endif
  gtk_widget_set_size_request(da_cursor, 16, 2);
  gtk_container_add (GTK_CONTAINER (frame_tsin_cursor_color), button_tsin_cursor_color);

  GtkWidget *hbox_cancel_ok = gtk_hbox_new (FALSE, 10);
  gtk_grid_set_column_homogeneous(GTK_GRID(hbox_cancel_ok), TRUE);
  gtk_box_pack_start (GTK_BOX (vbox_top), hbox_cancel_ok , FALSE, FALSE, 5);
  GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
  if (button_order)
    gtk_box_pack_end (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0);
  else
    gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0);
  GtkWidget *button_ok = gtk_button_new_from_stock (GTK_STOCK_OK);
#if !GTK_CHECK_VERSION(2,91,2)
  if (button_order)
    gtk_box_pack_end (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 5);
  else
    gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 5);
#else
  if (button_order)
    gtk_grid_attach_next_to (GTK_BOX (hbox_cancel_ok), button_ok, button_cancel, GTK_POS_LEFT, 1, 1);
  else
    gtk_grid_attach_next_to (GTK_BOX (hbox_cancel_ok), button_ok, button_cancel, GTK_POS_RIGHT, 1, 1);
#endif

  g_signal_connect (G_OBJECT (button_cancel), "clicked",
                            G_CALLBACK (close_kbm_window),
                            G_OBJECT (hime_kbm_window));

  g_signal_connect_swapped (G_OBJECT (button_ok), "clicked",
                            G_CALLBACK (cb_ok),
                            G_OBJECT (hime_kbm_window));

  GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT);
  gtk_widget_grab_default (button_cancel);

  gtk_widget_show_all (hime_kbm_window);

  return;
}
Exemple #9
0
static GtkWidget *
MoveFilterPage ( const int i, const int j,
                 movefilter UNUSED(aamf[ MAX_FILTER_PLIES ][ MAX_FILTER_PLIES ]),
                 movefiltersetupwidget *pmfsw ) {

  GtkWidget *pwPage;
  GtkWidget *pwhbox;
  GtkWidget *pw;

  pwPage = gtk_vbox_new ( FALSE, 0 );

  /* enable */

  pmfsw->aapwEnable[ i ][ j ] = 
    gtk_check_button_new_with_label ( _("Enable this level" ) );
  gtk_box_pack_start ( GTK_BOX ( pwPage ), pmfsw->aapwEnable[ i ][ j ], 
                       FALSE, FALSE, 0 );

  g_signal_connect( G_OBJECT ( pmfsw->aapwEnable[ i ][ j ] ),
                       "toggled", 
                       G_CALLBACK ( EnableToggled ), pmfsw );

  /* accept */

  pwhbox = gtk_hbox_new ( FALSE, 0 );
  pmfsw->aapwA[ i ][ j ] = pwhbox;
  gtk_box_pack_start ( GTK_BOX ( pwPage ), pwhbox, FALSE, FALSE, 0 );

  gtk_box_pack_start ( GTK_BOX ( pwhbox ),
                       gtk_label_new ( _("Always accept: ") ),
                       FALSE, FALSE, 0 );
  pmfsw->aapadjAccept[ i ][ j ] = 
    GTK_ADJUSTMENT ( gtk_adjustment_new ( 0, 0, 1000,
                                          1, 5, 0 ) );

  pw = gtk_spin_button_new ( GTK_ADJUSTMENT ( pmfsw->aapadjAccept[ i ][ j ] ), 
                             1, 0 );

  gtk_spin_button_set_numeric ( GTK_SPIN_BUTTON ( pw ), TRUE );

  gtk_box_pack_start ( GTK_BOX ( pwhbox ), pw, FALSE, FALSE, 0 );

  gtk_box_pack_start ( GTK_BOX ( pwhbox ),
                       gtk_label_new ( _("moves.") ),
                       FALSE, FALSE, 0 );

  g_signal_connect( G_OBJECT( pmfsw->aapadjAccept[ i ][ j ] ), 
                      "value-changed",
                      G_CALLBACK( AcceptChanged ), pmfsw );

  /* extra */

  pwhbox = gtk_hbox_new ( FALSE, 0 );
  pmfsw->aapwET[ i ][ j ] = pwhbox;
  gtk_box_pack_start ( GTK_BOX ( pwPage ), pwhbox, FALSE, FALSE, 0 );

  gtk_box_pack_start ( GTK_BOX ( pwhbox ),
                       gtk_label_new ( _("Add extra: ") ),
                       FALSE, FALSE, 0 );

  pmfsw->aapadjExtra[ i ][ j ] = 
    GTK_ADJUSTMENT ( gtk_adjustment_new ( 0, 0, 1000,
                                          1, 5, 0 ) );

  pw = gtk_spin_button_new ( GTK_ADJUSTMENT ( pmfsw->aapadjExtra[ i ][ j ] ), 
                             1, 0 );

  gtk_spin_button_set_numeric ( GTK_SPIN_BUTTON ( pw ), TRUE );

  gtk_box_pack_start ( GTK_BOX ( pwhbox ), pw, FALSE, FALSE, 0 );

  g_signal_connect( G_OBJECT( pmfsw->aapadjExtra[ i ][ j ] ), 
                      "value-changed",
                      G_CALLBACK( AcceptChanged ), pmfsw );

  /* threshold */

  gtk_box_pack_start ( GTK_BOX ( pwhbox ),
                       gtk_label_new ( _("moves within") ),
                       FALSE, FALSE, 0 );

  pmfsw->aapadjThreshold[ i ][ j ] = 
    GTK_ADJUSTMENT ( gtk_adjustment_new ( 0, 0, 10,
                                          0.001, 0.1, 0 ) );

  pw = 
    gtk_spin_button_new ( GTK_ADJUSTMENT ( pmfsw->aapadjThreshold[ i ][ j ] ), 
                          1, 3 );
  pmfsw->aapwT[ i ][ j ] = pw;

  gtk_spin_button_set_numeric ( GTK_SPIN_BUTTON ( pw ), TRUE );

  gtk_box_pack_start ( GTK_BOX ( pwhbox ), pw, TRUE, TRUE, 0 );

  g_signal_connect( G_OBJECT( pmfsw->aapadjThreshold[ i ][ j ] ), 
                      "value-changed",
                      G_CALLBACK( AcceptChanged ), pmfsw );

  

  return pwPage;

}
Exemple #10
0
/* Here the fist page of the layout is created */
void create_encoding_layout(GtkWidget *table)
{
GtkWidget *preview_button, *label, *addnorm_button;
GtkWidget *bicubic_button, *player_field, *saveonexit_button;
GtkObject *adjust_scale, *adjust_scale_n;
int table_line;

table_line = 0;

  t_use_yuvplay_pipe = use_yuvplay_pipe;
  t_addoutputnorm = encoding.addoutputnorm;
  t_use_bicubic = use_bicubic; 
  t_fourpelmotion = fourpelmotion;
  t_twopelmotion = twopelmotion;
  sprintf(t_selected_player, "%s", selected_player);
  t_saveonexit = saveonexit;

  label = gtk_label_new ("Save the encoding options when exiting : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  saveonexit_button = gtk_check_button_new();
  gtk_widget_ref (saveonexit_button);
  if (saveonexit != 0)
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (saveonexit_button), TRUE);
  gtk_signal_connect (GTK_OBJECT (saveonexit_button), "toggled",
                      GTK_SIGNAL_FUNC (set_saveonexit), NULL );
  gtk_table_attach_defaults (GTK_TABLE (table), 
                            saveonexit_button, 1, 2, table_line, table_line+1);
  gtk_widget_show (saveonexit_button);
  table_line++;

  label = gtk_label_new ("Show video while encoding : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  preview_button = gtk_check_button_new();
  gtk_widget_ref (preview_button);
  if (use_yuvplay_pipe) 
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preview_button), TRUE);
  gtk_signal_connect (GTK_OBJECT (preview_button), "toggled",
                      GTK_SIGNAL_FUNC (set_encoding_preview), NULL );
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             preview_button, 1, 2, table_line, table_line+1);
  gtk_widget_show (preview_button);
  table_line++;

  label = gtk_label_new ("Add norm when using yuvscaler : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  addnorm_button = gtk_check_button_new();
  gtk_widget_ref (addnorm_button);
  if (encoding.addoutputnorm) 
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (addnorm_button), TRUE);
  gtk_signal_connect (GTK_OBJECT (addnorm_button), "toggled",
                      GTK_SIGNAL_FUNC (set_addoutputnorm), NULL );
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             addnorm_button, 1, 2, table_line, table_line+1);
  gtk_widget_show (addnorm_button);
  table_line++;
  
  label = gtk_label_new ("Always use bicubic for scaling : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  bicubic_button = gtk_check_button_new();
//  gtk_widget_ref (bicubic_button);
  if (use_bicubic)  /* <- Does the preset of the values -v */
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bicubic_button), TRUE);
  gtk_signal_connect (GTK_OBJECT (bicubic_button), "toggled",
                      GTK_SIGNAL_FUNC (set_bicubicuse), NULL );
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             bicubic_button, 1, 2, table_line, table_line+1);
  gtk_widget_show (bicubic_button);
  table_line++;

  label = gtk_label_new (" 4*4-pel subsampled motion comp : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);

  adjust_scale = gtk_adjustment_new (1.0, 1.0, 5.0, 1, 1.0, 1.0);

  fourpel_scale = gtk_hscale_new (GTK_ADJUSTMENT (adjust_scale));
  gtk_scale_set_value_pos (GTK_SCALE(fourpel_scale), GTK_POS_LEFT);
  gtk_scale_set_digits (GTK_SCALE (fourpel_scale),0);
  gtk_signal_connect (GTK_OBJECT (adjust_scale), "value_changed",
                         GTK_SIGNAL_FUNC (change_four), adjust_scale);
  gtk_table_attach_defaults (GTK_TABLE (table),
                            fourpel_scale, 1, 2, table_line, table_line+1);
  gtk_widget_show (fourpel_scale);
  gtk_adjustment_set_value (GTK_ADJUSTMENT (adjust_scale), t_fourpelmotion);
  table_line++;

  label = gtk_label_new (" 2*2-pel subsampled motion comp : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);

  adjust_scale_n = gtk_adjustment_new (1.0, 1.0, 5.0, 1, 1.0, 1.0);
  twopel_scale = gtk_hscale_new (GTK_ADJUSTMENT (adjust_scale_n));
  gtk_scale_set_value_pos (GTK_SCALE(twopel_scale), GTK_POS_LEFT);
  gtk_scale_set_digits (GTK_SCALE (twopel_scale),0);
  gtk_signal_connect (GTK_OBJECT (adjust_scale_n), "value_changed",
                         GTK_SIGNAL_FUNC (change_two), adjust_scale_n);
  gtk_table_attach_defaults (GTK_TABLE (table),
                            twopel_scale, 1, 2, table_line, table_line+1);
  gtk_widget_show (twopel_scale);
  gtk_adjustment_set_value (GTK_ADJUSTMENT (adjust_scale_n), t_twopelmotion);
  table_line++;

  label = gtk_label_new (" Player and options for playback : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  
  player_field = gtk_entry_new ();
  gtk_entry_set_text(GTK_ENTRY(player_field), selected_player); 
  gtk_signal_connect(GTK_OBJECT(player_field), "changed",
                     GTK_SIGNAL_FUNC(player_callback), player_field);
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             player_field, 1, 2, table_line, table_line+1);
  gtk_widget_show (player_field);
}
Exemple #11
0
/*
 * mainline..
 */
void searchbox(char *title, GtkSignalFunc func)
{
    int i;
    GtkWidget *menu, *menuitem, *optionmenu;
    GSList *group;
    GtkWidget *small_hbox;

    GtkWidget *scrolled_win;
    GtkWidget *vbox1, *hbox, *hbox0;
    GtkWidget *button1, *button2, *button3, *button3a, *button4, *button5, *button6, *button7;
    GtkWidget *label;
    gchar *titles[]={"Matches"};
    GtkWidget *frame1, *frame2, *frameh, *frameh0;
    GtkWidget *table;
    GtkTooltips *tooltips;
    GtkAdjustment *adj;
    GtkWidget *align;

    if(is_active) 
	{
	gdk_window_raise(window->window);
	return;
	}

    is_active=1;
    cleanup=func;
    num_rows=selected_rows=0;

    /* create a new modal window */
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW (window), title);
    gtk_signal_connect(GTK_OBJECT (window), "delete_event",
                       (GtkSignalFunc) destroy_callback, NULL);

    tooltips=gtk_tooltips_new_2();

    table = gtk_table_new (256, 1, FALSE);
    gtk_widget_show (table);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_container_border_width (GTK_CONTAINER (vbox1), 3);
    gtk_widget_show (vbox1);
    frame1 = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frame1), 3);
    gtk_widget_show(frame1);
    gtk_table_attach (GTK_TABLE (table), frame1, 0, 1, 0, 1,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);

    label=gtk_label_new("Signal Search Expression");
    gtk_widget_show(label);

    gtk_box_pack_start (GTK_BOX (vbox1), label, TRUE, TRUE, 0);

    entry = gtk_entry_new_with_max_length (256);
    gtk_signal_connect(GTK_OBJECT(entry), "activate",
		       GTK_SIGNAL_FUNC(enter_callback),
		       entry);
    gtk_entry_set_text (GTK_ENTRY (entry), searchbox_text);
    gtk_entry_select_region (GTK_ENTRY (entry),
			     0, GTK_ENTRY(entry)->text_length);
    gtk_widget_show (entry);
    gtk_tooltips_set_tip_2(tooltips, entry, 
		"Enter search expression here.  POSIX Wildcards are allowed.  Note that you may also "
		"modify the search criteria by selecting ``[W]Range'', ``[W]Strand'', or ``None'' for suffix "
		"matching.",NULL);

    gtk_box_pack_start (GTK_BOX (vbox1), entry, TRUE, TRUE, 0);

    /* Allocate memory for the data that is used later */
    pdata = calloc_2(1, sizeof(SearchProgressData) );
    pdata->value = pdata->oldvalue = 0.0;
    /* Create a centering alignment object */  
    align = gtk_alignment_new (0.5, 0.5, 0, 0);
    gtk_widget_show(align);
    /* Create a Adjustment object to hold the range of the
     * progress bar */
    adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, (gfloat)((numfacs>1)?numfacs-1:1), 0, 0, 0);
    pdata->adj = adj;
    /* Create the GtkProgressBar using the adjustment */
    pdata->pbar = gtk_progress_bar_new_with_adjustment (adj);
    /* Set the format of the string that can be displayed in the
     * trough of the progress bar:
     * %p - percentage
     * %v - value
     * %l - lower range value
     * %u - upper range value */
    gtk_progress_set_format_string (GTK_PROGRESS (pdata->pbar), "(%p%%)");
    gtk_progress_set_show_text (GTK_PROGRESS (pdata->pbar), TRUE);
    gtk_widget_show(pdata->pbar);
    gtk_box_pack_start (GTK_BOX (vbox1), pdata->pbar, TRUE, TRUE, 0);

    gtk_container_add (GTK_CONTAINER (frame1), vbox1);


    frame2 = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frame2), 3);
    gtk_widget_show(frame2);

    gtk_table_attach (GTK_TABLE (table), frame2, 0, 1, 1, 254,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);

    clist=gtk_clist_new_with_titles(1,titles);
    gtk_clist_column_titles_passive(GTK_CLIST(clist)); 

    gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_EXTENDED);
    gtk_signal_connect_object (GTK_OBJECT (clist), "select_row",
			       GTK_SIGNAL_FUNC(select_row_callback),
			       NULL);
    gtk_signal_connect_object (GTK_OBJECT (clist), "unselect_row",
			       GTK_SIGNAL_FUNC(unselect_row_callback),
			       NULL);
    gtk_widget_show (clist);

    scrolled_win = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
                                      GTK_POLICY_AUTOMATIC,
                                      GTK_POLICY_AUTOMATIC);
    gtk_widget_set_usize( GTK_WIDGET (scrolled_win), -1, 300);
    gtk_widget_show(scrolled_win);

    /* gtk_scrolled_window_add_with_viewport doesn't seen to work right here.. */
    gtk_container_add (GTK_CONTAINER (scrolled_win), clist);

    gtk_container_add (GTK_CONTAINER (frame2), scrolled_win);


    frameh0 = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frameh0), 3);
    gtk_widget_show(frameh0);
    gtk_table_attach (GTK_TABLE (table), frameh0, 0, 1, 254, 255,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);


    hbox0 = gtk_hbox_new (FALSE, 1);
    gtk_widget_show (hbox0);

    button6 = gtk_button_new_with_label (" Select All ");
    gtk_container_border_width (GTK_CONTAINER (button6), 3);
    gtk_signal_connect_object (GTK_OBJECT (button6), "clicked",
			       GTK_SIGNAL_FUNC(select_all_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button6);
    gtk_tooltips_set_tip_2(tooltips, button6, 
		"Highlight all signals listed in the match window.",NULL);

    gtk_box_pack_start (GTK_BOX (hbox0), button6, TRUE, FALSE, 0);



    menu = gtk_menu_new ();
    group=NULL;

    small_hbox = gtk_hbox_new (TRUE, 0);
    gtk_widget_show (small_hbox);
    
    for(i=0;i<5;i++)
        {
        menuitem = gtk_radio_menu_item_new_with_label (group, regex_name[i]);
        group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
        gtk_menu_append (GTK_MENU (menu), menuitem);
        gtk_widget_show (menuitem);
        gtk_signal_connect(GTK_OBJECT (menuitem), "activate",
                                 GTK_SIGNAL_FUNC(regex_clicked),
                                 &regex_mutex[i]);
        regex_mutex[i]=0;
        }
    
        regex_mutex[0]=1;     /* "range" */
    
        optionmenu = gtk_option_menu_new ();
        gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
        gtk_box_pack_start (GTK_BOX (small_hbox), optionmenu, TRUE, FALSE, 0);
        gtk_widget_show (optionmenu);   
	gtk_tooltips_set_tip_2(tooltips, optionmenu,
		"You may "
		"modify the search criteria by selecting ``Range'', ``Strand'', or ``None'' for suffix "
		"matching.  This optionally matches the string you enter in the search string above with a Verilog "
		"format range (signal[7:0]), a strand (signal.1, signal.0), or with no suffix.  "
		"The ``W'' modifier for ``Range'' and ``Strand'' explicitly matches on word boundaries.  "
		"(addr matches unit.freezeaddr[63:0] for ``Range'' but only unit.addr[63:0] for ``WRange'' since addr has to be on a word boundary.  "
		"Note that when ``None'' "
		"is selected, the search string may be located anywhere in the signal name.",NULL);
    
        gtk_box_pack_start (GTK_BOX (hbox0), small_hbox, FALSE, FALSE, 0);


    button7 = gtk_button_new_with_label (" Unselect All ");
    gtk_container_border_width (GTK_CONTAINER (button7), 3);
    gtk_signal_connect_object (GTK_OBJECT (button7), "clicked",
			       GTK_SIGNAL_FUNC(unselect_all_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button7);
    gtk_tooltips_set_tip_2(tooltips, button7, 
		"Unhighlight all signals listed in the match window.",NULL);
    gtk_box_pack_start (GTK_BOX (hbox0), button7, TRUE, FALSE, 0);

    gtk_container_add (GTK_CONTAINER (frameh0), hbox0);


    frameh = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frameh), 3);
    gtk_widget_show(frameh);
    gtk_table_attach (GTK_TABLE (table), frameh, 0, 1, 255, 256,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);


    hbox = gtk_hbox_new (FALSE, 1);
    gtk_widget_show (hbox);

    button1 = gtk_button_new_with_label ("Append");
    gtk_container_border_width (GTK_CONTAINER (button1), 3);
    gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
			       GTK_SIGNAL_FUNC(ok_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button1);
    gtk_tooltips_set_tip_2(tooltips, button1, 
		"Add selected signals to end of the display on the main window.",NULL);

    gtk_box_pack_start (GTK_BOX (hbox), button1, TRUE, FALSE, 0);

    button2 = gtk_button_new_with_label (" Insert ");
    gtk_container_border_width (GTK_CONTAINER (button2), 3);
    gtk_signal_connect_object (GTK_OBJECT (button2), "clicked",
			       GTK_SIGNAL_FUNC(insert_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button2);
    gtk_tooltips_set_tip_2(tooltips, button2, 
		"Add selected signals after last highlighted signal on the main window.",NULL);
    gtk_box_pack_start (GTK_BOX (hbox), button2, TRUE, FALSE, 0);

    if(vcd_explicit_zero_subscripts>=0)
	{
	button3 = gtk_button_new_with_label (" Bundle Up ");
    	gtk_container_border_width (GTK_CONTAINER (button3), 3);
    	gtk_signal_connect_object (GTK_OBJECT (button3), "clicked",
			       GTK_SIGNAL_FUNC(bundle_callback_up),
			       GTK_OBJECT (window));
    	gtk_widget_show (button3);
    	gtk_tooltips_set_tip_2(tooltips, button3, 
		"Bundle selected signals into a single bit vector with the topmost selected signal as the LSB and the lowest as the MSB.",NULL);
    	gtk_box_pack_start (GTK_BOX (hbox), button3, TRUE, FALSE, 0);

    	button3a = gtk_button_new_with_label (" Bundle Down ");
    	gtk_container_border_width (GTK_CONTAINER (button3a), 3);
    	gtk_signal_connect_object (GTK_OBJECT (button3a), "clicked",
			       GTK_SIGNAL_FUNC(bundle_callback_down),
			       GTK_OBJECT (window));
    	gtk_widget_show (button3a);
    	gtk_tooltips_set_tip_2(tooltips, button3a, 
		"Bundle selected signals into a single bit vector with the topmost selected signal as the MSB and the lowest as the LSB.",NULL);
	gtk_box_pack_start (GTK_BOX (hbox), button3a, TRUE, FALSE, 0);
	}

    button4 = gtk_button_new_with_label (" Replace ");
    gtk_container_border_width (GTK_CONTAINER (button4), 3);
    gtk_signal_connect_object (GTK_OBJECT (button4), "clicked",
			       GTK_SIGNAL_FUNC(replace_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button4);
    gtk_tooltips_set_tip_2(tooltips, button4, 
		"Replace highlighted signals on the main window with signals selected above.",NULL);
    gtk_box_pack_start (GTK_BOX (hbox), button4, TRUE, FALSE, 0);

    button5 = gtk_button_new_with_label (" Exit ");
    gtk_container_border_width (GTK_CONTAINER (button5), 3);
    gtk_signal_connect_object (GTK_OBJECT (button5), "clicked",
			       GTK_SIGNAL_FUNC(destroy_callback),
			       GTK_OBJECT (window));
    gtk_tooltips_set_tip_2(tooltips, button5, 
		"Do nothing and return to the main window.",NULL);
    gtk_widget_show (button5);
    gtk_box_pack_start (GTK_BOX (hbox), button5, TRUE, FALSE, 0);

    gtk_container_add (GTK_CONTAINER (frameh), hbox);
    gtk_container_add (GTK_CONTAINER (window), table);

    gtk_widget_show(window);

    if(strlen(searchbox_text)) enter_callback(entry,NULL);
}
static void
mcharmap_mini_font_selection_init (McharmapMiniFontSelection *fontsel)
{
  GtkCellRenderer *renderer;
  GtkStyle *style;
  AtkObject *accessib;

  gtk_widget_ensure_style (GTK_WIDGET (fontsel));
  style = gtk_widget_get_style (GTK_WIDGET (fontsel));
  fontsel->font_desc = pango_font_description_copy (style->font_desc);
  fontsel->default_size = -1;

  fontsel->size_adj = gtk_adjustment_new (MIN_FONT_SIZE, 
                                          MIN_FONT_SIZE, MAX_FONT_SIZE, 1, 8, 0);

  accessib = gtk_widget_get_accessible (GTK_WIDGET (fontsel));
  atk_object_set_name (accessib, _("Font"));

  gtk_box_set_spacing (GTK_BOX (fontsel), 6);

  fontsel->family = gtk_combo_box_new ();

  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (fontsel->family), renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (fontsel->family), renderer,
                                  "text", COL_FAMILIY,
                                  NULL);
  gtk_widget_show (fontsel->family);
  accessib = gtk_widget_get_accessible (fontsel->family);
  atk_object_set_name (accessib, _("Font Family"));

  fontsel->bold = gtk_toggle_button_new_with_mnemonic (GTK_STOCK_BOLD);
  gtk_button_set_use_stock (GTK_BUTTON (fontsel->bold), TRUE);
  gtk_widget_show (fontsel->bold);
  g_signal_connect (fontsel->bold, "toggled",
                    G_CALLBACK (bold_toggled), fontsel);

  fontsel->italic = gtk_toggle_button_new_with_mnemonic (GTK_STOCK_ITALIC);
  gtk_button_set_use_stock (GTK_BUTTON (fontsel->italic), TRUE);
  gtk_widget_show (fontsel->italic);
  g_signal_connect (fontsel->italic, "toggled",
                    G_CALLBACK (italic_toggled), fontsel);

  fontsel->size = gtk_spin_button_new (GTK_ADJUSTMENT (fontsel->size_adj),
                                       0, 0);
  gtk_widget_show (fontsel->size);
  accessib = gtk_widget_get_accessible (fontsel->size);
  atk_object_set_name (accessib, _("Font Size"));
  g_signal_connect (fontsel->size_adj, "value-changed",
                    G_CALLBACK (font_size_changed), fontsel);

  fill_font_families_combo (fontsel);

  gtk_combo_box_set_active (GTK_COMBO_BOX (fontsel->family), -1);
  g_signal_connect (fontsel->family, "changed",
                    G_CALLBACK (family_combo_changed), fontsel);

  gtk_box_pack_start (GTK_BOX (fontsel), fontsel->family, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (fontsel), fontsel->bold, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (fontsel), fontsel->italic, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (fontsel), fontsel->size, FALSE, FALSE, 0);

  gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (fontsel->family), FALSE);
  gtk_button_set_focus_on_click (GTK_BUTTON (fontsel->bold), FALSE);
  gtk_button_set_focus_on_click (GTK_BUTTON (fontsel->italic), FALSE);

  gtk_container_set_border_width (GTK_CONTAINER (fontsel), 6);

  gtk_widget_show_all (GTK_WIDGET (fontsel));
}
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *label3;
  GtkWidget *label4;
  GtkObject *spinbuttonT_adj;
  GtkWidget *spinbuttonT;
  GtkObject *spinbuttonD_adj;
  GtkWidget *spinbuttonD;
  GtkObject *spinbuttonB_adj;
  GtkWidget *spinbuttonB;
  GtkWidget *checkbuttonBF;
  GtkWidget *hscale1;
  GtkWidget *drawingarea1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("ASharp by MarcFD"));

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  table1 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0);

  label1 = gtk_label_new (_("Threshold :"));
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  label2 = gtk_label_new (_("Strength :"));
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

  label3 = gtk_label_new (_("Block Adaptative :"));
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  label4 = gtk_label_new (_("Unknown flag :"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  spinbuttonT_adj = gtk_adjustment_new (1, -1, 100, 0.5, 0.1, 0.1);
  spinbuttonT = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonT_adj), 1, 1);
  gtk_widget_show (spinbuttonT);
  gtk_table_attach (GTK_TABLE (table1), spinbuttonT, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonT), TRUE);

  spinbuttonD_adj = gtk_adjustment_new (1, -1, 100, 0.5, 0.1, 0.1);
  spinbuttonD = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonD_adj), 1, 1);
  gtk_widget_show (spinbuttonD);
  gtk_table_attach (GTK_TABLE (table1), spinbuttonD, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonD), TRUE);

  spinbuttonB_adj = gtk_adjustment_new (1, -1, 100, 0.5, 0.1, 0.1);
  spinbuttonB = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonB_adj), 1, 1);
  gtk_widget_show (spinbuttonB);
  gtk_table_attach (GTK_TABLE (table1), spinbuttonB, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonB), TRUE);

  checkbuttonBF = gtk_check_button_new_with_mnemonic (_(" "));
  gtk_widget_show (checkbuttonBF);
  gtk_table_attach (GTK_TABLE (table1), checkbuttonBF, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 1, 1)));
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, TRUE, TRUE, 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialog1, label4, "label4");
  GLADE_HOOKUP_OBJECT (dialog1, spinbuttonT, "spinbuttonT");
  GLADE_HOOKUP_OBJECT (dialog1, spinbuttonD, "spinbuttonD");
  GLADE_HOOKUP_OBJECT (dialog1, spinbuttonB, "spinbuttonB");
  GLADE_HOOKUP_OBJECT (dialog1, checkbuttonBF, "checkbuttonBF");
  GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *Horizontal;
  GtkWidget *Vertical;
  GtkWidget *Dering;
  GtkWidget *vbox2;
  GtkWidget *SwapUV;
  GtkWidget *alignment1;
  GtkWidget *hbox1;
  GtkWidget *image1;
  GtkWidget *label2;
  GtkWidget *label1;
  GtkWidget *hscale1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("Mplayer PostProc options"));

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  Horizontal = gtk_check_button_new_with_mnemonic (_("Horizontal Deblocking"));
  gtk_widget_show (Horizontal);
  gtk_box_pack_start (GTK_BOX (vbox1), Horizontal, FALSE, FALSE, 0);

  Vertical = gtk_check_button_new_with_mnemonic (_("Vertical Deblocking"));
  gtk_widget_show (Vertical);
  gtk_box_pack_start (GTK_BOX (vbox1), Vertical, FALSE, FALSE, 0);

  Dering = gtk_check_button_new_with_mnemonic (_("Deringing"));
  gtk_widget_show (Dering);
  gtk_box_pack_start (GTK_BOX (vbox1), Dering, FALSE, FALSE, 0);

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

  SwapUV = gtk_check_button_new ();
  gtk_widget_show (SwapUV);
  gtk_box_pack_start (GTK_BOX (vbox2), SwapUV, FALSE, FALSE, 0);

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (SwapUV), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label2 = gtk_label_new_with_mnemonic (_("Swap U & V"));
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (hbox1), label2, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

  label1 = gtk_label_new (_("Filter Strength"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (vbox2), label1, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (5, 0, 5, 1, 1, 0)));
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);
  gtk_scale_set_digits (GTK_SCALE (hscale1), 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, Horizontal, "Horizontal");
  GLADE_HOOKUP_OBJECT (dialog1, Vertical, "Vertical");
  GLADE_HOOKUP_OBJECT (dialog1, Dering, "Dering");
  GLADE_HOOKUP_OBJECT (dialog1, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (dialog1, SwapUV, "SwapUV");
  GLADE_HOOKUP_OBJECT (dialog1, alignment1, "alignment1");
  GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (dialog1, image1, "image1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
GtkWidget*
    create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *frame1;
  GtkWidget *table1;
  GtkWidget *buttonSelect;
  GtkWidget *labelVobsub;
  GtkWidget *label4;
  GtkWidget *optionmenu1;
  GtkWidget *label2;
  GtkWidget *frame2;
  GtkWidget *table2;
  GtkWidget *label6;
  GtkObject *spinbutton1_adj;
  GtkWidget *spinbutton1;
  GtkWidget *label7;
  GtkWidget *entryShift;
  GtkWidget *label5;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("VobSub Settings"));

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (vbox1), frame1, TRUE, TRUE, 0);

  table1 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table1);
  gtk_container_add (GTK_CONTAINER (frame1), table1);

  buttonSelect = gtk_button_new_with_mnemonic (QT_TR_NOOP("Select .idx"));
  gtk_widget_show (buttonSelect);
  gtk_table_attach (GTK_TABLE (table1), buttonSelect, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  labelVobsub = gtk_label_new (QT_TR_NOOP("None"));
  gtk_widget_show (labelVobsub);
  gtk_table_attach (GTK_TABLE (table1), labelVobsub, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (labelVobsub), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (labelVobsub), 0, 0.5);

  label4 = gtk_label_new (QT_TR_NOOP("Select Language :"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  optionmenu1 = gtk_option_menu_new ();
  gtk_widget_show (optionmenu1);
  gtk_table_attach (GTK_TABLE (table1), optionmenu1, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label2 = gtk_label_new (QT_TR_NOOP("Select Sub"));
  gtk_widget_show (label2);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), label2);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

  frame2 = gtk_frame_new (NULL);
  gtk_widget_show (frame2);
  gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0);

  table2 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table2);
  gtk_container_add (GTK_CONTAINER (frame2), table2);

  label6 = gtk_label_new (QT_TR_NOOP("Extra Shrink Factor :"));
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);

  spinbutton1_adj = gtk_adjustment_new (1, 1, 2, 0.1, 0.2, 0.2);
  spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0);
  gtk_widget_show (spinbutton1);
  gtk_table_attach (GTK_TABLE (table2), spinbutton1, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label7 = gtk_label_new (QT_TR_NOOP("Shift (ms) :"));
  gtk_widget_show (label7);
  gtk_table_attach (GTK_TABLE (table2), label7, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);

  entryShift = gtk_entry_new ();
  gtk_widget_show (entryShift);
  gtk_table_attach (GTK_TABLE (table2), entryShift, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label5 = gtk_label_new (QT_TR_NOOP("Extra Settings"));
  gtk_widget_show (label5);
  gtk_frame_set_label_widget (GTK_FRAME (frame2), label5);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, frame1, "frame1");
  GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, buttonSelect, "buttonSelect");
  GLADE_HOOKUP_OBJECT (dialog1, labelVobsub, "labelVobsub");
  GLADE_HOOKUP_OBJECT (dialog1, label4, "label4");
  GLADE_HOOKUP_OBJECT (dialog1, optionmenu1, "optionmenu1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, frame2, "frame2");
  GLADE_HOOKUP_OBJECT (dialog1, table2, "table2");
  GLADE_HOOKUP_OBJECT (dialog1, label6, "label6");
  GLADE_HOOKUP_OBJECT (dialog1, spinbutton1, "spinbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, label7, "label7");
  GLADE_HOOKUP_OBJECT (dialog1, entryShift, "entryShift");
  GLADE_HOOKUP_OBJECT (dialog1, label5, "label5");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
//******************
GtkWidget   *create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *hscaleHue;
  GtkWidget *hscaleSaturation;
  GtkWidget *hscale1;
  GtkWidget *drawingarea1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Hue/Saturation"));
  gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  table1 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0);

  label1 = gtk_label_new (QT_TR_NOOP("<b>Hue:</b>"));
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  label2 = gtk_label_new (QT_TR_NOOP("<b>Saturation:</b>"));
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

  hscaleHue = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -90, 90, 1, 1, 1)));
  gtk_widget_show (hscaleHue);
  gtk_table_attach (GTK_TABLE (table1), hscaleHue, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hscaleSaturation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -10, 10, 1, 1, 1)));
  gtk_widget_show (hscaleSaturation);
  gtk_table_attach (GTK_TABLE (table1), hscaleSaturation, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 1, 1)));
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, TRUE, TRUE, 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleHue, "hscaleHue");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleSaturation, "hscaleSaturation");
  GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Exemple #17
0
static void configure()
{
	GtkWidget *notebook1;
	GtkWidget *vbox;
	GtkWidget *vbox1;
	GtkWidget *hbox1;
	GtkWidget *Resolution_Frame;
	GtkWidget *vbox4;
	GSList *resolution_group = NULL;
	GtkWidget *Channels_Frame;
	GtkWidget *vbox5;
	GSList *vbox5_group = NULL;
	GtkWidget *Downsample_Frame;
	GtkWidget *vbox3;
	GSList *sample_group = NULL;
	GtkWidget *vbox6;
	GtkWidget *Quality_Label;
	GtkWidget *Options_Label;
	GtkWidget *pansep_label, *pansep_hscale;
	GtkWidget *bbox;
	GtkWidget *ok;
	GtkWidget *cancel;

	if (xmp_conf_window) {
		gdk_window_raise(xmp_conf_window->window);
		return;
	}

	xmp_conf_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),
		"xmp_conf_window", xmp_conf_window);
	gtk_window_set_title(GTK_WINDOW(xmp_conf_window), "XMP Configuration");
	gtk_window_set_policy(GTK_WINDOW(xmp_conf_window), FALSE, FALSE, FALSE);
	gtk_window_set_position(GTK_WINDOW(xmp_conf_window), GTK_WIN_POS_MOUSE);
	gtk_signal_connect(GTK_OBJECT(xmp_conf_window), "destroy",
		GTK_SIGNAL_FUNC(gtk_widget_destroyed),&xmp_conf_window);
	gtk_container_border_width(GTK_CONTAINER(xmp_conf_window), 10);

	vbox = gtk_vbox_new(FALSE, 10);
	gtk_container_add(GTK_CONTAINER(xmp_conf_window), vbox);

	notebook1 = gtk_notebook_new();
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),"notebook1", notebook1);
	gtk_widget_show(notebook1);
	gtk_box_pack_start(GTK_BOX(vbox), notebook1, TRUE, TRUE, 0);
	gtk_container_border_width(GTK_CONTAINER(notebook1), 3);

	vbox1 = gtk_vbox_new(FALSE, 0);
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),"vbox1", vbox1);
	gtk_widget_show(vbox1);

	hbox1 = gtk_hbox_new(FALSE, 0);
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),"hbox1", hbox1);
	gtk_widget_show(hbox1);
	gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);

	Resolution_Frame = gtk_frame_new("Resolution");
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),
		"Resolution_Frame", Resolution_Frame);
	gtk_widget_show(Resolution_Frame);
	gtk_box_pack_start(GTK_BOX(hbox1), Resolution_Frame, TRUE, TRUE, 0);
	gtk_container_set_border_width(GTK_CONTAINER (Resolution_Frame), 5);

	vbox4 = gtk_vbox_new(FALSE, 0);
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),"vbox4", vbox4);
	gtk_widget_show(vbox4);
	gtk_container_add(GTK_CONTAINER(Resolution_Frame), vbox4);

	Res_16 = gtk_radio_button_new_with_label(resolution_group, "16 bit");
	resolution_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Res_16));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "Res_16", Res_16);
	gtk_widget_show(Res_16);
	gtk_box_pack_start(GTK_BOX(vbox4), Res_16, TRUE, TRUE, 0);
	if (xmp_cfg.force8bit == 0)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Res_16), TRUE);

	Res_8 = gtk_radio_button_new_with_label(resolution_group, "8 bit");
	resolution_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Res_8));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "Res_8", Res_8);
	gtk_widget_show(Res_8);
	gtk_box_pack_start(GTK_BOX(vbox4), Res_8, TRUE, TRUE, 0);
	if (xmp_cfg.force8bit == 1)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Res_8), TRUE);

	Channels_Frame = gtk_frame_new("Channels");
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),
		"Channels_Frame", Channels_Frame);
	gtk_widget_show(Channels_Frame);
	gtk_box_pack_start(GTK_BOX(hbox1), Channels_Frame, TRUE, TRUE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(Channels_Frame), 5);

	vbox5 = gtk_vbox_new(FALSE, 0);
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "vbox5", vbox5);
	gtk_widget_show(vbox5);
	gtk_container_add(GTK_CONTAINER(Channels_Frame), vbox5);

	Chan_ST = gtk_radio_button_new_with_label(vbox5_group, "Stereo");
	vbox5_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Chan_ST));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "Chan_ST", Chan_ST);
	gtk_widget_show(Chan_ST);
	gtk_box_pack_start(GTK_BOX(vbox5), Chan_ST, TRUE, TRUE, 0);
	if (xmp_cfg.force_mono == 0)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Chan_ST), TRUE);

	Chan_MO = gtk_radio_button_new_with_label(vbox5_group, "Mono");
	vbox5_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Chan_MO));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "Chan_MO", Chan_MO);
	gtk_widget_show(Chan_MO);
	gtk_box_pack_start(GTK_BOX(vbox5), Chan_MO, TRUE, TRUE, 0);
	if (xmp_cfg.force_mono == 1)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Chan_MO), TRUE);

	Downsample_Frame = gtk_frame_new("Sampling rate");
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),
		"Downsample_Frame", Downsample_Frame);
	gtk_widget_show(Downsample_Frame);
	gtk_box_pack_start(GTK_BOX(vbox1), Downsample_Frame, TRUE, TRUE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(Downsample_Frame), 5);

	vbox3 = gtk_vbox_new(FALSE, 0);
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "vbox3", vbox3);
	gtk_widget_show(vbox3);
	gtk_container_add(GTK_CONTAINER(Downsample_Frame), vbox3);

	Sample_44 = gtk_radio_button_new_with_label(sample_group, "44 kHz");
	sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_44));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),"Sample_44", Sample_44);
	gtk_widget_show(Sample_44);
	gtk_box_pack_start(GTK_BOX(vbox3), Sample_44, TRUE, TRUE, 0);
	if (xmp_cfg.mixing_freq == FREQ_SAMPLE_44)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_44),TRUE);

	Sample_22 = gtk_radio_button_new_with_label(sample_group, "22 kHz");
	sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_22));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "Sample_22",Sample_22);
	gtk_widget_show(Sample_22);
	gtk_box_pack_start(GTK_BOX(vbox3), Sample_22, TRUE, TRUE, 0);
	if (xmp_cfg.mixing_freq == FREQ_SAMPLE_22)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_22),TRUE);

	Sample_11 = gtk_radio_button_new_with_label(sample_group, "11 kHz");
	sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_11));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "Sample_11",Sample_11);
	gtk_widget_show(Sample_11);
	gtk_box_pack_start(GTK_BOX(vbox3), Sample_11, TRUE, TRUE, 0);
	if (xmp_cfg.mixing_freq == FREQ_SAMPLE_11)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_11),TRUE);

	vbox6 = gtk_vbox_new(FALSE, 0);
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "vbox6", vbox6);
	gtk_widget_show(vbox6);

	/* Options */

#define OPTCHECK(w,l,o) {						\
	w = gtk_check_button_new_with_label(l);				\
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), #w, w);	\
	gtk_widget_show(w);						\
	gtk_box_pack_start(GTK_BOX(vbox6), w, TRUE, TRUE, 0);		\
	if (xmp_cfg.o == 1)						\
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), TRUE); \
}

	OPTCHECK(Convert_Check, "Convert 16 bit samples to 8 bit", convert8bit);
	OPTCHECK(Fixloops_Check, "Fix sample loops", fixloops);
	OPTCHECK(Modrange_Check, "Force 3 octave range in standard MOD files",
		modrange);
	OPTCHECK(Interp_Check, "Enable 32-bit linear interpolation",
		interpolation);
	OPTCHECK(Filter_Check, "Enable IT filters", filter);

	pansep_label = gtk_label_new("Pan amplitude (%)");
	gtk_widget_show(pansep_label);
	gtk_box_pack_start(GTK_BOX(vbox6), pansep_label, TRUE, TRUE, 0);
	pansep_adj = gtk_adjustment_new(xmp_cfg.pan_amplitude,
		0.0, 100.0, 1.0, 10.0, 1.0);
	pansep_hscale = gtk_hscale_new(GTK_ADJUSTMENT(pansep_adj));
	gtk_scale_set_digits(GTK_SCALE(pansep_hscale), 0);
	gtk_scale_set_draw_value(GTK_SCALE(pansep_hscale), TRUE);
	gtk_scale_set_value_pos(GTK_SCALE(pansep_hscale), GTK_POS_BOTTOM);
	gtk_widget_show(pansep_hscale);
	gtk_box_pack_start(GTK_BOX(vbox6), pansep_hscale, TRUE, TRUE, 0);

	Quality_Label = gtk_label_new("Quality");
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),
		"Quality_Label", Quality_Label);
	gtk_widget_show(Quality_Label);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), vbox1, Quality_Label);

	Options_Label = gtk_label_new("Options");
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),
		"Options_Label", Options_Label);
	gtk_widget_show(Options_Label);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), vbox6, Options_Label);

	bbox = gtk_hbutton_box_new();
	gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
	gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
	gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);

	ok = gtk_button_new_with_label("Ok");
	gtk_signal_connect(GTK_OBJECT(ok), "clicked",
		GTK_SIGNAL_FUNC(config_ok), NULL);
	GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
	gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
	gtk_widget_show(ok);
	gtk_widget_grab_default(ok);

	cancel = gtk_button_new_with_label("Cancel");
	gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked",
		GTK_SIGNAL_FUNC(gtk_widget_destroy),
		GTK_OBJECT(xmp_conf_window));
	GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
	gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
	gtk_widget_show(cancel);

	gtk_widget_show(bbox);

	gtk_widget_show(vbox);
	gtk_widget_show(xmp_conf_window);
}
Exemple #18
0
static int configure( Tcl_Interp *interp, SpinButtonParams *para,
      GnoclOption options[] )
{
   int ret = TCL_ERROR;
   int   blocked = 0;

   int setAdjust = 0;
   GtkAdjustment *oldAdjust = gtk_spin_button_get_adjustment( 
         para->spinButton );
   gfloat lower = oldAdjust->lower;
   gfloat upper = oldAdjust->upper;
   gfloat stepInc = oldAdjust->step_increment;
   gfloat pageInc = oldAdjust->page_increment;


   if( gnoclSetOptions( interp, options, G_OBJECT( para->spinButton ), -1 ) 
         != TCL_OK )
      goto cleanExit;

   gnoclAttacheOptCmdAndVar( options + onValueChangedIdx, &para->onValueChanged,
         options + variableIdx, &para->variable,
         "value-changed", G_OBJECT( para->spinButton ), 
         G_CALLBACK( changedFunc ), interp, traceFunc, para );

   if( para->onValueChanged != NULL )
   {
      blocked = g_signal_handlers_block_matched( 
            G_OBJECT( para->spinButton ), G_SIGNAL_MATCH_FUNC,
            0, 0, NULL, (gpointer *)changedFunc, NULL );
   }

   if( options[valueIdx].status == GNOCL_STATUS_CHANGED )
   {
      assert( strcmp( options[valueIdx].optName, "-value" ) == 0 );
      gtk_spin_button_set_value( para->spinButton, options[valueIdx].val.d );
      if( para->variable )
      {
         Tcl_Obj *obj = getObjValue( para->spinButton );
         para->inSetVar++;
         obj = Tcl_SetVar2Ex( para->interp, para->variable, NULL, obj, 
               TCL_GLOBAL_ONLY );
         para->inSetVar--;
         if( obj == NULL )
            goto cleanExit;
      }
   }

   /* if variable is set, synchronize variable and widget */
   if( options[variableIdx].status == GNOCL_STATUS_CHANGED 
         && para->variable != NULL
         && options[valueIdx].status != GNOCL_STATUS_CHANGED )
   {
      Tcl_Obj *var = Tcl_GetVar2Ex( interp, para->variable, NULL, 
            TCL_GLOBAL_ONLY );

      assert( strcmp( options[variableIdx].optName, "-variable" ) == 0 );
      if( var == NULL ) /* variable does not yet exist */
      {
         Tcl_Obj *obj = getObjValue( para->spinButton );

         para->inSetVar++;
         obj = Tcl_SetVar2Ex( para->interp, para->variable, NULL, obj, 
               TCL_GLOBAL_ONLY );
         para->inSetVar--;
         if( obj == NULL )
            goto cleanExit;
      }
      else
      {
         double d;
         if( Tcl_GetDoubleFromObj( interp, var, &d ) != TCL_OK )
            goto cleanExit;
         gtk_spin_button_set_value( para->spinButton, d );
      }
 
   }

   if( options[lowerIdx].status == GNOCL_STATUS_CHANGED )
   {
      assert( strcmp( options[lowerIdx].optName, "-lower" ) == 0 );
      lower = options[lowerIdx].val.d;
      setAdjust = 1;
   }
   if( options[upperIdx].status == GNOCL_STATUS_CHANGED )
   {
      assert( strcmp( options[upperIdx].optName, "-upper" ) == 0 );
      upper = options[upperIdx].val.d;
      setAdjust = 1;
   }
   if( options[stepIncIdx].status == GNOCL_STATUS_CHANGED )
   {
      assert( strcmp( options[stepIncIdx].optName, "-stepInc" ) == 0 );
      stepInc = options[stepIncIdx].val.d;
      setAdjust = 1;
   }
   if( options[pageIncIdx].status == GNOCL_STATUS_CHANGED )
   {
      assert( strcmp( options[pageIncIdx].optName, "-pageInc" ) == 0 );
      pageInc = options[pageIncIdx].val.d;
      setAdjust = 1;
   }


   if( setAdjust )
   {
      /* see also scale.c */
      /* last parameter is pageSize, where it is used? */
      gtk_spin_button_set_adjustment( para->spinButton, 
            GTK_ADJUSTMENT( gtk_adjustment_new( oldAdjust->value, lower, upper, 
            stepInc, pageInc, 0 ) ) ); 
      /* gtk_spin_button_update( para->spinButton ); */
   }

   /*
   spinButtonTraceFunc( para, interp, para->variable, NULL, 0 );
   */
   
   ret = TCL_OK;

cleanExit:
   if( blocked )
   {
      g_signal_handlers_unblock_matched( 
            G_OBJECT( para->spinButton ), G_SIGNAL_MATCH_FUNC, 0,
            0, NULL, (gpointer *)changedFunc, NULL );
   }

   return ret;
}
Exemple #19
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *hbox1;
  GtkWidget *frame1;
  GtkWidget *table2;
  GtkWidget *label4;
  GtkWidget *label5;
  GtkWidget *hscaleBrightness;
  GtkWidget *hscaleSaturation;
  GtkWidget *hscaleContrast;
  GtkWidget *label3;
  GtkWidget *label1;
  GtkWidget *frame2;
  GtkWidget *table3;
  GtkWidget *label6;
  GtkWidget *hscaleGamma;
  GtkWidget *hscaleGammaR;
  GtkWidget *label8;
  GtkWidget *hscaleGammaG;
  GtkWidget *label9;
  GtkWidget *label10;
  GtkWidget *label7;
  GtkWidget *hscaleGammaB;
  GtkWidget *hscaleGammaWeight;
  GtkWidget *label2;
  GtkWidget *hscale1;
  GtkWidget *drawingarea1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_container_set_border_width (GTK_CONTAINER (dialog1), 6);
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("MPlayer eq2"));
  gtk_window_set_resizable (GTK_WINDOW (dialog1), FALSE);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (hbox1), frame1, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE);

  table2 = gtk_table_new (3, 2, FALSE);
  gtk_widget_show (table2);
  gtk_container_add (GTK_CONTAINER (frame1), table2);
  gtk_container_set_border_width (GTK_CONTAINER (table2), 12);
  gtk_table_set_row_spacings (GTK_TABLE (table2), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table2), 12);

  label4 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Brigh_tness:"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table2), label4, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  label5 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Saturation:"));
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);

  hscaleBrightness = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -1, 1, 0.05, 1, 0)));
  gtk_widget_show (hscaleBrightness);
  gtk_table_attach (GTK_TABLE (table2), hscaleBrightness, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleBrightness, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleBrightness), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleBrightness), 2);

  hscaleSaturation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleSaturation);
  gtk_table_attach (GTK_TABLE (table2), hscaleSaturation, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleSaturation, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleSaturation), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleSaturation), 2);

  hscaleContrast = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, -2, 2, 0.05, 1, 0)));
  gtk_widget_show (hscaleContrast);
  gtk_table_attach (GTK_TABLE (table2), hscaleContrast, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleContrast, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleContrast), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleContrast), 2);

  label3 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Contrast:"));
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table2), label3, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  label1 = gtk_label_new ("");
  gtk_widget_show (label1);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), label1);
  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);

  frame2 = gtk_frame_new (NULL);
  gtk_widget_show (frame2);
  gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE);

  table3 = gtk_table_new (5, 2, FALSE);
  gtk_widget_show (table3);
  gtk_container_add (GTK_CONTAINER (frame2), table3);
  gtk_container_set_border_width (GTK_CONTAINER (table3), 12);
  gtk_table_set_row_spacings (GTK_TABLE (table3), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table3), 12);

  label6 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Initial:"));
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table3), label6, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);

  hscaleGamma = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleGamma);
  gtk_table_attach (GTK_TABLE (table3), hscaleGamma, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGamma, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGamma), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGamma), 2);

  hscaleGammaR = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleGammaR);
  gtk_table_attach (GTK_TABLE (table3), hscaleGammaR, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGammaR, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaR), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGammaR), 2);

  label8 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Red:"));
  gtk_widget_show (label8);
  gtk_table_attach (GTK_TABLE (table3), label8, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label8), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);

  hscaleGammaG = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleGammaG);
  gtk_table_attach (GTK_TABLE (table3), hscaleGammaG, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGammaG, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaG), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGammaG), 2);

  label9 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Green:"));
  gtk_widget_show (label9);
  gtk_table_attach (GTK_TABLE (table3), label9, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label9), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);

  label10 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Blue:"));
  gtk_widget_show (label10);
  gtk_table_attach (GTK_TABLE (table3), label10, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);

  label7 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Weight:"));
  gtk_widget_show (label7);
  gtk_table_attach (GTK_TABLE (table3), label7, 0, 1, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);

  hscaleGammaB = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleGammaB);
  gtk_table_attach (GTK_TABLE (table3), hscaleGammaB, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGammaB, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaB), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGammaB), 2);

  hscaleGammaWeight = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 1, 0.05, 1, 0)));
  gtk_widget_show (hscaleGammaWeight);
  gtk_table_attach (GTK_TABLE (table3), hscaleGammaWeight, 1, 2, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGammaWeight, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaWeight), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGammaWeight), 2);

  label2 = gtk_label_new (QT_TR_NOOP("<b>Gamma</b>"));
  gtk_widget_show (label2);
  gtk_frame_set_label_widget (GTK_FRAME (frame2), label2);
  gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 1, 0)));
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, FALSE, FALSE, 0);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, TRUE, TRUE, 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  gtk_label_set_mnemonic_widget (GTK_LABEL (label4), hscaleBrightness);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label5), hscaleSaturation);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label3), hscaleContrast);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label6), hscaleGamma);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label8), hscaleGammaR);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label9), hscaleGammaG);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label10), hscaleGammaB);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label7), hscaleGammaWeight);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (dialog1, frame1, "frame1");
  GLADE_HOOKUP_OBJECT (dialog1, table2, "table2");
  GLADE_HOOKUP_OBJECT (dialog1, label4, "label4");
  GLADE_HOOKUP_OBJECT (dialog1, label5, "label5");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleBrightness, "hscaleBrightness");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleSaturation, "hscaleSaturation");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleContrast, "hscaleContrast");
  GLADE_HOOKUP_OBJECT (dialog1, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, frame2, "frame2");
  GLADE_HOOKUP_OBJECT (dialog1, table3, "table3");
  GLADE_HOOKUP_OBJECT (dialog1, label6, "label6");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGamma, "hscaleGamma");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaR, "hscaleGammaR");
  GLADE_HOOKUP_OBJECT (dialog1, label8, "label8");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaG, "hscaleGammaG");
  GLADE_HOOKUP_OBJECT (dialog1, label9, "label9");
  GLADE_HOOKUP_OBJECT (dialog1, label10, "label10");
  GLADE_HOOKUP_OBJECT (dialog1, label7, "label7");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaB, "hscaleGammaB");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaWeight, "hscaleGammaWeight");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Exemple #20
0
GtkWidget *
gu_playdeck_add(gu_window_t *gw, GtkWidget *parent)
{
    GtkToolItem *ti;
    GtkWidget *w;
    GtkWidget *l;
    GtkWidget *vbox;
    GtkWidget *playdeck;
    playdeck_t *pd = calloc(1, sizeof(playdeck_t));
    prop_courier_t *pc = gw->gw_gu->gu_pc;

    playdeck = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(parent), playdeck, FALSE, TRUE, 0);

    w = gtk_hseparator_new();
    gtk_widget_show(w);
    gtk_box_pack_start(GTK_BOX(playdeck), w, FALSE, TRUE, 0);


    pd->root = gtk_hbox_new(FALSE, 1);
    gtk_widget_show(pd->root);
    gtk_box_pack_start(GTK_BOX(playdeck), pd->root, FALSE, TRUE, 0);

    /* Playdeck album art */
    w = gtk_image_new();
    gtk_widget_show(w);
    gtk_misc_set_alignment(GTK_MISC(w), 0, 1);
    gtk_box_pack_start(GTK_BOX(pd->root), w, FALSE, TRUE, 0);

    pd->sub_album_art =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "metadata", "album_art"),
                       PROP_TAG_CALLBACK_STRING, pd_set_albumart, w,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Middle vbox */
    vbox = gtk_vbox_new(FALSE, 1);
    gtk_box_pack_start(GTK_BOX(pd->root), vbox, TRUE, TRUE, 0);


    /* Title of current track */
    l = gtk_label_new("");
    gtk_misc_set_alignment(GTK_MISC(l), 0, 0);
    gtk_box_pack_start(GTK_BOX(vbox), l, TRUE, TRUE, 0);
    g_object_set(G_OBJECT(l),
                 "ellipsize", PANGO_ELLIPSIZE_END, NULL);

    pd->sub_title =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "metadata", "title"),
                       PROP_TAG_CALLBACK_STRING, set_current_title, l,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Title of current track */
    pd->trackextra = gtk_label_new("");
    g_object_set(G_OBJECT(pd->trackextra),
                 "ellipsize", PANGO_ELLIPSIZE_END, NULL);
    gtk_misc_set_alignment(GTK_MISC(pd->trackextra), 0, 0);
    gtk_box_pack_start(GTK_BOX(vbox), pd->trackextra, TRUE, TRUE, 0);

    pd->sub_album =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "metadata", "album"),
                       PROP_TAG_CALLBACK_STRING, set_current_album, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);

    pd->sub_artist =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "metadata", "artist"),
                       PROP_TAG_CALLBACK_STRING, set_current_artist, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);



    /* The toolbar */
    pd->tbar = gtk_toolbar_new();
    gtk_toolbar_set_style(GTK_TOOLBAR(pd->tbar), GTK_TOOLBAR_ICONS);
    gtk_box_pack_start(GTK_BOX(vbox), pd->tbar, FALSE, TRUE, 0);

    /* Prev button */
    pd->prev = ti = gtk_tool_button_new_from_stock(GTK_STOCK_MEDIA_PREVIOUS);
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);
    g_signal_connect(G_OBJECT(ti), "clicked", G_CALLBACK(prev_clicked), pd);

    pd->sub_canSkipBackward =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "canSkipBackward"),
                       PROP_TAG_CALLBACK_INT, gu_subscription_set_sensitivity,
                       pd->prev,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Play / Pause */
    pd->playpause = ti = gtk_tool_button_new_from_stock(GTK_STOCK_MEDIA_PLAY);
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);
    g_signal_connect(G_OBJECT(ti), "clicked", G_CALLBACK(playpause_clicked), pd);

    pd->sub_canPause =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "canPause"),
                       PROP_TAG_CALLBACK_INT, gu_subscription_set_sensitivity,
                       pd->playpause,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Next button */
    pd->next = ti = gtk_tool_button_new_from_stock(GTK_STOCK_MEDIA_NEXT);
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);
    g_signal_connect(G_OBJECT(ti), "clicked", G_CALLBACK(next_clicked), pd);

    pd->sub_canSkipForward =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "canSkipForward"),
                       PROP_TAG_CALLBACK_INT, gu_subscription_set_sensitivity,
                       pd->next,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Separator */
    ti = gtk_separator_tool_item_new();
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);

    /* Subscribe to playstatus */
    pd->sub_playstatus =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current", "playstatus"),
                       PROP_TAG_CALLBACK, update_playstatus, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /**
     * Media position
     */
    pd->pos_adjust = gtk_adjustment_new(0, 0, 0, 0, 0, 0);

    pd->pos_slider = gtk_hscale_new(GTK_ADJUSTMENT(pd->pos_adjust));
    gtk_scale_set_value_pos (GTK_SCALE(pd->pos_slider), GTK_POS_LEFT);

    g_signal_connect(G_OBJECT(pd->pos_slider), "grab-focus",
                     G_CALLBACK(slider_grabbed), pd);

    g_signal_connect(G_OBJECT(pd->pos_slider), "change-value",
                     G_CALLBACK(slider_updated), pd);

    g_signal_connect(G_OBJECT(pd->pos_slider), "format-value",
                     G_CALLBACK(slider_value_callback), pd);

    ti = gtk_tool_item_new();
    gtk_tool_item_set_expand(ti, TRUE);
    gtk_container_add(GTK_CONTAINER(ti), pd->pos_slider);
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);

    /* Subscribe to current track position */
    pd->sub_pos =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current", "currenttime"),
                       PROP_TAG_CALLBACK_FLOAT, update_curtime, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Subscribe to current track duration */
    pd->sub_duration =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "metadata", "duration"),
                       PROP_TAG_CALLBACK_FLOAT, update_duration, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);



    /* Separator */
    ti = gtk_separator_tool_item_new();
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);

    gtk_widget_show_all(vbox);

    /**
     * Volume control
     */
    ti = gtk_tool_item_new();
    pd->volume = gtk_volume_button_new();
    gtk_container_add(GTK_CONTAINER(ti), pd->volume);
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);

    g_signal_connect(G_OBJECT(pd->volume), "value-changed",
                     G_CALLBACK(read_mastervol), pd);

    pd->sub_volume =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "audio", "mastervolume"),
                       PROP_TAG_CALLBACK_FLOAT, update_mastervol, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);
    gtk_widget_show_all(GTK_WIDGET(ti));

    g_signal_connect(playdeck, "destroy", G_CALLBACK(playdeck_dtor), pd);
    return playdeck;
}
Exemple #21
0
		CVoxelView::CVoxelView(CVoxelDisplay& rVoxelDisplay) :
			m_rVoxelDisplay(rVoxelDisplay),
			m_pBuilderInterface(NULL),
			m_pCubeButton(NULL),
			m_pSphereButton(NULL),
			m_pMinScaleFactorSpinButton(NULL),
			m_pMaxScaleFactorSpinButton(NULL),
			m_f64MinScaleFactor(1),
			m_f64MaxScaleFactor(2),
			m_pThresholdRangeAndOrLabel(NULL),
			m_pMinDisplayThresholdBoundaryButton(NULL),
			m_pMaxDisplayThresholdBoundaryButton(NULL),
			m_pMinDisplayThresholdScale(NULL),
			m_pMaxDisplayThresholdScale(NULL),
			m_f64MinDisplayThreshold(0.25),
			m_f64MaxDisplayThreshold(0.75)
		{
			//load the gtk builder interface
			m_pBuilderInterface=gtk_builder_new(); // glade_xml_new("../share/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-VoxelDisplay.ui", NULL, NULL);
			gtk_builder_add_from_file(m_pBuilderInterface, "../share/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-VoxelDisplay.ui", NULL);

			if(!m_pBuilderInterface)
			{
				g_warning("Couldn't load the interface!");
				return;
			}

			gtk_builder_connect_signals(m_pBuilderInterface, NULL);

			//toolbar
			//-------

			//voxel object buttons
			m_pCubeButton = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "CubeButton"));
			m_pSphereButton = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "SphereButton"));

			g_signal_connect(G_OBJECT(m_pCubeButton), "toggled", G_CALLBACK(setVoxelObjectCallback), this);
			g_signal_connect(G_OBJECT(m_pSphereButton), "toggled", G_CALLBACK(setVoxelObjectCallback), this);

			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifyColorToolButton")), "toggled", G_CALLBACK(toggleColorModificationCallback), this);
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifyTransparencyToolButton")), "toggled", G_CALLBACK(toggleTransparencyModificationCallback), this);
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifySizeToolButton")), "toggled", G_CALLBACK(toggleSizeModificationCallback), this);

			//min voxel scale factor
			m_pMinScaleFactorSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MinScaleFactorSpinButton"));
			m_rVoxelDisplay.setMinScaleFactor(m_f64MinScaleFactor);
			gtk_spin_button_configure(
				m_pMinScaleFactorSpinButton,
				GTK_ADJUSTMENT(gtk_adjustment_new(
					m_f64MinScaleFactor, //initial value
					0, //lower
					5, //upper
					0.1, //step increment
					0.5, //page increment
					0)), //page size - deprecated
					0.1, //climb rate
					1); //digits
			g_signal_connect(G_OBJECT(m_pMinScaleFactorSpinButton), "value-changed", G_CALLBACK(setMinScaleFactorCallback), this);

			//max voxel scale factor
			m_pMaxScaleFactorSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MaxScaleFactorSpinButton"));
			m_rVoxelDisplay.setMaxScaleFactor(m_f64MaxScaleFactor);
			gtk_spin_button_configure(
				m_pMaxScaleFactorSpinButton,
				GTK_ADJUSTMENT(gtk_adjustment_new(
					m_f64MaxScaleFactor, //initial value
					0, //lower
					5, //upper
					0.1, //step increment
					0.5, //page increment
					0)), //page size - deprecated
					0.1, //climb rate
					1); //digits
			g_signal_connect(G_OBJECT(m_pMaxScaleFactorSpinButton), "value-changed", G_CALLBACK(setMaxScaleFactorCallback), this);

			boolean l_bInclusiveDisplayThresholdBoundary = true;
			m_rVoxelDisplay.setDisplayThresholdBoundaryType(l_bInclusiveDisplayThresholdBoundary);

			//AND/OR label
			m_pThresholdRangeAndOrLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilderInterface, "ThresholdRangeAndOrLabel"));
			gtk_label_set_label(m_pThresholdRangeAndOrLabel, l_bInclusiveDisplayThresholdBoundary? "AND" : "OR");

			//min display threshold boundary type
			m_pMinDisplayThresholdBoundaryButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MinDisplayThresholdBoundaryButton"));
			gtk_button_set_label(m_pMinDisplayThresholdBoundaryButton, l_bInclusiveDisplayThresholdBoundary ? ">" : "<");
			g_signal_connect(G_OBJECT(m_pMinDisplayThresholdBoundaryButton), "clicked", G_CALLBACK(setMinDisplayThresholdBoundaryTypeCallback), this);

			//max display threshold boundary type
			m_pMaxDisplayThresholdBoundaryButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MaxDisplayThresholdBoundaryButton"));
			gtk_button_set_label(m_pMaxDisplayThresholdBoundaryButton, l_bInclusiveDisplayThresholdBoundary ? "<" : ">");
			g_signal_connect(G_OBJECT(m_pMaxDisplayThresholdBoundaryButton), "clicked", G_CALLBACK(setMaxDisplayThresholdBoundaryTypeCallback), this);

			//min display threshold slider
			m_pMinDisplayThresholdScale = GTK_SCALE(gtk_hscale_new_with_range(0.0, 1.0, 0.01));
			m_rVoxelDisplay.setMinDisplayThreshold(m_f64MinDisplayThreshold);
			gtk_range_set_value(GTK_RANGE(m_pMinDisplayThresholdScale), m_f64MinDisplayThreshold);
			gtk_scale_set_value_pos(m_pMinDisplayThresholdScale, GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(m_pMinDisplayThresholdScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(GTK_WIDGET(m_pMinDisplayThresholdScale), 100, -1);
			gtk_widget_show_all(GTK_WIDGET(m_pMinDisplayThresholdScale));
			g_signal_connect(G_OBJECT(m_pMinDisplayThresholdScale), "value_changed", G_CALLBACK(setMinDisplayThresholdCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldMinScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "MinDisplayThresholdScale"));
			GtkWidget* l_pMinScaleParent = gtk_widget_get_parent(l_pOldMinScale);
			if(l_pMinScaleParent != NULL && GTK_IS_CONTAINER(l_pMinScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pMinScaleParent), l_pOldMinScale);
				if(GTK_IS_BOX(l_pMinScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pMinScaleParent), GTK_WIDGET(m_pMinDisplayThresholdScale), TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pMinScaleParent), GTK_WIDGET(m_pMinDisplayThresholdScale), 1);
				}
			}

			//max display threshold slider
			m_pMaxDisplayThresholdScale = GTK_SCALE(gtk_hscale_new_with_range(0.0, 1.0, 0.01));
			m_rVoxelDisplay.setMaxDisplayThreshold(m_f64MaxDisplayThreshold);
			gtk_range_set_value(GTK_RANGE(m_pMaxDisplayThresholdScale), m_f64MaxDisplayThreshold);
			gtk_scale_set_value_pos(m_pMaxDisplayThresholdScale, GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(m_pMaxDisplayThresholdScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(GTK_WIDGET(m_pMaxDisplayThresholdScale), 100, -1);
			gtk_widget_show_all(GTK_WIDGET(m_pMaxDisplayThresholdScale));
			g_signal_connect(G_OBJECT(m_pMaxDisplayThresholdScale), "value_changed", G_CALLBACK(setMaxDisplayThresholdCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldMaxScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "MaxDisplayThresholdScale"));
			GtkWidget* l_pMaxScaleParent = gtk_widget_get_parent(l_pOldMaxScale);
			if(l_pMaxScaleParent != NULL && GTK_IS_CONTAINER(l_pMaxScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pMaxScaleParent), l_pOldMaxScale);
				if(GTK_IS_BOX(l_pMaxScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pMaxScaleParent), GTK_WIDGET(m_pMaxDisplayThresholdScale), TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pMaxScaleParent), GTK_WIDGET(m_pMaxDisplayThresholdScale), 1);
				}
			}

			//skull opacity slider
			GtkWidget* l_pSkullOpacityScale = gtk_hscale_new_with_range(0.0, 1.0, 0.05);
			float64 l_f64SkullOpacity = 0.07;
			gtk_range_set_value(GTK_RANGE(l_pSkullOpacityScale), l_f64SkullOpacity);
			m_rVoxelDisplay.setSkullOpacity(l_f64SkullOpacity);
			gtk_scale_set_value_pos(GTK_SCALE(l_pSkullOpacityScale), GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(l_pSkullOpacityScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(l_pSkullOpacityScale, 100, -1);
			gtk_widget_show_all(l_pSkullOpacityScale);
			g_signal_connect(G_OBJECT(l_pSkullOpacityScale), "value_changed", G_CALLBACK(setSkullOpacityCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "SkullOpacityScale"));
			GtkWidget* l_pScaleParent = gtk_widget_get_parent(l_pOldScale);
			if(l_pScaleParent != NULL && GTK_IS_CONTAINER(l_pScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pScaleParent), l_pOldScale);
				if(GTK_IS_BOX(l_pScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pScaleParent), l_pSkullOpacityScale, TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pScaleParent), l_pSkullOpacityScale, 0);
				}
			}

			//camera animation button
			GtkToggleToolButton* l_pAnimateCameraButton = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "AnimateCameraButton"));
			g_signal_connect(G_OBJECT(l_pAnimateCameraButton), "toggled", G_CALLBACK(toggleAnimateCameraCallback), this);

			//reposition camera
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "RepositionCamera")),	"clicked", G_CALLBACK(repositionCameraCallback), this);

			this->toggleColorModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifyColorToolButton")))?true:false);
			this->toggleTransparencyModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifyTransparencyToolButton")))?true:false);
			this->toggleSizeModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifySizeToolButton")))?true:false);
			this->enableAutoCameraMovementCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "AnimateCameraButton")))?true:false);
		}
/* ------------------------------
 * do_dialog
 * ------------------------------
 * create and show the dialog window
 */
static void
do_dialog (FgSelectDialogGuiStuff *guiStuffPtr, GapFgSelectValues *cuvals)
{
  GtkWidget  *vbox;

  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *frame1;
  GtkWidget *vbox1;
  GtkWidget *label;
  GtkWidget *table1;
  GtkObject *spinbutton_adj;
  GtkWidget *spinbutton;
  GtkWidget *dialog_action_area1;
  GtkWidget *checkbutton;
  GtkWidget *combo;
  gint       row;


  /* Init UI  */
  gimp_ui_init ("Forground Extract", FALSE);


  /*  The dialog1  */
  guiStuffPtr->run = FALSE;
  guiStuffPtr->vals = cuvals;


  /*  The dialog1 and main vbox  */
  dialog1 = gimp_dialog_new (_("Foreground-Extract"), "foreground_extract",
                               NULL, 0,
                               gimp_standard_help_func, PLUG_IN2_HELP_ID,
                               
                               GIMP_STOCK_RESET, GAP_FOREGROUND_FROM_SELECTION_RESPONSE_RESET,
                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                               GTK_STOCK_OK,     GTK_RESPONSE_OK,
                               NULL);

  guiStuffPtr->shell = dialog1;


  /*
   * g_object_set_data (G_OBJECT (dialog1), "dialog1", dialog1);
   * gtk_window_set_title (GTK_WINDOW (dialog1), _("dialog1"));
   */


  g_signal_connect (G_OBJECT (dialog1), "response",
                      G_CALLBACK (p_fg_from_selectiont_response),
                      guiStuffPtr);

  /* the vbox */
  vbox = gtk_vbox_new (FALSE, 2);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog1)->vbox), vbox,
                      TRUE, TRUE, 0);
  gtk_widget_show (vbox);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  g_object_set_data (G_OBJECT (dialog1), "dialog_vbox1", dialog_vbox1);
  gtk_widget_show (dialog_vbox1);



  /* the frame */
  frame1 = gimp_frame_new (_("Options"));

  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), frame1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame1), 2);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (frame1), vbox1);
  gtk_widget_show (vbox1);


  /* table1 for ...  */
  table1 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (table1), 4);


  row = 0;

  /* the InnerRadius spinbutton  */
  label = gtk_label_new (_("Inner Radius"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table1), label, 0, 1, row, row+1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
  spinbutton_adj = gtk_adjustment_new (cuvals->innerRadius, 0.0, 500, 1, 10, 0);
  spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 2);
  gimp_help_set_help_data (spinbutton, _("Radius for undefined (e.g. trimmable) area inside the selection border"), NULL);
  gtk_widget_show (spinbutton);
  gtk_table_attach (GTK_TABLE (table1), spinbutton, 1, 2, row, row+1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  g_signal_connect (G_OBJECT (spinbutton_adj), "value_changed", G_CALLBACK (gimp_int_adjustment_update),
                    &cuvals->innerRadius);
  guiStuffPtr->colordiff_innerRadius_spinbutton_adj = spinbutton_adj;
  guiStuffPtr->colordiff_innerRadius_spinbutton = spinbutton;

  row++;

  /* the OuterRadius spinbutton  */
  label = gtk_label_new (_("Outer Radius"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table1), label, 0, 1, row, row+1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
  spinbutton_adj = gtk_adjustment_new (cuvals->outerRadius, 0.0, 500, 1, 10, 0);
  spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 2);
  gimp_help_set_help_data (spinbutton, _("Radius for undefined (e.g. trimmable) area outside the selection border"), NULL);
  gtk_widget_show (spinbutton);
  gtk_table_attach (GTK_TABLE (table1), spinbutton, 1, 2, row, row+1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  g_signal_connect (G_OBJECT (spinbutton_adj), "value_changed", G_CALLBACK (gimp_int_adjustment_update),
                    &cuvals->outerRadius);
  guiStuffPtr->colordiff_outerRadius_spinbutton_adj = spinbutton_adj;
  guiStuffPtr->colordiff_outerRadius_spinbutton = spinbutton;

 



  row++;

  /* create_layermask checkbutton  */
  label = gtk_label_new (_("Create Layermask:"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table1), label, 0, 1, row, row+1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);


  checkbutton = gtk_check_button_new_with_label (" ");
  g_object_set_data (G_OBJECT (checkbutton), "guiStuffPtr", guiStuffPtr);
  guiStuffPtr->create_layermaskCheckbutton = checkbutton;
  gimp_help_set_help_data (checkbutton, _("ON: render opacity by creating a new layer mask, "
                                          "OFF: apply rendered opacity to the alpha channel"), NULL);
  gtk_widget_show (checkbutton);
  gtk_table_attach( GTK_TABLE(table1), checkbutton, 1, 2, row, row+1,
                    GTK_FILL, 0, 0, 0 );
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), cuvals->create_layermask);
  g_signal_connect (checkbutton, "toggled",
                    G_CALLBACK (on_gboolean_button_update),
                    &cuvals->create_layermask);

  row++;


  /* lock_color checkbutton  */
  label = gtk_label_new (_("Lock Colors:"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table1), label, 0, 1, row, row+1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);

  checkbutton = gtk_check_button_new_with_label (" ");
  g_object_set_data (G_OBJECT (checkbutton), "guiStuffPtr", guiStuffPtr);
  guiStuffPtr->lock_colorCheckbutton = checkbutton;
  gimp_help_set_help_data (checkbutton, _("ON: Keep RGB channels of the input layer, "
                                          "OFF: allow Background color removal in processed undefined regions"), NULL);
  gtk_widget_show (checkbutton);
  gtk_table_attach( GTK_TABLE(table1), checkbutton, 1, 2, row, row+1,
                    GTK_FILL, 0, 0, 0 );
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), cuvals->lock_color);
  g_signal_connect (checkbutton, "toggled",
                    G_CALLBACK (on_gboolean_button_update),
                    &cuvals->lock_color);

  row++;

 
  /* colordiff_threshold spinbutton  */
  label = gtk_label_new (_("Color Diff Threshold"));
  //gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table1), label, 0, 1, row, row+1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
  spinbutton_adj = gtk_adjustment_new (cuvals->colordiff_threshold, 0.0, 100, 0.1, 1, 0);
  spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 2);
  gimp_help_set_help_data (spinbutton, _("sensitivity for color comparison"), NULL);
  //gtk_widget_show (spinbutton);
  gtk_table_attach (GTK_TABLE (table1), spinbutton, 1, 2, row, row+1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  g_signal_connect (G_OBJECT (spinbutton_adj), "value_changed", G_CALLBACK (gimp_double_adjustment_update),
                    &cuvals->colordiff_threshold);
  guiStuffPtr->colordiff_threshold_spinbutton_adj = spinbutton_adj;
  guiStuffPtr->colordiff_threshold_spinbutton = spinbutton;






  /* -- */


  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);

  p_init_widget_values(guiStuffPtr);
  p_update_widget_sensitivity (guiStuffPtr);

  gtk_widget_show (dialog1);

  gtk_main ();
  gdk_flush ();


}  /* end do_dialog */
Exemple #23
0
int main(int argc, char **argv) {

    struct arguments argument;
    struct arguments *pargument = &argument;

    //InitOpenAL(); // potential memory leak
    source = 0;
    pargument->first = 1;
    pargument->endless_check = 0;
    pargument->continue_count = 0;
    pargument->offset = 0;
    pargument->elapsed = g_timer_new();
    GtkWidget *window, *hpaned, *pause_button, *bitrate_label, *chooser1, *chooser2, *chooser3, *vboxl, *vboxr, *check,
              *continue_check, *continue_label, *next_button, *button2, *spin_int, *progressbar, *button_hbox, *continue_hbox;
    GtkFileFilter *filter1, *filter2;

    gtk_init(&argc, &argv);

    //g_remove("list.txt");
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    pargument->adjust = (GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 1, 1, 1);

#if GTK3
    progressbar = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adjust);
#endif
    progressbar = gtk_hscale_new(pargument->adjust);
    gtk_scale_set_draw_value ((GtkScale*)progressbar, FALSE);
    gtk_window_set_title(GTK_WINDOW(window), "lelele player");
    pargument->label = gtk_label_new ("");
    pargument->title_label = gtk_label_new("");
    pargument->album_label = gtk_label_new("");
    pargument->artist_label = gtk_label_new("");
    gtk_label_set_line_wrap((GtkLabel*)pargument->title_label, TRUE);
    gtk_label_set_line_wrap((GtkLabel*)pargument->artist_label, TRUE);
    gtk_label_set_line_wrap((GtkLabel*)pargument->album_label, TRUE);
    continue_label = gtk_label_new("Number of songs played\n -1 to go endless");

    gtk_container_set_border_width(GTK_CONTAINER(window), 10);
    gtk_widget_set_size_request(window, 500, 250);
    hpaned = gtk_hpaned_new();

    spin_int = gtk_spin_button_new_with_range(-1, 10000, 1);
    gtk_spin_button_set_value ((GtkSpinButton*)spin_int, 1);
    pause_button = gtk_button_new_with_mnemonic("_Play/Pause");
    next_button = gtk_button_new_with_mnemonic("Next");
    check = gtk_check_button_new_with_label ("Endless mode.");
    //continue_check = gtk_check_button_new_with_label("Play this number of songs.");


    g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL);
    g_signal_connect (G_OBJECT(pause_button), "clicked", G_CALLBACK(play), pargument);
    g_signal_connect (G_OBJECT(next_button), "clicked", G_CALLBACK(next), pargument);
    g_signal_connect (G_OBJECT(check), "toggled", G_CALLBACK(check_toggled), pargument);
    //g_signal_connect(G_OBJECT(continue_check), "toggled", G_CALLBACK(continue_check_toggled), spin_int);
    g_signal_connect(G_OBJECT(spin_int), "value-changed", G_CALLBACK(continue_spin_count), pargument);
    g_signal_connect(G_OBJECT(progressbar), "value-changed", G_CALLBACK(slider_changed), pargument);


    /* Create two buttons, one to select a folder and one to select a file. */

    chooser1 = gtk_file_chooser_button_new ("Chooser a Folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
    chooser2 = gtk_file_chooser_button_new ("Chooser a Folder", GTK_FILE_CHOOSER_ACTION_OPEN);
    chooser3 = gtk_file_chooser_button_new ("Choose a folder for config (may take some time)", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);

    /* Monitor when the selected folder or file are changed. */
    g_signal_connect (G_OBJECT (chooser2), "selection_changed", G_CALLBACK (file_changed), pargument);
    g_signal_connect (G_OBJECT (chooser1), "selection_changed", G_CALLBACK(folder_changed), pargument);
    g_signal_connect (G_OBJECT (chooser3), "selection_changed", G_CALLBACK (config_folder_changed), pargument);

    /* Set both file chooser buttons to the location of the user's home directory. */
    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser2), g_get_home_dir());

    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser1), g_get_home_dir());
    /* Provide a filter to show all files and one to shown only 3 types of images. */
    filter1 = gtk_file_filter_new ();
    filter2 = gtk_file_filter_new ();
    gtk_file_filter_set_name (filter1, "Audio Files");
    gtk_file_filter_set_name (filter2, "All Files");
    gtk_file_filter_add_pattern (filter1, "*.mp3");
    gtk_file_filter_add_pattern (filter1, "*.flac");
    gtk_file_filter_add_pattern (filter1, "*.aac");
    gtk_file_filter_add_pattern (filter2, "*");

    /* Add the both filters to the file chooser button that selects files. */
    gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser2), filter1);
    gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser2), filter2);


    //gtk_widget_set_sensitive(spin_int, FALSE);
    vboxl = gtk_vbox_new (TRUE, 5);
    vboxr = gtk_vbox_new (TRUE, 5);
    button_hbox = gtk_hbox_new (TRUE, 5);
    continue_hbox= gtk_hbox_new (TRUE, 5);

    gtk_box_set_homogeneous(GTK_BOX(vboxr), FALSE);
    gtk_box_set_homogeneous(GTK_BOX(continue_hbox), FALSE);

    gtk_box_pack_start_defaults (GTK_BOX (vboxl), chooser1);
    gtk_box_pack_start_defaults (GTK_BOX (vboxl), chooser2);
//	gtk_box_pack_start_defaults (GTK_BOX (vboxl), chooser3);
    //gtk_box_pack_start_defaults (GTK_BOX (vboxl), check);

    gtk_box_pack_start_defaults (GTK_BOX (vboxl), continue_hbox);
    gtk_box_pack_start_defaults (GTK_BOX(continue_hbox), continue_label);
    gtk_box_pack_start_defaults (GTK_BOX(continue_hbox), spin_int);
    gtk_box_pack_start_defaults (GTK_BOX (vboxl), button_hbox);
    gtk_box_pack_start_defaults (GTK_BOX (button_hbox), pause_button);
    gtk_box_pack_start_defaults (GTK_BOX(button_hbox), next_button);
    gtk_box_pack_start_defaults (GTK_BOX(vboxl), progressbar);

    gtk_box_pack_start(GTK_BOX (vboxr), pargument->label, FALSE, FALSE, 1);
    gtk_box_pack_start(GTK_BOX (vboxr), pargument->title_label, FALSE, FALSE, 1);
    gtk_box_pack_start(GTK_BOX (vboxr), pargument->album_label, FALSE, FALSE, 1);
    gtk_box_pack_start(GTK_BOX (vboxr), pargument->artist_label, FALSE, FALSE, 1);

#ifdef GTK3
    vboxl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
    vboxr = gtk_vboxr_new (GTK_ORIENTATION_VERTICAL, 5);
    gtk_box_pack_start (GTK_BOX (vboxl), chooser1, TRUE, TRUE, 3);
    gtk_box_pack_start (GTK_BOX (vboxl), chooser2, TRUE, TRUE, 3);
    gtk_box_pack_start (GTK_BOX (vboxl), pause_button, TRUE, TRUE, 3);
    gtk_box_pack_start (GTK_BOX(vboxl), next_button, TRUE, TRUE, 3);
    gtk_box_pack_start (GTK_BOX (vboxl), pargument->label, TRUE, TRUE, 3);
    gtk_box_pack_start (GTK_BOX (vboxl), check, TRUE, TRUE, 3);
    gtk_box_pack_start (GTK_BOX(vboxl), continue_check, TRUE, TRUE, 3);
    gtk_box_pack_start (GTK_BOX(vboxl), spin_int, TRUE, TRUE, 3);

    gtk_box_pack_start (GTK_BOX(vboxl), progressbar, TRUE, TRUE, 3);

    gtk_box_pack_start (GTK_BOX (vboxr), pargument->label, TRUE, TRUE, 3);
    gtk_box_pack_start_defaults (GTK_BOX (vboxr), pargument->title_label, TRUE, TRUE, 3);
    gtk_box_pack_start_defaults (GTK_BOX (vboxr), pargument->album_label, TRUE, TRUE, 3);
    gtk_box_pack_start_defaults (GTK_BOX (vboxr), pargument->artist_label, TRUE, TRUE, 3);

#endif

    gtk_paned_pack1(GTK_PANED(hpaned), vboxl, FALSE, FALSE);
    gtk_paned_pack2(GTK_PANED(hpaned), vboxr, TRUE, FALSE);
    gtk_container_add (GTK_CONTAINER (window), hpaned);

    gtk_widget_show_all(window);

    gtk_main();
    return 0;
}
GtkWidget*
create_threshold_dialog (void)
{
  GtkWidget *threshold_dialog;
  GtkWidget *dialogVbox;
  GtkWidget *allButButtonsVbox;
  GtkWidget *settingsOuterHbox;
  GtkWidget *settingsOuterVbox;
  GtkWidget *minValueVbox;
  GtkWidget *minValueLabel;
  GtkWidget *minValueHbox;
  GtkWidget *minValueSlider;
  GtkObject *minValueSpinner_adj;
  GtkWidget *minValueSpinner;
  GtkWidget *maxValueVbox;
  GtkWidget *maxValueLabel;
  GtkWidget *maxValueHbox;
  GtkWidget *maxValueSlider;
  GtkObject *maxValueSpinner_adj;
  GtkWidget *maxValueSpinner;
  GtkWidget *outputValuesHbox;
  GtkWidget *outputValuesLabel;
  GtkWidget *outputValuesMenu;
  GtkWidget *debugHbox;
  GtkWidget *debugLabel;
  GtkObject *debugSpinButton_adj;
  GtkWidget *debugSpinButton;
  GtkWidget *previewFrame;
  GtkWidget *previewAlignment;
  GtkWidget *previewVbox;
  GtkWidget *previewControlHbox;
  GtkWidget *previewOutputMenu;
  GtkWidget *previewSlider;
  GtkWidget *previewVideo;
  GtkWidget *previewLabel;
  GtkWidget *dialogButtonBox;
  GtkWidget *cancelButton;
  GtkWidget *okButton;

  threshold_dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (threshold_dialog), QT_TR_NOOP("Threshold"));
  gtk_window_set_type_hint (GTK_WINDOW (threshold_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialogVbox = GTK_DIALOG (threshold_dialog)->vbox;
  gtk_widget_show (dialogVbox);

  allButButtonsVbox = gtk_vbox_new (FALSE, 12);
  gtk_widget_show (allButButtonsVbox);
  gtk_box_pack_start (GTK_BOX (dialogVbox), allButButtonsVbox, TRUE, TRUE, 0);

  settingsOuterHbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (settingsOuterHbox);
  gtk_box_pack_start (GTK_BOX (allButButtonsVbox), settingsOuterHbox, FALSE, TRUE, 0);

  settingsOuterVbox = gtk_vbox_new (FALSE, 12);
  gtk_widget_show (settingsOuterVbox);
  gtk_box_pack_start (GTK_BOX (settingsOuterHbox), settingsOuterVbox, TRUE, TRUE, 0);

  minValueVbox = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (minValueVbox);
  gtk_box_pack_start (GTK_BOX (settingsOuterVbox), minValueVbox, FALSE, FALSE, 0);

  minValueLabel = gtk_label_new (QT_TR_NOOP("Minimum value to be in-range:"));
  gtk_widget_show (minValueLabel);
  gtk_box_pack_start (GTK_BOX (minValueVbox), minValueLabel, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (minValueLabel), 0.5, 1);
  gtk_misc_set_padding (GTK_MISC (minValueLabel), 0, 8);

  minValueHbox = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (minValueHbox);
  gtk_box_pack_start (GTK_BOX (minValueVbox), minValueHbox, TRUE, TRUE, 0);

#ifdef ORIGINAL_CODE_GENERATED_BY_GLADE
  minValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 255, 1, 1, 0)));
#else
  minValueSpinner_adj = gtk_adjustment_new (0, 0, 255, 1, 1, 0);
  minValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (minValueSpinner_adj));
#endif
  gtk_widget_show (minValueSlider);
  gtk_box_pack_start (GTK_BOX (minValueHbox), minValueSlider, TRUE, TRUE, 0);
  gtk_scale_set_draw_value (GTK_SCALE (minValueSlider), FALSE);
  gtk_scale_set_value_pos (GTK_SCALE (minValueSlider), GTK_POS_LEFT);
  gtk_scale_set_digits (GTK_SCALE (minValueSlider), 0);

#ifdef ORIGINAL_CODE_GENERATED_BY_GLADE
  minValueSpinner_adj = gtk_adjustment_new (0, 0, 255, 1, 10, 10);
#endif
  minValueSpinner = gtk_spin_button_new (GTK_ADJUSTMENT (minValueSpinner_adj), 1, 0);
  gtk_widget_show (minValueSpinner);
  gtk_box_pack_start (GTK_BOX (minValueHbox), minValueSpinner, FALSE, TRUE, 0);

  maxValueVbox = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (maxValueVbox);
  gtk_box_pack_start (GTK_BOX (settingsOuterVbox), maxValueVbox, FALSE, FALSE, 0);

  maxValueLabel = gtk_label_new (QT_TR_NOOP("Maximum value to be in-range:"));
  gtk_widget_show (maxValueLabel);
  gtk_box_pack_start (GTK_BOX (maxValueVbox), maxValueLabel, FALSE, FALSE, 0);

  maxValueHbox = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (maxValueHbox);
  gtk_box_pack_start (GTK_BOX (maxValueVbox), maxValueHbox, TRUE, TRUE, 0);

#ifdef ORIGINAL_CODE_GENERATED_BY_GLADE
  maxValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (255, 0, 255, 1, 1, 0)));
#else
  maxValueSpinner_adj = gtk_adjustment_new (255, 0, 255, 1, 1, 0);
  maxValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (maxValueSpinner_adj));
#endif
  gtk_widget_show (maxValueSlider);
  gtk_box_pack_start (GTK_BOX (maxValueHbox), maxValueSlider, TRUE, TRUE, 0);
  gtk_scale_set_draw_value (GTK_SCALE (maxValueSlider), FALSE);
  gtk_scale_set_value_pos (GTK_SCALE (maxValueSlider), GTK_POS_LEFT);
  gtk_scale_set_digits (GTK_SCALE (maxValueSlider), 0);

#ifdef ORIGINAL_CODE_GENERATED_BY_GLADE
  maxValueSpinner_adj = gtk_adjustment_new (255, 0, 255, 1, 10, 10);
#endif
  maxValueSpinner = gtk_spin_button_new (GTK_ADJUSTMENT (maxValueSpinner_adj), 1, 0);
  gtk_widget_show (maxValueSpinner);
  gtk_box_pack_start (GTK_BOX (maxValueHbox), maxValueSpinner, FALSE, TRUE, 0);

  outputValuesHbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (outputValuesHbox);
  gtk_box_pack_start (GTK_BOX (settingsOuterVbox), outputValuesHbox, TRUE, TRUE, 0);

  outputValuesLabel = gtk_label_new (QT_TR_NOOP("Output values:   "));
  gtk_widget_show (outputValuesLabel);
  gtk_box_pack_start (GTK_BOX (outputValuesHbox), outputValuesLabel, FALSE, FALSE, 0);

  outputValuesMenu = gtk_combo_box_new_text ();
  gtk_widget_show (outputValuesMenu);
  gtk_box_pack_start (GTK_BOX (outputValuesHbox), outputValuesMenu, TRUE, TRUE, 0);
  gtk_combo_box_append_text (GTK_COMBO_BOX (outputValuesMenu), QT_TR_NOOP("In-range values go black, out-of-range values go white"));
  gtk_combo_box_append_text (GTK_COMBO_BOX (outputValuesMenu), QT_TR_NOOP("In-range values go white, out-of-range values go black"));

  debugHbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (debugHbox);
  gtk_box_pack_start (GTK_BOX (settingsOuterVbox), debugHbox, TRUE, TRUE, 0);

  debugLabel = gtk_label_new (QT_TR_NOOP("Debugging settings (bits):   "));
  gtk_widget_show (debugLabel);
  gtk_box_pack_start (GTK_BOX (debugHbox), debugLabel, FALSE, FALSE, 0);

  debugSpinButton_adj = gtk_adjustment_new (0, 0, 16777215, 1, 10, 10);
  debugSpinButton = gtk_spin_button_new (GTK_ADJUSTMENT (debugSpinButton_adj), 1, 0);
  gtk_widget_show (debugSpinButton);
  gtk_box_pack_start (GTK_BOX (debugHbox), debugSpinButton, TRUE, TRUE, 0);

  previewFrame = gtk_frame_new (NULL);
  gtk_widget_show (previewFrame);
  gtk_box_pack_start (GTK_BOX (allButButtonsVbox), previewFrame, TRUE, TRUE, 0);

  previewAlignment = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (previewAlignment);
  gtk_container_add (GTK_CONTAINER (previewFrame), previewAlignment);
  gtk_alignment_set_padding (GTK_ALIGNMENT (previewAlignment), 0, 8, 6, 8);

  previewVbox = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (previewVbox);
  gtk_container_add (GTK_CONTAINER (previewAlignment), previewVbox);

  previewControlHbox = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (previewControlHbox);
  gtk_box_pack_start (GTK_BOX (previewVbox), previewControlHbox, TRUE, TRUE, 0);

  previewOutputMenu = gtk_combo_box_new_text ();
  gtk_widget_show (previewOutputMenu);
  gtk_box_pack_start (GTK_BOX (previewControlHbox), previewOutputMenu, FALSE, TRUE, 0);

  previewSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 99, 1, 1, 1)));
  gtk_widget_show (previewSlider);
  gtk_box_pack_start (GTK_BOX (previewControlHbox), previewSlider, TRUE, TRUE, 0);
  gtk_scale_set_digits (GTK_SCALE (previewSlider), 0);

  previewVideo = gtk_drawing_area_new ();
  gtk_widget_show (previewVideo);
  gtk_box_pack_start (GTK_BOX (previewVbox), previewVideo, TRUE, TRUE, 0);
  gtk_widget_set_size_request (previewVideo, 30, 30);
  gtk_widget_set_events (previewVideo, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK);

  previewLabel = gtk_label_new (QT_TR_NOOP("Preview"));
  gtk_widget_show (previewLabel);
  gtk_frame_set_label_widget (GTK_FRAME (previewFrame), previewLabel);

  dialogButtonBox = GTK_DIALOG (threshold_dialog)->action_area;
  gtk_widget_show (dialogButtonBox);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialogButtonBox), GTK_BUTTONBOX_END);

  cancelButton = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelButton);
  gtk_dialog_add_action_widget (GTK_DIALOG (threshold_dialog), cancelButton, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelButton, GTK_CAN_DEFAULT);

  okButton = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okButton);
  gtk_dialog_add_action_widget (GTK_DIALOG (threshold_dialog), okButton, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okButton, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, threshold_dialog, "threshold_dialog");
  GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, dialogVbox, "dialogVbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, allButButtonsVbox, "allButButtonsVbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, settingsOuterHbox, "settingsOuterHbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, settingsOuterVbox, "settingsOuterVbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, minValueVbox, "minValueVbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, minValueLabel, "minValueLabel");
  GLADE_HOOKUP_OBJECT (threshold_dialog, minValueHbox, "minValueHbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, minValueSlider, "minValueSlider");
  GLADE_HOOKUP_OBJECT (threshold_dialog, minValueSpinner, "minValueSpinner");
  GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueVbox, "maxValueVbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueLabel, "maxValueLabel");
  GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueHbox, "maxValueHbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueSlider, "maxValueSlider");
  GLADE_HOOKUP_OBJECT (threshold_dialog, maxValueSpinner, "maxValueSpinner");
  GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesHbox, "outputValuesHbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesLabel, "outputValuesLabel");
  GLADE_HOOKUP_OBJECT (threshold_dialog, outputValuesMenu, "outputValuesMenu");
  GLADE_HOOKUP_OBJECT (threshold_dialog, debugHbox, "debugHbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, debugLabel, "debugLabel");
  GLADE_HOOKUP_OBJECT (threshold_dialog, debugSpinButton, "debugSpinButton");
  GLADE_HOOKUP_OBJECT (threshold_dialog, previewFrame, "previewFrame");
  GLADE_HOOKUP_OBJECT (threshold_dialog, previewAlignment, "previewAlignment");
  GLADE_HOOKUP_OBJECT (threshold_dialog, previewVbox, "previewVbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, previewControlHbox, "previewControlHbox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, previewOutputMenu, "previewOutputMenu");
  GLADE_HOOKUP_OBJECT (threshold_dialog, previewSlider, "previewSlider");
  GLADE_HOOKUP_OBJECT (threshold_dialog, previewVideo, "previewVideo");
  GLADE_HOOKUP_OBJECT (threshold_dialog, previewLabel, "previewLabel");
  GLADE_HOOKUP_OBJECT_NO_REF (threshold_dialog, dialogButtonBox, "dialogButtonBox");
  GLADE_HOOKUP_OBJECT (threshold_dialog, cancelButton, "cancelButton");
  GLADE_HOOKUP_OBJECT (threshold_dialog, okButton, "okButton");

  return threshold_dialog;
}
Exemple #25
0
//===================================================================
  MemObj GUI_Slider__ (MemObj *o_par, int typ, void *funcnam,
                       double valMin, double valMax, double valStart,
                       char *opts) {
//===================================================================
/// \code
/// GUI_Slider__           Slider = AdjustmentControl
///
/// Input:
///   parent     parentBox
///   typ        0=horizontal, 1=vertical.
///   funcnam    callBack-function for moving the slider; NULL = no callback.
///   opts       options; (HorSiz,VertSiz)
///              HorSiz,VertSiz:  size in characters; default is automatic size.
///                              'e' = expand widget; default is fixed size.
///              Examples: "" or "10" or "10e,e"
///                "10e,e" horiz. size 10 chars, hor. and vert. expandable.
///
/// funcnam prototyp:
/// int funcnam (MemObj *mo, void **data);
///   // data=table of 2 pointers;
///   GUI_DATA_EVENT  = *(int*)data[0]    = TYP_EventMove or
///                                         TYP_EventPress (left mousebutton)
///                                         TYP_EventRelease 
///   GUI_DATA_D1     = *(double*)data[1] = slider-value (only TYP_EventMove)
///   GUI_OBJ_TYP(mo) = TYP_GUI_Slider
///
/// Example without callback:
/// wsl1 = GUI_Slider__ (&box1, 0, NULL, 0., 1., 0.5, "8");
/// // query slider-value
/// printf(" sliVal=%f\n",GUI_Slider_get(&wsl1));
/// // change slider-value
/// GUI_Slider_set (&wsl1, 0.75);
///
/// Example with callback:
/// wsl1 = GUI_Slider__ (&box1, 0, sl_CB, 0., 1., 0.5, "8");
/// int sl_CB (MemObj *mo, void **data) {
///   if(GUI_DATA_EVENT == TYP_EventMove) {
///     printf("sl_CB %lf\n",GUI_DATA_D1);  // slider-value as double
///   }
/// }
/// \endcode


  int           pTyp;
  GtkAdjustment *adj1;
  // GtkObject     *adj1;
  GtkWidget     *wsc1;
  void          *w_par;
  double        d1;
  Obj_Slider    *go;


  // get gtk-widget for parentBox from MemObj
  w_par = GUI_obj_parent__ (&pTyp, o_par);
  if(!w_par) return (UME_obj_invalid_set (-3));


  // get address & memspc
  GUI_obj_spc ((void**)&go, sizeof(Obj_Slider));
  if(!go) return (UME_obj_invalid_set (-1));



  // Adjustment (StartVal minVal maxVal incr pageIncr pageSize)
  d1 = (valMax - valMin ) / 100.;
  adj1 = gtk_adjustment_new((gdouble)valStart,
                            (gdouble)valMin,
                            (gdouble)valMax,
                            (gdouble)d1,
                            (gdouble)0.,
                            (gdouble)0.);

  // callback for moving the control
  if(funcnam) {
    g_signal_connect (adj1, "value_changed",
                      G_CALLBACK(GUI_Slider_cb1),
                      PTR_MEMOBJ(go->mem_obj));
  }


  wsc1 = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT(adj1));


  if(funcnam) { // 2013-09-09
    gtk_widget_add_events (GTK_WIDGET(wsc1),
                           GDK_BUTTON_PRESS_MASK |
                           GDK_BUTTON_RELEASE_MASK);

    g_signal_connect (G_OBJECT(wsc1), "button_press_event",
                      G_CALLBACK(GUI_Slider_cb2),
                      PTR_MEMOBJ(go->mem_obj));

    g_signal_connect (G_OBJECT(wsc1), "button_release_event",
                      G_CALLBACK(GUI_Slider_cb2),
                      PTR_MEMOBJ(go->mem_obj));
  }


  UI_act_wi = wsc1;              // GUI_Tip; 2013-09-09


  // do not display actual value
  gtk_scale_set_draw_value (GTK_SCALE(wsc1), FALSE);

  
  // // GUI_packwn (w_par, wsc1, siz, 0);
  // if(siz == 1) GUI_packwn (w_par, wsc1, 0, 1);
  // else         GUI_packwn (w_par, wsc1, siz, 0);
  GUI_w_pack1 (pTyp, w_par, wsc1, opts);


  // fill obj
  go->gio_typ  = TYP_GUI_Slider;
  go->slider   = adj1; //wsc1;
  go->uFunc    = funcnam;

  return (((Obj_Unknown*)go)->mem_obj);

}
Exemple #26
0
static GtkWidget *
prefs_get_property_widget(DiaPrefData *data)
{
  GtkWidget *widget = NULL;
  GtkAdjustment *adj;
  
  switch(data->type) {
  case PREF_BOOLEAN:
    widget = gtk_toggle_button_new_with_label (_("No"));
    g_signal_connect (GTK_OBJECT (widget), "toggled",
		      G_CALLBACK (prefs_boolean_toggle), NULL);
    break;
  case PREF_INT:
    adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0,
					    G_MININT, G_MAXINT,
					    1.0, 10.0, 0));
    widget = gtk_spin_button_new (adj, 1.0, 0);
    gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(widget), TRUE);
    gtk_widget_set_size_request (widget, 80, -1);
    break;
  case PREF_UINT:
    adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0,
					    0.0, G_MAXINT,
					    1.0, 10.0, 0));
    widget = gtk_spin_button_new (adj, 1.0, 0);
    gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(widget), TRUE);
    gtk_widget_set_size_request (widget, 80, -1);
    break;
  case PREF_REAL:
    adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0,
					    G_MINFLOAT, G_MAXFLOAT,
					    1.0, 10.0, 0));
    widget = gtk_spin_button_new (adj, 1.0, 3);
    gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(widget), TRUE);
    gtk_widget_set_size_request (widget, 80, -1);
    break;
  case PREF_UREAL:
    adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0,
					    0.0, G_MAXFLOAT,
					    1.0, 10.0, 0 ));
    widget = gtk_spin_button_new (adj, 1.0, 3);
    gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(widget), TRUE);
    gtk_widget_set_size_request (widget, 80, -1);
    break;
  case PREF_COLOUR:
    widget = dia_color_selector_new();
    break;
  case PREF_STRING:
    widget = gtk_entry_new();
    break;
  case PREF_CHOICE: {
    GList *names;
    widget = gtk_combo_box_new_text ();
    for (names = (data->choice_list_function)(data); 
         names != NULL;
	 names = g_list_next(names)) {
      gtk_combo_box_append_text (GTK_COMBO_BOX (widget), (gchar *)names->data);
    }
    break;
  }
  case PREF_NONE:
  case PREF_END_GROUP:
    widget = NULL;
    break;
  }
  if (widget != NULL)
    gtk_widget_show(widget);
  return widget;
}
Exemple #27
0
/** @brief Creates the autonumber text dialog.
 *
 * Dialog is not shown. No callbacks are registered. This is basically
 * unmodified code returned by Glade.
 *
 * Only modification was the following substitution:
 *
 * %s/create_pixmap (autonumber_text, "\(.*\)")/autonumber_create_pixmap("gschem-\1", w_current)/
 * 
 * and addition of the "w_current" parameter.
 *
 * @param w_current Pointer to the top level struct.
 * @return Pointer to the dialog window.
 */
GtkWidget* autonumber_create_dialog(GschemToplevel *w_current)
{
  GtkWidget *autonumber_text;
  GtkWidget *vbox1;
  GtkWidget *alignment1;
  GtkWidget *vbox3;
  GtkWidget *table1;
  GtkWidget *label4;
  GtkWidget *scope_text;
  GtkWidget *label8;
  GtkWidget *label6;
  GtkWidget *scope_number;
  GtkWidget *scope_skip;
  GtkWidget *scope_overwrite;
  GtkWidget *label1;
  GtkWidget *alignment3;
  GtkWidget *vbox4;
  GtkWidget *table3;
  GtkWidget *label12;
  GtkWidget *label13;
  GtkObject *opt_startnum_adj;
  GtkWidget *opt_startnum;
  GtkWidget *sort_order;
  GtkWidget *opt_removenum;
  GtkWidget *opt_slotting;
  GtkWidget *label3;


  autonumber_text = gschem_dialog_new_with_buttons(_("Autonumber text"),
                                                   GTK_WINDOW(w_current->main_window),
                                                   0, /* not modal */
                                                   "autonumber", w_current,
                                                   GTK_STOCK_CLOSE,
                                                   GTK_RESPONSE_REJECT,
                                                   GTK_STOCK_APPLY,
                                                   GTK_RESPONSE_ACCEPT,
                                                   NULL);
  /* Set the alternative button order (ok, cancel, help) for other systems */
  gtk_dialog_set_alternative_button_order(GTK_DIALOG(autonumber_text),
					  GTK_RESPONSE_ACCEPT,
					  GTK_RESPONSE_REJECT,
					  -1);

  gtk_window_set_position (GTK_WINDOW (autonumber_text), GTK_WIN_POS_MOUSE);
  
  gtk_container_set_border_width (GTK_CONTAINER (autonumber_text),
                                  DIALOG_BORDER_SPACING);
  vbox1 = GTK_DIALOG(autonumber_text)->vbox;
  gtk_box_set_spacing(GTK_BOX(vbox1), DIALOG_V_SPACING);

  /* scope section */
  label1 = gtk_label_new (_("<b>Scope</b>"));
  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  gtk_misc_set_alignment (GTK_MISC(label1), 0, 0);
  gtk_box_pack_start (GTK_BOX(vbox1), label1, TRUE, TRUE, 0);
  gtk_widget_show (label1);

  alignment1 = gtk_alignment_new (0, 0, 1, 1);
  gtk_widget_show (alignment1);
  gtk_box_pack_start (GTK_BOX (vbox1), alignment1, TRUE, TRUE, 0);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 
			     0, 0, DIALOG_INDENTATION, 0);

  vbox3 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox3);
  gtk_container_add (GTK_CONTAINER (alignment1), vbox3);

  table1 = gtk_table_new (3, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox3), table1, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table1), DIALOG_V_SPACING);
  gtk_table_set_col_spacings (GTK_TABLE (table1), DIALOG_H_SPACING);

  label4 = gtk_label_new (_("Search for:"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  scope_text = gtk_combo_box_entry_new_text ();
  gtk_entry_set_activates_default(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(scope_text))), TRUE);
  gtk_widget_show (scope_text);
  gtk_table_attach (GTK_TABLE (table1), scope_text, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  label8 = gtk_label_new (_("Autonumber text in:"));
  gtk_widget_show (label8);
  gtk_table_attach (GTK_TABLE (table1), label8, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);

  label6 = gtk_label_new (_("Skip numbers found in:"));
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);

  scope_number = gtk_combo_box_new_text ();
  gtk_widget_show (scope_number);
  gtk_table_attach (GTK_TABLE (table1), scope_number, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), _("Selected objects"));
  gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), _("Current page"));
  gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), _("Whole hierarchy"));

  scope_skip = gtk_combo_box_new_text ();
  gtk_widget_show (scope_skip);
  gtk_table_attach (GTK_TABLE (table1), scope_skip, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), _("Selected objects"));
  gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), _("Current page"));
  gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), _("Whole hierarchy"));

  scope_overwrite = gtk_check_button_new_with_mnemonic (_("Overwrite existing numbers"));
  gtk_widget_show (scope_overwrite);
  gtk_box_pack_start (GTK_BOX (vbox3), scope_overwrite, FALSE, FALSE, 6);

  /* Options section */
  label3 = gtk_label_new (_("<b>Options</b>"));
  gtk_label_set_use_markup (GTK_LABEL (label3), TRUE);
  gtk_misc_set_alignment(GTK_MISC(label3), 0, 0);
  gtk_widget_show (label3);
  gtk_box_pack_start(GTK_BOX(vbox1), label3, TRUE, TRUE, 0);

  alignment3 = gtk_alignment_new (0, 0, 1, 1);
  gtk_widget_show (alignment3);
  gtk_box_pack_start(GTK_BOX(vbox1), alignment3, TRUE, TRUE, 0);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 
			     0, 0, DIALOG_INDENTATION, 0);

  vbox4 = gtk_vbox_new (FALSE, 3);
  gtk_widget_show (vbox4);
  gtk_container_add (GTK_CONTAINER (alignment3), vbox4);

  table3 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table3);
  gtk_box_pack_start (GTK_BOX (vbox4), table3, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table3), DIALOG_V_SPACING);
  gtk_table_set_col_spacings (GTK_TABLE (table3), DIALOG_H_SPACING);

  label12 = gtk_label_new (_("Starting number:"));
  gtk_widget_show (label12);
  gtk_table_attach (GTK_TABLE (table3), label12, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);

  label13 = gtk_label_new (_("Sort order:"));
  gtk_widget_show (label13);
  gtk_table_attach (GTK_TABLE (table3), label13, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);

  opt_startnum_adj = gtk_adjustment_new (1, 0, 10000, 1, 10, 10);
  opt_startnum = gtk_spin_button_new (GTK_ADJUSTMENT (opt_startnum_adj), 1, 0);
  gtk_entry_set_activates_default(GTK_ENTRY(opt_startnum), TRUE);
  gtk_widget_show (opt_startnum);
  gtk_table_attach (GTK_TABLE (table3), opt_startnum, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  sort_order = gtk_combo_box_new();
  gtk_widget_show (sort_order);
  gtk_table_attach (GTK_TABLE (table3), sort_order, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  opt_removenum = gtk_check_button_new_with_mnemonic (_("Remove numbers"));
  gtk_widget_show (opt_removenum);
  gtk_box_pack_start (GTK_BOX (vbox4), opt_removenum, FALSE, FALSE, 0);

  opt_slotting = gtk_check_button_new_with_mnemonic (_("Automatic slotting"));
  gtk_widget_show (opt_slotting);
  gtk_box_pack_start (GTK_BOX (vbox4), opt_slotting, FALSE, FALSE, 0);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT (autonumber_text, scope_text, "scope_text");
  GLADE_HOOKUP_OBJECT (autonumber_text, scope_number, "scope_number");
  GLADE_HOOKUP_OBJECT (autonumber_text, scope_skip, "scope_skip");
  GLADE_HOOKUP_OBJECT (autonumber_text, scope_overwrite, "scope_overwrite");
  GLADE_HOOKUP_OBJECT (autonumber_text, opt_startnum, "opt_startnum");
  GLADE_HOOKUP_OBJECT (autonumber_text, sort_order, "sort_order");
  GLADE_HOOKUP_OBJECT (autonumber_text, opt_removenum, "opt_removenum");
  GLADE_HOOKUP_OBJECT (autonumber_text, opt_slotting, "opt_slotting");

  return autonumber_text;
}
Exemple #28
0
spin_button_ctx_t *time_scrollbar_new(void)
{
    GtkObject *adj_msec;
    GtkObject *adj_sec;
    GtkObject *adj_min;
    GtkObject *adj_scale;
    GtkWidget *scale;
    GtkWidget *spin_msec;
    GtkWidget *spin_sec;
    GtkWidget *spin_min;
    GtkWidget *hbox;
    GtkWidget *vbox;
    spin_button_ctx_t *sbctx;

    sbctx = (spin_button_ctx_t *) calloc(1, sizeof(spin_button_ctx_t));

    vbox = gtk_vbox_new(FALSE, 4);
    sbctx->time_scrollbar = vbox;

    hbox = gtk_hbox_new(FALSE, 4);
    gtk_widget_show(hbox);

    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
   
    adj_msec  = gtk_adjustment_new(0.0, -1.0, 1000.0, 1.0, 1.0, 1.0);
    adj_sec   = gtk_adjustment_new(0.0, -1.0, 60.0,   1.0, 1.0, 1.0);
    adj_min   = gtk_adjustment_new(0.0, 0.0,  99.0,   1.0, 1.0, 1.0);
    adj_scale = gtk_adjustment_new(0.0, 0.0,  100.0*60*1000, 5.0, 5.0, 1.0);

    spin_min = gtk_spin_button_new(GTK_ADJUSTMENT(adj_min), 1.0, 0);
    gtk_widget_show(spin_min);

    spin_sec = gtk_spin_button_new(GTK_ADJUSTMENT(adj_sec), 1.0, 0);
    gtk_widget_show(spin_sec);

    spin_msec = gtk_spin_button_new(GTK_ADJUSTMENT(adj_msec), 1.0, 0);
    gtk_widget_show(spin_msec);
    
    scale = gtk_hscale_new_with_range(0.0, 100.0, 1.0);
    gtk_widget_show(scale);
    gtk_range_set_adjustment(GTK_RANGE(scale), GTK_ADJUSTMENT(adj_scale));
    gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_DELAYED);
    gtk_scale_set_draw_value(GTK_SCALE(scale), FALSE);

    gtk_box_pack_start(GTK_BOX(hbox), spin_min,  FALSE, TRUE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), spin_sec,  FALSE, TRUE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), spin_msec, FALSE, TRUE, 2);
    gtk_box_pack_start(GTK_BOX(vbox), scale,     FALSE, TRUE, 2);

    sbctx->spin_min  = GTK_SPIN_BUTTON(spin_min);
    sbctx->spin_sec  = GTK_SPIN_BUTTON(spin_sec);
    sbctx->spin_msec = GTK_SPIN_BUTTON(spin_msec);
    sbctx->scale     = GTK_SCALE(scale);
    sbctx->adj_min   = GTK_ADJUSTMENT(adj_min);
    sbctx->adj_sec   = GTK_ADJUSTMENT(adj_sec);
    sbctx->adj_msec  = GTK_ADJUSTMENT(adj_msec);
    sbctx->adj_scale = GTK_ADJUSTMENT(adj_scale);

    g_signal_connect(G_OBJECT(spin_msec), "value-changed", 
                     G_CALLBACK(cb_block_scale), sbctx);
    sbctx->hmsec = g_signal_connect(G_OBJECT(spin_msec), "value-changed", 
                     G_CALLBACK(cb_spin_msec), sbctx);
    g_signal_connect(G_OBJECT(spin_msec), "value-changed", 
                     G_CALLBACK(cb_unblock_scale), sbctx);

    g_signal_connect(G_OBJECT(spin_sec), "value-changed", 
                     G_CALLBACK(cb_block_scale), sbctx);
    sbctx->hsec = g_signal_connect(G_OBJECT(spin_sec), "value-changed", 
                     G_CALLBACK(cb_spin_sec), sbctx);
    g_signal_connect(G_OBJECT(spin_sec), "value-changed", 
                     G_CALLBACK(cb_unblock_scale), sbctx);

    g_signal_connect(G_OBJECT(spin_min), "value-changed", 
                     G_CALLBACK(cb_block_scale), sbctx);
    sbctx->hmin = g_signal_connect(G_OBJECT(spin_min), "value-changed", 
                     G_CALLBACK(cb_spin_min), sbctx);
    g_signal_connect(G_OBJECT(spin_min), "value-changed", 
                     G_CALLBACK(cb_unblock_scale), sbctx);

    g_signal_connect(G_OBJECT(scale), "value-changed", 
                     G_CALLBACK(cb_block_spinners), sbctx);
    sbctx->hscale = g_signal_connect(G_OBJECT(scale), "value-changed", 
                     G_CALLBACK(cb_scale), sbctx);
    g_signal_connect(G_OBJECT(scale), "value-changed", 
                     G_CALLBACK(cb_unblock_spinners), sbctx);
    return sbctx;
}
Exemple #29
0
static void create_config(GtkWidget *tab) {
  GtkWidget *tabs;
  GtkWidget *text, *label, *panel, *button, *hbox, *scrolled, *frame, *vbox;
  GtkObject *adj;
  gchar *plugin_about_text;
  gchar *station_tab_titles[3] = { _("Station"), _("Frequency"), "" };
  char *f[3];
  int i;

  tabs = gtk_notebook_new();
 
  gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tabs),GTK_POS_TOP);
  gtk_box_pack_start(GTK_BOX(tab),tabs,TRUE,TRUE,0); 

  /* STATION TAB */

  panel = gtk_vbox_new(0, 0);
  
  gui_station_list = gtk_clist_new_with_titles(3, station_tab_titles);
  gtk_clist_set_column_auto_resize(GTK_CLIST(gui_station_list),
				   0, TRUE);
  gtk_clist_set_column_auto_resize(GTK_CLIST(gui_station_list),
				   0, TRUE);
  gtk_clist_set_reorderable(GTK_CLIST(gui_station_list), TRUE);
  gtk_clist_set_column_justification(GTK_CLIST(gui_station_list),
				     1, GTK_JUSTIFY_RIGHT);

  /* fill data in clist */
  f[1] = malloc(32);
  f[2] = "";
  for (i = 0; i< nstations; i++) {
    f[0] = stations[i].station_name;
    snprintf(f[1],32, "%.2f", stations[i].freq);
    gtk_clist_append(GTK_CLIST(gui_station_list), f);
  }
  gui_station_count = nstations;
  free(f[1]);

  gtk_signal_connect(GTK_OBJECT(gui_station_list), "select-row",
		     (GtkSignalFunc)gui_select_row, NULL);

  scrolled = gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
				 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_container_add(GTK_CONTAINER(scrolled),gui_station_list);

  gtk_container_add(GTK_CONTAINER(panel), scrolled);

  hbox = gtk_hbox_new(0, 0);

  button = gtk_button_new_with_label(_("New"));
  gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)gui_new_station, NULL);

  gtk_box_pack_start(GTK_BOX(hbox), button, 0, 0, 2);
  button = gtk_button_new_with_label(_("Edit")); 
  gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)gui_edit_station, NULL);

  gtk_box_pack_start(GTK_BOX(hbox), button, 0, 0, 2);
  button = gtk_button_new_with_label(_("Delete")); 
  gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)gui_delete_station, NULL);

  gtk_box_pack_start(GTK_BOX(hbox), button, 0, 0, 2);
  button = gtk_button_new_with_label(_("Up"));
  gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)gui_moveup_station, NULL);

  gtk_box_pack_start(GTK_BOX(hbox), button, 0, 0, 2);

  button = gtk_button_new_with_label(_("Down"));
  gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)gui_movedown_station, NULL);
  gtk_box_pack_start(GTK_BOX(hbox), button, 0, 0, 2);
  
  label = gtk_label_new(_("Stations"));

  gtk_box_pack_start(GTK_BOX(panel), hbox, FALSE, FALSE, 4);


  
  gtk_notebook_append_page(GTK_NOTEBOOK(tabs), panel, label);

  /* OPTIONS TAB */

  vbox = gtk_vbox_new(0,0);

  /* mutetime */ {

    hbox = gtk_hbox_new(0, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, 0, 0, 2);
    
    label = gtk_label_new(_("Time to mute on channel jump (seconds):"));
    gtk_box_pack_start(GTK_BOX(hbox), label, 0, 0, 2);
    
    adj = gtk_adjustment_new(mutetime, 0.0, 9.99, 0.01, 0.1, 1);
    gui_mutetime_entry = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.01, 2);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(gui_mutetime_entry), mutetime);
    gtk_box_pack_start(GTK_BOX(hbox), gui_mutetime_entry, 0, 0, 2);

  }

  /* reopenoption */ {

    gui_reopen_toggle = gtk_check_button_new_with_label(_("Attempt to reopen radio on startup"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gui_reopen_toggle), attempt_reopen);
    gtk_box_pack_start(GTK_BOX(vbox), gui_reopen_toggle, 0, 0, 2);
  /* close radio on exit toggle */
    gui_close_toggle = 
      gtk_check_button_new_with_label(_("Turn radio off when exiting gkrellm"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gui_close_toggle), 
        close_atexit);
    gtk_box_pack_start(GTK_BOX(vbox), gui_close_toggle, 0, 0, 2);

  }
  
  label = gtk_label_new(_("Options"));
  gtk_notebook_append_page(GTK_NOTEBOOK(tabs), vbox, label);

  /* INFO TAB */
  
  frame = gtk_frame_new(NULL);
  scrolled = gkrellm_gtk_notebook_page(tabs,_("Info"));
  text = gkrellm_gtk_scrolled_text_view(scrolled,NULL,
                                   GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  for (i=0; i < sizeof(info_text)/sizeof(gchar *); ++i)
     gkrellm_gtk_text_view_append(text, _(info_text[i]));
  /* ABOUT TAB */

  plugin_about_text = g_strdup_printf(
   _("Radio Plugin %s\n" \
   "GKrellM radio Plugin\n\n" \
   "Copyright (C) 2001-2002 Sjoerd Simons\n" \
   "[email protected]\n" \
   "http://gkrellm.luon.net/gkrellm-radio.phtml\n\n" \
   "Released under the GNU General Public Licence"), VERSION);

  text = gtk_label_new(plugin_about_text); 
  label = gtk_label_new(_("About"));
  gtk_notebook_append_page(GTK_NOTEBOOK(tabs),text,label);
  g_free(plugin_about_text);
}
Exemple #30
0
GtkWidget * surfadd_dialog_new(gpointer hfo_ptr) {

	GtkObject *adj;
	GtkWidget *button, *table, *hbox, *vbox, *scale, *scrolled_window;
	GtkWidget *frame;
	static gboolean dummy_flag;

	gpointer data;
	hf_options_struct *hfo = (hf_options_struct *) hfo_ptr;

	if (!hfo)
		return gtk_label_new(_("No surface addition dialog"));

	data = hfo->hfw_ptr_ptr;

//	Main dialog box
	vbox = gtk_vbox_new(FALSE,0);
	gtk_widget_show(GTK_WIDGET(vbox));

//	2008-02 Now with scrolled window
	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_widget_show (scrolled_window);
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrolled_window), vbox);

	gtk_widget_set_size_request (scrolled_window, -1, gdk_screen_get_height(gdk_screen_get_default())/3);

//	Seed
	
	gtk_box_pack_start_defaults(GTK_BOX(vbox), 
		seed_dialog_new(data, hfo->surfadd_options->seed, 
		change_surfadd_seed));

	table = gtk_table_new(4, 2, FALSE);
	gtk_widget_show(table);

//	Slope / roughness (kind of)
//	From 0 to 100%
//	100: we keep the same H for each step, even if the surfaces to add are smaller
//	50:  we divide the H by 2 for each step (default), because  the surfaces are divided by two
//	100:  we divide the H by 3 for each step.

	define_label_in_table("Slope",table, 0, 1, 0, 1, 0); 

	adj = gtk_adjustment_new (hfo->surfadd_options->slope, 0, 100, 1, 1, 0.01);

	scale = define_scale_in_table(adj,table,1,2,0,1,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (slope_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Random x-y displacement scale
//	From 0 to 100 % (100 % = twice the size of the current surface to add)

	define_label_in_table("XZ Displacement ",table, 0, 1, 1, 2, 0); 

	adj = gtk_adjustment_new 
		(hfo->surfadd_options->xy_random_range, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,1,2,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (xy_scale_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Random height displacement scale
//	From 0 to 100 % (100 % = twice the height of the current surface to add)

	define_label_in_table("H Displacement ",table, 0, 1, 2, 3, 0); 
	adj = gtk_adjustment_new 
		(hfo->surfadd_options->h_random_range, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,2,3,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (h_scale_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Lateral density variation
//	From 0 to 100 % (100 % = twice the default density)

	define_label_in_table("Density",table, 0, 1, 3, 4, 0); 
	adj = gtk_adjustment_new 
		(hfo->surfadd_options->density, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,3,4,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (density_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

	hbox = gtk_hbox_new(FALSE,0);
	gtk_widget_show(hbox);

	gtk_box_pack_start_defaults(GTK_BOX(hbox), table);

	gtk_box_pack_start_defaults(GTK_BOX(vbox), hbox);

//	Filters for the primitive surface and preview
	frame = frame_new("Primitive surface", DEF_PAD*0.5);
	gtk_container_add(GTK_CONTAINER(vbox), frame);

//	HBOX will contain the shape filter dialog and the preview
	hbox = gtk_hbox_new(FALSE,0);
	gtk_widget_show(hbox);
	
	gtk_container_add(GTK_CONTAINER(frame), hbox);

//	We create the primitive surface, and the preview area at the same time
	hfo->primit_surf = hf_wrapper_new(NULL,NULL,hbox, hbox, 
		hf_options_dialog_new(hfo->tools_window,
			hbox, 
			hfo->tooltips, 
			NULL, 
			&hfo->primit_surf,
			hfo->stack,
			hfo->doc_type,
			hfo->all_docs,
			hfo->get_doc_list_from_type),
		&dummy_flag, &dummy_flag, NULL, NULL, NULL, NULL, HFPRIMITIVE);
//	Shared data:
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->dist_matrix =
			hfo->dist_matrix;

	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_calculation = (gpointer) uniform;
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_callb = NULL;
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_options = (gpointer) hfo->uniform_value;

	set_filter_type (((hf_wrapper_struct *) hfo->primit_surf)->hf_options->creation_fd_struct, MEDIUM_FILTER_1);
	
	set_dependent_process ((hf_wrapper_struct *) hfo->primit_surf, gener_hf_from_ptr_ptr, hfo->hfw_ptr_ptr);

//	Set the merge operation to MULTIPLY:

	set_filter_merge(((hf_wrapper_struct *) hfo->primit_surf)->hf_options->creation_fd_struct, 1);

//	Frequency dialog
	gtk_box_pack_start(GTK_BOX(vbox),
		surfadd_frq_dialog_new(hfo_ptr), FALSE, FALSE,0);

	return define_options_frame_with_hiding_arrows("sum of surfaces", scrolled_window, hfo->tools_window, TRUE);
}