Previous 15994 Revisions Next

r2956 Wednesday 16th July, 2008 at 11:08:43 UTC by Nathan Woods
Minor cleanups
[src/mess]tapectrl.c uimess.c uimess.h
[src/mess/osd/windows]tapedlg.c

src/mess/uimess.c
r2955r2956
1212#include "uimess.h"
1313#include "input.h"
1414
15//int mess_pause_for_ui = 0;
15
16/***************************************************************************
17    LOCAL VARIABLES
18***************************************************************************/
19
1620static int ui_active = 0;
1721
22
23
24/***************************************************************************
25    IMPLEMENTATION
26***************************************************************************/
27
1828int mess_ui_active(void)
1929{
2030   return ui_active;
r2955r2956
160170
161171
162172
173/*-------------------------------------------------
174    ui_menu_image_info - menu that shows info on
175   all loaded images
176-------------------------------------------------*/
177
163178UINT32 ui_menu_image_info(running_machine *machine, UINT32 state)
164179{
165180   char buf[2048];
r2955r2956
182197
183198
184199
200/*-------------------------------------------------
201    mess_use_new_ui - determines if the "new ui"
202   is in use
203-------------------------------------------------*/
204
185205int mess_use_new_ui(void)
186206{
187207#if (defined(WIN32) || defined(_MSC_VER)) && !defined(SDLMAME_WIN32)
r2955r2956
193213
194214
195215
216/*-------------------------------------------------
217    mess_disable_builtin_ui - function to determine
218   if the builtin UI should be disabled
219-------------------------------------------------*/
220
196221int mess_disable_builtin_ui(running_machine *machine)
197222{
198223   return mess_use_new_ui() || ((machine->gamedrv->flags & GAME_COMPUTER) && !mess_ui_active());
src/mess/uimess.h
r2955r2956
1010#define UIMESS_H
1111
1212#include "ui.h"
13#include "uimenu.h"
1314
1415int mess_ui_active(void);
1516void mess_ui_update(running_machine *machine);
r2955r2956
2526
2627/* tape control */
2728UINT32 menu_tape_control(running_machine *machine, UINT32 state);
28void tapecontrol_gettime(char *timepos, size_t timepos_size, const device_config *img, int *curpos, int *endpos);
29astring *tapecontrol_gettime(astring *dest, const device_config *device, int *curpos, int *endpos);
2930
3031/* paste */
3132void ui_paste(running_machine *machine);
src/mess/tapectrl.c
r2955r2956
1919    IMPLEMENTATION
2020***************************************************************************/
2121
22void tapecontrol_gettime(char *timepos, size_t timepos_size, const device_config *img, int *curpos, int *endpos)
22/*-------------------------------------------------
23    tapecontrol_gettime - returns a textual
24   representation of the time
25-------------------------------------------------*/
26
27astring *tapecontrol_gettime(astring *dest, const device_config *device, int *curpos, int *endpos)
2328{
2429   double t0, t1;
2530
26   t0 = cassette_get_position(img);
27   t1 = cassette_get_length(img);
31   t0 = cassette_get_position(device);
32   t1 = cassette_get_length(device);
2833
2934   if (t1)
30      snprintf(timepos, timepos_size, "%04d/%04d", (int) t0, (int) t1);
35      astring_printf(dest, "%04d/%04d", (int) t0, (int) t1);
3136   else
32      snprintf(timepos, timepos_size, "%04d/%04d", 0, (int) t1);
37      astring_printf(dest, "%04d/%04d", 0, (int) t1);
3338
34   if (curpos)
39   if (curpos != NULL)
3540      *curpos = t0;
36   if (endpos)
41   if (endpos != NULL)
3742      *endpos = t1;
43
44   return dest;
3845}
3946
47
48
4049static int tapecontrol(running_machine *machine, int selected)
4150{
4251   static int id = 0;
43   char timepos[32];
52   astring *timepos = astring_alloc();
4453   ui_menu_item menu_item[40];
4554   char name[64];
4655   const device_config *img;
r2955r2956
7887   menu_item[total].flags = 0;
7988   total++;
8089
81   tapecontrol_gettime(timepos, sizeof(timepos) / sizeof(timepos[0]), img, NULL, NULL);
90   tapecontrol_gettime(timepos, img, NULL, NULL);
8291
8392   state = cassette_get_state(img);
8493   menu_item[total].text =
r2955r2956
9099               : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? UI_recording : UI_recording_inhibited)
91100               ));
92101
93   menu_item[total].subtext = timepos;
102   menu_item[total].subtext = astring_c(timepos);
94103   menu_item[total].flags = 0;
95104   total++;
96105
r2955r2956
214223   if (input_ui_pressed(machine, IPT_UI_CONFIGURE))
215224      sel = -2;
216225
226   astring_free(timepos);
217227   return sel + 1;
218228}
219229
220230
221231/*-------------------------------------------------
222    menu_tape_control - MESS-specific menu
232    menu_tape_control - main tape control menu
223233-------------------------------------------------*/
224234
225235UINT32 menu_tape_control(running_machine *machine, UINT32 state)
src/mess/osd/windows/tapedlg.c
r2955r2956
6060   struct tape_dialog *dlg;
6161   int id;
6262   int curpos, endpos;
63   char tapestatus[32];
63   astring *tapestatus = astring_alloc();
6464   const device_config *img;
6565
6666   dlg = get_tapedialog(dialog);
r2955r2956
6868
6969   img = image_from_devtype_and_index(IO_CASSETTE, id);
7070
71   tapecontrol_gettime(tapestatus, sizeof(tapestatus) / sizeof(tapestatus[0]),
72      img, &curpos, &endpos);
71   tapecontrol_gettime(tapestatus, img, &curpos, &endpos);
7372
7473   SendMessage(dlg->slider, TBM_SETRANGEMIN, FALSE, 0);
7574   SendMessage(dlg->slider, TBM_SETRANGEMAX, FALSE, endpos);
7675   SendMessage(dlg->slider, TBM_SETPOS, TRUE, curpos);
7776
78   win_set_window_text_utf8(dlg->status, tapestatus);
77   win_set_window_text_utf8(dlg->status, astring_c(tapestatus));
78
79   astring_free(tapestatus);
7980}
8081
8182//============================================================

Previous 15994 Revisions Next


© 1998-2018 The MESS Team