From a0097a0e5390a99c604aa459b6913469530e0836 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 22 Mar 2015 16:32:21 +0100 Subject: [PATCH] Copying info about selected object to clipboard (#391) --- src/object/robotmain.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index f932e93d..36b9182a 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -26,6 +26,8 @@ #include "app/controller.h" #include "app/input.h" +#include "clipboard/clipboard.h" + #include "common/event.h" #include "common/global.h" #include "common/iman.h" @@ -888,6 +890,15 @@ bool CRobotMain::ProcessEvent(Event &event) { SetSpeed(4.0f); } + if (event.key.key == KEY(c) && ((event.kmodState & KEY_MOD(CTRL)) != 0) && m_engine->GetShowStats()) + { + std::ostringstream ss; + CObject* obj = GetSelect(); + if(obj != nullptr) { + ss << "CreateObject type=" << GetTypeObject(obj->GetType()) << " pos=" << std::fixed << std::setprecision(3) << obj->GetPosition(0).x/g_unit << ";" << obj->GetPosition(0).z/g_unit << " dir=" << (obj->GetAngleZ(0)/(Math::PI/180.0f)); + } + widgetSetClipboardText(ss.str().c_str()); + } break; case EVENT_KEY_UP: