~ubuntu-branches/ubuntu/maverick/vdr-plugin-skinenigmang/maverick

« back to all changes in this revision

Viewing changes to setup.c

  • Committer: Bazaar Package Importer
  • Author(s): Tobias Grimm
  • Date: 2009-05-03 22:37:14 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090503223714-hzn95frtagzb0f50
Tags: 0.1.0-1
* New upstream release
* Updated debian/copyright
* Build-depend on libmagick++-dev instead of libmagick++9-dev (Closes: 524592)

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
#include "common.h"
9
9
#include "config.h"
10
 
#include "i18n.h"
11
10
#include "logo.h"
12
11
#include "setup.h"
13
12
#include "tools.h"
24
23
#include "services/mailbox.h"
25
24
#endif
26
25
 
27
 
#ifdef HAVE_FREETYPE
28
26
#include "texteffects.h"
29
 
#endif
30
27
 
31
28
static const char *allVdrFonts[] = {
32
 
#ifdef HAVE_FREETYPE
33
29
  trNOOP("TrueType Font"),
34
 
#else
35
 
  trNOOP("No TTF support!"),
36
 
#endif
37
30
  trNOOP("Default OSD Font"),
38
31
  trNOOP("Default Fixed Size Font"),
39
 
  trNOOP("Default Small Font"),
40
 
  SKINENIGMA_FONTS
 
32
  trNOOP("Default Small Font")
41
33
};
42
34
 
43
35
// cPluginSkinEnigmaSetup
67
59
void cPluginSkinEnigmaSetup::Setup(void)
68
60
{
69
61
  // update setup display
70
 
  int current = Current();
 
62
  int currentItem = Current();
71
63
 
72
64
  Clear();
73
65
 
74
66
  Add(new cOsdItem(tr("General")));
75
67
  Add(new cOsdItem(tr("Logos & Symbols")));
76
 
#ifndef DISABLE_ANIMATED_TEXT
77
68
  Add(new cOsdItem(tr("Animated Text")));
78
 
#endif
79
69
  if (::Setup.UseSmallFont == 1) { // only if "Use small font" = "skin dependent"
80
70
    Add(new cOsdItem(tr("Fonts")));
81
71
  }
85
75
  } //TODO? else display "EPGsearch plugin not found"
86
76
#endif
87
77
 
88
 
  SetCurrent(Get(current));
 
78
  SetCurrent(Get(currentItem));
89
79
  Display();
90
80
  SetHelp(NULL, NULL, NULL, trVDR("Button$Open"));
91
81
}
137
127
  SetupStore("StatusLineMode", EnigmaConfig.statusLineMode);
138
128
  SetupStore("ShowWssSymbols", EnigmaConfig.showWssSymbols);
139
129
  SetupStore("ShowStatusSymbols", EnigmaConfig.showStatusSymbols);
 
130
  SetupStore("ShowScrollbar", EnigmaConfig.showScrollbar);
 
131
  SetupStore("ShowSignalInfo", EnigmaConfig.showSignalInfo);
 
132
  SetupStore("ShowCaMode", EnigmaConfig.showCaMode);
140
133
 
141
134
  char tmp[sizeof(EnigmaConfig.allFonts[0].Name) + 8];
142
135
  for (int id = 0; id < FONT_NUMFONTS; id++) {
166
159
        state = AddSubMenu(new cMenuSetupGeneral(&data));
167
160
      else if (strcmp(ItemText, tr("Logos & Symbols")) == 0)
168
161
        state = AddSubMenu(new cMenuSetupLogos(&data));
169
 
#ifndef DISABLE_ANIMATED_TEXT
170
162
      else if (strcmp(ItemText, tr("Animated Text")) == 0)
171
163
        state = AddSubMenu(new cMenuSetupAnimText(&data));
172
 
#endif
173
164
      else if (strcmp(ItemText, tr("Fonts")) == 0)
174
165
        state = AddSubMenu(new cMenuSetupFonts(&data));
175
166
#ifdef USE_PLUGIN_EPGSEARCH
219
210
  statusLineModeTexts[1] = tr("Help buttons");
220
211
  statusLineModeTexts[2] = tr("Free last line");
221
212
 
 
213
  showScrollbarTexts[0] = trVDR("no");
 
214
  showScrollbarTexts[1] = trVDR("yes");
 
215
  showScrollbarTexts[2] = tr("if required");
222
216
  Set();
223
217
}
224
218
 
229
223
 
230
224
void cMenuSetupGeneral::Set(void)
231
225
{
232
 
  int current = Current();
 
226
  int currentItem = Current();
233
227
  Clear();
234
228
 
235
229
  Add(new cMenuEditBoolItem(tr("Try 8bpp single area"), &data->singleArea8Bpp));
239
233
  Add(new cMenuEditBoolItem(tr("Full title width"), &data->fullTitleWidth));
240
234
  Add(new cMenuEditStraItem(tr("Show remaining/elapsed time"), &data->showRemaining, 3, showRemainingTexts));
241
235
  Add(new cMenuEditBoolItem(tr("Show VPS"), &data->showVps));
 
236
#ifndef DISABLE_SIGNALINFO
 
237
  Add(new cMenuEditBoolItem(tr("Show signal info"), &data->showSignalInfo));
 
238
#endif //DISABLE_SIGNALINFO
 
239
  Add(new cMenuEditBoolItem(tr("Show CA system as text"), &data->showCaMode));
242
240
  Add(new cMenuEditBoolItem(tr("Show progressbar"), &data->showProgressbar));
243
 
#ifdef USE_PLUGIN_AVARDS
244
 
  //TODO: USE_PLUGIN_AVARDS only if APIVERSNUM < 10504
245
 
  cPlugin *pAvardsPlugin = cPluginManager::GetPlugin("avards");
246
 
  if (pAvardsPlugin != NULL) {
247
 
#if APIVERSNUM < 10504
248
 
      if (pAvardsPlugin->Service(AVARDS_MAXOSDSIZE_SERVICE_STRING_ID)) {
249
 
#endif
250
 
        Add(new cMenuEditBoolItem(tr("Dynamic OSD size"), &data->dynOsd));
251
 
#if APIVERSNUM < 10504
252
 
      } else {
253
 
        Add(new cOsdItem(AVARDS_MAXOSDSIZE_SERVICE_STRING_ID " service not found!", osUnknown, false));
254
 
      }
255
 
#endif
256
 
  } //TODO? else display "Avards not found"
257
 
#endif
 
241
  Add(new cMenuEditBoolItem(tr("Dynamic OSD size"), &data->dynOsd));
258
242
  Add(new cMenuEditStraItem(tr("Show messages in menu on"), &data->statusLineMode, 3, statusLineModeTexts));
 
243
  Add(new cMenuEditStraItem(tr("Show scrollbar in menu"), &data->showScrollbar, 3, showScrollbarTexts));
259
244
 
260
 
  SetCurrent(Get(current));
 
245
  SetCurrent(Get(currentItem));
261
246
  Display();
262
247
  SetHelp(NULL, NULL, NULL, NULL);
263
248
}
321
306
 
322
307
void cMenuSetupLogos::Set(void)
323
308
{
324
 
  int current = Current();
 
309
  int currentItem = Current();
325
310
  Clear();
326
311
 
327
312
  Add(new cMenuEditBoolItem(tr("Show symbols"), &data->showSymbols));    //TODO? symbols -> icons
387
372
    Add(new cMenuEditIntItem(tr("Channel logo cache size"), &data->cacheSize, 0, 1000));
388
373
  }
389
374
 
390
 
  SetCurrent(Get(current));
 
375
  SetCurrent(Get(currentItem));
391
376
  Display();
392
377
  SetHelp(tr("Button$Flush cache"), NULL, NULL, NULL);
393
378
}
394
379
 
395
 
#ifndef DISABLE_ANIMATED_TEXT
396
380
// Setup: Animated Text
397
381
cMenuSetupAnimText::cMenuSetupAnimText(cEnigmaConfig* Data) : cMenuSetupSubMenu(tr("Animated Text"), Data)
398
382
{
416
400
 
417
401
void cMenuSetupAnimText::Set(void)
418
402
{
419
 
  int current = Current();
 
403
  int currentItem = Current();
420
404
  Clear();
421
405
 
422
406
  Add(new cMenuEditBoolItem(tr("Enable"), &data->useTextEffects));
425
409
    Add(new cMenuEditBoolItem(tr("  Scroll info area"), &data->scrollInfo));
426
410
    Add(new cMenuEditBoolItem(tr("  Scroll active list items"), &data->scrollListItem));
427
411
    Add(new cMenuEditBoolItem(tr("  Scroll other items"), &data->scrollOther));
428
 
    Add(new cMenuEditStraItem(tr("  Scoll behaviour"), &data->scrollMode, 2, scrollModeTexts));
429
 
    Add(new cMenuEditIntItem(tr("  Scroll delay (ms)"), &data->scrollDelay, 50, 1000));
 
412
    Add(new cMenuEditStraItem(tr("  Scroll behaviour"), &data->scrollMode, 2, scrollModeTexts));
 
413
    Add(new cMenuEditIntItem(tr("  Scroll delay (ms)"), &data->scrollDelay, 3, 1000));
430
414
    Add(new cMenuEditIntItem(tr("  Scroll pause (ms)"), &data->scrollPause, 500, 2000));
431
415
    Add(new cMenuEditIntItem(tr("  Blink pause (ms)"), &data->blinkPause, 500, 2000));
432
416
  }
433
417
 
434
 
  SetCurrent(Get(current));
 
418
  SetCurrent(Get(currentItem));
435
419
  Display();
436
420
  SetHelp(NULL, NULL, NULL, NULL);
437
421
}
438
 
#endif
439
422
 
440
 
#ifdef HAVE_FREETYPE
441
423
// Setup: TTF
442
 
#if VDRVERSNUM < 10504
443
 
cMenuSetupTTF::cMenuSetupTTF(FontInfo* Data) : cOsdMenu(tr("TrueType Font"), 10)
444
 
#else // VDRVERSNUM >= 10504
445
424
cMenuSetupTTF::cMenuSetupTTF(FontInfo* Data, cStringList* fonts) : cOsdMenu(tr("TrueType Font"), 10)
446
 
#endif // VDRVERSNUM < 10504
447
425
{
448
426
  data = Data;
449
 
#if VDRVERSNUM < 10504
450
 
  availTTFs = EnigmaTextEffects.GetAvailTTFs();
451
 
  if (availTTFs && data) {
452
 
    nMaxTTFs = EnigmaTextEffects.GetNumAvailTTFs();
453
 
    nFont = 0;
454
 
    for (int i = 0; i < nMaxTTFs; i++) {
455
 
      if (availTTFs[i]) {
456
 
        if (strcmp(availTTFs[i], data->Name) == 0) {
457
 
          nFont = i;
458
 
          break;
459
 
        }
460
 
      }
461
 
    }
462
 
    nWidth = data->Width;
463
 
    nSize = data->Size;
464
 
  }
465
 
#else // VDRVERSNUM >= 10504
466
427
  if (data && fonts) {
467
428
    fontList = fonts;
468
429
    nFont = std::max(0, fontList->Find(data->Name));
469
430
    nWidth = data->Width;
470
431
    nSize = data->Size;
471
432
  }
472
 
#endif // VDRVERSNUM < 10504
473
433
 
474
434
  SetHelp(NULL, NULL, NULL, NULL);
475
435
  Set();
477
437
 
478
438
void cMenuSetupTTF::Set(void)
479
439
{
480
 
  int current = Current();
 
440
  int currentItem = Current();
481
441
  Clear();
482
442
 
483
 
#if VDRVERSNUM < 10504
484
 
  if (availTTFs) {
485
 
    Add(new cMenuEditStraItem(tr("Name"), &nFont, nMaxTTFs, availTTFs));
486
 
#else // VDRVERSNUM >= 10504
487
443
  if (fontList->Size() > 0) {
488
444
    Add(new cMenuEditStraItem(tr("Name"), &nFont, fontList->Size(), &(*fontList)[0]));
489
 
#endif // VDRVERSNUM < 10504
490
445
    Add(new cMenuEditIntItem(tr("Size"), &nSize, 10, MAXFONTSIZE));
491
 
#if VDRVERSNUM < 10503 || VDRVERSNUM >= 10505
492
 
    //VDR 1.5.2 - 1.5.4 can't set TTF width
493
446
    Add(new cMenuEditIntItem(tr("Width"), &nWidth, 50, 150));
494
 
#endif
495
 
    SetCurrent(Get(current));
 
447
    SetCurrent(Get(currentItem));
496
448
  } else {
497
449
    cOsdItem *item = new cOsdItem(tr("No TrueType fonts installed!"));
498
450
 
525
477
 
526
478
void cMenuSetupTTF::Store(void)
527
479
{
528
 
#if VDRVERSNUM < 10504
529
 
  if (data && availTTFs) {
530
 
    strncpy(data->Name, availTTFs[nFont], sizeof(data->Name));
531
 
    data->Width = nWidth;
532
 
    data->Size = nSize;
533
 
  }
534
 
#else // VDRVERSNUM >= 10504
535
480
  if (data) {
536
481
    Utf8Strn0Cpy(data->Name, (*fontList)[nFont], sizeof(data->Name));
537
482
    data->Width = nWidth;
538
483
    data->Size = nSize;
539
484
  }
540
 
#endif // VDRVERSNUM < 10504
541
485
}
542
 
#endif
543
486
 
544
487
// Setup: Fonts
545
488
cMenuSetupFonts::cMenuSetupFonts(cEnigmaConfig* Data) : cMenuSetupSubMenu(tr("Fonts"), Data)
546
489
{
547
 
#ifdef HAVE_FREETYPE
548
490
  allVdrFonts[0] = tr("TrueType Font");
549
 
#else
550
 
  allVdrFonts[0] = tr("No TTF support!");
551
 
#endif
552
491
  allVdrFonts[1] = tr("Default OSD Font");
553
492
  allVdrFonts[2] = tr("Default Fixed Size Font");
554
493
  allVdrFonts[3] = tr("Default Small Font");
555
494
 
556
 
#ifdef HAVE_FREETYPE
557
 
#if VDRVERSNUM >= 10504
558
495
  cFont::GetAvailableFontNames(&fontMonoNames, true);
559
496
  cFont::GetAvailableFontNames(&fontNames);
560
 
#endif
561
 
#endif
562
497
 
563
498
  Set();
564
499
}
571
506
{
572
507
  eOSState state = cMenuSetupSubMenu::ProcessKey(Key);
573
508
 
574
 
#ifdef HAVE_FREETYPE
575
509
  if (state == osUnknown && Key == kBlue && data->allFonts[Current()].VdrId == FONT_TRUETYPE) {
576
 
#if VDRVERSNUM < 10504
577
 
    state = AddSubMenu(new cMenuSetupTTF(&data->allFonts[Current()]));
578
 
#else // VDRVERSNUM >= 10504
579
510
    state = AddSubMenu(new cMenuSetupTTF(&data->allFonts[Current()], strncmp(Get(Current())->Text(), tr("Fixed Font"), strlen(tr("Fixed Font"))) == 0 ? &fontMonoNames : &fontNames));
580
 
#endif
581
511
  } else {
582
512
    if (!HasSubMenu() && data->allFonts[Current()].VdrId == FONT_TRUETYPE)
583
513
      SetHelp(NULL, NULL, NULL, tr("Button$Set"));
584
514
    else
585
515
      SetHelp(NULL, NULL, NULL, NULL);
586
516
  }
587
 
#endif
588
517
 
589
518
  return state;
590
519
}
591
520
 
592
521
void cMenuSetupFonts::Set(void)
593
522
{
594
 
  int current = Current();
 
523
  int currentItem = Current();
595
524
  Clear();
596
525
 
597
526
  int numAvailFonts = sizeof(allVdrFonts)/sizeof(char*);
614
543
  Add(new cMenuEditStraItem(tr("Replay: times"), &data->allFonts[FONT_REPLAYTIMES].VdrId, numAvailFonts, allVdrFonts));
615
544
  Add(new cMenuEditStraItem(tr("Fixed Font"), &data->allFonts[FONT_FIXED].VdrId, numAvailFonts, allVdrFonts));
616
545
 
617
 
  SetCurrent(Get(current));
 
546
  SetCurrent(Get(currentItem));
618
547
  Display();
619
 
#ifdef HAVE_FREETYPE
620
548
  if (data->allFonts[Current()].VdrId == FONT_TRUETYPE)
621
549
    SetHelp(NULL, NULL, NULL, tr("Button$Set"));
622
550
  else
623
 
#endif
624
551
    SetHelp(NULL, NULL, NULL, NULL);
625
552
}
626
553
 
642
569
 
643
570
void cMenuSetupEpgSearch::Set(void)
644
571
{
645
 
  int current = Current();
 
572
  int currentItem = Current();
646
573
  Clear();
647
574
 
648
575
  cPlugin *pEPGsearchPlugin = cPluginManager::GetPlugin("epgsearch");
662
589
    }
663
590
  }
664
591
 
665
 
  SetCurrent(Get(current));
 
592
  SetCurrent(Get(currentItem));
666
593
  Display();
667
594
  SetHelp(NULL, NULL, NULL, NULL);
668
595
}