Better support for monochrom terminals

This commit is contained in:
Markus Gans 2015-10-11 21:56:16 +02:00
parent a41727c4fc
commit 70f5b545a5
21 changed files with 225 additions and 71 deletions

View File

@ -1,5 +1,6 @@
2015-10-11 Markus Gans <guru.mail@muenster.de> 2015-10-11 Markus Gans <guru.mail@muenster.de>
* Improve attribute setting for bold, reverse and underline output * Improve attribute setting for bold, reverse and underline output
* Better support for monochrom terminals
2015-10-10 Markus Gans <guru.mail@muenster.de> 2015-10-10 Markus Gans <guru.mail@muenster.de>
* Deactivate a key from the status bar automatically * Deactivate a key from the status bar automatically

View File

@ -2,7 +2,6 @@ Bugs
~~~~ ~~~~
- -
Improvements Improvements
~~~~~~~~~~~~ ~~~~~~~~~~~~
- Use only termpap variables for FTerm::hideCursor() - Use only termpap variables for FTerm::hideCursor()
@ -11,10 +10,10 @@ Improvements
-> implement t_exit_reverse_mode with "\E[27m" -> implement t_exit_reverse_mode with "\E[27m"
- New behavior in FTerm::appendAttributes(...) - New behavior in FTerm::appendAttributes(...)
- 1st: reset don't needed attributes (bold, reverse and underline) - 1st: reset don't needed attributes (bold, reverse and underline)
use 'sgr' for this, to do this in one step => 3rd is don't need
- 2nd: set the foreground and background color - 2nd: set the foreground and background color
- 3rd: set new attributes (bold, reverse and underline) - 3rd: set new attributes (bold, reverse and underline)
Missing Features Missing Features
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
- application menu - application menu

View File

@ -145,7 +145,7 @@ void FButton::draw()
hotkey_offset = 0; hotkey_offset = 0;
space = int(' '); space = int(' ');
if ( isMonochron() ) if ( isMonochron() || getMaxColor() < 16 )
ButtonText = new wchar_t[length+3]; ButtonText = new wchar_t[length+3];
else else
ButtonText = new wchar_t[length+1]; ButtonText = new wchar_t[length+1];
@ -162,6 +162,8 @@ void FButton::draw()
is_NoUnderline = ((flags & NO_UNDERLINE) != 0); is_NoUnderline = ((flags & NO_UNDERLINE) != 0);
setUpdateVTerm(false); setUpdateVTerm(false);
if ( isMonochron() )
setReverse(true);
if ( button_down && click_animation ) if ( button_down && click_animation )
{ {
// noshadow + indent one character to the right // noshadow + indent one character to the right
@ -214,7 +216,7 @@ void FButton::draw()
margin = 0; margin = 0;
if ( isMonochron() && (is_Active || is_Focus) ) if ( isMonochron() && (is_Active || is_Focus) )
setReverse(true); setReverse(false);
if ( is_Flat ) if ( is_Flat )
{ {
@ -257,11 +259,11 @@ void FButton::draw()
for (int y=1; y <= height; y++) for (int y=1; y <= height; y++)
{ {
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(true);
gotoxy (xpos+xmin-1+width, ypos+ymin-2+y); gotoxy (xpos+xmin-1+width, ypos+ymin-2+y);
print (' '); // clear right print (' '); // clear right
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(false);
} }
} }
@ -333,7 +335,7 @@ void FButton::draw()
} }
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(true);
if ( is_NonFlatShadow && ! button_down ) if ( is_NonFlatShadow && ! button_down )
{ {
@ -343,6 +345,9 @@ void FButton::draw()
drawShadow(); drawShadow();
} }
if ( isMonochron() )
setReverse(false);
setUpdateVTerm(true); setUpdateVTerm(true);
delete[] ButtonText; delete[] ButtonText;

View File

@ -134,10 +134,14 @@ void FButtonGroup::directFocus()
void FButtonGroup::draw() void FButtonGroup::draw()
{ {
setUpdateVTerm(false); setUpdateVTerm(false);
if ( isMonochron() )
setReverse(true);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( border ) if ( border )
drawBorder(); drawBorder();
drawLabel(); drawLabel();
if ( isMonochron() )
setReverse(false);
setUpdateVTerm(true); setUpdateVTerm(true);
} }

View File

@ -55,6 +55,13 @@ void FCheckBox::drawCheckButton()
return; return;
gotoxy (xpos+xmin-1, ypos+ymin-1); gotoxy (xpos+xmin-1, ypos+ymin-1);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() )
{
if ( hasFocus() )
setReverse(false);
else
setReverse(true);
}
if ( checked ) if ( checked )
{ {
if ( isNewFont() ) if ( isNewFont() )
@ -77,4 +84,6 @@ void FCheckBox::drawCheckButton()
print (']'); print (']');
} }
} }
if ( isMonochron() )
setReverse(false);
} }

View File

@ -198,9 +198,13 @@ void FDialog::drawTitleBar()
// draw the title button // draw the title button
gotoxy (xpos+xmin-1, ypos+ymin-1); gotoxy (xpos+xmin-1, ypos+ymin-1);
setColor (wc.titlebar_button_fg, wc.titlebar_button_bg); setColor (wc.titlebar_button_fg, wc.titlebar_button_bg);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); {
if ( isActiveWindow() )
setReverse(false);
else
setReverse(true);
}
if ( isNewFont() ) if ( isNewFont() )
{ {
@ -256,6 +260,7 @@ void FDialog::drawDialogShadow()
{ {
// transparent shadow // transparent shadow
drawShadow(); drawShadow();
if ( isNewFont() && ((flags & SCROLLABLE) == 0) ) if ( isNewFont() && ((flags & SCROLLABLE) == 0) )
{ {
FTerm::char_data ch; FTerm::char_data ch;
@ -272,7 +277,11 @@ void FDialog::drawDialogShadow()
} }
else else
{ {
if ( isMonochron() )
return;
drawShadow(); drawShadow();
FTerm::char_data ch; FTerm::char_data ch;
ch = getCoveredCharacter (xpos+xmin-1, ypos+ymin-1+height, this); ch = getCoveredCharacter (xpos+xmin-1, ypos+ymin-1+height, this);
// left of the shaddow ▀▀ // left of the shaddow ▀▀
@ -297,12 +306,9 @@ void FDialog::drawDialogShadow()
print (ch.code); print (ch.code);
if ( ch.underline ) unsetUnderline();
unsetUnderline(); unsetReverse();
if ( ch.reverse ) unsetBold();
unsetReverse();
if ( ch.bold )
unsetBold();
} }
} }
} }
@ -317,9 +323,14 @@ void FDialog::draw()
width = xmax; width = xmax;
height = ymax; height = ymax;
} }
setUpdateVTerm(false);
// fill the background // fill the background
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
setUpdateVTerm(false); if ( isMonochron() )
setReverse(true);
clrscr(); clrscr();
drawBorder(); drawBorder();
drawTitleBar(); drawTitleBar();
@ -329,6 +340,9 @@ void FDialog::draw()
if ( (flags & RESIZEABLE) != 0 ) if ( (flags & RESIZEABLE) != 0 )
{ {
if ( isMonochron() )
setReverse(false);
if ( maximized ) if ( maximized )
{ {
if ( isNewFont() ) if ( isNewFont() )
@ -366,6 +380,8 @@ void FDialog::draw()
} }
} }
} }
if ( isMonochron() )
setReverse(false);
setUpdateVTerm(true); setUpdateVTerm(true);
} }
@ -872,6 +888,9 @@ bool FDialog::setTransparentShadow (bool on)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FDialog::setShadow (bool on) bool FDialog::setShadow (bool on)
{ {
if ( isMonochron() )
return false;
if ( on ) if ( on )
{ {
flags |= SHADOW; flags |= SHADOW;

View File

@ -232,6 +232,13 @@ void FLabel::draw()
setUpdateVTerm(false); setUpdateVTerm(false);
if ( isMonochron() )
{
setReverse(true);
if ( hasEmphasis() )
setBold(true);
}
if ( hasEmphasis() ) if ( hasEmphasis() )
setColor (emphasis_color, backgroundColor); setColor (emphasis_color, backgroundColor);
else else
@ -292,6 +299,12 @@ void FLabel::draw()
printLine (LabelText, length, hotkeypos, xoffset); printLine (LabelText, length, hotkeypos, xoffset);
delete[] LabelText; delete[] LabelText;
} }
if ( isMonochron() )
{
setReverse(false);
if ( hasEmphasis() )
setBold(false);
}
setUpdateVTerm(true); setUpdateVTerm(true);
} }

View File

@ -138,8 +138,12 @@ void FLineEdit::drawInputField()
gotoxy (xpos+xmin-1, ypos+ymin-1); gotoxy (xpos+xmin-1, ypos+ymin-1);
if ( isMonochron() ) if ( isMonochron() )
{ {
setReverse(true);
print (' '); print (' ');
setUnderline(true); if ( isActiveFocus )
setReverse(false);
else
setUnderline(true);
} }
else if ( isActiveFocus ) else if ( isActiveFocus )
{ {
@ -190,7 +194,10 @@ void FLineEdit::drawInputField()
x++; x++;
} }
if ( isMonochron() ) if ( isMonochron() )
{
setReverse(false);
setUnderline(false); setUnderline(false);
}
if ( isShadow ) if ( isShadow )
drawShadow (); drawShadow ();

View File

@ -134,6 +134,8 @@ void FListBox::draw()
setUpdateVTerm(false); setUpdateVTerm(false);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() )
setReverse(true);
if ( isNewFont() ) if ( isNewFont() )
width--; width--;
drawBorder(); drawBorder();
@ -151,6 +153,8 @@ void FListBox::draw()
} }
} }
drawLabel(); drawLabel();
if ( isMonochron() )
setReverse(false);
setUpdateVTerm(true); setUpdateVTerm(true);
if ( VBar->isVisible() ) if ( VBar->isVisible() )
@ -291,10 +295,10 @@ void FListBox::drawList()
, wc.current_element_bg ); , wc.current_element_bg );
} }
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(false);
} }
else if ( isMonochron() ) else if ( isMonochron() )
setReverse(false); setReverse(true);
// print the entry // print the entry
if ( isMonochron() && isCurrentLine ) if ( isMonochron() && isCurrentLine )

View File

@ -203,9 +203,13 @@ void FMenu::draw()
// fill the background // fill the background
setColor (wc.menu_active_fg, wc.menu_active_bg); setColor (wc.menu_active_fg, wc.menu_active_bg);
setUpdateVTerm(false); setUpdateVTerm(false);
if ( isMonochron() )
setReverse(true);
clrscr(); clrscr();
drawBorder(); drawBorder();
drawItems(); drawItems();
if ( isMonochron() )
setReverse(false);
//if ( (flags & SHADOW) != 0 ) //if ( (flags & SHADOW) != 0 )
// drawMenuShadow(); // drawMenuShadow();
setUpdateVTerm(true); setUpdateVTerm(true);
@ -356,8 +360,8 @@ void FMenu::drawItems()
print (' '); print (' ');
} }
if ( is_Active && is_Selected ) if ( isMonochron() && is_Active && is_Selected )
setReverse(false); setReverse(true);
delete[] item_text; delete[] item_text;
++iter; ++iter;

View File

@ -134,11 +134,12 @@ void FMenuBar::drawItems()
setUpdateVTerm(false); setUpdateVTerm(false);
gotoxy (1,1); gotoxy (1,1);
if ( isMonochron() )
setReverse(true);
iter = itemlist.begin(); iter = itemlist.begin();
end = itemlist.end(); end = itemlist.end();
if ( isMonochron() )
setReverse(true);
while ( iter != end ) while ( iter != end )
{ {
wchar_t* src; wchar_t* src;
@ -157,10 +158,10 @@ void FMenuBar::drawItems()
{ {
if ( is_Selected ) if ( is_Selected )
{ {
foregroundColor = wc.menu_active_focus_fg;
backgroundColor = wc.menu_active_focus_bg;
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
foregroundColor = wc.menu_active_focus_fg;
backgroundColor = wc.menu_active_focus_bg;
} }
else else
{ {
@ -227,8 +228,8 @@ void FMenuBar::drawItems()
} }
setColor (wc.menu_active_fg, wc.menu_active_bg); setColor (wc.menu_active_fg, wc.menu_active_bg);
if ( is_Active && is_Selected ) if ( isMonochron() && is_Active && is_Selected )
setReverse(false); setReverse(true);
delete[] item_text; delete[] item_text;
++iter; ++iter;
@ -236,6 +237,7 @@ void FMenuBar::drawItems()
for (; x <= screenWidth; x++) for (; x <= screenWidth; x++)
print (vmenubar, ' '); print (vmenubar, ' ');
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);

View File

@ -226,6 +226,10 @@ void FMessageBox::draw()
int msg_x = int((width - int(maxLineWidth)) / 2); // center the whole block int msg_x = int((width - int(maxLineWidth)) / 2); // center the whole block
setUpdateVTerm(false); setUpdateVTerm(false);
if ( isMonochron() )
setReverse(true);
if ( ! headline_text.isNull() ) if ( ! headline_text.isNull() )
{ {
setColor(emphasis_color, backgroundColor); setColor(emphasis_color, backgroundColor);
@ -247,6 +251,10 @@ void FMessageBox::draw()
gotoxy (xpos+xmin-1+msg_x+center_x, ypos+ymin+2+head_offset+i); gotoxy (xpos+xmin-1+msg_x+center_x, ypos+ymin+2+head_offset+i);
print(text_components[i]); print(text_components[i]);
} }
if ( isMonochron() )
setReverse(false);
setUpdateVTerm(true); setUpdateVTerm(true);
} }

View File

@ -27,11 +27,15 @@ void FProgressbar::drawPercentage()
{ {
setColor ( parentWidget()->getForegroundColor() setColor ( parentWidget()->getForegroundColor()
, parentWidget()->getBackgroundColor() ); , parentWidget()->getBackgroundColor() );
if ( isMonochron() )
setReverse(true);
gotoxy (xpos+xmin+width-5, ypos+ymin-2); gotoxy (xpos+xmin+width-5, ypos+ymin-2);
if ( percentage < 0 || percentage > 100 ) if ( percentage < 0 || percentage > 100 )
print ("--- %"); print ("--- %");
else else
printf ("%3d %%", percentage); printf ("%3d %%", percentage);
if ( isMonochron() )
setReverse(false);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -45,9 +49,9 @@ void FProgressbar::drawBar()
{ {
if ( round(length) >= 1) if ( round(length) >= 1)
{ {
setReverse(true);
print (' ');
setReverse(false); setReverse(false);
print (' ');
setReverse(true);
} }
else else
print (fc::MediumShade); // ▒ print (fc::MediumShade); // ▒
@ -83,11 +87,11 @@ void FProgressbar::drawBar()
setColor ( wc.progressbar_bg setColor ( wc.progressbar_bg
, wc.progressbar_fg ); , wc.progressbar_fg );
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(false);
for (; i < trunc(length); i++) for (; i < trunc(length); i++)
print (' '); print (' ');
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(true);
if ( trunc(length) >= 1 && trunc(length) < BarLength ) if ( trunc(length) >= 1 && trunc(length) < BarLength )
{ {
@ -97,9 +101,9 @@ void FProgressbar::drawBar()
{ {
if ( isMonochron() ) if ( isMonochron() )
{ {
setReverse(true);
print (' ');
setReverse(false); setReverse(false);
print (' ');
setReverse(true);
} }
else else
print (' '); print (' ');
@ -123,6 +127,8 @@ void FProgressbar::drawBar()
for (; i < BarLength; i++) for (; i < BarLength; i++)
print (' '); print (' ');
} }
if ( isMonochron() )
setReverse(false);
updateTerminal(); updateTerminal();
flush_out(); flush_out();
} }

View File

@ -56,6 +56,13 @@ void FRadioButton::drawRadioButton()
return; return;
gotoxy (xpos+xmin-1, ypos+ymin-1); gotoxy (xpos+xmin-1, ypos+ymin-1);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() )
{
if ( hasFocus() )
setReverse(false);
else
setReverse(true);
}
if ( checked ) if ( checked )
{ {
if ( isNewFont() ) if ( isNewFont() )
@ -78,5 +85,7 @@ void FRadioButton::drawRadioButton()
print (')'); print (')');
} }
} }
if ( isMonochron() )
setReverse(false);
} }

View File

@ -550,10 +550,11 @@ void FScrollbar::setGeometry (int x, int y, int w, int h, bool adjust)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::drawBar() void FScrollbar::drawBar()
{ {
setUpdateVTerm(false);
if (SliderPos != currentSliderPos) if (SliderPos != currentSliderPos)
{ {
int z; int z;
setUpdateVTerm(false);
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
{ {
setColor (wc.scrollbar_fg, wc.scrollbar_bg); setColor (wc.scrollbar_fg, wc.scrollbar_bg);
@ -569,7 +570,7 @@ void FScrollbar::drawBar()
} }
setColor (wc.scrollbar_bg, wc.scrollbar_fg); setColor (wc.scrollbar_bg, wc.scrollbar_fg);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(false);
for (z=1; z <= SliderLength; z++) for (z=1; z <= SliderLength; z++)
{ {
gotoxy (xpos+xmin-1, ypos+ymin-1+SliderPos+z); gotoxy (xpos+xmin-1, ypos+ymin-1+SliderPos+z);
@ -578,7 +579,7 @@ void FScrollbar::drawBar()
print (' '); print (' ');
} }
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(true);
setColor (wc.scrollbar_fg, wc.scrollbar_bg); setColor (wc.scrollbar_fg, wc.scrollbar_bg);
for (z=SliderPos+SliderLength+1; z <= BarLength; z++) for (z=SliderPos+SliderLength+1; z <= BarLength; z++)
{ {
@ -612,13 +613,13 @@ void FScrollbar::drawBar()
} }
setColor (wc.scrollbar_bg, wc.scrollbar_fg); setColor (wc.scrollbar_bg, wc.scrollbar_fg);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(false);
z = 0; z = 0;
for (; z < SliderLength; z++) for (; z < SliderLength; z++)
print (' '); print (' ');
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(true);
setColor (wc.scrollbar_fg, wc.scrollbar_bg); setColor (wc.scrollbar_fg, wc.scrollbar_bg);
z = SliderPos + SliderLength + 1; z = SliderPos + SliderLength + 1;
for (; z <= BarLength; z++) for (; z <= BarLength; z++)
@ -632,8 +633,12 @@ void FScrollbar::drawBar()
} }
} }
currentSliderPos = SliderPos; currentSliderPos = SliderPos;
if ( isMonochron() )
setReverse(false);
setUpdateVTerm(true);
} }
setUpdateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -643,9 +648,10 @@ void FScrollbar::drawButtons()
if ( isNewFont() ) if ( isNewFont() )
{ {
gotoxy (xpos+xmin-1, ypos+ymin-1);
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
{ {
gotoxy (xpos+xmin-1, ypos+ymin-1);
print (fc::NF_rev_up_arrow1); print (fc::NF_rev_up_arrow1);
print (fc::NF_rev_up_arrow2); print (fc::NF_rev_up_arrow2);
gotoxy (xpos+xmin-1, ypos+ymin+length-2); gotoxy (xpos+xmin-1, ypos+ymin+length-2);
@ -654,7 +660,6 @@ void FScrollbar::drawButtons()
} }
else // horizontal else // horizontal
{ {
gotoxy (xpos+xmin-1, ypos+ymin-1);
print (fc::NF_rev_left_arrow1); print (fc::NF_rev_left_arrow1);
print (fc::NF_rev_left_arrow2); print (fc::NF_rev_left_arrow2);
gotoxy (xpos+xmin+length-3, ypos+ymin-1); gotoxy (xpos+xmin+length-3, ypos+ymin-1);
@ -664,11 +669,13 @@ void FScrollbar::drawButtons()
} }
else else
{ {
gotoxy (xpos+xmin-1, ypos+ymin-1);
if ( isMonochron() )
setReverse(true);
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
{ {
gotoxy (xpos+xmin-1, ypos+ymin-1);
if ( isMonochron() )
setReverse(true);
if ( isCygwinTerminal() ) if ( isCygwinTerminal() )
print ('^'); print ('^');
else else
@ -678,19 +685,15 @@ void FScrollbar::drawButtons()
print ('v'); print ('v');
else else
print (fc::BlackDownPointingTriangle); // ▼ print (fc::BlackDownPointingTriangle); // ▼
if ( isMonochron() )
setReverse(false);
} }
else // horizontal else // horizontal
{ {
gotoxy (xpos+xmin-1, ypos+ymin-1);
if ( isMonochron() )
setReverse(true);
print (fc::BlackLeftPointingPointer); // ◄ print (fc::BlackLeftPointingPointer); // ◄
gotoxy (xpos+xmin+length-2, ypos+ymin-1); gotoxy (xpos+xmin+length-2, ypos+ymin-1);
print (fc::BlackRightPointingPointer); // ► print (fc::BlackRightPointingPointer); // ►
if ( isMonochron() )
setReverse(false);
} }
if ( isMonochron() )
setReverse(false);
} }
} }

View File

@ -226,11 +226,12 @@ void FStatusBar::drawKeys()
setUpdateVTerm(false); setUpdateVTerm(false);
gotoxy (1, lastLine); gotoxy (1, lastLine);
if ( isMonochron() )
setReverse(true);
iter = keylist.begin(); iter = keylist.begin();
end = keylist.end(); end = keylist.end();
if ( isMonochron() )
setReverse(true);
while ( iter != end ) while ( iter != end )
{ {
int kname_len = int(getKeyName((*iter)->getKey()).getLength()); int kname_len = int(getKeyName((*iter)->getKey()).getLength());
@ -620,6 +621,7 @@ void FStatusBar::drawMessage()
} }
for (int i=x; i <= termWidth; i++) for (int i=x; i <= termWidth; i++)
print (vstatusbar, ' '); print (vstatusbar, ' ');
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);

View File

@ -63,6 +63,7 @@ void FSwitch::drawCheckButton()
{ {
if ( isMonochron() ) if ( isMonochron() )
setBold(true); setBold(true);
if ( isMonochron() || getMaxColor() < 16 ) if ( isMonochron() || getMaxColor() < 16 )
{ {
wcsncpy ( on, L" <On>", 6); wcsncpy ( on, L" <On>", 6);
@ -78,22 +79,30 @@ void FSwitch::drawCheckButton()
setColor (wc.button_hotkey_fg, wc.button_active_bg); setColor (wc.button_hotkey_fg, wc.button_active_bg);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(false);
print (on); print (on);
if ( isMonochron() ) if ( isMonochron() )
{ {
setReverse(false); setReverse(true);
setBold(false); setBold(false);
} }
setColor (wc.button_inactive_fg, wc.button_inactive_bg); setColor (wc.button_inactive_fg, wc.button_inactive_bg);
print (off); print (off);
if ( isMonochron() )
setReverse(false);
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);
if ( isMonochron() )
setReverse(true);
print (on); print (on);
if ( hasFocus() && ! button_pressed ) if ( hasFocus() && ! button_pressed )
@ -115,13 +124,12 @@ void FSwitch::drawCheckButton()
setColor (wc.button_hotkey_fg, wc.button_active_bg); setColor (wc.button_hotkey_fg, wc.button_active_bg);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true);
print (off);
if ( isMonochron() )
{
setReverse(false); setReverse(false);
print (off);
if ( isMonochron() )
setBold(false); setBold(false);
}
setCursorPos ( xpos + xmin + 5 + switch_offset_pos setCursorPos ( xpos + xmin + 5 + switch_offset_pos
, ypos + ymin - 1 ); , ypos + ymin - 1 );

View File

@ -67,9 +67,12 @@ void FTextView::draw()
{ {
setUpdateVTerm(false); setUpdateVTerm(false);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() )
setReverse(true);
if ( ! isNewFont() ) if ( ! isNewFont() )
drawBorder(); drawBorder();
if ( isMonochron() )
setReverse(false);
if ( VBar->isVisible() ) if ( VBar->isVisible() )
VBar->redraw(); VBar->redraw();
if ( HBar->isVisible() ) if ( HBar->isVisible() )
@ -108,6 +111,10 @@ void FTextView::drawText()
setUpdateVTerm(false); setUpdateVTerm(false);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() )
setReverse(true);
for (uInt y=start; y < end; y++) for (uInt y=start; y < end; y++)
{ {
gotoxy (xpos+xmin, ypos+ymin-nf_offset+int(y)); gotoxy (xpos+xmin, ypos+ymin-nf_offset+int(y));
@ -125,6 +132,10 @@ void FTextView::drawText()
for (; i < uInt(width - nf_offset - 2); i++) for (; i < uInt(width - nf_offset - 2); i++)
print (' '); print (' ');
} }
if ( isMonochron() )
setReverse(false);
setUpdateVTerm(true); setUpdateVTerm(true);
} }

View File

@ -222,6 +222,9 @@ void FToggleButton::drawLabel()
gotoxy (xpos+xmin-1+label_offset_pos, ypos+ymin-1); gotoxy (xpos+xmin-1+label_offset_pos, ypos+ymin-1);
if ( isMonochron() )
setReverse(true);
if ( isEnabled() ) if ( isEnabled() )
setColor(wc.label_fg, wc.label_bg); setColor(wc.label_fg, wc.label_bg);
else else
@ -240,8 +243,12 @@ void FToggleButton::drawLabel()
setColor (wc.label_fg, wc.label_bg); setColor (wc.label_fg, wc.label_bg);
} }
else else
print ( LabelText[z] ); print (LabelText[z]);
} }
if ( isMonochron() )
setReverse(false);
delete[] LabelText; delete[] LabelText;
} }
@ -423,6 +430,7 @@ bool FToggleButton::setFocus(bool on)
foregroundColor = wc.toggle_button_active_focus_fg; foregroundColor = wc.toggle_button_active_focus_fg;
backgroundColor = wc.toggle_button_active_focus_bg; backgroundColor = wc.toggle_button_active_focus_bg;
if ( isCursorInside() && (isRadioButton() || isCheckboxButton()) ) if ( isCursorInside() && (isRadioButton() || isCheckboxButton()) )
showCursor(); showCursor();

View File

@ -636,11 +636,6 @@ void FWidget::onAccel (FAccelEvent*)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::onResize (FResizeEvent* ev) void FWidget::onResize (FResizeEvent* ev)
{ {
if ( openConsole() == 0 )
{
getTermGeometry();
closeConsole();
}
rootObject->resize(); rootObject->resize();
rootObject->redraw(); rootObject->redraw();
ev->accept(); ev->accept();
@ -1226,6 +1221,8 @@ void FWidget::resize()
} }
else else
adjustSize(); adjustSize();
// resize the four double-flatline-masks
double_flatline_mask.top.resize (uLong(width), false); double_flatline_mask.top.resize (uLong(width), false);
double_flatline_mask.right.resize (uLong(height), false); double_flatline_mask.right.resize (uLong(height), false);
double_flatline_mask.bottom.resize (uLong(width), false); double_flatline_mask.bottom.resize (uLong(width), false);
@ -1834,13 +1831,13 @@ void FWidget::drawShadow()
{ {
FTerm::char_data ch; FTerm::char_data ch;
int x1, x2, y1, y2; int x1, x2, y1, y2;
bool trans_shadow; bool trans_shadow = ((flags & TRANS_SHADOW) != 0);
trans_shadow = bool((flags & TRANS_SHADOW) != 0); if ( isMonochron() && ! trans_shadow )
return;
if ( (Encoding == fc::VT100 && ! trans_shadow && ! isTeraTerm() ) if ( (Encoding == fc::VT100 && ! trans_shadow && ! isTeraTerm() )
|| (Encoding == fc::ASCII && ! trans_shadow) || (Encoding == fc::ASCII && ! trans_shadow) )
|| monochron )
{ {
clearShadow(); clearShadow();
return; return;
@ -1857,12 +1854,25 @@ void FWidget::drawShadow()
if ( x2 < xmax ) if ( x2 < xmax )
{ {
gotoxy (x2+1, y1); gotoxy (x2+1, y1);
for (int x=1; x <= 2; x++) for (int x=1; x <= 2; x++)
{ {
ch = getCoveredCharacter (x2+x, y1, this); ch = getCoveredCharacter (x2+x, y1, this);
setColor (ch.fg_color, ch.bg_color); setColor (ch.fg_color, ch.bg_color);
if ( ch.reverse )
setReverse(true);
if ( ch.bold )
setBold(true);
if ( ch.underline )
setUnderline(true);
print (ch.code); print (ch.code);
setReverse(false);
setBold(false);
setUnderline(false);
} }
setColor (wc.shadow_bg, wc.shadow_fg); setColor (wc.shadow_bg, wc.shadow_fg);
for (int i=1; i < height && y1+i <= ymax; i++) for (int i=1; i < height && y1+i <= ymax; i++)
{ {
@ -1884,12 +1894,25 @@ void FWidget::drawShadow()
if ( y2 < ymax ) if ( y2 < ymax )
{ {
gotoxy (x1, y2+1); gotoxy (x1, y2+1);
for (int x=0; x <= 1; x++) for (int x=0; x <= 1; x++)
{ {
ch = getCoveredCharacter (x1+x, y2+1, this); ch = getCoveredCharacter (x1+x, y2+1, this);
setColor (ch.fg_color, ch.bg_color); setColor (ch.fg_color, ch.bg_color);
if ( ch.reverse )
setReverse(true);
if ( ch.bold )
setBold(true);
if ( ch.underline )
setUnderline(true);
print (ch.code); print (ch.code);
setReverse(false);
setBold(false);
setUnderline(false);
} }
setColor (wc.shadow_bg, wc.shadow_fg); setColor (wc.shadow_bg, wc.shadow_fg);
for (int i=2; i <= width+1 && x1+i <= xmax; i++) for (int i=2; i <= width+1 && x1+i <= xmax; i++)
{ {
@ -1904,6 +1927,8 @@ void FWidget::drawShadow()
print (ch.code); print (ch.code);
} }
} }
if ( isMonochron() )
setReverse(false);
} }
else else
{ {
@ -1954,6 +1979,9 @@ void FWidget::clearShadow()
FTerm::char_data ch; FTerm::char_data ch;
int x1, x2, y1, y2; int x1, x2, y1, y2;
if ( isMonochron() )
return;
x1 = xpos+xmin-1; x1 = xpos+xmin-1;
x2 = xpos+xmin-2+width; x2 = xpos+xmin-2+width;
y1 = ypos+ymin-1; y1 = ypos+ymin-1;

View File

@ -313,11 +313,15 @@ void Calc::drawDispay()
display = " Error "; display = " Error ";
setColor(fc::Black, fc::LightGray); setColor(fc::Black, fc::LightGray);
if ( isMonochron() )
setReverse(false);
gotoxy (xpos+xmin+1, ypos+ymin+1); gotoxy (xpos+xmin+1, ypos+ymin+1);
print(display); print(display);
print(L' '); print(L' ');
setColor(wc.dialog_fg, wc.dialog_bg); setColor(wc.dialog_fg, wc.dialog_bg);
if ( isMonochron() )
setReverse(true);
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));