Removed the ugly about window, and replaced it with a common BAlert.
Moved the alert to TermApp, too - TermWindow now only forwards the B_ABOUT_REQUESTED message. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13737 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
42a1650087
commit
76649c0319
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files or portions
|
||||
* thereof (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice
|
||||
* in the binary, as well as this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided with
|
||||
* the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#include <Application.h>
|
||||
#include <StringView.h>
|
||||
#include "AboutWindow.h"
|
||||
|
||||
|
||||
// Set up the window
|
||||
|
||||
|
||||
aboutWindow::aboutWindow(const char *)
|
||||
: BWindow(BRect(100,100,390,230), "About", B_TITLED_WINDOW, B_NOT_RESIZABLE)
|
||||
{
|
||||
|
||||
// Set up the main view
|
||||
BView* icon = new BView(BRect(0,0,390,230), "File Info", B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
|
||||
|
||||
// Set up the colour of the panel and set it to being displayed
|
||||
AddChild(icon);
|
||||
|
||||
Show();
|
||||
|
||||
|
||||
text1 = new BStringView(BRect(15,10,390,30), "text", "Haiku Terminal", B_FOLLOW_NONE, B_WILL_DRAW);
|
||||
AddChild(text1);
|
||||
|
||||
text2 = new BStringView(BRect(15,30,390,50), "text", "Based on MuTerminal 2.3", B_FOLLOW_NONE, B_WILL_DRAW);
|
||||
AddChild(text2);
|
||||
|
||||
text3 = new BStringView(BRect(15,50,390,70), "text", "By Kazuho Okui and Takashi Murai", B_FOLLOW_NONE, B_WILL_DRAW);
|
||||
AddChild(text3);
|
||||
|
||||
text4 = new BStringView(BRect(15,70,390,90), "text", "Haiku Modifications by Kian Duffy, Daniel Furrer", B_FOLLOW_NONE, B_WILL_DRAW);
|
||||
AddChild(text4);
|
||||
|
||||
|
||||
|
||||
|
||||
// Set up the BMessage handlers
|
||||
}
|
||||
|
||||
void
|
||||
aboutWindow::MessageReceived(BMessage* msg)
|
||||
{
|
||||
|
||||
switch(msg->what)
|
||||
{
|
||||
|
||||
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Quit Button implementation
|
||||
|
||||
|
||||
void aboutWindow::Quit()
|
||||
{
|
||||
|
||||
BWindow::Quit();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files or portions
|
||||
* thereof (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice
|
||||
* in the binary, as well as this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided with
|
||||
* the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Window.h>
|
||||
#include <View.h>
|
||||
|
||||
class aboutWindow : public BWindow
|
||||
{
|
||||
public:
|
||||
aboutWindow(const char *);
|
||||
|
||||
|
||||
void MessageReceived(BMessage* msg);
|
||||
void Quit();
|
||||
|
||||
private:
|
||||
// Private classes to Be classes
|
||||
BWindow* handler;
|
||||
BStringView* text1;
|
||||
BStringView* text2;
|
||||
BStringView* text3;
|
||||
BStringView* text4;
|
||||
|
||||
};
|
|
@ -1,33 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files or portions
|
||||
* thereof (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice
|
||||
* in the binary, as well as this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided with
|
||||
* the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
* Copyright (c) 2003-2004 Kian Duffy <myob@users.sourceforge.net>
|
||||
* Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||
*
|
||||
* Distributed unter the terms of the MIT license.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
|
@ -40,6 +18,7 @@
|
|||
#include <Alert.h>
|
||||
#include <Screen.h>
|
||||
#include <String.h>
|
||||
#include <TextView.h>
|
||||
|
||||
#include "TermApp.h"
|
||||
#include "TermWindow.h"
|
||||
|
@ -48,6 +27,7 @@
|
|||
#include "PrefHandler.h"
|
||||
#include "CodeConv.h"
|
||||
|
||||
|
||||
extern PrefHandler *gTermPref; /* Preference temporary */
|
||||
extern char gWindowName[];
|
||||
|
||||
|
@ -97,10 +77,8 @@ TermApp::TermApp (void)
|
|||
gTermPref = new PrefHandler();
|
||||
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
TermApp::~TermApp (void)
|
||||
{
|
||||
/* delete (gTermPref); */
|
||||
|
@ -108,10 +86,6 @@ TermApp::~TermApp (void)
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
TermApp::ReadyToRun (void)
|
||||
{
|
||||
|
@ -156,10 +130,8 @@ TermApp::ReadyToRun (void)
|
|||
|
||||
MakeTermWindow (fTermFrame);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void
|
||||
TermApp::Quit (void)
|
||||
{
|
||||
|
@ -174,12 +146,31 @@ TermApp::Quit (void)
|
|||
|
||||
BApplication::Quit();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// MessageReceived
|
||||
// Dispatches message.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void
|
||||
TermApp::MessageReceived (BMessage* msg)
|
||||
TermApp::AboutRequested()
|
||||
{
|
||||
BAlert *alert = new BAlert("about", "Terminal\n"
|
||||
"\twritten by Kazuho Okui and Takashi Murai\n"
|
||||
"\tupdated by Kian Duffy and others\n\n"
|
||||
"\tCopyright 2005, Haiku.\n", "Ok");
|
||||
BTextView *view = alert->TextView();
|
||||
BFont font;
|
||||
|
||||
view->SetStylable(true);
|
||||
|
||||
view->GetFont(&font);
|
||||
font.SetSize(18);
|
||||
font.SetFace(B_BOLD_FACE);
|
||||
view->SetFontAndColor(0, 8, &font);
|
||||
|
||||
alert->Go();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermApp::MessageReceived(BMessage* msg)
|
||||
{
|
||||
switch(msg->what) {
|
||||
case MENU_NEW_TREM:
|
||||
|
|
|
@ -45,16 +45,17 @@ class AboutDlg;
|
|||
class TermApp : public BApplication
|
||||
{
|
||||
public:
|
||||
TermApp (void);
|
||||
~TermApp (void);
|
||||
TermApp();
|
||||
~TermApp();
|
||||
|
||||
private:
|
||||
/*
|
||||
* Hook functions
|
||||
*/
|
||||
void ReadyToRun (void);
|
||||
void Quit (void);
|
||||
void MessageReceived (BMessage* msg);
|
||||
void ReadyToRun();
|
||||
void Quit();
|
||||
void AboutRequested();
|
||||
void MessageReceived(BMessage* msg);
|
||||
void RefsReceived(BMessage *message);
|
||||
void ArgvReceived(int32 argc, char **argv);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
#include "MenuUtil.h"
|
||||
#include "spawn.h"
|
||||
#include "ColorWindow.h"
|
||||
#include "AboutWindow.h"
|
||||
|
||||
|
||||
// Global Preference Handler
|
||||
extern PrefHandler *gTermPref;
|
||||
|
@ -239,10 +239,8 @@ TermWindow::MenusBeginning(void)
|
|||
(fEncodingmenu->FindItem(op2longname(gNowCoding)))->SetMarked(true);
|
||||
BWindow::MenusBeginning();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// SetupMenu(void)
|
||||
// Makes Menu Bar.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void
|
||||
TermWindow::SetupMenu(void)
|
||||
{
|
||||
|
@ -260,11 +258,11 @@ TermWindow::SetupMenu(void)
|
|||
fFilemenu->AddItem(new BMenuItem("Switch Terminals", new BMessage(MENU_SWITCH_TERM),'G'));
|
||||
fFilemenu->AddItem(new BMenuItem("Start New Terminal", new BMessage(MENU_NEW_TREM), 'N'));
|
||||
fFilemenu->AddSeparatorItem();
|
||||
fFilemenu->AddItem(new BMenuItem("About Terminal...", new BMessage(MENU_SHOW_ABOUT)));
|
||||
fFilemenu->AddSeparatorItem();
|
||||
fFilemenu->AddItem(new BMenuItem("Page Setup...", new BMessage(MENU_PAGE_SETUP)));
|
||||
fFilemenu->AddItem(new BMenuItem("Print", new BMessage(MENU_PRINT),'P'));
|
||||
fFilemenu->AddSeparatorItem();
|
||||
fFilemenu->AddItem(new BMenuItem("About Terminal...", new BMessage(B_ABOUT_REQUESTED)));
|
||||
fFilemenu->AddSeparatorItem();
|
||||
fFilemenu->AddItem(new BMenuItem("Quit", new BMessage(MENU_FILE_QUIT), 'Q'));
|
||||
fMenubar->AddItem(fFilemenu);
|
||||
|
||||
|
@ -323,17 +321,11 @@ TermWindow::SetupMenu(void)
|
|||
fHelpmenu->AddSeparatorItem();
|
||||
fHelpmenu->AddItem(new BMenuItem("Preferences", new BMessage(MENU_PREF_OPEN)));
|
||||
fMenubar->AddItem(fHelpmenu);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AddChild(fMenubar);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// MessageReceived (BMessage *)
|
||||
// Dispatch Mesasge.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void
|
||||
TermWindow::MessageReceived(BMessage *message)
|
||||
{
|
||||
|
@ -342,8 +334,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||
BFont halfFont;
|
||||
BFont fullFont;
|
||||
|
||||
|
||||
switch(message->what) {
|
||||
switch (message->what) {
|
||||
|
||||
case MENU_SWITCH_TERM:
|
||||
be_app->PostMessage(MENU_SWITCH_TERM);
|
||||
|
@ -360,11 +351,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||
fPrefWindow->Activate();
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_SHOW_ABOUT:
|
||||
aboutRequested();
|
||||
break;
|
||||
|
||||
|
||||
case MSG_PREF_CLOSED:
|
||||
fPrefWindow = NULL;
|
||||
break;
|
||||
|
@ -528,6 +515,10 @@ TermWindow::MessageReceived(BMessage *message)
|
|||
fTermView->UpdateSIGWINCH ();
|
||||
break;
|
||||
|
||||
case B_ABOUT_REQUESTED:
|
||||
be_app->PostMessage(B_ABOUT_REQUESTED);
|
||||
break;
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
break;
|
||||
|
@ -553,14 +544,9 @@ TermWindow::WindowActivated (bool )
|
|||
// colW->Show();
|
||||
// }
|
||||
|
||||
|
||||
void
|
||||
TermWindow::aboutRequested() {
|
||||
aboutWindow *aboutW=new aboutWindow("About");
|
||||
aboutW->Show();
|
||||
}
|
||||
|
||||
void
|
||||
TermWindow::Quit (void)
|
||||
TermWindow::Quit(void)
|
||||
{
|
||||
delete fTermParse;
|
||||
delete fCodeConv;
|
||||
|
@ -568,12 +554,10 @@ TermWindow::Quit (void)
|
|||
be_app->PostMessage (B_QUIT_REQUESTED, be_app);
|
||||
BWindow::Quit ();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// QuitRequested (void)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
bool
|
||||
TermWindow::QuitRequested (void)
|
||||
TermWindow::QuitRequested(void)
|
||||
{
|
||||
|
||||
return true;
|
||||
|
|
|
@ -63,7 +63,6 @@ private:
|
|||
void InitWindow (void);
|
||||
void SetupMenu (void);
|
||||
// void colRequested (void);
|
||||
void aboutRequested (void);
|
||||
void MessageReceived (BMessage *message);
|
||||
void WindowActivated (bool);
|
||||
int GetTimeZone (void);
|
||||
|
|
Loading…
Reference in New Issue