don't send a message on mouse down and mouve moved

correctly set "be:channel_changed"
correctly set "be:current_channel" with SetCurrentChannel()
correctly set "be:value"


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20388 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2007-03-17 18:25:27 +00:00
parent 15a62f7c61
commit 789b86ec6c
2 changed files with 15 additions and 19 deletions

View File

@ -263,14 +263,12 @@ BChannelControl::InvokeChannel(BMessage *msg, int32 fromChannel,
invokeMessage.AddInt32("be:current_channel", fCurrentChannel);
if (channelCount == -1)
if (channelCount < 0)
channelCount = fChannelCount - fromChannel;
for (int32 i = fromChannel; i < fromChannel + channelCount; i++) {
invokeMessage.AddInt32("be:channel_value", fChannelValues[i]);
// TODO: Fix this: just send "be:channel_changed" = true
// for channels which have changed their values.
invokeMessage.AddBool("be:channel_changed", true);
for (int32 i = 0; i < channelCount; i++) {
invokeMessage.AddInt32("be:channel_value", fChannelValues[fromChannel + i]);
invokeMessage.AddBool("be:channel_changed", inMask ? inMask[i] : true);
}
return BControl::Invoke(&invokeMessage);
@ -417,7 +415,8 @@ BChannelControl::SetAllValue(int32 values)
delete[] fChannelValues;
fChannelValues = newValues;
BControl::SetValue(fChannelValues[fCurrentChannel]);
return B_OK;
}

View File

@ -272,6 +272,7 @@ BChannelSlider::MouseDown(BPoint where)
// Click was on a slider.
if (frame.Contains(where)) {
fCurrentChannel = channel;
SetCurrentChannel(channel);
break;
}
}
@ -626,18 +627,15 @@ void
BChannelSlider::FinishChange()
{
if (fInitialValues != NULL) {
if (fAllChannels) {
// TODO: Iterate through the list of channels, and invoke only
// for changed values ?
InvokeChannel();
} else {
if (ValueList()[fCurrentChannel] != fInitialValues[fCurrentChannel]) {
SetValueFor(fCurrentChannel, ValueList()[fCurrentChannel]);
Invoke();
}
bool *inMask = NULL;
int32 numChannels = CountChannels();
if (!fAllChannels) {
inMask = new bool[CountChannels()];
for (int i=0; i<numChannels; i++)
inMask[i] = false;
inMask[fCurrentChannel] = true;
}
InvokeChannel(NULL, 0, numChannels, inMask);
}
SetTracking(false);
@ -822,7 +820,6 @@ BChannelSlider::MouseMovedCommon(BPoint point, BPoint point2)
else
SetValueFor(fCurrentChannel, value);
InvokeNotifyChannel(ModificationMessage());
DrawThumbs();
}