more renaming
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -60,7 +60,7 @@ AppearancePrefView::AppearancePrefView(BRect frame, const char *name,
|
|||||||
fColorField->SetDivider(StringWidth(fColorField->Label()) + 8.0);
|
fColorField->SetDivider(StringWidth(fColorField->Label()) + 8.0);
|
||||||
AddChild(fColorField);
|
AddChild(fColorField);
|
||||||
|
|
||||||
fColorControl = SetupBColorControl(BPoint(r.left, r.bottom + 10),
|
fColorControl = SetupColorControl(BPoint(r.left, r.bottom + 10),
|
||||||
B_CELLS_32x8, 6, MSG_COLOR_CHANGED);
|
B_CELLS_32x8, 6, MSG_COLOR_CHANGED);
|
||||||
fColorControl->SetValue(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR));
|
fColorControl->SetValue(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const static etable kEncodingTable[] =
|
|||||||
{"ISO-8859-8", "8859-8", '8', B_ISO8_CONVERSION},
|
{"ISO-8859-8", "8859-8", '8', B_ISO8_CONVERSION},
|
||||||
{"ISO-8859-9", "8859-9", '9', B_ISO9_CONVERSION},
|
{"ISO-8859-9", "8859-9", '9', B_ISO9_CONVERSION},
|
||||||
{"ISO-8859-10", "8859-10", '0', B_ISO10_CONVERSION},
|
{"ISO-8859-10", "8859-10", '0', B_ISO10_CONVERSION},
|
||||||
{"MacRoman", "MacRoman",'M', B_MAC_ROMAN_CONVERSION},
|
{"MacRoman", "MacRoman", 'M', B_MAC_ROMAN_CONVERSION},
|
||||||
{"JIS", "JIS", 'J', B_JIS_CONVERSION},
|
{"JIS", "JIS", 'J', B_JIS_CONVERSION},
|
||||||
{"Shift-JIS", "SJIS", 'S', B_SJIS_CONVERSION},
|
{"Shift-JIS", "SJIS", 'S', B_SJIS_CONVERSION},
|
||||||
{"EUC-jp", "EUCJ", 'E', B_EUC_CONVERSION},
|
{"EUC-jp", "EUCJ", 'E', B_EUC_CONVERSION},
|
||||||
@@ -60,7 +60,7 @@ get_nth_encoding(int i, int *id)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
longname2id(const char *longname)
|
EncodingID(const char *longname)
|
||||||
{
|
{
|
||||||
int id = M_UTF8;
|
int id = M_UTF8;
|
||||||
const etable *s = kEncodingTable;
|
const etable *s = kEncodingTable;
|
||||||
@@ -76,25 +76,21 @@ longname2id(const char *longname)
|
|||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
longname2shortname(const char *longname)
|
EncodingAsShortString(int id)
|
||||||
{
|
{
|
||||||
const char *shortName = NULL;
|
|
||||||
|
|
||||||
const etable *p = kEncodingTable;
|
const etable *p = kEncodingTable;
|
||||||
while (p->name) {
|
while (p->name) {
|
||||||
if (!strcmp(p->name, longname)) {
|
if (id == p->id)
|
||||||
shortName = p->shortname;
|
return p->shortname;
|
||||||
break;
|
|
||||||
}
|
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return shortName;
|
return kEncodingTable[0].shortname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
id2longname(int id)
|
EncodingAsString(int id)
|
||||||
{
|
{
|
||||||
const etable *p = kEncodingTable;
|
const etable *p = kEncodingTable;
|
||||||
while (p->name) {
|
while (p->name) {
|
||||||
|
|||||||
@@ -39,10 +39,10 @@
|
|||||||
|
|
||||||
status_t get_nth_encoding(int i, int *id);
|
status_t get_nth_encoding(int i, int *id);
|
||||||
|
|
||||||
int longname2id(const char *longname);
|
int EncodingID(const char *longname);
|
||||||
const char * longname2shortname(const char *longname);
|
const char * EncodingAsShortString(int id);
|
||||||
const char * id2longname(int op);
|
const char * EncodingAsString(int id);
|
||||||
const char id2shortcut(int op);
|
const char id2shortcut(int id);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CODING_H_ */
|
#endif /* _CODING_H_ */
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ MakeEncodingMenu(BMenu *eMenu, bool flag)
|
|||||||
BMessage *msg = new BMessage(MENU_ENCODING);
|
BMessage *msg = new BMessage(MENU_ENCODING);
|
||||||
msg->AddInt32("op", (int32)encoding);
|
msg->AddInt32("op", (int32)encoding);
|
||||||
if (flag)
|
if (flag)
|
||||||
eMenu->AddItem(new BMenuItem(id2longname(encoding), msg, id2shortcut(encoding)));
|
eMenu->AddItem(new BMenuItem(EncodingAsString(encoding), msg, id2shortcut(encoding)));
|
||||||
else
|
else
|
||||||
eMenu->AddItem(new BMenuItem(id2longname(encoding), msg));
|
eMenu->AddItem(new BMenuItem(EncodingAsString(encoding), msg));
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ PrefHandler::_LoadFromFile(const char* path)
|
|||||||
setRGB(PREF_CURSOR_FORE_COLOR, prefs.curfg);
|
setRGB(PREF_CURSOR_FORE_COLOR, prefs.curfg);
|
||||||
setRGB(PREF_SELECT_BACK_COLOR, prefs.selbg);
|
setRGB(PREF_SELECT_BACK_COLOR, prefs.selbg);
|
||||||
setRGB(PREF_SELECT_FORE_COLOR, prefs.selfg);
|
setRGB(PREF_SELECT_FORE_COLOR, prefs.selfg);
|
||||||
setString(PREF_TEXT_ENCODING, id2longname(prefs.encoding));
|
setString(PREF_TEXT_ENCODING, EncodingAsString(prefs.encoding));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,15 +40,10 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
// PrefView ()
|
|
||||||
// Constructor.
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
PrefView::PrefView(BRect frame, const char *name)
|
PrefView::PrefView(BRect frame, const char *name)
|
||||||
:BView(frame, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
|
:BView(frame, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
fLabel.SetTo(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -61,12 +56,6 @@ PrefView::~PrefView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
|
||||||
PrefView::ViewLabel() const
|
|
||||||
{
|
|
||||||
return fLabel.String();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// CanApply()
|
// CanApply()
|
||||||
@@ -99,14 +88,12 @@ PrefView::MessageReceived(BMessage* msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
// SetupBColorControl
|
|
||||||
// Make BColorControl.
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
BColorControl *
|
BColorControl *
|
||||||
PrefView::SetupBColorControl(BPoint point, color_control_layout layout, float cellSize, ulong message)
|
PrefView::SetupColorControl(BPoint point, color_control_layout layout,
|
||||||
|
float cellSize, ulong message)
|
||||||
{
|
{
|
||||||
BColorControl *control = new BColorControl(point, layout, cellSize, "", new BMessage(message));
|
BColorControl *control = new BColorControl(point, layout, cellSize,
|
||||||
|
"", new BMessage(message));
|
||||||
AddChild(control);
|
AddChild(control);
|
||||||
return control;
|
return control;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,21 +77,14 @@ const ulong MSG_TEXT_MODIFIED = 'tcmm';
|
|||||||
const ulong MSG_PREF_MODIFIED = 'mpmo';
|
const ulong MSG_PREF_MODIFIED = 'mpmo';
|
||||||
|
|
||||||
|
|
||||||
extern PrefHandler *gTermPref;
|
class PrefView : public BView {
|
||||||
|
public:
|
||||||
|
PrefView(BRect frame, const char *name);
|
||||||
|
virtual ~PrefView();
|
||||||
|
virtual bool CanApply();
|
||||||
|
virtual void MessageReceived(BMessage *msg);
|
||||||
|
|
||||||
class PrefView : public BView
|
BColorControl* SetupColorControl(BPoint p, color_control_layout layout, float cell_size, ulong msg);
|
||||||
{
|
|
||||||
public:
|
|
||||||
PrefView (BRect frame, const char *name);
|
|
||||||
virtual ~PrefView();
|
|
||||||
const char * ViewLabel (void) const;
|
|
||||||
virtual bool CanApply ();
|
|
||||||
virtual void MessageReceived (BMessage *msg);
|
|
||||||
|
|
||||||
BColorControl* SetupBColorControl (BPoint p, color_control_layout layout, float cell_size, ulong msg);
|
|
||||||
|
|
||||||
private:
|
|
||||||
BString fLabel;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007, Haiku, Inc.
|
* Copyright 2007-2008, Haiku, Inc.
|
||||||
* Copyright 2003-2004 Kian Duffy, [email protected]
|
* Copyright 2003-2004 Kian Duffy, [email protected]
|
||||||
* Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
|
* Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
|
||||||
* All rights reserved. Distributed under the terms of the MIT license.
|
* All rights reserved. Distributed under the terms of the MIT license.
|
||||||
@@ -7,11 +7,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "AppearPrefView.h"
|
#include "AppearPrefView.h"
|
||||||
#include "MenuUtil.h"
|
|
||||||
#include "PrefHandler.h"
|
#include "PrefHandler.h"
|
||||||
#include "PrefWindow.h"
|
#include "PrefWindow.h"
|
||||||
#include "PrefView.h"
|
#include "PrefView.h"
|
||||||
#include "Shell.h"
|
|
||||||
#include "TermConst.h"
|
#include "TermConst.h"
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
@@ -33,13 +31,11 @@ PrefWindow::PrefWindow(BMessenger messenger)
|
|||||||
fDirty(false),
|
fDirty(false),
|
||||||
fPrefDlgMessenger(messenger)
|
fPrefDlgMessenger(messenger)
|
||||||
{
|
{
|
||||||
BRect rect;
|
|
||||||
|
|
||||||
BView *top = new BView(Bounds(), "topview", B_FOLLOW_NONE, B_WILL_DRAW);
|
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);
|
AddChild(top);
|
||||||
|
|
||||||
rect = top->Bounds();
|
BRect rect = top->Bounds();
|
||||||
rect.bottom *= .75;
|
rect.bottom *= .75;
|
||||||
AppearancePrefView *prefView= new AppearancePrefView(rect, "Appearance",
|
AppearancePrefView *prefView= new AppearancePrefView(rect, "Appearance",
|
||||||
fPrefDlgMessenger);
|
fPrefDlgMessenger);
|
||||||
@@ -68,8 +64,8 @@ PrefWindow::PrefWindow(BMessenger messenger)
|
|||||||
fRevertButton->Bounds().Height());
|
fRevertButton->Bounds().Height());
|
||||||
top->AddChild(fRevertButton);
|
top->AddChild(fRevertButton);
|
||||||
|
|
||||||
AddShortcut((ulong)'Q', (ulong)B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||||
AddShortcut((ulong)'W', (ulong)B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||||
|
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,7 +300,6 @@ TermParse::EscParse()
|
|||||||
int nparam = 1;
|
int nparam = 1;
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
int width;
|
|
||||||
|
|
||||||
/* default coding system is UTF8 */
|
/* default coding system is UTF8 */
|
||||||
int *groundtable = utf8_groundtable;
|
int *groundtable = utf8_groundtable;
|
||||||
|
|||||||
@@ -256,7 +256,8 @@ TermView::_InitObject(int32 argc, const char **argv)
|
|||||||
//SetIMAware(false);
|
//SetIMAware(false);
|
||||||
|
|
||||||
status_t status = fShell->Open(fTermRows, fTermColumns,
|
status_t status = fShell->Open(fTermRows, fTermColumns,
|
||||||
longname2shortname(id2longname(fEncoding)), argc, argv);
|
EncodingAsShortString(fEncoding),
|
||||||
|
argc, argv);
|
||||||
|
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ void
|
|||||||
TermWindow::MenusBeginning()
|
TermWindow::MenusBeginning()
|
||||||
{
|
{
|
||||||
// Syncronize Encode Menu Pop-up menu and Preference.
|
// Syncronize Encode Menu Pop-up menu and Preference.
|
||||||
BMenuItem *item = fEncodingmenu->FindItem(id2longname(_ActiveTermView()->Encoding()));
|
BMenuItem *item = fEncodingmenu->FindItem(EncodingAsString(_ActiveTermView()->Encoding()));
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
BWindow::MenusBeginning();
|
BWindow::MenusBeginning();
|
||||||
@@ -606,7 +606,7 @@ TermWindow::_AddTab(Arguments *args)
|
|||||||
// TODO: shouldn't this be done in BScrollView itself ? At least BScrollBar does that.
|
// TODO: shouldn't this be done in BScrollView itself ? At least BScrollBar does that.
|
||||||
scrollView->ScrollBar(B_VERTICAL)->ResizeBy(0, -13);
|
scrollView->ScrollBar(B_VERTICAL)->ResizeBy(0, -13);
|
||||||
|
|
||||||
view->SetEncoding(longname2id(PrefHandler::Default()->getString(PREF_TEXT_ENCODING)));
|
view->SetEncoding(EncodingID(PrefHandler::Default()->getString(PREF_TEXT_ENCODING)));
|
||||||
|
|
||||||
BFont font;
|
BFont font;
|
||||||
_GetPreferredFont(font);
|
_GetPreferredFont(font);
|
||||||
|
|||||||
Reference in New Issue
Block a user