1 /** \file c64dtvui.c
2 * \brief Native GTK3 C64DTV 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 "c64dtvmodel.h"
35 #include "crtcontrolwidget.h"
36 #include "machine.h"
37 #include "machinemodelwidget.h"
38 #include "ui.h"
39 #include "uimachinewindow.h"
40 #include "settings_sampler.h"
41 #include "vicii.h"
42 #include "videomodelwidget.h"
43 #include "c64dtvmodel.h"
44 #include "settings_model.h"
45
46 #include "c64ui.h"
47
48
49 /** \brief List of DTV models
50 *
51 * Used in the machine-model widget
52 */
53 static const char *c64dtv_model_list[] = {
54 "V2 PAL",
55 "V2 NTSC",
56 "V3 PAL",
57 "V3 NTSC",
58 "Hummer (NTSC)",
59 NULL
60 };
61
62
63 /** \brief VIC-II models
64 *
65 * Used in the VIC-II models widget
66 */
67 static const vice_gtk3_radiogroup_entry_t c64dtv_vicii_models[] = {
68 { "PAL-G", MACHINE_SYNC_PAL },
69 { "NTSC-M", MACHINE_SYNC_NTSC },
70 { NULL, -1 }
71 };
72
73
74 /** \brief Identify the canvas used to create a window
75 *
76 * \param[in] canvas video canvas reference
77 *
78 * \return window index on success, -1 on failure
79 */
identify_canvas(video_canvas_t * canvas)80 static int identify_canvas(video_canvas_t *canvas)
81 {
82 if (canvas != vicii_get_canvas()) {
83 return -1;
84 }
85
86 return PRIMARY_WINDOW;
87 }
88
89 /** \brief Create CRT controls widget for \a target window
90 *
91 * \param[in] target_window target window index
92 *
93 * \return GtkGrid
94 */
create_crt_widget(int target_window)95 static GtkWidget *create_crt_widget(int target_window)
96 {
97 return crt_control_widget_create(NULL, "VICII", TRUE);
98 }
99
100 /** \brief Pre-initialize the UI before the canvas window gets created
101 *
102 * \return 0 on success, -1 on failure
103 */
c64dtvui_init_early(void)104 int c64dtvui_init_early(void)
105 {
106 ui_machine_window_init();
107 ui_set_identify_canvas_func(identify_canvas);
108 ui_set_create_controls_widget_func(create_crt_widget);
109 return 0;
110 }
111
112
113 /** \brief Initialize the UI
114 *
115 * \return 0 on success, -1 on failure
116 */
c64dtvui_init(void)117 int c64dtvui_init(void)
118 {
119 machine_model_widget_getter(dtvmodel_get);
120 machine_model_widget_setter(dtvmodel_set);
121 machine_model_widget_set_models(c64dtv_model_list);
122
123 video_model_widget_set_title("VIC-II model");
124 video_model_widget_set_resource("MachineVideoStandard");
125 video_model_widget_set_models(c64dtv_vicii_models);
126
127 settings_sampler_set_devices_getter(sampler_get_devices);
128
129 settings_model_widget_set_model_func(dtvmodel_get);
130 return 0;
131 }
132
133
134 /** \brief Shut down the UI
135 */
c64dtvui_shutdown(void)136 void c64dtvui_shutdown(void)
137 {
138 /* NOP */
139 }
140