[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-cvs] enigma/src menus.cc,1.69,1.70
From: |
Ralf Westram <address@hidden> |
Subject: |
[Enigma-cvs] enigma/src menus.cc,1.69,1.70 |
Date: |
Mon, 27 Oct 2003 11:50:04 +0000 |
Update of /cvsroot/enigma/enigma/src
In directory subversions:/tmp/cvs-serv12401/src
Modified Files:
menus.cc
Log Message:
- Derived several classes from ValueButton
Index: menus.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/menus.cc,v
retrieving revision 1.69
retrieving revision 1.70
diff -C2 -d -r1.69 -r1.70
*** menus.cc 22 Oct 2003 21:36:09 -0000 1.69
--- menus.cc 27 Oct 2003 11:50:02 -0000 1.70
***************
*** 428,434 ****
string build_text(int value) const {
! char msg[50];
! sprintf(msg, "Mouse speed: %d", value);
! return msg;
}
public:
--- 428,432 ----
string build_text(int value) const {
! return strf("Mouse speed: %d", value);
}
public:
***************
*** 450,456 ****
}
else {
! char msg[50];
! sprintf(msg, "Sound vol: %d", value);
! return msg;
}
}
--- 448,452 ----
}
else {
! return strf("Sound vol: %d", value);
}
}
***************
*** 471,477 ****
}
else {
! char msg[50];
! sprintf(msg, "Music vol: %d", value);
! return msg;
}
}
--- 467,471 ----
}
else {
! return strf("Music vol: %d", value);
}
}
***************
*** 480,504 ****
};
! class StereoButton : public TextButton {
! void update() {
! if (StereoSeparation == 0)
! set_text("Mono");
! else if (StereoSeparation > 0)
! set_text("Stereo l-r");
! else
! set_text("Stereo r-l");
}
! // ActionListener interface.
! void on_action(Widget *) {
! if (StereoSeparation == 0)
! StereoSeparation = +10.0;
! else if (StereoSeparation > 0)
! StereoSeparation = -10.0;
! else
! StereoSeparation = 0;
! update();
}
public:
! StereoButton() : TextButton("", this) { update(); }
};
--- 474,498 ----
};
! class StereoButton : public ValueButton {
!
! int get_value() const { return StereoSeparation == 0 ? 0 :
(StereoSeparation > 0 ? 1 : -1); }
! void set_value(int value) {
! if (value == 0) StereoSeparation = 0.0;
! else if (value > 0) StereoSeparation = 10.0;
! else StereoSeparation = -10.0;
}
!
! string build_text(int value) const {
! switch (value) {
! case -1: return "Stereo r-l";
! case 0: return "Mono";
! case 1: return "Stereo l-r";
! }
! assert(0);
! return string();
}
+
public:
! StereoButton() : ValueButton("", -1, 1) { update(); }
};
***************
*** 522,529 ****
};
! class SoundSetButton : public TextButton {
! void update() {
string sound_set;
! switch (SoundSet) {
case 0: sound_set = "Default"; break;
case 1: sound_set = "Enigma"; break;
--- 516,541 ----
};
! class SoundSetButton : public ValueButton {
!
! int get_value() const { return SoundSet; }
!
! bool hasSoundSet(int value) {
! if (value<2) return true;
! return oxyd::FoundOxyd(OxydVersion(value-2));
! }
!
! void set_value(int value) {
! int old = SoundSet;
! SoundSet = value;
! if (!hasSoundSet(SoundSet)) {
! if (old < SoundSet) inc_value(1);
! else inc_value(-1);
! return;
! }
! oxyd::ChangeSoundset(SoundSet, -1);
! }
! string build_text(int value) const {
string sound_set;
! switch (value) {
case 0: sound_set = "Default"; break;
case 1: sound_set = "Enigma"; break;
***************
*** 536,567 ****
case OxydVersion_PerOxyd: sound_set = "Per.Oxyd";
break;
default :
! fprintf(stderr, "Invalid soundset %i\n", SoundSet);
break;
}
break;
}
!
! sound_set += " sound";
! set_text(sound_set);
! }
! void on_action(Widget *) {
! ++SoundSet;
! if (SoundSet >= 2) { // test if oxyd pack is installed
! while (1) {
! if ((SoundSet-2) > OxydVersion_Last) {
! SoundSet = 0;
! break;
! }
! if (oxyd::FoundOxyd(OxydVersion(SoundSet-2))) {
! break;
! }
! ++SoundSet;
! }
! }
! oxyd::ChangeSoundset(SoundSet, -1);
! update();
}
public:
! SoundSetButton() : TextButton("", this) { update(); }
};
--- 548,561 ----
case OxydVersion_PerOxyd: sound_set = "Per.Oxyd";
break;
default :
! fprintf(stderr, "Invalid soundset %i\n", value);
break;
}
break;
}
! return sound_set;
}
+
public:
! SoundSetButton() : ValueButton("", 0, int(OxydVersion_PerOxyd)+2) {
update(); }
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Enigma-cvs] enigma/src menus.cc,1.69,1.70,
Ralf Westram <address@hidden> <=