예제 #1
0
파일: tglgrid.c 프로젝트: nicklan/tglgrid
static void tglgrid_dialog(t_tg *tg, t_symbol *s, int argc, t_atom *argv) {
  UNUSED(s);
  if (!tg)
    error("tglgrid: tried to set properties on a non-existant grid");
  else if (argc != 6)
    error("tglgrid: invalid number of arguments passed to tglgrid_dialog.  (Expected 6, got %d)",
          argc);
  else if (argv[0].a_type != A_FLOAT ||
           argv[1].a_type != A_FLOAT ||
           argv[2].a_type != A_FLOAT ||
           argv[3].a_type != A_FLOAT ||
           argv[4].a_type != A_SYMBOL ||
           argv[5].a_type != A_SYMBOL)
    error("tglgrid: invalid parameter types passed to tglgrid_dialog");
  else {
    t_int newcols = (t_int)argv[0].a_w.w_float;
    t_int newrows = (t_int)argv[1].a_w.w_float;
    tg->cell_size = (t_int)argv[2].a_w.w_float;
    tg->spacing = (t_int)argv[3].a_w.w_float;
    snprintf(tg->tglfill,8,argv[4].a_w.w_symbol->s_name);
    snprintf(tg->untglfill,8,argv[5].a_w.w_symbol->s_name);

    // need to erase before we change # of rows/cols
    // so we erase the old size
    draw_erase(tg,tg->glist);
    resize_to(tg,newcols,newrows);
    draw_new(tg,tg->glist);
  }
}
예제 #2
0
파일: tglgrid.c 프로젝트: nicklan/tglgrid
static void tglgrid_vis(t_gobj *z, t_glist *glist, int vis) {
  t_tg *tg = (t_tg*)z;
  if (vis)
    draw_new(tg, glist);
  else
    draw_erase(tg, glist);
}
예제 #3
0
gboolean whiteb_board_motion(GtkWidget *canvas, GdkEventMotion *ev, gpointer user_data)
{
	if(whiteb_tool_mode == WHITEB_LINE)
	{
		if((ev->state & GDK_BUTTON1_MASK)==GDK_BUTTON1_MASK)
		{
			draw_sync_buffers(canvas);
			draw_temp_line(canvas,oldx,oldy,ev->x,ev->y,2);
		}
	}
	else if(whiteb_tool_mode == WHITEB_FREEHAND)
	{
		if((ev->state & GDK_BUTTON1_MASK)==GDK_BUTTON1_MASK)
			draw_line(canvas,oldx,oldy,ev->x, ev->y,0,0,0,2);
		oldx = ev->x;
		oldy = ev->y;
	}
	else if(whiteb_tool_mode == WHITEB_ERASER)
	{
		draw_sync_buffers(canvas);
		draw_temp_rect(canvas,ev->x,ev->y,width);
		if((ev->state & GDK_BUTTON1_MASK)==GDK_BUTTON1_MASK)
			draw_erase(canvas,oldx, oldy,ev->x, ev->y,width);
		oldx = ev->x;
		oldy = ev->y;
	}
	else
	{
		oldx = ev->x;
		oldy = ev->y;
	}
	return 1;
}
예제 #4
0
파일: tglgrid.c 프로젝트: nicklan/tglgrid
void tg_size(t_tg* tg, t_floatarg cf, t_floatarg rf) {
  t_int c = (t_int)cf;
  t_int r = (t_int)rf;

  if (c != tg->cols || r != tg->rows) {
    draw_erase(tg,tg->glist);
    resize_to(tg,c,r);
    draw_new(tg,tg->glist);
  }
}