~ubuntu-branches/ubuntu/hardy/vice/hardy

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2007-10-07 07:05:46 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071007070546-81yy0twlka7p2t0e
Tags: 1.22-1
* New upstream version (closes: #428280).
* Correct link to HTML documentation in manpage (closes: #409567).
* Fix most packaging mistakes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * uivideoc64plus4vic20.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 "uivideoc64plus4vic20.h"
 
34
#include "intl.h"
 
35
#include "translate.h"
 
36
 
 
37
static video_canvas_t *video_canvas;
 
38
 
 
39
static int ui_external_palette_enable_translate[] = {
 
40
  IDMS_DISABLED,
 
41
  IDS_ENABLED,
 
42
  0
 
43
};
 
44
 
 
45
static char *ui_external_palette_enable[countof(ui_external_palette_enable_translate)];
 
46
 
 
47
static const int ui_external_palette_enable_values[] = {
 
48
  0,
 
49
  1,
 
50
  -1
 
51
};
 
52
 
 
53
static int ui_PAL_mode_translate[] = {
 
54
  IDS_FAST_PAL,
 
55
  IDS_PAL_EMULATION,
 
56
  0
 
57
};
 
58
 
 
59
static char *ui_PAL_mode[countof(ui_PAL_mode_translate)];
 
60
 
 
61
static const int ui_PAL_mode_values[] = {
 
62
  0,
 
63
  1,
 
64
  -1
 
65
};
 
66
 
 
67
static ui_to_from_t ui_to_from[] = {
 
68
  { NULL, MUI_TYPE_FLOAT, "ColorGamma", NULL, NULL },
 
69
  { NULL, MUI_TYPE_FLOAT, "PALScanLineShade", NULL, NULL },
 
70
  { NULL, MUI_TYPE_FLOAT, "PALBlur", NULL, NULL },
 
71
  { NULL, MUI_TYPE_CYCLE, "PALMode", ui_PAL_mode, ui_PAL_mode_values },
 
72
  { NULL, MUI_TYPE_CYCLE, NULL, ui_external_palette_enable, ui_external_palette_enable_values },
 
73
  { NULL, MUI_TYPE_FILENAME, NULL, NULL, NULL },
 
74
  { NULL, MUI_TYPE_FLOAT, "ColorSaturation", NULL, NULL },
 
75
  { NULL, MUI_TYPE_FLOAT, "ColorContrast", NULL, NULL },
 
76
  { NULL, MUI_TYPE_FLOAT, "ColorBrightness", NULL, NULL },
 
77
  UI_END /* mandatory */
 
78
};
 
79
 
 
80
static ULONG Browse( struct Hook *hook, Object *obj, APTR arg )
 
81
{
 
82
  char *fname=NULL;
 
83
 
 
84
  fname=BrowseFile(translate_text(IDS_EXTERNAL_PALETTE_SELECT), "#?.vpl", video_canvas);
 
85
 
 
86
  if (fname!=NULL)
 
87
    set(ui_to_from[5].object, MUIA_String_Contents, fname);
 
88
 
 
89
  return 0;
 
90
}
 
91
 
 
92
static APTR build_gui(void)
 
93
{
 
94
  APTR app, ui, ok, browse_button, cancel;
 
95
 
 
96
#ifdef AMIGA_MORPHOS
 
97
  static const struct Hook BrowseFileHook = { { NULL,NULL },(VOID *)HookEntry,(VOID *)Browse, NULL};
 
98
#else
 
99
  static const struct Hook BrowseFileHook = { { NULL,NULL },(VOID *)Browse,NULL,NULL };
 
100
#endif
 
101
 
 
102
  app = mui_get_app();
 
103
 
 
104
  ui = GroupObject,
 
105
    STRING(ui_to_from[0].object, translate_text(IDS_GAMMA_0_2), ".0123456789", 5+1)
 
106
    STRING(ui_to_from[1].object, translate_text(IDS_PAL_SHADE_0_1), ".0123456789", 5+1)
 
107
    STRING(ui_to_from[2].object, translate_text(IDS_PAL_BLUR_0_1), ".0123456789", 5+1)
 
108
    CYCLE(ui_to_from[3].object, translate_text(IDS_PAL_MODE), ui_PAL_mode)
 
109
    CYCLE(ui_to_from[4].object, translate_text(IDS_EXTERNAL_PALETTE), ui_external_palette_enable)
 
110
    FILENAME(ui_to_from[5].object, translate_text(IDS_PALETTE_FILENAME), browse_button)
 
111
    STRING(ui_to_from[6].object, translate_text(IDS_SATURATION_0_2), ".0123456789", 5+1)
 
112
    STRING(ui_to_from[7].object, translate_text(IDS_CONTRAST_0_2), ".0123456789", 5+1)
 
113
    STRING(ui_to_from[8].object, translate_text(IDS_BRIGHTNESS_0_2), ".0123456789", 5+1)
 
114
    OK_CANCEL_BUTTON
 
115
  End;
 
116
 
 
117
  if (ui != NULL) {
 
118
    DoMethod(cancel,
 
119
      MUIM_Notify, MUIA_Pressed, FALSE,
 
120
      app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
 
121
 
 
122
    DoMethod(ok, MUIM_Notify, MUIA_Pressed, FALSE,
 
123
      app, 2, MUIM_Application_ReturnID, BTN_OK);
 
124
 
 
125
    DoMethod(browse_button, MUIM_Notify, MUIA_Pressed, FALSE,
 
126
      app, 2, MUIM_CallHook, &BrowseFileHook);
 
127
  }
 
128
 
 
129
  return ui;
 
130
}
 
131
 
 
132
void ui_video_c64plus4vic20_settings_dialog(video_canvas_t *canvas, char *external_palette, char *palette_file)
 
133
{
 
134
  APTR window;
 
135
 
 
136
  video_canvas=canvas;
 
137
  intl_convert_mui_table(ui_external_palette_enable_translate, ui_external_palette_enable);
 
138
  intl_convert_mui_table(ui_PAL_mode_translate, ui_PAL_mode);
 
139
  ui_to_from[4].resource=external_palette;
 
140
  ui_to_from[5].resource=palette_file;
 
141
 
 
142
  window = mui_make_simple_window(build_gui(), translate_text(IDS_VIDEO_SETTINGS));
 
143
 
 
144
  if (window != NULL) {
 
145
    mui_add_window(window);
 
146
    ui_get_to(ui_to_from);
 
147
    set(window, MUIA_Window_Open, TRUE);
 
148
    if (mui_run() == BTN_OK) {
 
149
      ui_get_from(ui_to_from);
 
150
    }
 
151
    set(window, MUIA_Window_Open, FALSE);
 
152
    mui_rem_window(window);
 
153
    MUI_DisposeObject(window);
 
154
  }
 
155
}