Solving issue 2341: "Pipette and flat curves - no line colors"

This commit is contained in:
Hombre
2014-04-23 22:22:34 +02:00
parent 0fde2ec06d
commit 402c5a6af9
7 changed files with 89 additions and 40 deletions

View File

@@ -23,14 +23,43 @@ class CurveEditor;
class CurveListener {
private:
bool multi;
private:
bool multi;
public:
CurveListener() : multi(false) {}
virtual ~CurveListener() {}
virtual void curveChanged () {}
virtual void curveChanged (CurveEditor* ce) {}
void setMulti(bool value) { multi = value; }
bool isMulti() { return multi; }
CurveListener() : multi(false) {}
/** @brief Blend pipette values from its different channels into a single value
If the buffer has more than one channel and one channel, this method will blend them together.
@param chan1 first channel's value
@param chan2 second channel's value
@param chan3 third channel's value
@return the blended value */
virtual float blendPipetteValues(float chan1, float chan2, float chan3) {
float retVal = 0.f;
int n = 0;
if (chan1 != -1.f) {
retVal += chan1;
++n;
}
if (chan2 != -1.f) {
retVal += chan2;
++n;
}
if (chan3 != -1.f) {
retVal += chan3;
++n;
}
if (n>1)
retVal /= n;
else if (!n)
retVal = -1.f;
return retVal;
}
};
#endif