Exemplo n.º 1
0
static int wheel_cb(Ihandle *ih,float delta,int x,int y,char* status)
{
  int canvas_w, canvas_h;
  cdCanvas *canvas = (cdCanvas*)IupGetAttribute(ih, "_CD_CANVAS");
  (void)x;
  (void)y;
  (void)status;

  if (scale+delta==0) /* skip 0 */
  {
    if (scale > 0) 
      scale = -1;
    else 
      scale = 1;
  }
  else
    scale += (int)delta;

  cdCanvasActivate(canvas);
  cdCanvasGetSize(canvas, &canvas_w, &canvas_h, NULL, NULL);
  update_scrollbar(ih, canvas_w, canvas_h);
  update_viewport(ih, canvas, IupGetFloat(ih, "POSX"), IupGetFloat(ih, "POSY"));
  IupRedraw(ih, 0);
  return IUP_DEFAULT;
}
Exemplo n.º 2
0
static int scroll_cb(Ihandle *ih, int op, float posx, float posy)
{
  char* op2str[12] = {"SBUP", "SBDN", "SBPGUP", "SBPGDN", "SBPOSV", "SBDRAGV",
                      "SBLEFT", "SBRIGHT", "SBPGLEFT", "SBPGRIGHT", "SBPOSH", "SBDRAGH"};
  printf("SCROLL_CB(%s, posx=%.2f, posy=%.2f)\n", op2str[op], posx, posy);
  IupRedraw(ih, 0);
  return IUP_DEFAULT;
}
Exemplo n.º 3
0
static int scroll_cb(Ihandle *ih, int op, float posx, float posy)
{
  cdCanvas *canvas = (cdCanvas*)IupGetAttribute(ih, "_CD_CANVAS");
  update_viewport(ih, canvas, posx, posy);
  IupRedraw(ih, 0);
  (void)op;
  return IUP_DEFAULT;
}
Exemplo n.º 4
0
static int scroll_cb(Ihandle *ih, int op, float posx, float posy)
{
  cdCanvas *canvas = (cdCanvas*)IupGetAttribute(ih, "_CD_CANVAS");
printf("SCROLL_CB(%g, %g)\n", posx, posy);
  cdCanvasActivate(canvas);
  update_viewport(ih, canvas, posx, posy);
  IupRedraw(ih, 0);
  (void)op;
  return IUP_DEFAULT;
}
int btnClearLines_cb(Ihandle *btn) {
	
	Ihandle *canvas;
	void (*destroy_routine) (void *data);
	
	canvas = IupGetHandle(GL_CANVAS);
	destroy_routine = pointList.destroy;
	
	list_destroy(&pointList);
	list_init(&pointList, destroy_routine);
	
	IupRedraw(canvas, 0);
	
	return IUP_DEFAULT;
}
int btnRandLine_cb(Ihandle *btn) {
	
	Ihandle *canvas;
	void (*destroy_routine) (void *data);
	
	canvas = IupGetHandle(GL_CANVAS);
	destroy_routine = pointList.destroy;
	
	list_destroy(&pointList);
	list_init(&pointList, destroy_routine);

	util_generateRandomFloat(-1.0, 1.0, 30, &pointList);
	IupRedraw(canvas, 0);
//	IupUpdate(canvas);
	
	printf("%d random floats generated\n", list_size(&pointList));
	
	return IUP_DEFAULT;
}
Exemplo n.º 7
0
static int Redraw(lua_State *L)
{
  IupRedraw(iuplua_checkihandle(L,1), luaL_checkint(L, 2));
  return 0;
}
Exemplo n.º 8
0
int  guiMenu_OnValueChanged ( Ihandle *ih )
{
  Ihandle *kid = IupGetChild ( ih, 0 ), *fset[] =
  {
#ifndef EMULATOR
    guiOrg.main.fset,
    guiPfm.main.fset,
    guiTar.main.fset,
#endif
    guiPro.main.fset,
    guiQry.main.fset,
    guiRes.main.fset,
    NULL,
    guiHacks.main.fset,
    guiHack.main.fset,
    guiCodes->main.fset,
    guiCode->main.fset,
    NULL
  };
  Icallback cb[] =
  {
#ifndef EMULATOR
    guiOrg_OnShow,
    guiPfm_OnShow,
    guiTar_OnShow,
#endif
    guiPro_OnShow,
    guiQry_OnShow,
    guiRes_OnShow,
    NULL,
    guiHacks_OnShow,
    guiHack_OnShow,
    guiCodes_OnShow,
    guiCode_OnShow,
    NULL
  };
  //char  *title = IupGetAttribute ( kid, IUP_TITLE );
  int i = 1, c = IupGetChildCount ( guiDlg.vb );

  // Hide all groups first
  for ( ; i < c; ++i )
  {
    kid = IupGetChild ( guiDlg.vb, i );
    IupSetAttribute ( kid, "FLOATING", IUP_YES );
    IupHide ( kid );
  }

  for ( i = 0, c = IupGetChildCount ( guiOrg.main.vb ); i < c; ++i )
  {
    kid = IupGetChild ( guiOrg.main.vb, i );
    IupSetAttribute ( kid, "FLOATING", IUP_YES );
    IupHide ( kid );
  }

  // Find and show appropriate group
  i = IupGetInt ( ih, IUP_VALUE );
  IupSetInt( ih, "MEDIT_I", i );

  if ( ( --i ) >= 0 && fset[i] && cb[i] )
  {
    IupShow ( fset[i] );
    cb[i] ( fset[i] );
  }

  guiMenu_OnLang();
  // Force Update GUI
  IupRefresh ( guiDlg.vb );
  IupRedraw ( guiDlg.vb, 1 );
  IupFlush();
  return IUP_DEFAULT;
}
Exemplo n.º 9
0
static void Redraw(void)
{
  IupRedraw(iuplua_checkihandle(1), luaL_check_int(2));
}