Previous 15994 Revisions Next

r8124 Friday 21st May, 2010 at 11:13:36 UTC by Robbbert
[OLDUI tape control] Controls have been revised. Rewind will go back 30 secs; Fast Forward will advance by 30 secs. Highlight the counter and press enter to rewind fully, or use arrows to position the tape.
[src/mess]tapectrl.c

src/mess/tapectrl.c
r8123r8124
2222#define TAPECMD_PLAY         ((void *) 0x0002)
2323#define TAPECMD_RECORD         ((void *) 0x0003)
2424#define TAPECMD_REWIND         ((void *) 0x0004)
25#define TAPECMD_FAST_FORWARD   ((void *) 0x0005)
25#define TAPECMD_FAST_FORWARD      ((void *) 0x0005)
26#define TAPECMD_SLIDER         ((void *) 0x0006)
27#define TAPECMD_SELECT         ((void *) 0x0007)
2628
2729
2830
r8123r8124
106108
107109   if (image_exists(menustate->device))
108110   {
111      double t0, t1;
112      UINT32 tapeflags = 0;
113
114      t0 = cassette_get_position(menustate->device);
115      t1 = cassette_get_length(menustate->device);
116
117      if (t1 > 0)
118      {
119         if (t0 > 0)
120            tapeflags |= MENU_FLAG_LEFT_ARROW;
121         if (t0 < t1)
122            tapeflags |= MENU_FLAG_RIGHT_ARROW;
123      }           
124
109125      /* name of tape */
110      ui_menu_item_append(menu, image_typename_id(menustate->device), image_filename(menustate->device), flags, NULL);
126      ui_menu_item_append(menu, image_typename_id(menustate->device), image_filename(menustate->device), flags, TAPECMD_SELECT);
111127
112128      /* state */
113129      tapecontrol_gettime(&timepos, menustate->device, NULL, NULL);
r8123r8124
121137               : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
122138               ),
123139         astring_c(&timepos),
124         0,
125         NULL);
140         tapeflags,
141         TAPECMD_SLIDER);
126142
127143      /* pause or stop */
128144      ui_menu_item_append(menu, "Pause/Stop", NULL, 0, TAPECMD_STOP);
r8123r8124
181197   menu_tape_control_populate(machine, menu, (tape_control_menu_state*)state);
182198
183199   /* process the menu */
184   event = ui_menu_process(machine, menu, 0);
200   event = ui_menu_process(machine, menu, UI_MENU_PROCESS_LR_REPEAT);
185201   if (event != NULL)
186202   {
187203      switch(event->iptkey)
188204      {
189205         case IPT_UI_LEFT:
190            /* left arrow - rotate left through cassette devices */
191            if (menustate->index > 0)
192               menustate->index--;
206            if (event->itemref==TAPECMD_SLIDER)
207               cassette_seek(menustate->device, -1, SEEK_CUR);
193208            else
194               menustate->index = cassette_count(machine) - 1;
195            menustate->device = NULL;
209            if (event->itemref==TAPECMD_SELECT)
210            {
211               /* left arrow - rotate left through cassette devices */
212               if (menustate->index > 0)
213                  menustate->index--;
214               else
215                  menustate->index = cassette_count(machine) - 1;
216               menustate->device = NULL;
217            }
196218            break;
197219
198220         case IPT_UI_RIGHT:
199            /* right arrow - rotate right through cassette devices */
200            if (menustate->index < cassette_count(machine) - 1)
201               menustate->index++;
221            if (event->itemref==TAPECMD_SLIDER)
222               cassette_seek(menustate->device, +1, SEEK_CUR);
202223            else
203               menustate->index = 0;
204            menustate->device = NULL;
224            if (event->itemref==TAPECMD_SELECT)
225            {
226               /* right arrow - rotate right through cassette devices */
227               if (menustate->index < cassette_count(machine) - 1)
228                  menustate->index++;
229               else
230                  menustate->index = 0;
231               menustate->device = NULL;
232            }
205233            break;
206234
207235         case IPT_UI_SELECT:
208236            {
209               if (event->itemref==TAPECMD_NULL) {
210               }
211               else if (event->itemref==TAPECMD_STOP) {
237               if (event->itemref==TAPECMD_STOP)
212238                  cassette_change_state(menustate->device, CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
213               }
214               else if (event->itemref==TAPECMD_PLAY) {
239               else
240               if (event->itemref==TAPECMD_PLAY)
215241                  cassette_change_state(menustate->device, CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
216               }
217               else if (event->itemref==TAPECMD_RECORD) {
242               else
243               if (event->itemref==TAPECMD_RECORD)
218244                  cassette_change_state(menustate->device, CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
219               }
220               else if (event->itemref==TAPECMD_REWIND) {
221                  cassette_seek(menustate->device, -60, SEEK_CUR);
222               }
223               else if (event->itemref==TAPECMD_FAST_FORWARD) {
224                  cassette_seek(menustate->device, +60, SEEK_CUR);
225               }
245               else
246               if (event->itemref==TAPECMD_REWIND)
247                  cassette_seek(menustate->device, -30, SEEK_CUR);
248               else
249               if (event->itemref==TAPECMD_FAST_FORWARD)
250                  cassette_seek(menustate->device, 30, SEEK_CUR);
251               else
252               if (event->itemref==TAPECMD_SLIDER)
253                  cassette_seek(menustate->device, 0, SEEK_SET);
226254            }
227255            break;
228256      }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team