~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/arch/win32/uireu.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include "vice.h"
29
29
 
 
30
#include <stdio.h>
30
31
#include <string.h>
31
32
#include <windows.h>
 
33
#include <tchar.h>
32
34
 
33
35
#include "res.h"
34
36
#include "resources.h"
35
 
#include "ui.h"
 
37
#include "system.h"
 
38
#include "uilib.h"
36
39
#include "uireu.h"
37
40
#include "winmain.h"
38
41
 
39
 
/* Mingw & pre VC 6 headers doesn't have this definition */
40
 
#ifndef OFN_ENABLESIZING
41
 
#define OFN_ENABLESIZING    0x00800000
42
 
#endif
43
42
 
44
43
#define NUM_OF_REU_SIZE 8
45
44
static const int ui_reu_size[NUM_OF_REU_SIZE] = {
64
63
    HWND temp_hwnd;
65
64
    int res_value;
66
65
    const char *reufile;
 
66
    TCHAR *st_reufile;
67
67
    int res_value_loop;
68
68
    int active_value;
69
69
 
71
71
    CheckDlgButton(hwnd, IDC_REU_ENABLE, 
72
72
        res_value ? BST_CHECKED : BST_UNCHECKED);
73
73
    
74
 
    temp_hwnd = GetDlgItem(hwnd,IDC_REU_SIZE);
 
74
    temp_hwnd = GetDlgItem(hwnd, IDC_REU_SIZE);
75
75
    for (res_value_loop = 0; res_value_loop < NUM_OF_REU_SIZE;
76
76
        res_value_loop++) {
77
 
        char st[10];
78
 
        itoa(ui_reu_size[res_value_loop], st, 10);
79
 
        strcat(st, " kB");
 
77
        TCHAR st[10];
 
78
        _itot(ui_reu_size[res_value_loop], st, 10);
 
79
        _tcscat(st, TEXT(" kB"));
80
80
        SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st);
81
81
    }
82
82
    resources_get_value("REUsize", (void *)&res_value);
83
 
    active_value = 0; /* default */
 
83
    active_value = 0;
84
84
    for (res_value_loop = 0; res_value_loop < NUM_OF_REU_SIZE;
85
85
        res_value_loop++) {
86
86
        if (ui_reu_size[res_value_loop] == res_value)
89
89
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0);
90
90
 
91
91
    resources_get_value("REUfilename", (void *)&reufile);
92
 
    SetDlgItemText(hwnd, IDC_REU_FILE, reufile != NULL ? reufile : "");
 
92
    st_reufile = system_mbstowcs_alloc(reufile);
 
93
    SetDlgItemText(hwnd, IDC_REU_FILE,
 
94
                   reufile != NULL ? st_reufile : TEXT(""));
 
95
    system_mbstowcs_free(st_reufile);
93
96
 
94
97
    enable_reu_controls(hwnd);
95
98
}
96
99
 
97
100
static void end_reu_dialog(HWND hwnd)
98
101
{
 
102
    TCHAR st[MAX_PATH];
99
103
    char s[MAX_PATH];
100
104
 
101
105
    resources_set_value("REU", (resource_value_t)
106
110
                        ui_reu_size[SendMessage(GetDlgItem(
107
111
                        hwnd, IDC_REU_SIZE), CB_GETCURSEL, 0, 0)]);
108
112
 
109
 
    GetDlgItemText(hwnd, IDC_REU_FILE, s, MAX_PATH);
 
113
    GetDlgItemText(hwnd, IDC_REU_FILE, st, MAX_PATH);
 
114
    system_wcstombs(s, st, MAX_PATH);
110
115
    resources_set_value("REUfilename", (resource_value_t)s);
111
116
}
112
117
 
 
118
static void browse_reu_file(HWND hwnd)
 
119
{
 
120
    uilib_select_browse(hwnd, TEXT("Select file for REU"),
 
121
                        UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_SAVE,
 
122
                        IDC_REU_FILE);
 
123
}
 
124
 
113
125
static BOOL CALLBACK dialog_proc(HWND hwnd, UINT msg, WPARAM wparam,
114
126
                                 LPARAM lparam)
115
127
{
120
132
        command = LOWORD(wparam);
121
133
        switch (command) {
122
134
          case IDC_REU_BROWSE:
123
 
            {
124
 
                char name[1024] = "";
125
 
                OPENFILENAME ofn;
126
 
 
127
 
                memset(&ofn, 0, sizeof(ofn));
128
 
                ofn.lStructSize = sizeof(ofn);
129
 
                ofn.hwndOwner = hwnd;
130
 
                ofn.hInstance = winmain_instance;
131
 
                ofn.lpstrFilter = "All files (*.*)\0*.*\0";
132
 
                ofn.lpstrCustomFilter = NULL;
133
 
                ofn.nMaxCustFilter = 0;
134
 
                ofn.nFilterIndex = 1;
135
 
                ofn.lpstrFile = name;
136
 
                ofn.nMaxFile = sizeof(name);
137
 
                ofn.lpstrFileTitle = NULL;
138
 
                ofn.nMaxFileTitle = 0;
139
 
                ofn.lpstrInitialDir = NULL;
140
 
                ofn.lpstrTitle = "Select File for REU";
141
 
                ofn.Flags = (OFN_EXPLORER
142
 
                    | OFN_HIDEREADONLY
143
 
                    | OFN_NOTESTFILECREATE
144
 
                    | OFN_FILEMUSTEXIST
145
 
                    | OFN_SHAREAWARE
146
 
                    | OFN_ENABLESIZING);
147
 
                ofn.nFileOffset = 0;
148
 
                ofn.nFileExtension = 0;
149
 
                ofn.lpstrDefExt = NULL;
150
 
 
151
 
                if (GetSaveFileName(&ofn))
152
 
                    SetDlgItemText(hwnd, IDC_REU_FILE, name);
153
 
            }
 
135
            browse_reu_file(hwnd);
154
136
            break;
155
137
          case IDC_REU_ENABLE:
156
138
            enable_reu_controls(hwnd);