Beispiel #1
0
static UI_MENU_CALLBACK(show_font_callback)
{
    int active = 1;
    int i, j;
    char fontchars[] = "0x 0123456789abcdef";

    if (activated) {
        sdl_ui_clear();
        sdl_ui_print_center("   0123456789ABCDEF", 0);
        sdl_ui_print_center("0x \xff\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 1);
        for (j = 1; j < 16; ++j) {
            for (i = 0; i < 16; ++i) {
                fontchars[3 + i] = (char)(j * 16 + i);
            }
            fontchars[0] = "0123456789ABCDEF"[j];
            sdl_ui_print_center(fontchars, 1 + j);
        }
        sdl_ui_refresh();
        while (active) {
            switch(sdl_ui_menu_poll_input()) {
                case MENU_ACTION_CANCEL:
                case MENU_ACTION_EXIT:
                    active = 0;
                    break;
                default:
                    SDL_Delay(10);
                    break;
            }
        }
    }
    return NULL;
}
Beispiel #2
0
console_t *uimon_window_open(void)
{
    sdl_ui_activate_pre_action();
    sdl_ui_init_draw_params();
    sdl_ui_clear();
    menu_draw = sdl_ui_get_menu_param();
    mon_console.console_xres = menu_draw->max_text_x;
    mon_console.console_yres = menu_draw->max_text_y;
    x_pos = 0;
    return &mon_console;
}
Beispiel #3
0
static UI_MENU_CALLBACK(about_callback)
{
    int active = 1;

    if (activated) {
        sdl_ui_clear();
        sdl_ui_print_center("VICE", 0);
        sdl_ui_print_center("Versatile Commodore Emulator", 1);
#ifdef USE_SVN_REVISION
        sdl_ui_print_center("Version " VERSION " rev " VICE_SVN_REV_STRING, 2);
#else
        sdl_ui_print_center("Version " VERSION, 2);
#endif
        sdl_ui_print_center("SDL " PLATFORM_CPU " " PLATFORM_OS " " PLATFORM_COMPILER, 3);
        sdl_ui_print_center("The VICE Team", 5);
        sdl_ui_print_center("(C) 1998-2014 Dag Lem", 6);
        sdl_ui_print_center("(C) 1999-2014 Andreas Matthies", 7);
        sdl_ui_print_center("(C) 1999-2014 Martin Pottendorfer", 8);
        sdl_ui_print_center("(C) 2005-2014 Marco van den Heuvel", 9);
        sdl_ui_print_center("(C) 2006-2014 Christian Vogelgsang", 10);
        sdl_ui_print_center("(C) 2007-2014 Fabrizio Gennari", 11);
        sdl_ui_print_center("(C) 2007-2014 Daniel Kahlin", 12);
        sdl_ui_print_center("(C) 2008-2014 Antti S. Lankila", 13);
        sdl_ui_print_center("(C) 2009-2014 Groepaz", 14);
        sdl_ui_print_center("(C) 2009-2014 Ingo Korb", 15);
        sdl_ui_print_center("(C) 2009-2014 Errol Smith", 16);
        sdl_ui_print_center("(C) 2010-2014 Olaf Seibert", 17);
        sdl_ui_print_center("(C) 2011-2014 Marcus Sutton", 18);
        sdl_ui_print_center("(C) 2011-2014 Ulrich Schulz", 19);
        sdl_ui_print_center("(C) 2011-2014 Stefan Haubenthal", 20);
        sdl_ui_print_center("(C) 2011-2014 Thomas Giesel", 21);
        sdl_ui_print_center("(C) 2011-2014 Kajtar Zsolt", 22);
        sdl_ui_print_center("(C) 2012-2014 Benjamin 'BeRo' Rosseaux", 23);
        sdl_ui_refresh();

        while (active) {
            switch (sdl_ui_menu_poll_input()) {
                case MENU_ACTION_CANCEL:
                case MENU_ACTION_EXIT:
                case MENU_ACTION_SELECT:
                    active = 0;
                    break;
                default:
                    SDL_Delay(10);
                    break;
            }
        }
    }
    return NULL;
}
Beispiel #4
0
static UI_MENU_CALLBACK(about_callback)
{
    int active = 1;
    int i;
    int j;
    char *tmp;

    if (activated) {
        sdl_ui_clear();
        i = 0;
        sdl_ui_print_center("VICE", i++);
        sdl_ui_print_center("Versatile Commodore Emulator", i++);
#ifdef USE_SVN_REVISION
        sdl_ui_print_center("Version " VERSION " rev " VICE_SVN_REV_STRING, i);
#else
        sdl_ui_print_center("Version " VERSION, i);
#endif
        i++;
#ifdef USE_SDLUI2
        sdl_ui_print_center("SDL2", i++);
#else
        sdl_ui_print_center("SDL", i++);
#endif
        i++;
        sdl_ui_print_center("The VICE Team", i++);
        for (j = 0; core_team[j].name; j++) {
            tmp = util_concat("(C) ", core_team[j].years, " ", core_team[j].name, NULL);
            sdl_ui_print_center(tmp, i++);
            lib_free(tmp);
        }
        sdl_ui_refresh();

        while (active) {
            switch (sdl_ui_menu_poll_input()) {
                case MENU_ACTION_CANCEL:
                case MENU_ACTION_EXIT:
                case MENU_ACTION_SELECT:
                    active = 0;
                    break;
                default:
                    SDL_Delay(10);
                    break;
            }
        }
    }
    return NULL;
}
Beispiel #5
0
static UI_MENU_CALLBACK(about_callback)
{
    int active = 1;

    if (activated) {
        sdl_ui_clear();
        sdl_ui_print_center("VICE", 0);
        sdl_ui_print_center("Versatile Commodore Emulator", 1);
        sdl_ui_print_center("Version " VERSION, 2);
        sdl_ui_print_center("SDL " PLATFORM_CPU " " PLATFORM_OS " " PLATFORM_COMPILER, 3);
        sdl_ui_print_center("The VICE Team", 5);
        sdl_ui_print_center("(C) 1998-2011 Dag Lem", 6);
        sdl_ui_print_center("(C) 1999-2011 Andreas Matthies", 7);
        sdl_ui_print_center("(C) 1999-2011 Martin Pottendorfer", 8);
        sdl_ui_print_center("(C) 2000-2011 Spiro Trikaliotis", 9);
        sdl_ui_print_center("(C) 2005-2011 Marco van den Heuvel", 10);
        sdl_ui_print_center("(C) 2006-2011 Christian Vogelgsang", 11);
        sdl_ui_print_center("(C) 2007-2011 Fabrizio Gennari", 12);
        sdl_ui_print_center("(C) 2007-2011 Daniel Kahlin", 13);
        sdl_ui_print_center("(C) 2008-2011 Antti S. Lankila", 14);
        sdl_ui_print_center("(C) 2009-2011 Groepaz", 15);
        sdl_ui_print_center("(C) 2009-2011 Ingo Korb", 16);
        sdl_ui_print_center("(C) 2009-2011 Errol Smith", 17);
        sdl_ui_print_center("(C) 2010-2011 Olaf Seibert", 18);
        sdl_ui_refresh();

        while (active) {
            switch(sdl_ui_menu_poll_input()) {
                case MENU_ACTION_CANCEL:
                case MENU_ACTION_EXIT:
                case MENU_ACTION_SELECT:
                    active = 0;
                    break;
                default:
                    SDL_Delay(10);
                    break;
            }
        }
    }
    return NULL;
}
Beispiel #6
0
static void sdl_ui_image_file_selector_redraw(image_contents_t *contents, const char *title, int offset, int num_items, int more, ui_menu_filereq_mode_t mode, int cur_offset)
{
    int i, j;
    char* title_string;
    char* name;
    uint8_t oldbg;
    image_contents_file_list_t *entry;

    title_string = image_contents_to_string(contents, 0);
    
    sdl_ui_clear();
    sdl_ui_display_title(title_string);
    lib_free(title_string);

    entry = contents->file_list;
    for (i = 0; i < offset; ++i) {
        entry = entry->next;
    }
    for (i = 0; i < num_items; ++i) {
        if (i == cur_offset) {
            oldbg = sdl_ui_set_cursor_colors();
        }

        j = MENU_FIRST_X;
        name = image_contents_file_to_string(entry, IMAGE_CONTENTS_STRING_PETSCII);
        j += sdl_ui_print(name, j, i + IMAGE_FIRST_Y + SDL_FILEREQ_META_NUM);

        if (i == cur_offset) {
            sdl_ui_print_eol(j, i + IMAGE_FIRST_Y + SDL_FILEREQ_META_NUM);
            sdl_ui_reset_cursor_colors(oldbg);
        }
        entry = entry->next;
    }
    name = lib_msprintf("%d BLOCKS FREE.", contents->blocks_free);
    sdl_ui_print(name, MENU_FIRST_X, i + IMAGE_FIRST_Y + SDL_FILEREQ_META_NUM);
    lib_free(name);
}
Beispiel #7
0
static void show_text(const char *text)
{
    int first_line = 0;
    int next_line = 0;
    int next_page = 0;
    unsigned int current_line = 0;
    unsigned int len;
    int x, y, z;
    int active = 1;
    int active_keys;
    char *string;
    menu_draw_t *menu_draw;

    menu_draw = sdl_ui_get_menu_param();

    string = lib_malloc(128);
    len = strlen(text);

    while (active) {
        sdl_ui_clear();
        first_line = current_line;
        for (y = 0; (y < menu_draw->max_text_y) && (current_line < len); y++) {
            z = 0;
            for (x = 0; text[current_line + x] != '\n'; x++) {
                switch (text[current_line + x]) {
                    case '`':
                        string[x + z] = '\'';
                        break;
                    case 'ä':
                        string[x + z] = 'a';
                        break;
                    case '~':
                        string[x + z] = '-';
                        break;
                    case 'é':
                    case 'è':
                        string[x + z] = 'e';
                        break;
                    case 'Ö':
                        string[x + z] = 'O';
                        break;
                    case 'ö':
                        string[x + z] = 'o';
                        break;
                    case 'å':
                        string[x + z] = 'a';
                        break;
                    case '\t':
                        string[x + z] = ' ';
                        string[x + z + 1] = ' ';
                        string[x + z + 2] = ' ';
                        string[x + z + 3] = ' ';
                        z += 3;
                        break;
                    default:
                       string[x + z] = text[current_line + x];
                       break;
                }
            }
            if (x != 0) {
                string[x + z] = 0;
                sdl_ui_print(string, 0, y);
            }
            if (y == 0) {
                next_line = current_line + x + 1;
            }
            current_line += x + 1;
        }
        next_page = current_line;
        active_keys = 1;
        sdl_ui_refresh();

        while (active_keys) {
            switch(sdl_ui_menu_poll_input()) {
                case MENU_ACTION_CANCEL:
                case MENU_ACTION_EXIT:
                case MENU_ACTION_SELECT:
                    active_keys = 0;
                    active = 0;
                    break;
                case MENU_ACTION_RIGHT:
                    active_keys = 0;
                    current_line = next_page;
                    break;
                case MENU_ACTION_DOWN:
                    active_keys = 0;
                    current_line = next_line;
                    break;
                case MENU_ACTION_LEFT:
                    active_keys = 0;
                    current_line = scroll_up(text, first_line, menu_draw->max_text_y);
                    break;
                case MENU_ACTION_UP:
                    active_keys = 0;
                    current_line = scroll_up(text, first_line, 1);
                    break;
                default:
                    SDL_Delay(10);
                    break;
            }
        }
    }
    lib_free(string);
}
Beispiel #8
0
static void show_text(const char *text)
{
    int first_line = 0;
    int last_line = 0;
    int next_line = 0;
    int next_page = 0;
    unsigned int current_line = 0;
    unsigned int this_line = 0;
    unsigned int len;
    int x, y, z;
    int active = 1;
    int active_keys;
    char *string;
    menu_draw_t *menu_draw;

    menu_draw = sdl_ui_get_menu_param();

    string = lib_malloc(0x400);
    len = strlen(text);

    /* find out how many lines */
    for (x = 0, z = 0; text[x] != 0; x++) {
        if (text[x] == '\n') {
            last_line++;
        }
    }

    last_line -= menu_draw->max_text_y;
    for (x = 0, z = 0; text[x] != 0; x++) {
        if (last_line == 0) {
            break;
        }
        if (text[x] == '\n') {
            last_line--;
        }
    }
    last_line = x; /* save the offset */

    while (active) {
        sdl_ui_clear();
        first_line = current_line;
        this_line = current_line;
        for (y = 0; (y < menu_draw->max_text_y) && (this_line < len); y++) {
            z = 0;
            for (x = 0; (text[this_line + x] != '\n') &&
                        (text[this_line + x] != 0); x++) {
                switch (text[this_line + x]) {
                    case '`':
                        string[x + z] = '\'';
                        break;
                    /* FIXME: we should actually be able to handle some of these */
                    case CHARCODE_UMLAUT_A_LOWER:
                    case CHARCODE_KROUZEK_A_LOWER:
                        string[x + z] = 'a';
                        break;
                    case CHARCODE_UMLAUT_A_UPPER:
                        string[x + z] = 'A';
                        break;
                    case '~':
                        string[x + z] = '-';
                        break;
                    case CHARCODE_GRAVE_E_LOWER:
                    case CHARCODE_AIGU_E_LOWER:
                        string[x + z] = 'e';
                        break;
                    case CHARCODE_UMLAUT_O_UPPER:
                        string[x + z] = 'O';
                        break;
                    case CHARCODE_UMLAUT_O_LOWER:
                        string[x + z] = 'o';
                        break;
                    case CHARCODE_UMLAUT_U_UPPER:
                        string[x + z] = 'U';
                        break;
                    case CHARCODE_UMLAUT_U_LOWER:
                        string[x + z] = 'u';
                        break;
                    case '\t':
                        string[x + z] = ' ';
                        string[x + z + 1] = ' ';
                        string[x + z + 2] = ' ';
                        string[x + z + 3] = ' ';
                        z += 3;
                        break;
                    default:
                        string[x + z] = text[this_line + x];
                        break;
                }
            }
            if (x != 0) {
                string[x + z] = 0;
                sdl_ui_print(string, 0, y);
            }
            if (y == 0) {
                next_line = this_line + x + 1;
            }
            this_line += x + 1;
        }
        next_page = this_line;
        active_keys = 1;
        sdl_ui_refresh();

        while (active_keys) {
            switch (sdl_ui_menu_poll_input()) {
                case MENU_ACTION_CANCEL:
                case MENU_ACTION_EXIT:
                case MENU_ACTION_SELECT:
                    active_keys = 0;
                    active = 0;
                    break;
                case MENU_ACTION_RIGHT:
                case MENU_ACTION_PAGEDOWN:
                    active_keys = 0;
                    if (current_line < last_line) {
                        current_line = next_page;
                        if (current_line > last_line) {
                            current_line = last_line;
                        }
                    }
                    break;
                case MENU_ACTION_DOWN:
                    active_keys = 0;
                    if (current_line < last_line) {
                        current_line = next_line;
                        if (current_line > last_line) {
                            current_line = last_line;
                        }
                    }
                    break;
                case MENU_ACTION_LEFT:
                case MENU_ACTION_PAGEUP:
                    active_keys = 0;
                    current_line = scroll_up(text, first_line, menu_draw->max_text_y);
                    break;
                case MENU_ACTION_UP:
                    active_keys = 0;
                    current_line = scroll_up(text, first_line, 1);
                    break;
                case MENU_ACTION_HOME:
                    active_keys = 0;
                    current_line = 0;
                    break;
                case MENU_ACTION_END:
                    active_keys = 0;
                    if (current_line < last_line) {
                        current_line = last_line;
                    }
                    break;
                default:
                    SDL_Delay(10);
                    break;
            }
        }
    }
    lib_free(string);
}
Beispiel #9
0
SDL_Event sdl_ui_poll_event(const char *what, const char *target, int options, int timeout)
{
    SDL_Event e;

    int count = 0;
    int polling = 1;
    int i;

    int allow_keyboard = options & SDL_POLL_KEYBOARD;
    int allow_modifier = options & SDL_POLL_MODIFIER;
#ifdef HAVE_SDL_NUMJOYSTICKS
    int allow_joystick = options & SDL_POLL_JOYSTICK;
#endif

    sdl_ui_clear();
    i = sdl_ui_print("Polling ", 0, 0);
    i = i + sdl_ui_print(what, i, 0);
    sdl_ui_print(" for:", i, 0);
    sdl_ui_print(target, 0, 1);

    if (timeout > 0) {
        sdl_poll_print_timeout(0, 2, timeout);
    }

    /* TODO check if key/event is suitable */
    while (polling) {
        while (polling && SDL_PollEvent(&e)) {
            switch (e.type) {
                case SDL_KEYDOWN:
                    if (allow_keyboard && (allow_modifier || is_not_modifier(e.key.keysym.sym))) {
                        polling = 0;
                    }
                    break;
#ifdef HAVE_SDL_NUMJOYSTICKS
                case SDL_JOYBUTTONDOWN:
                    if (allow_joystick) {
                        polling = 0;
                    }
                    break;
                case SDL_JOYHATMOTION:
                    if (allow_joystick && (sdljoy_check_hat_movement(e) != 0)) {
                        polling = 0;
                    }
                    break;
                case SDL_JOYAXISMOTION:
                    if (allow_joystick && (sdljoy_check_axis_movement(e) != 0)) {
                        polling = 0;
                    }
                    break;
#endif
                default:
                    ui_handle_misc_sdl_event(e);
                    break;
            }
        }
        SDL_Delay(20);

        if ((timeout > 0) && (++count == 1000 / 20)) {
            count = 0;
            if (--timeout == 0) {
                e.type = SDL_USEREVENT;
                polling = 0;
            } else {
                sdl_poll_print_timeout(0, 2, timeout);
            }
        }
    }

    if (polling == 1) {
        e.type = SDL_USEREVENT;
    }

    return e;
}