Patch by Vasilis Kaoutsis:
* Style issues. * Renamed CenteredRect to _CenteredRect since is private and removed the static keyword. * Corrected copyright dates. Thank you! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20266 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2df0aaea1d
commit
3e837bf6d0
@ -1,85 +1,78 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku, Inc.
|
||||
* Copyright 2007, Haiku, Inc.
|
||||
* Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net
|
||||
* Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
|
||||
* All rights reserved. Distributed under the terms of the MIT license.
|
||||
*/
|
||||
|
||||
|
||||
#include "AppearPrefView.h"
|
||||
#include "MenuUtil.h"
|
||||
#include "PrefHandler.h"
|
||||
#include "PrefDlg.h"
|
||||
#include "PrefView.h"
|
||||
#include "spawn.h"
|
||||
#include "TermConst.h"
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <FilePanel.h>
|
||||
#include <Path.h>
|
||||
#include <Screen.h>
|
||||
#include <Alert.h>
|
||||
#include <storage/Path.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "PrefHandler.h"
|
||||
#include "PrefDlg.h"
|
||||
#include "TermConst.h"
|
||||
#include "MenuUtil.h"
|
||||
|
||||
#include "AppearPrefView.h"
|
||||
#include "PrefView.h"
|
||||
#include "spawn.h"
|
||||
|
||||
|
||||
// Global Preference Handler
|
||||
extern PrefHandler *gTermPref;
|
||||
// Global Preference Handler
|
||||
|
||||
PrefDlg::PrefDlg(BMessenger messenger)
|
||||
: BWindow(CenteredRect(BRect(0, 0, 350, 215)), "Terminal Settings",
|
||||
: BWindow(_CenteredRect(BRect(0, 0, 350, 215)), "Terminal Settings",
|
||||
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||
B_NOT_RESIZABLE|B_NOT_ZOOMABLE),
|
||||
fPrefTemp(new PrefHandler(gTermPref)),
|
||||
fSavePanel(NULL),
|
||||
fDirty(false),
|
||||
fPrefDlgMessenger(messenger)
|
||||
{
|
||||
fPrefTemp = new PrefHandler(gTermPref);
|
||||
fDirty = false;
|
||||
fSavePanel = NULL;
|
||||
|
||||
BRect r;
|
||||
BRect rect;
|
||||
|
||||
BView *top = new BView(Bounds(), "topview", B_FOLLOW_NONE, B_WILL_DRAW);
|
||||
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
AddChild(top);
|
||||
|
||||
r=top->Bounds();
|
||||
r.bottom *= .75;
|
||||
AppearancePrefView *prefView= new AppearancePrefView(r, "Appearance",
|
||||
rect = top->Bounds();
|
||||
rect.bottom *= .75;
|
||||
AppearancePrefView *prefView= new AppearancePrefView(rect, "Appearance",
|
||||
fPrefDlgMessenger);
|
||||
top->AddChild(prefView);
|
||||
|
||||
fSaveAsFileButton = new BButton(BRect(0,0,1,1), "savebutton",
|
||||
"Save to File",
|
||||
new BMessage(MSG_SAVEAS_PRESSED),
|
||||
B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
fSaveAsFileButton = new BButton(BRect(0, 0, 1, 1), "savebutton", "Save to File",
|
||||
new BMessage(MSG_SAVEAS_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
fSaveAsFileButton->ResizeToPreferred();
|
||||
fSaveAsFileButton->MoveTo(5, top->Bounds().Height() - 5 -
|
||||
fSaveAsFileButton->Bounds().Height());
|
||||
fSaveAsFileButton->Bounds().Height());
|
||||
top->AddChild(fSaveAsFileButton);
|
||||
|
||||
|
||||
fSaveButton = new BButton(BRect(0,0,1,1), "okbutton", "OK",
|
||||
new BMessage(MSG_SAVE_PRESSED), B_FOLLOW_TOP,
|
||||
B_WILL_DRAW);
|
||||
|
||||
fSaveButton = new BButton(BRect(0, 0, 1, 1), "okbutton", "OK",
|
||||
new BMessage(MSG_SAVE_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
fSaveButton->ResizeToPreferred();
|
||||
fSaveButton->MoveTo(top->Bounds().Width() - 5 - fSaveButton->Bounds().Width(),
|
||||
top->Bounds().Height() - 5 - fSaveButton->Bounds().Height());
|
||||
top->Bounds().Height() - 5 - fSaveButton->Bounds().Height());
|
||||
fSaveButton->MakeDefault(true);
|
||||
top->AddChild(fSaveButton);
|
||||
|
||||
fRevertButton = new BButton(BRect(0,0,1,1), "revertbutton",
|
||||
"Cancel", new BMessage(MSG_REVERT_PRESSED),
|
||||
B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
|
||||
fRevertButton = new BButton(BRect(0, 0, 1, 1), "revertbutton",
|
||||
"Cancel", new BMessage(MSG_REVERT_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
fRevertButton->ResizeToPreferred();
|
||||
fRevertButton->MoveTo(fSaveButton->Frame().left - 10 -
|
||||
fRevertButton->Bounds().Width(),
|
||||
top->Bounds().Height() - 5 -
|
||||
fRevertButton->Bounds().Height());
|
||||
fRevertButton->MoveTo(fSaveButton->Frame().left - 10 -
|
||||
fRevertButton->Bounds().Width(), top->Bounds().Height() - 5 -
|
||||
fRevertButton->Bounds().Height());
|
||||
top->AddChild(fRevertButton);
|
||||
|
||||
AddShortcut ((ulong)'Q', (ulong)B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||
AddShortcut ((ulong)'W', (ulong)B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||
AddShortcut((ulong)'Q', (ulong)B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||
AddShortcut((ulong)'W', (ulong)B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||
|
||||
Show();
|
||||
}
|
||||
@ -213,16 +206,16 @@ PrefDlg::MessageReceived(BMessage *msg)
|
||||
|
||||
|
||||
BRect
|
||||
PrefDlg::CenteredRect(BRect r)
|
||||
PrefDlg::_CenteredRect(BRect rect)
|
||||
{
|
||||
BRect screenRect = BScreen().Frame();
|
||||
|
||||
screenRect.InsetBy(10,10);
|
||||
|
||||
float x = screenRect.left + (screenRect.Width() - r.Width()) / 2;
|
||||
float y = screenRect.top + (screenRect.Height() - r.Height()) / 3;
|
||||
float x = screenRect.left + (screenRect.Width() - rect.Width()) / 2;
|
||||
float y = screenRect.top + (screenRect.Height() - rect.Height()) / 3;
|
||||
|
||||
r.OffsetTo(x, y);
|
||||
rect.OffsetTo(x, y);
|
||||
|
||||
return r;
|
||||
return rect;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku, Inc.
|
||||
* Copyright 2007, Haiku, Inc.
|
||||
* Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net
|
||||
* Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
|
||||
* All rights reserved. Distributed under the terms of the MIT license.
|
||||
@ -7,32 +7,33 @@
|
||||
#ifndef PREFDLG_H_INCLUDED
|
||||
#define PREFDLG_H_INCLUDED
|
||||
|
||||
#include <Box.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include "PrefHandler.h"
|
||||
|
||||
// local message, so these are in .cpp files....
|
||||
#include <Box.h>
|
||||
#include <Window.h>
|
||||
|
||||
// local messages
|
||||
const ulong MSG_SAVE_PRESSED = 'okok';
|
||||
const ulong MSG_SAVEAS_PRESSED = 'canl';
|
||||
const ulong MSG_REVERT_PRESSED = 'revt';
|
||||
const ulong MSG_PREF_CLOSED = 'mspc';
|
||||
|
||||
|
||||
// Notify PrefDlg closed to TermWindow
|
||||
|
||||
class BRect;
|
||||
class BMessage;
|
||||
class BTextControl;
|
||||
class BButton;
|
||||
class PrefHandler;
|
||||
class BFilePanel;
|
||||
class BMessage;
|
||||
class BRect;
|
||||
class BTextControl;
|
||||
|
||||
class PrefHandler;
|
||||
|
||||
|
||||
class PrefDlg : public BWindow
|
||||
{
|
||||
public:
|
||||
PrefDlg(BMessenger messenger);
|
||||
virtual ~PrefDlg();
|
||||
|
||||
|
||||
virtual void Quit();
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
@ -42,9 +43,9 @@ class PrefDlg : public BWindow
|
||||
void _SaveAs();
|
||||
void _Revert();
|
||||
void _SaveRequested(BMessage *msg);
|
||||
BRect _CenteredRect(BRect rect);
|
||||
|
||||
static BRect CenteredRect(BRect r);
|
||||
|
||||
private:
|
||||
PrefHandler *fPrefTemp;
|
||||
BFilePanel *fSavePanel;
|
||||
|
||||
@ -53,8 +54,7 @@ class PrefDlg : public BWindow
|
||||
*fSaveButton;
|
||||
|
||||
bool fDirty;
|
||||
|
||||
BMessenger fPrefDlgMessenger;
|
||||
};
|
||||
|
||||
#endif //PREFDLG_H_INCLUDED
|
||||
#endif // PREFDLG_H_INCLUDED
|
||||
|
Loading…
Reference in New Issue
Block a user