[haiku-commits] r37322 - haiku/trunk/src/apps/overlayimage

  • From: humdingerb@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 30 Jun 2010 20:04:25 +0200 (CEST)

Author: humdinger
Date: 2010-06-30 20:04:25 +0200 (Wed, 30 Jun 2010)
New Revision: 37322
Changeset: http://dev.haiku-os.org/changeset/37322/haiku

Modified:
   haiku/trunk/src/apps/overlayimage/OverlayApp.h
   haiku/trunk/src/apps/overlayimage/OverlayView.cpp
   haiku/trunk/src/apps/overlayimage/OverlayView.h
   haiku/trunk/src/apps/overlayimage/OverlayWindow.cpp
   haiku/trunk/src/apps/overlayimage/OverlayWindow.h
Log:
Moved the instructions from tool tip to a text view.

Modified: haiku/trunk/src/apps/overlayimage/OverlayApp.h
===================================================================
--- haiku/trunk/src/apps/overlayimage/OverlayApp.h      2010-06-30 17:39:36 UTC 
(rev 37321)
+++ haiku/trunk/src/apps/overlayimage/OverlayApp.h      2010-06-30 18:04:25 UTC 
(rev 37322)
@@ -23,7 +23,7 @@
 public:
                                        OverlayApp();
 private:
-               BCatalog        fCatalog;                               
+               BCatalog        fCatalog;
 };
 
 #endif // OVERLAY_APP_H

Modified: haiku/trunk/src/apps/overlayimage/OverlayView.cpp
===================================================================
--- haiku/trunk/src/apps/overlayimage/OverlayView.cpp   2010-06-30 17:39:36 UTC 
(rev 37321)
+++ haiku/trunk/src/apps/overlayimage/OverlayView.cpp   2010-06-30 18:04:25 UTC 
(rev 37322)
@@ -13,9 +13,15 @@
 
 #include "OverlayView.h"
 
+#include <Catalog.h>
 #include <InterfaceDefs.h>
+#include <Locale.h>
+#include <String.h>
 #include <TextView.h>
 
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "Main window"
+
 const float kDraggerSize = 7;
        
 
@@ -25,13 +31,26 @@
 {
        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 @@
                {
                        if (fReplicated)
                                break;
-
+                       
                        entry_ref ref;
                        msg->FindRef("refs", &ref);
                        BEntry entry(&ref);
@@ -79,6 +98,11 @@
                        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 @@
 {
        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();
 }

Modified: haiku/trunk/src/apps/overlayimage/OverlayView.h
===================================================================
--- haiku/trunk/src/apps/overlayimage/OverlayView.h     2010-06-30 17:39:36 UTC 
(rev 37321)
+++ haiku/trunk/src/apps/overlayimage/OverlayView.h     2010-06-30 18:04:25 UTC 
(rev 37322)
@@ -42,6 +42,7 @@
 private:
        BBitmap                         *fBitmap;
        bool                            fReplicated;
+       BTextView                       *fText;
 };
 
 #endif // OVERLAY_VIEW_H

Modified: haiku/trunk/src/apps/overlayimage/OverlayWindow.cpp
===================================================================
--- haiku/trunk/src/apps/overlayimage/OverlayWindow.cpp 2010-06-30 17:39:36 UTC 
(rev 37321)
+++ haiku/trunk/src/apps/overlayimage/OverlayWindow.cpp 2010-06-30 18:04:25 UTC 
(rev 37322)
@@ -18,7 +18,6 @@
 #include <Catalog.h>
 #include <Locale.h>
 #include <String.h>
-#include <TextView.h>
 
 #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 @@
        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);
 }
 
 

Modified: haiku/trunk/src/apps/overlayimage/OverlayWindow.h
===================================================================
--- haiku/trunk/src/apps/overlayimage/OverlayWindow.h   2010-06-30 17:39:36 UTC 
(rev 37321)
+++ haiku/trunk/src/apps/overlayimage/OverlayWindow.h   2010-06-30 18:04:25 UTC 
(rev 37322)
@@ -14,6 +14,7 @@
 #ifndef OVERLAY_WINDOW_H
 #define OVERLAY_WINDOW_H
 
+#include <TextView.h>
 #include <Window.h>
 
 


Other related posts:

  • » [haiku-commits] r37322 - haiku/trunk/src/apps/overlayimage - humdingerb