more renaming

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2008-01-21 20:41:45 +00:00
parent 5af13da19d
commit c4eae2c1fc
11 changed files with 35 additions and 63 deletions

View File

@ -60,7 +60,7 @@ AppearancePrefView::AppearancePrefView(BRect frame, const char *name,
fColorField->SetDivider(StringWidth(fColorField->Label()) + 8.0);
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);
fColorControl->SetValue(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR));
}

View File

@ -25,7 +25,7 @@ const static etable kEncodingTable[] =
{"ISO-8859-8", "8859-8", '8', B_ISO8_CONVERSION},
{"ISO-8859-9", "8859-9", '9', B_ISO9_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},
{"Shift-JIS", "SJIS", 'S', B_SJIS_CONVERSION},
{"EUC-jp", "EUCJ", 'E', B_EUC_CONVERSION},
@ -60,7 +60,7 @@ get_nth_encoding(int i, int *id)
int
longname2id(const char *longname)
EncodingID(const char *longname)
{
int id = M_UTF8;
const etable *s = kEncodingTable;
@ -76,25 +76,21 @@ longname2id(const char *longname)
const char *
longname2shortname(const char *longname)
EncodingAsShortString(int id)
{
const char *shortName = NULL;
const etable *p = kEncodingTable;
while (p->name) {
if (!strcmp(p->name, longname)) {
shortName = p->shortname;
break;
}
if (id == p->id)
return p->shortname;
p++;
}
return shortName;
return kEncodingTable[0].shortname;
}
const char *
id2longname(int id)
EncodingAsString(int id)
{
const etable *p = kEncodingTable;
while (p->name) {

View File

@ -39,10 +39,10 @@
status_t get_nth_encoding(int i, int *id);
int longname2id(const char *longname);
const char * longname2shortname(const char *longname);
const char * id2longname(int op);
const char id2shortcut(int op);
int EncodingID(const char *longname);
const char * EncodingAsShortString(int id);
const char * EncodingAsString(int id);
const char id2shortcut(int id);
#endif /* _CODING_H_ */

View File

@ -49,9 +49,9 @@ MakeEncodingMenu(BMenu *eMenu, bool flag)
BMessage *msg = new BMessage(MENU_ENCODING);
msg->AddInt32("op", (int32)encoding);
if (flag)
eMenu->AddItem(new BMenuItem(id2longname(encoding), msg, id2shortcut(encoding)));
eMenu->AddItem(new BMenuItem(EncodingAsString(encoding), msg, id2shortcut(encoding)));
else
eMenu->AddItem(new BMenuItem(id2longname(encoding), msg));
eMenu->AddItem(new BMenuItem(EncodingAsString(encoding), msg));
i++;
}

View File

@ -395,7 +395,7 @@ PrefHandler::_LoadFromFile(const char* path)
setRGB(PREF_CURSOR_FORE_COLOR, prefs.curfg);
setRGB(PREF_SELECT_BACK_COLOR, prefs.selbg);
setRGB(PREF_SELECT_FORE_COLOR, prefs.selfg);
setString(PREF_TEXT_ENCODING, id2longname(prefs.encoding));
setString(PREF_TEXT_ENCODING, EncodingAsString(prefs.encoding));
return B_OK;
}

View File

@ -40,15 +40,10 @@
#include <String.h>
////////////////////////////////////////////////////////////////////////////
// PrefView ()
// Constructor.
////////////////////////////////////////////////////////////////////////////
PrefView::PrefView(BRect frame, const char *name)
:BView(frame, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
{
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()
@ -99,14 +88,12 @@ PrefView::MessageReceived(BMessage* msg)
}
//////////////////////////////////////////////////////////////////////////////
// SetupBColorControl
// Make 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);
return control;
}

View File

@ -77,21 +77,14 @@ const ulong MSG_TEXT_MODIFIED = 'tcmm';
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
{
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;
BColorControl* SetupColorControl(BPoint p, color_control_layout layout, float cell_size, ulong msg);
};

View File

@ -1,5 +1,5 @@
/*
* Copyright 2007, Haiku, Inc.
* Copyright 2007-2008, 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,11 +7,9 @@
#include "AppearPrefView.h"
#include "MenuUtil.h"
#include "PrefHandler.h"
#include "PrefWindow.h"
#include "PrefView.h"
#include "Shell.h"
#include "TermConst.h"
#include <Alert.h>
@ -33,13 +31,11 @@ PrefWindow::PrefWindow(BMessenger messenger)
fDirty(false),
fPrefDlgMessenger(messenger)
{
BRect rect;
BView *top = new BView(Bounds(), "topview", B_FOLLOW_NONE, B_WILL_DRAW);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(top);
rect = top->Bounds();
BRect rect = top->Bounds();
rect.bottom *= .75;
AppearancePrefView *prefView= new AppearancePrefView(rect, "Appearance",
fPrefDlgMessenger);
@ -68,8 +64,8 @@ PrefWindow::PrefWindow(BMessenger messenger)
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('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
Show();
}

View File

@ -300,7 +300,6 @@ TermParse::EscParse()
int nparam = 1;
int row, col;
int width;
/* default coding system is UTF8 */
int *groundtable = utf8_groundtable;

View File

@ -256,7 +256,8 @@ TermView::_InitObject(int32 argc, const char **argv)
//SetIMAware(false);
status_t status = fShell->Open(fTermRows, fTermColumns,
longname2shortname(id2longname(fEncoding)), argc, argv);
EncodingAsShortString(fEncoding),
argc, argv);
if (status < B_OK)
return status;

View File

@ -115,7 +115,7 @@ void
TermWindow::MenusBeginning()
{
// 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)
item->SetMarked(true);
BWindow::MenusBeginning();
@ -606,7 +606,7 @@ TermWindow::_AddTab(Arguments *args)
// TODO: shouldn't this be done in BScrollView itself ? At least BScrollBar does that.
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;
_GetPreferredFont(font);