Exemplo n.º 1
0
static void oss_preferences_ok(GtkButton *button, struct oss_prefdlg *pd)
{
     inifile_set(OSS_PCMFILE_PLAYBACK,
		 (char *)gtk_entry_get_text(pd->pcmdev_playback));
     inifile_set(OSS_PCMFILE_RECORD,
		 (char *)gtk_entry_get_text(pd->pcmdev_record));
     oss_noselect = gtk_toggle_button_get_active(pd->noselect);
     inifile_set_gboolean(OSS_NOSELECT,oss_noselect);
     gtk_widget_destroy(GTK_WIDGET(pd->wnd));
}
Exemplo n.º 2
0
static void faction_btn(spawn_dd *dt, void **wdata, int what, void **where)
{
	spawn_row *rp = dt->strs;
	char *s, txt[64], buf[PATHBUF];
	int i, j, idx[FACTION_ROWS_TOTAL];

	if (what == op_EVT_CLICK) /* Execute */
	{
		gtkncpy(buf, dt->cmd, PATHBUF);
		spawn_expansion(buf, dt->dir);
		return;
	}

	cmd_peekv(dt->list, idx, sizeof(idx), LISTC_ORDER);
	for (i = 0; i < FACTION_ROWS_TOTAL; i++ , rp++)
	{
		for (j = 0; j < 3; j++)
		{
			sprintf(txt, faction_ini[j], idx[i] + 1);
			if (!j) s = rp->name;
			else if (j == 1) gtkncpy(s = buf, rp->cmd, sizeof(buf));
			else s = rp->dir;
			inifile_set(txt, s);
		}
	}
	update_faction_menu();
	run_destroy(wdata);
}
Exemplo n.º 3
0
gint delete_inputd( GtkWidget *widget, GdkEvent *event, gpointer data )
{
	int i, j;
	char txt[32];

#if GTK_MAJOR_VERSION == 1
	GdkDeviceInfo *dev = tablet_device;
#endif
#if GTK_MAJOR_VERSION == 2
	GdkDevice *dev = GTK_INPUT_DIALOG (inputd)->current_device;
#endif

	if ( tablet_working )		// Store tablet settings in INI file for future session
	{
		inifile_set( tablet_ini3[0], dev->name );
		inifile_set_gint32( tablet_ini3[1], dev->mode );

		for ( i=0; i<dev->num_axes; i++ )
		{
#if GTK_MAJOR_VERSION == 1
			j = dev->axes[i];
#endif
#if GTK_MAJOR_VERSION == 2
			j = dev->axes[i].use;
#endif
			sprintf(txt, "%s%i", tablet_ini3[2], i);
			inifile_set_gint32( txt, j );
		}
	}

	inifile_set_gboolean( "tablet_USE", tablet_working );
	gtk_widget_destroy(inputd);
	inputd = NULL;

	return FALSE;
}
Exemplo n.º 4
0
gint prefs_apply( GtkWidget *widget, GdkEvent *event, gpointer data )
{
	int i, type;
	char txt[64];

	for ( i=0; i<STATUS_ITEMS; i++ )
	{
		sprintf(txt, "status%iToggle", i);
		inifile_set_gboolean( txt,
			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_status[i])) );
		status_on[i] = inifile_get_gboolean(txt, TRUE);
	}

	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_maxmem) );
	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_greys) );
	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_nudge) );
	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_trans) );
	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_hotx) );
	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_hoty) );
	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_jpeg) );
	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_recent) );
	gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_pan) );
	for ( i=0; i<4; i++ )
		gtk_spin_button_update( GTK_SPIN_BUTTON(spinbutton_grid[i]) );
			// All needed in GTK+2 for late changes

	mem_undo_limit = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_maxmem) );
	mem_background = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_greys) );
	mem_nudge = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_nudge) );
	mem_xpm_trans = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_trans) );
	mem_xbm_hot_x = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_hotx) );
	mem_xbm_hot_y = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_hoty) );
	mem_jpeg_quality = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_jpeg) );
	recent_files = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_recent) );
	mem_grid_min = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_grid[0]) );
	for ( i=0; i<3; i++ )
		mem_grid_rgb[i] =
			gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_grid[i+1]) );

	for ( i=0; i<3; i++ )
	{
		tablet_tool_use[i] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_tablet[i]));
		inifile_set_gboolean( tablet_ini2[i], tablet_tool_use[i] );
		tablet_tool_factor[i] = GTK_HSCALE(hscale_tablet[i])->scale.range.adjustment->value;
		inifile_set_gint32( tablet_ini[i], tablet_tool_factor[i]*100 );
	}

	inifile_set_gint32( "gridMin", mem_grid_min );
	inifile_set_gint32( "gridR", mem_grid_rgb[0] );
	inifile_set_gint32( "gridG", mem_grid_rgb[1] );
	inifile_set_gint32( "gridB", mem_grid_rgb[2] );


	inifile_set_gint32( "panSize",
		gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(spinbutton_pan) ) );
	inifile_set_gint32( "undoMBlimit", mem_undo_limit );
	inifile_set_gint32( "backgroundGrey", mem_background );
	inifile_set_gint32( "pixelNudge", mem_nudge );
	inifile_set_gint32( "jpegQuality", mem_jpeg_quality );
	inifile_set_gint32( "recentFiles", recent_files );
	inifile_set_gboolean( "zoomToggle",
		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_zoom)) );
	inifile_set_gboolean( "pasteToggle",
		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_paste)) );
	inifile_set_gboolean( "cursorToggle",
		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_cursor)) );
	inifile_set_gboolean( "exitToggle",
		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_exit)) );

#if GTK_MAJOR_VERSION == 2
	inifile_set_gboolean( "scrollwheelZOOM",
		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_wheel)) );
#endif

	inifile_set_gboolean( "pasteCommit",
		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_commit)) );

	q_quit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_quit));
	inifile_set_gboolean( "quitToggle", q_quit );

	type = 0;
#ifdef U_NLS
	for ( i=0; i<PREF_LANGS; i++ )
	{
		if ( gtk_toggle_button_get_active(
				&(GTK_RADIO_BUTTON( pref_lang_radio[i] )->check_button.toggle_button)
					) ) type = i;
	}
	inifile_set( "languageSETTING", pref_lang_ini[type*2] );
	setup_language();
#endif

	strncpy( mem_clip_file[1], gtk_entry_get_text( GTK_ENTRY(clipboard_entry) ), 250 );
	strncpy( mem_clip_file[0], mem_clip_file[1], 250 );
	inifile_set( "clipFilename", mem_clip_file[0] );

	show_paste = inifile_get_gboolean( "pasteToggle", TRUE );

	update_all_views();		// Update canvas for changes
	set_cursor();

	update_recent_files();
	init_status_bar();

	return FALSE;
}