Now reacts to color drops. Tested with Zeta prefs and ArtPaint palette.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25028 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -618,10 +618,10 @@ ActivityView::FrameResized(float /*width*/, float /*height*/)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ActivityView::_UpdateOffscreenBitmap()
|
ActivityView::_UpdateOffscreenBitmap(bool force)
|
||||||
{
|
{
|
||||||
BRect frame = _HistoryFrame();
|
BRect frame = _HistoryFrame();
|
||||||
if (fOffscreen != NULL && frame == fOffscreen->Bounds())
|
if (!force && fOffscreen != NULL && frame == fOffscreen->Bounds())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
delete fOffscreen;
|
delete fOffscreen;
|
||||||
@@ -716,6 +716,28 @@ ActivityView::MouseMoved(BPoint where, uint32 transit,
|
|||||||
void
|
void
|
||||||
ActivityView::MessageReceived(BMessage* message)
|
ActivityView::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
|
// if a color is dropped, use it as background
|
||||||
|
if (message->WasDropped()) {
|
||||||
|
rgb_color *color;
|
||||||
|
ssize_t size;
|
||||||
|
if ((message->FindData("RGBColor",
|
||||||
|
B_RGB_COLOR_TYPE, 0, (const void **)&color, &size) == B_OK) &&
|
||||||
|
size == sizeof(rgb_color)) {
|
||||||
|
//message->PrintToStream();
|
||||||
|
BPoint dropPoint, dropOffset;
|
||||||
|
dropPoint = message->DropPoint(&dropOffset);
|
||||||
|
ConvertFromScreen(&dropPoint);
|
||||||
|
dropPoint += dropOffset;
|
||||||
|
if (_HistoryFrame().Contains(dropPoint)) {
|
||||||
|
fBackgroundColor = *color;
|
||||||
|
_UpdateOffscreenBitmap(true);
|
||||||
|
} else {
|
||||||
|
// XXX: check each legend color box ?
|
||||||
|
SetLowColor(*color);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} // else try the switch or BView::
|
||||||
|
}
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case B_ABOUT_REQUESTED:
|
case B_ABOUT_REQUESTED:
|
||||||
ActivityMonitor::ShowAbout();
|
ActivityMonitor::ShowAbout();
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void _Init(const BMessage* settings);
|
void _Init(const BMessage* settings);
|
||||||
void _Refresh();
|
void _Refresh();
|
||||||
void _UpdateOffscreenBitmap();
|
void _UpdateOffscreenBitmap(bool force=false);
|
||||||
void _UpdateFrame();
|
void _UpdateFrame();
|
||||||
BRect _HistoryFrame() const;
|
BRect _HistoryFrame() const;
|
||||||
float _LegendHeight() const;
|
float _LegendHeight() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user