Commit 253a5cc8 authored by Valentine Sinitsyn's avatar Valentine Sinitsyn

Make bold font for bright (intensive) ANSI colors a user-configurable option...

Make bold font for bright (intensive) ANSI colors a user-configurable option rather than hardcoded default.
BUG: 226308


svn path=/trunk/KDE/kdebase/apps/konsole/; revision=1133477
parent ee7b0500
...@@ -477,6 +477,11 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info) ...@@ -477,6 +477,11 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
_ui->antialiasTextButton->setChecked(antialias); _ui->antialiasTextButton->setChecked(antialias);
connect( _ui->antialiasTextButton , SIGNAL(toggled(bool)) , this , connect( _ui->antialiasTextButton , SIGNAL(toggled(bool)) , this ,
SLOT(setAntialiasText(bool)) ); SLOT(setAntialiasText(bool)) );
bool boldIntense = info->property<bool>(Profile::BoldIntense);
_ui->boldIntenseButton->setChecked(boldIntense);
connect( _ui->boldIntenseButton , SIGNAL(toggled(bool)) , this ,
SLOT(setBoldIntense(bool)));
} }
void EditProfileDialog::setAntialiasText(bool enable) void EditProfileDialog::setAntialiasText(bool enable)
{ {
...@@ -488,6 +493,11 @@ void EditProfileDialog::setAntialiasText(bool enable) ...@@ -488,6 +493,11 @@ void EditProfileDialog::setAntialiasText(bool enable)
// update preview to reflect text smoothing state // update preview to reflect text smoothing state
fontSelected(font); fontSelected(font);
} }
void EditProfileDialog::setBoldIntense(bool enable)
{
_tempProfile->setProperty(Profile::BoldIntense,enable);
preview(Profile::BoldIntense,enable);
}
void EditProfileDialog::colorSchemeAnimationUpdate() void EditProfileDialog::colorSchemeAnimationUpdate()
{ {
QAbstractItemModel* model = _ui->colorSchemeList->model(); QAbstractItemModel* model = _ui->colorSchemeList->model();
......
...@@ -130,6 +130,7 @@ private slots: ...@@ -130,6 +130,7 @@ private slots:
void setFontSliderRange(const QFont&); void setFontSliderRange(const QFont&);
void setFontSliderValue(const QFont&); void setFontSliderValue(const QFont&);
void setAntialiasText(bool enable); void setAntialiasText(bool enable);
void setBoldIntense(bool enable);
void showFontDialog(); void showFontDialog();
void newColorScheme(); void newColorScheme();
void editColorScheme(); void editColorScheme();
......
...@@ -580,6 +580,13 @@ ...@@ -580,6 +580,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="boldIntenseButton">
<property name="text">
<string>Draw intense colors in bold font</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
......
...@@ -87,6 +87,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = ...@@ -87,6 +87,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] =
, { ColorScheme , "ColorScheme" , APPEARANCE_GROUP , QVariant::String } , { ColorScheme , "ColorScheme" , APPEARANCE_GROUP , QVariant::String }
, { ColorScheme , "colors" , 0 , QVariant::String } , { ColorScheme , "colors" , 0 , QVariant::String }
, { AntiAliasFonts, "AntiAliasFonts" , APPEARANCE_GROUP , QVariant::Bool } , { AntiAliasFonts, "AntiAliasFonts" , APPEARANCE_GROUP , QVariant::Bool }
, { BoldIntense, "BoldIntense", APPEARANCE_GROUP, QVariant::Bool }
// Keyboard // Keyboard
, { KeyBindings , "KeyBindings" , KEYBOARD_GROUP , QVariant::String } , { KeyBindings , "KeyBindings" , KEYBOARD_GROUP , QVariant::String }
...@@ -179,6 +180,7 @@ FallbackProfile::FallbackProfile() ...@@ -179,6 +180,7 @@ FallbackProfile::FallbackProfile()
setProperty(DefaultEncoding,QString(QTextCodec::codecForLocale()->name())); setProperty(DefaultEncoding,QString(QTextCodec::codecForLocale()->name()));
setProperty(AntiAliasFonts,true); setProperty(AntiAliasFonts,true);
setProperty(BoldIntense,true);
// default taken from KDE 3 // default taken from KDE 3
setProperty(WordCharacters,":@-./_~?&=%+#"); setProperty(WordCharacters,":@-./_~?&=%+#");
......
...@@ -184,6 +184,9 @@ public: ...@@ -184,6 +184,9 @@ public:
AntiAliasFonts, AntiAliasFonts,
/** (bool) Whether new sessions should be started in the same directory as the /** (bool) Whether new sessions should be started in the same directory as the
* currently active session. */ * currently active session. */
BoldIntense,
/** (bool) Whether character with intense colors should be rendered in bold font
* or just in bright color. */
StartInCurrentSessionDir, StartInCurrentSessionDir,
/** (bool) Whether a 'New Tab' and 'Close Tab' buttons should be shown on the tab bar */ /** (bool) Whether a 'New Tab' and 'Close Tab' buttons should be shown on the tab bar */
ShowNewAndCloseTabButtons, ShowNewAndCloseTabButtons,
......
...@@ -286,6 +286,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent) ...@@ -286,6 +286,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_fontHeight(1) ,_fontHeight(1)
,_fontWidth(1) ,_fontWidth(1)
,_fontAscent(1) ,_fontAscent(1)
,_boldIntense(true)
,_lines(1) ,_lines(1)
,_columns(1) ,_columns(1)
,_usedLines(1) ,_usedLines(1)
...@@ -516,7 +517,7 @@ void TerminalDisplay::drawLineCharString( QPainter& painter, int x, int y, co ...@@ -516,7 +517,7 @@ void TerminalDisplay::drawLineCharString( QPainter& painter, int x, int y, co
{ {
const QPen& currentPen = painter.pen(); const QPen& currentPen = painter.pen();
if ( attributes->rendition & RE_BOLD ) if ( (attributes->rendition & RE_BOLD) && _boldIntense )
{ {
QPen boldPen(currentPen); QPen boldPen(currentPen);
boldPen.setWidth(3); boldPen.setWidth(3);
...@@ -672,9 +673,9 @@ void TerminalDisplay::drawCharacters(QPainter& painter, ...@@ -672,9 +673,9 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
// setup bold and underline // setup bold and underline
bool useBold; bool useBold;
ColorEntry::FontWeight weight = style->fontWeight(_colorTable); ColorEntry::FontWeight weight = style->fontWeight(_colorTable);
if (weight == ColorEntry::UseCurrentFormat) if (weight == ColorEntry::UseCurrentFormat)
useBold = style->rendition & RE_BOLD || font().bold(); useBold = ((style->rendition & RE_BOLD) && _boldIntense) || font().bold();
else else
useBold = (weight == ColorEntry::Bold) ? true : false; useBold = (weight == ColorEntry::Bold) ? true : false;
bool useUnderline = style->rendition & RE_UNDERLINE || font().underline(); bool useUnderline = style->rendition & RE_UNDERLINE || font().underline();
......
...@@ -355,6 +355,16 @@ public: ...@@ -355,6 +355,16 @@ public:
* Returns true if anti-aliasing of text in the terminal is enabled. * Returns true if anti-aliasing of text in the terminal is enabled.
*/ */
static bool antialias() { return _antialiasText; } static bool antialias() { return _antialiasText; }
/**
* Specifies whether characters with intense colors should be rendered
* as bold. Defaults to true.
*/
void setBoldIntense(bool value) { _boldIntense = value; }
/**
* Returns true if characters with intense colors are rendered in bold.
*/
bool getBoldIntense() { return _boldIntense; }
/** /**
* Sets whether or not the current height and width of the * Sets whether or not the current height and width of the
...@@ -676,6 +686,7 @@ private: ...@@ -676,6 +686,7 @@ private:
int _fontHeight; // height int _fontHeight; // height
int _fontWidth; // width int _fontWidth; // width
int _fontAscent; // ascend int _fontAscent; // ascend
bool _boldIntense; // Whether intense colors should be rendered with bold font
int _leftMargin; // offset int _leftMargin; // offset
int _topMargin; // offset int _topMargin; // offset
......
...@@ -832,6 +832,7 @@ void ViewManager::applyProfile(TerminalDisplay* view , const Profile::Ptr info, ...@@ -832,6 +832,7 @@ void ViewManager::applyProfile(TerminalDisplay* view , const Profile::Ptr info,
// load font // load font
view->setAntialias(info->property<bool>(Profile::AntiAliasFonts)); view->setAntialias(info->property<bool>(Profile::AntiAliasFonts));
view->setBoldIntense(info->property<bool>(Profile::BoldIntense));
view->setVTFont(info->font()); view->setVTFont(info->font());
// set scroll-bar position // set scroll-bar position
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment