1 /** \file plus4ui.c
2 * \brief Native GTK3 PLUS4 UI
3 *
4 * \author Marco van den Heuvel <blackystardust68@yahoo.com>
5 * \author Bas Wassink <b.wassink@ziggo.nl>
6 */
7
8 /*
9 * This file is part of VICE, the Versatile Commodore Emulator.
10 * See README for copyright notice.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 * 02111-1307 USA.
26 *
27 */
28
29 #include "vice.h"
30
31 #include <stdio.h>
32
33 #include "debug_gtk3.h"
34 #include "cartridge.h"
35 #include "carthelpers.h"
36 #include "crtcontrolwidget.h"
37 #include "machine.h"
38 #include "machinemodelwidget.h"
39 #include "plus4model.h"
40 #include "sampler.h"
41 #include "ted.h"
42 #include "ui.h"
43 #include "uicart.h"
44 #include "uimachinewindow.h"
45 #include "settings_sampler.h"
46 #include "videomodelwidget.h"
47 #include "widgethelpers.h"
48
49 #include "plus4ui.h"
50
51
52 /** \brief List of Plus/4 models
53 *
54 * Used in the machine-model widget
55 */
56 static const char *plus4_model_list[] = {
57 "C16 PAL",
58 "C16 NTSC",
59 "Plus4 PAL",
60 "Plus4 NTSC",
61 "V364 NTSC",
62 "232 NTSC",
63 NULL
64 };
65
66
67 /** \brief List of TED models
68 *
69 * Used in the TED model widget
70 */
71 static const vice_gtk3_radiogroup_entry_t plus4_ted_models[] = {
72 { "PAL", MACHINE_SYNC_PAL },
73 { "NTSC", MACHINE_SYNC_NTSC },
74 { NULL, -1 }
75 };
76
77
78 /** \brief Identify the canvas used to create a window
79 *
80 * \param[in] canvas video canvas
81 *
82 * \return window index on success, -1 on failure
83 */
identify_canvas(video_canvas_t * canvas)84 static int identify_canvas(video_canvas_t *canvas)
85 {
86 if (canvas != ted_get_canvas()) {
87 return -1;
88 }
89
90 return PRIMARY_WINDOW;
91 }
92
93 /** \brief Create CRT controls widget for \a target window
94 *
95 * \param[in] target_window target window index
96 *
97 * \return GtkGrid
98 */
create_crt_widget(int target_window)99 static GtkWidget *create_crt_widget(int target_window)
100 {
101 return crt_control_widget_create(NULL, "TED", TRUE);
102 }
103
104 /** \brief Pre-initialize the UI before the canvas window gets created
105 *
106 * \return 0 on success, -1 on failure
107 */
plus4ui_init_early(void)108 int plus4ui_init_early(void)
109 {
110 ui_machine_window_init();
111 ui_set_identify_canvas_func(identify_canvas);
112 ui_set_create_controls_widget_func(create_crt_widget);
113 return 0;
114 }
115
116
117 /** \brief Initialize the UI
118 *
119 * \return 0 on success, -1 on failure
120 */
plus4ui_init(void)121 int plus4ui_init(void)
122 {
123 machine_model_widget_getter(plus4model_get);
124 machine_model_widget_setter(plus4model_set);
125 machine_model_widget_set_models(plus4_model_list);
126
127 video_model_widget_set_title("TED model");
128 video_model_widget_set_resource("MachineVideoStandard");
129 video_model_widget_set_models(plus4_ted_models);
130
131 settings_sampler_set_devices_getter(sampler_get_devices);
132
133 /* uicart_set_detect_func(cartridge_detect); only cbm2/plus4 */
134 /* uicart_set_list_func(cartridge_get_info_list); */
135 uicart_set_attach_func(cartridge_attach_image);
136 /* uicart_set_freeze_func(cartridge_trigger_freeze); */
137 uicart_set_detach_func(cartridge_detach_image);
138 /* uicart_set_default_func(cartridge_set_default); */
139 return 0;
140 }
141
142
143 /** \brief Shut down the UI
144 */
plus4ui_shutdown(void)145 void plus4ui_shutdown(void)
146 {
147 /* NOP */
148 }
149