* cleanup, no functional change

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27201 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich
2008-08-25 21:48:06 +00:00
parent ec44f528d8
commit 56b0c7b90d
+26 -15
View File
@@ -155,9 +155,8 @@ ShowImageWindow::ShowImageWindow(const entry_ref *ref,
if (InitCheck() != B_OK) { if (InitCheck() != B_OK) {
BAlert* alert; BAlert* alert;
alert = new BAlert("ShowImage", alert = new BAlert("ShowImage",
"Could not load image! Either the file or an image translator for it does not exist.", "Could not load image! Either the file or an image translator for "
"OK", NULL, NULL, "it does not exist.", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT);
B_WIDTH_AS_USUAL, B_INFO_ALERT);
alert->Go(); alert->Go();
// quit if file could not be opened // quit if file could not be opened
@@ -208,12 +207,14 @@ ShowImageWindow::UpdateTitle()
SetTitle(path.String()); SetTitle(path.String());
} }
void void
ShowImageWindow::BuildContextMenu(BMenu *menu) ShowImageWindow::BuildContextMenu(BMenu *menu)
{ {
BuildViewMenu(menu, true); BuildViewMenu(menu, true);
} }
void void
ShowImageWindow::BuildViewMenu(BMenu *menu, bool popupMenu) ShowImageWindow::BuildViewMenu(BMenu *menu, bool popupMenu)
{ {
@@ -224,9 +225,10 @@ ShowImageWindow::BuildViewMenu(BMenu *menu, bool popupMenu)
fSlideShowDelay = delayMenu; fSlideShowDelay = delayMenu;
delayMenu->SetRadioMode(true); delayMenu->SetRadioMode(true);
// Note: ShowImage loads images in window thread so it becomes unresponsive if // Note: ShowImage loads images in window thread so it becomes unresponsive
// slide show delay is too short! (Especially if loading the image takes as long as // if slide show delay is too short! (Especially if loading the image
// or longer than the slide show delay). Should load in background thread! // takes as long as or longer than the slide show delay). Should load
// in background thread!
AddDelayItem(delayMenu, "Three Seconds", 3); AddDelayItem(delayMenu, "Three Seconds", 3);
AddDelayItem(delayMenu, "Four Second", 4); AddDelayItem(delayMenu, "Four Second", 4);
AddDelayItem(delayMenu, "Five Seconds", 5); AddDelayItem(delayMenu, "Five Seconds", 5);
@@ -260,7 +262,8 @@ ShowImageWindow::BuildViewMenu(BMenu *menu, bool popupMenu)
AddShortcut(B_ENTER, 0, new BMessage(MSG_FULL_SCREEN)); AddShortcut(B_ENTER, 0, new BMessage(MSG_FULL_SCREEN));
AddItemMenu(menu, "Show Caption in Full Screen Mode", MSG_SHOW_CAPTION, 0, 0, 'W', true); AddItemMenu(menu, "Show Caption in Full Screen Mode", MSG_SHOW_CAPTION, 0,
0, 'W', true);
MarkMenuItem(menu, MSG_SHOW_CAPTION, fShowCaption); MarkMenuItem(menu, MSG_SHOW_CAPTION, fShowCaption);
MarkMenuItem(menu, MSG_SCALE_BILINEAR, fImageView->GetScaleBilinear()); MarkMenuItem(menu, MSG_SCALE_BILINEAR, fImageView->GetScaleBilinear());
@@ -279,8 +282,8 @@ ShowImageWindow::BuildViewMenu(BMenu *menu, bool popupMenu)
if (popupMenu) { if (popupMenu) {
menu->AddSeparatorItem(); menu->AddSeparatorItem();
AddItemMenu(menu, "As Desktop Background", MSG_DESKTOP_BACKGROUND, 0, 0,
AddItemMenu(menu, "As Desktop Background", MSG_DESKTOP_BACKGROUND, 0, 0, 'W', true); 'W', true);
} }
} }
@@ -306,7 +309,8 @@ ShowImageWindow::AddMenus(BMenuBar *bar)
AddItemMenu(menu, "Page Setup" B_UTF8_ELLIPSIS, MSG_PAGE_SETUP, 0, 0, 'W', true); AddItemMenu(menu, "Page Setup" B_UTF8_ELLIPSIS, MSG_PAGE_SETUP, 0, 0, 'W', true);
AddItemMenu(menu, "Print" B_UTF8_ELLIPSIS, MSG_PREPARE_PRINT, 0, 0, 'W', true); AddItemMenu(menu, "Print" B_UTF8_ELLIPSIS, MSG_PREPARE_PRINT, 0, 0, 'W', true);
menu->AddSeparatorItem(); menu->AddSeparatorItem();
AddItemMenu(menu, "About ShowImage" B_UTF8_ELLIPSIS, B_ABOUT_REQUESTED, 0, 0, 'A', true); AddItemMenu(menu, "About ShowImage" B_UTF8_ELLIPSIS, B_ABOUT_REQUESTED, 0, 0,
'A', true);
menu->AddSeparatorItem(); menu->AddSeparatorItem();
AddItemMenu(menu, "Quit", B_QUIT_REQUESTED, 'Q', 0, 'A', true); AddItemMenu(menu, "Quit", B_QUIT_REQUESTED, 'Q', 0, 'A', true);
bar->AddItem(menu); bar->AddItem(menu);
@@ -344,10 +348,12 @@ ShowImageWindow::AddMenus(BMenuBar *bar)
menu->AddSeparatorItem(); menu->AddSeparatorItem();
AddItemMenu(menu, "Invert Colors", MSG_INVERT, 0, 0, 'W', true); AddItemMenu(menu, "Invert Colors", MSG_INVERT, 0, 0, 'W', true);
menu->AddSeparatorItem(); menu->AddSeparatorItem();
fResizeItem = AddItemMenu(menu, "Resize" B_UTF8_ELLIPSIS, MSG_OPEN_RESIZER_WINDOW, 0, 0, 'W', true); fResizeItem = AddItemMenu(menu, "Resize" B_UTF8_ELLIPSIS,
MSG_OPEN_RESIZER_WINDOW, 0, 0, 'W', true);
bar->AddItem(menu); bar->AddItem(menu);
menu->AddSeparatorItem(); menu->AddSeparatorItem();
AddItemMenu(menu, "Use as Desktop Background", MSG_DESKTOP_BACKGROUND, 0, 0, 'W', true); AddItemMenu(menu, "Use as Desktop Background", MSG_DESKTOP_BACKGROUND, 0, 0,
'W', true);
} }
@@ -355,7 +361,8 @@ BMenuItem *
ShowImageWindow::AddItemMenu(BMenu *menu, char *caption, uint32 command, ShowImageWindow::AddItemMenu(BMenu *menu, char *caption, uint32 command,
char shortcut, uint32 modifier, char target, bool enabled) char shortcut, uint32 modifier, char target, bool enabled)
{ {
BMenuItem* item = new BMenuItem(caption, new BMessage(command), shortcut, modifier); BMenuItem* item =
new BMenuItem(caption, new BMessage(command), shortcut, modifier);
if (target == 'A') if (target == 'A')
item->SetTarget(be_app); item->SetTarget(be_app);
@@ -399,7 +406,8 @@ ShowImageWindow::WindowRedimension(BBitmap *pbitmap)
const float windowBorderHeight = 5; const float windowBorderHeight = 5;
float width = r.Width() + 2 * PEN_SIZE + B_V_SCROLL_BAR_WIDTH; float width = r.Width() + 2 * PEN_SIZE + B_V_SCROLL_BAR_WIDTH;
float height = r.Height() + 2 * PEN_SIZE + 1 + fBar->Frame().Height() + B_H_SCROLL_BAR_HEIGHT; float height = r.Height() + 2 * PEN_SIZE + 1 + fBar->Frame().Height() +
B_H_SCROLL_BAR_HEIGHT;
// dimensions so that window does not reach outside of screen // dimensions so that window does not reach outside of screen
float maxWidth = screen.Frame().Width() + 1 - windowBorderWidth - Frame().left; float maxWidth = screen.Frame().Width() + 1 - windowBorderWidth - Frame().left;
@@ -1149,6 +1157,7 @@ ShowImageWindow::Print(BMessage *msg)
} }
} }
void void
ShowImageWindow::OpenResizerWindow(int32 width, int32 height) ShowImageWindow::OpenResizerWindow(int32 width, int32 height)
{ {
@@ -1161,6 +1170,7 @@ ShowImageWindow::OpenResizerWindow(int32 width, int32 height)
fResizerWindowMessenger->SendMessage(ResizerWindow::kActivateMsg); fResizerWindowMessenger->SendMessage(ResizerWindow::kActivateMsg);
} }
void void
ShowImageWindow::UpdateResizerWindow(int32 width, int32 height) ShowImageWindow::UpdateResizerWindow(int32 width, int32 height)
{ {
@@ -1175,6 +1185,7 @@ ShowImageWindow::UpdateResizerWindow(int32 width, int32 height)
fResizerWindowMessenger->SendMessage(&updateMsg); fResizerWindowMessenger->SendMessage(&updateMsg);
} }
void void
ShowImageWindow::CloseResizerWindow() ShowImageWindow::CloseResizerWindow()
{ {
@@ -1186,6 +1197,7 @@ ShowImageWindow::CloseResizerWindow()
fResizerWindowMessenger = NULL; fResizerWindowMessenger = NULL;
} }
bool bool
ShowImageWindow::QuitRequested() ShowImageWindow::QuitRequested()
{ {
@@ -1212,4 +1224,3 @@ ShowImageWindow::ScreenChanged(BRect frame, color_space mode)
{ {
fImageView->SetDither(mode == B_CMAP8); fImageView->SetDither(mode == B_CMAP8);
} }