Beispiel #1
0
static void init_romset_dialog(HWND hwnd)
{
    int res_value, idc_active;
    const char *name;
    TCHAR *st_name;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, romset_dialog_trans);

    /* adjust the size of the elements in the main group */
    uilib_adjust_group_width(hwnd, romset_main_group);

    resources_get_int("RomsetSourceFile", &res_value);
    idc_active = IDC_ROMSET_SELECT_ARCHIVE + res_value;
    update_romset_dialog(hwnd, idc_active);

    resources_get_string("RomsetArchiveName", &name);
    st_name = system_mbstowcs_alloc(name);
    SetDlgItemText(hwnd, IDC_ROMSET_ARCHIVE_NAME, name != NULL ? st_name : TEXT(""));
    system_mbstowcs_free(st_name);

    resources_get_string("RomsetFileName", &name);
    st_name = system_mbstowcs_alloc(name);
    SetDlgItemText(hwnd, IDC_ROMSET_FILE_NAME, name != NULL ? st_name : TEXT(""));
    system_mbstowcs_free(st_name);
}
Beispiel #2
0
static INT_PTR CALLBACK dialog_proc_romset(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
    switch (msg) {
        case WM_INITDIALOG:
            system_init_dialog(hwnd);
            init_romset_dialog(hwnd);
            return TRUE;
        case WM_NOTIFY:
            switch (((NMHDR FAR *)lparam)->code) {
                case PSN_KILLACTIVE:
                    end_romset_dialog(hwnd);
                    return TRUE;
            }
            return FALSE;
        case WM_COMMAND:
            switch (LOWORD(wparam)) {
                case IDC_ROMSET_SELECT_ARCHIVE:
                case IDC_ROMSET_SELECT_FILE:
                    update_romset_dialog(hwnd, LOWORD(wparam));
                    break;
                case IDC_ROMSET_ARCHIVE_BROWSE:
                    uilib_select_browse(hwnd, translate_text(IDS_SELECT_ROMSET_ARCHIVE), UILIB_FILTER_ROMSET_ARCHIVE, UILIB_SELECTOR_TYPE_FILE_SAVE, IDC_ROMSET_ARCHIVE_NAME);
                    break;
                case IDC_ROMSET_ARCHIVE_LOAD:
                    load_archive_romset_dialog(hwnd);
                    break;
                case IDC_ROMSET_ARCHIVE_SAVE:
                    save_archive_romset_dialog(hwnd);
                    break;
                case IDC_ROMSET_ARCHIVE_APPLY:
                    apply_archive_romset_dialog(hwnd);
                    break;
                case IDC_ROMSET_ARCHIVE_NEW:
                    new_archive_romset_dialog(hwnd);
                    break;
                case IDC_ROMSET_ARCHIVE_DELETE:
                    delete_archive_romset_dialog(hwnd);
                    break;
                case IDC_ROMSET_FILE_BROWSE:
                    uilib_select_browse(hwnd, translate_text(IDS_SELECT_ROMSET_FILE), UILIB_FILTER_ROMSET_FILE, UILIB_SELECTOR_TYPE_FILE_SAVE, IDC_ROMSET_FILE_NAME);
                    break;
                case IDC_ROMSET_FILE_LOAD:
                    load_file_romset_dialog(hwnd);
                    break;
                case IDC_ROMSET_FILE_SAVE:
                    save_file_romset_dialog(hwnd);
                    break;
                case IDC_ROMSET_RESOURCE_COMPUTER:
                    uirom_resources_computer(hwnd);
                    break;
                case IDC_ROMSET_RESOURCE_DRIVE:
                    uirom_resources_drive(hwnd);
                    break;
                case IDC_ROMSET_RESOURCE_OTHER:
                    uirom_resources_other(hwnd);
                    break;
            }
            return TRUE;
        case WM_CLOSE:
            EndDialog(hwnd, 0);
            return TRUE;
    }
    return FALSE;
}
Beispiel #3
0
static void init_romset_dialog(HWND hwnd)
{
    int res_value = 0;
    int idc_active;
    int dist, xmax, xmin;
    const char *name = NULL;
    TCHAR *st_name;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, romset_dialog_trans);

    /* adjust the size of the elements in the main group */
    uilib_adjust_group_width(hwnd, romset_main_group);

    /* get the max x of the romset archive load button */
    uilib_get_element_max_x(hwnd, IDC_ROMSET_ARCHIVE_LOAD, &xmax);

    /* get the min x of the romset archive save button */
    uilib_get_element_min_x(hwnd, IDC_ROMSET_ARCHIVE_SAVE, &xmin);

    /* calculate the distance between buttons */
    dist = xmin - xmax;

    /* adjust the size of the load/save buttons group */
    uilib_adjust_group_width(hwnd, romset_archive_loadsave_group);

    /* get the max x of the romset archive load button */
    uilib_get_element_max_x(hwnd, IDC_ROMSET_ARCHIVE_LOAD, &xmax);

    /* move the romset archive save button */
    uilib_move_element(hwnd, IDC_ROMSET_ARCHIVE_SAVE, xmax + dist);

    /* get the max x of the romset load button */
    uilib_get_element_max_x(hwnd, IDC_ROMSET_FILE_LOAD, &xmax);

    /* get the min x of the romset save button */
    uilib_get_element_min_x(hwnd, IDC_ROMSET_FILE_SAVE, &xmin);

    /* calculate the distance between buttons */
    dist = xmin - xmax;

    /* adjust the size of the load/save buttons group */
    uilib_adjust_group_width(hwnd, romset_loadsave_group);

    /* get the max x of the romset load button */
    uilib_get_element_max_x(hwnd, IDC_ROMSET_FILE_LOAD, &xmax);

    /* move the romset save button */
    uilib_move_element(hwnd, IDC_ROMSET_FILE_SAVE, xmax + dist);

    resources_get_int("RomsetSourceFile", &res_value);
    idc_active = IDC_ROMSET_SELECT_ARCHIVE + res_value;
    update_romset_dialog(hwnd, idc_active);

    resources_get_string("RomsetArchiveName", &name);
    st_name = system_mbstowcs_alloc(name);
    SetDlgItemText(hwnd, IDC_ROMSET_ARCHIVE_NAME, name != NULL ? st_name : TEXT(""));
    system_mbstowcs_free(st_name);

    resources_get_string("RomsetFileName", &name);
    st_name = system_mbstowcs_alloc(name);
    SetDlgItemText(hwnd, IDC_ROMSET_FILE_NAME, name != NULL ? st_name : TEXT(""));
    system_mbstowcs_free(st_name);
}