Added synchronous mouse support (shouldn't I lock the window ? why does it work without locking ?), now the thumb bitmap is drawn with B_OP_OVER, thus eliminating a visual glitch.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12504 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -269,41 +269,49 @@ BChannelSlider::MouseDown(BPoint where)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fCurrentChannel != -1) {
|
// Click wasn't on a slider.
|
||||||
uint32 buttons = 0;
|
if (fCurrentChannel == -1)
|
||||||
BMessage *currentMessage = Window()->CurrentMessage();
|
return;
|
||||||
if (currentMessage != NULL)
|
|
||||||
currentMessage->FindInt32("buttons", (int32 *)&buttons);
|
|
||||||
|
|
||||||
fAllChannels = (buttons & B_SECONDARY_MOUSE_BUTTON) == 0;
|
uint32 buttons = 0;
|
||||||
|
BMessage *currentMessage = Window()->CurrentMessage();
|
||||||
if (fInitialValues != NULL && fAllChannels) {
|
if (currentMessage != NULL)
|
||||||
delete[] fInitialValues;
|
currentMessage->FindInt32("buttons", (int32 *)&buttons);
|
||||||
fInitialValues = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fInitialValues == NULL)
|
|
||||||
fInitialValues = new int32[CountChannels()];
|
|
||||||
|
|
||||||
if (fAllChannels) {
|
|
||||||
for (int32 i = 0; i < CountChannels(); i++)
|
|
||||||
fInitialValues[i] = ValueFor(i);
|
|
||||||
} else
|
|
||||||
fInitialValues[fCurrentChannel] = ValueFor(fCurrentChannel);
|
|
||||||
|
|
||||||
if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) {
|
|
||||||
if (!IsTracking()) {
|
|
||||||
SetTracking(true);
|
|
||||||
DrawThumbs();
|
|
||||||
Flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseMovedCommon(where, where);
|
fAllChannels = (buttons & B_SECONDARY_MOUSE_BUTTON) == 0;
|
||||||
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
|
|
||||||
|
if (fInitialValues != NULL && fAllChannels) {
|
||||||
} else {
|
delete[] fInitialValues;
|
||||||
debugger("BChannelSlider::MouseDown(): SYNCHRONOUS CONTROLS NOT YET SUPPORTED");
|
fInitialValues = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fInitialValues == NULL)
|
||||||
|
fInitialValues = new int32[CountChannels()];
|
||||||
|
|
||||||
|
if (fAllChannels) {
|
||||||
|
for (int32 i = 0; i < CountChannels(); i++)
|
||||||
|
fInitialValues[i] = ValueFor(i);
|
||||||
|
} else
|
||||||
|
fInitialValues[fCurrentChannel] = ValueFor(fCurrentChannel);
|
||||||
|
|
||||||
|
if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) {
|
||||||
|
if (!IsTracking()) {
|
||||||
|
SetTracking(true);
|
||||||
|
DrawThumbs();
|
||||||
|
Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseMovedCommon(where, B_ORIGIN);
|
||||||
|
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
|
||||||
|
} else {
|
||||||
|
do {
|
||||||
|
snooze(30000);
|
||||||
|
GetMouse(&where, &buttons);
|
||||||
|
MouseMovedCommon(where, B_ORIGIN);
|
||||||
|
} while (buttons != 0);
|
||||||
|
FinishChange();
|
||||||
|
fCurrentChannel = -1;
|
||||||
|
fAllChannels = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -474,25 +482,26 @@ BChannelSlider::DrawThumb(BView *into, int32 channel, BPoint where, bool pressed
|
|||||||
where.x -= bitmapBounds.right / 2;
|
where.x -= bitmapBounds.right / 2;
|
||||||
where.y -= bitmapBounds.bottom / 2;
|
where.y -= bitmapBounds.bottom / 2;
|
||||||
|
|
||||||
into->DrawBitmapAsync(thumb, where);
|
into->PushState();
|
||||||
|
|
||||||
if (pressed) {
|
|
||||||
into->PushState();
|
|
||||||
|
|
||||||
|
into->SetDrawingMode(B_OP_OVER);
|
||||||
|
into->DrawBitmapAsync(thumb, where);
|
||||||
|
|
||||||
|
if (pressed) {
|
||||||
into->SetDrawingMode(B_OP_ALPHA);
|
into->SetDrawingMode(B_OP_ALPHA);
|
||||||
|
|
||||||
rgb_color color = tint_color(into->ViewColor(), B_DARKEN_4_TINT);
|
rgb_color color = tint_color(into->ViewColor(), B_DARKEN_4_TINT);
|
||||||
color.alpha = 128;
|
color.alpha = 128;
|
||||||
into->SetHighColor(color);
|
into->SetHighColor(color);
|
||||||
|
|
||||||
BRect rect(where, where);
|
BRect destRect(where, where);
|
||||||
rect.right += bitmapBounds.right;
|
destRect.right += bitmapBounds.right;
|
||||||
rect.bottom += bitmapBounds.bottom;
|
destRect.bottom += bitmapBounds.bottom;
|
||||||
|
|
||||||
into->FillRect(rect);
|
into->FillRect(destRect);
|
||||||
|
|
||||||
into->PopState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
into->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user