~ubuntu-branches/ubuntu/raring/vice/raring

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-03-31 00:37:15 UTC
  • mfrom: (1.1.7 upstream) (9.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090331003715-i5yisvcfv7mgz3eh
Tags: 2.1.dfsg-1
* New major upstream release (closes: #495937).
* Add desktop files (closes: #501181).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * uimouse.c - Implementation of the mouse settings dialog box.
 
3
 *
 
4
 * Written by
 
5
 *  Marco van den Heuvel <blackystardust68@yahoo.com>
 
6
 *
 
7
 * This file is part of VICE, the Versatile Commodore Emulator.
 
8
 * See README for copyright notice.
 
9
 *
 
10
 *  This program is free software; you can redistribute it and/or modify
 
11
 *  it under the terms of the GNU General Public License as published by
 
12
 *  the Free Software Foundation; either version 2 of the License, or
 
13
 *  (at your option) any later version.
 
14
 *
 
15
 *  This program is distributed in the hope that it will be useful,
 
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 *  GNU General Public License for more details.
 
19
 *
 
20
 *  You should have received a copy of the GNU General Public License
 
21
 *  along with this program; if not, write to the Free Software
 
22
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
23
 *  02111-1307  USA.
 
24
 *
 
25
 */
 
26
 
 
27
#include "vice.h"
 
28
 
 
29
#include <stdio.h>
 
30
#include <string.h>
 
31
#include <windows.h>
 
32
#include <tchar.h>
 
33
 
 
34
#include "res.h"
 
35
#include "resources.h"
 
36
#include "system.h"
 
37
#include "translate.h"
 
38
#include "uilib.h"
 
39
#include "uimouse.h"
 
40
#include "winmain.h"
 
41
 
 
42
static void enable_mouse_controls(HWND hwnd)
 
43
{
 
44
  EnableWindow(GetDlgItem(hwnd, IDC_MOUSE_TYPE), 1);
 
45
  EnableWindow(GetDlgItem(hwnd, IDC_MOUSE_PORT), 1);
 
46
}
 
47
 
 
48
static void init_mouse_dialog(HWND hwnd)
 
49
{
 
50
  HWND temp_hwnd;
 
51
  int res_value;
 
52
 
 
53
  temp_hwnd = GetDlgItem(hwnd, IDC_MOUSE_TYPE);
 
54
  SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"1351");
 
55
  SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"NEOS");
 
56
  SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"AMIGA");
 
57
  resources_get_int("Mousetype", &res_value);
 
58
  SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);
 
59
 
 
60
  temp_hwnd = GetDlgItem(hwnd, IDC_MOUSE_PORT);
 
61
  SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Joy1");
 
62
  SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"Joy2");
 
63
  resources_get_int("Mouseport", &res_value);
 
64
  res_value--;
 
65
  SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);
 
66
 
 
67
  enable_mouse_controls(hwnd);
 
68
}
 
69
 
 
70
static void end_mouse_dialog(HWND hwnd)
 
71
{
 
72
  resources_set_int("Mousetype",SendMessage(GetDlgItem(
 
73
                    hwnd, IDC_MOUSE_TYPE), CB_GETCURSEL, 0, 0));
 
74
 
 
75
  resources_set_int("Mouseport",SendMessage(GetDlgItem(
 
76
                    hwnd, IDC_MOUSE_PORT), CB_GETCURSEL, 0, 0)+1);
 
77
}
 
78
 
 
79
static BOOL CALLBACK dialog_proc(HWND hwnd, UINT msg, WPARAM wparam,
 
80
                                 LPARAM lparam)
 
81
{
 
82
  int command;
 
83
 
 
84
  switch (msg)
 
85
  {
 
86
    case WM_COMMAND:
 
87
      command = LOWORD(wparam);
 
88
      switch (command)
 
89
      {
 
90
        case IDOK:
 
91
          end_mouse_dialog(hwnd);
 
92
        case IDCANCEL:
 
93
          EndDialog(hwnd, 0);
 
94
          return TRUE;
 
95
      }
 
96
      return FALSE;
 
97
    case WM_CLOSE:
 
98
      EndDialog(hwnd, 0);
 
99
      return TRUE;
 
100
    case WM_INITDIALOG:
 
101
      init_mouse_dialog(hwnd);
 
102
      return TRUE;
 
103
  }
 
104
  return FALSE;
 
105
}
 
106
 
 
107
void ui_mouse_settings_dialog(HWND hwnd)
 
108
{
 
109
  DialogBox(winmain_instance, (LPCTSTR)translate_res(IDD_MOUSE_SETTINGS_DIALOG), hwnd,
 
110
            dialog_proc);
 
111
}
 
112