diff --git a/src/cheat/CheatManager.cxx b/src/cheat/CheatManager.cxx index 33fa95ad6..25b8e0826 100644 --- a/src/cheat/CheatManager.cxx +++ b/src/cheat/CheatManager.cxx @@ -89,11 +89,11 @@ void CheatManager::addPerFrame(const string& name, const string& code, bool enab { // The actual cheat will always be in the main list; we look there first shared_ptr cheat; - for(uInt32 i = 0; i < myCheatList.size(); i++) + for(auto& c: myCheatList) { - if(myCheatList[i]->name() == name || myCheatList[i]->code() == code) + if(c->name() == name || c->code() == code) { - cheat = myCheatList[i]; + cheat = c; break; } } diff --git a/src/common/Version.hxx b/src/common/Version.hxx index 0cd9c444d..9a3870902 100644 --- a/src/common/Version.hxx +++ b/src/common/Version.hxx @@ -22,7 +22,7 @@ #include -#define STELLA_VERSION "4.6" +#define STELLA_VERSION "4.7_pre" #define STELLA_BUILD atoi("$Rev$" + 6) #endif diff --git a/src/debugger/gui/ColorWidget.cxx b/src/debugger/gui/ColorWidget.cxx index 370e013b8..88caa9826 100644 --- a/src/debugger/gui/ColorWidget.cxx +++ b/src/debugger/gui/ColorWidget.cxx @@ -46,7 +46,7 @@ ColorWidget::~ColorWidget() void ColorWidget::setColor(int color) { _color = color; - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index 9aeb852df..ae5204c89 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -128,7 +128,7 @@ cerr << "_addrList.size() = " << _addrList.size() // Send item selected signal for starting with cell 0 sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id); - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -165,7 +165,7 @@ void DataGridWidget::setHiliteList(const BoolArray& hilitelist) _hiliteList.clear(); _hiliteList = hilitelist; - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -201,7 +201,7 @@ void DataGridWidget::setValue(int position, int value, bool changed) sendCommand(DataGridWidget::kItemDataChangedCmd, position, _id); - setDirty(); draw(); + setDirty(); } } @@ -234,7 +234,7 @@ void DataGridWidget::handleMouseDown(int x, int y, int button, int clickCount) _currentCol = _selectedItem - (_currentRow * _cols); sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id); - setDirty(); draw(); + setDirty(); } } @@ -462,7 +462,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod) if(_selectedItem != oldItem) sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id); - setDirty(); draw(); + setDirty(); } _currentKeyDown = key; diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index 8defaba4d..eeeddea1a 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -86,19 +86,21 @@ void PromptWidget::drawWidget(bool hilite) int start = _scrollLine - _linesPerPage + 1; int y = _y + 2; - for (int line = 0; line < _linesPerPage; line++) + for (int line = 0; line < _linesPerPage; ++line) { int x = _x + 1; - for (int column = 0; column < _lineWidth; column++) { + for (int column = 0; column < _lineWidth; ++column) { int c = buffer((start + line) * _lineWidth + column); - if(c & (1 << 17)) { // inverse video flag + if(c & (1 << 17)) // inverse video flag + { fgcolor = _bgcolor; bgcolor = (c & 0x1ffff) >> 8; s.fillRect(x, y, _kConsoleCharWidth, _kConsoleCharHeight, bgcolor); - } else { - fgcolor = c >> 8; } + else + fgcolor = c >> 8; + s.drawChar(_font, c & 0x7f, x, y, fgcolor); x += _kConsoleCharWidth; } @@ -144,7 +146,7 @@ bool PromptWidget::handleText(char text) for(int i = _promptEndPos - 1; i >= _currentPos; i--) buffer(i + 1) = buffer(i); _promptEndPos++; - putchar(text); + putcharIntern(text); scrollToCurrent(); } return true; @@ -430,9 +432,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod) // Take care of changes made above if(dirty) - { - setDirty(); draw(); - } + setDirty(); // There are times when we want the prompt and scrollbar to be marked // as dirty *after* they've been drawn above. One such occurrence is @@ -478,7 +478,7 @@ void PromptWidget::handleCommand(CommandSender* sender, int cmd, if (newPos != _scrollLine) { _scrollLine = newPos; - setDirty(); draw(); + setDirty(); } break; } @@ -553,9 +553,7 @@ void PromptWidget::specialKeys(StellaKey key) } if(handled) - { - setDirty(); draw(); - } + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -709,7 +707,7 @@ void PromptWidget::historyScroll(int direction) // Ensure once more the caret is visible (in case of very long history entries) scrollToCurrent(); - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -774,13 +772,6 @@ int PromptWidget::vprintf(const char* format, va_list argptr) return count; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::putchar(int c) -{ - putcharIntern(c); - setDirty(); draw(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PromptWidget::putcharIntern(int c) { @@ -809,14 +800,14 @@ void PromptWidget::putcharIntern(int c) updateScrollBuffer(); } } + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PromptWidget::print(const string& str) { - const char* c = str.c_str(); - while(*c) - putcharIntern(*c++); + for(char c: str) + putcharIntern(c); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/PromptWidget.hxx b/src/debugger/gui/PromptWidget.hxx index a6044d56b..e94c5dd3a 100644 --- a/src/debugger/gui/PromptWidget.hxx +++ b/src/debugger/gui/PromptWidget.hxx @@ -38,8 +38,6 @@ class PromptWidget : public Widget, public CommandSender public: int printf(const char *format, ...); int vprintf(const char *format, va_list argptr); -#undef putchar - void putchar(int c); void print(const string& str); void printPrompt(); bool saveBuffer(string& filename); diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 55c21ebac..1c68e048f 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -112,8 +112,6 @@ void RomListWidget::setList(const CartDebug::Disassembly& disasm, myCheckList[i]->clearFlags(WIDGET_ENABLED); recalc(); - - setDirty(); draw(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -190,6 +188,8 @@ void RomListWidget::recalc() // Reset to normal data entry abortEditMode(); + + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -215,7 +215,7 @@ void RomListWidget::scrollToCurrent(int item) myScrollBar->_currentPos = _currentPos; myScrollBar->recalc(); - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -245,7 +245,7 @@ void RomListWidget::handleMouseDown(int x, int y, int button, int clickCount) if (_editMode) abortEditMode(); _selectedItem = newSelectedItem; - setDirty(); draw(); + setDirty(); } } } @@ -409,7 +409,7 @@ void RomListWidget::handleCommand(CommandSender* sender, int cmd, int data, int if (_currentPos != (int)data) { _currentPos = data; - setDirty(); draw(); + setDirty(); } break; diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx index 7a48392e1..6dbdf7c0b 100644 --- a/src/debugger/gui/TiaOutputWidget.cxx +++ b/src/debugger/gui/TiaOutputWidget.cxx @@ -60,7 +60,7 @@ TiaOutputWidget::~TiaOutputWidget() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaOutputWidget::loadConfig() { - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx index fe474e2e9..56c7c40f4 100644 --- a/src/debugger/gui/TiaZoomWidget.cxx +++ b/src/debugger/gui/TiaZoomWidget.cxx @@ -68,7 +68,7 @@ TiaZoomWidget::~TiaZoomWidget() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaZoomWidget::loadConfig() { - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -104,7 +104,7 @@ void TiaZoomWidget::recalc() myXOff = BSPF_clamp(myXOff, 0, tw - myNumCols); myYOff = BSPF_clamp(myYOff, 0, th - myNumRows); - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx index d53b38b9f..05e871553 100644 --- a/src/debugger/gui/ToggleBitWidget.cxx +++ b/src/debugger/gui/ToggleBitWidget.cxx @@ -72,7 +72,7 @@ void ToggleBitWidget::setState(const BoolArray& state, const BoolArray& changed) _changedList.clear(); _changedList = changed; - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/TogglePixelWidget.cxx b/src/debugger/gui/TogglePixelWidget.cxx index 134c2576b..97de2f788 100644 --- a/src/debugger/gui/TogglePixelWidget.cxx +++ b/src/debugger/gui/TogglePixelWidget.cxx @@ -54,7 +54,7 @@ void TogglePixelWidget::setState(const BoolArray& state) _stateList.clear(); _stateList = state; - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx index bef7c2bab..9d50d250e 100644 --- a/src/debugger/gui/ToggleWidget.cxx +++ b/src/debugger/gui/ToggleWidget.cxx @@ -61,7 +61,7 @@ void ToggleWidget::handleMouseDown(int x, int y, int button, int clickCount) _selectedItem = newSelectedItem; _currentRow = _selectedItem / _cols; _currentCol = _selectedItem - (_currentRow * _cols); - setDirty(); draw(); + setDirty(); } } @@ -78,7 +78,7 @@ void ToggleWidget::handleMouseUp(int x, int y, int button, int clickCount) _stateList[_selectedItem] = !_stateList[_selectedItem]; _changedList[_selectedItem] = !_changedList[_selectedItem]; sendCommand(ToggleWidget::kItemDataChangedCmd, _selectedItem, _id); - setDirty(); draw(); + setDirty(); } } @@ -195,7 +195,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod) sendCommand(ToggleWidget::kItemDataChangedCmd, _selectedItem, _id); } - setDirty(); draw(); + setDirty(); } return handled; @@ -211,7 +211,7 @@ void ToggleWidget::handleCommand(CommandSender* sender, int cmd, if (_selectedItem != (int)data) { _selectedItem = data; - setDirty(); draw(); + setDirty(); } break; } diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 6b60191af..3058a1591 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -233,8 +233,8 @@ void Dialog::buildCurrentFocusList(int tabID) } // Add appropriate items from tablist (if present) - for(uInt32 id = 0; id < _myTabList.size(); ++id) - _myTabList[id].appendFocusList(_focusList); + for(auto& tabfocus: _myTabList) + tabfocus.appendFocusList(_focusList); // Add remaining items from main focus list Vec::append(_focusList, _myFocus.list); diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx index f5bbc0671..3e98ca33f 100644 --- a/src/gui/EditTextWidget.cxx +++ b/src/gui/EditTextWidget.cxx @@ -42,8 +42,6 @@ void EditTextWidget::setText(const string& str, bool changed) EditableWidget::setText(str, changed); _backupString = str; _changed = changed; - - setDirty(); draw(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -65,9 +63,7 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) } if (setCaretPos(i)) - { - setDirty(); draw(); - } + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index 410743143..99ffe31ed 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -55,9 +55,9 @@ void EditableWidget::setText(const string& str, bool) { // Filter input string _editString = ""; - for(int i = 0; i < str.size(); ++i) - if(_filter(tolower(str[i]))) - _editString.push_back(str[i]); + for(char c: str) + if(_filter(tolower(c))) + _editString.push_back(c); _caretPos = (int)_editString.size(); @@ -68,8 +68,7 @@ void EditableWidget::setText(const string& str, bool) if(_editable) startEditMode(); - // Make sure the new string is seen onscreen - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EditableWidget::setEditable(bool editable) @@ -102,7 +101,7 @@ bool EditableWidget::handleText(char text) { _caretPos++; sendCommand(EditableWidget::kChangedCmd, 0, _id); - setDirty(); draw(); + setDirty(); return true; } return false; @@ -179,9 +178,7 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod) } if (dirty) - { - setDirty(); draw(); - } + setDirty(); return handled; } diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx index 6ab096880..953a79cf8 100644 --- a/src/gui/GuiObject.hxx +++ b/src/gui/GuiObject.hxx @@ -63,19 +63,18 @@ class GuiObject : public CommandReceiver : myOSystem(osystem), myParent(parent), myDialog(dialog), - _x(x), - _y(y), - _w(w), - _h(h), + _x(x), _y(y), _w(w), _h(h), _dirty(false), - _firstWidget(0) {} + _firstWidget(0) { } - virtual ~GuiObject() {} + virtual ~GuiObject() { } OSystem& instance() const { return myOSystem; } DialogContainer& parent() const { return myParent; } Dialog& dialog() const { return myDialog; } + void setDirty() { _dirty = true; } + virtual int getAbsX() const { return _x; } virtual int getAbsY() const { return _y; } virtual int getChildX() const { return getAbsX(); } @@ -86,10 +85,7 @@ class GuiObject : public CommandReceiver virtual void setWidth(int w) { _w = w; } virtual void setHeight(int h) { _h = h; } - virtual void setDirty() { _dirty = true; } - virtual bool isVisible() const = 0; - virtual void draw() = 0; /** Add given widget to the focus list */ virtual void addFocusWidget(Widget* w) = 0; @@ -98,10 +94,11 @@ class GuiObject : public CommandReceiver WidgetArray& getFocusList() { return _focusList; } /** Redraw the focus list */ - virtual void redrawFocus() {} + virtual void redrawFocus() { } protected: virtual void releaseFocus() = 0; + virtual void draw() = 0; private: OSystem& myOSystem; @@ -109,8 +106,7 @@ class GuiObject : public CommandReceiver Dialog& myDialog; protected: - int _x, _y; - int _w, _h; + int _x, _y, _w, _h; bool _dirty; Widget* _firstWidget; diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index 2d9c0598c..54789a61d 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -70,7 +70,7 @@ void ListWidget::setSelected(int item) { if(item < 0 || item >= (int)_list.size()) { - setDirty(); draw(); // Simply redraw and exit + setDirty(); // Simply redraw and exit return; } @@ -208,7 +208,7 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) abortEditMode(); _selectedItem = newSelectedItem; sendCommand(ListWidget::kSelectionChangedCmd, _selectedItem, _id); - setDirty(); draw(); + setDirty(); } // TODO: Determine where inside the string the user clicked and place the @@ -420,7 +420,7 @@ void ListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) if (_currentPos != (int)data) { _currentPos = data; - setDirty(); draw(); + setDirty(); // Let boss know the list has scrolled sendCommand(ListWidget::kScrolledCmd, _currentPos, _id); @@ -453,7 +453,7 @@ void ListWidget::scrollToCurrent(int item) _scrollBar->_currentPos = _currentPos; _scrollBar->recalc(); - setDirty(); draw(); + setDirty(); if(oldScrollPos != _currentPos) sendCommand(ListWidget::kScrolledCmd, _currentPos, _id); diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index 36eabe2fe..c96a4909c 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -48,10 +48,7 @@ void RomInfoWidget::loadConfig() // by saving a different image or through a change in video renderer, // so we reload the properties if(myHaveProperties) - { parseProperties(); - setDirty(); draw(); - } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -62,10 +59,7 @@ void RomInfoWidget::setProperties(const Properties& props) // Decide whether the information should be shown immediately if(instance().eventHandler().state() == EventHandler::S_LAUNCHER) - { parseProperties(); - setDirty(); draw(); - } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -77,9 +71,7 @@ void RomInfoWidget::clearProperties() // Decide whether the information should be shown immediately if(instance().eventHandler().state() == EventHandler::S_LAUNCHER) - { - setDirty(); draw(); - } + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -132,6 +124,8 @@ void RomInfoWidget::parseProperties() myRomInfo.push_back("Note: " + myProperties.get(Cartridge_Note)); myRomInfo.push_back("Controllers: " + myProperties.get(Controller_Left) + " (left), " + myProperties.get(Controller_Right) + " (right)"); + + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/ScrollBarWidget.cxx b/src/gui/ScrollBarWidget.cxx index baf4d370a..0a23f3c35 100644 --- a/src/gui/ScrollBarWidget.cxx +++ b/src/gui/ScrollBarWidget.cxx @@ -181,9 +181,7 @@ void ScrollBarWidget::handleMouseMoved(int x, int y, int button) _part = kSliderPart; if (old_part != _part) - { - setDirty(); draw(); - } + setDirty(); } } @@ -204,8 +202,7 @@ void ScrollBarWidget::checkBounds(int old_pos) if (old_pos != _currentPos) { - recalc(); // This takes care of the required refresh - setDirty(); draw(); + recalc(); sendCommand(kSetPositionCmd, _currentPos, _id); } } @@ -214,7 +211,6 @@ void ScrollBarWidget::checkBounds(int old_pos) void ScrollBarWidget::handleMouseEntered(int button) { setFlags(WIDGET_HILITED); - setDirty(); draw(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -222,7 +218,6 @@ void ScrollBarWidget::handleMouseLeft(int button) { _part = kNoPart; clearFlags(WIDGET_HILITED); - setDirty(); draw(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -246,7 +241,7 @@ void ScrollBarWidget::recalc() _sliderPos = UP_DOWN_BOX_HEIGHT; } - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx index 8266acd94..7ad0b4090 100644 --- a/src/gui/TabWidget.cxx +++ b/src/gui/TabWidget.cxx @@ -126,7 +126,7 @@ void TabWidget::updateActiveTab() if(_tabs[_activeTab].parentWidget) _tabs[_activeTab].parentWidget->loadConfig(); - setDirty(); draw(); + setDirty(); // Redraw focused areas _boss->redrawFocus(); diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 056dedc51..2d193e027 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -152,12 +152,8 @@ void Widget::lostFocus() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Widget::setEnabled(bool e) { - if(e) - setFlags(WIDGET_ENABLED); - else - clearFlags(WIDGET_ENABLED); - - setDirty(); draw(); + if(e) setFlags(WIDGET_ENABLED); + else clearFlags(WIDGET_ENABLED); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -227,7 +223,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr, tmp->lostFocus(); s.frameRect(x, y, w, h, kDlgColor); - tmp->setDirty(); tmp->draw(); + tmp->setDirty(); s.setDirty(); } } @@ -270,7 +266,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr, tmp->receivedFocus(); s.frameRect(x, y, w, h, kWidFrameColor, kDashLine); - tmp->setDirty(); tmp->draw(); + tmp->setDirty(); s.setDirty(); return tmp; @@ -310,7 +306,7 @@ void StaticTextWidget::setValue(int value) BSPF_snprintf(buf, 255, "%d", value); _label = buf; - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -318,7 +314,7 @@ void StaticTextWidget::setLabel(const string& label) { _label = label; - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -350,14 +346,14 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font, void ButtonWidget::handleMouseEntered(int button) { setFlags(WIDGET_HILITED); - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ButtonWidget::handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); - setDirty(); draw(); + setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -513,7 +509,7 @@ void CheckboxWidget::setState(bool state) if(_state != state) { _state = state; - setDirty(); draw(); + setDirty(); } } @@ -572,7 +568,7 @@ void SliderWidget::setValue(int value) if(value != _value) { _value = value; - setDirty(); draw(); + setDirty(); sendCommand(_cmd, _value, _id); } } diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index e4009031e..8fd936f57 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -87,12 +87,12 @@ class Widget : public GuiObject void lostFocus(); void addFocusWidget(Widget* w) { _focusList.push_back(w); } - /** Set/clear WIDGET_ENABLED flag and immediately redraw */ + /** Set/clear WIDGET_ENABLED flag */ void setEnabled(bool e); - void setFlags(int flags) { _flags |= flags; } - void clearFlags(int flags) { _flags &= ~flags; } - int getFlags() const { return _flags; } + void setFlags(int flags) { _flags |= flags; setDirty(); } + void clearFlags(int flags) { _flags &= ~flags; setDirty(); } + int getFlags() const { return _flags; } bool isEnabled() const { return _flags & WIDGET_ENABLED; } bool isVisible() const { return !(_flags & WIDGET_INVISIBLE); }