diff options
Diffstat (limited to 'engines/wage/gui.cpp')
-rw-r--r-- | engines/wage/gui.cpp | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index afc61c4a27..2809656bec 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -230,93 +230,6 @@ static bool consoleWindowCallback(WindowClick click, Common::Event &event, void return gui->processConsoleEvents(click, event); } -bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) { - if (click == kBorderScrollUp || click == kBorderScrollDown) { - if (event.type == Common::EVENT_LBUTTONDOWN) { - int consoleHeight = _consoleWindow->getInnerDimensions().height(); - int textFullSize = _lines.size() * _consoleLineHeight + consoleHeight; - float scrollPos = (float)_scrollPos / textFullSize; - float scrollSize = (float)consoleHeight / textFullSize; - - _consoleWindow->setScroll(scrollPos, scrollSize); - - return true; - } else if (event.type == Common::EVENT_LBUTTONUP) { - int oldScrollPos = _scrollPos; - - switch (click) { - case kBorderScrollUp: - _scrollPos = MAX<int>(0, _scrollPos - _consoleLineHeight); - undrawCursor(); - _cursorY -= (_scrollPos - oldScrollPos); - _consoleDirty = true; - _consoleFullRedraw = true; - break; - case kBorderScrollDown: - _scrollPos = MIN<int>((_lines.size() - 2) * _consoleLineHeight, _scrollPos + _consoleLineHeight); - undrawCursor(); - _cursorY -= (_scrollPos - oldScrollPos); - _consoleDirty = true; - _consoleFullRedraw = true; - break; - default: - return false; - } - - return true; - } - - return false; - } - - if (click == kBorderResizeButton) { - _consoleDirty = true; - _consoleFullRedraw = true; - - return true; - } - - if (click == kBorderInner) { - if (event.type == Common::EVENT_LBUTTONDOWN) { - startMarking(event.mouse.x, event.mouse.y); - - return true; - } else if (event.type == Common::EVENT_LBUTTONUP) { - if (_inTextSelection) { - _inTextSelection = false; - - if (_selectionEndY == -1 || - (_selectionEndX == _selectionStartX && _selectionEndY == _selectionStartY)) { - _selectionStartY = _selectionEndY = -1; - _consoleFullRedraw = true; - _menu->enableCommand(kMenuEdit, kMenuActionCopy, false); - } else { - _menu->enableCommand(kMenuEdit, kMenuActionCopy, true); - - bool cutAllowed = false; - - if (_selectionStartY == _selectionEndY && _selectionStartY == (int)_lines.size() - 1) - cutAllowed = true; - - _menu->enableCommand(kMenuEdit, kMenuActionCut, cutAllowed); - _menu->enableCommand(kMenuEdit, kMenuActionClear, cutAllowed); - } - } - - return true; - } else if (event.type == Common::EVENT_MOUSEMOVE) { - if (_inTextSelection) { - updateTextSelection(event.mouse.x, event.mouse.y); - return true; - } - } - - return false; - } - - return false; -} - void Gui::regenCommandsMenu() { _menu->regenCommandsMenu(); } @@ -329,53 +242,4 @@ bool Gui::processEvent(Common::Event &event) { return _wm.processEvent(event); } -int Gui::calcTextX(int x, int textLine) { - const Graphics::Font *font = getConsoleFont(); - - if ((uint)textLine >= _lines.size()) - return 0; - - Common::String str = _lines[textLine]; - - x -= _consoleWindow->getInnerDimensions().left; - - for (int i = str.size(); i >= 0; i--) { - if (font->getStringWidth(str) < x) { - return i; - } - - str.deleteLastChar(); - } - - return 0; -} - -int Gui::calcTextY(int y) { - y -= _consoleWindow->getInnerDimensions().top; - - if (y < 0) - y = 0; - - const int firstLine = _scrollPos / _consoleLineHeight; - int textLine = (y - _scrollPos % _consoleLineHeight) / _consoleLineHeight + firstLine; - - return textLine; -} - -void Gui::startMarking(int x, int y) { - _selectionStartY = calcTextY(y); - _selectionStartX = calcTextX(x, _selectionStartY); - - _selectionEndY = -1; - - _inTextSelection = true; -} - -void Gui::updateTextSelection(int x, int y) { - _selectionEndY = calcTextY(y); - _selectionEndX = calcTextX(x, _selectionEndY); - - _consoleFullRedraw = true; -} - } // End of namespace Wage |