Tone: Add 'valueChanged' signal

This commit is contained in:
Jonas Kulla 2014-08-12 21:21:16 +02:00
parent 3550cc0ff5
commit d95e90db34
2 changed files with 11 additions and 0 deletions

View File

@ -180,30 +180,39 @@ void Tone::set(double red, double green, double blue, double gray)
this->gray = gray; this->gray = gray;
updateInternal(); updateInternal();
valueChanged();
} }
void Tone::setRed(double value) void Tone::setRed(double value)
{ {
red = value; red = value;
norm.x = (float) clamp<double>(value, -255, 255) / 255; norm.x = (float) clamp<double>(value, -255, 255) / 255;
valueChanged();
} }
void Tone::setGreen(double value) void Tone::setGreen(double value)
{ {
green = value; green = value;
norm.y = (float) clamp<double>(value, -255, 255) / 255; norm.y = (float) clamp<double>(value, -255, 255) / 255;
valueChanged();
} }
void Tone::setBlue(double value) void Tone::setBlue(double value)
{ {
blue = value; blue = value;
norm.z = (float) clamp<double>(value, -255, 255) / 255; norm.z = (float) clamp<double>(value, -255, 255) / 255;
valueChanged();
} }
void Tone::setGray(double value) void Tone::setGray(double value)
{ {
gray = value; gray = value;
norm.w = (float) clamp<double>(value, 0, 255) / 255; norm.w = (float) clamp<double>(value, 0, 255) / 255;
valueChanged();
} }
/* Serializable */ /* Serializable */

View File

@ -134,6 +134,8 @@ struct Tone : public Serializable
/* Normalized (-1.0 ~ 1.0) */ /* Normalized (-1.0 ~ 1.0) */
Vec4 norm; Vec4 norm;
sigc::signal<void> valueChanged;
}; };
struct Rect : public Serializable struct Rect : public Serializable