1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
|
/* ui.h: General UI event handling routines
Copyright (c) 2000-2004 Philip Kendall
$Id: ui.h 4180 2010-10-09 12:59:37Z fredm $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Author contact information:
E-mail: philip-fuse@shadowmagic.org.uk
*/
#ifndef FUSE_UI_H
#define FUSE_UI_H
#include <stdarg.h>
#ifdef HAVE_LIB_GLIB
#include <glib.h>
#endif
#include <libspectrum.h>
#include "compat.h"
#include "disk/beta.h"
#include "disk/opus.h"
#include "disk/plusd.h"
#include "machines/specplus3.h"
#include "ui/scaler/scaler.h"
/* The various severities of error level, increasing downwards */
typedef enum ui_error_level {
UI_ERROR_INFO, /* Informational message */
UI_ERROR_WARNING, /* Something is wrong, but it's not that
important */
UI_ERROR_ERROR, /* An actual error */
} ui_error_level;
int ui_init(int *argc, char ***argv);
int ui_event(void);
int ui_end(void);
/* Error handling routines */
int ui_error( ui_error_level severity, const char *format, ... )
GCC_PRINTF( 2, 3 );
libspectrum_error ui_libspectrum_error( libspectrum_error error,
const char *format, va_list ap );
int ui_verror( ui_error_level severity, const char *format, va_list ap );
int ui_error_specific( ui_error_level severity, const char *message );
void ui_error_frame( void );
/* Callbacks used by the debugger */
int ui_debugger_activate( void );
int ui_debugger_deactivate( int interruptable );
int ui_debugger_update( void );
int ui_debugger_disassemble( libspectrum_word address );
/* Reset anything in the UI which needs to be reset on machine selection */
int ui_widgets_reset( void );
/* Functions defined in ../ui.c */
/* Confirm whether we want to save some data before overwriting it */
typedef enum ui_confirm_save_t {
UI_CONFIRM_SAVE_SAVE, /* Save the data */
UI_CONFIRM_SAVE_DONTSAVE, /* Don't save the data */
UI_CONFIRM_SAVE_CANCEL, /* Cancel the action */
} ui_confirm_save_t;
ui_confirm_save_t ui_confirm_save( const char *format, ... )
GCC_PRINTF( 1, 2 );
ui_confirm_save_t ui_confirm_save_specific( const char *message );
/* Confirm whether we want to change a joystick setting */
typedef enum ui_confirm_joystick_t {
UI_CONFIRM_JOYSTICK_NONE, /* Don't map joystick */
UI_CONFIRM_JOYSTICK_KEYBOARD, /* Map the joystick to the keyboard */
UI_CONFIRM_JOYSTICK_JOYSTICK_1, /* Map the joystick to joystick 1 */
UI_CONFIRM_JOYSTICK_JOYSTICK_2, /* Map the joystick to joystick 2 */
} ui_confirm_joystick_t;
ui_confirm_joystick_t
ui_confirm_joystick( libspectrum_joystick libspectrum_type, int inputs );
/* Mouse handling */
extern int ui_mouse_present, ui_mouse_grabbed;
void ui_mouse_suspend( void );
void ui_mouse_resume( void );
void ui_mouse_button( int button, int down );
void ui_mouse_motion( int dx, int dy );
int ui_mouse_grab( int startup ); /* UI: grab, return 1 if done */
int ui_mouse_release( int suspend ); /* UI: ungrab, return 0 if done */
/* Write the current tape out */
int ui_tape_write( void );
/* Write a +3, Beta or +D disk out */
int ui_plus3_disk_write( specplus3_drive_number which, int saveas );
int ui_beta_disk_write( beta_drive_number which, int saveas );
int ui_opus_disk_write( opus_drive_number which, int saveas );
int ui_plusd_disk_write( plusd_drive_number which, int saveas );
int ui_mdr_write( int which, int saveas );
/* Get a rollback point from the given list */
int ui_get_rollback_point( GSList *points );
/* Routines to (de)activate certain menu items */
typedef enum ui_menu_item {
UI_MENU_ITEM_FILE_MOVIES_RECORDING,
UI_MENU_ITEM_MACHINE_PROFILER,
UI_MENU_ITEM_MEDIA_CARTRIDGE,
UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK,
UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK_EJECT,
UI_MENU_ITEM_MEDIA_IF1,
UI_MENU_ITEM_MEDIA_IF1_M1_EJECT,
UI_MENU_ITEM_MEDIA_IF1_M1_WP_SET,
UI_MENU_ITEM_MEDIA_IF1_M2_EJECT,
UI_MENU_ITEM_MEDIA_IF1_M2_WP_SET,
UI_MENU_ITEM_MEDIA_IF1_M3_EJECT,
UI_MENU_ITEM_MEDIA_IF1_M3_WP_SET,
UI_MENU_ITEM_MEDIA_IF1_M4_EJECT,
UI_MENU_ITEM_MEDIA_IF1_M4_WP_SET,
UI_MENU_ITEM_MEDIA_IF1_M5_EJECT,
UI_MENU_ITEM_MEDIA_IF1_M5_WP_SET,
UI_MENU_ITEM_MEDIA_IF1_M6_EJECT,
UI_MENU_ITEM_MEDIA_IF1_M6_WP_SET,
UI_MENU_ITEM_MEDIA_IF1_M7_EJECT,
UI_MENU_ITEM_MEDIA_IF1_M7_WP_SET,
UI_MENU_ITEM_MEDIA_IF1_M8_EJECT,
UI_MENU_ITEM_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ITEM_MEDIA_IDE_DIVIDE_MASTER_EJECT,
UI_MENU_ITEM_MEDIA_IDE_DIVIDE_SLAVE_EJECT,
UI_MENU_ITEM_RECORDING,
UI_MENU_ITEM_RECORDING_ROLLBACK,
UI_MENU_ITEM_AY_LOGGING,
UI_MENU_ITEM_TAPE_RECORDING,
} ui_menu_item;
int ui_menu_activate( ui_menu_item item, int active );
int ui_menu_item_set_active( const char *path, int active );
void ui_menu_disk_update( void );
/* Functions to update the statusbar */
typedef enum ui_statusbar_item {
UI_STATUSBAR_ITEM_DISK,
UI_STATUSBAR_ITEM_MICRODRIVE,
UI_STATUSBAR_ITEM_MOUSE,
UI_STATUSBAR_ITEM_PAUSED,
UI_STATUSBAR_ITEM_TAPE,
} ui_statusbar_item;
typedef enum ui_statusbar_state {
UI_STATUSBAR_STATE_NOT_AVAILABLE,
UI_STATUSBAR_STATE_INACTIVE,
UI_STATUSBAR_STATE_ACTIVE,
} ui_statusbar_state;
int ui_statusbar_update( ui_statusbar_item item, ui_statusbar_state state );
int ui_statusbar_update_speed( float speed );
typedef enum ui_tape_browser_update_type {
UI_TAPE_BROWSER_NEW_TAPE, /* Whole tape image has changed
implies modified reset */
UI_TAPE_BROWSER_SELECT_BLOCK, /* Tape block selected has changed */
UI_TAPE_BROWSER_NEW_BLOCK, /* A new block has been appended,
implies modified set */
UI_TAPE_BROWSER_MODIFIED, /* Tape modified status has changed */
} ui_tape_browser_update_type;
/* Cause the tape browser to be updated */
int ui_tape_browser_update( ui_tape_browser_update_type change,
libspectrum_tape_block *block );
char *ui_get_open_filename( const char *title );
char *ui_get_save_filename( const char *title );
int ui_query( const char *message );
#ifdef USE_WIDGET
#include "ui/widget/widget.h"
#define ui_widget_finish() widget_finish()
#else /* #ifdef USE_WIDGET */
#define ui_widget_finish()
#endif /* #ifdef USE_WIDGET */
/* Code called at start and end of emulation if widget system is used */
int ui_widget_init( void );
int ui_widget_end( void );
/* How many levels deep have we recursed through widgets; -1 => none */
extern int ui_widget_level;
/* widget system popup the apropriate menu */
void ui_popup_menu( int native_key );
void ui_widget_keyhandler( int native_key );
#endif /* #ifndef FUSE_UI_H */
|