From 037e5cee4829aba31914a39548418a7a435d8439 Mon Sep 17 00:00:00 2001 From: Ryan Leavengood Date: Fri, 14 Aug 2009 07:11:49 +0000 Subject: [PATCH] Implemented pretty much all of #4190. The Enter key was actually already set as a shortcut for fullscreen, but I guess the view was processing it first. So I just removed B_ENTER as an option for next image. Also Shift plus primary mouse was already working for moving the image. Also I know it was discussed at length but I still wonder if all these options for next and previous image are overkill. Now there is no way to scroll with the keyboard. And there isn't an easy way to go to the next image with the mouse (menus are a pain.) So I still think some more UI tweaking is needed to avoid constant shifting between mouse and keyboard. Finally I also added Command-1 as a shortcut for Original Size, but it does not work. Anyone know why? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32343 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/showimage/ShowImageView.cpp | 24 ++++++++++++------------ src/apps/showimage/ShowImageWindow.cpp | 12 +++++------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/apps/showimage/ShowImageView.cpp b/src/apps/showimage/ShowImageView.cpp index e862eb694f..1182ac57e2 100644 --- a/src/apps/showimage/ShowImageView.cpp +++ b/src/apps/showimage/ShowImageView.cpp @@ -1648,20 +1648,11 @@ ShowImageView::KeyDown(const char* bytes, int32 numBytes) switch (*bytes) { case B_DOWN_ARROW: - _ScrollRestrictedBy(0, 10); - break; - case B_UP_ARROW: - _ScrollRestrictedBy(0, -10); - break; - case B_LEFT_ARROW: - _ScrollRestrictedBy(-10, 0); - break; case B_RIGHT_ARROW: - _ScrollRestrictedBy(10, 0); - break; - case B_ENTER: _SendMessageToWindow(MSG_FILE_NEXT); break; + case B_UP_ARROW: + case B_LEFT_ARROW: case B_BACKSPACE: _SendMessageToWindow(MSG_FILE_PREV); break; @@ -1725,7 +1716,16 @@ ShowImageView::_MouseWheelChanged(BMessage *msg) if (msg->FindFloat("be:wheel_delta_y", &dy) == B_OK) y = dy * kscrollBy; - _ScrollRestrictedBy(x, y); + if (modifiers() & B_SHIFT_KEY) + _ScrollRestrictedBy(x, y); + else if (modifiers() & B_COMMAND_KEY) + _ScrollRestrictedBy(y, x); + else { + if (dy < 0) + ZoomIn(); + else if (dy > 0) + ZoomOut(); + } } diff --git a/src/apps/showimage/ShowImageWindow.cpp b/src/apps/showimage/ShowImageWindow.cpp index ebd275d532..15a3360f35 100644 --- a/src/apps/showimage/ShowImageWindow.cpp +++ b/src/apps/showimage/ShowImageWindow.cpp @@ -272,7 +272,7 @@ ShowImageWindow::_BuildViewMenu(BMenu *menu, bool popupMenu) menu->AddSeparatorItem(); - _AddItemMenu(menu, "Original Size", MSG_ORIGINAL_SIZE, 0, 0, this); + _AddItemMenu(menu, "Original Size", MSG_ORIGINAL_SIZE, '1', 0, this); _AddItemMenu(menu, "Zoom In", MSG_ZOOM_IN, '+', 0, this); _AddItemMenu(menu, "Zoom Out", MSG_ZOOM_OUT, '-', 0, this); @@ -287,11 +287,9 @@ ShowImageWindow::_BuildViewMenu(BMenu *menu, bool popupMenu) menu->AddSeparatorItem(); - _AddItemMenu(menu, "Full Screen", MSG_FULL_SCREEN, 'F', 0, this); + _AddItemMenu(menu, "Full Screen", MSG_FULL_SCREEN, B_ENTER, 0, this); _MarkMenuItem(menu, MSG_FULL_SCREEN, fFullScreen); - AddShortcut(B_ENTER, 0, new BMessage(MSG_FULL_SCREEN)); - _AddItemMenu(menu, "Show Caption in Full Screen Mode", MSG_SHOW_CAPTION, 0, 0, this); _MarkMenuItem(menu, MSG_SHOW_CAPTION, fShowCaption); @@ -337,7 +335,7 @@ ShowImageWindow::AddMenus(BMenuBar *bar) _AddItemMenu(menu, "Close", B_QUIT_REQUESTED, 'W', 0, this); menu->AddSeparatorItem(); _AddItemMenu(menu, "Page Setup" B_UTF8_ELLIPSIS, MSG_PAGE_SETUP, 0, 0, this); - _AddItemMenu(menu, "_Print" B_UTF8_ELLIPSIS, MSG_PREPARE_PRINT, 'P', 0, this); + _AddItemMenu(menu, "Print" B_UTF8_ELLIPSIS, MSG_PREPARE_PRINT, 'P', 0, this); menu->AddSeparatorItem(); _AddItemMenu(menu, "About ShowImage" B_UTF8_ELLIPSIS, B_ABOUT_REQUESTED, 0, 0, be_app); @@ -370,8 +368,8 @@ ShowImageWindow::AddMenus(BMenuBar *bar) bar->AddItem(menu); menu = new BMenu("Image"); - _AddItemMenu(menu, "Rotate Counterclockwise", MSG_ROTATE_270, '[', 0, this); - _AddItemMenu(menu, "Rotate Clockwise", MSG_ROTATE_90, ']', 0, this); + _AddItemMenu(menu, "Rotate Clockwise", MSG_ROTATE_90, 'R', 0, this); + _AddItemMenu(menu, "Rotate Counterclockwise", MSG_ROTATE_270, 'R', B_SHIFT_KEY, this); menu->AddSeparatorItem(); _AddItemMenu(menu, "Flip Left to Right", MSG_FLIP_LEFT_TO_RIGHT, 0, 0, this); _AddItemMenu(menu, "Flip Top to Bottom", MSG_FLIP_TOP_TO_BOTTOM, 0, 0, this);