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
+6 -7
View File
@@ -263,14 +263,12 @@ BChannelControl::InvokeChannel(BMessage *msg, int32 fromChannel,
invokeMessage.AddInt32("be:current_channel", fCurrentChannel); invokeMessage.AddInt32("be:current_channel", fCurrentChannel);
if (channelCount == -1) if (channelCount < 0)
channelCount = fChannelCount - fromChannel; channelCount = fChannelCount - fromChannel;
for (int32 i = fromChannel; i < fromChannel + channelCount; i++) { for (int32 i = 0; i < channelCount; i++) {
invokeMessage.AddInt32("be:channel_value", fChannelValues[i]); invokeMessage.AddInt32("be:channel_value", fChannelValues[fromChannel + i]);
// TODO: Fix this: just send "be:channel_changed" = true invokeMessage.AddBool("be:channel_changed", inMask ? inMask[i] : true);
// for channels which have changed their values.
invokeMessage.AddBool("be:channel_changed", true);
} }
return BControl::Invoke(&invokeMessage); return BControl::Invoke(&invokeMessage);
@@ -417,7 +415,8 @@ BChannelControl::SetAllValue(int32 values)
delete[] fChannelValues; delete[] fChannelValues;
fChannelValues = newValues; fChannelValues = newValues;
BControl::SetValue(fChannelValues[fCurrentChannel]);
return B_OK; return B_OK;
} }
+9 -12
View File
@@ -272,6 +272,7 @@ BChannelSlider::MouseDown(BPoint where)
// Click was on a slider. // Click was on a slider.
if (frame.Contains(where)) { if (frame.Contains(where)) {
fCurrentChannel = channel; fCurrentChannel = channel;
SetCurrentChannel(channel);
break; break;
} }
} }
@@ -626,18 +627,15 @@ void
BChannelSlider::FinishChange() BChannelSlider::FinishChange()
{ {
if (fInitialValues != NULL) { if (fInitialValues != NULL) {
if (fAllChannels) { bool *inMask = NULL;
// TODO: Iterate through the list of channels, and invoke only int32 numChannels = CountChannels();
// for changed values ? if (!fAllChannels) {
inMask = new bool[CountChannels()];
InvokeChannel(); for (int i=0; i<numChannels; i++)
inMask[i] = false;
} else { inMask[fCurrentChannel] = true;
if (ValueList()[fCurrentChannel] != fInitialValues[fCurrentChannel]) {
SetValueFor(fCurrentChannel, ValueList()[fCurrentChannel]);
Invoke();
}
} }
InvokeChannel(NULL, 0, numChannels, inMask);
} }
SetTracking(false); SetTracking(false);
@@ -822,7 +820,6 @@ BChannelSlider::MouseMovedCommon(BPoint point, BPoint point2)
else else
SetValueFor(fCurrentChannel, value); SetValueFor(fCurrentChannel, value);
InvokeNotifyChannel(ModificationMessage());
DrawThumbs(); DrawThumbs();
} }