mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-02 07:28:32 +00:00
GRAPHICS: MACGUI: Initial code for Cutting/Paste multiline input texts
This commit is contained in:
parent
aef786fcc3
commit
0e2d14ac41
@ -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();
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user