Terminal: always use bright for bold text.
* "Allow bold font" now enables the use of the bold font for bold text. * so one can now see bold text in black on black.
This commit is contained in:
parent
6c2abee2f5
commit
105acc92e3
@ -61,9 +61,9 @@ AppearancePrefView::AppearancePrefView(const char* name,
|
||||
B_TRANSLATE("Blinking cursor"),
|
||||
new BMessage(MSG_BLINK_CURSOR_CHANGED));
|
||||
|
||||
fBrightInsteadOfBold = new BCheckBox(
|
||||
B_TRANSLATE("Use bright instead of bold text"),
|
||||
new BMessage(MSG_BRIGHT_INSTEAD_OF_BOLD_CHANGED));
|
||||
fAllowBold = new BCheckBox(
|
||||
B_TRANSLATE("Allow bold text"),
|
||||
new BMessage(MSG_ALLOW_BOLD_CHANGED));
|
||||
|
||||
fWarnOnExit = new BCheckBox(
|
||||
B_TRANSLATE("Confirm exit if active programs exist"),
|
||||
@ -139,7 +139,7 @@ AppearancePrefView::AppearancePrefView(const char* name,
|
||||
.Add(fColorControl = new BColorControl(BPoint(10, 10),
|
||||
B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED)))
|
||||
.Add(fBlinkCursor)
|
||||
.Add(fBrightInsteadOfBold)
|
||||
.Add(fAllowBold)
|
||||
.Add(fWarnOnExit);
|
||||
|
||||
fTabTitle->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||
@ -171,7 +171,7 @@ AppearancePrefView::Revert()
|
||||
fWindowTitle->SetText(pref->getString(PREF_WINDOW_TITLE));
|
||||
|
||||
fBlinkCursor->SetValue(pref->getBool(PREF_BLINK_CURSOR));
|
||||
fBrightInsteadOfBold->SetValue(pref->getBool(PREF_BRIGHT_INSTEAD_OF_BOLD));
|
||||
fAllowBold->SetValue(pref->getBool(PREF_ALLOW_BOLD));
|
||||
fWarnOnExit->SetValue(pref->getBool(PREF_WARN_ON_EXIT));
|
||||
|
||||
_SetCurrentColorScheme();
|
||||
@ -193,7 +193,7 @@ AppearancePrefView::AttachedToWindow()
|
||||
fTabTitle->SetTarget(this);
|
||||
fWindowTitle->SetTarget(this);
|
||||
fBlinkCursor->SetTarget(this);
|
||||
fBrightInsteadOfBold->SetTarget(this);
|
||||
fAllowBold->SetTarget(this);
|
||||
fWarnOnExit->SetTarget(this);
|
||||
|
||||
fFontField->Menu()->SetTargetForItems(this);
|
||||
@ -329,11 +329,11 @@ AppearancePrefView::MessageReceived(BMessage* msg)
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_BRIGHT_INSTEAD_OF_BOLD_CHANGED:
|
||||
if (PrefHandler::Default()->getBool(PREF_BRIGHT_INSTEAD_OF_BOLD)
|
||||
!= fBrightInsteadOfBold->Value()) {
|
||||
PrefHandler::Default()->setBool(PREF_BRIGHT_INSTEAD_OF_BOLD,
|
||||
fBrightInsteadOfBold->Value());
|
||||
case MSG_ALLOW_BOLD_CHANGED:
|
||||
if (PrefHandler::Default()->getBool(PREF_ALLOW_BOLD)
|
||||
!= fAllowBold->Value()) {
|
||||
PrefHandler::Default()->setBool(PREF_ALLOW_BOLD,
|
||||
fAllowBold->Value());
|
||||
modified = true;
|
||||
}
|
||||
break;
|
||||
|
@ -24,7 +24,7 @@ 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';
|
||||
static const uint32 MSG_BLINK_CURSOR_CHANGED = 'mbcc';
|
||||
static const uint32 MSG_BRIGHT_INSTEAD_OF_BOLD_CHANGED = 'bibc';
|
||||
static const uint32 MSG_ALLOW_BOLD_CHANGED = 'mabc';
|
||||
static const uint32 MSG_WARN_ON_EXIT_CHANGED = 'mwec';
|
||||
static const uint32 MSG_COLS_CHANGED = 'mccl';
|
||||
static const uint32 MSG_HISTORY_CHANGED = 'mhst';
|
||||
@ -77,7 +77,7 @@ private:
|
||||
const char* style, const char* size);
|
||||
|
||||
BCheckBox* fBlinkCursor;
|
||||
BCheckBox* fBrightInsteadOfBold;
|
||||
BCheckBox* fAllowBold;
|
||||
BCheckBox* fWarnOnExit;
|
||||
BMenuField* fFontField;
|
||||
|
||||
|
@ -132,8 +132,7 @@ static const char* const PREF_ROWS = "Rows";
|
||||
static const char* const PREF_TEXT_ENCODING = "Text encoding";
|
||||
|
||||
static const char* const PREF_BLINK_CURSOR = "Blinking cursor";
|
||||
static const char* const PREF_BRIGHT_INSTEAD_OF_BOLD =
|
||||
"Bright instead of bold text";
|
||||
static const char* const PREF_ALLOW_BOLD = "Allow bold text";
|
||||
static const char* const PREF_WARN_ON_EXIT = "Warn on exit";
|
||||
static const char* const PREF_CURSOR_STYLE = "Cursor style";
|
||||
static const char* const PREF_EMULATE_BOLD = "Emulate bold";
|
||||
|
@ -283,7 +283,7 @@ TermView::_InitObject(const ShellParameters& shellParameters)
|
||||
fFontHeight = 0;
|
||||
fFontAscent = 0;
|
||||
fEmulateBold = false;
|
||||
fBrightInsteadOfBold = false;
|
||||
fAllowBold = false;
|
||||
fFrameResized = false;
|
||||
fResizeViewDisableCount = 0;
|
||||
fLastActivityTime = 0;
|
||||
@ -779,8 +779,8 @@ TermView::SetTermFont(const BFont *font)
|
||||
fEmulateBold = PrefHandler::Default() == NULL ? false
|
||||
: PrefHandler::Default()->getBool(PREF_EMULATE_BOLD);
|
||||
|
||||
fBrightInsteadOfBold = PrefHandler::Default() == NULL ? false
|
||||
: PrefHandler::Default()->getBool(PREF_BRIGHT_INSTEAD_OF_BOLD);
|
||||
fAllowBold = PrefHandler::Default() == NULL ? false
|
||||
: PrefHandler::Default()->getBool(PREF_ALLOW_BOLD);
|
||||
|
||||
_ScrollTo(0, false);
|
||||
if (fScrollBar != NULL)
|
||||
@ -962,7 +962,7 @@ TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf,
|
||||
if (highlight != NULL)
|
||||
attr = highlight->Highlighter()->AdjustTextAttributes(attr);
|
||||
|
||||
inView->SetFont(IS_BOLD(attr) && !fEmulateBold && !fBrightInsteadOfBold
|
||||
inView->SetFont(IS_BOLD(attr) && !fEmulateBold && fAllowBold
|
||||
? &fBoldFont : &fHalfFont);
|
||||
|
||||
// Set pen point
|
||||
@ -1005,7 +1005,11 @@ TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf,
|
||||
|
||||
// Draw character.
|
||||
if (IS_BOLD(attr)) {
|
||||
if (fBrightInsteadOfBold) {
|
||||
if (fEmulateBold) {
|
||||
inView->MovePenTo(x1 - 1, y1 + fFontAscent - 1);
|
||||
inView->DrawString((char *)buf);
|
||||
inView->SetDrawingMode(B_OP_BLEND);
|
||||
} else {
|
||||
rgb_color bright = rgb_fore;
|
||||
|
||||
bright.red = saturated_add<uint8>(bright.red, 64);
|
||||
@ -1013,10 +1017,6 @@ TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf,
|
||||
bright.blue = saturated_add<uint8>(bright.blue, 64);
|
||||
|
||||
inView->SetHighColor(bright);
|
||||
} else if (fEmulateBold) {
|
||||
inView->MovePenTo(x1 - 1, y1 + fFontAscent - 1);
|
||||
inView->DrawString((char *)buf);
|
||||
inView->SetDrawingMode(B_OP_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ private:
|
||||
int fFontAscent;
|
||||
struct escapement_delta fEscapement;
|
||||
bool fEmulateBold;
|
||||
bool fBrightInsteadOfBold;
|
||||
bool fAllowBold;
|
||||
|
||||
// frame resized flag.
|
||||
bool fFrameResized;
|
||||
|
@ -840,7 +840,7 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
|
||||
case MSG_HALF_FONT_CHANGED:
|
||||
case MSG_FULL_FONT_CHANGED:
|
||||
case MSG_BRIGHT_INSTEAD_OF_BOLD_CHANGED:
|
||||
case MSG_ALLOW_BOLD_CHANGED:
|
||||
{
|
||||
BFont font;
|
||||
_GetPreferredFont(font);
|
||||
|
Loading…
Reference in New Issue
Block a user