From bef5fffeae877e7a2b825cdb81676f6df0d1fd60 Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Sat, 20 Sep 2008 10:49:00 +0000 Subject: [PATCH] * use B_PNG_FORMAT, thanks Stephan * truncate the path label, since a long path would automatically resize the window to something unusable in that case... Note: somehow the PopUpMenu does ignore a set max column size expanding from small to large leaves some drawing artefacts git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27647 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/screenshot/ScreenshotWindow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/apps/screenshot/ScreenshotWindow.cpp b/src/apps/screenshot/ScreenshotWindow.cpp index 1c02b862ff..3564845e4f 100644 --- a/src/apps/screenshot/ScreenshotWindow.cpp +++ b/src/apps/screenshot/ScreenshotWindow.cpp @@ -59,9 +59,6 @@ enum { }; -const int32 kPNGImageFileType = 1347307296; - - // #pragma mark - DirectoryRefFilter @@ -174,11 +171,14 @@ ScreenshotWindow::MessageReceived(BMessage* message) case B_REFS_RECEIVED: { entry_ref ref; if (message->FindRef("refs", &ref) == B_OK) { - BPath path(&ref); - BMessage* message = new BMessage(kLocationChanged); - message->AddString("path", path.Path()); + BString path(BPath(&ref).Path()); - fLastSelectedPath = new BMenuItem(path.Path(), message); + BMessage* message = new BMessage(kLocationChanged); + message->AddString("path", path.String()); + + fOutputPathMenu->TruncateString(&path, B_TRUNCATE_MIDDLE, + fOutputPathMenu->StringWidth("SomethingLongHere")); + fLastSelectedPath = new BMenuItem(path.String(), message); fLastSelectedPath->SetMarked(true); fOutputPathMenu->AddItem(fLastSelectedPath, @@ -391,7 +391,7 @@ ScreenshotWindow::_SetupTranslatorMenu(BMenu* translatorMenu) if (item && item->Message()) { item->Message()->FindInt32("be:type", &fImageFileType); item->Message()->FindInt32("be:translator", &fTranslator); - if (fImageFileType == kPNGImageFileType) { + if (fImageFileType == B_PNG_FORMAT) { item->SetMarked(true); break; } @@ -581,7 +581,7 @@ ScreenshotWindow::_SaveScreenshot() return; BBitmapStream bitmapStream(fScreenshot); - BTranslatorRoster *roster = BTranslatorRoster::Default(); + BTranslatorRoster* roster = BTranslatorRoster::Default(); roster->Translate(&bitmapStream, NULL, NULL, &file, fImageFileType, B_TRANSLATOR_BITMAP); fScreenshot = NULL; @@ -591,7 +591,7 @@ ScreenshotWindow::_SaveScreenshot() return; int32 numFormats; - const translation_format *formats = NULL; + const translation_format* formats = NULL; if (roster->GetOutputFormats(fTranslator, &formats, &numFormats) != B_OK) return;