~ubuntu-branches/ubuntu/natty/vice/natty

« back to all changes in this revision

Viewing changes to src/arch/amigaos/mui/uiautostart.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2010-02-11 18:30:16 UTC
  • mfrom: (1.1.8 upstream) (9.2.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100211183016-f6n8usn3tzp0u6dp
Tags: 2.2.dfsg-1
* New upstream release, C64 DTV is included so update package description
  and add it to the menu.
* Drop patch fixing build failure with gcc-4.4 , applied upstream.
* Fix some lintian problems and clean up debian/rules .

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * uiplus256k.c
 
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
#ifdef AMIGA_M68K
 
29
#define _INLINE_MUIMASTER_H
 
30
#endif
 
31
#include "mui.h"
 
32
 
 
33
#include "uiautostart.h"
 
34
#include "intl.h"
 
35
#include "translate.h"
 
36
 
 
37
static video_canvas_t *autostart_canvas;
 
38
 
 
39
static int ui_autostart_enable_translate[] = {
 
40
    IDMS_DISABLED,
 
41
    IDS_ENABLED,
 
42
    0
 
43
};
 
44
 
 
45
static char *ui_autostart_enable[countof(ui_autostart_enable_translate)];
 
46
 
 
47
static const int ui_autostart_enable_values[] = {
 
48
    0,
 
49
    1,
 
50
    -1
 
51
};
 
52
 
 
53
static int ui_autostart_mode_translate[] = {
 
54
    IDS_AUTOSTART_VIRTUAL_FS,
 
55
    IDS_AUTOSTART_INJECT,
 
56
    IDS_AUTOSTART_DISK,
 
57
    0
 
58
};
 
59
 
 
60
static char *ui_autostart_mode[countof(ui_autostart_mode_translate)];
 
61
 
 
62
static const int ui_autostart_mode_values[] = {
 
63
    0,
 
64
    1,
 
65
    2,
 
66
    -1
 
67
};
 
68
 
 
69
static ui_to_from_t ui_to_from[] = {
 
70
    { NULL, MUI_TYPE_CYCLE, "AutostartWarp", ui_autostart_enable, ui_autostart_enable_values },
 
71
    { NULL, MUI_TYPE_CYCLE, "AutostartRunWithColon", ui_autostart_enable, ui_autostart_enable_values },
 
72
    { NULL, MUI_TYPE_CYCLE, "AutostartPrgMode", ui_autostart_mode, ui_autostart_mode_values },
 
73
    { NULL, MUI_TYPE_FILENAME, "AutostartPrgDiskImage", NULL, NULL },
 
74
    UI_END /* mandatory */
 
75
};
 
76
 
 
77
static ULONG Browse(struct Hook *hook, Object *obj, APTR arg)
 
78
{
 
79
    char *fname = NULL;
 
80
 
 
81
    fname = BrowseFile(translate_text(IDS_AUTOSTART_DISK_IMAGE_SELECT), "#?", autostart_canvas);
 
82
 
 
83
    if (fname != NULL) {
 
84
        set(ui_to_from[3].object, MUIA_String_Contents, fname);
 
85
    }
 
86
 
 
87
    return 0;
 
88
}
 
89
 
 
90
static APTR build_gui(void)
 
91
{
 
92
    APTR app, ui, ok, browse_button, cancel;
 
93
 
 
94
#ifdef AMIGA_MORPHOS
 
95
    static const struct Hook BrowseFileHook = { { NULL, NULL }, (VOID *)HookEntry, (VOID *)Browse, NULL };
 
96
#else
 
97
    static const struct Hook BrowseFileHook = { { NULL, NULL }, (VOID *)Browse, NULL, NULL };
 
98
#endif
 
99
 
 
100
    app = mui_get_app();
 
101
 
 
102
    ui = GroupObject,
 
103
           CYCLE(ui_to_from[0].object, translate_text(IDS_WARP_ON_AUTOSTART), ui_autostart_enable)
 
104
           CYCLE(ui_to_from[1].object, translate_text(IDS_RUN_WITH_COLON), ui_autostart_enable)
 
105
           CYCLE(ui_to_from[2].object, translate_text(IDS_AUTOSTART_PRG_MODE), ui_autostart_mode)
 
106
           FILENAME(ui_to_from[3].object, translate_text(IDS_AUTOSTART_DISK_IMAGE_FILENAME), browse_button)
 
107
           OK_CANCEL_BUTTON
 
108
         End;
 
109
 
 
110
    if (ui != NULL) {
 
111
        DoMethod(cancel, MUIM_Notify, MUIA_Pressed, FALSE,
 
112
                 app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
 
113
 
 
114
        DoMethod(ok, MUIM_Notify, MUIA_Pressed, FALSE,
 
115
                 app, 2, MUIM_Application_ReturnID, BTN_OK);
 
116
 
 
117
        DoMethod(browse_button, MUIM_Notify, MUIA_Pressed, FALSE,
 
118
                 app, 2, MUIM_CallHook, &BrowseFileHook);
 
119
    }
 
120
 
 
121
    return ui;
 
122
}
 
123
 
 
124
void ui_autostart_settings_dialog(video_canvas_t *canvas)
 
125
{
 
126
    APTR window;
 
127
 
 
128
    autostart_canvas = canvas;
 
129
    intl_convert_mui_table(ui_autostart_enable_translate, ui_autostart_enable);
 
130
    intl_convert_mui_table(ui_autostart_mode_translate, ui_autostart_mode);
 
131
 
 
132
    window = mui_make_simple_window(build_gui(), translate_text(IDS_AUTOSTART_SETTINGS));
 
133
 
 
134
    if (window != NULL) {
 
135
        mui_add_window(window);
 
136
        ui_get_to(ui_to_from);
 
137
        set(window, MUIA_Window_Open, TRUE);
 
138
        if (mui_run() == BTN_OK) {
 
139
            ui_get_from(ui_to_from);
 
140
        }
 
141
        set(window, MUIA_Window_Open, FALSE);
 
142
        mui_rem_window(window);
 
143
        MUI_DisposeObject(window);
 
144
    }
 
145
}