void tui_display_window(int x, int y, int width, int height, int foreground_color, int background_color, const char *title, tui_area_t *backing_store) { int i; if (backing_store != NULL) { /* 2 more chars on right, 1 more on bottom because of the "shadow". */ tui_area_get(backing_store, x, y, width + 2, height + 1); } tui_make_shadow(x + 2, y + 1, width, height); tui_set_attr(foreground_color, background_color, 0); tui_put_char(x, y, 0xc9); tui_hline(x + 1, y, 0xcd, width - 2); tui_put_char(x + width - 1, y, 0xbb); tui_put_char(x, y + height - 1, 0xc8); tui_hline(x + 1, y + height - 1, 0xcd, width - 2); tui_put_char(x + width - 1, y + height - 1, 0xbc); for (i = 0; i < height - 2; i++) { tui_put_char(x, y + i + 1, 0xba); tui_hline(x + 1, y + i + 1, ' ', width - 2); tui_put_char(x + width - 1, y + i + 1, 0xba); } if (!util_check_null_string(title)) { int title_x, title_length; title_length = strlen(title); title_x = x + (width - title_length - 4) / 2; tui_display(title_x, y, 0, "\x10 %s \x11", title); } }
static void file_selector_display_item(struct file_list *fl, int num, int first_item_num, int x, int y, int width, int height, int num_cols) { y += (num - first_item_num) % height; x += ((num - first_item_num) / height) * width; if (num >= fl->num_used_items) { tui_hline(x, y, ' ', width); } else { int len = strlen(fl->items[num].name); /* XXX: Assumes `width' is > 5! */ if (len > width - 2) { char *name = alloca(width - 2 + 1); if (fl->items[num].type == FT_DIR) { memcpy(name, fl->items[num].name, width - 3); name[width - 4] = name[width - 5] = '.'; name[width - 3] = '/'; } else { memcpy(name, fl->items[num].name, width - 2); name[width - 3] = name[width - 4] = '.'; } name[width - 2] = '\0'; tui_display(x, y, width, " %s ", name); } else { if (fl->items[num].type == FT_DIR) { tui_display(x, y, width, " %s/ ", fl->items[num].name); } else { tui_display(x, y, width, " %s ", fl->items[num].name); } } } }
void tui_clear_screen(void) { int i; _setcursortype(_NOCURSOR); tui_set_attr(FIRST_LINE_FORE, FIRST_LINE_BACK, 0); #ifndef UNSTABLE tui_display(0, 0, tui_num_cols(), "VICE version %s", VERSION); #else tui_display(0, 0, tui_num_cols(), "VICE version %s (unstable)", VERSION); #endif tui_set_attr(BACKPATTERN_FORE, BACKPATTERN_BACK, 0); for (i = 1; i < tui_num_lines() - 1; i++) tui_hline(0, i, BACKCHAR, tui_num_cols()); }
static void file_selector_display_path(const char *path, int x, int y, int width) { int i, xx; tui_set_attr(MENU_BORDER, MENU_BACK, 0); tui_hline(x, y, 0xcd, width); tui_set_attr(MENU_FORE, MENU_BACK, 0); for (i = strlen(path) - 1, xx = MIN(x + width - 1, x + i); i >= 0 && xx >= x; i--, xx--) { char c; /* Display ellipsis on the left if longer than the line. */ if (xx <= x + 1 && i > 1) { c = '.'; } else { c = path[i] == '/' ? '\\' : path[i]; } tui_put_char(xx, y, c); } }
static void print_configuration (void) { char tmp[256]; int y = 5; int i; tui_clrwin (0); tui_drawbox (0); tui_hline (2, 3, tui_cols () - 1); sprintf (tmp, "UAE %d.%d.%d: The Un*x Amiga Emulator", UAEMAJOR, UAEMINOR, UAESUBREV); tui_gotoxy ((tui_cols () - strlen(tmp))/2, 2); tui_puts (tmp); strcpy(tmp, "Press RETURN/ENTER to run UAE, ESC to exit"); tui_gotoxy ((tui_cols () - strlen(tmp))/2, tui_lines ()); tui_puts (tmp); tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF0: %s", trimfilename (currprefs.df[0], tui_cols () - 20)); tui_puts (tmp); tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF1: %s", trimfilename (currprefs.df[1], tui_cols () - 20)); tui_puts (tmp); tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF2: %s", trimfilename (currprefs.df[2], tui_cols () - 20)); tui_puts (tmp); tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF3: %s", trimfilename (currprefs.df[3], tui_cols () - 20)); tui_puts (tmp); y++; tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "VIDEO: %d:%d%s %s", currprefs.gfx_width, currprefs.gfx_height, currprefs.gfx_lores_mode ? " (lores)" : "", "" /*colormodes[currprefs.color_mode]*/); tui_puts (tmp); tui_gotoxy (OPTION_COLUMN+7, y++); if (currprefs.gfx_vresolution) tui_puts ("Doubling lines, "); /* if (currprefs.gfx_correct_aspect) tui_puts ("Aspect corrected"); else tui_puts ("Not aspect corrected");*/ tui_gotoxy (OPTION_COLUMN+7, y++); if (currprefs.gfx_xcenter) tui_puts ("X centered"); if (currprefs.gfx_xcenter == 2) tui_puts (" (clever)"); if (currprefs.gfx_ycenter && currprefs.gfx_xcenter) tui_puts (", "); if (currprefs.gfx_ycenter) tui_puts ("Y centered "); if (currprefs.gfx_ycenter == 2) tui_puts (" (clever)"); tui_gotoxy (OPTION_COLUMN+7, y++); tui_puts ("drawing every "); switch (currprefs.gfx_framerate) { case 1: break; case 2: tui_puts ("2nd "); break; case 3: tui_puts ("3rd "); break; default: sprintf (tmp, "%dth ",currprefs.gfx_framerate); tui_puts (tmp); break; } tui_puts ("frame. "); tui_gotoxy (OPTION_COLUMN+7, y++); if (currprefs.gfxmem_size) { sprintf (tmp, "Picasso 96 %d MB", currprefs.gfxmem_size / 0x100000); tui_puts(tmp); } else tui_puts ("Picasso 96 Off"); y++; tui_gotoxy (OPTION_COLUMN, y++); tui_puts ("CPU: "); switch (currprefs.cpu_level) { case 0: tui_puts ("68000"); break; case 1: tui_puts ("68010"); break; case 2: tui_puts ("68020"); break; case 3: tui_puts ("68020/68881"); break; } if (currprefs.address_space_24 && currprefs.cpu_level > 1) tui_puts (" (24 bit addressing)"); if (currprefs.cpu_compatible) tui_puts (" (slow but compatible)"); tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "MEMORY: %4dK chip; %4dK fast; %4dK slow", currprefs.chipmem_size/1024, currprefs.fastmem_size/1024, currprefs.bogomem_size/1024); tui_puts (tmp); tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "ROM IMAGE: %s", trimfilename (currprefs.romfile, tui_cols () - 50)); tui_puts (tmp); tui_gotoxy (OPTION_COLUMN, y++); if (!sound_available) tui_puts ("SOUND: Not available"); else { switch (currprefs.produce_sound) { case 0: tui_puts ("SOUND: 0 (Off)"); break; case 1: tui_puts ("SOUND: 1 (Off, but emulated)"); break; case 2: tui_puts ("SOUND: 2 (On)"); break; case 3: tui_puts ("SOUND: 3 (On, emulated perfectly)"); break; } tui_gotoxy (OPTION_COLUMN + 7, y++); sprintf (tmp, "%d bits at %d Hz", currprefs.sound_bits, currprefs.sound_freq); tui_puts (tmp); tui_gotoxy (OPTION_COLUMN + 7, y++); sprintf (tmp, "Maximum buffer size %d bytes", currprefs.sound_maxbsiz); tui_puts (tmp); } tui_gotoxy (OPTION_COLUMN,y++); tui_puts ("GAME PORT 1: "); tui_puts (gameport_state (0)); tui_gotoxy (OPTION_COLUMN,y++); tui_puts ("GAME PORT 2: "); tui_puts (gameport_state (1)); for (i = 0;; i++) { char buf[256]; tui_gotoxy (OPTION_COLUMN+1,y++); if (sprintf_filesys_unit (currprefs.mountinfo, buf, i) == -1) break; tui_puts (buf); } }