diff options
author | Eugene Sandulenko | 2017-08-07 22:17:26 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-08-08 11:25:55 +0200 |
commit | 0e2d14ac415faeec25226cef64b3443b0905eff9 (patch) | |
tree | ed8e392683cda5e5bb02279dcdc09beb7b15290a | |
parent | aef786fcc3b93670ce980f37d44fea48955d9d3a (diff) | |
download | scummvm-rg350-0e2d14ac415faeec25226cef64b3443b0905eff9.tar.gz scummvm-rg350-0e2d14ac415faeec25226cef64b3443b0905eff9.tar.bz2 scummvm-rg350-0e2d14ac415faeec25226cef64b3443b0905eff9.zip |
GRAPHICS: MACGUI: Initial code for Cutting/Paste multiline input texts
-rw-r--r-- | engines/wage/gui.cpp | 2 | ||||
-rw-r--r-- | graphics/macgui/mactext.cpp | 5 | ||||
-rw-r--r-- | graphics/macgui/mactext.h | 2 | ||||
-rw-r--r-- | graphics/macgui/mactextwindow.cpp | 7 | ||||
-rw-r--r-- | graphics/macgui/mactextwindow.h | 2 |
5 files changed, 10 insertions, 8 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 50b5694b91..fb46ec168f 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -391,7 +391,7 @@ void Gui::actionCut() { int startPos = s->startCol; int endPos = s->endCol; - if (startPos > endPos) + if (s->startRow > s->endRow || (s->startRow == s->endRow && startPos > endPos)) SWAP(startPos, endPos); Common::String input = _consoleWindow->getInput(); diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 9db5d459d7..8168962479 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -498,7 +498,7 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col) { } } -Common::String MacText::getTextChunk(int startRow, int startCol, int endRow, int endCol, bool formatted) { +Common::String MacText::getTextChunk(int startRow, int startCol, int endRow, int endCol, bool formatted, bool newlines) { Common::String res; startRow = CLIP(startRow, 0, (int)_textLines.size() - 1); @@ -567,7 +567,8 @@ Common::String MacText::getTextChunk(int startRow, int startCol, int endRow, int res += _textLines[i].chunks[chunk].text; } - res += '\n'; + if (newlines) + res += '\n'; } } diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h index eb567cf2a6..7cb115902e 100644 --- a/graphics/macgui/mactext.h +++ b/graphics/macgui/mactext.h @@ -116,7 +116,7 @@ public: void getRowCol(int x, int y, int *sx, int *sy, int *row, int *col); - Common::String getTextChunk(int startRow, int startCol, int endRow, int endCol, bool formatted = false); + Common::String getTextChunk(int startRow, int startCol, int endRow, int endCol, bool formatted = false, bool newlines = true); private: void splitString(Common::String &s); diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp index 5bbd956d5f..5f3d01e25f 100644 --- a/graphics/macgui/mactextwindow.cpp +++ b/graphics/macgui/mactextwindow.cpp @@ -216,7 +216,7 @@ void MacTextWindow::drawSelection() { } } -Common::String MacTextWindow::getSelection(bool formatted) { +Common::String MacTextWindow::getSelection(bool formatted, bool newlines) { if (_selectedText.endY == -1) return Common::String(""); @@ -227,7 +227,7 @@ Common::String MacTextWindow::getSelection(bool formatted) { SWAP(s.startCol, s.endCol); } - return _mactext->getTextChunk(s.startRow, s.startCol, s.endRow, s.endCol, formatted); + return _mactext->getTextChunk(s.startRow, s.startCol, s.endRow, s.endCol, formatted, newlines); } void MacTextWindow::clearSelection() { @@ -324,7 +324,8 @@ bool MacTextWindow::processEvent(Common::Event &event) { bool cutAllowed = false; - if (_selectedText.startRow == _selectedText.endRow && _selectedText.startRow == _mactext->getLineCount() - 1) + if (_selectedText.startRow >= _mactext->getLineCount() - _inputTextHeight && + _selectedText.endRow >= _mactext->getLineCount() - _inputTextHeight) cutAllowed = true; _menu->enableCommand("Edit", "Cut", cutAllowed); diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h index 50f908a05a..f2cf8bb639 100644 --- a/graphics/macgui/mactextwindow.h +++ b/graphics/macgui/mactextwindow.h @@ -69,7 +69,7 @@ public: void clearInput(); void appendInput(Common::String str); - Common::String getSelection(bool formatted = false); + Common::String getSelection(bool formatted = false, bool newlines = true); void clearSelection(); const SelectedText *getSelectedText() { return &_selectedText; } |