Ticket #8194: confirm.diff

File confirm.diff, 4.0 KB (added by Deledrius, 18 years ago)

Patch against 2003-04-05 CVS to add Exit Confirmation

Line 
1Index: dialogs.cpp
2===================================================================
3RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
4retrieving revision 1.40
5diff -r1.40 dialogs.cpp
6649a650,653
7> ConfirmExitDialog::ConfirmExitDialog(NewGui *gui, Scumm *scumm)
8> : InfoDialog(gui, scumm, "Are you sure you want to quit? (Y/N)") {
9> }
10>
11Index: dialogs.h
12===================================================================
13RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.h,v
14retrieving revision 1.17
15diff -r1.17 dialogs.h
16139a140,160
17> class ConfirmExitDialog : public InfoDialog {
18> public:
19> ConfirmExitDialog(NewGui *gui, Scumm *scumm);
20> virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers)
21> {
22> if (tolower(ascii) == 'n') { // Close exit dialog if n key is pressed
23> result = ascii;
24> close();
25> }
26> if (tolower(ascii) == 'y') { // Quit engine if y key is pressed
27> result = ascii;
28> close();
29> }
30> else
31> ScummDialog::handleKeyDown(ascii, keycode, modifiers);
32> }
33> int getResult() {return result;};
34> private:
35> int result;
36> };
37>
38Index: scumm.h
39===================================================================
40RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
41retrieving revision 1.160
42diff -r1.160 scumm.h
43356a357
44> Dialog *_confirmExitDialog;
45363a365
46> void confirmexitDialog();
47923a928
48> bool _confirm;
49Index: scummvm.cpp
50===================================================================
51RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
52retrieving revision 2.67
53diff -r2.67 scummvm.cpp
54192a193
55> _confirm = detector->_confirm;
561192a1194,1205
57> void Scumm::confirmexitDialog() {
58> if (!_confirmExitDialog)
59> _confirmExitDialog = new ConfirmExitDialog(_newgui, this);
60> runDialog(_confirmExitDialog);
61>
62> if (tolower(((ConfirmExitDialog*)_confirmExitDialog)->getResult()) == 'y')
63> {
64> shutDown(0);
65> _system->quit(); // TODO: Remove this when shutDown is implemented
66> }
67> }
68>
691557a1571,1577
70> else if (event.kbd.keycode == 'z')
71> {
72> if(_confirm)
73> confirmexitDialog();
74> else
75> _system->quit(); // TODO: change to shutDown() when implemented
76> }
771559a1580,1584
78> } else if (event.kbd.flags == OSystem::KBD_ALT && event.kbd.keycode == 'x') {
79> if(_confirm)
80> confirmexitDialog();
81> else
82> _system->quit(); // TODO: change to shutDown() when implemented
83Index: gameDetector.cpp
84===================================================================
85RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v
86retrieving revision 1.86
87diff -r1.86 gameDetector.cpp
8874a75
89> "\t-i - confirm exit before quitting (default: false)\n"
90150a153
91> _confirm = false;
92225a229,230
93> _confirm = g_config->getBool("confirm_exit", _confirm ? true : false);
94>
95327a333,337
96> case 'i':
97> CHECK_OPTION();
98> _confirm = (c == 'i');
99> g_config->setBool("confirm_exit", _confirm);
100> break;
101Index: gameDetector.h
102===================================================================
103RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.h,v
104retrieving revision 1.35
105diff -r1.35 gameDetector.h
106164a165
107> bool _confirm;
108Index: sdl/sdl-common.cpp
109===================================================================
110RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
111retrieving revision 1.42
112diff -r1.42 sdl-common.cpp
113523,524c523,529
114< if ((b == KBD_CTRL && ev.key.keysym.sym=='z') || (b == KBD_ALT && ev.key.keysym.sym=='x')) {
115< quit();
116---
117> if ((b == KBD_CTRL && ev.key.keysym.sym=='z') ||
118> (b == KBD_ALT && ev.key.keysym.sym=='x')) {
119> event->event_code = EVENT_KEYDOWN;
120> event->kbd.flags = b;
121> event->kbd.keycode = ev.key.keysym.sym;
122> return true;
123> //quit();
124531c536,540
125< quit();
126---
127> event->event_code = EVENT_KEYDOWN;
128> event->kbd.flags = KBD_ALT;
129> event->kbd.keycode = 'x';
130> return true;
131> //quit();