From ec4c846e8cde5ba578bd5385698efaf6d530a716 Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Thu, 19 Sep 2019 22:44:49 +0100 Subject: WAGE: Implement global clipboard support --- engines/wage/gui.cpp | 18 ++++++++++++------ engines/wage/gui.h | 1 - 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'engines/wage') diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 6075ee1b05..51c140fdb6 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -115,6 +115,10 @@ Gui::Gui(WageEngine *engine) { _menu->calcDimensions(); + if (g_system->hasTextInClipboard()) { + _menu->enableCommand(kMenuEdit, kMenuActionPaste, true); + } + _sceneWindow = _wm.addWindow(false, false, false); _sceneWindow->setCallback(sceneWindowCallback, this); @@ -347,22 +351,24 @@ void Gui::clearOutput() { } void Gui::actionCopy() { - _clipboard = _consoleWindow->getSelection(); + g_system->setTextInClipboard(_consoleWindow->getSelection()); _menu->enableCommand(kMenuEdit, kMenuActionPaste, true); } void Gui::actionPaste() { - _undobuffer = _engine->_inputText; + if (g_system->hasTextInClipboard()) { + _undobuffer = _engine->_inputText; - _consoleWindow->appendInput(_clipboard); + _consoleWindow->appendInput(g_system->getTextFromClipboard()); - _menu->enableCommand(kMenuEdit, kMenuActionUndo, true); + _menu->enableCommand(kMenuEdit, kMenuActionUndo, true); + } } void Gui::actionUndo() { _consoleWindow->clearInput(); - _consoleWindow->appendInput(_clipboard); + _consoleWindow->appendInput(_undobuffer); _menu->enableCommand(kMenuEdit, kMenuActionUndo, false); } @@ -386,7 +392,7 @@ void Gui::actionCut() { Common::String input = _consoleWindow->getInput(); - _clipboard = _consoleWindow->cutSelection(); + g_system->setTextInClipboard(_consoleWindow->cutSelection()); _undobuffer = input; diff --git a/engines/wage/gui.h b/engines/wage/gui.h index 446cb9d0a0..cb57392d03 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -168,7 +168,6 @@ private: Graphics::MacMenu *_menu; bool _sceneDirty; - Common::String _clipboard; Common::String _undobuffer; int _commandsMenuId; -- cgit v1.2.3