~ubuntu-branches/ubuntu/utopic/lebiniou/utopic

« back to all changes in this revision

Viewing changes to src/context_event.c

  • Committer: Package Import Robot
  • Author(s): Olivier Girondel
  • Date: 2012-04-22 22:07:40 UTC
  • mfrom: (6.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120422220740-xncgwhc3g71nopnu
Tags: 3.18-1
* New upstream release 3.18.
* Support older libswscale.
* Add missing Build-Depends: libfreetype6-dev, libasound2-dev,
  libpulse-dev. (Closes: #669437)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright 1994-2011 Olivier Girondel
 
2
 *  Copyright 1994-2012 Olivier Girondel
3
3
 *
4
4
 *  This file is part of lebiniou.
5
5
 *
22
22
#include "colormaps.h"
23
23
#include "pictures.h"
24
24
 
 
25
#ifdef WITH_WEBCAM
 
26
extern int webcams;
 
27
#endif
 
28
 
25
29
 
26
30
void
27
31
Context_add_event(Context_t *ctx, const Event_t *e)
104
108
  switch (e->cmd) {
105
109
  case BC_QUIT:
106
110
    if (e->arg0 == BA_SAVE)
107
 
      Sequence_save(ctx->sm->cur, 0);
 
111
      Sequence_save(ctx->sm->cur, 0, SequenceManager_is_transient(ctx->sm, ctx->sm->cur));
108
112
    ctx->running = 0;
109
113
    return 1;
110
114
    break;
207
211
      return 1;
208
212
      break;
209
213
 
 
214
#ifdef WITH_GL
 
215
    case BA_PULSE:
 
216
      ctx->pulse_3d = !ctx->pulse_3d;
 
217
      return 1;
 
218
      break;
 
219
 
 
220
    case BA_BOUNDARY:
 
221
      ctx->force_cube = !ctx->force_cube;
 
222
      return 1;
 
223
      break;
 
224
#endif
 
225
 
210
226
    default:
211
227
      return 0;
212
228
      break;
304
320
        return 1;
305
321
      }
306
322
 
 
323
#ifdef WITH_WEBCAM
 
324
    case BA_WEBCAM:
 
325
      ctx->cam = (ctx->cam+1) % webcams;
 
326
      return 1;
 
327
#endif
 
328
 
307
329
    default:
308
330
      return 0;
309
331
    }
360
382
    }
361
383
 
362
384
  case BC_USE_BANK:
363
 
    printf("[i] Using sequence in bank #%d\n", (e->arg0+1));
364
 
    Context_use_bank(ctx, e->arg0);
 
385
    switch (ctx->bank_mode) {
 
386
    case SEQUENCES:
 
387
      Context_use_sequence_bank(ctx, e->arg0);
 
388
      break;
 
389
    case COLORMAPS:
 
390
      {
 
391
        uint32_t id = ctx->banks[COLORMAPS][ctx->bankset[COLORMAPS]][e->arg0];
 
392
        if (id) {
 
393
          printf("[i] Using colormap in bank #%d\n", (e->arg0+1));
 
394
          ctx->sm->next->cmap_id = id;
 
395
          ctx->bank[COLORMAPS] = e->arg0;
 
396
          Context_set_colormap(ctx);
 
397
        }
 
398
      }
 
399
      break;
 
400
    case PICTURES:
 
401
      {
 
402
        uint32_t id = ctx->banks[PICTURES][ctx->bankset[PICTURES]][e->arg0];
 
403
        if (id) {
 
404
          printf("[i] Using picture in bank #%d\n", (e->arg0+1));
 
405
          ctx->sm->next->picture_id = id;
 
406
          ctx->bank[PICTURES] = e->arg0;
 
407
          Context_set_picture(ctx);
 
408
        }
 
409
      }
 
410
      break;
 
411
    }
365
412
    return 1;
366
413
    break;
367
414
 
368
415
  case BC_CLEAR_BANK:
369
 
    printf("[i] Clear sequence in bank #%d\n", (e->arg0+1));
 
416
    printf("[i] Clear sequence/colormap/picture in bank #%d\n", (e->arg0+1));
370
417
    Context_clear_bank(ctx, e->arg0);
371
418
    return 1;
372
419
    break;
378
425
    }
379
426
    break;
380
427
 
 
428
#ifdef WITH_WEBCAM
 
429
  case BC_SET:
 
430
    if (e->arg0 == BA_WEBCAM) {
 
431
      pthread_mutex_lock(&ctx->cam_mtx[ctx->cam]);
 
432
      Buffer8_copy(ctx->cam_save[ctx->cam][0], ctx->cam_ref[ctx->cam]);
 
433
      pthread_mutex_unlock(&ctx->cam_mtx[ctx->cam]);
 
434
      return 1;
 
435
    }
 
436
    break;
 
437
#endif
 
438
 
 
439
  case BC_STORE_BANK:
 
440
    printf("[i] Storing sequence/colormap/picture in bank #%d\n", e->arg0+1);
 
441
    Context_store_bank(ctx, e->arg0);
 
442
    return 1;
 
443
    break;
 
444
 
 
445
  case BC_USE_BANKSET:
 
446
    printf("[i] Using bankset %d\n", (e->arg0+1));
 
447
    Context_use_bankset(ctx, e->arg0);
 
448
    return 1;
 
449
    break;
 
450
 
 
451
  case BC_SAVE_BANKS:
 
452
    printf("[i] Writing banks file\n");
 
453
    Context_save_banks(ctx);
 
454
    return 1;
 
455
    break;
 
456
 
 
457
  case BC_SET_BANKMODE:
 
458
    printf("[i] Set bank mode to ");
 
459
    switch (e->arg0) {
 
460
    case SEQUENCES: printf("sequences"); break;
 
461
    case COLORMAPS: printf("colormaps"); break;
 
462
    case PICTURES: printf("pictures"); break;
 
463
    default: xerror("Invalid bank mode %d\n", e->arg0); break;
 
464
    }
 
465
    printf("\n");
 
466
    ctx->bank_mode = e->arg0;
 
467
    return 1;
 
468
    break;
 
469
 
381
470
  default:
382
471
    break;
383
472
  }