From 0739d5b595be9492c1e574192eba12174111e52c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 30 Oct 2015 09:16:32 +0100 Subject: also rename protocol -> proto --- protocol-mouse/CMakeLists.txt | 3 - protocol-mouse/ftnoir_mousecontrols.ui | 188 ------------------------ protocol-mouse/ftnoir_protocol_mouse.cpp | 54 ------- protocol-mouse/ftnoir_protocol_mouse.h | 59 -------- protocol-mouse/ftnoir_protocol_mouse_dialog.cpp | 24 --- protocol-mouse/images/mouse.png | Bin 1169 -> 0 bytes protocol-mouse/win32-mouse-protocol.qrc | 5 - 7 files changed, 333 deletions(-) delete mode 100644 protocol-mouse/CMakeLists.txt delete mode 100644 protocol-mouse/ftnoir_mousecontrols.ui delete mode 100644 protocol-mouse/ftnoir_protocol_mouse.cpp delete mode 100644 protocol-mouse/ftnoir_protocol_mouse.h delete mode 100644 protocol-mouse/ftnoir_protocol_mouse_dialog.cpp delete mode 100644 protocol-mouse/images/mouse.png delete mode 100644 protocol-mouse/win32-mouse-protocol.qrc (limited to 'protocol-mouse') diff --git a/protocol-mouse/CMakeLists.txt b/protocol-mouse/CMakeLists.txt deleted file mode 100644 index b221c79c..00000000 --- a/protocol-mouse/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -if(WIN32) - opentrack_boilerplate(opentrack-proto-win32-mouse) -endif() diff --git a/protocol-mouse/ftnoir_mousecontrols.ui b/protocol-mouse/ftnoir_mousecontrols.ui deleted file mode 100644 index b1f4bcf8..00000000 --- a/protocol-mouse/ftnoir_mousecontrols.ui +++ /dev/null @@ -1,188 +0,0 @@ - - - UICMOUSEControls - - - Qt::NonModal - - - - 0 - 0 - 280 - 106 - - - - Mouse protocol settings - - - - :/images/mouse.png:/images/mouse.png - - - Qt::LeftToRight - - - false - - - - - - - 0 - 0 - - - - Map mouse X to: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - - - 80 - 16777215 - - - - Select Number - - - QComboBox::InsertAlphabetically - - - - None - - - - - X - - - - - Y - - - - - Z - - - - - Yaw - - - - - Pitch - - - - - Roll - - - - - - - - - 80 - 16777215 - - - - Select Number - - - QComboBox::InsertAlphabetically - - - - None - - - - - X - - - - - Y - - - - - Z - - - - - Yaw - - - - - Pitch - - - - - Roll - - - - - - - - - 0 - 0 - - - - Map mouse Y to: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/protocol-mouse/ftnoir_protocol_mouse.cpp b/protocol-mouse/ftnoir_protocol_mouse.cpp deleted file mode 100644 index c0a0a868..00000000 --- a/protocol-mouse/ftnoir_protocol_mouse.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2015 Stanislaw Halik - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ -#include "ftnoir_protocol_mouse.h" -#include "opentrack/plugin-api.hpp" -#include - -#ifndef MOUSEEVENTF_MOVE_NOCOALESCE -# define MOUSEEVENTF_MOVE_NOCOALESCE 0x2000 -#endif - -void FTNoIR_Protocol::pose(const double *headpose ) { - RECT desktop; - const HWND hDesktop = GetDesktopWindow(); - if (hDesktop != NULL && GetWindowRect(hDesktop, &desktop)) { - // XXX TODO remove axis selector, use mapping window's - // axis selection. Mention in UI axis used. -sh 20140920 - int axis_x = s.Mouse_X; - int axis_y = s.Mouse_Y; - - int mouse_x = 0, mouse_y = 0; - - if (axis_x > 0 && axis_x <= 6) - mouse_x = headpose[axis_x-1] / (axis_x <= 3 ? 100 : 180) * 10 * desktop.right/2; - - if (axis_y > 0 && axis_y <= 6) - mouse_y = headpose[axis_y-1] / (axis_y <= 3 ? 100 : 180) * 10 * desktop.bottom/2; - - MOUSEINPUT mi; - mi.dx = mouse_x - last_x; - mi.dy = mouse_y - last_y; - mi.mouseData = 0; - mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE; - mi.time = 0; - mi.dwExtraInfo = 0; - INPUT input; - input.type = INPUT_MOUSE; - input.mi = mi; - (void) SendInput(1, &input, sizeof(INPUT)); - - last_x = mouse_x; - last_y = mouse_y; - } -} - -bool FTNoIR_Protocol::correct() -{ - return true; -} - -OPENTRACK_DECLARE_PROTOCOL(FTNoIR_Protocol, MOUSEControls, FTNoIR_ProtocolDll) diff --git a/protocol-mouse/ftnoir_protocol_mouse.h b/protocol-mouse/ftnoir_protocol_mouse.h deleted file mode 100644 index 595be393..00000000 --- a/protocol-mouse/ftnoir_protocol_mouse.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2015 Stanislaw Halik - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ - -#pragma once - -#include "ui_ftnoir_mousecontrols.h" -#include -#include "opentrack/plugin-api.hpp" -#include "opentrack/options.hpp" -using namespace options; - -struct settings : opts { - value Mouse_X, Mouse_Y; - settings() : - opts("mouse-proto"), - Mouse_X(b, "mouse-x", 0), - Mouse_Y(b, "mouse-y", 0) - {} -}; - -class FTNoIR_Protocol : public IProtocol -{ -public: - FTNoIR_Protocol() : last_x(0), last_y(0) {} - bool correct(); - void pose( const double *headpose); - QString game_name() { - return "Mouse tracker"; - } - int last_x, last_y; -private: - struct settings s; -}; - -class MOUSEControls: public IProtocolDialog -{ - Q_OBJECT -public: - MOUSEControls(); - void register_protocol(IProtocol *) {} - void unregister_protocol() {} -private: - Ui::UICMOUSEControls ui; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class FTNoIR_ProtocolDll : public Metadata -{ -public: - QString name() { return QString("mouse emulation"); } - QIcon icon() { return QIcon(":/images/mouse.png"); } -}; diff --git a/protocol-mouse/ftnoir_protocol_mouse_dialog.cpp b/protocol-mouse/ftnoir_protocol_mouse_dialog.cpp deleted file mode 100644 index bb5fe3b8..00000000 --- a/protocol-mouse/ftnoir_protocol_mouse_dialog.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "ftnoir_protocol_mouse.h" -#include "opentrack/plugin-api.hpp" - -MOUSEControls::MOUSEControls() -{ - ui.setupUi( this ); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - tie_setting(s.Mouse_X, ui.cbxSelectMouse_X); - tie_setting(s.Mouse_Y, ui.cbxSelectMouse_Y); -} - -void MOUSEControls::doOK() { - s.b->save(); - this->close(); -} - -void MOUSEControls::doCancel() { - s.b->reload(); - this->close(); -} - diff --git a/protocol-mouse/images/mouse.png b/protocol-mouse/images/mouse.png deleted file mode 100644 index c6f9ea26..00000000 Binary files a/protocol-mouse/images/mouse.png and /dev/null differ diff --git a/protocol-mouse/win32-mouse-protocol.qrc b/protocol-mouse/win32-mouse-protocol.qrc deleted file mode 100644 index ed6a71be..00000000 --- a/protocol-mouse/win32-mouse-protocol.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - images/mouse.png - - -- cgit v1.2.3