widget clearing updates now only non-covered characters

This commit is contained in:
Markus Gans 2016-08-06 21:43:39 +02:00
parent f81370f8cf
commit 5606d66404
28 changed files with 75 additions and 65 deletions

View File

@ -1,3 +1,9 @@
2016-07-31 Markus Gans <guru.mail@muenster.de>
* Rename setUpdateVTerm to updateVTerm
* Rename clrscr to clearArea
* The widget clearing method updates now only non-covered
characters on the virtual terminal.
2016-07-31 Markus Gans <guru.mail@muenster.de> 2016-07-31 Markus Gans <guru.mail@muenster.de>
* Resetting the local window widget focus at * Resetting the local window widget focus at
the end of the lifetime of a widget. the end of the lifetime of a widget.

View File

@ -21,7 +21,7 @@ Missing Features
--------------------------------------- ---------------------------------------
- Screen characters should get the options transparent - Screen characters should get the options transparent
and transparent with color and transparent shadow (transparent with color)
- FDialog title button [▲] and [▼] should maximized or restore - FDialog title button [▲] and [▼] should maximized or restore
the window size on a resizeable dialog the window size on a resizeable dialog
- A possibility to change the window size dynamically with the mouse - A possibility to change the window size dynamically with the mouse

View File

@ -161,7 +161,7 @@ void FButton::draw()
is_Flat = isFlat(); is_Flat = isFlat();
is_NonFlatShadow = ((flags & (fc::shadow+fc::flat)) == fc::shadow); is_NonFlatShadow = ((flags & (fc::shadow+fc::flat)) == fc::shadow);
is_NoUnderline = ((flags & fc::no_underline) != 0); is_NoUnderline = ((flags & fc::no_underline) != 0);
setUpdateVTerm(false); updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -374,7 +374,7 @@ void FButton::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
delete[] ButtonText; delete[] ButtonText;
if ( is_Focus && statusBar() ) if ( is_Focus && statusBar() )

View File

@ -138,7 +138,7 @@ void FButtonGroup::directFocus()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButtonGroup::draw() void FButtonGroup::draw()
{ {
setUpdateVTerm(false); updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -153,7 +153,7 @@ void FButtonGroup::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -40,10 +40,10 @@ void FCheckBox::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FCheckBox::draw() void FCheckBox::draw()
{ {
setUpdateVTerm(false); updateVTerm(false);
drawCheckButton(); drawCheckButton();
drawLabel(); drawLabel();
setUpdateVTerm(true); updateVTerm(true);
FToggleButton::draw(); FToggleButton::draw();
} }

View File

@ -466,14 +466,14 @@ void FDialog::draw()
height = ymax; height = ymax;
} }
setUpdateVTerm(false); updateVTerm(false);updateVTerm(true);
// fill the background // fill the background
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
clrscr(); clearArea();
drawBorder(); drawBorder();
drawTitleBar(); drawTitleBar();
@ -526,7 +526,7 @@ void FDialog::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -239,7 +239,7 @@ void FLabel::draw()
if ( text.isNull() || text.isEmpty() ) if ( text.isNull() || text.isEmpty() )
return; return;
setUpdateVTerm(false); updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
{ {
@ -317,7 +317,7 @@ void FLabel::draw()
setBold(false); setBold(false);
} }
setUpdateVTerm(true); updateVTerm(true);
} }

View File

@ -135,7 +135,7 @@ void FLineEdit::drawInputField()
isActive = ((flags & fc::active) != 0); isActive = ((flags & fc::active) != 0);
isShadow = ((flags & fc::shadow) != 0 ); isShadow = ((flags & fc::shadow) != 0 );
setUpdateVTerm(false); updateVTerm(false);
gotoxy (xpos+xmin-1, ypos+ymin-1); gotoxy (xpos+xmin-1, ypos+ymin-1);
if ( isMonochron() ) if ( isMonochron() )
@ -220,7 +220,7 @@ void FLineEdit::drawInputField()
if ( isShadow ) if ( isShadow )
drawShadow (); drawShadow ();
setUpdateVTerm(true); updateVTerm(true);
// set the cursor to the first pos. // set the cursor to the first pos.
setCursorPos (xpos+xmin+cursor_pos-offset, ypos+ymin-1); setCursorPos (xpos+xmin+cursor_pos-offset, ypos+ymin-1);

View File

@ -134,7 +134,7 @@ void FListBox::draw()
if ( current < 1 ) if ( current < 1 )
current = 1; current = 1;
setUpdateVTerm(false); updateVTerm(false);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() ) if ( isMonochron() )
@ -166,7 +166,7 @@ void FListBox::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
if ( VBar->isVisible() ) if ( VBar->isVisible() )
VBar->redraw(); VBar->redraw();
@ -247,7 +247,7 @@ void FListBox::drawList()
end = std::max(last_pos, current_pos)+1; end = std::max(last_pos, current_pos)+1;
} }
setUpdateVTerm(false); updateVTerm(false);
for (uInt y=start; y < end; y++) for (uInt y=start; y < end; y++)
{ {
@ -473,7 +473,7 @@ void FListBox::drawList()
setReverse(false); setReverse(false);
unsetBold(); unsetBold();
setUpdateVTerm(true); updateVTerm(true);
updateTerminal(); updateTerminal();
flush_out(); flush_out();

View File

@ -598,12 +598,12 @@ 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); updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
clrscr(); clearArea();
drawBorder(); drawBorder();
drawItems(); drawItems();
@ -611,9 +611,13 @@ void FMenu::draw()
setReverse(false); setReverse(false);
if ( (flags & fc::shadow) != 0 ) if ( (flags & fc::shadow) != 0 )
{
drawMenuShadow(); drawMenuShadow();
term_area* area = getWindowWidget(this)->getVWin();
setUpdateVTerm(true); putArea (xpos+xmin-1, ypos+ymin-1, area);
}
else
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -329,7 +329,7 @@ void FMenuBar::drawItems()
if ( itemlist.empty() ) if ( itemlist.empty() )
return; return;
setUpdateVTerm(false); updateVTerm(false);
gotoxy (1,1); gotoxy (1,1);
if ( isMonochron() ) if ( isMonochron() )
@ -470,7 +470,7 @@ void FMenuBar::drawItems()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -229,7 +229,7 @@ void FMessageBox::draw()
int head_offset = 0; int head_offset = 0;
int center_x = 0; int center_x = 0;
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); updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -263,7 +263,7 @@ void FMessageBox::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -150,14 +150,14 @@ void FProgressbar::drawBar()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FProgressbar::draw() void FProgressbar::draw()
{ {
setUpdateVTerm(false); updateVTerm(false);
drawPercentage(); drawPercentage();
drawBar(); drawBar();
if ( (flags & fc::shadow) != 0 ) if ( (flags & fc::shadow) != 0 )
drawShadow (); drawShadow ();
setUpdateVTerm(true); updateVTerm(true);
flush_out(); flush_out();
} }
@ -204,7 +204,7 @@ void FProgressbar::setPercentage (int percentage_value)
else else
percentage = percentage_value; percentage = percentage_value;
setUpdateVTerm(false); updateVTerm(false);
if ( isVisible() ) if ( isVisible() )
{ {
@ -212,14 +212,14 @@ void FProgressbar::setPercentage (int percentage_value)
drawBar(); drawBar();
} }
setUpdateVTerm(true); updateVTerm(true);
updateTerminal(); updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FProgressbar::reset() void FProgressbar::reset()
{ {
setUpdateVTerm(false); updateVTerm(false);
percentage = -1; percentage = -1;
if ( isVisible() ) if ( isVisible() )
@ -228,7 +228,7 @@ void FProgressbar::reset()
drawBar(); drawBar();
} }
setUpdateVTerm(true); updateVTerm(true);
updateTerminal(); updateTerminal();
} }

View File

@ -41,10 +41,10 @@ void FRadioButton::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FRadioButton::draw() void FRadioButton::draw()
{ {
setUpdateVTerm(false); updateVTerm(false);
drawRadioButton(); drawRadioButton();
drawLabel(); drawLabel();
setUpdateVTerm(true); updateVTerm(true);
FToggleButton::draw(); FToggleButton::draw();
} }

View File

@ -80,11 +80,11 @@ void FScrollbar::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::draw() void FScrollbar::draw()
{ {
setUpdateVTerm(false); updateVTerm(false);
drawButtons(); drawButtons();
currentSliderPos = -1; currentSliderPos = -1;
drawBar(); drawBar();
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -563,7 +563,7 @@ void FScrollbar::drawBar()
if (SliderPos != currentSliderPos) if (SliderPos != currentSliderPos)
{ {
int z; int z;
setUpdateVTerm(false); updateVTerm(false);
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
{ {
@ -665,7 +665,7 @@ void FScrollbar::drawBar()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
} }
} }

View File

@ -230,7 +230,7 @@ void FStatusBar::drawKeys()
return; return;
} }
setUpdateVTerm(false); updateVTerm(false);
gotoxy (1, lastLine); gotoxy (1, lastLine);
if ( isMonochron() ) if ( isMonochron() )
@ -343,7 +343,7 @@ void FStatusBar::drawKeys()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
x_msg = x; x_msg = x;
} }
@ -602,7 +602,7 @@ void FStatusBar::drawMessage()
if ( isLastActiveFocus ) if ( isLastActiveFocus )
space_offset = 0; space_offset = 0;
setUpdateVTerm(false); updateVTerm(false);
setColor (wc.statusbar_fg, wc.statusbar_bg); setColor (wc.statusbar_fg, wc.statusbar_bg);
gotoxy (x, lastLine); gotoxy (x, lastLine);
@ -646,7 +646,7 @@ void FStatusBar::drawMessage()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -37,10 +37,10 @@ FSwitch::~FSwitch() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FSwitch::draw() void FSwitch::draw()
{ {
setUpdateVTerm(false); updateVTerm(false);
drawLabel(); drawLabel();
drawCheckButton(); drawCheckButton();
setUpdateVTerm(true); updateVTerm(true);
FToggleButton::draw(); FToggleButton::draw();
updateTerminal(); updateTerminal();
flush_out(); flush_out();

View File

@ -2573,7 +2573,7 @@ void FTerm::updateVTerm (FTerm::term_area* area)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::setUpdateVTerm (bool on) void FTerm::updateVTerm (bool on)
{ {
vterm_updates = on; vterm_updates = on;

View File

@ -278,7 +278,7 @@ class FTerm
bool isCovered (const FPoint&, FTerm::term_area*) const; bool isCovered (const FPoint&, FTerm::term_area*) const;
bool isCovered (int, int, FTerm::term_area*) const; bool isCovered (int, int, FTerm::term_area*) const;
void updateVTerm (FTerm::term_area*); void updateVTerm (FTerm::term_area*);
void setUpdateVTerm (bool); void updateVTerm (bool);
void getArea (const FPoint&, FTerm::term_area*); void getArea (const FPoint&, FTerm::term_area*);
void getArea (int, int, FTerm::term_area*); void getArea (int, int, FTerm::term_area*);
void getArea (const FRect&, FTerm::term_area*); void getArea (const FRect&, FTerm::term_area*);

View File

@ -65,7 +65,7 @@ void FTextView::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTextView::draw() void FTextView::draw()
{ {
setUpdateVTerm(false); updateVTerm(false);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() ) if ( isMonochron() )
@ -83,7 +83,7 @@ void FTextView::draw()
if ( HBar->isVisible() ) if ( HBar->isVisible() )
HBar->redraw(); HBar->redraw();
setUpdateVTerm(true); updateVTerm(true);
drawText(); drawText();
if ( hasFocus() && statusBar() ) if ( hasFocus() && statusBar() )
@ -93,10 +93,10 @@ void FTextView::draw()
if ( curMsg != msg ) if ( curMsg != msg )
{ {
setUpdateVTerm(false); updateVTerm(false);
statusBar()->setMessage(msg); statusBar()->setMessage(msg);
statusBar()->drawMessage(); statusBar()->drawMessage();
setUpdateVTerm(true); updateVTerm(true);
} }
} }
@ -119,7 +119,7 @@ void FTextView::drawText()
if ( end > getRows() ) if ( end > getRows() )
end = getRows(); end = getRows();
setUpdateVTerm(false); updateVTerm(false);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
if ( isMonochron() ) if ( isMonochron() )
@ -159,7 +159,7 @@ void FTextView::drawText()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -174,7 +174,7 @@ void FWidget::init()
foregroundColor = wc.term_fg; foregroundColor = wc.term_fg;
backgroundColor = wc.term_bg; backgroundColor = wc.term_bg;
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
clrscr(); clearArea();
accelerator_list = new Accelerators(); accelerator_list = new Accelerators();
} }
@ -1232,7 +1232,7 @@ void FWidget::redraw()
{ {
terminal_updates = false; terminal_updates = false;
setColor (wc.term_fg, wc.term_bg); setColor (wc.term_fg, wc.term_bg);
clrscr(); clearArea();
} }
else if ( ! visible ) else if ( ! visible )
return; return;
@ -1926,7 +1926,7 @@ bool FWidget::setCursorPos (register int x, register int y)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::clrscr() void FWidget::clearArea()
{ {
term_area* area; term_area* area;
FWindow* area_widget; FWindow* area_widget;
@ -1979,7 +1979,7 @@ void FWidget::clrscr()
area->changes[i].xmax = uInt(area->width + area->right_shadow - 1); area->changes[i].xmax = uInt(area->width + area->right_shadow - 1);
} }
putArea (xpos+xmin-1, ypos+ymin-1, area); updateVTerm (area);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -444,7 +444,7 @@ class FWidget : public FObject, public FTerm
static void gotoxy (const FPoint&); static void gotoxy (const FPoint&);
static void gotoxy (register int, register int); static void gotoxy (register int, register int);
void clrscr(); void clearArea();
static void setNormal(); static void setNormal();

View File

@ -154,7 +154,7 @@ void FWindow::delWindow (FWidget* obj)
{ {
if ( (*iter) == obj ) if ( (*iter) == obj )
{ {
window_list->erase(iter); window_list->erase (iter);
return; return;
} }

View File

@ -290,7 +290,7 @@ Calc::~Calc()
void Calc::drawDispay() void Calc::drawDispay()
{ {
FString display = input; FString display = input;
setUpdateVTerm(false); updateVTerm(false);
if ( display.isNull() || display.isEmpty() ) if ( display.isNull() || display.isEmpty() )
display = L'0'; display = L'0';
@ -353,7 +353,7 @@ void Calc::drawDispay()
print(separator); print(separator);
} }
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -45,7 +45,7 @@ void keyboard::draw()
{ {
setNormal(); setNormal();
setColor(fc::Default, fc::Default); setColor(fc::Default, fc::Default);
clrscr(); clearArea();
gotoxy (1,1); gotoxy (1,1);
print ("---------------\n"); print ("---------------\n");
print ("Press Q to quit\n"); print ("Press Q to quit\n");

View File

@ -90,7 +90,7 @@ void Mandelbrot::draw()
current_line++; current_line++;
} }
setUpdateVTerm(true); updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -244,7 +244,7 @@ void AttribDemo::printAltCharset()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void AttribDemo::draw() void AttribDemo::draw()
{ {
setUpdateVTerm(false); updateVTerm(false);
// test alternate character set // test alternate character set
printAltCharset(); printAltCharset();
@ -367,7 +367,7 @@ void AttribDemo::draw()
gotoxy (xpos + xmin + 14, ypos + ymin + 15); gotoxy (xpos + xmin + 14, ypos + ymin + 15);
print ("Change background color ->"); print ("Change background color ->");
setUpdateVTerm(true); updateVTerm(true);
} }

View File

@ -50,7 +50,7 @@ void timer::draw()
{ {
setNormal(); setNormal();
setColor (fc::Default, fc::Default); setColor (fc::Default, fc::Default);
clrscr(); clearArea();
gotoxy (1,1); gotoxy (1,1);
print ("---------------\n"); print ("---------------\n");
print ("Press Q to quit\n"); print ("Press Q to quit\n");