diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/EventRecorder.cpp | 43 | ||||
-rw-r--r-- | gui/EventRecorder.h | 2 | ||||
-rw-r--r-- | gui/about.cpp | 4 | ||||
-rw-r--r-- | gui/chooser.cpp | 1 | ||||
-rw-r--r-- | gui/editrecorddialog.cpp | 2 | ||||
-rw-r--r-- | gui/onscreendialog.cpp | 36 | ||||
-rw-r--r-- | gui/onscreendialog.h | 10 | ||||
-rw-r--r-- | gui/recorderdialog.cpp | 13 | ||||
-rw-r--r-- | gui/saveload-dialog.cpp | 2 |
9 files changed, 70 insertions, 43 deletions
diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index d8cb0b8830..fd0093d266 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -77,6 +77,19 @@ EventRecorder::EventRecorder() { _initialized = false; _needRedraw = false; _fastPlayback = false; + + _fakeTimer = 0; + _savedState = false; + _needcontinueGame = false; + _temporarySlot = 0; + _realSaveManager = 0; + _realMixerManager = 0; + _controlPanel = 0; + _lastMillis = 0; + _lastScreenshotTime = 0; + _screenshotPeriod = 0; + _playbackFile = 0; + DebugMan.addDebugChannel(kDebugLevelEventRec, "EventRec", "Event recorder debug level"); } @@ -96,8 +109,8 @@ void EventRecorder::deinit() { _recordMode = kPassthrough; delete _fakeMixerManager; _fakeMixerManager = NULL; - controlPanel->close(); - delete controlPanel; + _controlPanel->close(); + delete _controlPanel; debugC(1, kDebugLevelEventRec, "playback:action=stopplayback"); g_system->getEventManager()->getEventDispatcher()->unregisterSource(this); _recordMode = kPassthrough; @@ -127,7 +140,7 @@ void EventRecorder::processMillis(uint32 &millis, bool skipRecord) { millisDelay = millis - _lastMillis; _lastMillis = millis; _fakeTimer += millisDelay; - controlPanel->setReplayedTime(_fakeTimer); + _controlPanel->setReplayedTime(_fakeTimer); timerEvent.recordedtype = Common::kRecorderEventTypeTimer; timerEvent.time = _fakeTimer; _playbackFile->writeEvent(timerEvent); @@ -150,7 +163,7 @@ void EventRecorder::processMillis(uint32 &millis, bool skipRecord) { } } millis = _fakeTimer; - controlPanel->setReplayedTime(_fakeTimer); + _controlPanel->setReplayedTime(_fakeTimer); break; case kRecorderPlaybackPause: millis = _fakeTimer; @@ -173,7 +186,7 @@ void EventRecorder::checkForKeyCode(const Common::Event &event) { bool EventRecorder::pollEvent(Common::Event &ev) { if ((_recordMode != kRecorderPlayback) || !_initialized) return false; - + if ((_nextEvent.recordedtype == Common::kRecorderEventTypeTimer) || (_nextEvent.type == Common::EVENT_INVALID)) { return false; } @@ -209,12 +222,12 @@ void EventRecorder::togglePause() { case kRecorderRecord: oldState = _recordMode; _recordMode = kRecorderPlaybackPause; - controlPanel->runModal(); + _controlPanel->runModal(); _recordMode = oldState; _initialized = true; break; case kRecorderPlaybackPause: - controlPanel->close(); + _controlPanel->close(); break; default: break; @@ -277,7 +290,7 @@ void EventRecorder::init(Common::String recordFileName, RecordMode mode) { return; } if (_recordMode != kPassthrough) { - controlPanel = new GUI::OnScreenDialog(_recordMode == kRecorderRecord); + _controlPanel = new GUI::OnScreenDialog(_recordMode == kRecorderRecord); } if (_recordMode == kRecorderPlayback) { applyPlaybackSettings(); @@ -318,7 +331,7 @@ bool EventRecorder::openRecordFile(const Common::String &fileName) { } bool EventRecorder::checkGameHash(const ADGameDescription *gameDesc) { - if ((gameDesc == NULL) && (_playbackFile->getHeader().hashRecords.size() != 0)) { + if (_playbackFile->getHeader().hashRecords.size() != 0) { warning("Engine doesn't contain description table"); return false; } @@ -439,8 +452,8 @@ Common::List<Common::Event> EventRecorder::mapEvent(const Common::Event &ev, Com return Common::DefaultEventMapper::mapEvent(ev, source); break; case kRecorderRecord: - g_gui.processEvent(evt, controlPanel); - if (((evt.type == Common::EVENT_LBUTTONDOWN) || (evt.type == Common::EVENT_LBUTTONUP) || (evt.type == Common::EVENT_MOUSEMOVE)) && controlPanel->isMouseOver()) { + g_gui.processEvent(evt, _controlPanel); + if (((evt.type == Common::EVENT_LBUTTONDOWN) || (evt.type == Common::EVENT_LBUTTONUP) || (evt.type == Common::EVENT_MOUSEMOVE)) && _controlPanel->isMouseOver()) { return Common::List<Common::Event>(); } else { Common::RecorderEvent e; @@ -453,13 +466,13 @@ Common::List<Common::Event> EventRecorder::mapEvent(const Common::Event &ev, Com break; case kRecorderPlaybackPause: { Common::Event dialogEvent; - if (controlPanel->isEditDlgVisible()) { + if (_controlPanel->isEditDlgVisible()) { dialogEvent = ev; } else { dialogEvent = evt; } - g_gui.processEvent(dialogEvent, controlPanel->getActiveDlg()); - if (((dialogEvent.type == Common::EVENT_LBUTTONDOWN) || (dialogEvent.type == Common::EVENT_LBUTTONUP) || (dialogEvent.type == Common::EVENT_MOUSEMOVE)) && controlPanel->isMouseOver()) { + g_gui.processEvent(dialogEvent, _controlPanel->getActiveDlg()); + if (((dialogEvent.type == Common::EVENT_LBUTTONDOWN) || (dialogEvent.type == Common::EVENT_LBUTTONUP) || (dialogEvent.type == Common::EVENT_MOUSEMOVE)) && _controlPanel->isMouseOver()) { return Common::List<Common::Event>(); } return Common::DefaultEventMapper::mapEvent(dialogEvent, source); @@ -549,7 +562,7 @@ void EventRecorder::preDrawOverlayGui() { g_system->showOverlay(); g_gui.theme()->clearAll(); g_gui.theme()->openDialog(true, GUI::ThemeEngine::kShadingNone); - controlPanel->drawDialog(); + _controlPanel->drawDialog(); g_gui.theme()->finishBuffering(); g_gui.theme()->updateScreen(); _recordMode = oldMode; diff --git a/gui/EventRecorder.h b/gui/EventRecorder.h index 4abefc05f5..68ffe16fbc 100644 --- a/gui/EventRecorder.h +++ b/gui/EventRecorder.h @@ -193,7 +193,7 @@ private: DefaultTimerManager *_timerManager; RecorderSaveFileManager _fakeSaveManager; NullSdlMixerManager *_fakeMixerManager; - GUI::OnScreenDialog *controlPanel; + GUI::OnScreenDialog *_controlPanel; Common::RecorderEvent _nextEvent; void setFileHeader(); diff --git a/gui/about.cpp b/gui/about.cpp index 088971f273..20145886c6 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -46,7 +46,7 @@ enum { // 0 - 2 -- set a custom color: // 0 normal text // 1 highlighted text -// 2 disabled text +// 2 disabled text // TODO: Maybe add a tab/indent feature; that is, make it possible to specify // an amount by which that line shall be indented (the indent of course would have // to be considered while performing any word wrapping, too). @@ -139,7 +139,7 @@ void AboutDialog::addLine(const char *str) { } else { Common::String format(str, 2); str += 2; - + static Common::String asciiStr; if (format[0] == 'A') { bool useAscii = false; diff --git a/gui/chooser.cpp b/gui/chooser.cpp index 6ae08161df..c195e94c9b 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -67,6 +67,7 @@ void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data break; case kCloseCmd: setResult(-1); + // Fall through default: Dialog::handleCommand(sender, cmd, data); } diff --git a/gui/editrecorddialog.cpp b/gui/editrecorddialog.cpp index a6a7a2560e..cfcc747121 100644 --- a/gui/editrecorddialog.cpp +++ b/gui/editrecorddialog.cpp @@ -37,7 +37,7 @@ void EditRecordDialog::setAuthor(const Common::String &author) { const Common::String EditRecordDialog::getNotes() { return _notesEdit->getEditString(); -} +} void EditRecordDialog::setNotes(const Common::String &desc) { _notesEdit->setEditString(desc); diff --git a/gui/onscreendialog.cpp b/gui/onscreendialog.cpp index efe8038e68..03a6f26ec0 100644 --- a/gui/onscreendialog.cpp +++ b/gui/onscreendialog.cpp @@ -97,26 +97,28 @@ OnScreenDialog::OnScreenDialog(bool isRecord) : Dialog("OnScreenDialog") { } else #endif { - GUI::ButtonWidget *btn; if (g_system->getOverlayWidth() > 320) - btn = new ButtonWidget(this, "OnScreenDialog.StopButton", "[ ]", _("Stop"), kStopCmd); + new ButtonWidget(this, "OnScreenDialog.StopButton", "[ ]", _("Stop"), kStopCmd); else - btn = new ButtonWidget(this, "OnScreenDialog.StopButton", "[]", _("Stop"), kStopCmd); + new ButtonWidget(this, "OnScreenDialog.StopButton", "[]", _("Stop"), kStopCmd); if (isRecord) { - btn = new ButtonWidget(this, "OnScreenDialog.EditButton", "E", _("Edit record description"), kEditCmd); + new ButtonWidget(this, "OnScreenDialog.EditButton", "E", _("Edit record description"), kEditCmd); } else { - btn = new ButtonWidget(this, "OnScreenDialog.SwitchModeButton", "G", _("Switch to Game"), kSwitchModeCmd); + new ButtonWidget(this, "OnScreenDialog.SwitchModeButton", "G", _("Switch to Game"), kSwitchModeCmd); - btn = new ButtonWidget(this, "OnScreenDialog.FastReplayButton", ">>", _("Fast replay"), kFastModeCmd); + new ButtonWidget(this, "OnScreenDialog.FastReplayButton", ">>", _("Fast replay"), kFastModeCmd); } } - text = new GUI::StaticTextWidget(this, "OnScreenDialog.TimeLabel", "00:00:00"); + _text = new GUI::StaticTextWidget(this, "OnScreenDialog.TimeLabel", "00:00:00"); _enableDrag = false; _mouseOver = false; _editDlgShown = false; + + _lastTime = 0; + _dlg = 0; } void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { @@ -128,20 +130,20 @@ void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat close(); break; case kEditCmd: - dlg = new EditRecordDialog(g_eventRec.getAuthor(), g_eventRec.getName(), g_eventRec.getNotes()); + _dlg = new EditRecordDialog(g_eventRec.getAuthor(), g_eventRec.getName(), g_eventRec.getNotes()); CursorMan.lock(false); g_eventRec.setRedraw(false); g_system->showOverlay(); _editDlgShown = true; - dlg->runModal(); + _dlg->runModal(); _editDlgShown = false; g_system->hideOverlay(); g_eventRec.setRedraw(true); CursorMan.lock(true); - g_eventRec.setAuthor(((EditRecordDialog *)dlg)->getAuthor()); - g_eventRec.setName(((EditRecordDialog *)dlg)->getName()); - g_eventRec.setNotes(((EditRecordDialog *)dlg)->getNotes()); - delete dlg; + g_eventRec.setAuthor(((EditRecordDialog *)_dlg)->getAuthor()); + g_eventRec.setName(((EditRecordDialog *)_dlg)->getName()); + g_eventRec.setNotes(((EditRecordDialog *)_dlg)->getNotes()); + delete _dlg; break; case kSwitchModeCmd: if (g_eventRec.switchMode()) { @@ -155,10 +157,10 @@ void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } void OnScreenDialog::setReplayedTime(uint32 newTime) { - if (newTime - lastTime > 1000) { + if (newTime - _lastTime > 1000) { uint32 seconds = newTime / 1000; - text->setLabel(Common::String::format("%.2d:%.2d:%.2d", seconds / 3600 % 24, seconds / 60 % 60, seconds % 60)); - lastTime = newTime; + _text->setLabel(Common::String::format("%.2d:%.2d:%.2d", seconds / 3600 % 24, seconds / 60 % 60, seconds % 60)); + _lastTime = newTime; } } @@ -218,7 +220,7 @@ void OnScreenDialog::close() { Dialog *OnScreenDialog::getActiveDlg() { if (_editDlgShown) { - return dlg; + return _dlg; } else { return this; } diff --git a/gui/onscreendialog.h b/gui/onscreendialog.h index 4f3839acb6..2fae14cbc6 100644 --- a/gui/onscreendialog.h +++ b/gui/onscreendialog.h @@ -30,14 +30,16 @@ namespace GUI { class OnScreenDialog : public Dialog { private: - uint32 lastTime; + uint32 _lastTime; bool _enableDrag; bool _mouseOver; bool _editDlgShown; Common::Point _dragPoint; - GUI::StaticTextWidget *text; - Dialog *dlg; + GUI::StaticTextWidget *_text; + Dialog *_dlg; + bool isMouseOver(int x, int y); + public: OnScreenDialog(bool recordingMode); ~OnScreenDialog(); @@ -56,7 +58,7 @@ public: bool isEditDlgVisible(); Dialog *getActiveDlg(); protected: - virtual void releaseFocus(); + virtual void releaseFocus(); }; } // End of namespace GUI diff --git a/gui/recorderdialog.cpp b/gui/recorderdialog.cpp index 55f342d4a1..1a11dbac65 100644 --- a/gui/recorderdialog.cpp +++ b/gui/recorderdialog.cpp @@ -52,6 +52,12 @@ enum { }; RecorderDialog::RecorderDialog() : Dialog("RecorderDialog"), _list(0), _currentScreenshot(0) { + _firstScreenshotUpdate = false; + _screenShotsCount = 0; + _currentScreenshotText = 0; + _authorText = 0; + _notesText = 0; + _backgroundType = ThemeEngine::kDialogBackgroundSpecial; new StaticTextWidget(this, "SaveLoadChooser.Title", _("Recorder or Playback Gameplay")); @@ -63,7 +69,7 @@ RecorderDialog::RecorderDialog() : Dialog("RecorderDialog"), _list(0), _currentS new GUI::ButtonWidget(this, "RecorderDialog.Cancel", _("Cancel"), 0, kCloseCmd); new GUI::ButtonWidget(this, "RecorderDialog.Record", _("Record"), 0, kRecordCmd); _playbackButton = new GUI::ButtonWidget(this, "RecorderDialog.Playback", _("Playback"), 0, kPlaybackCmd); - + _editButton = new GUI::ButtonWidget(this, "RecorderDialog.Edit", _("Edit"), 0, kEditRecordCmd); _editButton->setEnabled(false); @@ -74,7 +80,7 @@ RecorderDialog::RecorderDialog() : Dialog("RecorderDialog"), _list(0), _currentS _container = new GUI::ContainerWidget(this, 0, 0, 10, 10); if (g_gui.xmlEval()->getVar("Globals.RecorderDialog.ExtInfo.Visible") == 1) { new GUI::ButtonWidget(this,"RecorderDialog.NextScreenShotButton", "<", 0, kPrevScreenshotCmd); - new GUI::ButtonWidget(this, "RecorderDialog.PreviousScreenShotButton", ">", 0, kNextScreenshotCmd); + new GUI::ButtonWidget(this, "RecorderDialog.PreviousScreenShotButton", ">", 0, kNextScreenshotCmd); _currentScreenshotText = new StaticTextWidget(this, "RecorderDialog.currentScreenshot", "0/0"); _authorText = new StaticTextWidget(this, "RecorderDialog.Author", _("Author: ")); _notesText = new StaticTextWidget(this, "RecorderDialog.Notes", _("Notes: ")); @@ -185,10 +191,11 @@ void RecorderDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat break; case kCloseCmd: setResult(kRecordDialogClose); + // Fall through default: Dialog::handleCommand(sender, cmd, data); - } } +} void RecorderDialog::updateList() { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index c7dd62b6c6..585117fba4 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -286,6 +286,7 @@ void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uin break; case kCloseCmd: setResult(-1); + // Fall through default: SaveLoadChooserDialog::handleCommand(sender, cmd, data); } @@ -595,6 +596,7 @@ void SaveLoadChooserGrid::handleCommand(CommandSender *sender, uint32 cmd, uint3 case kCloseCmd: setResult(-1); + // Fall through default: SaveLoadChooserDialog::handleCommand(sender, cmd, data); } |