void ShowImageWindow::_BuildViewMenu(BMenu *menu, bool popupMenu) { _AddItemMenu(menu, "Slide show", MSG_SLIDE_SHOW, 0, 0, this); _MarkMenuItem(menu, MSG_SLIDE_SHOW, fImageView->SlideShowStarted()); BMenu* delayMenu = new BMenu("Slide delay"); if (fSlideShowDelay == NULL) fSlideShowDelay = delayMenu; delayMenu->SetRadioMode(true); // Note: ShowImage loads images in window thread so it becomes unresponsive // if slide show delay is too short! (Especially if loading the image // takes as long as or longer than the slide show delay). Should load // in background thread! _AddDelayItem(delayMenu, "3 seconds", 3); _AddDelayItem(delayMenu, "4 seconds", 4); _AddDelayItem(delayMenu, "5 seconds", 5); _AddDelayItem(delayMenu, "6 seconds", 6); _AddDelayItem(delayMenu, "7 seconds", 7); _AddDelayItem(delayMenu, "8 seconds", 8); _AddDelayItem(delayMenu, "9 seconds", 9); _AddDelayItem(delayMenu, "10 seconds", 10); _AddDelayItem(delayMenu, "20 seconds", 20); menu->AddItem(delayMenu); menu->AddSeparatorItem(); _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); menu->AddSeparatorItem(); _AddItemMenu(menu, "High-quality zooming", MSG_SCALE_BILINEAR, 0, 0, this); menu->AddSeparatorItem(); _AddItemMenu(menu, "Shrink to window", MSG_SHRINK_TO_WINDOW, 0, 0, this); _AddItemMenu(menu, "Zoom to window", MSG_ZOOM_TO_WINDOW, 0, 0, this); menu->AddSeparatorItem(); _AddItemMenu(menu, "Full screen", MSG_FULL_SCREEN, B_ENTER, 0, this); _MarkMenuItem(menu, MSG_FULL_SCREEN, fFullScreen); _AddItemMenu(menu, "Show caption in full screen mode", MSG_SHOW_CAPTION, 0, 0, this); _MarkMenuItem(menu, MSG_SHOW_CAPTION, fShowCaption); _MarkMenuItem(menu, MSG_SCALE_BILINEAR, fImageView->GetScaleBilinear()); bool shrink, zoom, enabled; shrink = fImageView->GetShrinkToBounds(); zoom = fImageView->GetZoomToBounds(); _MarkMenuItem(menu, MSG_SHRINK_TO_WINDOW, shrink); _MarkMenuItem(menu, MSG_ZOOM_TO_WINDOW, zoom); enabled = !(shrink || zoom); _EnableMenuItem(menu, MSG_ORIGINAL_SIZE, enabled); _EnableMenuItem(menu, MSG_ZOOM_IN, enabled); _EnableMenuItem(menu, MSG_ZOOM_OUT, enabled); if (popupMenu) { menu->AddSeparatorItem(); _AddItemMenu(menu, "Use as background" B_UTF8_ELLIPSIS, MSG_DESKTOP_BACKGROUND, 0, 0, this); } }
void ShowImageWindow::_BuildViewMenu(BMenu* menu, bool popupMenu) { _AddItemMenu(menu, B_TRANSLATE("Slide show"), MSG_SLIDE_SHOW, 0, 0, this); _MarkMenuItem(menu, MSG_SLIDE_SHOW, fSlideShowRunner != NULL); BMenu* delayMenu = new BMenu(B_TRANSLATE("Slide delay")); if (fSlideShowDelayMenu == NULL) fSlideShowDelayMenu = delayMenu; delayMenu->SetRadioMode(true); int32 kDelays[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 20}; for (uint32 i = 0; i < sizeof(kDelays) / sizeof(kDelays[0]); i++) { BString text; BDurationFormat format; text.Truncate(0); format.Format(text, 0, kDelays[i] * 1000000LL); _AddDelayItem(delayMenu, text.String(), kDelays[i] * 1000000LL); } menu->AddItem(delayMenu); menu->AddSeparatorItem(); _AddItemMenu(menu, B_TRANSLATE("Original size"), kMsgOriginalSize, '1', 0, this); _AddItemMenu(menu, B_TRANSLATE("Fit to window"), kMsgFitToWindow, '0', 0, this); _AddItemMenu(menu, B_TRANSLATE("Zoom in"), MSG_ZOOM_IN, '+', 0, this); _AddItemMenu(menu, B_TRANSLATE("Zoom out"), MSG_ZOOM_OUT, '-', 0, this); menu->AddSeparatorItem(); if (!popupMenu || fFullScreen) { _AddItemMenu(menu, B_TRANSLATE("High-quality zooming"), MSG_SCALE_BILINEAR, 0, 0, this); _AddItemMenu(menu, B_TRANSLATE("Stretch to window"), kMsgStretchToWindow, 0, 0, this); menu->AddSeparatorItem(); } _AddItemMenu(menu, B_TRANSLATE("Full screen"), MSG_FULL_SCREEN, B_ENTER, 0, this); _MarkMenuItem(menu, MSG_FULL_SCREEN, fFullScreen); _AddItemMenu(menu, B_TRANSLATE("Show caption in full screen mode"), MSG_SHOW_CAPTION, 0, 0, this); _MarkMenuItem(menu, MSG_SHOW_CAPTION, fShowCaption); _MarkMenuItem(menu, MSG_SCALE_BILINEAR, fImageView->ScaleBilinear()); _MarkMenuItem(menu, kMsgStretchToWindow, fImageView->StretchesToBounds()); if (!popupMenu) { _AddItemMenu(menu, B_TRANSLATE("Show tool bar"), kMsgToggleToolBar, 'B', 0, this); _MarkMenuItem(menu, kMsgToggleToolBar, !fToolBar->IsHidden(fToolBar)); } if (popupMenu) { menu->AddSeparatorItem(); _AddItemMenu(menu, B_TRANSLATE("Use as background" B_UTF8_ELLIPSIS), MSG_DESKTOP_BACKGROUND, 0, 0, this); } }