Better contrast on 8 color terminals

This commit is contained in:
Markus Gans 2015-07-09 23:29:51 +02:00
parent 2350242db0
commit 58bd749463
6 changed files with 70 additions and 31 deletions

View File

@ -1,3 +1,6 @@
2015-06-09 Markus Gans <guru.mail@muenster.de>
* Better contrast on 8 color terminals
2015-06-07 Markus Gans <guru.mail@muenster.de>
* Bug fix disable cursor on focus FSwitch
* Hold down the mouse button displays FSwitch in a different color.

View File

@ -150,10 +150,10 @@ void FButton::draw()
else
d = 0;
if ( ! isActive && (isMonochron() || getMaxColor() < 16) )
if ( ! isActive && isMonochron() )
space = fc::MediumShade; // ▒
if ( isMonochron() && isActiveFocus )
if ( (isMonochron() || getMaxColor() < 16) && isActiveFocus )
{
txt = "<" + txt + ">";
length = int(txt.getLength());
@ -202,9 +202,6 @@ void FButton::draw()
}
else if ( ! isMonochron() )
{
if ( ! isActive && getMaxColor() < 16 )
setColor (button_fg, button_bg);
else
setColor (button_bg, parentWidget()->getBackgroundColor());
gotoxy (xpos+xmin-1+d, ypos+ymin-1);
for (int y=1; y <= height; y++)

View File

@ -242,6 +242,7 @@ void FListBox::drawList()
bool serach_mark = false;
bool lineHasBrackets = hasBrackets(int(y)+yoffset+1);
bool isLineSelected = isSelected(int(y)+yoffset+1);
bool isCurrentLine = bool(uInt(y)+uInt(yoffset)+1 == uInt(current));
if ( isLineSelected )
{
@ -258,7 +259,7 @@ void FListBox::drawList()
setColor (wc.list_fg, wc.list_bg);
}
if ( uInt(y)+uInt(yoffset)+1 == uInt(current) )
if ( isCurrentLine )
{
if ( isLineSelected )
{
@ -298,6 +299,9 @@ void FListBox::drawList()
setReverse(false);
// print the entry
if ( isMonochron() && isCurrentLine )
print ('>');
else
print (' ');
if ( lineHasBrackets )
{
@ -373,6 +377,11 @@ void FListBox::drawList()
}
i++;
}
if ( isMonochron() && isCurrentLine )
{
print ('<');
i++;
}
for (; b+i < uInt(width-nf_offset-3); i++)
print (' ');
}
@ -397,6 +406,11 @@ void FListBox::drawList()
print (element_str[i]);
}
if ( isMonochron() && isCurrentLine )
{
print ('<');
i++;
}
for (; i < uInt(width-nf_offset-3); i++)
print (' ');
}

View File

@ -56,29 +56,54 @@ void FSwitch::drawCheckButton()
if ( ! isVisible() )
return;
wchar_t on[6] = L" On ";
wchar_t off[6] = L" Off ";
gotoxy (xpos+xmin-1+switch_offset_pos, ypos+ymin-1);
if ( checked )
{
if ( hasFocus() && ! button_pressed )
{
if ( isMonochron() || getMaxColor() < 16 )
{
wcsncpy ( on, L" <On>", 6);
setColor (wc.button_active_focus_fg, wc.button_active_focus_bg);
}
else
setColor (wc.button_hotkey_fg, wc.button_active_focus_bg);
}
else
if ( isMonochron() || getMaxColor() < 16 )
setColor (wc.button_active_focus_fg, wc.button_active_bg);
else
setColor (wc.button_hotkey_fg, wc.button_active_bg);
print (" On ");
print (on);
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
print (" Off ");
print (off);
setCursorPos ( xpos + xmin + 1 + switch_offset_pos,
ypos + ymin - 1 );
}
else
{
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
print (" On ");
print (on);
if ( hasFocus() && ! button_pressed )
{
if ( isMonochron() || getMaxColor() < 16 )
{
wcsncpy ( off, L"<Off>", 6);
setColor (wc.button_active_focus_fg, wc.button_active_focus_bg);
}
else
setColor (wc.button_hotkey_fg, wc.button_active_focus_bg);
}
else
if ( isMonochron() || getMaxColor() < 16 )
setColor (wc.button_active_focus_fg, wc.button_active_bg);
else
setColor (wc.button_hotkey_fg, wc.button_active_bg);
print (" Off ");
print (off);
setCursorPos ( xpos + xmin + 5 + switch_offset_pos,
ypos + ymin - 1 );
}

View File

@ -258,7 +258,7 @@ void FWidget::setColorTheme()
if ( max_color < 16 ) // for 8 color mode
{
wc.term_fg = fc::Black;
wc.term_bg = fc::Cyan;
wc.term_bg = fc::Blue;
wc.list_fg = fc::Black;
wc.list_bg = fc::LightGray;
wc.selected_list_fg = fc::Blue;
@ -266,9 +266,9 @@ void FWidget::setColorTheme()
wc.dialog_fg = fc::Black;
wc.dialog_emphasis_fg = fc::Blue;
wc.dialog_bg = fc::LightGray;
wc.error_box_fg = fc::LightGray;
wc.error_box_emphasis_fg = fc::Brown;
wc.error_box_bg = fc::Red;
wc.error_box_fg = fc::Black;
wc.error_box_emphasis_fg = fc::Red;
wc.error_box_bg = fc::LightGray;
wc.shadow_fg = fc::Black;
wc.shadow_bg = fc::LightGray; // only for transparent shadow
wc.current_element_focus_fg = fc::LightGray;
@ -300,13 +300,13 @@ void FWidget::setColorTheme()
wc.toggle_button_inactive_bg = fc::LightGray;
wc.button_active_focus_fg = fc::LightGray;
wc.button_active_focus_bg = fc::Blue;
wc.button_active_fg = fc::Black;
wc.button_active_bg = fc::Cyan;
wc.button_inactive_fg = fc::Cyan;
wc.button_inactive_bg = fc::LightGray;
wc.button_active_fg = fc::LightGray;
wc.button_active_bg = fc::Blue;
wc.button_inactive_fg = fc::LightGray;
wc.button_inactive_bg = fc::Cyan;
wc.button_hotkey_fg = fc::Red;
wc.titlebar_active_fg = fc::LightGray;
wc.titlebar_active_bg = fc::Blue;
wc.titlebar_active_bg = fc::Red;
wc.titlebar_inactive_fg = fc::Black;
wc.titlebar_inactive_bg = fc::LightGray;
wc.titlebar_button_fg = fc::Black;
@ -320,11 +320,11 @@ void FWidget::setColorTheme()
wc.statusbar_active_bg = fc::LightGray;
wc.statusbar_active_hotkey_fg = fc::Red;
wc.statusbar_active_hotkey_bg = fc::LightGray;
wc.scrollbar_fg = fc::Blue;
wc.scrollbar_fg = fc::Black;
wc.scrollbar_bg = fc::LightGray;
wc.scrollbar_button_fg = fc::LightGray;
wc.scrollbar_button_bg = fc::Black;
wc.progressbar_fg = fc::Blue;
wc.scrollbar_button_fg = fc::Black;
wc.scrollbar_button_bg = fc::LightGray;
wc.progressbar_fg = fc::Black;
wc.progressbar_bg = fc::LightGray;
}
}

View File

@ -313,7 +313,7 @@ void Calc::drawDispay()
print(display);
print(L' ');
setColor(fc::Black, fc::White);
setColor(wc.dialog_fg, wc.dialog_bg);
if ( isNewFont() )
{
FString bottom_line(33, wchar_t(fc::NF_border_line_bottom));