+39
-11
@@ -26,15 +26,10 @@
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
TShowBit *tsbb;
|
||||
static TShowBit *tsbb;
|
||||
static long niter = 256;
|
||||
static uchar palette[256];
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
long niter = 256;
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
uchar palette[256];
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
void TShowBit::MouseDown(BPoint where)
|
||||
{
|
||||
@@ -54,7 +49,41 @@ void TShowBit::MouseDown(BPoint where)
|
||||
redraw_mand();
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
TShowBit::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch(message->what) {
|
||||
case B_MOUSE_WHEEL_CHANGED:
|
||||
{
|
||||
//float factor = 1;
|
||||
float change = message->FindFloat("be:wheel_delta_y");
|
||||
BPoint where;
|
||||
GetMouse(&where, 0, 0);
|
||||
|
||||
selection = Bounds();
|
||||
|
||||
if (change < 0) {
|
||||
// zoom in
|
||||
selection.top = (where.y + selection.top) / 2;
|
||||
selection.bottom = (where.y + selection.bottom) / 2;
|
||||
selection.left = (where.x + selection.left) / 2;
|
||||
selection.right = (where.x + selection.right) / 2;
|
||||
} else {
|
||||
// zoom out
|
||||
selection.top = - where.y + selection.top * 2;
|
||||
selection.bottom = - where.y + selection.bottom * 2;
|
||||
selection.left = - where.x + selection.left * 2;
|
||||
selection.right = - where.x + selection.right * 2;
|
||||
}
|
||||
redraw_mand();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TShowBit::redraw_mand()
|
||||
{
|
||||
@@ -66,8 +95,7 @@ void TShowBit::redraw_mand()
|
||||
px -= (scale / 2.0);
|
||||
py -= (scale / 2.0);
|
||||
scale *= 2.0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
px0 = px + (scale * (selection.left / (1.0*size_x)));
|
||||
py0 = py + (scale * (selection.top / (1.0*size_x)));
|
||||
scale0 = scale * ((selection.bottom-selection.top) / (1.0*size_x));
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
virtual ~TShowBit();
|
||||
virtual void Draw(BRect);
|
||||
virtual void MouseDown(BPoint where);
|
||||
void MessageReceived(BMessage* message);
|
||||
virtual void Pulse();
|
||||
void mand(double vx, double vy, double sx, double sy);
|
||||
long limit_v(long v);
|
||||
|
||||
Reference in New Issue
Block a user