WIP: Create the about dialog once, hide and show, Quit() when object is destroyed.

This commit is contained in:
John Scipione
2012-11-12 23:57:25 -05:00
parent 0046f44436
commit 5b0cd98792
11 changed files with 196 additions and 165 deletions
+3
View File
@@ -24,6 +24,8 @@ class BAboutWindow : public BWindow {
const char* signature); const char* signature);
virtual ~BAboutWindow(); virtual ~BAboutWindow();
virtual bool QuitRequested();
void AddDescription(const char* description); void AddDescription(const char* description);
void AddCopyright(int32 firstCopyrightYear, void AddCopyright(int32 firstCopyrightYear,
const char* copyrightHolder, const char* copyrightHolder,
@@ -40,6 +42,7 @@ class BAboutWindow : public BWindow {
private: private:
AboutView* fAboutView; AboutView* fAboutView;
BHandler* fCaller;
}; };
#endif // B_ABOUT_WINDOW_H #endif // B_ABOUT_WINDOW_H
+3 -16
View File
@@ -8,17 +8,19 @@
#include <stdlib.h> #include <stdlib.h>
#include <AboutWindow.h>
#include <Application.h> #include <Application.h>
#include "ActivityWindow.h" #include "ActivityWindow.h"
const char* kAppName = B_TRANSLATE_SYSTEM_NAME("ActivityMonitor");
const char* kSignature = "application/x-vnd.Haiku-ActivityMonitor"; const char* kSignature = "application/x-vnd.Haiku-ActivityMonitor";
ActivityMonitor::ActivityMonitor() ActivityMonitor::ActivityMonitor()
: BApplication(kSignature) : BApplication(kSignature)
{ {
fWindow = new ActivityWindow();
} }
@@ -30,7 +32,6 @@ ActivityMonitor::~ActivityMonitor()
void void
ActivityMonitor::ReadyToRun() ActivityMonitor::ReadyToRun()
{ {
fWindow = new ActivityWindow();
fWindow->Show(); fWindow->Show();
} }
@@ -52,20 +53,6 @@ ActivityMonitor::MessageReceived(BMessage* message)
void void
ActivityMonitor::AboutRequested() ActivityMonitor::AboutRequested()
{ {
ShowAbout();
}
/*static*/ void
ActivityMonitor::ShowAbout()
{
const char* kAuthors[] = {
"Axel Dörfler",
NULL
};
BAboutWindow aboutWindow(B_TRANSLATE_SYSTEM_NAME("ActivityMonitor"), 2008, kAuthors);
aboutWindow.Show();
} }
+2 -3
View File
@@ -9,8 +9,9 @@
#include <Application.h> #include <Application.h>
#include <Catalog.h> #include <Catalog.h>
class BMessage;
class ActivityWindow; class ActivityWindow;
class BMessage;
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "ActivityWindow" #define B_TRANSLATION_CONTEXT "ActivityWindow"
@@ -28,8 +29,6 @@ public:
virtual void AboutRequested(); virtual void AboutRequested();
static void ShowAbout();
private: private:
ActivityWindow* fWindow; ActivityWindow* fWindow;
}; };
+8 -1
View File
@@ -12,6 +12,7 @@
#include <vector> #include <vector>
#ifdef __HAIKU__ #ifdef __HAIKU__
# include <AboutWindow.h>
# include <AbstractLayoutItem.h> # include <AbstractLayoutItem.h>
# include <ControlLook.h> # include <ControlLook.h>
#endif #endif
@@ -175,6 +176,7 @@ const uint32 kMsgToggleDataSource = 'tgds';
const uint32 kMsgToggleLegend = 'tglg'; const uint32 kMsgToggleLegend = 'tglg';
const uint32 kMsgUpdateResolution = 'ures'; const uint32 kMsgUpdateResolution = 'ures';
extern const char* kAppName;
extern const char* kSignature; extern const char* kSignature;
@@ -598,6 +600,8 @@ ActivityView::~ActivityView()
{ {
delete fOffscreen; delete fOffscreen;
delete fSystemInfoHandler; delete fSystemInfoHandler;
fAboutWindow->Quit();
} }
@@ -614,6 +618,9 @@ ActivityView::_Init(const BMessage* settings)
#endif #endif
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
fAboutWindow = new BAboutWindow(kAppName, kSignature);
fAboutWindow->AddCopyright(2008, "Haiku, Inc.");
fLastRefresh = 0; fLastRefresh = 0;
fDrawResolution = 1; fDrawResolution = 1;
fZooming = false; fZooming = false;
@@ -1104,7 +1111,7 @@ ActivityView::MessageReceived(BMessage* message)
switch (message->what) { switch (message->what) {
case B_ABOUT_REQUESTED: case B_ABOUT_REQUESTED:
ActivityMonitor::ShowAbout(); fAboutWindow->Show();
break; break;
case kMsgUpdateResolution: case kMsgUpdateResolution:
+4 -1
View File
@@ -16,6 +16,8 @@
#include "CircularBuffer.h" #include "CircularBuffer.h"
#include "DataSource.h" #include "DataSource.h"
class BAboutWindow;
class BBitmap; class BBitmap;
class BMessageRunner; class BMessageRunner;
class Scale; class Scale;
@@ -23,7 +25,6 @@ class SystemInfoHandler;
class ViewHistory; class ViewHistory;
struct data_item; struct data_item;
class DataHistory { class DataHistory {
public: public:
DataHistory(bigtime_t memorize, bigtime_t interval); DataHistory(bigtime_t memorize, bigtime_t interval);
@@ -145,6 +146,8 @@ private:
int32 fOriginalResolution; int32 fOriginalResolution;
SystemInfoHandler* fSystemInfoHandler; SystemInfoHandler* fSystemInfoHandler;
std::map<scale_type, ::Scale*> fScales; std::map<scale_type, ::Scale*> fScales;
BAboutWindow* fAboutWindow;
}; };
#endif // ACTIVITY_VIEW_H #endif // ACTIVITY_VIEW_H
+6 -6
View File
@@ -22,6 +22,7 @@
#include <FindDirectory.h> #include <FindDirectory.h>
#include <Path.h> #include <Path.h>
#include "CalcView.h"
#include "CalcWindow.h" #include "CalcWindow.h"
@@ -29,9 +30,9 @@
#define B_TRANSLATION_CONTEXT "CalcApplication" #define B_TRANSLATION_CONTEXT "CalcApplication"
static const char* kSettingsFileName = "DeskCalc_settings"; static const char* kSettingsFileName = "DeskCalc_settings";
const char* kAppName = B_TRANSLATE_SYSTEM_NAME("DeskCalc"); const char* kAppName = B_TRANSLATE_SYSTEM_NAME("DeskCalc");
const char* kAppSig = "application/x-vnd.Haiku-DeskCalc"; const char* kSignature = "application/x-vnd.Haiku-DeskCalc";
static const float kDefaultWindowWidth = 220.0; static const float kDefaultWindowWidth = 220.0;
static const float kDefaultWindowHeight = 140.0; static const float kDefaultWindowHeight = 140.0;
@@ -39,7 +40,7 @@ static const float kDefaultWindowHeight = 140.0;
CalcApplication::CalcApplication() CalcApplication::CalcApplication()
: :
BApplication(kAppSig), BApplication(kSignature),
fCalcWindow(NULL) fCalcWindow(NULL)
{ {
} }
@@ -67,8 +68,7 @@ CalcApplication::ReadyToRun()
void void
CalcApplication::AboutRequested() CalcApplication::AboutRequested()
{ {
// TODO: implement me! fCalcWindow->View()->MessageReceived(new BMessage(B_ABOUT_REQUESTED));
return BApplication::AboutRequested();
} }
+1 -1
View File
@@ -16,7 +16,7 @@
extern const char* kAppName; extern const char* kAppName;
extern const char* kAppSig; extern const char* kSignature;
class BFile; class BFile;
class CalcWindow; class CalcWindow;
+101 -108
View File
@@ -138,24 +138,10 @@ CalcView::CalcView(BRect frame, rgb_color rgbBaseColor, BMessage* settings)
fAudioFeedbackItem(NULL), fAudioFeedbackItem(NULL),
fOptions(new CalcOptions()) fOptions(new CalcOptions())
{ {
// create expression text view
fExpressionTextView = new ExpressionTextView(_ExpressionRect(), this);
AddChild(fExpressionTextView);
// read data from archive
_LoadSettings(settings);
// tell the app server not to erase our b/g // tell the app server not to erase our b/g
SetViewColor(B_TRANSPARENT_32_BIT); SetViewColor(B_TRANSPARENT_32_BIT);
// parse calculator description _Init(settings);
_ParseCalcDesc(fKeypadDescription);
// colorize based on base color.
_Colorize();
// Fetch the calc icon for compact view
_FetchAppIcon(fCalcIcon);
} }
@@ -188,15 +174,7 @@ CalcView::CalcView(BMessage* archive)
// Do not restore the follow mode, in shelfs, we never follow. // Do not restore the follow mode, in shelfs, we never follow.
SetResizingMode(B_FOLLOW_NONE); SetResizingMode(B_FOLLOW_NONE);
// create expression text view _Init(archive);
fExpressionTextView = new ExpressionTextView(_ExpressionRect(), this);
AddChild(fExpressionTextView);
// read data from archive
_LoadSettings(archive);
// Fetch the calc icon for compact view
_FetchAppIcon(fCalcIcon);
} }
@@ -205,6 +183,8 @@ CalcView::~CalcView()
delete fKeypad; delete fKeypad;
delete fOptions; delete fOptions;
free(fKeypadDescription); free(fKeypadDescription);
fAboutWindow->Quit();
} }
@@ -288,7 +268,7 @@ CalcView::MessageReceived(BMessage* message)
// (replicant) about box requested // (replicant) about box requested
case B_ABOUT_REQUESTED: case B_ABOUT_REQUESTED:
AboutRequested(); fAboutWindow->Show();
break; break;
case MSG_UNFLASH_KEY: case MSG_UNFLASH_KEY:
@@ -296,6 +276,7 @@ CalcView::MessageReceived(BMessage* message)
int32 key; int32 key;
if (message->FindInt32("key", &key) == B_OK) if (message->FindInt32("key", &key) == B_OK)
_FlashKey(key, 0); _FlashKey(key, 0);
break; break;
} }
@@ -709,20 +690,6 @@ CalcView::FrameResized(float width, float height)
} }
void
CalcView::AboutRequested()
{
const char* extraCopyrights[] = {
"1997, 1998 R3 Software Ltd.",
NULL
};
BAboutWindow* about = new BAboutWindow(kAppName, kAppSig);
about->AddCopyright(2006, "Haiku, Inc.", extraCopyrights);
about->Show();
}
status_t status_t
CalcView::Archive(BMessage* archive, bool deep) const CalcView::Archive(BMessage* archive, bool deep) const
{ {
@@ -735,7 +702,7 @@ CalcView::Archive(BMessage* archive, bool deep) const
// save app signature for replicant add-on loading // save app signature for replicant add-on loading
if (ret == B_OK) if (ret == B_OK)
ret = archive->AddString("add_on", kAppSig); ret = archive->AddString("add_on", kSignature);
// save all the options // save all the options
if (ret == B_OK) if (ret == B_OK)
@@ -816,73 +783,6 @@ CalcView::Paste(BMessage* message)
} }
status_t
CalcView::_LoadSettings(BMessage* archive)
{
if (!archive)
return B_BAD_VALUE;
// record calculator description
const char* calcDesc;
if (archive->FindString("calcDesc", &calcDesc) < B_OK)
calcDesc = kKeypadDescriptionBasic;
// save calculator description for reference
free(fKeypadDescription);
fKeypadDescription = strdup(calcDesc);
// read grid dimensions
if (archive->FindInt16("cols", &fColumns) < B_OK)
fColumns = 5;
if (archive->FindInt16("rows", &fRows) < B_OK)
fRows = 4;
// read color scheme
const rgb_color* color;
ssize_t size;
if (archive->FindData("rgbBaseColor", B_RGB_COLOR_TYPE,
(const void**)&color, &size) < B_OK
|| size != sizeof(rgb_color)) {
fBaseColor = ui_color(B_PANEL_BACKGROUND_COLOR);
puts("Missing rgbBaseColor from CalcView archive!\n");
} else {
fBaseColor = *color;
}
if (archive->FindData("rgbDisplay", B_RGB_COLOR_TYPE,
(const void**)&color, &size) < B_OK
|| size != sizeof(rgb_color)) {
fExpressionBGColor = (rgb_color){ 0, 0, 0, 255 };
puts("Missing rgbBaseColor from CalcView archive!\n");
} else {
fExpressionBGColor = *color;
}
// load options
fOptions->LoadSettings(archive);
// load display text
const char* display;
if (archive->FindString("displayText", &display) < B_OK) {
puts("Missing expression text from CalcView archive.\n");
} else {
// init expression text
fExpressionTextView->SetText(display);
}
// load expression history
fExpressionTextView->LoadSettings(archive);
// parse calculator description
_ParseCalcDesc(fKeypadDescription);
// colorize based on base color.
_Colorize();
return B_OK;
}
status_t status_t
CalcView::SaveSettings(BMessage* archive) const CalcView::SaveSettings(BMessage* archive) const
{ {
@@ -1068,6 +968,99 @@ CalcView::SetKeypadMode(uint8 mode)
// #pragma mark - // #pragma mark -
void
CalcView::_Init(BMessage* settings)
{
// create the about window
const char* extraCopyrights[] = {
"1997, 1998 R3 Software Ltd.",
NULL
};
fAboutWindow = new BAboutWindow(kAppName, kSignature);
fAboutWindow->AddCopyright(2006, "Haiku, Inc.",
extraCopyrights);
// create expression text view
fExpressionTextView = new ExpressionTextView(_ExpressionRect(), this);
AddChild(fExpressionTextView);
// read data from archive
_LoadSettings(settings);
// fetch the calc icon for compact view
_FetchAppIcon(fCalcIcon);
}
status_t
CalcView::_LoadSettings(BMessage* archive)
{
if (!archive)
return B_BAD_VALUE;
// record calculator description
const char* calcDesc;
if (archive->FindString("calcDesc", &calcDesc) < B_OK)
calcDesc = kKeypadDescriptionBasic;
// save calculator description for reference
free(fKeypadDescription);
fKeypadDescription = strdup(calcDesc);
// read grid dimensions
if (archive->FindInt16("cols", &fColumns) < B_OK)
fColumns = 5;
if (archive->FindInt16("rows", &fRows) < B_OK)
fRows = 4;
// read color scheme
const rgb_color* color;
ssize_t size;
if (archive->FindData("rgbBaseColor", B_RGB_COLOR_TYPE,
(const void**)&color, &size) < B_OK
|| size != sizeof(rgb_color)) {
fBaseColor = ui_color(B_PANEL_BACKGROUND_COLOR);
puts("Missing rgbBaseColor from CalcView archive!\n");
} else {
fBaseColor = *color;
}
if (archive->FindData("rgbDisplay", B_RGB_COLOR_TYPE,
(const void**)&color, &size) < B_OK
|| size != sizeof(rgb_color)) {
fExpressionBGColor = (rgb_color){ 0, 0, 0, 255 };
puts("Missing rgbBaseColor from CalcView archive!\n");
} else {
fExpressionBGColor = *color;
}
// load options
fOptions->LoadSettings(archive);
// load display text
const char* display;
if (archive->FindString("displayText", &display) < B_OK) {
puts("Missing expression text from CalcView archive.\n");
} else {
// init expression text
fExpressionTextView->SetText(display);
}
// load expression history
fExpressionTextView->LoadSettings(archive);
// parse calculator description
_ParseCalcDesc(fKeypadDescription);
// colorize based on base color.
_Colorize();
return B_OK;
}
void void
CalcView::_ParseCalcDesc(const char* keypadDescription) CalcView::_ParseCalcDesc(const char* keypadDescription)
{ {
@@ -1372,7 +1365,7 @@ void
CalcView::_FetchAppIcon(BBitmap* into) CalcView::_FetchAppIcon(BBitmap* into)
{ {
entry_ref appRef; entry_ref appRef;
status_t status = be_roster->FindApp(kAppSig, &appRef); status_t status = be_roster->FindApp(kSignature, &appRef);
if (status == B_OK) { if (status == B_OK) {
BFile file(&appRef, B_READ_ONLY); BFile file(&appRef, B_READ_ONLY);
BAppFileInfo appInfo(&file); BAppFileInfo appInfo(&file);
+6 -5
View File
@@ -34,6 +34,7 @@ static const float kMaximumHeightBasic = 400.0f;
class BAboutWindow; class BAboutWindow;
class BString; class BString;
class BMenuItem; class BMenuItem;
class BMessage;
class BPopUpMenu; class BPopUpMenu;
class CalcOptions; class CalcOptions;
class CalcOptionsWindow; class CalcOptionsWindow;
@@ -64,9 +65,6 @@ class CalcView : public BView {
virtual void ResizeTo(float width, float height); virtual void ResizeTo(float width, float height);
virtual void FrameResized(float width, float height); virtual void FrameResized(float width, float height);
// Present about box for view (replicant).
virtual void AboutRequested();
// Archive this view. // Archive this view.
virtual status_t Archive(BMessage* archive, bool deep) const; virtual status_t Archive(BMessage* archive, bool deep) const;
@@ -102,6 +100,8 @@ class CalcView : public BView {
void SetKeypadMode(uint8 mode); void SetKeypadMode(uint8 mode);
private: private:
void _Init(BMessage* settings);
status_t _LoadSettings(BMessage* archive);
void _ParseCalcDesc(const char* keypadDescription); void _ParseCalcDesc(const char* keypadDescription);
void _PressKey(int key); void _PressKey(int key);
@@ -121,8 +121,6 @@ class CalcView : public BView {
void _FetchAppIcon(BBitmap* into); void _FetchAppIcon(BBitmap* into);
status_t _LoadSettings(BMessage* archive);
// grid dimensions // grid dimensions
int16 fColumns; int16 fColumns;
int16 fRows; int16 fRows;
@@ -165,6 +163,9 @@ class CalcView : public BView {
// calculator options. // calculator options.
CalcOptions* fOptions; CalcOptions* fOptions;
// about window for replicant
BAboutWindow* fAboutWindow;
}; };
#endif // _CALC_VIEW_H #endif // _CALC_VIEW_H
+2
View File
@@ -31,6 +31,8 @@ class CalcWindow : public BWindow {
void SetFrame(BRect frame, void SetFrame(BRect frame,
bool forceCenter = false); bool forceCenter = false);
CalcView* View() const { return fCalcView; };
private: private:
CalcView* fCalcView; CalcView* fCalcView;
}; };
+60 -24
View File
@@ -31,6 +31,7 @@
#include <SystemCatalog.h> #include <SystemCatalog.h>
#include <TextView.h> #include <TextView.h>
#include <View.h> #include <View.h>
#include <Window.h>
static const float kStripeWidth = 30.0; static const float kStripeWidth = 30.0;
@@ -80,8 +81,12 @@ StripeView::StripeView(BBitmap* icon)
BView("StripeView", B_WILL_DRAW), BView("StripeView", B_WILL_DRAW),
fIcon(icon) fIcon(icon)
{ {
SetExplicitMinSize(BSize(160.0, B_SIZE_UNSET)); float width = 48.0f;
SetExplicitPreferredSize(BSize(160.0, B_SIZE_UNLIMITED)); if (icon != NULL)
width += icon->Bounds().Width() - 16.0f;
SetExplicitMinSize(BSize(width, B_SIZE_UNSET));
SetExplicitPreferredSize(BSize(width, B_SIZE_UNLIMITED));
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
} }
@@ -233,7 +238,7 @@ AboutView::AppIcon(const char* signature)
BAboutWindow::BAboutWindow(const char* appName, int32 firstCopyrightYear, BAboutWindow::BAboutWindow(const char* appName, int32 firstCopyrightYear,
const char** authors, const char* extraInfo) const char** authors, const char* extraInfo)
: BWindow(BRect(0.0, 0.0, 300.0, 140.0), appName, B_TITLED_WINDOW, : BWindow(BRect(0.0, 0.0, 200.0, 140.0), appName, B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
| B_AUTO_UPDATE_SIZE_LIMITS) | B_AUTO_UPDATE_SIZE_LIMITS)
{ {
@@ -261,6 +266,19 @@ BAboutWindow::~BAboutWindow()
} }
bool
BAboutWindow::QuitRequested()
{
while (!IsHidden())
Hide();
return false;
}
// #pragma mark -
void void
BAboutWindow::AddDescription(const char* description) BAboutWindow::AddDescription(const char* description)
{ {
@@ -270,8 +288,11 @@ BAboutWindow::AddDescription(const char* description)
const char* appDesc = B_TRANSLATE_MARK(description); const char* appDesc = B_TRANSLATE_MARK(description);
appDesc = gSystemCatalog.GetString(appDesc, "AboutWindow"); appDesc = gSystemCatalog.GetString(appDesc, "AboutWindow");
BString desc(appDesc); BString desc("");
desc << "\n\n"; if (fAboutView->InfoView()->TextLength() > 0)
desc << "\n\n";
desc << appDesc;
fAboutView->InfoView()->Insert(desc.String()); fAboutView->InfoView()->Insert(desc.String());
} }
@@ -281,10 +302,7 @@ void
BAboutWindow::AddCopyright(int32 firstCopyrightYear, BAboutWindow::AddCopyright(int32 firstCopyrightYear,
const char* copyrightHolder, const char** extraCopyrights) const char* copyrightHolder, const char** extraCopyrights)
{ {
BString copyright(B_UTF8_COPYRIGHT " %years%"); BString copyright(B_UTF8_COPYRIGHT " %years% %holder%");
if (copyrightHolder != NULL)
copyright << " " << copyrightHolder;
const char* firstCopyright = B_TRANSLATE_MARK(copyright.String()); const char* firstCopyright = B_TRANSLATE_MARK(copyright.String());
firstCopyright = gSystemCatalog.GetString(copyright, "AboutWindow"); firstCopyright = gSystemCatalog.GetString(copyright, "AboutWindow");
@@ -298,23 +316,29 @@ BAboutWindow::AddCopyright(int32 firstCopyrightYear,
if (copyrightYears != currentYear) if (copyrightYears != currentYear)
copyrightYears << "-" << currentYear; copyrightYears << "-" << currentYear;
BString text(firstCopyright); BString text("");
if (fAboutView->InfoView()->TextLength() > 0)
text << "\n\n";
// Replace the copyright year with the current year text << firstCopyright;
// Fill out the copyright year placeholder
text.ReplaceAll("%years%", copyrightYears.String()); text.ReplaceAll("%years%", copyrightYears.String());
// Fill in the copyright holder placeholder
text.ReplaceAll("%holder%", copyrightHolder);
// Add extra copyright strings // Add extra copyright strings
if (extraCopyrights != NULL) { if (extraCopyrights != NULL) {
// Add optional extra copyright information // Add optional extra copyright information
for (int32 i = 0; extraCopyrights[i]; i++) for (int32 i = 0; extraCopyrights[i]; i++)
text << "\n" << B_UTF8_COPYRIGHT << " " << extraCopyrights[i]; text << "\n" << B_UTF8_COPYRIGHT << " " << extraCopyrights[i];
} }
text << "\n";
const char* allRightsReserved = B_TRANSLATE_MARK("All Rights Reserved."); const char* allRightsReserved = B_TRANSLATE_MARK("All Rights Reserved.");
allRightsReserved = gSystemCatalog.GetString(allRightsReserved, allRightsReserved = gSystemCatalog.GetString(allRightsReserved,
"AboutWindow"); "AboutWindow");
text << " " << allRightsReserved << "\n\n"; text << "\n " << allRightsReserved;
fAboutView->InfoView()->Insert(text.String()); fAboutView->InfoView()->Insert(text.String());
} }
@@ -329,11 +353,14 @@ BAboutWindow::AddAuthors(const char** authors)
const char* writtenBy = B_TRANSLATE_MARK("Written by:"); const char* writtenBy = B_TRANSLATE_MARK("Written by:");
writtenBy = gSystemCatalog.GetString(writtenBy, "AboutWindow"); writtenBy = gSystemCatalog.GetString(writtenBy, "AboutWindow");
BString text(writtenBy); BString text("");
if (fAboutView->InfoView()->TextLength() > 0)
text << "\n\n";
text << writtenBy;
text << "\n"; text << "\n";
for (int32 i = 0; authors[i]; i++) for (int32 i = 0; authors[i]; i++)
text << " " << authors[i] << "\n"; text << " " << authors[i] << "\n";
text << "\n";
fAboutView->InfoView()->Insert(text.String()); fAboutView->InfoView()->Insert(text.String());
} }
@@ -348,11 +375,13 @@ BAboutWindow::AddSpecialThanks(const char** thanks)
const char* specialThanks = B_TRANSLATE_MARK("Special Thanks:"); const char* specialThanks = B_TRANSLATE_MARK("Special Thanks:");
specialThanks = gSystemCatalog.GetString(specialThanks, "AboutWindow"); specialThanks = gSystemCatalog.GetString(specialThanks, "AboutWindow");
BString text(specialThanks); BString text("");
text << "\n"; if (fAboutView->InfoView()->TextLength() > 0)
text << "\n\n";
text << specialThanks << "\n";
for (int32 i = 0; thanks[i]; i++) for (int32 i = 0; thanks[i]; i++)
text << " " << thanks[i] << "\n"; text << " " << thanks[i] << "\n";
text << "\n";
fAboutView->InfoView()->Insert(text.String()); fAboutView->InfoView()->Insert(text.String());
} }
@@ -366,11 +395,14 @@ BAboutWindow::AddVersionHistory(const char** history)
const char* versionHistory = B_TRANSLATE_MARK("Version history:"); const char* versionHistory = B_TRANSLATE_MARK("Version history:");
versionHistory = gSystemCatalog.GetString(versionHistory, "AboutWindow"); versionHistory = gSystemCatalog.GetString(versionHistory, "AboutWindow");
BString text(versionHistory);
text << "\n"; BString text("");
if (fAboutView->InfoView()->TextLength() > 0)
text << "\n\n";
text << versionHistory << "\n";
for (int32 i = 0; history[i]; i++) for (int32 i = 0; history[i]; i++)
text << " " << history[i] << "\n"; text << " " << history[i] << "\n";
text << "\n";
fAboutView->InfoView()->Insert(text.String()); fAboutView->InfoView()->Insert(text.String());
} }
@@ -385,8 +417,11 @@ BAboutWindow::AddExtraInfo(const char* extraInfo)
const char* appExtraInfo = B_TRANSLATE_MARK(extraInfo); const char* appExtraInfo = B_TRANSLATE_MARK(extraInfo);
appExtraInfo = gSystemCatalog.GetString(extraInfo, "AboutWindow"); appExtraInfo = gSystemCatalog.GetString(extraInfo, "AboutWindow");
BString extra(appExtraInfo); BString extra("");
extra << "\n"; if (fAboutView->InfoView()->TextLength() > 0)
extra << "\n\n";
extra << appExtraInfo;
fAboutView->InfoView()->Insert(extra.String()); fAboutView->InfoView()->Insert(extra.String());
} }
@@ -409,7 +444,8 @@ BAboutWindow::AboutPosition(float width, float height)
result.x = screenFrame.left + (screenFrame.Width() / 2.0) - (width / 2.0); result.x = screenFrame.left + (screenFrame.Width() / 2.0) - (width / 2.0);
// This is probably sooo wrong, but it looks right on 1024 x 768 // This is probably sooo wrong, but it looks right on 1024 x 768
result.y = screenFrame.top + (screenFrame.Height() / 4.0) - ceil(height / 3.0); result.y = screenFrame.top + (screenFrame.Height() / 4.0)
- ceil(height / 3.0);
return result; return result;
} }