diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 26922f26d..9cb5accb2 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -128,7 +128,6 @@ void Dialog::close() _visible = false; parent().removeDialog(); - setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -219,26 +218,30 @@ void Dialog::positionAt(uInt32 pos) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Dialog::render() +void Dialog::redraw() { if(!isVisible() || !needsRedraw()) - return false; + return;// false; // Draw this dialog center(); drawDialog(); + render(); +// return true; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Dialog::render() +{ // Update dialog surface; also render any extra surfaces // Extra surfaces must be rendered afterwards, so they are drawn on top if(_surface->render()) { - mySurfaceStack.applyAll([](shared_ptr& surface){ + mySurfaceStack.applyAll([](shared_ptr& surface) { surface->render(); }); } - //_dirty = false; - - return true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index 68a71608c..b9a924b55 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -67,7 +67,8 @@ class Dialog : public GuiObject void setDirty() override; bool isDirty() override; // TODO: remove bool isChainDirty() const override; - bool render(); + void redraw(); + void render(); void addFocusWidget(Widget* w) override; void addToFocusList(WidgetArray& list) override; diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index 60bc9b32d..9649e447c 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -89,11 +89,11 @@ void DialogContainer::updateTime(uInt64 time) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool DialogContainer::draw(bool full) +void DialogContainer::draw(bool full) { cerr << "draw " << full << " " << typeid(*this).name() << endl; if(myDialogStack.empty()) - return false; + return; // Make the top dialog dirty if a full redraw is requested if(full) @@ -102,10 +102,8 @@ bool DialogContainer::draw(bool full) // Render all dirty dialogs myDialogStack.applyAll([&](Dialog*& d) { if(d->needsRedraw()) - full |= d->render(); + d->redraw(); }); - - return full; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -133,7 +131,7 @@ int DialogContainer::addDialog(Dialog* d) "Unable to show dialog box; FIX THE CODE"); else { - // fade out current top dialog + // "darken" current top dialog if(!myDialogStack.empty()) myDialogStack.top()->setDirty(); d->setDirty(); @@ -148,14 +146,16 @@ void DialogContainer::removeDialog() if(!myDialogStack.empty()) { myDialogStack.pop(); - // necessary as long as all dialogs share the same surface + if(!myDialogStack.empty()) { - //myDialogStack.top()->setDirty(); + // this "undarkens" the top dialog + myDialogStack.top()->setDirty(); - // Mark all dialogs for redraw + // Rerender all dialogs (TODO: top dialog is rendered twice) myDialogStack.applyAll([&](Dialog*& d){ - d->setDirty(); + //d->setDirty(); + d->render(); }); } } diff --git a/src/gui/DialogContainer.hxx b/src/gui/DialogContainer.hxx index cc50e23b6..1f6cce8f6 100644 --- a/src/gui/DialogContainer.hxx +++ b/src/gui/DialogContainer.hxx @@ -121,10 +121,8 @@ class DialogContainer /** Draw the stack of menus (full indicates to redraw all items). - - @return Answers whether any drawing actually occurred. */ - bool draw(bool full = false); + void draw(bool full = false); /** Answers whether a full redraw is required. diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index 0b78c8952..4032daae3 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -74,7 +74,6 @@ bool EditableWidget::isDirty() _caretEnabled = !_caretEnabled; _dirty = true; } - cerr << "."; } return _dirty; diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx index cf799dc47..ccf6af1aa 100644 --- a/src/gui/PopUpWidget.cxx +++ b/src/gui/PopUpWidget.cxx @@ -277,7 +277,7 @@ void PopUpWidget::drawWidget(bool hilite) // Fill the background ColorId bgCol = isEditable() ? kWidColor : kDlgColor; - s.fillRect(x + 1, _y + 1, w - (_arrowWidth * 2 - 0), _h - 2, + s.fillRect(x + 1, _y + 1, w - (_arrowWidth * 2 - 1), _h - 2, onTop ? _changed ? kDbgChangedColor : bgCol : kDlgColor); s.fillRect(x + w - (_arrowWidth * 2 - 2), _y + 1, (_arrowWidth * 2 - 3), _h - 2, onTop ? isEnabled() && hilite ? kBtnColorHi : bgCol : kBGColorLo);