[Scummvm-cvs-logs] SF.net SVN: scummvm: [27598] scummvm/trunk/gui
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Fri Jun 22 09:49:08 CEST 2007
Revision: 27598
http://scummvm.svn.sourceforge.net/scummvm/?rev=27598&view=rev
Author: eriktorbjorn
Date: 2007-06-22 00:49:02 -0700 (Fri, 22 Jun 2007)
Log Message:
-----------
Use KEYCODE constants.
Modified Paths:
--------------
scummvm/trunk/gui/ListWidget.cpp
scummvm/trunk/gui/PopUpWidget.cpp
scummvm/trunk/gui/console.cpp
scummvm/trunk/gui/dialog.cpp
scummvm/trunk/gui/editable.cpp
Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp 2007-06-22 07:34:07 UTC (rev 27597)
+++ scummvm/trunk/gui/ListWidget.cpp 2007-06-22 07:49:02 UTC (rev 27598)
@@ -24,6 +24,7 @@
#include "common/stdafx.h"
#include "common/system.h"
+#include "common/events.h"
#include "gui/ListWidget.h"
#include "gui/ScrollBarWidget.h"
#include "gui/dialog.h"
@@ -231,39 +232,39 @@
// not editmode
switch (keycode) {
- case '\n': // enter/return
- case '\r':
+ case Common::KEYCODE_RETURN:
+ case Common::KEYCODE_KP_ENTER:
if (_selectedItem >= 0) {
// override continuous enter keydown
- if (_editable && (_currentKeyDown != '\n' && _currentKeyDown != '\r')) {
+ if (_editable && (_currentKeyDown != Common::KEYCODE_RETURN && _currentKeyDown != Common::KEYCODE_KP_ENTER)) {
dirty = true;
startEditMode();
} else
sendCommand(kListItemActivatedCmd, _selectedItem);
}
break;
- case 256+17: // up arrow
+ case Common::KEYCODE_UP:
if (_selectedItem > 0)
_selectedItem--;
break;
- case 256+18: // down arrow
+ case Common::KEYCODE_DOWN:
if (_selectedItem < (int)_list.size() - 1)
_selectedItem++;
break;
- case 256+24: // pageup
+ case Common::KEYCODE_PAGEUP:
_selectedItem -= _entriesPerPage - 1;
if (_selectedItem < 0)
_selectedItem = 0;
break;
- case 256+25: // pagedown
+ case Common::KEYCODE_PAGEDOWN:
_selectedItem += _entriesPerPage - 1;
if (_selectedItem >= (int)_list.size() )
_selectedItem = _list.size() - 1;
break;
- case 256+22: // home
+ case Common::KEYCODE_HOME:
_selectedItem = 0;
break;
- case 256+23: // end
+ case Common::KEYCODE_END:
_selectedItem = _list.size() - 1;
break;
default:
Modified: scummvm/trunk/gui/PopUpWidget.cpp
===================================================================
--- scummvm/trunk/gui/PopUpWidget.cpp 2007-06-22 07:34:07 UTC (rev 27597)
+++ scummvm/trunk/gui/PopUpWidget.cpp 2007-06-22 07:49:02 UTC (rev 27598)
@@ -24,6 +24,7 @@
#include "common/stdafx.h"
#include "common/system.h"
+#include "common/events.h"
#include "gui/dialog.h"
#include "gui/eval.h"
#include "gui/newgui.h"
@@ -210,7 +211,7 @@
}
void PopUpDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
- if (keycode == 27) { // escape
+ if (keycode == Common::KEYCODE_ESCAPE) {
// Don't change the previous selection
setResult(-1);
close();
@@ -221,21 +222,21 @@
return;
switch (keycode) {
- case '\n': // enter/return
- case '\r':
+ case Common::KEYCODE_RETURN:
+ case Common::KEYCODE_KP_ENTER:
setResult(_selection);
close();
break;
- case 256+17: // up arrow
+ case Common::KEYCODE_UP:
moveUp();
break;
- case 256+18: // down arrow
+ case Common::KEYCODE_DOWN:
moveDown();
break;
- case 256+22: // home
+ case Common::KEYCODE_HOME:
setSelection(0);
break;
- case 256+23: // end
+ case Common::KEYCODE_END:
setSelection(_popUpBoss->_entries.size()-1);
break;
}
Modified: scummvm/trunk/gui/console.cpp
===================================================================
--- scummvm/trunk/gui/console.cpp 2007-06-22 07:34:07 UTC (rev 27597)
+++ scummvm/trunk/gui/console.cpp 2007-06-22 07:49:02 UTC (rev 27598)
@@ -265,8 +265,8 @@
return;
switch (keycode) {
- case '\n': // enter/return
- case '\r': {
+ case Common::KEYCODE_RETURN:
+ case Common::KEYCODE_KP_ENTER: {
if (_caretVisible)
drawCaret(true);
@@ -307,10 +307,10 @@
slideUpAndClose();
break;
}
- case 27: // escape
+ case Common::KEYCODE_ESCAPE:
slideUpAndClose();
break;
- case 8: // backspace
+ case Common::KEYCODE_BACKSPACE:
if (_caretVisible)
drawCaret(true);
@@ -321,7 +321,7 @@
scrollToCurrent();
drawLine(pos2line(_currentPos));
break;
- case 9: // tab
+ case Common::KEYCODE_TAB:
{
if (_completionCallbackProc) {
int len = _currentPos - _promptStartPos;
@@ -346,11 +346,11 @@
}
break;
}
- case 127:
+ case Common::KEYCODE_DELETE:
killChar();
drawLine(pos2line(_currentPos));
break;
- case 256 + 24: // pageup
+ case Common::KEYCODE_PAGEUP:
if (modifiers == Common::KBD_SHIFT) {
_scrollLine -= _linesPerPage - 1;
if (_scrollLine < _firstLineInBuffer + _linesPerPage - 1)
@@ -359,7 +359,7 @@
draw();
}
break;
- case 256 + 25: // pagedown
+ case Common::KEYCODE_PAGEDOWN:
if (modifiers == Common::KBD_SHIFT) {
_scrollLine += _linesPerPage - 1;
if (_scrollLine > _promptEndPos / kCharsPerLine) {
@@ -371,7 +371,7 @@
draw();
}
break;
- case 256 + 22: // home
+ case Common::KEYCODE_HOME:
if (modifiers == Common::KBD_SHIFT) {
_scrollLine = _firstLineInBuffer + _linesPerPage - 1;
updateScrollBuffer();
@@ -380,7 +380,7 @@
}
draw();
break;
- case 256 + 23: // end
+ case Common::KEYCODE_END:
if (modifiers == Common::KBD_SHIFT) {
_scrollLine = _promptEndPos / kCharsPerLine;
if (_scrollLine < _linesPerPage - 1)
@@ -391,18 +391,18 @@
}
draw();
break;
- case 273: // cursor up
+ case Common::KEYCODE_UP:
historyScroll(+1);
break;
- case 274: // cursor down
+ case Common::KEYCODE_DOWN:
historyScroll(-1);
break;
- case 275: // cursor right
+ case Common::KEYCODE_RIGHT:
if (_currentPos < _promptEndPos)
_currentPos++;
drawLine(pos2line(_currentPos));
break;
- case 276: // cursor left
+ case Common::KEYCODE_LEFT:
if (_currentPos > _promptStartPos)
_currentPos--;
drawLine(pos2line(_currentPos));
@@ -446,25 +446,25 @@
void ConsoleDialog::specialKeys(int keycode) {
switch (keycode) {
- case 'a':
+ case Common::KEYCODE_a:
_currentPos = _promptStartPos;
draw();
break;
- case 'd':
+ case Common::KEYCODE_d:
if (_currentPos < _promptEndPos) {
killChar();
draw();
}
break;
- case 'e':
+ case Common::KEYCODE_e:
_currentPos = _promptEndPos;
draw();
break;
- case 'k':
+ case Common::KEYCODE_k:
killLine();
draw();
break;
- case 'w':
+ case Common::KEYCODE_w:
killLastWord();
draw();
break;
Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp 2007-06-22 07:34:07 UTC (rev 27597)
+++ scummvm/trunk/gui/dialog.cpp 2007-06-22 07:49:02 UTC (rev 27598)
@@ -23,6 +23,7 @@
*/
#include "common/stdafx.h"
+#include "common/events.h"
#include "gui/newgui.h"
#include "gui/dialog.h"
@@ -233,7 +234,7 @@
}
// ESC closes all dialogs by default
- if (keycode == 27) {
+ if (keycode == Common::KEYCODE_ESCAPE) {
setResult(-1);
close();
}
Modified: scummvm/trunk/gui/editable.cpp
===================================================================
--- scummvm/trunk/gui/editable.cpp 2007-06-22 07:34:07 UTC (rev 27597)
+++ scummvm/trunk/gui/editable.cpp 2007-06-22 07:49:02 UTC (rev 27598)
@@ -23,6 +23,7 @@
*/
#include "common/stdafx.h"
+#include "common/events.h"
#include "gui/editable.h"
#include "gui/newgui.h"
@@ -94,17 +95,17 @@
drawCaret(true);
switch (keycode) {
- case '\n': // enter/return
- case '\r':
+ case Common::KEYCODE_RETURN:
+ case Common::KEYCODE_KP_ENTER:
// confirm edit and exit editmode
endEditMode();
dirty = true;
break;
- case 27: // escape
+ case Common::KEYCODE_ESCAPE:
abortEditMode();
dirty = true;
break;
- case 8: // backspace
+ case Common::KEYCODE_BACKSPACE:
if (_caretPos > 0) {
_caretPos--;
_editString.deleteChar(_caretPos);
@@ -112,32 +113,32 @@
}
forcecaret = true;
break;
- case 127: // delete
+ case Common::KEYCODE_DELETE:
if (_caretPos < (int)_editString.size()) {
_editString.deleteChar(_caretPos);
dirty = true;
}
forcecaret = true;
break;
- case 256 + 20: // left arrow
+ case Common::KEYCODE_LEFT:
if (_caretPos > 0) {
dirty = setCaretPos(_caretPos - 1);
}
forcecaret = true;
dirty = true;
break;
- case 256 + 19: // right arrow
+ case Common::KEYCODE_RIGHT:
if (_caretPos < (int)_editString.size()) {
dirty = setCaretPos(_caretPos + 1);
}
forcecaret = true;
dirty = true;
break;
- case 256 + 22: // home
+ case Common::KEYCODE_HOME:
dirty = setCaretPos(0);
forcecaret = true;
break;
- case 256 + 23: // end
+ case Common::KEYCODE_END:
dirty = setCaretPos(_editString.size());
forcecaret = true;
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list