Exemplo n.º 1
0
int		main(int ac, char **av)
{
  t_data	data;

  set_max_heap_size(30);
  data.sup = bunny_malloc(sizeof(struct s_support));
  if (ac == 2)
    data.sup->name = av[1];
  else
    data.sup->name = NULL;
  data.sup->pos.x = 0;
  data.sup->pos.y = 0;
  if (init_button(&data) == 1)
    return (1);
  init_main_variables(&data);
  init_all_pixarray(&data);
  data.window = bunny_start(WIN_WIDTH, WIN_HEIGHT, 0, "Chroma");
  display_it(&data, data.pixbg, 0, 0);
  display_it(&data, data.pixbgtool, WIN_WIDTH - 255, 150);
  display_it(&data, data.pixbgcalc, WIN_WIDTH - 255, WIN_HEIGHT - 282);
  bunny_set_loop_main_function(mainloop);
  bunny_set_key_response(key_actions);
  bunny_set_click_response(click_actions);
  bunny_loop(data.window, 60, &data);
  bunny_stop(data.window);
  delete_all_clipables(&data);
  empty_list(data.tool, free_calc);
  bunny_free(data.tool);
  return (0);
}
Exemplo n.º 2
0
t_bunny_response	mainloop(void *_data)
{
  t_data		*data;

  data = (t_data *)_data;
  display_pos(data);
  dtraverse(data->tool, display_button, data);
  start(data);
  set_color_tool(data);
  set_bg(data->sup->pixarray, WHITE);
  dtraverse(data->sup->calc, add_calc, data);
  display_it(data, data->pixback, 78, 2);
  display_it(data, data->sup->pixarray, data->sup->pos.x, data->sup->pos.y);
  display_it(data, data->swatch.pix, WIN_WIDTH - 260, 5);
  display_it(data, data->swatch.pix2, WIN_WIDTH - 260, 112);
  display_it(data, data->pixinfo, 0, WIN_HEIGHT - 20);
  set_bg(data->pixinfocolor, data->tools.color.full);
  display_it(data, data->pixinfocolor, 7, WIN_HEIGHT - 87);
  display_it(data, data->square.pix_square,
	     data->square.init_pos.x, data->square.init_pos.y);
  display_text(data, data->crs.tool, 10, WIN_HEIGHT - 18);
  display_pos(data);
  bunny_display(data->window);
  dtraverse(data->sup->calc, check_button_calc, data);
  draw(data);
  return (GO_ON);
}
Exemplo n.º 3
0
/*
**	crum_move(test_list, status, ch)
**
**	(*) test all cursor move commands
*/
static void
crum_move(
	struct test_list *t,
	int *state,
	int *ch)
{
	char buf[80];
	int n;

	switch (n = (t->flags & 15)) {
	case 0:
		sprintf(buf, " (cr) (nel) (cub1)%s",
			cursor_home ? " (home)" : (cursor_up ? " (cuu1)" : ""));
		break;
	case 1:
		sprintf(buf, "%s%s%s%s", cursor_left ? " (cub1)" : "",
			cursor_down ? " (cud1)" : "", cursor_right ? " (cuf1)" : "",
			cursor_up ? " (cuu1)" : "");
		if (buf[0] == '\0') {
			ptext("    (cub1) (cud1) (cuf1) (cuu1) not defined.");
		}
		break;
	case 2:
		sprintf(buf, "%s%s%s%s", parm_left_cursor ? " (cub)" : "",
			parm_down_cursor ? " (cud)" : "",
			parm_right_cursor ? " (cuf)" : "",
			parm_up_cursor ? " (cuu)" : "");
		if (buf[0] == '\0') {
			ptext("    (cub) (cud) (cuf) (cuu) not defined.");
		}
		break;
	case 3:
		sprintf(buf, "%s%s", row_address ? " (vpa)" : "",
			column_address ? " (hpa)" : "");
		if (buf[0] == '\0') {
			ptext("    (vpa) (hpa) not defined.");
		}
		break;
	case 4:
		if (!cursor_address) {
			ptext("    (cup) not defined.  ");
			generic_done_message(t, state, ch);
			return;
		}
		strcpy(buf, " (cup)");
		break;
	}
	if (buf[0] == '\0') {
		put_str("  Done. ");
	} else {
		can_test(buf, FLAG_TESTED);
		strcpy(crum_text[n], &buf[2]);
		crum_text[n][strlen(buf) - 3] = '\0';

		display_it(1 << n, buf);
	}
	*ch = wait_here();
	if (*ch != 'r') {
		put_clear();
	}
}