Fix #5809 by making the context menu sticky and also offsetting the open point

by 5 pixels. Add a check so that multiple context menus aren't opened.

Also don't draw a 0 x 0 selection rect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36799 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood
2010-05-13 03:43:05 +00:00
parent 36c176518b
commit 016233a96c
+7 -3
View File
@@ -1021,6 +1021,7 @@ ShowImageView::Draw(BRect updateRect)
void void
ShowImageView::_DrawSelectionBox() ShowImageView::_DrawSelectionBox()
{ {
if (fSelectionRect.Height() > 0.0 && fSelectionRect.Width() > 0.0) {
BRect r(fSelectionRect); BRect r(fSelectionRect);
_ConstrainToImage(r); _ConstrainToImage(r);
r = _ImageToView(r); r = _ImageToView(r);
@@ -1035,6 +1036,7 @@ ShowImageView::_DrawSelectionBox()
StrokeLine(BPoint(r.left, r.top+1), BPoint(r.left, r.bottom-1), fPatternDown); StrokeLine(BPoint(r.left, r.top+1), BPoint(r.left, r.bottom-1), fPatternDown);
PopState(); PopState();
} }
}
void void
@@ -1780,16 +1782,18 @@ ShowImageView::_MouseWheelChanged(BMessage *msg)
void void
ShowImageView::_ShowPopUpMenu(BPoint screen) ShowImageView::_ShowPopUpMenu(BPoint screen)
{ {
BPopUpMenu* menu = new PopUpMenu("PopUpMenu", this); if (!fShowingPopUpMenu) {
PopUpMenu* menu = new PopUpMenu("PopUpMenu", this);
ShowImageWindow* showImage = dynamic_cast<ShowImageWindow*>(Window()); ShowImageWindow* showImage = dynamic_cast<ShowImageWindow*>(Window());
if (showImage) if (showImage)
showImage->BuildContextMenu(menu); showImage->BuildContextMenu(menu);
screen -= BPoint(10, 10); screen += BPoint(5, 5);
menu->Go(screen, true, false, true); menu->Go(screen, true, true, true);
fShowingPopUpMenu = true; fShowingPopUpMenu = true;
} }
}
void void