[Scummvm-cvs-logs] CVS: scummvm/gui ListWidget.cpp,1.43,1.44 ListWidget.h,1.26,1.27 PopUpWidget.cpp,1.34,1.35 dialog.cpp,1.48,1.49 newgui.cpp,1.103,1.104
Max Horn
fingolfin at users.sourceforge.net
Sat Mar 12 07:29:44 CET 2005
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17626
Modified Files:
ListWidget.cpp ListWidget.h PopUpWidget.cpp dialog.cpp
newgui.cpp
Log Message:
Fix popup widget in scaled GUI mode
Index: ListWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- ListWidget.cpp 29 Jan 2005 18:04:34 -0000 1.43
+++ ListWidget.cpp 12 Mar 2005 15:29:16 -0000 1.44
@@ -112,7 +112,7 @@
// First check whether the selection changed
int newSelectedItem;
- newSelectedItem = (y - 1) / kLineHeight + _currentPos;
+ newSelectedItem = findItem(x, y);
if (newSelectedItem > (int)_list.size() - 1)
newSelectedItem = -1;
@@ -132,7 +132,7 @@
void ListWidget::handleMouseUp(int x, int y, int button, int clickCount) {
// If this was a double click and the mouse is still over the selected item,
// send the double click command
- if (clickCount == 2 && (_selectedItem == (y - 1) / kLineHeight + _currentPos)) {
+ if (clickCount == 2 && (_selectedItem == findItem(x, y))) {
sendCommand(kListItemDoubleClickedCmd, _selectedItem);
}
}
@@ -142,6 +142,10 @@
}
+int ListWidget::findItem(int x, int y) const {
+ return (y - 1) / kLineHeight + _currentPos;
+}
+
static int matchingCharsIgnoringCase(const char *x, const char *y, bool &stop) {
int match = 0;
while (*x && *y && toupper(*x) == toupper(*y)) {
Index: ListWidget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- ListWidget.h 29 Jan 2005 18:04:34 -0000 1.26
+++ ListWidget.h 12 Mar 2005 15:29:16 -0000 1.27
@@ -90,6 +90,7 @@
protected:
void drawWidget(bool hilite);
+ int findItem(int x, int y) const;
void scrollBarRecalc();
void endEditMode();
Index: PopUpWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/PopUpWidget.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- PopUpWidget.cpp 10 Jan 2005 22:05:37 -0000 1.34
+++ PopUpWidget.cpp 12 Mar 2005 15:29:16 -0000 1.35
@@ -187,7 +187,7 @@
int PopUpDialog::findItem(int x, int y) const {
if (x >= 0 && x < _w && y >= 0 && y < _h) {
- return (y-2) / kLineHeight;
+ return (y - 2) / kLineHeight;
}
return -1;
}
Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- dialog.cpp 10 Jan 2005 22:05:38 -0000 1.48
+++ dialog.cpp 12 Mar 2005 15:29:16 -0000 1.49
@@ -119,8 +119,6 @@
}
void Dialog::handleMouseDown(int x, int y, int button, int clickCount) {
- x /= g_gui.getScaleFactor(); y /= g_gui.getScaleFactor();
-
Widget *w;
w = findWidget(x, y);
@@ -146,8 +144,6 @@
}
void Dialog::handleMouseUp(int x, int y, int button, int clickCount) {
- x /= g_gui.getScaleFactor(); y /= g_gui.getScaleFactor();
-
Widget *w;
if (_focusedWidget) {
@@ -168,8 +164,6 @@
}
void Dialog::handleMouseWheel(int x, int y, int direction) {
- x /= g_gui.getScaleFactor(); y /= g_gui.getScaleFactor();
-
Widget *w;
// This may look a bit backwards, but I think it makes more sense for
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- newgui.cpp 12 Mar 2005 15:04:49 -0000 1.103
+++ newgui.cpp 12 Mar 2005 15:29:16 -0000 1.104
@@ -132,6 +132,10 @@
uint32 time = _system->getMillis();
while (_system->pollEvent(event)) {
+ Common::Point mouse(event.mouse.x - (activeDialog->_x * _scaleFactor), event.mouse.y - (activeDialog->_y * _scaleFactor));
+ mouse.x /= _scaleFactor;
+ mouse.y /= _scaleFactor;
+
switch (event.type) {
case OSystem::EVENT_KEYDOWN:
#if !defined(__PALM_OS__)
@@ -151,7 +155,7 @@
_currentKeyDown.keycode = 0;
break;
case OSystem::EVENT_MOUSEMOVE:
- activeDialog->handleMouseMoved(event.mouse.x - (activeDialog->_x * _scaleFactor), event.mouse.y - (activeDialog->_y * _scaleFactor), 0);
+ activeDialog->handleMouseMoved(mouse.x, mouse.y, 0);
break;
// We don't distinguish between mousebuttons (for now at least)
case OSystem::EVENT_LBUTTONDOWN:
@@ -167,18 +171,18 @@
_lastClick.count = 1;
}
_lastClick.time = time;
- activeDialog->handleMouseDown(event.mouse.x - (activeDialog->_x * _scaleFactor), event.mouse.y - (activeDialog->_y * _scaleFactor), button, _lastClick.count);
+ activeDialog->handleMouseDown(mouse.x, mouse.y, button, _lastClick.count);
break;
case OSystem::EVENT_LBUTTONUP:
case OSystem::EVENT_RBUTTONUP:
button = (event.type == OSystem::EVENT_LBUTTONUP ? 1 : 2);
- activeDialog->handleMouseUp(event.mouse.x - (activeDialog->_x * _scaleFactor), event.mouse.y - (activeDialog->_y * _scaleFactor), button, _lastClick.count);
+ activeDialog->handleMouseUp(mouse.x, mouse.y, button, _lastClick.count);
break;
case OSystem::EVENT_WHEELUP:
- activeDialog->handleMouseWheel(event.mouse.x - (activeDialog->_x * _scaleFactor), event.mouse.y - (activeDialog->_y * _scaleFactor), -1);
+ activeDialog->handleMouseWheel(mouse.x, mouse.y, -1);
break;
case OSystem::EVENT_WHEELDOWN:
- activeDialog->handleMouseWheel(event.mouse.x - (activeDialog->_x * _scaleFactor), event.mouse.y - (activeDialog->_y * _scaleFactor), 1);
+ activeDialog->handleMouseWheel(mouse.x, mouse.y, 1);
break;
case OSystem::EVENT_QUIT:
_system->quit();
More information about the Scummvm-git-logs
mailing list