summaryrefslogtreecommitdiff
path: root/soundsetmenu.c
blob: fc6ee30aa2bdbe3064965d3407ba65df95c1cacb (plain)
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
/*
 * sndctl  -  a plugin for the Video Disk Recorder
 *        file: soundsetmenu.c
 * description: the sound set editor menu
 *
 *      author: Thomas Hildebrandt <toxym@web.de>
 *
 * inspired by and reengineered from 'avolctl'
 * thanks to Martin Prochnow <nordlichtl@martins-kabuff.de>
 */

#include "defaults.h"
#include "soundsetmenu.h"
#include "menuitems.h"
#include "soundset.h"

/*********************************************************
 * member functions for class cSoundsetMenuSndctl
 *********************************************************/

/*
 * constructors
 */
cSoundsetMenuSndctl::cSoundsetMenuSndctl( cSoundSet *SoundSet, string ActiveSoundSet ){
  string title;

  // save parameter
  soundset = SoundSet;
  isActive = soundset->GetID() == ActiveSoundSet;

  // set titel
  title = string( tr(SNDCTL_TXT_0006));
  title.append( " - " );
  title.append( soundset->GetName());
  SetTitle( title.c_str());

  // get initial values
  name = strdup( soundset->GetName().c_str());

  // add content
  Set();
}

/*
 * makes setup menu entries
 */
void cSoundsetMenuSndctl::Set( void ){
  vector<cControlId>           controls;
  vector<cControlId>::iterator it;

  // sound set name
  Add( new cMenuEditStrItem( tr( SNDCTL_TXT_0008 ), name, 20, tr(FileNameChars)));

  // one entry for every control
  controls = soundset->GetControls();
  cControlId *lastId = NULL;
  for( it = controls.begin(); it != controls.end(); it++ ) {
    if (lastId == NULL || lastId->getSoundCardId() != it->getSoundCardId())
      Add (new cOsdItem(it->getSoundCardId().c_str(), osUnknown, false));
    lastId = it.base();
    Add( new cSoundSetControlItem( soundset, *it, isActive ));
  }
}

/*
 * stores changed values
 */
void cSoundsetMenuSndctl::Store( void ){
  // name
  soundset->Set( string( "name" ), string( name ));
}