-/* This is very similar to ARDOUR::ConfigVariable but expects numeric values to
- * be in hexadecimal. This is because it is intended for use with color
- * specifications which are easier to scan for issues in "rrggbbaa" format than
- * as decimals.
- */
-template<class T>
-class ColorVariable : public ARDOUR::ConfigVariableBase
-{
- public:
- ColorVariable (std::string str) : ARDOUR::ConfigVariableBase (str) {}
- ColorVariable (std::string str, T val) : ARDOUR::ConfigVariableBase (str), value (val) {}
-
- bool set (T val) {
- if (val == value) {
- return false;
- }
- value = val;
- return true;
- }
-
- T get() const {
- return value;
- }
-
- std::string get_as_string () const {
- std::stringstream ss;
- ss << std::hex;
- ss.fill('0');
- ss.width(8);
- ss << value;
- return ss.str ();
- }
-
- void set_from_string (std::string const & s) {
- std::stringstream ss;
- ss << std::hex;
- ss << s;
- ss >> value;
- }
-
- protected:
- T get_for_save() { return value; }
- T value;
-};