Exemple #1
0
static void update_faction_menu()	// Populate menu
{
	int i, v, items = 0;
	char txt[64], *nm, *cm;
	void **slot;

	/* Show valid slots in menu */
	for (i = 1; i <= FACTION_PRESETS_TOTAL; i++)
	{
		sprintf(txt, faction_ini[0], i);
		nm = inifile_get(txt, "");

		sprintf(txt, faction_ini[1], i);
		cm = inifile_get(txt, "");

		slot = menu_slots[MENU_FACTION1 - 1 + i];

		if ((v = nm && nm[0] && (nm[0] != '#') &&
			cm && cm[0] && (cm[0] != '#')))
			cmd_setv(slot, nm, LABEL_VALUE);

		cmd_showhide(slot, v);	/* Hide by default */
		items += v;
	}

	/* Hide separator if no valid slots */
	cmd_showhide(menu_slots[MENU_FACTION_S], items);
}	
Exemple #2
0
static void fpick_select(fpick_dd *dt, void **wdata, int what, void **where)
{
	int *rp = dt->fcols + dt->idx * COL_MAX;
	char *txt_name = RELREF(rp[COL_FILE]), *txt_size = RELREF(rp[COL_SIZE]);

	// File selected
	if (txt_size[0]) cmd_setv(dt->entry, txt_name, PATH_VALUE);
}
Exemple #3
0
static void fpick_scan_drives(fpick_dd *dt)	// Scan drives, populate widgets
{
	int cdrive = 0;

	/* Get the current drive letter */
	if (dt->txt_directory[1] == ':') cdrive = dt->txt_directory[0];

	dt->txt_directory[0] = '\0';
	cmd_setv(dt->combo, "", ENTRY_VALUE); // Just clear it

	scan_drives(dt, cdrive);
	cmd_reset(dt->list, dt);
}
Exemple #4
0
static void reset_frames(shifter_dd *dt)
{
	char txt[130];
	int i, j, l, lcm;

	for (lcm = 1 , i = 0; i < NSHIFT; i++)
	{
		l = spins[i][0][0] - spins[i][1][0];
		if (!l) continue;
		// Total frames needed for shifts, including delays
		l = (1 + abs(l)) * (spins[i][2][0] + 1);
		// Calculate the lowest common multiple for all of the numbers
		j = gcd(lcm, l);
		lcm = (lcm / j) * l;
	}

	dt->frame[2] = lcm - 1;
	// Re-centre the slider if its out of range on the new scale
	if (dt->frame[0] >= lcm) dt->frame[0] = 0;
	cmd_setv(dt->slider, dt->frame, SPIN_ALL); // Set min/max value of slider

	snprintf(txt, 128, "%s = %i", _("Frames"), lcm);
	cmd_setv(dt->label, txt, LABEL_VALUE);
}
Exemple #5
0
static void faction_changed(spawn_dd *dt, void **wdata, int what, void **where)
{
	void *cause;
	spawn_row *rp;

	if (dt->lock) return;
	cause = cmd_read(where, dt);

	rp = dt->strs + dt->idx;
	if (cause == dt->dir) strncpy(rp->dir, dt->dir, sizeof(rp->dir));
	else
	{
		strncpy0(rp->name, dt->name, sizeof(rp->name));
		strncpy0(rp->cmd, dt->cmd, sizeof(rp->cmd));
		cmd_setv(dt->list, (void *)dt->idx, LISTC_RESET_ROW);
	}
}