Cleanup: removed unused messages constant and classes, merged AppearPrefView
with PrefView, moved main from Terminal.cpp to TermApp.cpp. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34163 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a5ec0eeb43
commit
70f7a8ad0f
@ -12,6 +12,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Button.h>
|
||||
#include <ColorControl.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Menu.h>
|
||||
@ -29,10 +30,10 @@
|
||||
|
||||
AppearancePrefView::AppearancePrefView(const char *name,
|
||||
const BMessenger &messenger)
|
||||
: PrefView(name),
|
||||
: BView(name, B_WILL_DRAW),
|
||||
fTerminalMessenger(messenger)
|
||||
{
|
||||
const char *color_tbl[] = {
|
||||
const char *kColorTable[] = {
|
||||
PREF_TEXT_FORE_COLOR,
|
||||
PREF_TEXT_BACK_COLOR,
|
||||
PREF_CURSOR_FORE_COLOR,
|
||||
@ -72,8 +73,8 @@ AppearancePrefView::AppearancePrefView(const char *name,
|
||||
.Add(fFont = new BMenuField("font", "Font:", fontMenu))
|
||||
.Add(fFontSize = new BMenuField("size", "Size:", sizeMenu))
|
||||
.Add(fColorField = new BMenuField("color", "Color:",
|
||||
MakeMenu(MSG_COLOR_FIELD_CHANGED, color_tbl,
|
||||
color_tbl[0])))
|
||||
MakeMenu(MSG_COLOR_FIELD_CHANGED, kColorTable,
|
||||
kColorTable[0])))
|
||||
.Add(fColorControl = new BColorControl(BPoint(10, 10),
|
||||
B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED)))
|
||||
.End();
|
||||
@ -183,7 +184,7 @@ AppearancePrefView::MessageReceived(BMessage *msg)
|
||||
break;
|
||||
|
||||
default:
|
||||
PrefView::MessageReceived(msg);
|
||||
BView::MessageReceived(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8,16 +8,31 @@
|
||||
#define APPEARANCE_PREF_VIEW_H
|
||||
|
||||
|
||||
#include "PrefView.h"
|
||||
#include <Messenger.h>
|
||||
#include <String.h>
|
||||
#include <View.h>
|
||||
|
||||
|
||||
//
|
||||
// Appearance Message
|
||||
//
|
||||
const ulong MSG_HALF_FONT_CHANGED = 'mchf';
|
||||
const ulong MSG_HALF_SIZE_CHANGED = 'mchs';
|
||||
const ulong MSG_FULL_FONT_CHANGED = 'mcff';
|
||||
const ulong MSG_FULL_SIZE_CHANGED = 'mcfs';
|
||||
const ulong MSG_COLOR_FIELD_CHANGED = 'mccf';
|
||||
const ulong MSG_COLOR_CHANGED = 'mcbc';
|
||||
|
||||
|
||||
const ulong MSG_PREF_MODIFIED = 'mpmo';
|
||||
|
||||
|
||||
|
||||
class BColorControl;
|
||||
class BMenu;
|
||||
class BMenuField;
|
||||
|
||||
class TTextControl;
|
||||
|
||||
|
||||
class AppearancePrefView : public PrefView {
|
||||
class AppearancePrefView : public BView {
|
||||
public:
|
||||
AppearancePrefView(const char *name, const BMessenger &messenger);
|
||||
|
||||
|
@ -14,9 +14,7 @@ Application Terminal :
|
||||
Globals.cpp
|
||||
HistoryBuffer.cpp
|
||||
MenuUtil.cpp
|
||||
Terminal.cpp
|
||||
PrefHandler.cpp
|
||||
PrefView.cpp
|
||||
PrefWindow.cpp
|
||||
Shell.cpp
|
||||
SmartTabView.cpp
|
||||
@ -27,7 +25,6 @@ Application Terminal :
|
||||
TermScrollView.cpp
|
||||
TermView.cpp
|
||||
TermWindow.cpp
|
||||
TTextControl.cpp
|
||||
UTF8WidthTbl.c
|
||||
VTKeyTbl.c
|
||||
VTPrsTbl.c
|
||||
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku
|
||||
* 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 "PrefView.h"
|
||||
|
||||
#include "PrefHandler.h"
|
||||
#include "TermConst.h"
|
||||
#include "TTextControl.h"
|
||||
|
||||
#include <ColorControl.h>
|
||||
#include <Message.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
PrefView::PrefView(const char *name)
|
||||
:BView(name, B_WILL_DRAW)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ~PrefView ()
|
||||
// Destructor.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
PrefView::~PrefView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CanApply()
|
||||
// Determines whether view can reply to Apply command or not.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
bool
|
||||
PrefView::CanApply()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PrefView::MessageReceived(BMessage* msg)
|
||||
{
|
||||
switch (msg->what) {
|
||||
case MSG_TEXT_MODIFIED: {
|
||||
TTextControl* textControl;
|
||||
BControl *control;
|
||||
if (msg->FindPointer("source", (void**)&control) >= B_OK
|
||||
&& (textControl = dynamic_cast<TTextControl*>(control))) {
|
||||
textControl->ModifiedText(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
BView::MessageReceived(msg);
|
||||
}
|
||||
}
|
@ -1,90 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PREFVIEW_H_INCLUDED
|
||||
#define PREFVIEW_H_INCLUDED
|
||||
|
||||
#include <View.h>
|
||||
#include <ColorControl.h>
|
||||
#include <String.h>
|
||||
|
||||
class PrefHandler;
|
||||
class BRect;
|
||||
class BBox;
|
||||
class TTextControl;
|
||||
class BStringView;
|
||||
class BRadioButton;
|
||||
class BButton;
|
||||
class BCheckBox;
|
||||
class BMenuField;
|
||||
|
||||
enum {
|
||||
PREF_APP_VIEW,
|
||||
PREF_SHELL_VIEW,
|
||||
PREF_LANG_VIEW
|
||||
};
|
||||
|
||||
//
|
||||
// Appearance Message
|
||||
//
|
||||
const ulong MSG_HALF_FONT_CHANGED = 'mchf';
|
||||
const ulong MSG_HALF_SIZE_CHANGED = 'mchs';
|
||||
const ulong MSG_FULL_FONT_CHANGED = 'mcff';
|
||||
const ulong MSG_FULL_SIZE_CHANGED = 'mcfs';
|
||||
const ulong MSG_COLOR_FIELD_CHANGED = 'mccf';
|
||||
const ulong MSG_COLOR_CHANGED = 'mcbc';
|
||||
|
||||
//
|
||||
// ShellMessage
|
||||
//
|
||||
const ulong MSG_COLS_CHANGED = 'mccl';
|
||||
const ulong MSG_ROWS_CHANGED = 'mcrw';
|
||||
const ulong MSG_HISTORY_CHANGED = 'mhst';
|
||||
|
||||
const ulong MSG_LANG_CHANGED = 'mclg';
|
||||
const ulong MSG_INPUT_METHOD_CHANGED = 'mcim';
|
||||
|
||||
//
|
||||
// TextControl Modification Message.
|
||||
//
|
||||
const ulong MSG_TEXT_MODIFIED = 'tcmm';
|
||||
const ulong MSG_PREF_MODIFIED = 'mpmo';
|
||||
|
||||
|
||||
class PrefView : public BView {
|
||||
public:
|
||||
PrefView(const char *name);
|
||||
virtual ~PrefView();
|
||||
virtual bool CanApply();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
|
||||
};
|
||||
|
||||
#endif //PREFVIEW_H_INCLUDED
|
@ -9,7 +9,6 @@
|
||||
#include "AppearPrefView.h"
|
||||
#include "PrefHandler.h"
|
||||
#include "PrefWindow.h"
|
||||
#include "PrefView.h"
|
||||
#include "TermConst.h"
|
||||
|
||||
#include <Alert.h>
|
||||
@ -150,7 +149,6 @@ PrefWindow::_Revert()
|
||||
|
||||
fTerminalMessenger.SendMessage(MSG_HALF_FONT_CHANGED);
|
||||
fTerminalMessenger.SendMessage(MSG_COLOR_CHANGED);
|
||||
fTerminalMessenger.SendMessage(MSG_INPUT_METHOD_CHANGED);
|
||||
|
||||
fDirty = false;
|
||||
}
|
||||
|
@ -1,84 +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 <TextControl.h>
|
||||
#include "TTextControl.h"
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* CONSTRUCTOR and DESTRUCTOR
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// TTextControl ()
|
||||
// Constructor.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
TTextControl::TTextControl (BRect r, const char *name,
|
||||
const char *label, const char *text,
|
||||
BMessage *msg)
|
||||
:BTextControl (r, name, label, text, msg)
|
||||
{
|
||||
mModified = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ~TTextControl ()
|
||||
// Destructor.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
TTextControl::~TTextControl ()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC MEMBER FUNCTIONS.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ModifiedText (int)
|
||||
// Dispatch modification message.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
TTextControl::ModifiedText (int flag)
|
||||
{
|
||||
mModified = flag;
|
||||
return;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// IsModified (void)
|
||||
// Dispatch modification message.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
int
|
||||
TTextControl::IsModified (void)
|
||||
{
|
||||
return mModified;
|
||||
}
|
||||
|
@ -1,59 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TTEXTCTL_H_INCLUDED
|
||||
#define TTEXTCTL_H_INCLUDED
|
||||
#include <TextControl.h>
|
||||
|
||||
class TTextControl : public BTextControl
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Constructor and Desctructor
|
||||
//
|
||||
TTextControl (BRect, const char *, const char *,
|
||||
const char *, BMessage *);
|
||||
~TTextControl ();
|
||||
|
||||
//
|
||||
// public member functions.
|
||||
//
|
||||
void ModifiedText (int);
|
||||
int IsModified (void);
|
||||
|
||||
private:
|
||||
//
|
||||
// Data member.
|
||||
//
|
||||
int mModified;
|
||||
|
||||
};
|
||||
|
||||
#endif /* TTEXT_CTL_H_INCLUDED */
|
@ -40,6 +40,16 @@ const ulong MSG_ACTIVATE_TERM = 'msat';
|
||||
const ulong MSG_TERM_WINDOW_INFO = 'mtwi';
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
TermApp app;
|
||||
app.Run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TermApp::TermApp()
|
||||
: BApplication(TERM_SIGNATURE),
|
||||
fStartFullscreen(false),
|
||||
|
Loading…
x
Reference in New Issue
Block a user