Skip to content

Commit

Permalink
WAGE: Started copy command implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Feb 14, 2016
1 parent a2e3d33 commit fe40bb2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
18 changes: 17 additions & 1 deletion engines/wage/gui.cpp
Expand Up @@ -707,8 +707,9 @@ Designed *Gui::mouseUp(int x, int y) {
(_selectionEndX == _selectionStartX && _selectionEndY == _selectionStartY)) {
_selectionStartY = _selectionEndY = -1;
_consoleFullRedraw = true;
_menu->enableCommand(kMenuEdit, kMenuActionCopy, false);
} else {

_menu->enableCommand(kMenuEdit, kMenuActionCopy, true);
}
}

Expand Down Expand Up @@ -794,4 +795,19 @@ void Gui::updateTextSelection(int x, int y) {
_consoleFullRedraw = true;
}

void Gui::actionCopy() {
if (_selectionStartX == -1)
return;

int startX = _selectionStartX;
int startY = _selectionStartY;
int endX = _selectionEndX;
int endY = _selectionEndY;

if (startY > endY) {
SWAP(startX, endX);
SWAP(endX, endY);
}
}

} // End of namespace Wage
4 changes: 4 additions & 0 deletions engines/wage/gui.h
Expand Up @@ -104,6 +104,8 @@ class Gui {
void pushArrowCursor();
void popCursor();

void actionCopy();

private:
void paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType);
void renderConsole(Graphics::Surface *g, Common::Rect &r);
Expand Down Expand Up @@ -155,6 +157,8 @@ class Gui {
int _selectionStartY;
int _selectionEndX;
int _selectionEndY;

Common::String _clipboard;
};

} // End of namespace Wage
Expand Down
3 changes: 3 additions & 0 deletions engines/wage/menu.cpp
Expand Up @@ -517,7 +517,10 @@ void Menu::executeCommand(MenuSubItem *subitem) {

case kMenuActionUndo:
case kMenuActionCut:
break;
case kMenuActionCopy:
_gui->actionCopy();
break;
case kMenuActionPaste:
case kMenuActionClear:
break;
Expand Down

0 comments on commit fe40bb2

Please sign in to comment.