~ubuntu-branches/ubuntu/quantal/vice/quantal

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2006-07-30 19:15:59 UTC
  • mto: (9.1.1 lenny) (1.1.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20060730191559-g31ymd2mk102kzff
Tags: upstream-1.19
ImportĀ upstreamĀ versionĀ 1.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
#include "res.h"
34
34
#include "resources.h"
 
35
#include "translate.h"
35
36
#include "uiacia.h"
36
37
#include "winmain.h"
 
38
#include "intl.h"
 
39
#include "uilib.h"
37
40
 
38
41
 
39
42
#define MAXRS232 4
40
43
 
41
44
 
42
 
static const TCHAR *interrupt_names[] = {
43
 
    TEXT("None"), TEXT("IRQ"), TEXT("NMI"), NULL
 
45
static const int interrupt_names[] = {
 
46
    IDS_NONE, IDS_IRQ, IDS_NMI, 0
44
47
};
45
48
 
46
49
static unsigned int support_enable;
82
85
 
83
86
static void init_acia_dialog(HWND hwnd)
84
87
{
85
 
    HWND temp_hwnd;
86
 
    int res_value;
87
 
    unsigned int i;
 
88
HWND temp_hwnd;
 
89
int res_value;
 
90
unsigned int i;
 
91
RECT rect;
 
92
RECT child_rect;
 
93
int min_width;
 
94
int xpos;
 
95
int xsize, ysize;
 
96
 
 
97
    SetWindowText(hwnd, intl_translate_text_new(IDS_ACIA_CAPTION));
 
98
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_ENABLE);
 
99
    SetWindowText(temp_hwnd, intl_translate_text_new(IDS_ACIA_ENABLE));
 
100
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_DEVICE_LABEL);
 
101
    SetWindowText(temp_hwnd, intl_translate_text_new(IDS_ACIA_DEVICE));
 
102
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_LOCATION_LABEL);
 
103
    SetWindowText(temp_hwnd, intl_translate_text_new(IDS_ACIA_LOCATION));
 
104
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_INTERRUPT_LABEL);
 
105
    SetWindowText(temp_hwnd, intl_translate_text_new(IDS_ACIA_INTERRUPT));
 
106
    temp_hwnd = GetDlgItem(hwnd, IDOK);
 
107
    SetWindowText(temp_hwnd, intl_translate_text_new(IDS_OK));
 
108
    temp_hwnd = GetDlgItem(hwnd, IDCANCEL);
 
109
    SetWindowText(temp_hwnd, intl_translate_text_new(IDS_CANCEL));
 
110
 
 
111
    GetClientRect(hwnd, &rect);
 
112
 
 
113
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_ENABLE);
 
114
    GetClientRect(temp_hwnd, &child_rect);
 
115
    MapWindowPoints(temp_hwnd, hwnd, (POINT*)&child_rect, 2);
 
116
    uilib_get_general_window_extents(temp_hwnd, &xsize, &ysize);
 
117
    xsize += 20;
 
118
    MoveWindow(temp_hwnd, child_rect.left, child_rect.top, xsize, child_rect.bottom - child_rect.top, TRUE);
 
119
    min_width = child_rect.left + xsize + 10;
 
120
 
 
121
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_DEVICE_LABEL);
 
122
    GetClientRect(temp_hwnd, &child_rect);
 
123
    MapWindowPoints(temp_hwnd, hwnd, (POINT*)&child_rect, 2);
 
124
    uilib_get_general_window_extents(temp_hwnd, &xsize, &ysize);
 
125
    MoveWindow(temp_hwnd, child_rect.left, child_rect.top, xsize, child_rect.bottom - child_rect.top, TRUE);
 
126
    xpos = child_rect.left + xsize + 10;
 
127
 
 
128
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_LOCATION_LABEL);
 
129
    GetClientRect(temp_hwnd, &child_rect);
 
130
    MapWindowPoints(temp_hwnd, hwnd, (POINT*)&child_rect, 2);
 
131
    uilib_get_general_window_extents(temp_hwnd, &xsize, &ysize);
 
132
    MoveWindow(temp_hwnd, child_rect.left, child_rect.top, xsize, child_rect.bottom - child_rect.top, TRUE);
 
133
    if (xpos < child_rect.left + xsize + 10) {
 
134
        xpos = child_rect.left + xsize + 10;
 
135
    }
 
136
 
 
137
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_INTERRUPT_LABEL);
 
138
    GetClientRect(temp_hwnd, &child_rect);
 
139
    MapWindowPoints(temp_hwnd, hwnd, (POINT*)&child_rect, 2);
 
140
    uilib_get_general_window_extents(temp_hwnd, &xsize, &ysize);
 
141
    MoveWindow(temp_hwnd, child_rect.left, child_rect.top, xsize, child_rect.bottom - child_rect.top, TRUE);
 
142
    if (xpos < child_rect.left + xsize + 10) {
 
143
        xpos = child_rect.left + xsize + 10;
 
144
    }
 
145
 
 
146
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_DEVICE);
 
147
    GetClientRect(temp_hwnd, &child_rect);
 
148
    MapWindowPoints(temp_hwnd, hwnd, (POINT*)&child_rect, 2);
 
149
    MoveWindow(temp_hwnd, xpos, child_rect.top, child_rect.right - child_rect.left, child_rect.bottom - child_rect.top, TRUE);
 
150
    if (min_width < xpos + child_rect.right - child_rect.left) {
 
151
        min_width = xpos + child_rect.right - child_rect.left;
 
152
    }
 
153
 
 
154
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_LOCATION);
 
155
    GetClientRect(temp_hwnd, &child_rect);
 
156
    MapWindowPoints(temp_hwnd, hwnd, (POINT*)&child_rect, 2);
 
157
    MoveWindow(temp_hwnd, xpos, child_rect.top, child_rect.right - child_rect.left, child_rect.bottom - child_rect.top, TRUE);
 
158
    if (min_width < xpos + child_rect.right - child_rect.left) {
 
159
        min_width = xpos + child_rect.right - child_rect.left;
 
160
    }
 
161
 
 
162
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_INTERRUPT);
 
163
    GetClientRect(temp_hwnd, &child_rect);
 
164
    MapWindowPoints(temp_hwnd, hwnd, (POINT*)&child_rect, 2);
 
165
    MoveWindow(temp_hwnd, xpos, child_rect.top, child_rect.right - child_rect.left, child_rect.bottom - child_rect.top, TRUE);
 
166
    if (min_width < xpos + child_rect.right - child_rect.left) {
 
167
        min_width = xpos + child_rect.right - child_rect.left;
 
168
    }
 
169
 
 
170
    GetWindowRect(hwnd, &rect);
 
171
    MoveWindow(hwnd, rect.left, rect.top, min_width + 20, rect.bottom - rect.top, TRUE);
88
172
 
89
173
    if (support_enable != 0) {
90
174
        resources_get_value("Acia1Enable", (void *)&res_value);
98
182
    temp_hwnd = GetDlgItem(hwnd, IDC_ACIA_DEVICE);
99
183
    for (i = 0; i < MAXRS232; i++) {
100
184
        TCHAR st[20];
101
 
        _stprintf(st, TEXT("RS232 device %i"), i + 1);
 
185
        _stprintf(st, translate_text(IDS_RS232_DEVICE_I), i + 1);
102
186
        SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st);
103
187
    }
104
188
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);
111
195
        for (res_value_loop = 0; interrupt_names[res_value_loop];
112
196
            res_value_loop++) {
113
197
            SendMessage(temp_hwnd, CB_ADDSTRING, 0,
114
 
                        (LPARAM)interrupt_names[res_value_loop]);
 
198
                        (LPARAM)(TCHAR *)intl_translate_text_new(interrupt_names[res_value_loop]));
115
199
        }
116
200
        SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);
117
201
    }
144
228
    int command;
145
229
 
146
230
    switch (msg) {
147
 
      case WM_COMMAND:
148
 
        command = LOWORD(wparam);
149
 
        switch (command) {
150
 
          case IDC_ACIA_ENABLE:
151
 
            enable_acia_controls(hwnd);
152
 
            break;
153
 
          case IDOK:
154
 
            end_acia_dialog(hwnd);
155
 
          case IDCANCEL:
 
231
        case WM_COMMAND:
 
232
            command = LOWORD(wparam);
 
233
            switch (command) {
 
234
                case IDC_ACIA_ENABLE:
 
235
                    enable_acia_controls(hwnd);
 
236
                    break;
 
237
                case IDOK:
 
238
                    end_acia_dialog(hwnd);
 
239
                case IDCANCEL:
 
240
                    EndDialog(hwnd, 0);
 
241
                    return TRUE;
 
242
            }
 
243
            return FALSE;
 
244
        case WM_CLOSE:
156
245
            EndDialog(hwnd, 0);
157
246
            return TRUE;
158
 
        }
159
 
        return FALSE;
160
 
      case WM_CLOSE:
161
 
        EndDialog(hwnd, 0);
162
 
        return TRUE;
163
 
      case WM_INITDIALOG:
164
 
        init_acia_dialog(hwnd);
165
 
        return TRUE;
 
247
        case WM_INITDIALOG:
 
248
            init_acia_dialog(hwnd);
 
249
            return TRUE;
166
250
    }
167
251
    return FALSE;
168
252
}