[Scummvm-cvs-logs] CVS: scummvm gui.cpp,1.51,1.52

Max Horn fingolfin at users.sourceforge.net
Tue Jul 2 12:57:23 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv28965

Modified Files:
	gui.cpp 
Log Message:
added comment that explains why return key seems to not work in save dialog; some code cleanup

Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- gui.cpp	30 Jun 2002 13:33:49 -0000	1.51
+++ gui.cpp	2 Jul 2002 19:52:16 -0000	1.52
@@ -716,26 +716,20 @@
 	int lastEdit = _editString;
 	showCaret(false);
 
-	if (_dialog == LAUNCHER_DIALOG) {
+	switch (_dialog) {
+	case LAUNCHER_DIALOG:
 		handleLauncherDialogCommand(cmd);
 		return;
-	}
-	if (_dialog == SOUND_DIALOG) {
+	case SOUND_DIALOG:
 		handleSoundDialogCommand(cmd);
 		return;
-	}
-
-	if (_dialog == OPTIONS_DIALOG) {
+	case OPTIONS_DIALOG:
 		handleOptionsDialogCommand(cmd);
 		return;
-	}
-
-	if (_dialog == KEYS_DIALOG) {
+	case KEYS_DIALOG:
 		handleKeysDialogCommand(cmd);
 		return;
-	}
-
-	if (_dialog == ABOUT_DIALOG) {
+	case ABOUT_DIALOG:
 		if (_return_to == LAUNCHER_DIALOG) {
 			_widgets[0] = launcher_dialog;
 			_active = true;
@@ -746,6 +740,8 @@
 			close();
 		return;
 	}
+	
+	// If we get here, it's the SAVELOAD_DIALOG
 
 	switch (cmd) {
 	case 1:											/* up button */
@@ -780,7 +776,7 @@
 		_cur_page = 0;
 		draw(0, 100);
 		return;
-	case 8:
+	case 8:											/* ok button (save game) */
 		if (lastEdit == -1 || game_names[lastEdit][0] == 0)
 			return;
 
@@ -902,10 +898,15 @@
 		if (_editString == -1)
 			return;
 
-		if (letter == 13) { 
+/*
+		FIXME - this code here has no effect at all, since Scumm::convertKeysToClicks()
+		swallows all return key events.
+		// Return pressed?
+		if (letter == '\n' || letter == '\r') { 
 			handleCommand(8);
 			return;
 		}
+*/
 
 		if (letter >= 32 && letter < 128 && _editLen < SAVEGAME_NAME_LEN - 1) {
 			game_names[_editString][_editLen++] = letter;
@@ -1026,16 +1027,16 @@
 {
 	_widgets[0] = save_load_dialog;
 	_editString = -1;
-	_cur_page = 0;
 	_active = true;
+	_cur_page = 0;
 	_dialog = SAVELOAD_DIALOG;
 }
 
 void Gui::pause()
 {
 	_widgets[0] = pause_dialog;
-	_cur_page = 0;
 	_active = true;
+	_cur_page = 0;
 	_dialog = PAUSE_DIALOG;
 }
 





More information about the Scummvm-git-logs mailing list