Files
haiku-beta6/src/apps/expander/ExpanderApp.cpp
T
Adrien Destugues be8fa2fb30 * Update all applications in tree to use the new localizing system
* Remove the old one from the locale librairy, with some cleanup
Known regressions :
 * readonlybootprompt will no longer update the locale settings : the 
method used messed with internal undocumented things
 * external localized apps (webpositive for example) will not run 
anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37336 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-07-02 11:36:13 +00:00

105 lines
1.9 KiB
C++

/*
* Copyright 2004-2006, Jérôme DUVAL. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include "ExpanderApp.h"
#include "ExpanderWindow.h"
#include <Alert.h>
#include <Catalog.h>
#include <Locale.h>
#include <TextView.h>
ExpanderApp::ExpanderApp()
: BApplication("application/x-vnd.Haiku-Expander")
{
BPoint windowPosition = fSettings.Message().FindPoint("window_position");
BRect windowFrame(0, 0, 450, 120);
windowFrame.OffsetBy(windowPosition);
BMessage settings(fSettings.Message());
fWindow = new ExpanderWindow(windowFrame, NULL, &settings);
}
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "About"
void
ExpanderApp::AboutRequested()
{
BString appName = B_TRANSLATE("Expander");
int nameLength = appName.CountChars();
BAlert* alert = new BAlert("about",
appName.Append(B_TRANSLATE("\n\twritten by Jérôme Duval\n"
"\tCopyright 2004-2006, Haiku Inc.\n\noriginal Be version by \n"
"Dominic, Hiroshi, Peter, Pavel and Robert\n")),
B_TRANSLATE("OK"));
BTextView* view = alert->TextView();
BFont font;
view->SetStylable(true);
view->GetFont(&font);
font.SetSize(18);
font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, nameLength, &font);
alert->Go();
}
void
ExpanderApp::ReadyToRun()
{
}
void
ExpanderApp::ArgvReceived(int32 argc, char **argv)
{
BMessage* msg = NULL;
for (int32 i = 1; i < argc; i++) {
entry_ref ref;
status_t err = get_ref_for_path(argv[i], &ref);
if (err == B_OK) {
if (!msg) {
msg = new BMessage;
msg->what = B_REFS_RECEIVED;
}
msg->AddRef("refs", &ref);
}
}
if (msg)
RefsReceived(msg);
}
void
ExpanderApp::RefsReceived(BMessage* msg)
{
BMessenger messenger(fWindow);
msg->AddBool("fromApp", true);
messenger.SendMessage(msg);
}
void
ExpanderApp::UpdateSettingsFrom(BMessage* message)
{
fSettings.UpdateFrom(message);
}
// #pragma mark -
int
main(int, char **)
{
ExpanderApp theApp;
theApp.Run();
return 0;
}