Merge branch 'feature/improve_ui_redraws' of https://github.com/stella-emu/stella into feature/improve_ui_redraws

This commit is contained in:
thrust26 2020-11-18 23:52:46 +01:00
commit 7ba9ce3439
9 changed files with 32 additions and 30 deletions

View File

@ -571,7 +571,7 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int DataGridWidget::getToolTipIndex(Common::Point pos) const
int DataGridWidget::getToolTipIndex(const Common::Point& pos) const
{
const int col = (pos.x - getAbsX()) / _colWidth;
const int row = (pos.y - getAbsY()) / _rowHeight;
@ -580,7 +580,7 @@ int DataGridWidget::getToolTipIndex(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string DataGridWidget::getToolTip(Common::Point pos) const
string DataGridWidget::getToolTip(const Common::Point& pos) const
{
const Int32 val = _valueList[getToolTipIndex(pos)];
ostringstream buf;
@ -595,7 +595,8 @@ string DataGridWidget::getToolTip(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DataGridWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
bool DataGridWidget::changedToolTip(const Common::Point& oldPos,
const Common::Point& newPos) const
{
return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
}

View File

@ -84,8 +84,8 @@ class DataGridWidget : public EditableWidget
void setCrossed(bool enable) { _crossGrid = enable; }
string getToolTip(Common::Point pos) const override;
bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
string getToolTip(const Common::Point& pos) const override;
bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
protected:
void drawWidget(bool hilite) override;
@ -150,7 +150,7 @@ class DataGridWidget : public EditableWidget
void enableEditMode(bool state) { _editMode = state; }
int getToolTipIndex(Common::Point pos) const;
int getToolTipIndex(const Common::Point& pos) const;
private:
// Following constructors and assignment operators not supported

View File

@ -444,7 +444,7 @@ void RomListWidget::lostFocusWidget()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Common::Point RomListWidget::getToolTipIndex(Common::Point pos) const
Common::Point RomListWidget::getToolTipIndex(const Common::Point& pos) const
{
const Common::Rect& r = getEditRect();
const int col = (pos.x - r.x() - getAbsX()) / _font.getMaxCharWidth();
@ -457,9 +457,9 @@ Common::Point RomListWidget::getToolTipIndex(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string RomListWidget::getToolTip(Common::Point pos) const
string RomListWidget::getToolTip(const Common::Point& pos) const
{
const Common::Point idx = getToolTipIndex(pos);
const Common::Point& idx = getToolTipIndex(pos);
if(idx.y == -1)
return EmptyString;
@ -499,7 +499,8 @@ string RomListWidget::getToolTip(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool RomListWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
bool RomListWidget::changedToolTip(const Common::Point& oldPos,
const Common::Point& newPos) const
{
return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
}

View File

@ -56,8 +56,8 @@ class RomListWidget : public EditableWidget
void setSelected(int item);
void setHighlighted(int item);
string getToolTip(Common::Point pos) const override;
bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
string getToolTip(const Common::Point& pos) const override;
bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
protected:
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
@ -88,7 +88,7 @@ class RomListWidget : public EditableWidget
private:
void scrollToCurrent(int item);
Common::Point getToolTipIndex(Common::Point pos) const;
Common::Point getToolTipIndex(const Common::Point& pos) const;
private:
unique_ptr<RomListSettings> myMenu;

View File

@ -205,7 +205,7 @@ void ToggleWidget::handleCommand(CommandSender* sender, int cmd,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int ToggleWidget::getToolTipIndex(Common::Point pos) const
int ToggleWidget::getToolTipIndex(const Common::Point& pos) const
{
const int row = (pos.y - getAbsY()) / _rowHeight;
@ -213,7 +213,7 @@ int ToggleWidget::getToolTipIndex(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string ToggleWidget::getToolTip(Common::Point pos) const
string ToggleWidget::getToolTip(const Common::Point& pos) const
{
const int idx = getToolTipIndex(pos);
Int32 val = 0;
@ -243,10 +243,8 @@ string ToggleWidget::getToolTip(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ToggleWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
bool ToggleWidget::changedToolTip(const Common::Point& oldPos,
const Common::Point& newPos) const
{
return getToolTipIndex(oldPos) != getToolTipIndex(newPos);
}

View File

@ -46,8 +46,8 @@ class ToggleWidget : public Widget, public CommandSender
void setEditable(bool editable) { _editable = editable; }
bool isEditable() const { return _editable; }
string getToolTip(Common::Point pos) const override;
bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
string getToolTip(const Common::Point& pos) const override;
bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
protected:
bool hasToolTip() const override { return true; }
@ -76,7 +76,7 @@ class ToggleWidget : public Widget, public CommandSender
bool handleKeyDown(StellaKey key, StellaMod mod) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
int getToolTipIndex(Common::Point pos) const;
int getToolTipIndex(const Common::Point& pos) const;
// Following constructors and assignment operators not supported
ToggleWidget() = delete;

View File

@ -51,7 +51,7 @@ void StringListWidget::setList(const StringList& list)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int StringListWidget::getToolTipIndex(Common::Point pos) const
int StringListWidget::getToolTipIndex(const Common::Point& pos) const
{
int idx = (pos.y - getAbsY()) / _lineHeight + _currentPos;
@ -62,7 +62,7 @@ int StringListWidget::getToolTipIndex(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string StringListWidget::getToolTip(Common::Point pos) const
string StringListWidget::getToolTip(const Common::Point& pos) const
{
Common::Rect rect = getEditRect();
int idx = getToolTipIndex(pos);
@ -79,7 +79,8 @@ string StringListWidget::getToolTip(Common::Point pos) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StringListWidget::changedToolTip(Common::Point oldPos, Common::Point newPos) const
bool StringListWidget::changedToolTip(const Common::Point& oldPos,
const Common::Point& newPos) const
{
bool ch = getToolTipIndex(oldPos) != getToolTipIndex(newPos)
&& getToolTip(oldPos) != getToolTip(newPos);

View File

@ -32,8 +32,8 @@ class StringListWidget : public ListWidget
void setList(const StringList& list);
bool wantsFocus() const override { return true; }
string getToolTip(Common::Point pos) const override;
bool changedToolTip(Common::Point oldPos, Common::Point newPos) const override;
string getToolTip(const Common::Point& pos) const override;
bool changedToolTip(const Common::Point& oldPos, const Common::Point& newPos) const override;
protected:
// display depends on _hasFocus so we have to redraw when focus changes
@ -50,7 +50,7 @@ class StringListWidget : public ListWidget
int _textOfs{0};
private:
int getToolTipIndex(Common::Point pos) const;
int getToolTipIndex(const Common::Point& pos) const;
private:
// Following constructors and assignment operators not supported

View File

@ -106,8 +106,9 @@ class Widget : public GuiObject
void setShadowColor(ColorId color) { _shadowcolor = color; setDirty(); }
void setToolTip(const string& text);
virtual string getToolTip(Common::Point pos) const { return _toolTipText; }
virtual bool changedToolTip(Common::Point oldPos, Common::Point newPos) const { return false; }
virtual string getToolTip(const Common::Point& pos) const { return _toolTipText; }
virtual bool changedToolTip(const Common::Point& oldPos,
const Common::Point& newPos) const { return false; }
virtual void loadConfig() { }