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

« back to all changes in this revision

Viewing changes to src/arch/win32/uiram.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:
34
34
#include "res.h"
35
35
#include "resources.h"
36
36
#include "system.h"
37
 
#include "ui.h"
38
37
#include "uiram.h"
39
38
#include "winmain.h"
40
39
 
41
40
 
42
 
static int ui_ram_startvalue[]={
 
41
static int ui_ram_startvalue[] = {
43
42
    0, 255, -1
44
43
};
45
44
 
46
 
static int ui_ram_invertvalue[]={
 
45
static int ui_ram_invertvalue[] = {
47
46
    0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, -1
48
47
};
49
48
 
62
61
 
63
62
    s_win = lib_malloc((2 * strlen(s) + 1) * sizeof(TCHAR));
64
63
    i = j =0;
65
 
    while(s[i] != '\0') {
 
64
    while (s[i] != '\0') {
66
65
        if(s[i] == '\n')
67
66
            s_win[j++] = TEXT('\r');
68
67
        s_win[j++] = (TCHAR)s[i++];
78
77
{
79
78
    HWND    temp_hwnd, temp_hwnd2;
80
79
    int     i;
81
 
    LOGFONT logfont = {-12,-7,0,0,400,0,0,0,0,0,0,
82
 
        DRAFT_QUALITY,FIXED_PITCH|FF_MODERN,TEXT("")};
 
80
    LOGFONT logfont = { -12, -7, 0, 0, 400, 0, 0, 0, 0, 0, 0,
 
81
                      DRAFT_QUALITY, FIXED_PITCH|FF_MODERN, TEXT("") };
83
82
    HFONT   hfont = CreateFontIndirect(&logfont);
84
83
 
85
84
    if (hfont)
86
 
        SendDlgItemMessage(hwnd,IDC_RAMINIT_PREVIEW,WM_SETFONT,
87
 
            (WPARAM)hfont,MAKELPARAM(TRUE,0));
 
85
        SendDlgItemMessage(hwnd, IDC_RAMINIT_PREVIEW, WM_SETFONT,
 
86
            (WPARAM)hfont, MAKELPARAM(TRUE, 0));
88
87
 
89
88
    resources_get_value("RAMInitStartValue", (void *)&orig_startvalue);
90
 
    temp_hwnd=GetDlgItem(hwnd,IDC_RAMINIT_STARTVALUE);
 
89
    temp_hwnd = GetDlgItem(hwnd,IDC_RAMINIT_STARTVALUE);
91
90
 
92
 
    for (i = 0; ui_ram_startvalue[i] >= 0; i++)
93
 
    {
 
91
    for (i = 0; ui_ram_startvalue[i] >= 0; i++) {
94
92
        TCHAR s[16];
95
93
 
96
94
        _stprintf(s, TEXT("%d"), ui_ram_startvalue[i]);
97
 
        SendMessage(temp_hwnd,CB_ADDSTRING,0,(LPARAM)s);
 
95
        SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)s);
98
96
        if (orig_startvalue == ui_ram_startvalue[i])
99
 
            SendMessage(temp_hwnd,CB_SETCURSEL,(WPARAM)i,0);
 
97
            SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)i, 0);
100
98
    }
101
99
 
102
100
    resources_get_value("RAMInitValueInvert", (void *)&orig_valueinvert);
103
101
    resources_get_value("RAMInitPatternInvert", (void *)&orig_patterninvert);
104
 
    temp_hwnd=GetDlgItem(hwnd,IDC_RAMINIT_VALUEINVERT);
105
 
    temp_hwnd2=GetDlgItem(hwnd,IDC_RAMINIT_PATTERNINVERT);
 
102
    temp_hwnd = GetDlgItem(hwnd, IDC_RAMINIT_VALUEINVERT);
 
103
    temp_hwnd2 = GetDlgItem(hwnd, IDC_RAMINIT_PATTERNINVERT);
106
104
    
107
 
    for (i = 0; ui_ram_invertvalue[i] >= 0; i++)
108
 
    {
 
105
    for (i = 0; ui_ram_invertvalue[i] >= 0; i++) {
109
106
        TCHAR s[16];
110
107
 
111
108
        _stprintf(s, TEXT("%d"), ui_ram_invertvalue[i]);
112
 
        SendMessage(temp_hwnd,CB_ADDSTRING,0,(LPARAM)s);
113
 
        SendMessage(temp_hwnd2,CB_ADDSTRING,0,(LPARAM)s);
 
109
        SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)s);
 
110
        SendMessage(temp_hwnd2, CB_ADDSTRING, 0, (LPARAM)s);
114
111
        if (ui_ram_invertvalue[i] == orig_valueinvert)
115
 
            SendMessage(temp_hwnd,CB_SETCURSEL,(WPARAM)i,0);
 
112
            SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)i, 0);
116
113
        if (ui_ram_invertvalue[i] == orig_patterninvert)
117
 
            SendMessage(temp_hwnd2,CB_SETCURSEL,(WPARAM)i,0);
 
114
            SendMessage(temp_hwnd2, CB_SETCURSEL, (WPARAM)i, 0);
118
115
    }
119
116
 
120
117
    update_preview(hwnd);
121
118
}
122
119
 
123
120
 
124
 
static BOOL CALLBACK dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
121
static BOOL CALLBACK dialog_proc(HWND hwnd, UINT msg, WPARAM wparam,
 
122
                                 LPARAM lparam)
125
123
{
126
124
    int command;
127
125
    int rv;
128
126
 
129
127
    switch (msg) {
130
 
        case WM_COMMAND:
131
 
            command=LOWORD(wparam);
132
 
            switch (command) {
133
 
                case IDC_RAMINIT_STARTVALUE:
134
 
                    rv = SendMessage(GetDlgItem(
135
 
                            hwnd,IDC_RAMINIT_STARTVALUE),CB_GETCURSEL,0,0);
136
 
                    resources_set_value("RAMInitStartValue", 
137
 
                        (resource_value_t) ui_ram_startvalue[rv]);
138
 
                    update_preview(hwnd);
139
 
                    break;
140
 
                case IDC_RAMINIT_VALUEINVERT:
141
 
                    rv = SendMessage(GetDlgItem(
142
 
                            hwnd,IDC_RAMINIT_VALUEINVERT),CB_GETCURSEL,0,0);
143
 
                    resources_set_value("RAMInitValueInvert", 
144
 
                        (resource_value_t) ui_ram_invertvalue[rv]);
145
 
                    update_preview(hwnd);
146
 
                    break;
147
 
                case IDC_RAMINIT_PATTERNINVERT:
148
 
                    rv = SendMessage(GetDlgItem(
149
 
                            hwnd,IDC_RAMINIT_PATTERNINVERT),CB_GETCURSEL,0,0);
150
 
                    resources_set_value("RAMInitPatternInvert", 
151
 
                        (resource_value_t) ui_ram_invertvalue[rv]);
152
 
                    update_preview(hwnd);
153
 
                    break;
 
128
      case WM_COMMAND:
 
129
        command = LOWORD(wparam);
 
130
        switch (command) {
 
131
          case IDC_RAMINIT_STARTVALUE:
 
132
           rv = SendMessage(GetDlgItem(hwnd,
 
133
                            IDC_RAMINIT_STARTVALUE), CB_GETCURSEL, 0, 0);
 
134
           resources_set_value("RAMInitStartValue", 
 
135
                               (resource_value_t)ui_ram_startvalue[rv]);
 
136
           update_preview(hwnd);
 
137
           break;
 
138
         case IDC_RAMINIT_VALUEINVERT:
 
139
           rv = SendMessage(GetDlgItem(
 
140
                            hwnd, IDC_RAMINIT_VALUEINVERT), CB_GETCURSEL, 0, 0);
 
141
           resources_set_value("RAMInitValueInvert", 
 
142
                               (resource_value_t)ui_ram_invertvalue[rv]);
 
143
           update_preview(hwnd);
 
144
           break;
 
145
         case IDC_RAMINIT_PATTERNINVERT:
 
146
           rv = SendMessage(GetDlgItem(hwnd,
 
147
                            IDC_RAMINIT_PATTERNINVERT), CB_GETCURSEL, 0, 0);
 
148
           resources_set_value("RAMInitPatternInvert", 
 
149
                               (resource_value_t) ui_ram_invertvalue[rv]);
 
150
           update_preview(hwnd);
 
151
           break;
154
152
 
155
 
                case IDOK:
156
 
                    EndDialog(hwnd,0);
157
 
                    return TRUE;
158
 
                case IDCANCEL:
159
 
                    resources_set_value("RAMInitStartValue", 
160
 
                        (resource_value_t) orig_startvalue);
161
 
                    resources_set_value("RAMInitValueInvert", 
162
 
                        (resource_value_t) orig_valueinvert);
163
 
                    resources_set_value("RAMInitPatternInvert", 
164
 
                        (resource_value_t) orig_patterninvert);
165
 
                    EndDialog(hwnd,0);
166
 
                    return TRUE;
167
 
            }
 
153
         case IDOK:
 
154
           EndDialog(hwnd,0);
 
155
           return TRUE;
 
156
         case IDCANCEL:
 
157
           resources_set_value("RAMInitStartValue", 
 
158
                               (resource_value_t) orig_startvalue);
 
159
           resources_set_value("RAMInitValueInvert", 
 
160
                               (resource_value_t) orig_valueinvert);
 
161
           resources_set_value("RAMInitPatternInvert", 
 
162
                               (resource_value_t) orig_patterninvert);
 
163
           EndDialog(hwnd,0);
 
164
           return TRUE;
 
165
       }
168
166
            return FALSE;
169
167
        case WM_CLOSE:
170
168
            EndDialog(hwnd,0);
180
178
 
181
179
void ui_ram_settings_dialog(HWND hwnd)
182
180
{
183
 
    DialogBox(winmain_instance,MAKEINTRESOURCE(IDD_RAM_SETTINGS_DIALOG),hwnd,dialog_proc);
 
181
    DialogBox(winmain_instance, MAKEINTRESOURCE(IDD_RAM_SETTINGS_DIALOG), hwnd,
 
182
              dialog_proc);
184
183
}
185
184