[Scummvm-cvs-logs] SF.net SVN: scummvm: [27786] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jun 30 14:26:59 CEST 2007


Revision: 27786
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27786&view=rev
Author:   fingolfin
Date:     2007-06-30 05:26:59 -0700 (Sat, 30 Jun 2007)

Log Message:
-----------
Changed GUI system to use Common::KeyState state

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/dialogs.cpp
    scummvm/trunk/engines/scumm/dialogs.h
    scummvm/trunk/gui/KeysDialog.cpp
    scummvm/trunk/gui/KeysDialog.h
    scummvm/trunk/gui/ListWidget.cpp
    scummvm/trunk/gui/ListWidget.h
    scummvm/trunk/gui/PopUpWidget.cpp
    scummvm/trunk/gui/TabWidget.cpp
    scummvm/trunk/gui/TabWidget.h
    scummvm/trunk/gui/about.cpp
    scummvm/trunk/gui/about.h
    scummvm/trunk/gui/console.cpp
    scummvm/trunk/gui/console.h
    scummvm/trunk/gui/dialog.cpp
    scummvm/trunk/gui/dialog.h
    scummvm/trunk/gui/editable.cpp
    scummvm/trunk/gui/editable.h
    scummvm/trunk/gui/launcher.cpp
    scummvm/trunk/gui/launcher.h
    scummvm/trunk/gui/newgui.cpp
    scummvm/trunk/gui/widget.h

Modified: scummvm/trunk/engines/scumm/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/engines/scumm/dialogs.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -825,26 +825,26 @@
 	: InfoDialog(scumm, res) {
 }
 
-void PauseDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-	if (ascii == ' ')  // Close pause dialog if space key is pressed
+void PauseDialog::handleKeyDown(Common::KeyState state) {
+	if (state.ascii == ' ')  // Close pause dialog if space key is pressed
 		close();
 	else
-		ScummDialog::handleKeyDown(ascii, keycode, modifiers);
+		ScummDialog::handleKeyDown(state);
 }
 
 ConfirmDialog::ConfirmDialog(ScummEngine *scumm, int res)
 	: InfoDialog(scumm, res) {
 }
 
-void ConfirmDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-	if (tolower(ascii) == 'n') {
+void ConfirmDialog::handleKeyDown(Common::KeyState state) {
+	if (state.keycode == Common::KEYCODE_n) {
 		setResult(0);
 		close();
-	} else if (tolower(ascii) == 'y') {
+	} else if (state.keycode == Common::KEYCODE_y) {
 		setResult(1);
 		close();
 	} else
-		ScummDialog::handleKeyDown(ascii, keycode, modifiers);
+		ScummDialog::handleKeyDown(state);
 }
 
 #pragma mark -
@@ -892,11 +892,11 @@
 	_h = height;
 }
 
-void ValueDisplayDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-	if (ascii == _incKey || ascii == _decKey) {
-		if (ascii == _incKey && _value < _max)
+void ValueDisplayDialog::handleKeyDown(Common::KeyState state) {
+	if (state.ascii == _incKey || state.ascii == _decKey) {
+		if (state.ascii == _incKey && _value < _max)
 			_value++;
-		else if (ascii == _decKey && _value > _min)
+		else if (state.ascii == _decKey && _value > _min)
 			_value--;
 
 		setResult(_value);
@@ -924,8 +924,8 @@
 		close();
 }
 
-void SubtitleSettingsDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-	if (keycode == 't' && modifiers == Common::KBD_CTRL) {
+void SubtitleSettingsDialog::handleKeyDown(Common::KeyState state) {
+	if (state.keycode == 't' && state.flags == Common::KBD_CTRL) {
 		cycleValue();
 
 		reflowLayout();
@@ -959,11 +959,11 @@
 	: InfoDialog(scumm, text) {
 }
 
-void Indy3IQPointsDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-	if (ascii == 'i') 
+void Indy3IQPointsDialog::handleKeyDown(Common::KeyState state) {
+	if (state.ascii == 'i') 
 		close();
 	else
-		ScummDialog::handleKeyDown(ascii, keycode, modifiers);
+		ScummDialog::handleKeyDown(state);
 }
 
 } // End of namespace Scumm

Modified: scummvm/trunk/engines/scumm/dialogs.h
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/engines/scumm/dialogs.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -169,8 +169,8 @@
 		setResult(0);
 		close();
 	}
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-		setResult(ascii);
+	virtual void handleKeyDown(Common::KeyState state) {
+		setResult(state.ascii);
 		close();
 	}
 
@@ -189,7 +189,7 @@
 class PauseDialog : public InfoDialog {
 public:
 	PauseDialog(ScummEngine *scumm, int res);
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	virtual void handleKeyDown(Common::KeyState state);
 };
 
 /**
@@ -199,7 +199,7 @@
 class ConfirmDialog : public InfoDialog {
 public:
 	ConfirmDialog(ScummEngine *scumm, int res);
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	virtual void handleKeyDown(Common::KeyState state);
 };
 
 /**
@@ -216,7 +216,7 @@
 	virtual void handleMouseDown(int x, int y, int button, int clickCount) {
 		close();
 	}
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	virtual void handleKeyDown(Common::KeyState state);
 
 	virtual void reflowLayout();
 
@@ -247,7 +247,7 @@
 	virtual void handleMouseDown(int x, int y, int button, int clickCount) {
 		close();
 	}
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	virtual void handleKeyDown(Common::KeyState state);
 protected:
 	int _value;
 	uint32 _timer;
@@ -259,7 +259,7 @@
 class Indy3IQPointsDialog : public InfoDialog {
 public:
 	Indy3IQPointsDialog(ScummEngine *scumm, char* text);
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	virtual void handleKeyDown(Common::KeyState state);
 };
 
 } // End of namespace Scumm

Modified: scummvm/trunk/gui/KeysDialog.cpp
===================================================================
--- scummvm/trunk/gui/KeysDialog.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/KeysDialog.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -126,23 +126,23 @@
 	}
 }
 
-void KeysDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers){
+void KeysDialog::handleKeyDown(Common::KeyState state){
 	if (!Actions::Instance()->mappingActive())
-		Dialog::handleKeyDown(ascii,keycode,modifiers);
+		Dialog::handleKeyDown(state);
 }
 
-void KeysDialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
+void KeysDialog::handleKeyUp(Common::KeyState state) {
 #ifdef __SYMBIAN32__
 	if (Actions::Instance()->mappingActive()) {
 #else
-	if (modifiers == 0xff  && Actions::Instance()->mappingActive()) {	// GAPI key was selected
+	if (state.flags == 0xff  && Actions::Instance()->mappingActive()) {	// GAPI key was selected
 #endif
 		char selection[100];
 
-		Actions::Instance()->setMapping((ActionType)_actionSelected, ascii);
+		Actions::Instance()->setMapping((ActionType)_actionSelected, state.ascii);
 
 		if (ascii != 0)
-			sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey) keycode));
+			sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey) state.keycode));
 		else
 			sprintf(selection, "Associated key : none");
 
@@ -154,7 +154,7 @@
 		_actionsList->setEnabled(true);
 		Actions::Instance()->beginMapping(false);
 	} else 
-		Dialog::handleKeyUp(ascii,keycode,modifiers);
+		Dialog::handleKeyUp(state);
 }
 
 } // namespace GUI

Modified: scummvm/trunk/gui/KeysDialog.h
===================================================================
--- scummvm/trunk/gui/KeysDialog.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/KeysDialog.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -38,8 +38,8 @@
 	KeysDialog(const Common::String &title = "Choose an action to map");
 
 	virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
-	virtual void handleKeyUp(uint16 ascii, int keycode, int modifiers);
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	virtual void handleKeyUp(Common::KeyState state);
+	virtual void handleKeyDown(Common::KeyState state);
 
 protected:
 

Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/ListWidget.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -186,12 +186,12 @@
 	return match;
 }
 
-bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
+bool ListWidget::handleKeyDown(Common::KeyState state) {
 	bool handled = true;
 	bool dirty = false;
 	int oldSelectedItem = _selectedItem;
 
-	if (!_editMode && isprint((char)ascii)) {
+	if (!_editMode && isprint((char)state.ascii)) {
 		// Quick selection mode: Go to first list item starting with this key
 		// (or a substring accumulated from the last couple key presses).
 		// Only works in a useful fashion if the list entries are sorted.
@@ -199,9 +199,9 @@
 		// method "enableQuickSelect()" or so ?
 		uint32 time = getMillis();
 		if (_quickSelectTime < time) {
-			_quickSelectStr = (char)ascii;
+			_quickSelectStr = (char)state.ascii;
 		} else {
-			_quickSelectStr += (char)ascii;
+			_quickSelectStr += (char)state.ascii;
 		}
 		_quickSelectTime = time + 300;	// TODO: Turn this into a proper constant (kQuickSelectDelay ?)
 
@@ -227,11 +227,11 @@
 		scrollToCurrent();
 	} else if (_editMode) {
 		// Class EditableWidget handles all text editing related key presses for us
-		handled = EditableWidget::handleKeyDown(ascii, keycode, modifiers);
+		handled = EditableWidget::handleKeyDown(state);
 	} else {
 		// not editmode
 
-		switch (keycode) {
+		switch (state.keycode) {
 		case Common::KEYCODE_RETURN:
 		case Common::KEYCODE_KP_ENTER:
 			if (_selectedItem >= 0) {
@@ -285,14 +285,14 @@
 
 #if !defined(PALMOS_MODE)
 	// not done on PalmOS because keyboard is emulated and keyup is not generated
-	_currentKeyDown = keycode;
+	_currentKeyDown = state.keycode;
 #endif
 
 	return handled;
 }
 
-bool ListWidget::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
-	if (keycode == _currentKeyDown)
+bool ListWidget::handleKeyUp(Common::KeyState state) {
+	if (state.keycode == _currentKeyDown)
 		_currentKeyDown = 0;
 	return true;
 }

Modified: scummvm/trunk/gui/ListWidget.h
===================================================================
--- scummvm/trunk/gui/ListWidget.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/ListWidget.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -92,8 +92,8 @@
 	virtual void handleMouseDown(int x, int y, int button, int clickCount);
 	virtual void handleMouseUp(int x, int y, int button, int clickCount);
 	virtual void handleMouseWheel(int x, int y, int direction);
-	virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers);
-	virtual bool handleKeyUp(uint16 ascii, int keycode, int modifiers);
+	virtual bool handleKeyDown(Common::KeyState state);
+	virtual bool handleKeyUp(Common::KeyState state);
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 
 	virtual void reflowLayout();

Modified: scummvm/trunk/gui/PopUpWidget.cpp
===================================================================
--- scummvm/trunk/gui/PopUpWidget.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/PopUpWidget.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -58,7 +58,7 @@
 	void handleMouseUp(int x, int y, int button, int clickCount);
 	void handleMouseWheel(int x, int y, int direction);	// Scroll through entries with scroll wheel
 	void handleMouseMoved(int x, int y, int button);	// Redraw selections depending on mouse position
-	void handleKeyDown(uint16 ascii, int keycode, int modifiers);	// Scroll through entries with arrow keys etc.
+	void handleKeyDown(Common::KeyState state);	// Scroll through entries with arrow keys etc.
 
 protected:
 	void drawMenuEntry(int entry, bool hilite);
@@ -210,8 +210,8 @@
 	setSelection(item);
 }
 
-void PopUpDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-	if (keycode == Common::KEYCODE_ESCAPE) {
+void PopUpDialog::handleKeyDown(Common::KeyState state) {
+	if (state.keycode == Common::KEYCODE_ESCAPE) {
 		// Don't change the previous selection
 		setResult(-1);
 		close();
@@ -221,7 +221,7 @@
 	if (isMouseDown())
 		return;
 
-	switch (keycode) {
+	switch (state.keycode) {
 	case Common::KEYCODE_RETURN:
 	case Common::KEYCODE_KP_ENTER:
 		setResult(_selection);
@@ -239,6 +239,8 @@
 	case Common::KEYCODE_END:
 		setSelection(_popUpBoss->_entries.size()-1);
 		break;
+	default:
+		break;
 	}
 }
 

Modified: scummvm/trunk/gui/TabWidget.cpp
===================================================================
--- scummvm/trunk/gui/TabWidget.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/TabWidget.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -198,11 +198,11 @@
 	}
 }
 
-bool TabWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
+bool TabWidget::handleKeyDown(Common::KeyState state) {
 	// TODO: maybe there should be a way to switch between tabs
 	// using the keyboard? E.g. Alt-Shift-Left/Right-Arrow or something
 	// like that.
-	return Widget::handleKeyDown(ascii, keycode, modifiers);
+	return Widget::handleKeyDown(state);
 }
 
 void TabWidget::reflowLayout() {

Modified: scummvm/trunk/gui/TabWidget.h
===================================================================
--- scummvm/trunk/gui/TabWidget.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/TabWidget.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -87,7 +87,7 @@
 	void setActiveTab(int tabID);
 
 	virtual void handleMouseDown(int x, int y, int button, int clickCount);
-	virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	virtual bool handleKeyDown(Common::KeyState state);
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 
 	virtual void reflowLayout();

Modified: scummvm/trunk/gui/about.cpp
===================================================================
--- scummvm/trunk/gui/about.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/about.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -302,13 +302,13 @@
 	close();
 }
 
-void AboutDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-	if (ascii)
+void AboutDialog::handleKeyDown(Common::KeyState state) {
+	if (state.ascii)
 		_willClose = true;
 }
 
-void AboutDialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
-	if (ascii && _willClose)
+void AboutDialog::handleKeyUp(Common::KeyState state) {
+	if (state.ascii && _willClose)
 		close();
 }
 

Modified: scummvm/trunk/gui/about.h
===================================================================
--- scummvm/trunk/gui/about.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/about.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -52,8 +52,8 @@
 	void drawDialog();
 	void handleTickle();
 	void handleMouseUp(int x, int y, int button, int clickCount);
-	void handleKeyDown(uint16 ascii, int keycode, int modifiers);
-	void handleKeyUp(uint16 ascii, int keycode, int modifiers);
+	void handleKeyDown(Common::KeyState state);
+	void handleKeyUp(Common::KeyState state);
 
 	void reflowLayout();
 };

Modified: scummvm/trunk/gui/console.cpp
===================================================================
--- scummvm/trunk/gui/console.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/console.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -258,13 +258,13 @@
 	_scrollBar->handleMouseWheel(x, y, direction);
 }
 
-void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
+void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 	int i;
 
 	if (_slideMode != kNoSlideMode)
 		return;
 
-	switch (keycode) {
+	switch (state.keycode) {
 	case Common::KEYCODE_RETURN:
 	case Common::KEYCODE_KP_ENTER: {
 		if (_caretVisible)
@@ -351,7 +351,7 @@
 		drawLine(pos2line(_currentPos));
 		break;
 	case Common::KEYCODE_PAGEUP:
-		if (modifiers == Common::KBD_SHIFT) {
+		if (state.flags == Common::KBD_SHIFT) {
 			_scrollLine -= _linesPerPage - 1;
 			if (_scrollLine < _firstLineInBuffer + _linesPerPage - 1)
 				_scrollLine = _firstLineInBuffer + _linesPerPage - 1;
@@ -360,7 +360,7 @@
 		}
 		break;
 	case Common::KEYCODE_PAGEDOWN:
-		if (modifiers == Common::KBD_SHIFT) {
+		if (state.flags == Common::KBD_SHIFT) {
 			_scrollLine += _linesPerPage - 1;
 			if (_scrollLine > _promptEndPos / kCharsPerLine) {
 				_scrollLine = _promptEndPos / kCharsPerLine;
@@ -372,7 +372,7 @@
 		}
 		break;
 	case Common::KEYCODE_HOME:
-		if (modifiers == Common::KBD_SHIFT) {
+		if (state.flags == Common::KBD_SHIFT) {
 			_scrollLine = _firstLineInBuffer + _linesPerPage - 1;
 			updateScrollBuffer();
 		} else {
@@ -381,7 +381,7 @@
 		draw();
 		break;
 	case Common::KEYCODE_END:
-		if (modifiers == Common::KBD_SHIFT) {
+		if (state.flags == Common::KBD_SHIFT) {
 			_scrollLine = _promptEndPos / kCharsPerLine;
 			if (_scrollLine < _linesPerPage - 1)
 				_scrollLine = _linesPerPage - 1;
@@ -408,15 +408,15 @@
 		drawLine(pos2line(_currentPos));
 		break;
 	default:
-		if (ascii == '~' || ascii == '#') {
+		if (state.ascii == '~' || state.ascii == '#') {
 			slideUpAndClose();
-		} else if (modifiers == Common::KBD_CTRL) {
-			specialKeys(keycode);
-		} else if ((ascii >= 32 && ascii <= 127) || (ascii >= 160 && ascii <= 255)) {
+		} else if (state.flags == Common::KBD_CTRL) {
+			specialKeys(state.keycode);
+		} else if ((state.ascii >= 32 && state.ascii <= 127) || (state.ascii >= 160 && state.ascii <= 255)) {
 			for (i = _promptEndPos - 1; i >= _currentPos; i--)
 				buffer(i + 1) = buffer(i);
 			_promptEndPos++;
-			putchar((byte)ascii);
+			putchar((byte)state.ascii);
 			scrollToCurrent();
 		}
 	}

Modified: scummvm/trunk/gui/console.h
===================================================================
--- scummvm/trunk/gui/console.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/console.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -140,7 +140,7 @@
 	void handleTickle();
 	void reflowLayout();
 	void handleMouseWheel(int x, int y, int direction);
-	void handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	void handleKeyDown(Common::KeyState state);
 	void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 
 	int printf(const char *format, ...);

Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/dialog.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -211,18 +211,18 @@
 		w->handleMouseWheel(x, y, direction);
 }
 
-void Dialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
+void Dialog::handleKeyDown(Common::KeyState state) {
 	if (_focusedWidget) {
-		if (_focusedWidget->handleKeyDown(ascii, keycode, modifiers))
+		if (_focusedWidget->handleKeyDown(state))
 			return;
 	}
 
 	// Hotkey handling
-	if (ascii != 0) {
+	if (state.ascii != 0) {
 		Widget *w = _firstWidget;
-		ascii = toupper(ascii);
+		state.ascii = toupper(state.ascii);
 		while (w) {
-			if (w->_type == kButtonWidget && ascii == toupper(((ButtonWidget *)w)->_hotkey)) {
+			if (w->_type == kButtonWidget && state.ascii == toupper(((ButtonWidget *)w)->_hotkey)) {
 				// The hotkey for widget w was pressed. We fake a mouse click into the
 				// button by invoking the appropriate methods.
 				w->handleMouseDown(0, 0, 1, 1);
@@ -234,7 +234,7 @@
 	}
 
 	// ESC closes all dialogs by default
-	if (keycode == Common::KEYCODE_ESCAPE) {
+	if (state.keycode == Common::KEYCODE_ESCAPE) {
 		setResult(-1);
 		close();
 	}
@@ -242,10 +242,10 @@
 	// TODO: tab/shift-tab should focus the next/previous focusable widget
 }
 
-void Dialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
+void Dialog::handleKeyUp(Common::KeyState state) {
 	// Focused widget receives keyup events
 	if (_focusedWidget)
-		_focusedWidget->handleKeyUp(ascii, keycode, modifiers);
+		_focusedWidget->handleKeyUp(state);
 }
 
 void Dialog::handleMouseMoved(int x, int y, int button) {

Modified: scummvm/trunk/gui/dialog.h
===================================================================
--- scummvm/trunk/gui/dialog.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/dialog.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -77,8 +77,8 @@
 	virtual void handleMouseDown(int x, int y, int button, int clickCount);
 	virtual void handleMouseUp(int x, int y, int button, int clickCount);
 	virtual void handleMouseWheel(int x, int y, int direction);
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
-	virtual void handleKeyUp(uint16 ascii, int keycode, int modifiers);
+	virtual void handleKeyDown(Common::KeyState state);
+	virtual void handleKeyUp(Common::KeyState state);
 	virtual void handleMouseMoved(int x, int y, int button);
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 

Modified: scummvm/trunk/gui/editable.cpp
===================================================================
--- scummvm/trunk/gui/editable.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/editable.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -85,7 +85,7 @@
 	}
 }
 
-bool EditableWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
+bool EditableWidget::handleKeyDown(Common::KeyState state) {
 	bool handled = true;
 	bool dirty = false;
 	bool forcecaret = false;
@@ -94,7 +94,7 @@
 	if (_caretVisible)
 		drawCaret(true);
 
-	switch (keycode) {
+	switch (state.keycode) {
 	case Common::KEYCODE_RETURN:
 	case Common::KEYCODE_KP_ENTER:
 		// confirm edit and exit editmode
@@ -143,7 +143,7 @@
 		forcecaret = true;
 		break;
 	default:
-		if (tryInsertChar((byte)ascii, _caretPos)) {
+		if (tryInsertChar((byte)state.ascii, _caretPos)) {
 			_caretPos++;
 			dirty = true;
 			forcecaret = true;

Modified: scummvm/trunk/gui/editable.h
===================================================================
--- scummvm/trunk/gui/editable.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/editable.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -63,7 +63,7 @@
 	virtual const String &getEditString() const		{ return _editString; }
 
 	virtual void handleTickle();
-	virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers);
+	virtual bool handleKeyDown(Common::KeyState state);
 
 	virtual void reflowLayout();
 

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/launcher.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -789,13 +789,13 @@
 	}
 }
 
-void LauncherDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
-	Dialog::handleKeyDown(ascii, keycode, modifiers);
+void LauncherDialog::handleKeyDown(Common::KeyState state) {
+	Dialog::handleKeyDown(state);
 	updateButtons();
 }
 
-void LauncherDialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
-	Dialog::handleKeyUp(ascii, keycode, modifiers);
+void LauncherDialog::handleKeyUp(Common::KeyState state) {
+	Dialog::handleKeyUp(state);
 	updateButtons();
 }
 

Modified: scummvm/trunk/gui/launcher.h
===================================================================
--- scummvm/trunk/gui/launcher.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/launcher.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -47,8 +47,8 @@
 
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 
-	virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
-	virtual void handleKeyUp(uint16 ascii, int keycode, int modifiers);
+	virtual void handleKeyDown(Common::KeyState state);
+	virtual void handleKeyUp(Common::KeyState state);
 
 protected:
 	ListWidget		*_list;

Modified: scummvm/trunk/gui/newgui.cpp
===================================================================
--- scummvm/trunk/gui/newgui.cpp	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/newgui.cpp	2007-06-30 12:26:59 UTC (rev 27786)
@@ -272,10 +272,10 @@
 			
 			switch (event.type) {
 			case Common::EVENT_KEYDOWN:
-				activeDialog->handleKeyDown(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
+				activeDialog->handleKeyDown(event.kbd);
 				break;
 			case Common::EVENT_KEYUP:
-				activeDialog->handleKeyUp(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);
+				activeDialog->handleKeyUp(event.kbd);
 				break;
 			case Common::EVENT_MOUSEMOVE:
 				activeDialog->handleMouseMoved(mouse.x, mouse.y, 0);

Modified: scummvm/trunk/gui/widget.h
===================================================================
--- scummvm/trunk/gui/widget.h	2007-06-30 12:07:51 UTC (rev 27785)
+++ scummvm/trunk/gui/widget.h	2007-06-30 12:26:59 UTC (rev 27786)
@@ -27,6 +27,7 @@
 
 #include "common/scummsys.h"
 #include "common/str.h"
+#include "common/keyboard.h"
 #include "graphics/font.h"
 #include "graphics/surface.h"
 #include "gui/object.h"
@@ -127,8 +128,8 @@
 	virtual void handleMouseLeft(int button) {}
 	virtual void handleMouseMoved(int x, int y, int button) {}
 	virtual void handleMouseWheel(int x, int y, int direction) {}
-	virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers) { return false; }	// Return true if the event was handled
-	virtual bool handleKeyUp(uint16 ascii, int keycode, int modifiers) { return false; }	// Return true if the event was handled
+	virtual bool handleKeyDown(Common::KeyState state) { return false; }	// Return true if the event was handled
+	virtual bool handleKeyUp(Common::KeyState state) { return false; }	// Return true if the event was handled
 	virtual void handleTickle() {}
 
 	virtual void reflowLayout() { GuiObject::reflowLayout(); }


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