예제 #1
0
파일: tglgrid.c 프로젝트: nicklan/tglgrid
void tg_say(t_tg* tg, t_floatarg cf, t_floatarg rf) {
  t_int c = (int)cf;
  t_int r = (int)rf;
  if (toggle_val(tg,c,r)=='0')
    outlet_float(tg->f_out,0);
  else
    outlet_float(tg->f_out,1);
}
예제 #2
0
파일: flags.c 프로젝트: nickdrozd/lispinc
// inelegant
void switch_flag(char* flag_command) {
    if (DEBUG) printf("%s\n", "switching flag...");

    if (streq(flag_command, DEBUG_COMMAND))
        toggle_val(&DEBUG);
    else if (streq(flag_command, INFO_COMMAND))
        toggle_val(&INFO);
    else if (streq(flag_command, STATS_COMMAND))
        toggle_val(&STATS);
    else if (streq(flag_command, TAIL_COMMAND))
        toggle_val(&TAIL);
    else if (streq(flag_command, STEP_COMMAND))
        toggle_val(&STEP);
    else if (streq(flag_command, REPL_COMMAND))
        repl_switch();
    else if (streq(flag_command, DEMO_COMMAND))
        demo_switch();
}
예제 #3
0
파일: tglgrid.c 프로젝트: nicklan/tglgrid
static void tglgrid_motion(t_tg* tg, t_floatarg dx, t_floatarg dy) {
  int row,col;
  tg->mouse_x += dx;
  tg->mouse_y += dy;
  col_and_row(tg,tg->glist,tg->mouse_x,tg->mouse_y,&col,&row);
  if (col < tg->cols && row < tg->rows &&
      col >= 0 && row >= 0 &&
      (col != tg->tgld_col || row != tg->tgld_row) &&
      (toggle_val(tg,col,row) != tg->mouse_tgld) ) {
    do_toggle(tg,row,col);
    tg->tgld_col = col;
    tg->tgld_row = row;
  }
}
예제 #4
0
파일: tglgrid.c 프로젝트: nicklan/tglgrid
static void draw_new(t_tg* tg, t_glist *glist) {
  t_canvas *canvas = glist_getcanvas(glist);
  int c,r;
  int curx,cury;
  int w = full_width(tg);
  int h = full_height(tg);

  tg->canvas = canvas;

  curx = text_xpix(&tg->x_obj, glist)+tg->spacing;
  cury = text_ypix(&tg->x_obj, glist)+tg->spacing;

  for (r = 0;r < tg->rows;r++) {
    for (c = 0;c < tg->cols;c++) {
      if (toggle_val(tg,c,r) != '0')
        sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill %s -tags %lxTGLSQ%d.%d\n",
                 canvas, curx, cury, curx + tg->cell_size, cury + tg->cell_size, tg->tglfill, tg, c, r);
      else
        //sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill [.x%lx.c cget -background] -tags %lxTGLSQ%d.%d\n",
        sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill %s -tags %lxTGLSQ%d.%d\n",
                 canvas, curx, cury, curx + tg->cell_size, cury + tg->cell_size, tg->untglfill, tg, c, r);

      //set up highlighting
      sys_vgui(".x%lx.c bind %lxTGLSQ%d.%d <Enter> {.x%lx.c itemconfigure %lxTGLSQ%d.%d -outline #FF0000}\n",
               canvas,tg,c,r,canvas,tg,c,r);
      sys_vgui(".x%lx.c bind %lxTGLSQ%d.%d <Leave> {.x%lx.c itemconfigure %lxTGLSQ%d.%d -outline #000000}\n",
               canvas,tg,c,r,canvas,tg,c,r);
      curx += (tg->cell_size+tg->spacing);
    }
    curx = text_xpix(&tg->x_obj, glist)+tg->spacing;
    cury += (tg->cell_size+tg->spacing);
  }

  curx = text_xpix(&tg->x_obj, glist);
  cury = text_ypix(&tg->x_obj, glist);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxTGLBOUND\n",
           canvas, curx, cury, curx + w, cury + h, tg, canvas);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #000000 -tags %lxTGLIN1\n",
           canvas, curx, cury, curx + IOWIDTH, cury + 4, tg);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #000000 -tags %lxTGLIN2\n",
           canvas, curx+w-IOWIDTH, cury, curx + w, cury + 4, tg);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #000000 -tags %lxTGLOUT1\n",
           canvas, curx, cury+h-4, curx + IOWIDTH, cury + h, tg);
  sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #000000 -tags %lxTGLOUT2\n",
           canvas, curx+w-IOWIDTH, cury+h-4, curx + w, cury + h, tg);
  canvas_fixlinesfor(canvas, (t_text*)tg);
}
예제 #5
0
파일: flags.c 프로젝트: nickdrozd/lispinc
void toggle_LIB(void) { toggle_val(&LIB); }
예제 #6
0
파일: tglgrid.c 프로젝트: nicklan/tglgrid
void tg_off(t_tg* tg, t_floatarg cf, t_floatarg rf) {
  t_int c = (int)cf;
  t_int r = (int)rf;
  if (toggle_val(tg,c,r)!='0')
    do_toggle(tg,r,c);
}