From 227fb2b11c9fa888bb04964c233e6398e7f5d36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 25 Aug 2007 17:34:43 +0000 Subject: [PATCH] * use Ryan's new BAboutWindow class (also removed the hint that this app originally was a birthday present for Ingo... hope he is Ok with that) * fixed ticket #1424, now it uses three empty buttons for new pads * cloned pads are now opened at an offset, otherwise one wouldn't have any visual feedback that something happened with a cloned pad on top of the original git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22055 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/launchbox/App.cpp | 22 ++++++++++++--------- src/apps/launchbox/Jamfile | 4 +++- src/apps/launchbox/MainWindow.cpp | 32 ++++++++++++++++++++++++++----- src/apps/launchbox/MainWindow.h | 9 +++++---- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/src/apps/launchbox/App.cpp b/src/apps/launchbox/App.cpp index 9eef31b166..bfb8dd56b0 100644 --- a/src/apps/launchbox/App.cpp +++ b/src/apps/launchbox/App.cpp @@ -6,9 +6,12 @@ * Stephan Aßmus */ + +#include "App.h" + #include -#include +#include #include #include #include @@ -17,7 +20,6 @@ #include "MainWindow.h" -#include "App.h" // constructor App::App() @@ -73,7 +75,7 @@ App::ReadyToRun() } if (!windowAdded) { - MainWindow* window = new MainWindow("Pad 1", frame); + MainWindow* window = new MainWindow("Pad 1", frame, true); window->Show(); } } @@ -85,11 +87,13 @@ App::MessageReceived(BMessage* message) switch (message->what) { case MSG_ADD_WINDOW: { BMessage* settings = new BMessage('sett'); - message->FindMessage("window", settings); + bool wasCloned = message->FindMessage("window", settings) == B_OK; BString name("Pad "); name << CountWindows() + 1; MainWindow* window = new MainWindow(name.String(), - BRect(50.0, 50.0, 65.0, 100.0), settings); + BRect(50.0, 50.0, 65.0, 100.0), settings); + if (wasCloned) + window->MoveBy(10, 10); window->Show(); break; } @@ -103,8 +107,8 @@ App::MessageReceived(BMessage* message) void App::AboutRequested() { - (new BAlert("about", "LaunchBox by stippi\n\n" - "for bonefish\n\n\n" - "v1.1.0", - "Neat", NULL, NULL))->Go(NULL); + const char* authors[2]; + authors[0] = "Stephan Aßmus (aka stippi)"; + authors[1] = NULL; + (new BAboutWindow("LaunchBox", 2004, authors))->Show(); } diff --git a/src/apps/launchbox/Jamfile b/src/apps/launchbox/Jamfile index ceec9c4234..4f188011d6 100644 --- a/src/apps/launchbox/Jamfile +++ b/src/apps/launchbox/Jamfile @@ -2,6 +2,8 @@ SubDir HAIKU_TOP src apps launchbox ; AddSubDirSupportedPlatforms libbe_test ; +UsePrivateHeaders shared ; + Application LaunchBox : App.cpp IconButton.cpp @@ -12,7 +14,7 @@ Application LaunchBox : PadView.cpp Panel.cpp support.cpp - : be translation + : be translation libshared.a : LaunchBox.rdef ; diff --git a/src/apps/launchbox/MainWindow.cpp b/src/apps/launchbox/MainWindow.cpp index ad46b7d302..2820c25aeb 100644 --- a/src/apps/launchbox/MainWindow.cpp +++ b/src/apps/launchbox/MainWindow.cpp @@ -27,7 +27,7 @@ #include "PadView.h" // constructor -MainWindow::MainWindow(const char* name, BRect frame) +MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons) : BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE @@ -36,15 +36,19 @@ MainWindow::MainWindow(const char* name, BRect frame) fSettings(new BMessage('sett')), fPadView(new PadView("pad view")), fLastID(0), - fNamePanelFrame(-1000.0, -1000.0, -900.0, -900.0), + fNamePanelFrame(-1000.0, -1000.0, -800.0, -900.0), fAutoRaise(false), fShowOnAllWorkspaces(true) { bool buttonsAdded = false; if (load_settings(fSettings, "main_settings", "LaunchBox") >= B_OK) buttonsAdded = LoadSettings(fSettings); - if (!buttonsAdded) - _AddDefaultButtons(); + if (!buttonsAdded) { + if (addDefaultButtons) + _AddDefaultButtons(); + else + _AddEmptyButtons(); + } SetLayout(new BGroupLayout(B_HORIZONTAL)); AddChild(fPadView); @@ -65,7 +69,7 @@ MainWindow::MainWindow(const char* name, BRect frame, BMessage* settings) fShowOnAllWorkspaces(true) { if (!LoadSettings(settings)) - _AddDefaultButtons(); + _AddEmptyButtons(); SetLayout(new BGroupLayout(B_HORIZONTAL)); AddChild(fPadView); @@ -474,6 +478,7 @@ MainWindow::_AdjustLocation(BRect frame) ResizeTo(frame.Width(), frame.Height()); } +// _AddDefaultButtons void MainWindow::_AddDefaultButtons() { @@ -514,4 +519,21 @@ MainWindow::_AddDefaultButtons() button->SetTo("application/x-vnd.Haiku-Terminal", true); } +// _AddEmptyButtons +void +MainWindow::_AddEmptyButtons() +{ + LaunchButton* button = new LaunchButton("launch button", fLastID++, NULL, + new BMessage(MSG_LAUNCH)); + fPadView->AddButton(button); + + button = new LaunchButton("launch button", fLastID++, NULL, + new BMessage(MSG_LAUNCH)); + fPadView->AddButton(button); + + button = new LaunchButton("launch button", fLastID++, NULL, + new BMessage(MSG_LAUNCH)); + fPadView->AddButton(button); +} + diff --git a/src/apps/launchbox/MainWindow.h b/src/apps/launchbox/MainWindow.h index e7198d3430..dcda3fa6b8 100644 --- a/src/apps/launchbox/MainWindow.h +++ b/src/apps/launchbox/MainWindow.h @@ -27,10 +27,10 @@ enum { class MainWindow : public BWindow { public: - MainWindow(const char* name, - BRect frame); - MainWindow(const char* name, - BRect frame, BMessage* settings); + MainWindow(const char* name, BRect frame, + bool addDefaultButtons = false); + MainWindow(const char* name, BRect frame, + BMessage* settings); virtual ~MainWindow(); // BWindow interface @@ -63,6 +63,7 @@ class MainWindow : public BWindow { void _GetLocation(); void _AdjustLocation(BRect frame); void _AddDefaultButtons(); + void _AddEmptyButtons(); BMessage* fSettings; PadView* fPadView;