Ejemplo n.º 1
0
//Logic for States
void
state_logic ()
{
  if (state_terminated)
    {
      if (state_terminated > 0)
	{
	  trans_stop ();
	  state_quit ();
	  game_shutdown ();
	  state_terminated = -1;	//One Time Quit.
	}
      return;
    }

  if (state_switched)
    {
      return;
    }

  handlers[state].proc_logic ();
  {
    dt = al_get_time () - prev_time;
    while (dt >= GUI_DT)
      {
	gui_update ();
	dt -= GUI_DT;
	prev_time = al_get_time ();
      }
    gui_update ();
  }
}
Ejemplo n.º 2
0
Archivo: fbxkb.c Proyecto: kba/fbxkb
static GdkFilterReturn
filter( XEvent *xev, GdkEvent *event, gpointer data)
{
    XkbEvent *xkbev;

    ENTER;
    if (xev->type != xkb_event_type)
        RET(GDK_FILTER_CONTINUE);
   
    xkbev = (XkbEvent *) xev;
    DBG("XkbTypeEvent %d \n", xkbev->any.xkb_type);
    if (xkbev->any.xkb_type == XkbStateNotify) {
        DBG("XkbStateNotify: group=%d\n", xkbev->state.group);
        cur_group = xkbev->state.group;
        if (cur_group >= ngroups) {
            ERR("current group is bigger then total group number");
            cur_group = 0;
        }
        gui_update();
    } else if (xkbev->any.xkb_type == XkbNewKeyboardNotify) {         
        DBG("XkbNewKeyboardNotify\n");
        free_group_info();
        get_group_info();
        gui_update();
        gui_extra_rebuild();
    }
    RET(GDK_FILTER_REMOVE);
}
Ejemplo n.º 3
0
Archivo: fsv.c Proyecto: Explorer09/fsv
/* Performs filesystem scan and first-time initialization */
void
fsv_load( const char *dir )
{
	/* Lock down interface */
	window_set_access( FALSE );

	/* Bring up splash screen */
	globals.fsv_mode = FSV_SPLASH;
	redraw( );

	/* Reset scrollbars (disable scrolling) */
	camera_update_scrollbars( TRUE );

	gui_update( );

	/* Scan filesystem */
	scanfs( dir );

	/* Clear/reset node history */
	g_list_free( globals.history );
	globals.history = NULL;
	globals.current_node = root_dnode;

	/* Initialize file list */
	filelist_init( );
	gui_update( );

	/* Initialize visualization */
	globals.fsv_mode = FSV_NONE;
	fsv_set_mode( initial_fsv_mode );
}
Ejemplo n.º 4
0
void gui_enter()
{
        int x = 1;
        DIALOG_PLAYER *dp;       
        
        while (keypressed()) readkey();
        while (key[KEY_F11]) rest(100);

        gui_update();

        if (curtube != 3 && !mouse_amx) install_mouse();
        
        set_color_depth(dcol);
        show_mouse(screen);
        bemgui[0].x  = (windx / 2) - 36;
        bemgui[0].y  = windy - 8;
        bemgui[0].fg = makecol(255,255,255);
        dp=init_dialog(bemgui, 0);
        while (x && !key[KEY_F11] && !key[KEY_ESC])
        {
                x = update_dialog(dp);
        }
        shutdown_dialog(dp);
        show_mouse(NULL);
        set_color_depth(8);

        if (curtube != 3 && !mouse_amx) remove_mouse();
        
        while (key[KEY_F11]) rest(100);

        video_clearscreen();
}
Ejemplo n.º 5
0
void prefs_load(void)
{
	GKeyFile *keyfile = g_key_file_new();
	char *filename = g_build_filename(g_get_user_config_dir(), PACKAGE, NULL);
	bool loaded;

	if ((loaded = g_key_file_load_from_file(keyfile, filename, G_KEY_FILE_NONE,
		NULL)))
	{
		load_hash_funcs(keyfile);
		load_digest_format(keyfile);
		load_window_view(keyfile);
		load_window_show_toolbar(keyfile);
		load_window_size(keyfile);
	}

	g_free(filename);
	g_key_file_free(keyfile);

	if (!loaded) {
		default_hash_funcs();
		default_window_show_toolbar();
	}

	gui_update();
}
Ejemplo n.º 6
0
int gui_wprot0()
{
        writeprot[0] = !writeprot[0];
        if (fwriteprot[0]) fwriteprot[0] = 1;
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 7
0
int gui_method()
{
        sidmethod = (intptr_t)active_menu->dp;
        sid_settype(sidmethod, cursid);
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 8
0
int gui_interlaced()
{
        vid_interlace = 1;
        vid_linedbl = vid_scanlines = 0;
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 9
0
int gui_tubespd()
{
        tube_6502_speed = (intptr_t)active_menu->dp;
        tube_updatespeed();
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 10
0
int gui_tube()
{
        selecttube = (intptr_t)active_menu->dp;
        main_restart();
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 11
0
int gui_wprot1()
{
        writeprot[1] = !writeprot[1];
        if (fwriteprot[1]) fwriteprot[1] = 1;
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 12
0
static void prefs_default(void)
{
	default_hash_funcs();
	default_show_toolbar();

	gui_update();
}
Ejemplo n.º 13
0
int gui_model()
{
        oldmodel = curmodel;
        curmodel = (intptr_t)active_menu->dp;
        main_restart();
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 14
0
int gui_ddtype()
{
        ddnoise_type = (intptr_t)active_menu->dp;
        ddnoise_close();
        ddnoise_init();
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 15
0
int gui_speed()
{
        emuspeed = (intptr_t)active_menu->dp;
        changetimerspeed(timerspeeds[emuspeed]);
        vid_fskipmax = frameskips[emuspeed];
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 16
0
Archivo: fbxkb.c Proyecto: kba/fbxkb
static void
create_all()
{
    ENTER;
    get_group_info();
    gui_create();
    gui_update();
    gui_extra_rebuild();
    RET();
}
Ejemplo n.º 17
0
/* Runs the 'file' command on the given file, and returns the output
 * (a verbose description of the file type) */
static char *
get_file_type_desc( const char *filename )
{
	static char *cmd_output = NULL;
	FILE *cmd;
	double t0;
	int len, c, i = 0;
	char *cmd_line;

	/* Allocate output buffer */
	RESIZE(cmd_output, strlen( filename ) + 1024, char);

	/* Construct command line */
	len = strlen( FILE_COMMAND ) + strlen( filename ) - 1;
	cmd_line = NEW_ARRAY(char, len);
	sprintf( cmd_line, FILE_COMMAND, filename );

	/* Open command stream */
	cmd = popen( cmd_line, "r" );
	xfree( cmd_line );
	if (cmd == NULL) {
		strcpy( cmd_output, _("Could not execute 'file' command") );
		return cmd_output;
	}

	/* Read loop */
	t0 = xgettime( );
	while (!feof( cmd )) {
		/* Read command's stdout */
		c = fgetc( cmd );
		if (c != EOF)
			cmd_output[i++] = c;

		/* Check for timeout condition */
		if ((xgettime( ) - t0) > 5.0) {
			fclose( cmd ); /* Is this allowed? */
			strcpy( cmd_output, _("('file' command timed out)") );
			return cmd_output;
		}

		/* Keep the GUI responsive */
		gui_update( );
	}
	pclose( cmd );
	cmd_output[i] = '\0';

	len = strlen( filename );
	if (!strncmp( filename, cmd_output, len )) {
		/* Remove prepended "filename: " from output */
		return &cmd_output[len + 2];
	}

	return cmd_output;
}
Ejemplo n.º 18
0
int gui_autoboot()
{
        int ret;

        if ((ret = gui_load_drive(0, "Please choose a disc image to autoboot in drive 0/2")))
        {
                main_reset();
                autoboot = 150;
        }
        gui_update();
        return D_O_K;
}
Ejemplo n.º 19
0
int gui_vdfs_root() {
        char tempname[260];
        int ret;
        int xsize = windx - 32, ysize = windy - 16;
        strncpy(tempname, vdfs_get_root(), sizeof(tempname));
        memcpy(tempname, discfns[1], 260);
        ret = file_select_ex("Please select VDFS root directory", tempname, NULL, 260, xsize, ysize);
        if (ret)
            vdfs_set_root(tempname);
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 20
0
static void prefs_load(void)
{
	g_assert(prefs_priv.settings);

	load_hash_funcs();
	load_digest_format();
	load_view();
	load_show_toolbar();
	load_window_size();

	gui_update();
}
Ejemplo n.º 21
0
/* Adds a new entry to the directory tree */
void
dirtree_entry_new( GNode *dnode )
{
	GtkCTreeNode *parent_ctnode = NULL;
	const char *name;
	boolean expanded;

	g_assert( NODE_IS_DIR(dnode) );

	parent_ctnode = DIR_NODE_DESC(dnode->parent)->ctnode;
	if (strlen( NODE_DESC(dnode)->name ) > 0)
		name = NODE_DESC(dnode)->name;
	else
		name = _("/. (root)");
	expanded = g_node_depth( dnode ) <= 2;

	DIR_NODE_DESC(dnode)->ctnode = gui_ctree_node_add( dir_ctree_w, parent_ctnode, dir_colexp_mini_icons, name, expanded, dnode );

	if (parent_ctnode == NULL) {
		/* First entry was just added. Keep directory tree frozen
		 * most of the time while scanning, otherwise it tends to
		 * flicker annoyingly */
		gtk_clist_freeze( GTK_CLIST(dir_ctree_w) );
	}
	else if (GTK_CTREE_ROW(parent_ctnode)->expanded) {
		/* Pre-update (allow ctree to register new row) */
		gtk_clist_thaw( GTK_CLIST(dir_ctree_w) );
		gui_update( );
		gtk_clist_freeze( GTK_CLIST(dir_ctree_w) );
		/* Select last row */
		gtk_ctree_select( GTK_CTREE(dir_ctree_w), DIR_NODE_DESC(dnode)->ctnode );
		/* Scroll directory tree down to last row */
		gui_clist_moveto_row( dir_ctree_w, -1, 0.0 );
		/* Post-update (allow ctree to perform select/scroll) */
		gtk_clist_thaw( GTK_CLIST(dir_ctree_w) );
		gui_update( );
		gtk_clist_freeze( GTK_CLIST(dir_ctree_w) );
	}
}
Ejemplo n.º 22
0
static int subr_nodes_append(lua_State* L)
{
	GtkTreeIter *parent;            /*1*/
 	char *classname;
	GtkTreeIter node;
	attr_table_t table;
	unsigned u;

	if (lua_gettop(L)>2)
	{
		lua_pushstring(L, "node.append() takes at most two arguments: a parent and either a classname or a table.");
		lua_error(L);
	}

	parent=luaL_check_node_ref(L,1);

	if (internal_is_pseudo_root(parent)) parent = NULL;

	dyntree_model_iter_append(gui_cardview_get_store(),&node,parent);

	switch (lua_type(L,2)) {
		case LUA_TNONE:
		case LUA_TNIL:
			dyntree_model_iter_attribute_set(gui_cardview_get_store(),&node,CC_CLASSNAME,"t:item");
			break;	
		case LUA_TTABLE:
			if (internal_fill_table(L,2,&table))
			{
				for (u=0;u<table.size;u++)
				{
					dyntree_model_iter_attribute_set_by_name(gui_cardview_get_store(),&node,table.names[u],table.values[u]);	
				}
				internal_empty_table(&table);
			}
			break;
		case LUA_TSTRING:
			classname = g_strdup_printf("t:%s",luaL_checkstring(L,2));	
			dyntree_model_iter_attribute_set(gui_cardview_get_store(),&node,CC_CLASSNAME,classname);
			g_free(classname);
			break;
		default:
			luaL_error(L,"Parameter #2 of node.append() must be a string describing a classname or a table of attributes.");
	}

	lua_push_node_ref(L,&node);
	
	gui_update(1);

	return 1;
}
Ejemplo n.º 23
0
void gui_update_filelist(void) {
	if(!filelist_window){
		return;
	}
	window_draw_border(filelist_window);
	window_draw_title(filelist_window);
	window_draw_scrollbar(filelist_window);
	window_draw_list(filelist_window);
	window_update(filelist_window);

	//Update the info window as we are updated as well
	gui_update_info();
	gui_update();
}
Ejemplo n.º 24
0
static int subr_nodes_remove(lua_State* L)
{
  GtkTreeIter* iter = luaL_check_node_ref(L,1);

  if (internal_is_pseudo_root(iter)) iter = NULL;

  if (!dyntree_model_iter_remove(gui_cardview_get_store(),iter))
    lua_pushboolean(L,0);
  else
    lua_pushboolean(L,1);
  
  gui_update(1);
  return 1;
}
Ejemplo n.º 25
0
int gui_loadss()
{
        char tempname[260];
        int ret;
        int xsize = windx - 32, ysize = windy - 16;
        memcpy(tempname, discfns[0], 260);
        ret = file_select_ex("Please choose a save state", tempname, "SNP", 260, xsize, ysize);
        if (ret)
        {
                strcpy(savestate_name, tempname);
                savestate_load();
        }
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 26
0
Archivo: gui.c Proyecto: chinaktv/gxgui
void gui_loop()
{
	SDL_Event event;
	GuiWidget *root_widget = gui_root_widget();
	if (root_widget == NULL) {
		printf("ERROR: no found root widget\n");
		return;
	}
	
	widget_show(root_widget);
	root_widget = gui_main_widget();
	widget_show(root_widget);

	while (gui->running) {
		timer_exec();
		if (gui_update() == 0)
			SDL_Delay(10);
		if (SDL_PollEvent(&event)) {
			GuiWidget *cur_widget = (GuiWidget*)stack_peek(gui->win_stack);
			switch (event.type) {
				case SDL_VIDEORESIZE:
					break;
				case SDL_MOUSEBUTTONDOWN:
					printf("mouse (%d, %d)\n", event.button.x, event.button.y);
					break;
				case SDL_KEYDOWN:
					if (event.key.keysym.sym == SDLK_SPACE) {
						gui->running = 0;
						break;
					}
					if (cur_widget == NULL) continue;
					if (event.key.keysym.sym == SDLK_ESCAPE)
						widget_close(cur_widget);
					else
					{
						widget_process_event(cur_widget, (void *)&event);
					}
					break;
				case SDL_QUIT:
					gui->running = 0;

					break;
			}
		}
	}
	SDL_Quit();
}
Ejemplo n.º 27
0
static int gui_load_drive(int drive, const char *prompt)
{
        char tempname[260];
        int ret;
        int xsize = windx - 32, ysize = windy - 16;
        memcpy(tempname, discfns[drive], 260);
        ret = file_select_ex(prompt, tempname, "SSD;DSD;IMG;ADF;ADL;FDI", 260, xsize, ysize);
        if (ret)
        {
                disc_close(drive);
                memcpy(discfns[drive], tempname, 260);
                disc_load(drive, discfns[drive]);
                if (defaultwriteprot)
                        writeprot[drive] = 1;
        }
        gui_update();
        return ret;
}
Ejemplo n.º 28
0
int gui_hdisk()
{
        intptr_t sel = (intptr_t)active_menu->dp;
        int changed = 0;

        if (ide_enable)
        {
                if (sel != 0)
                {
                        ide_enable = 0;
                        changed = 1;
                }
        }
        else
        {
                if (sel == 0)
                {
                        ide_enable = 1;
                        changed = 1;
                }
        }
        if (scsi_enabled)
        {
                if (sel != 1)
                {
                        scsi_enabled = 0;
                        changed = 1;
                }
        }
        else
        {
                if (sel == 1)
                {
                        scsi_enabled = 1;
                        changed = 1;
                }
        }
        if (changed)
                main_reset();
        gui_update();
        return D_O_K;
}
Ejemplo n.º 29
0
int gui_savess()
{
        char tempname[260];
        int ret;
        int xsize = windx - 32, ysize = windy - 16;
        if (curtube != -1)
        {
                alert(NULL, "Second processor save states not supported yet.", NULL, "&OK", NULL, 0, 0);
                return D_CLOSE;
        }
        memcpy(tempname, discfns[0], 260);
        ret = file_select_ex("Please choose a save state", tempname, "SNP", 260, xsize, ysize);
        if (ret)
        {
                strcpy(savestate_name, tempname);
                savestate_save();
        }
        gui_update();
        return D_CLOSE;
}
Ejemplo n.º 30
0
/* This updates the directory tree to show (and select) a particular
 * directory entry, repopulating the file list with the contents of the
 * directory if not already listed */
void
dirtree_entry_show( GNode *dnode )
{
	int row;

	g_assert( NODE_IS_DIR(dnode) );

	/* Repopulate file list if directory is different */
	if (dnode != dirtree_current_dnode) {
		filelist_populate( dnode );
/* TODO: try removing this update from here */
		gui_update( );
	}

	/* Scroll directory tree to proper entry */
	row = gtk_clist_find_row_from_data( GTK_CLIST(dir_ctree_w), dnode );
	if (row >= 0)
		gtk_clist_select_row( GTK_CLIST(dir_ctree_w), row, 0 );
	else
		gtk_clist_unselect_all( GTK_CLIST(dir_ctree_w) );
	gui_clist_moveto_row( dir_ctree_w, MAX(0, row), DIRTREE_SCROLL_TIME );

	dirtree_current_dnode = dnode;
}