コード例 #1
0
ファイル: spawn.c プロジェクト: matyler/mtPaint
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);
}
コード例 #2
0
ファイル: shifter.c プロジェクト: Konovalets/mtPaint
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);
	}
}
コード例 #3
0
ファイル: channels.c プロジェクト: Konovalets/mtPaint
static void click_newchan_cancel(cchan_dd *dt, void **wdata)
{
	cmd_set(menu_slots[MENU_CHAN0 + mem_channel], TRUE);
		// Stops cancelled new channel showing as selected in the menu

	run_destroy(wdata);
	newchan_window = NULL;
}