Change schema in Terminal to color scheme.
Love this feature, but, color schema is not a thing, it is a color scheme. Change both the display text and the variable names. Also changed "Retro Terminal" color scheme to just "Retro". Terminal is redundant.
This commit is contained in:
parent
760de9b200
commit
2005db27ff
@ -100,10 +100,10 @@ AppearancePrefView::AppearancePrefView(const char* name,
|
||||
fFont = new BMenuField(B_TRANSLATE("Font:"), fontMenu);
|
||||
fFontSize = new BMenuField(B_TRANSLATE("Size:"), sizeMenu);
|
||||
|
||||
BPopUpMenu* schemasPopUp = _MakeColorSchemaMenu(MSG_COLOR_SCHEMA_CHANGED,
|
||||
gPredefinedSchemas, gPredefinedSchemas[0]);
|
||||
fColorSchemaField = new BMenuField(B_TRANSLATE("Color schema:"),
|
||||
schemasPopUp);
|
||||
BPopUpMenu* schemesPopUp = _MakeColorSchemeMenu(MSG_COLOR_SCHEME_CHANGED,
|
||||
gPredefinedColorSchemes, gPredefinedColorSchemes[0]);
|
||||
fColorSchemeField = new BMenuField(B_TRANSLATE("Color scheme:"),
|
||||
schemesPopUp);
|
||||
|
||||
BPopUpMenu* colorsPopUp = _MakeMenu(MSG_COLOR_FIELD_CHANGED, kColorTable,
|
||||
kColorTable[0]);
|
||||
@ -139,8 +139,8 @@ AppearancePrefView::AppearancePrefView(const char* name,
|
||||
.Add(fFont->CreateMenuBarLayoutItem(), 1, 2)
|
||||
.Add(fFontSize->CreateLabelLayoutItem(), 0, 3)
|
||||
.Add(fFontSize->CreateMenuBarLayoutItem(), 1, 3)
|
||||
.Add(fColorSchemaField->CreateLabelLayoutItem(), 0, 4)
|
||||
.Add(fColorSchemaField->CreateMenuBarLayoutItem(), 1, 4)
|
||||
.Add(fColorSchemeField->CreateLabelLayoutItem(), 0, 4)
|
||||
.Add(fColorSchemeField->CreateMenuBarLayoutItem(), 1, 4)
|
||||
.Add(fColorField->CreateLabelLayoutItem(), 0, 5)
|
||||
.Add(fColorField->CreateMenuBarLayoutItem(), 1, 5)
|
||||
.End()
|
||||
@ -155,7 +155,7 @@ AppearancePrefView::AppearancePrefView(const char* name,
|
||||
fFont->SetAlignment(B_ALIGN_RIGHT);
|
||||
fFontSize->SetAlignment(B_ALIGN_RIGHT);
|
||||
fColorField->SetAlignment(B_ALIGN_RIGHT);
|
||||
fColorSchemaField->SetAlignment(B_ALIGN_RIGHT);
|
||||
fColorSchemeField->SetAlignment(B_ALIGN_RIGHT);
|
||||
|
||||
fTabTitle->SetText(PrefHandler::Default()->getString(PREF_TAB_TITLE));
|
||||
fWindowTitle->SetText(PrefHandler::Default()->getString(PREF_WINDOW_TITLE));
|
||||
@ -197,7 +197,7 @@ AppearancePrefView::Revert()
|
||||
fWarnOnExit->SetValue(PrefHandler::Default()->getBool(
|
||||
PREF_WARN_ON_EXIT));
|
||||
|
||||
fColorSchemaField->Menu()->ItemAt(0)->SetMarked(true);
|
||||
fColorSchemeField->Menu()->ItemAt(0)->SetMarked(true);
|
||||
fColorControl->SetValue(PrefHandler::Default()->
|
||||
getRGB(PREF_TEXT_FORE_COLOR));
|
||||
|
||||
@ -221,12 +221,12 @@ AppearancePrefView::AttachedToWindow()
|
||||
|
||||
fColorControl->SetTarget(this);
|
||||
fColorField->Menu()->SetTargetForItems(this);
|
||||
fColorSchemaField->Menu()->SetTargetForItems(this);
|
||||
fColorSchemeField->Menu()->SetTargetForItems(this);
|
||||
|
||||
_SetCurrentColorSchema(fColorSchemaField);
|
||||
_SetCurrentColorScheme(fColorSchemeField);
|
||||
bool enableCustomColors =
|
||||
!strcmp(fColorSchemaField->Menu()->FindMarked()->Label(),
|
||||
gCustomSchema.name);
|
||||
!strcmp(fColorSchemeField->Menu()->FindMarked()->Label(),
|
||||
gCustomColorScheme.name);
|
||||
|
||||
_EnableCustomColors(enableCustomColors);
|
||||
}
|
||||
@ -281,17 +281,17 @@ AppearancePrefView::MessageReceived(BMessage* msg)
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_COLOR_SCHEMA_CHANGED:
|
||||
case MSG_COLOR_SCHEME_CHANGED:
|
||||
{
|
||||
color_schema* newSchema = NULL;
|
||||
if (msg->FindPointer("color_schema",
|
||||
(void**)&newSchema) == B_OK) {
|
||||
color_scheme* newScheme = NULL;
|
||||
if (msg->FindPointer("color_scheme",
|
||||
(void**)&newScheme) == B_OK) {
|
||||
|
||||
if (newSchema == &gCustomSchema)
|
||||
if (newScheme == &gCustomColorScheme)
|
||||
_EnableCustomColors(true);
|
||||
else
|
||||
_EnableCustomColors(false);
|
||||
_ChangeColorSchema(newSchema);
|
||||
_ChangeColorScheme(newScheme);
|
||||
modified = true;
|
||||
}
|
||||
break;
|
||||
@ -366,45 +366,46 @@ AppearancePrefView::_EnableCustomColors(bool enable)
|
||||
|
||||
|
||||
void
|
||||
AppearancePrefView::_ChangeColorSchema(color_schema* schema)
|
||||
AppearancePrefView::_ChangeColorScheme(color_scheme* scheme)
|
||||
{
|
||||
PrefHandler* pref = PrefHandler::Default();
|
||||
|
||||
pref->setRGB(PREF_TEXT_FORE_COLOR, schema->text_fore_color);
|
||||
pref->setRGB(PREF_TEXT_BACK_COLOR, schema->text_back_color);
|
||||
pref->setRGB(PREF_SELECT_FORE_COLOR, schema->select_fore_color);
|
||||
pref->setRGB(PREF_SELECT_BACK_COLOR, schema->select_back_color);
|
||||
pref->setRGB(PREF_CURSOR_FORE_COLOR, schema->cursor_fore_color);
|
||||
pref->setRGB(PREF_CURSOR_BACK_COLOR, schema->cursor_back_color);
|
||||
pref->setRGB(PREF_TEXT_FORE_COLOR, scheme->text_fore_color);
|
||||
pref->setRGB(PREF_TEXT_BACK_COLOR, scheme->text_back_color);
|
||||
pref->setRGB(PREF_SELECT_FORE_COLOR, scheme->select_fore_color);
|
||||
pref->setRGB(PREF_SELECT_BACK_COLOR, scheme->select_back_color);
|
||||
pref->setRGB(PREF_CURSOR_FORE_COLOR, scheme->cursor_fore_color);
|
||||
pref->setRGB(PREF_CURSOR_BACK_COLOR, scheme->cursor_back_color);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AppearancePrefView::_SetCurrentColorSchema(BMenuField* field)
|
||||
AppearancePrefView::_SetCurrentColorScheme(BMenuField* field)
|
||||
{
|
||||
PrefHandler* pref = PrefHandler::Default();
|
||||
|
||||
gCustomSchema.text_fore_color = pref->getRGB(PREF_TEXT_FORE_COLOR);
|
||||
gCustomSchema.text_back_color = pref->getRGB(PREF_TEXT_BACK_COLOR);
|
||||
gCustomSchema.select_fore_color = pref->getRGB(PREF_SELECT_FORE_COLOR);
|
||||
gCustomSchema.select_back_color = pref->getRGB(PREF_SELECT_BACK_COLOR);
|
||||
gCustomSchema.cursor_fore_color = pref->getRGB(PREF_CURSOR_FORE_COLOR);
|
||||
gCustomSchema.cursor_back_color = pref->getRGB(PREF_CURSOR_BACK_COLOR);
|
||||
gCustomColorScheme.text_fore_color = pref->getRGB(PREF_TEXT_FORE_COLOR);
|
||||
gCustomColorScheme.text_back_color = pref->getRGB(PREF_TEXT_BACK_COLOR);
|
||||
gCustomColorScheme.select_fore_color = pref->getRGB(PREF_SELECT_FORE_COLOR);
|
||||
gCustomColorScheme.select_back_color = pref->getRGB(PREF_SELECT_BACK_COLOR);
|
||||
gCustomColorScheme.cursor_fore_color = pref->getRGB(PREF_CURSOR_FORE_COLOR);
|
||||
gCustomColorScheme.cursor_back_color = pref->getRGB(PREF_CURSOR_BACK_COLOR);
|
||||
|
||||
const char* currentSchemaName = NULL;
|
||||
const char* currentSchemeName = NULL;
|
||||
|
||||
color_schema** schemas = const_cast<color_schema**>(gPredefinedSchemas);
|
||||
while (*schemas) {
|
||||
if (gCustomSchema == **schemas) {
|
||||
currentSchemaName = (*schemas)->name;
|
||||
color_scheme** schemes
|
||||
= const_cast<color_scheme**>(gPredefinedColorSchemes);
|
||||
while (*schemes) {
|
||||
if (gCustomColorScheme == **schemes) {
|
||||
currentSchemeName = (*schemes)->name;
|
||||
break;
|
||||
}
|
||||
schemas++;
|
||||
schemes++;
|
||||
}
|
||||
|
||||
for (int32 i = 0; i < fColorSchemaField->Menu()->CountItems(); i++) {
|
||||
BMenuItem* item = fColorSchemaField->Menu()->ItemAt(i);
|
||||
if (!strcmp(item->Label(), currentSchemaName)) {
|
||||
for (int32 i = 0; i < fColorSchemeField->Menu()->CountItems(); i++) {
|
||||
BMenuItem* item = fColorSchemeField->Menu()->ItemAt(i);
|
||||
if (!strcmp(item->Label(), currentSchemeName)) {
|
||||
item->SetMarked(true);
|
||||
break;
|
||||
}
|
||||
@ -521,8 +522,8 @@ AppearancePrefView::_MakeMenu(uint32 msg, const char** items,
|
||||
|
||||
|
||||
/*static*/ BPopUpMenu*
|
||||
AppearancePrefView::_MakeColorSchemaMenu(uint32 msg, const color_schema** items,
|
||||
const color_schema* defaultItemName)
|
||||
AppearancePrefView::_MakeColorSchemeMenu(uint32 msg, const color_scheme** items,
|
||||
const color_scheme* defaultItemName)
|
||||
{
|
||||
BPopUpMenu* menu = new BPopUpMenu("");
|
||||
|
||||
@ -532,7 +533,7 @@ AppearancePrefView::_MakeColorSchemaMenu(uint32 msg, const color_schema** items,
|
||||
menu->AddSeparatorItem();
|
||||
else {
|
||||
BMessage* message = new BMessage(msg);
|
||||
message->AddPointer("color_schema", (const void*)*items);
|
||||
message->AddPointer("color_scheme", (const void*)*items);
|
||||
menu->AddItem(new BMenuItem((*items)->name, message));
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ static const uint32 MSG_FULL_FONT_CHANGED = 'mcff';
|
||||
static const uint32 MSG_FULL_SIZE_CHANGED = 'mcfs';
|
||||
static const uint32 MSG_COLOR_FIELD_CHANGED = 'mccf';
|
||||
static const uint32 MSG_COLOR_CHANGED = 'mcbc';
|
||||
static const uint32 MSG_COLOR_SCHEMA_CHANGED = 'mccs';
|
||||
static const uint32 MSG_COLOR_SCHEME_CHANGED = 'mccs';
|
||||
|
||||
static const uint32 MSG_TAB_TITLE_SETTING_CHANGED = 'mtts';
|
||||
static const uint32 MSG_WINDOW_TITLE_SETTING_CHANGED = 'mwts';
|
||||
@ -32,7 +32,7 @@ static const uint32 MSG_HISTORY_CHANGED = 'mhst';
|
||||
static const uint32 MSG_PREF_MODIFIED = 'mpmo';
|
||||
|
||||
|
||||
struct color_schema;
|
||||
struct color_scheme;
|
||||
class BCheckBox;
|
||||
class BColorControl;
|
||||
class BMenu;
|
||||
@ -56,8 +56,8 @@ public:
|
||||
private:
|
||||
void _EnableCustomColors(bool enable);
|
||||
|
||||
void _ChangeColorSchema(color_schema* schema);
|
||||
void _SetCurrentColorSchema(BMenuField* field);
|
||||
void _ChangeColorScheme(color_scheme* scheme);
|
||||
void _SetCurrentColorScheme(BMenuField* field);
|
||||
|
||||
static BMenu* _MakeFontMenu(uint32 command,
|
||||
const char* defaultFamily,
|
||||
@ -68,16 +68,16 @@ private:
|
||||
static BPopUpMenu* _MakeMenu(uint32 msg, const char** items,
|
||||
const char* defaultItem);
|
||||
|
||||
static BPopUpMenu* _MakeColorSchemaMenu(uint32 msg,
|
||||
const color_schema** schemas,
|
||||
const color_schema* defaultItemName);
|
||||
static BPopUpMenu* _MakeColorSchemeMenu(uint32 msg,
|
||||
const color_scheme** schemes,
|
||||
const color_scheme* defaultItemName);
|
||||
|
||||
BCheckBox* fBlinkCursor;
|
||||
BCheckBox* fWarnOnExit;
|
||||
BMenuField* fFont;
|
||||
BMenuField* fFontSize;
|
||||
|
||||
BMenuField* fColorSchemaField;
|
||||
BMenuField* fColorSchemeField;
|
||||
BMenuField* fColorField;
|
||||
BColorControl* fColorControl;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "Terminal colors schema"
|
||||
#define B_TRANSLATION_CONTEXT "Terminal colors scheme"
|
||||
|
||||
|
||||
// Standard colors
|
||||
@ -20,7 +20,7 @@ const rgb_color kWhite = { 255, 255, 255, 255 };
|
||||
const rgb_color kYellow = { 255, 255, 0, 255 };
|
||||
|
||||
|
||||
const struct color_schema kColorDefault = {
|
||||
const struct color_scheme kColorSchemeDefault = {
|
||||
B_TRANSLATE("Default"),
|
||||
kBlack,
|
||||
kWhite,
|
||||
@ -30,7 +30,7 @@ const struct color_schema kColorDefault = {
|
||||
kBlack
|
||||
};
|
||||
|
||||
const struct color_schema kColorBlue = {
|
||||
const struct color_scheme kColorSchemeBlue = {
|
||||
B_TRANSLATE("Blue"),
|
||||
kYellow,
|
||||
{ 0, 0, 139, 255 },
|
||||
@ -40,7 +40,7 @@ const struct color_schema kColorBlue = {
|
||||
{ 0, 139, 139, 255 },
|
||||
};
|
||||
|
||||
const struct color_schema kColorMidnight = {
|
||||
const struct color_scheme kColorSchemeMidnight = {
|
||||
B_TRANSLATE("Midnight"),
|
||||
kWhite,
|
||||
kBlack,
|
||||
@ -50,7 +50,7 @@ const struct color_schema kColorMidnight = {
|
||||
kWhite
|
||||
};
|
||||
|
||||
const struct color_schema kColorProfessional = {
|
||||
const struct color_scheme kColorSchemeProfessional = {
|
||||
B_TRANSLATE("Professional"),
|
||||
kWhite,
|
||||
{ 8, 8, 8, 255 },
|
||||
@ -60,8 +60,8 @@ const struct color_schema kColorProfessional = {
|
||||
{ 50, 50, 50, 255 },
|
||||
};
|
||||
|
||||
const struct color_schema kColorRetroTerminal = {
|
||||
B_TRANSLATE("Retro Terminal"),
|
||||
const struct color_scheme kColorSchemeRetro = {
|
||||
B_TRANSLATE("Retro"),
|
||||
kGreen,
|
||||
kBlack,
|
||||
kBlack,
|
||||
@ -70,7 +70,7 @@ const struct color_schema kColorRetroTerminal = {
|
||||
kGreen
|
||||
};
|
||||
|
||||
const struct color_schema kColorSlate = {
|
||||
const struct color_scheme kColorSchemeSlate = {
|
||||
B_TRANSLATE("Slate"),
|
||||
kWhite,
|
||||
{ 20, 20, 28, 255 },
|
||||
@ -80,31 +80,31 @@ const struct color_schema kColorSlate = {
|
||||
{ 70, 70, 70, 255 },
|
||||
};
|
||||
|
||||
struct color_schema gCustomSchema = {
|
||||
struct color_scheme gCustomColorScheme = {
|
||||
B_TRANSLATE("Custom")
|
||||
};
|
||||
|
||||
const color_schema* gPredefinedSchemas[] = {
|
||||
&kColorDefault,
|
||||
&kColorBlue,
|
||||
&kColorMidnight,
|
||||
&kColorProfessional,
|
||||
&kColorRetroTerminal,
|
||||
&kColorSlate,
|
||||
&gCustomSchema,
|
||||
const color_scheme* gPredefinedColorSchemes[] = {
|
||||
&kColorSchemeDefault,
|
||||
&kColorSchemeBlue,
|
||||
&kColorSchemeMidnight,
|
||||
&kColorSchemeProfessional,
|
||||
&kColorSchemeRetro,
|
||||
&kColorSchemeSlate,
|
||||
&gCustomColorScheme,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
bool
|
||||
color_schema::operator==(const color_schema& schema)
|
||||
color_scheme::operator==(const color_scheme& scheme)
|
||||
{
|
||||
if (text_fore_color == schema.text_fore_color
|
||||
&& text_back_color == schema.text_back_color
|
||||
&& cursor_fore_color == schema.cursor_fore_color
|
||||
&& cursor_back_color == schema.cursor_back_color
|
||||
&& select_fore_color == schema.select_fore_color
|
||||
&& select_back_color == schema.select_back_color)
|
||||
if (text_fore_color == scheme.text_fore_color
|
||||
&& text_back_color == scheme.text_back_color
|
||||
&& cursor_fore_color == scheme.cursor_fore_color
|
||||
&& cursor_back_color == scheme.cursor_back_color
|
||||
&& select_fore_color == scheme.select_fore_color
|
||||
&& select_back_color == scheme.select_back_color)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -8,7 +8,8 @@
|
||||
|
||||
#include <InterfaceDefs.h>
|
||||
|
||||
struct color_schema {
|
||||
|
||||
struct color_scheme {
|
||||
const char* name;
|
||||
rgb_color text_fore_color;
|
||||
rgb_color text_back_color;
|
||||
@ -16,12 +17,11 @@ struct color_schema {
|
||||
rgb_color cursor_back_color;
|
||||
rgb_color select_fore_color;
|
||||
rgb_color select_back_color;
|
||||
bool operator==(const color_schema& color);
|
||||
bool operator==(const color_scheme& color);
|
||||
};
|
||||
|
||||
|
||||
extern color_schema gCustomSchema;
|
||||
extern const color_schema* gPredefinedSchemas[];
|
||||
extern color_scheme gCustomColorScheme;
|
||||
extern const color_scheme* gPredefinedColorSchemes[];
|
||||
|
||||
|
||||
#endif // _COLORS_H
|
||||
|
@ -839,7 +839,7 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
break;
|
||||
|
||||
case MSG_COLOR_CHANGED:
|
||||
case MSG_COLOR_SCHEMA_CHANGED:
|
||||
case MSG_COLOR_SCHEME_CHANGED:
|
||||
{
|
||||
_SetTermColors(_ActiveTermViewContainerView());
|
||||
_ActiveTermViewContainerView()->Invalidate();
|
||||
|
Loading…
Reference in New Issue
Block a user