示例#1
0
static void shift_btn(shifter_dd *dt, void **wdata, int what, void **where)
{
	int i;

	if ((what == op_EVT_OK) || (what == op_EVT_CANCEL))
	{
		shift_play_state = FALSE; // Stop

		mem_pal_copy(mem_pal, dt->old_pal);
		update_stuff(UPD_PAL);

		run_destroy(wdata);
		return;
	}

	if (what == op_EVT_CHANGE) // Play toggle
	{
		cmd_read(where, dt);
		if (shift_play_state && !shift_timer_state) // Start timer
			shift_timer_state = threads_timeout_add(100,
				shift_play_timer_call, dt);
		return;
	}

	where = origin_slot(where);

	if (where == dt->fix)	// Button to fix palette pressed
	{
		i = dt->frame[0];
		if (!i || (i > dt->frame[2])) return; // Nothing to do

		mem_pal_copy(mem_pal, dt->old_pal);
		spot_undo(UNDO_PAL);
		shifter_set_palette(dt, i);
		mem_pal_copy(dt->old_pal, mem_pal);
		cmd_set(dt->slider, 0);
		update_stuff(UPD_PAL);
	}

	else if (where == dt->clear)	// Button to clear all of the values
	{
		for (i = 0; i < NSHIFT; i++)
			spins[i][0][0] = spins[i][1][0] = spins[i][2][0] = 0;
		cmd_reset(dt->spinpack, dt);
		shifter_moved(dt, wdata, op_EVT_CHANGE, dt->spinpack);
	}

	else if (where == dt->create)	// Button to create a sequence of undo images
	{
		if (!dt->frame[2]) return;	// Nothing to do

		for (i = 0; i <= dt->frame[2]; i++)
		{
			shifter_set_palette(dt, i);
			spot_undo(UNDO_PAL);
		}
		shifter_set_palette(dt, dt->frame[0]);
		update_stuff(UPD_PAL);
	}
}
示例#2
0
文件: shifter.c 项目: UIKit0/mtPaint
static void click_shift_create()		// Button to create a sequence of undo images
{
	int i;

	if ( shifter_max<2 ) return;		// Nothing to do

	for ( i=0; i<shifter_max; i++ )
	{
		shifter_set_palette(i);
		spot_undo(UNDO_PAL);
	}

	shifter_set_palette( mt_spinslide_get_value(shifter_slider) );
	update_stuff(UPD_PAL);
}
示例#3
0
static void shifter_slider_moved(shifter_dd *dt, void **wdata, int what,
	void **where)
{
	cmd_read(where, dt);

	shifter_set_palette(dt, dt->frame[0]);
	update_stuff(UPD_PAL);
}
示例#4
0
文件: shifter.c 项目: UIKit0/mtPaint
static void shifter_slider_moved()		// Slider position changed
{
	int pos = mt_spinslide_read_value(shifter_slider);

	if ( pos != shifter_pos )
	{
		shifter_pos = pos;
		shifter_set_palette(pos);
		update_stuff(UPD_PAL);
	}
}
示例#5
0
文件: shifter.c 项目: UIKit0/mtPaint
static void click_shift_fix()			// Button to fix palette pressed
{
	int i = mt_spinslide_get_value(shifter_slider);

	if ( i==0 || i>=shifter_max ) return;	// Nothing to do

	mem_pal_copy( mem_pal, sh_old_pal );
	spot_undo(UNDO_PAL);
	shifter_set_palette(i);
	mem_pal_copy( sh_old_pal, mem_pal );

	mt_spinslide_set_value(shifter_slider, 0);

	update_stuff(UPD_PAL);
}