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> 2015-06-07 Markus Gans <guru.mail@muenster.de>
* Bug fix disable cursor on focus FSwitch * Bug fix disable cursor on focus FSwitch
* Hold down the mouse button displays FSwitch in a different color. * Hold down the mouse button displays FSwitch in a different color.

View File

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

View File

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

View File

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

View File

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

View File

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