From 75e72331626465252b62fb5ee0d5b40f822244df Mon Sep 17 00:00:00 2001 From: Joachim Seemer Date: Wed, 30 Jun 2010 18:04:25 +0000 Subject: [PATCH] Moved the instructions from tool tip to a text view. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37322 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/overlayimage/OverlayApp.h | 2 +- src/apps/overlayimage/OverlayView.cpp | 39 ++++++++++++++++++++----- src/apps/overlayimage/OverlayView.h | 1 + src/apps/overlayimage/OverlayWindow.cpp | 11 +------ src/apps/overlayimage/OverlayWindow.h | 1 + 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/apps/overlayimage/OverlayApp.h b/src/apps/overlayimage/OverlayApp.h index 37ba2b89b4..4d6c8478ea 100644 --- a/src/apps/overlayimage/OverlayApp.h +++ b/src/apps/overlayimage/OverlayApp.h @@ -23,7 +23,7 @@ class OverlayApp : public BApplication { public: OverlayApp(); private: - BCatalog fCatalog; + BCatalog fCatalog; }; #endif // OVERLAY_APP_H diff --git a/src/apps/overlayimage/OverlayView.cpp b/src/apps/overlayimage/OverlayView.cpp index 9b4be6e01f..e45a4eb417 100644 --- a/src/apps/overlayimage/OverlayView.cpp +++ b/src/apps/overlayimage/OverlayView.cpp @@ -13,9 +13,15 @@ #include "OverlayView.h" +#include #include +#include +#include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "Main window" + const float kDraggerSize = 7; @@ -25,13 +31,26 @@ OverlayView::OverlayView(BRect frame) { fBitmap = NULL; fReplicated = false; - + frame.left = frame.right - kDraggerSize; frame.top = frame.bottom - kDraggerSize; BDragger *dragger = new BDragger(frame, this, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); AddChild(dragger); SetViewColor(B_TRANSPARENT_COLOR); + + fText = new BTextView(Bounds(), "bgView", Bounds(), B_FOLLOW_ALL, B_WILL_DRAW); + fText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + AddChild(fText); + BString text; + text << B_TRANSLATE( + "Enable \"Show replicants\" in Deskbar.\n" + "Drag & drop an image.\n" + "Drag the replicant to the Desktop."); + fText->SetText(text); + fText->SetAlignment(B_ALIGN_CENTER); + fText->MakeSelectable(false); + fText->MoveBy(0, (Bounds().bottom - fText->TextRect().bottom) / 2); } @@ -69,7 +88,7 @@ OverlayView::MessageReceived(BMessage *msg) { if (fReplicated) break; - + entry_ref ref; msg->FindRef("refs", &ref); BEntry entry(&ref); @@ -79,6 +98,11 @@ OverlayView::MessageReceived(BMessage *msg) fBitmap = BTranslationUtils::GetBitmap(path.Path()); if (fBitmap != NULL) { + if (fText != NULL) { + RemoveChild(fText); + fText = NULL; + } + BRect rect = fBitmap->Bounds(); if (!fReplicated) Window()->ResizeTo(rect.right, rect.bottom); @@ -129,18 +153,19 @@ OverlayView::OverlayAboutRequested() { BAlert *alert = new BAlert("about", "OverlayImage\n" - "Copyright 1999-2010" "\n\n\t" - "originally by Seth Flaxman" "\n\t" - "modified by Hartmuth Reh" "\n\t" - "further modified by Humdinger" "\n", + "Copyright 1999-2010\n\n\t" + "originally by Seth Flaxman\n\t" + "modified by Hartmuth Reh\n\t" + "further modified by Humdinger\n", "OK"); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); - font.SetSize(font.Size() + 4); + font.SetSize(font.Size() + 7.0f); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 12, &font); + alert->Go(); } diff --git a/src/apps/overlayimage/OverlayView.h b/src/apps/overlayimage/OverlayView.h index 4f2427f028..a456321391 100644 --- a/src/apps/overlayimage/OverlayView.h +++ b/src/apps/overlayimage/OverlayView.h @@ -42,6 +42,7 @@ public: private: BBitmap *fBitmap; bool fReplicated; + BTextView *fText; }; #endif // OVERLAY_VIEW_H diff --git a/src/apps/overlayimage/OverlayWindow.cpp b/src/apps/overlayimage/OverlayWindow.cpp index 81f433d61f..7b94527988 100644 --- a/src/apps/overlayimage/OverlayWindow.cpp +++ b/src/apps/overlayimage/OverlayWindow.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #undef B_TRANSLATE_CONTEXT #define B_TRANSLATE_CONTEXT "Main window" @@ -26,7 +25,7 @@ OverlayWindow::OverlayWindow() : - BWindow(BRect(100, 100, 450, 350), "OverlayImage", + BWindow(BRect(50, 50, 500, 200), "OverlayImage", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) { OverlayView *replView = new OverlayView(Bounds()); @@ -35,14 +34,6 @@ OverlayWindow::OverlayWindow() BView *bgView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW); bgView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(bgView); - - BString text; - text << B_TRANSLATE("Enable \"Show replicants\" in Deskbar."); - text << "\n"; - text << B_TRANSLATE("Drag & drop an image."); - text << "\n"; - text << B_TRANSLATE("Drag the replicant to the Desktop."); - replView->SetToolTip(text); } diff --git a/src/apps/overlayimage/OverlayWindow.h b/src/apps/overlayimage/OverlayWindow.h index 7a0c6b5c34..f04ac5e722 100644 --- a/src/apps/overlayimage/OverlayWindow.h +++ b/src/apps/overlayimage/OverlayWindow.h @@ -14,6 +14,7 @@ #ifndef OVERLAY_WINDOW_H #define OVERLAY_WINDOW_H +#include #include