removed some superfluous redraws

This commit is contained in:
thrust26 2020-11-11 18:24:30 +01:00
parent 7433e14cec
commit cec27bb899
12 changed files with 75 additions and 58 deletions

View File

@ -242,15 +242,15 @@ void DataGridWidget::setRange(int lower, int upper)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseLeft()
{
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -285,15 +285,15 @@ void RomListWidget::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListWidget::handleMouseLeft()
{
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -181,15 +181,15 @@ void TiaZoomWidget::handleMouseMoved(int x, int y)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::handleMouseLeft()
{
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
setDirty();
myMouseMoving = false;
}

View File

@ -43,15 +43,15 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleWidget::handleMouseLeft()
{
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -438,19 +438,6 @@ void Dialog::drawDialog()
clearDirty();
}
Widget* w = _firstWidget;
// Draw all children
w = _firstWidget;
while(w)
{
// only redraw changed widgets
if(w->needsRedraw())
w->draw();
w = w->_next;
}
// Draw outlines for focused widgets
// Don't change focus, since this will trigger lost and received
// focus events
@ -458,8 +445,20 @@ void Dialog::drawDialog()
{
_focusedWidget = Widget::setFocusForChain(this, getFocusList(),
_focusedWidget, 0, false);
if(_focusedWidget)
_focusedWidget->draw(); // make sure the highlight color is drawn initially
// if(_focusedWidget)
// _focusedWidget->draw(); // make sure the highlight color is drawn initially
}
Widget* w = _firstWidget;
// Draw all children
w = _firstWidget;
while(w)
{
// only redraw changed widgets
if(w->needsRedraw())
w->draw();
w = w->_next;
}
}

View File

@ -51,15 +51,15 @@ void EditTextWidget::setText(const string& str, bool changed)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::handleMouseEntered()
{
if(isEnabled() && isEditable())
setFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::handleMouseLeft()
{
if(isEnabled() && isEditable())
clearFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -97,8 +97,22 @@ class GuiObject : public CommandReceiver
virtual bool isChainDirty() const = 0;
virtual bool needsRedraw() { return isDirty() || isChainDirty(); };
void setFlags(uInt32 flags) { _flags |= flags; setDirty(); }
void clearFlags(uInt32 flags) { _flags &= ~flags; setDirty(); }
void setFlags(uInt32 flags)
{
uInt32 oldFlags = _flags;
_flags |= flags;
if(oldFlags != _flags)
setDirty();
}
void clearFlags(uInt32 flags)
{
uInt32 oldFlags = _flags;
_flags &= ~flags;
if(oldFlags != _flags)
setDirty();
}
uInt32 getFlags() const { return _flags; }
bool hasBorder() const { return _flags & FLAG_BORDER; }

View File

@ -161,15 +161,15 @@ void PopUpWidget::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpWidget::handleMouseLeft()
{
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -243,16 +243,16 @@ void ScrollBarWidget::checkBounds(int old_pos)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::handleMouseLeft()
{
_part = Part::None;
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -53,15 +53,15 @@ void StringListWidget::setList(const StringList& list)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::handleMouseLeft()
{
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -216,15 +216,15 @@ void TabWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::handleMouseEntered()
{
setFlags(Widget::FLAG_HILITED);
setDirty();
//if(isEnabled())
// setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::handleMouseLeft()
{
clearFlags(Widget::FLAG_HILITED);
setDirty();
//if(isEnabled())
// clearFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -157,6 +157,7 @@ void Widget::draw()
_x = oldX;
_y = oldY;
}
clearDirty();
// Draw all children
Widget* w = _firstWidget;
@ -166,7 +167,6 @@ void Widget::draw()
w->draw();
w = w->_next;
}
clearDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -448,12 +448,14 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::handleMouseLeft()
{
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
}
@ -558,12 +560,14 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckboxWidget::handleMouseEntered()
{
if(isEnabled())
setFlags(Widget::FLAG_HILITED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckboxWidget::handleMouseLeft()
{
if(isEnabled())
clearFlags(Widget::FLAG_HILITED);
}