Commit 1b9cbf6f by liulongfei

3D鼠标优化

parent 76940085
......@@ -132,6 +132,15 @@ namespace VIZ.Framework.Common
SolidColorBrush brush = new SolidColorBrush(context.Target, info.DrawingBorderColor);
context.Target.DrawRectangle(drawRect, brush, info.DrawingBorderWidth);
// 中心轴
if (!info.IsCenterAxisEnabled)
return;
SolidColorBrush centerAxisBrush = new SolidColorBrush(context.Target, info.CenterAxisColor);
RawVector2 centerAxisPoint0 = new RawVector2(drawRect.Left + (drawRect.Right - drawRect.Left) / 2, drawRect.Top);
RawVector2 centerAxisPoint1 = new RawVector2(drawRect.Left + (drawRect.Right - drawRect.Left) / 2, drawRect.Bottom);
context.Target.DrawLine(centerAxisPoint0, centerAxisPoint1, centerAxisBrush, info.CenterAxisWidth);
}
}
}
......@@ -33,6 +33,21 @@ namespace VIZ.Framework.Common
public RawColor4 MaskColor { get; set; }
/// <summary>
/// 中心轴颜色
/// </summary>
public RawColor4 CenterAxisColor { get; set; }
/// <summary>
/// 中心轴宽度
/// </summary>
public float CenterAxisWidth { get; set; }
/// <summary>
/// 是否启用中心轴
/// </summary>
public bool IsCenterAxisEnabled { get; set; }
/// <summary>
/// 时码
/// </summary>
public long TimeCode { get; set; }
......
......@@ -12,6 +12,11 @@ namespace VIZ.Framework.Connection
public abstract class ConnInfoBase
{
/// <summary>
/// 本地ID
/// </summary>
public long Local_ID { get; set; }
/// <summary>
/// 本地IP
/// </summary>
public string LocalIP { get; internal set; }
......
/* SiCfg.h -- Configuration Saving Functions Header File
/* SiCfg.h -- Configuration Saving Functions Header File
*
* These functions are used to save and retrieve application configuration info
* in the registry.
*
* Strings are TCHARs. The defaut library is built with WCHARs. Src code is provided
* to rebuild it with ANSI chars if your application uses chars.
*
* Anything can be saved because everything is a string.
*
* We suggest that the following conventions be used:
*
* appName is the name of the application (e.g., "GUISync_SDK")
* modeName is the name of the application mode (e.g., "Sketch")
* configName is the name the user gives to the specific configuration, or a default,
* (e.g., "Electrical",
* "Mechanical 1",
* "Steve 1",
* "Small Assembly Work")
* settingName can optionally indicate the 3Dconnexion device # and the parameter name:
* (e.g., "29_Button 4" is SpacePilot button number 4,
* "Button 4" is a device independent button 4)
* settingValue should indicate the command source and a value that is assigned to this button (or whatever):
* (e.g., "D_23" means Driver function 23,
* "D_-3" means Driver macro 3,
* A_1005 means Application function 1005
* )
*/
SpwReturnValue SiCfgSaveSetting( const TCHAR *appName, const TCHAR *modeName, const TCHAR *configName, const TCHAR *settingName, const TCHAR *settingValue );
SpwReturnValue SiCfgGetSetting( const TCHAR *appName, const TCHAR *modeName, const TCHAR *configName, const TCHAR *settingName, TCHAR *settingValue, SPWuint32 *pmaxValueLen );
SpwReturnValue SiCfgGetModes( const TCHAR *appName, TCHAR *modeName, SPWuint32 *pmaxNameLen );
SpwReturnValue SiCfgGetModesNext( const TCHAR *appName, TCHAR *modeName, SPWuint32 *pmaxNameLen );
SpwReturnValue SiCfgGetNames( const TCHAR *appName, const TCHAR *modeName, TCHAR *configName, SPWuint32 *pmaxNameLen );
SpwReturnValue SiCfgGetNamesNext( const TCHAR *appName, const TCHAR *modeName, TCHAR *configName, SPWuint32 *pmaxNameLen );
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
* V3DCMD.h -- Virtual 3D Commands
*
* enums for all current V3DCMDs
* These are functions that all applications should respond to if they are
* at all applicable. These cmds are generated from any number of places
* including hard and soft buttons. They don't necessarily represent a
* hardware button
*
* Written: January 2013
* Original author: Jim Wick
*
*----------------------------------------------------------------------
*
* Copyright (c) 2013-2015 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*/
#ifndef _V3DCMD_H_
#define _V3DCMD_H_
static char v3DCMDCvsId[]="(C) 2013-2015 3Dconnexion: $Id: V3DCMD.h 11750 2015-09-08 13:58:59Z jwick $";
/*
* Constants
*/
/*
* Virtual 3D Commands
*
* These function numbers will never change, but the list will be amended as more
* V3DCMDs are created.
* For use with SI_CMD_EVENT.
* Most of these don't have a separate press and release of these events.
* Some keys do have press and release (Esc, Shift, Ctrl) as expected of keyboard keys.
*/
typedef enum
{
V3DCMD_NOOP = 0,
V3DCMD_MENU_OPTIONS = 1,
V3DCMD_VIEW_FIT = 2,
V3DCMD_VIEW_TOP = 3,
V3DCMD_VIEW_LEFT = 4,
V3DCMD_VIEW_RIGHT = 5,
V3DCMD_VIEW_FRONT = 6,
V3DCMD_VIEW_BOTTOM = 7,
V3DCMD_VIEW_BACK = 8,
V3DCMD_VIEW_ROLLCW = 9,
V3DCMD_VIEW_ROLLCCW = 10,
V3DCMD_VIEW_ISO1 = 11,
V3DCMD_VIEW_ISO2 = 12,
V3DCMD_KEY_F1 = 13,
V3DCMD_KEY_F2 = 14,
V3DCMD_KEY_F3 = 15,
V3DCMD_KEY_F4 = 16,
V3DCMD_KEY_F5 = 17,
V3DCMD_KEY_F6 = 18,
V3DCMD_KEY_F7 = 19,
V3DCMD_KEY_F8 = 20,
V3DCMD_KEY_F9 = 21,
V3DCMD_KEY_F10 = 22,
V3DCMD_KEY_F11 = 23,
V3DCMD_KEY_F12 = 24,
V3DCMD_KEY_ESC = 25,
V3DCMD_KEY_ALT = 26,
V3DCMD_KEY_SHIFT = 27,
V3DCMD_KEY_CTRL = 28,
V3DCMD_FILTER_ROTATE = 29,
V3DCMD_FILTER_PANZOOM= 30,
V3DCMD_FILTER_DOMINANT=31,
V3DCMD_SCALE_PLUS = 32,
V3DCMD_SCALE_MINUS = 33,
V3DCMD_VIEW_SPINCW = 34,
V3DCMD_VIEW_SPINCCW = 35,
V3DCMD_VIEW_TILTCW = 36,
V3DCMD_VIEW_TILTCCW = 37,
V3DCMD_MENU_POPUP = 38,
V3DCMD_MENU_BUTTONMAPPINGEDITOR = 39,
V3DCMD_MENU_ADVANCEDSETTINGSEDITOR = 40,
V3DCMD_MOTIONMACRO_ZOOM = 41,
V3DCMD_MOTIONMACRO_ZOOMOUT_CURSORTOCENTER = 42,
V3DCMD_MOTIONMACRO_ZOOMIN_CURSORTOCENTER = 43,
V3DCMD_MOTIONMACRO_ZOOMOUT_CENTERTOCENTER = 44,
V3DCMD_MOTIONMACRO_ZOOMIN_CENTERTOCENTER = 45,
V3DCMD_MOTIONMACRO_ZOOMOUT_CURSORTOCURSOR = 46,
V3DCMD_MOTIONMACRO_ZOOMIN_CURSORTOCURSOR = 47,
V3DCMD_VIEW_QZ_IN = 48,
V3DCMD_VIEW_QZ_OUT = 49,
V3DCMD_KEY_ENTER = 50,
V3DCMD_KEY_DELETE = 51,
V3DCMD_KEY_F13 = 52,
V3DCMD_KEY_F14 = 53,
V3DCMD_KEY_F15 = 54,
V3DCMD_KEY_F16 = 55,
V3DCMD_KEY_F17 = 56,
V3DCMD_KEY_F18 = 57,
V3DCMD_KEY_F19 = 58,
V3DCMD_KEY_F20 = 59,
V3DCMD_KEY_F21 = 60,
V3DCMD_KEY_F22 = 61,
V3DCMD_KEY_F23 = 62,
V3DCMD_KEY_F24 = 63,
V3DCMD_KEY_F25 = 64,
V3DCMD_KEY_F26 = 65,
V3DCMD_KEY_F27 = 66,
V3DCMD_KEY_F28 = 67,
V3DCMD_KEY_F29 = 68,
V3DCMD_KEY_F30 = 69,
V3DCMD_KEY_F31 = 70,
V3DCMD_KEY_F32 = 71,
V3DCMD_KEY_F33 = 72,
V3DCMD_KEY_F34 = 73,
V3DCMD_KEY_F35 = 74,
V3DCMD_KEY_F36 = 75,
V3DCMD_VIEW_1 = 76,
V3DCMD_VIEW_2 = 77,
V3DCMD_VIEW_3 = 78,
V3DCMD_VIEW_4 = 79,
V3DCMD_VIEW_5 = 80,
V3DCMD_VIEW_6 = 81,
V3DCMD_VIEW_7 = 82,
V3DCMD_VIEW_8 = 83,
V3DCMD_VIEW_9 = 84,
V3DCMD_VIEW_10 = 85,
V3DCMD_VIEW_11 = 86,
V3DCMD_VIEW_12 = 87,
V3DCMD_VIEW_13 = 88,
V3DCMD_VIEW_14 = 89,
V3DCMD_VIEW_15 = 90,
V3DCMD_VIEW_16 = 91,
V3DCMD_VIEW_17 = 92,
V3DCMD_VIEW_18 = 93,
V3DCMD_VIEW_19 = 94,
V3DCMD_VIEW_20 = 95,
V3DCMD_VIEW_21 = 96,
V3DCMD_VIEW_22 = 97,
V3DCMD_VIEW_23 = 98,
V3DCMD_VIEW_24 = 99,
V3DCMD_VIEW_25 = 100,
V3DCMD_VIEW_26 = 101,
V3DCMD_VIEW_27 = 102,
V3DCMD_VIEW_28 = 103,
V3DCMD_VIEW_29 = 104,
V3DCMD_VIEW_30 = 105,
V3DCMD_VIEW_31 = 106,
V3DCMD_VIEW_32 = 107,
V3DCMD_VIEW_33 = 108,
V3DCMD_VIEW_34 = 109,
V3DCMD_VIEW_35 = 110,
V3DCMD_VIEW_36 = 111,
V3DCMD_SAVE_VIEW_1 = 112,
V3DCMD_SAVE_VIEW_2 = 113,
V3DCMD_SAVE_VIEW_3 = 114,
V3DCMD_SAVE_VIEW_4 = 115,
V3DCMD_SAVE_VIEW_5 = 116,
V3DCMD_SAVE_VIEW_6 = 117,
V3DCMD_SAVE_VIEW_7 = 118,
V3DCMD_SAVE_VIEW_8 = 119,
V3DCMD_SAVE_VIEW_9 = 120,
V3DCMD_SAVE_VIEW_10 = 121,
V3DCMD_SAVE_VIEW_11 = 122,
V3DCMD_SAVE_VIEW_12 = 123,
V3DCMD_SAVE_VIEW_13 = 124,
V3DCMD_SAVE_VIEW_14 = 125,
V3DCMD_SAVE_VIEW_15 = 126,
V3DCMD_SAVE_VIEW_16 = 127,
V3DCMD_SAVE_VIEW_17 = 128,
V3DCMD_SAVE_VIEW_18 = 129,
V3DCMD_SAVE_VIEW_19 = 130,
V3DCMD_SAVE_VIEW_20 = 131,
V3DCMD_SAVE_VIEW_21 = 132,
V3DCMD_SAVE_VIEW_22 = 133,
V3DCMD_SAVE_VIEW_23 = 134,
V3DCMD_SAVE_VIEW_24 = 135,
V3DCMD_SAVE_VIEW_25 = 136,
V3DCMD_SAVE_VIEW_26 = 137,
V3DCMD_SAVE_VIEW_27 = 138,
V3DCMD_SAVE_VIEW_28 = 139,
V3DCMD_SAVE_VIEW_29 = 140,
V3DCMD_SAVE_VIEW_30 = 141,
V3DCMD_SAVE_VIEW_31 = 142,
V3DCMD_SAVE_VIEW_32 = 143,
V3DCMD_SAVE_VIEW_33 = 144,
V3DCMD_SAVE_VIEW_34 = 145,
V3DCMD_SAVE_VIEW_35 = 146,
V3DCMD_SAVE_VIEW_36 = 147,
V3DCMD_KEY_TAB = 148,
V3DCMD_KEY_SPACE = 149,
V3DCMD_MENU_1 = 150,
V3DCMD_MENU_2 = 151,
V3DCMD_MENU_3 = 152,
V3DCMD_MENU_4 = 153,
V3DCMD_MENU_5 = 154,
V3DCMD_MENU_6 = 155,
V3DCMD_MENU_7 = 156,
V3DCMD_MENU_8 = 157,
V3DCMD_MENU_9 = 158,
V3DCMD_MENU_10 = 159,
V3DCMD_MENU_11 = 160,
V3DCMD_MENU_12 = 161,
V3DCMD_MENU_13 = 162,
V3DCMD_MENU_14 = 163,
V3DCMD_MENU_15 = 164,
V3DCMD_MENU_16 = 165,
/* Add here as needed. Don't change any values that may be in use */
} V3DCMD;
#endif /* _V3DCMD_H_ */
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
* V3DKey.h -- Virtual 3D Keys
*
* enums for all current V3DKeys
*
* Written: January 2013
* Original author: Jim Wick
*
*----------------------------------------------------------------------
*
* Copyright notice:
* Copyright (c) 2013-2015 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*/
#ifndef _V3DKey_H_
#define _V3DKey_H_
static char v3DKeyCvsId[]="(C) 2013-2015 3Dconnexion: $Id: V3DKey.h 11750 2015-09-08 13:58:59Z jwick $";
/*
* Virtual 3D Keys
*
* Functions that refer to hardware keys use these constants to identify the keys.
* These represent hardware buttons on devices that have them.
* If a hardware device doesn't have a key, it won't produce the event.
* Not all hardware devices have all keys but any key that does exist is
* in this enum. If new hardware keys are added in the future, a new constant will
* be created for it.
*
* SI_BUTTON_PRESS_EVENT and SI_BUTTON_RELEASE_EVENT events identify the hardware
* keys that generated the events through V3DKeys (Virtual 3D Mouse Keys).
* These will represent the actual hardware key pressed unless the user did
* something clever in his xml file.
*/
/* This enum is replicated in virtualkeys.hpp. Reflect any changest there. */
typedef enum
{
V3DK_INVALID = 0,
V3DK_MENU = 1,
V3DK_FIT = 2,
V3DK_TOP = 3,
V3DK_LEFT = 4,
V3DK_RIGHT = 5,
V3DK_FRONT = 6,
V3DK_BOTTOM = 7,
V3DK_BACK = 8,
V3DK_ROLL_CW = 9,
V3DK_ROLL_CCW = 10,
V3DK_ISO1 = 11,
V3DK_ISO2 = 12,
V3DK_1 = 13,
V3DK_2 = 14,
V3DK_3 = 15,
V3DK_4 = 16,
V3DK_5 = 17,
V3DK_6 = 18,
V3DK_7 = 19,
V3DK_8 = 20,
V3DK_9 = 21,
V3DK_10 = 22,
V3DK_ESC = 23,
V3DK_ALT = 24,
V3DK_SHIFT = 25,
V3DK_CTRL = 26,
V3DK_ROTATE = 27,
V3DK_PANZOOM = 28,
V3DK_DOMINANT = 29,
V3DK_PLUS = 30,
V3DK_MINUS = 31,
V3DK_SPIN_CW = 32,
V3DK_SPIN_CCW = 33,
V3DK_TILT_CW = 34,
V3DK_TILT_CCW = 35,
V3DK_ENTER = 36,
V3DK_DELETE = 37,
V3DK_RESERVED0 = 38,
V3DK_RESERVED1 = 39,
V3DK_RESERVED2 = 40,
V3DK_F1 = 41,
V3DK_F2 = 42,
V3DK_F3 = 43,
V3DK_F4 = 44,
V3DK_F5 = 45,
V3DK_F6 = 46,
V3DK_F7 = 47,
V3DK_F8 = 48,
V3DK_F9 = 49,
V3DK_F10 = 50,
V3DK_F11 = 51,
V3DK_F12 = 52,
V3DK_F13 = 53,
V3DK_F14 = 54,
V3DK_F15 = 55,
V3DK_F16 = 56,
V3DK_F17 = 57,
V3DK_F18 = 58,
V3DK_F19 = 59,
V3DK_F20 = 60,
V3DK_F21 = 61,
V3DK_F22 = 62,
V3DK_F23 = 63,
V3DK_F24 = 64,
V3DK_F25 = 65,
V3DK_F26 = 66,
V3DK_F27 = 67,
V3DK_F28 = 68,
V3DK_F29 = 69,
V3DK_F30 = 70,
V3DK_F31 = 71,
V3DK_F32 = 72,
V3DK_F33 = 73,
V3DK_F34 = 74,
V3DK_F35 = 75,
V3DK_F36 = 76,
V3DK_11 = 77,
V3DK_12 = 78,
V3DK_13 = 79,
V3DK_14 = 80,
V3DK_15 = 81,
V3DK_16 = 82,
V3DK_17 = 83,
V3DK_18 = 84,
V3DK_19 = 85,
V3DK_20 = 86,
V3DK_21 = 87,
V3DK_22 = 88,
V3DK_23 = 89,
V3DK_24 = 90,
V3DK_25 = 91,
V3DK_26 = 92,
V3DK_27 = 93,
V3DK_28 = 94,
V3DK_29 = 95,
V3DK_30 = 96,
V3DK_31 = 97,
V3DK_32 = 98,
V3DK_33 = 99,
V3DK_34 = 100,
V3DK_35 = 101,
V3DK_36 = 102,
V3DK_VIEW_1 = 103,
V3DK_VIEW_2 = 104,
V3DK_VIEW_3 = 105,
V3DK_VIEW_4 = 106,
V3DK_VIEW_5 = 107,
V3DK_VIEW_6 = 108,
V3DK_VIEW_7 = 109,
V3DK_VIEW_8 = 110,
V3DK_VIEW_9 = 111,
V3DK_VIEW_10 = 112,
V3DK_VIEW_11 = 113,
V3DK_VIEW_12 = 114,
V3DK_VIEW_13 = 115,
V3DK_VIEW_14 = 116,
V3DK_VIEW_15 = 117,
V3DK_VIEW_16 = 118,
V3DK_VIEW_17 = 119,
V3DK_VIEW_18 = 120,
V3DK_VIEW_19 = 121,
V3DK_VIEW_20 = 122,
V3DK_VIEW_21 = 123,
V3DK_VIEW_22 = 124,
V3DK_VIEW_23 = 125,
V3DK_VIEW_24 = 126,
V3DK_VIEW_25 = 127,
V3DK_VIEW_26 = 128,
V3DK_VIEW_27 = 129,
V3DK_VIEW_28 = 130,
V3DK_VIEW_29 = 131,
V3DK_VIEW_30 = 132,
V3DK_VIEW_31 = 133,
V3DK_VIEW_32 = 134,
V3DK_VIEW_33 = 135,
V3DK_VIEW_34 = 136,
V3DK_VIEW_35 = 137,
V3DK_VIEW_36 = 138,
V3DK_SAVE_VIEW_1 = 139,
V3DK_SAVE_VIEW_2 = 140,
V3DK_SAVE_VIEW_3 = 141,
V3DK_SAVE_VIEW_4 = 142,
V3DK_SAVE_VIEW_5 = 143,
V3DK_SAVE_VIEW_6 = 144,
V3DK_SAVE_VIEW_7 = 145,
V3DK_SAVE_VIEW_8 = 146,
V3DK_SAVE_VIEW_9 = 147,
V3DK_SAVE_VIEW_10= 148,
V3DK_SAVE_VIEW_11= 149,
V3DK_SAVE_VIEW_12= 150,
V3DK_SAVE_VIEW_13= 151,
V3DK_SAVE_VIEW_14= 152,
V3DK_SAVE_VIEW_15= 153,
V3DK_SAVE_VIEW_16= 154,
V3DK_SAVE_VIEW_17= 155,
V3DK_SAVE_VIEW_18= 156,
V3DK_SAVE_VIEW_19= 157,
V3DK_SAVE_VIEW_20= 158,
V3DK_SAVE_VIEW_21= 159,
V3DK_SAVE_VIEW_22= 160,
V3DK_SAVE_VIEW_23= 161,
V3DK_SAVE_VIEW_24= 162,
V3DK_SAVE_VIEW_25= 163,
V3DK_SAVE_VIEW_26= 164,
V3DK_SAVE_VIEW_27= 165,
V3DK_SAVE_VIEW_28= 166,
V3DK_SAVE_VIEW_29= 167,
V3DK_SAVE_VIEW_30= 168,
V3DK_SAVE_VIEW_31= 169,
V3DK_SAVE_VIEW_32= 170,
V3DK_SAVE_VIEW_33= 171,
V3DK_SAVE_VIEW_34= 172,
V3DK_SAVE_VIEW_35= 173,
V3DK_SAVE_VIEW_36= 174,
V3DK_TAB = 175,
V3DK_SPACE = 176,
V3DK_MENU_1 = 177,
V3DK_MENU_2 = 178,
V3DK_MENU_3 = 179,
V3DK_MENU_4 = 180,
V3DK_MENU_5 = 181,
V3DK_MENU_6 = 182,
V3DK_MENU_7 = 183,
V3DK_MENU_8 = 184,
V3DK_MENU_9 = 185,
V3DK_MENU_10 = 186,
V3DK_MENU_11 = 187,
V3DK_MENU_12 = 188,
V3DK_MENU_13 = 189,
V3DK_MENU_14 = 190,
V3DK_MENU_15 = 191,
V3DK_MENU_16 = 192,
/* add more here as needed - don't change value of anything that may already be used */
V3DK_USER = 0x10000
} V3DKey;
#endif /* _V3DKey_H_ */
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
* siDefines.h -- 3DxWare input library defines and enums
*
* 3DxWare iInput library constants, no data structures
*
*----------------------------------------------------------------------
*
* Copyright (c) 2012-2018 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*/
#ifndef _SIDEFINES_H_
#define _SIDEFINES_H_
static char siDefinesCvsId[] = "(C) 2012-2018 3Dconnexion: $Id: siDefines.h 14752 2018-02-19 11:17:27Z jwick $";
/*
* UI modes
*/
#define SI_UI_ALL_CONTROLS 0xffffffffL
#define SI_UI_NO_CONTROLS 0x00000000L
/*
* Device types and classes
*/
typedef enum
{
SI_ALL_TYPES = -1,
SI_UNKNOWN_DEVICE = 0,
SI_SPACEBALL_2003 = 1,
SI_SPACEBALL_3003 = 2,
SI_SPACE_CONTROLLER = 3,
SI_SPACEEXPLORER = 4,
SI_SPACENAVIGATOR_FOR_NOTEBOOKS = 5,
SI_SPACENAVIGATOR = 6,
SI_SPACEBALL_2003A = 7,
SI_SPACEBALL_2003B = 8,
SI_SPACEBALL_2003C = 9,
SI_SPACEBALL_3003A = 10,
SI_SPACEBALL_3003B = 11,
SI_SPACEBALL_3003C = 12,
SI_SPACEBALL_4000 = 13,
SI_SPACEMOUSE_CLASSIC = 14,
SI_SPACEMOUSE_PLUS = 15,
SI_SPACEMOUSE_XT = 16,
SI_CYBERMAN = 17,
SI_CADMAN = 18,
SI_SPACEMOUSE_CLASSIC_PROMO = 19,
SI_SERIAL_CADMAN = 20,
SI_SPACEBALL_5000 = 21,
SI_TEST_NO_DEVICE = 22,
SI_3DX_KEYBOARD_BLACK = 23,
SI_3DX_KEYBOARD_WHITE = 24,
SI_TRAVELER = 25,
SI_TRAVELER1 = 26,
SI_SPACEBALL_5000A = 27,
SI_SPACEDRAGON = 28,
SI_SPACEPILOT = 29,
SI_MB = 30,
SI_SPACEPILOT_PRO = 0xc629,
SI_SPACEMOUSE_PRO = 0xc62b,
SI_SPACEMOUSE_TOUCH = 0xc62c,
SI_SPACEMOUSE_WIRELESS = 0xc62e,
SI_SPACEMOUSE_WIRELESS_NR = 0xc62f,
SI_SPACEMOUSE_PRO_WIRELESS = 0xc631,
SI_SPACEMOUSE_PRO_WIRELESS_NR = 0xc632,
SI_SPACEMOUSE_ENTERPRISE = 0xc633,
SI_SPACEMOUSE_COMPACT = 0xc635,
SI_SPACEMOUSE_MODULE = 0xc636,
SI_CADMOUSE = 0xc650,
SI_CADMOUSE_WIRELESS = 0xc651,
SI_UNIVERSAL_RECEIVER = 0xc652,
SI_UNIVERSAL_RECEIVER_SLOT = 0xf652,
SI_SCOUT = 0xc660
} SiDevType;
typedef enum
{
SI_CLASS_UNKNOWN = 0,
SI_CLASS_3DMOUSE = 1,
SI_CLASS_2DMOUSE = 2,
SI_CLASS_WIRELESS_RECEIVER = 3,
SI_CLASS_UNIVERSAL_WIRELESS_RECEIVER = 4,
SI_CLASS_KEYBOARD = 5,
SI_CLASS_JOYSTICK = 6,
SI_CLASS_VRGLASSES = 7,
SI_CLASS_MONITOR = 8,
SI_CLASS_TRACKER = 9,
SI_CLASS_EYETRACKER = 10,
} SiDevClass;
typedef enum
{
SI_CONNECTION_UNKNOWN = 0,
SI_CONNECTION_USB = 1, // USB cable
SI_CONNECTION_BT = 2, // BlueTooth
SI_CONNECTION_UR = 3, // Multi-device UniversalReceiver
SI_CONNECTION_NR = 4, // Dedicated single device NanoReceiver
SI_CONNECTION_WIRELESS = 5 // Generic wireless connection, e.g., WLAN
} SiDevConnection;
typedef enum
{
SI_ACTIVESTATE_UNKNOWN = 0,
SI_ACTIVESTATE_PAIREDANDSEENDATA = 1,
SI_ACTIVESTATE_PAIREDBUTNODATA = 2,
SI_ACTIVESTATE_USBCONNECTED = 3,
SI_ACTIVESTATE_USBDISCONNECTED = 4,
} SiDevActiveState;
typedef enum
{
SI_HINT_UNKNOWN = 0,
SI_HINT_SDKVERSION = 1,
SI_HINT_DRIVERVERSION = 2,
SI_HINT_USESV3DCMDS = 3,
SI_HINT_TEST_BOOL = 4, // These are just for testing
SI_HINT_TEST_INT = 5,
SI_HINT_TEST_FLOAT = 6,
SI_HINT_TEST_STRING = 7,
SI_HINT_USES3DXINPUT = 8,
SI_HINT_USESNAVLIB = 9,
SI_HINT_USESFILESYNC = 10,
} SiHintEnum;
/*
* Data retrieval mode, SI_POLL is not currently supported.
*/
#define SI_EVENT 0x0001
#define SI_POLL 0x0002
#define SI_NEUTERED 0x0004 // A connection that doesn't get events
#define SI_FOCUSTAIL 0x0008 // Last to get chosen for events
/*
* Get event flags
*/
#define SI_AVERAGE_EVENTS 0x0001
/*
* This is an INTERNAL flag used by the polling mechanism, user applications
* should NOT send this flag.
*/
#define SI_POLLED_REQUEST 0x0100
/*
* 3DxWare event types
*/
typedef enum
{
SI_BUTTON_EVENT = 1,
SI_MOTION_EVENT,
SI_COMBO_EVENT, /* Not implemented */
SI_ZERO_EVENT,
SI_EXCEPTION_EVENT, /* Driver use only */
SI_OUT_OF_BAND, /* Driver use only */
SI_ORIENTATION_EVENT, /* Driver use only */
SI_KEYBOARD_EVENT, /* Driver use only */
SI_LPFK_EVENT, /* Driver use only */
SI_APP_EVENT, /* Application functions */
SI_SYNC_EVENT, /* GUI synchronization events */
SI_BUTTON_PRESS_EVENT, /* Single button events (replace SI_BUTTON_EVENT) */
SI_BUTTON_RELEASE_EVENT, /* Single button events (replace SI_BUTTON_EVENT) */
SI_DEVICE_CHANGE_EVENT, /* Connect or disconnect device events */
SI_MOUSE_EVENT, /* Driver use only */
SI_JOYSTICK_EVENT, /* Driver use only */
SI_CMD_EVENT, /* V3DCMD_ events */
SI_MOTION_HID_EVENT, /* Motion event in HID nomenclature order */
SI_SETTING_CHANGED_EVENT,/* One or more smart ui settings have changed */
SI_RECONNECT_EVENT /* Occurs if the driver reconnects to the application */
} SiEventType;
/*
* SI_DEVICE_CHANGE_EVENT type
*/
typedef enum
{
SI_DEVICE_CHANGE_CONNECT,
SI_DEVICE_CHANGE_DISCONNECT
} SiDeviceChangeType;
/*
* SI_KEYBOARD_EVENT type
*/
typedef enum
{
SI_KEYBOARD_EVENT_KEYPRESS,
SI_KEYBOARD_EVENT_KEYRELEASE
} SiKeyboardEventType;
/*
* Motion data offsets
*/
#define SI_TX 0 /* Translation X value */
#define SI_TY 1 /* Translation Y value */
#define SI_TZ 2 /* Translation Z value */
#define SI_RX 3 /* Rotation X value */
#define SI_RY 4 /* Rotation Y value */
#define SI_RZ 5 /* Rotation Z value */
/*
* Reserved buttons
*/
#define SI_RESET_DEVICE_BIT 0x00000001L
#define SI_APP_FIT_BIT 0x80000000L
#define SI_APP_DIALOG_BIT 0x40000000L
#define SI_RESET_DEVICE_BUTTON 0
#define SI_APP_FIT_BUTTON 31
#define SI_APP_DIALOG_BUTTON 30
#define SI_APP_POPUPMENU_BUTTON 29
/*
* Miscellaneous
*/
#define SI_END_ARGS 0
#define SI_NO_HANDLE ((SiHdl) NULL)
#define SI_ALL_HANDLES ((SiHdl) NULL)
#define SI_ANY_HANDLE ((SiHdl) NULL)
#define SI_NO_TRANSCTL ((SiTransCtl) NULL)
#define SI_NO_MASK ((SiTypeMask *) NULL)
#define SI_ANY_DEVICE -1
#define SI_NOTIFICATION_DEVICE 0
#define SI_NO_DEVICE -1
#define SI_NO_TYPE -1
#define SI_NO_LIST -1
#define SI_NO_BUTTON -1
#define SI_STRSIZE 128
#define SI_MAXBUF 128
#define SI_MAXPORTNAME 260
#define SI_MAXPATH 512
#define SI_MAXAPPCMDID 500
#define SI_KEY_MAXBUF 5120
typedef enum
{
SI_LEFT = 0,
SI_RIGHT
} SiOrientation;
/*
SiMessageBox styles and behavior
*/
#define SI_MB_VIEW_SAVED 0x0001
#define SI_MB_HOLD_TO_SAVE 0x0002
#endif /* _SIDEFINES_H_ */
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
* siSync.h -- 3DxWare GUI Synchronization header
*
* Written: September 2004
* Author: Jim Wick
*
*----------------------------------------------------------------------
*
* Copyright notice:
* Copyright (c) 1998-2015 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*/
#ifndef _SISYNC_H_
#define _SISYNC_H_
#include "siSyncDefines.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
int state; /* VURZYX (Tx = LSB (& 1<<0) */
} SiSyncAxesState;
/*
* Private / implementation structures
*
* We suggest you leave these hidden and use the accessor functions rather than
* directly accessing the structures.
*/
#include "siSyncPriv.h"
/*
* Accessor Function headers
*/
SPWuint32 SiSyncGetSize(SiSyncPacket p);
void SiSyncSetSize(SiSyncPacket *p, SPWuint32 size);
SPWuint32 SiSyncGetHashCode(SiSyncPacket p);
void SiSyncSetHashCode(SiSyncPacket *p, SPWuint32 hashCode);
SiSyncOpCode SiSyncGetOpCode(SiSyncPacket p);
void SiSyncSetOpCode(SiSyncPacket *p, SPWuint32 opCode);
SiSyncItemCode SiSyncGetItemCode(SiSyncPacket p);
void SiSyncSetItemCode(SiSyncPacket *p, SPWuint32 itemCode);
#ifdef __cplusplus
}
#endif
#endif /* _SI_SYNC_H_ */
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
* siSyncPriv.h -- 3DxWare GUI Synchronization Private header
*
* Written: June 2005-2013
* Author: Jim Wick
*
*----------------------------------------------------------------------
*
* (c) Copyright 1998-2015 3Dconnexion. All rights reserved.
* Permission to use, copy, modify, and distribute this software for all
* purposes and without fees is hereby granted provided that this copyright
* notice appears in all copies. Permission to modify this software is granted
* and 3Dconnexion will support such modifications only is said modifications are
* approved by 3Dconnexion.
*
*/
#ifndef _SISYNCPRIV_H_
#define _SISYNCPRIV_H_
/*
* All packets start with the same fields.
* Many packets have data following the itemCode.
*/
typedef struct /* Sync Packet */
{
SPWuint32 size; /* total packet size */
SPWuint32 hashCode; /* Hash code that syncs a question with an answer */
SiSyncOpCode opCode; /* OpCode */
SiSyncItemCode itemCode; /* itemCode */
/* There will, generally, be more data starting here.
* There will not be any pointers, the data will be in here.
*/
} SiSyncPacketHeader;
/*
* I've enumerated all the possible packets here, not because they are all different,
* but mostly just for documentation. So the developer knows what parameters are
* expected with which packet type.
*/
typedef struct { SiSyncPacketHeader h; } SiSyncGetVersionPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 major; SPWint32 minor; } SiSyncSetVersionPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncCommandQueryPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncCommandSaveConfigPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetNumberOfFunctionsPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 n; } SiSyncSetNumberOfFunctionsPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; } SiSyncGetFunctionPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; SPWint32 n; WCHAR name[1];} SiSyncSetFunctionPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; } SiSyncGetButtonAssignmentPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; SPWint32 n; } SiSyncSetButtonAssignmentPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; SPWint32 n; } SiSyncSetButtonAssignmentAbsolutePacket;
typedef struct { SiSyncPacketHeader h; V3DKey v; SiAppCmdID a; } SiSyncSetButtonAssignmentV3DKeyPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; WCHAR name[1]; } SiSyncSetButtonNamePacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; } SiSyncGetAxisLabelPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; WCHAR name[1]; } SiSyncSetAxisLabelPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetOrientationPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 a[6]; } SiSyncSetOrientationPacket;
typedef struct { SiSyncPacketHeader h; SiSyncFilter i; } SiSyncGetFilterPacket;
typedef struct { SiSyncPacketHeader h; SiSyncFilter i; SiSyncFilterValue v; } SiSyncSetFilterPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetAxesStatePacket;
typedef struct { SiSyncPacketHeader h; SiSyncAxesState a; } SiSyncSetAxesStatePacket;
typedef struct { SiSyncPacketHeader h; SPWint32 duration; WCHAR s[1]; } SiSyncSetInfoLinePacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetScaleOverallPacket;
typedef struct { SiSyncPacketHeader h; SPWfloat32 v; } SiSyncSetScaleOverallPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetScaleTxPacket;
typedef struct { SiSyncPacketHeader h; SPWfloat32 v; } SiSyncSetScaleTxPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetScaleTyPacket;
typedef struct { SiSyncPacketHeader h; SPWfloat32 v; } SiSyncSetScaleTyPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetScaleTzPacket;
typedef struct { SiSyncPacketHeader h; SPWfloat32 v; } SiSyncSetScaleTzPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetScaleRxPacket;
typedef struct { SiSyncPacketHeader h; SPWfloat32 v; } SiSyncSetScaleRxPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetScaleRyPacket;
typedef struct { SiSyncPacketHeader h; SPWfloat32 v; } SiSyncSetScaleRyPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncGetScaleRzPacket;
typedef struct { SiSyncPacketHeader h; SPWfloat32 v; } SiSyncSetScaleRzPacket;
typedef struct { SiSyncPacketHeader h; SiSyncAbsFunctionNumber i; } SiSyncAbsFunctionPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 i; SPWbool state; } SiSyncSetButtonStatePacket;
typedef struct { SiSyncPacketHeader h; SPWbool bSuspendOrResume; } SiSyncSuspendFileWritingPacket;
typedef struct { SiSyncPacketHeader h; SPWint32 buttonNumber; SPWbool press; } SiSyncInjectButtonEventPacket;
typedef struct { SiSyncPacketHeader h; SPWbool press; WCHAR actionID[1]; } SiSyncInvokeActionIDPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncCreateButtonBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncDeleteButtonBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncSetCurrentButtonBankPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncPreviousButtonBankPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncNextButtonBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; SPWuint32 maxNameLen; } SiSyncGetCurrentButtonBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncCreateAxisBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncDeleteAxisBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncSetCurrentAxisBankPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncPreviousAxisBankPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncNextAxisBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; SPWuint32 maxNameLen; } SiSyncGetCurrentAxisBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncCreateApplicationBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncDeleteApplicationBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; } SiSyncSetCurrentApplicationBankPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncPreviousApplicationBankPacket;
typedef struct { SiSyncPacketHeader h; } SiSyncNextApplicationBankPacket;
typedef struct { SiSyncPacketHeader h; WCHAR bankName[1]; SPWuint32 maxNameLen; } SiSyncGetCurrentApplicationBankPacket;
typedef struct { SiSyncPacketHeader h; SPWuint32 syncID; } SiSyncSetGrabSyncIDPacket;
typedef struct { SiSyncPacketHeader h; SPWuint32 syncID; } SiSyncSetSyncIDPacket;
// Turn off "nonstandard extension used : nameless struct/union" warning
#pragma warning ( disable : 4201 )
typedef struct
{
union
{
SiSyncPacketHeader h;
SiSyncGetVersionPacket gv;
SiSyncSetVersionPacket sv;
SiSyncCommandQueryPacket cq;
SiSyncCommandSaveConfigPacket cs;
SiSyncGetNumberOfFunctionsPacket gnf;
SiSyncSetNumberOfFunctionsPacket snf;
SiSyncGetFunctionPacket gf;
SiSyncSetFunctionPacket sf;
SiSyncGetButtonAssignmentPacket gba;
SiSyncSetButtonAssignmentPacket sba;
SiSyncSetButtonAssignmentAbsolutePacket sbaa;
SiSyncSetButtonAssignmentV3DKeyPacket sbav;
SiSyncSetButtonNamePacket sbn;
SiSyncGetAxisLabelPacket ga;
SiSyncSetAxisLabelPacket sa;
SiSyncGetOrientationPacket go;
SiSyncSetOrientationPacket so;
SiSyncGetFilterPacket gfi;
SiSyncSetFilterPacket sfi;
SiSyncGetAxesStatePacket gas;
SiSyncSetAxesStatePacket sas;
SiSyncSetInfoLinePacket si;
SiSyncGetScaleOverallPacket gso;
SiSyncSetScaleOverallPacket sso;
SiSyncGetScaleTxPacket gtx;
SiSyncSetScaleTxPacket stx;
SiSyncGetScaleTyPacket gty;
SiSyncSetScaleTyPacket sty;
SiSyncGetScaleTzPacket gtz;
SiSyncSetScaleTzPacket stz;
SiSyncGetScaleRxPacket grx;
SiSyncSetScaleRxPacket srx;
SiSyncGetScaleRyPacket gry;
SiSyncSetScaleRyPacket sry;
SiSyncGetScaleRzPacket grz;
SiSyncSetScaleRzPacket srz;
SiSyncAbsFunctionPacket absf;
SiSyncSetButtonStatePacket sbs;
SiSyncSuspendFileWritingPacket sfw;
SiSyncInjectButtonEventPacket ibe;
SiSyncInvokeActionIDPacket ia;
SiSyncCreateButtonBankPacket cbb;
SiSyncDeleteButtonBankPacket dbb;
SiSyncSetCurrentButtonBankPacket scbb;
SiSyncPreviousButtonBankPacket pbb;
SiSyncNextButtonBankPacket nbb;
SiSyncGetCurrentButtonBankPacket gcbb;
SiSyncCreateAxisBankPacket cab;
SiSyncDeleteAxisBankPacket dab;
SiSyncSetCurrentAxisBankPacket scab;
SiSyncPreviousAxisBankPacket pab;
SiSyncNextAxisBankPacket nab;
SiSyncGetCurrentAxisBankPacket gcab;
SiSyncCreateApplicationBankPacket cappb;
SiSyncDeleteApplicationBankPacket dappb;
SiSyncSetCurrentApplicationBankPacket scappb;
SiSyncPreviousApplicationBankPacket pappb;
SiSyncNextApplicationBankPacket nappb;
SiSyncGetCurrentApplicationBankPacket gcappb;
SiSyncSetGrabSyncIDPacket sgsid;
SiSyncSetSyncIDPacket ssid;
};
} SiSyncPacket;
// Turn warning back on
#pragma warning ( default : 4201 )
#endif /* _SI_SYNCPRIV_H_ */
/*-----------------------------------------------------------------------------
/*-----------------------------------------------------------------------------
*
* siapp.h -- Si static library interface header file
*
* Contains function headers and type definitions for siapp.c.
*
*-----------------------------------------------------------------------------
*
* Copyright (c) 2013-2015 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*/
#ifndef SIAPP_H
#define SIAPP_H
static char SiAppCvsId[] = "(C) 1998-2018 3Dconnexion: $Id: siapp.h 14646 2018-01-04 15:08:23Z jwick $";
#ifdef __cplusplus
extern "C" {
#endif
/* externally used functions */
enum SpwRetVal SiInitialize(void);
SPWbool SiIsInitialized(void);
void SiTerminate(void);
int SiGetNumDevices(void);
SiDevID SiDeviceIndex(int idx);
int SiDispatch(SiHdl hdl, const SiGetEventData *pData, const SiSpwEvent *pEvent, const SiSpwHandlers *pDHandlers);
void SiOpenWinInit(SiOpenData *pData, HWND hWnd);
SiHdl SiOpen(const char *pAppName, SiDevID devID, const SiTypeMask *pTMask, int mode, const SiOpenData *pData);
SiHdl SiOpenPort(const char *pAppName, const SiDevPort *pPort, int mode, const SiOpenData *pData);
enum SpwRetVal SiClose(SiHdl hdl);
void SiGetEventWinInit(SiGetEventData *pData, UINT msg, WPARAM wParam, LPARAM lParam);
enum SpwRetVal SiGetEvent(SiHdl hdl, int flags, const SiGetEventData *pData, SiSpwEvent *pEvent);
enum SpwRetVal SiPeekEvent(SiHdl hdl, int flags, const SiGetEventData *pData, SiSpwEvent *pEvent);
enum SpwRetVal SiBeep(SiHdl hdl, const char *string);
enum SpwRetVal SiSetLEDs(SiHdl hdl, SPWuint32 mask);
enum SpwRetVal SiRezero(SiHdl hdl);
enum SpwRetVal SiGrabDevice(SiHdl hdl, SPWbool exclusive);
enum SpwRetVal SiReleaseDevice(SiHdl hdl);
int SiButtonPressed(const SiSpwEvent *pEvent);
int SiButtonReleased(const SiSpwEvent *pEvent);
enum SpwRetVal SiSetUiMode(SiHdl hdl, SPWuint32 mode);
enum SpwRetVal SiSetTypeMask(SiTypeMask *pTMask, int type1, ...);
enum SpwRetVal SiGetDevicePort(SiHdl hdl, SiDevPort *pPort);
enum SpwRetVal SiGetDriverInfo(SiVerInfo *pInfo);
void SiGetLibraryInfo(SiVerInfo *pInfo);
enum SpwRetVal SiGetDeviceInfo(SiHdl hdl, SiDevInfo *pInfo);
char * SpwErrorString(enum SpwRetVal val);
enum SpwRetVal SiSyncSendQuery(SiHdl hdl);
enum SpwRetVal SiSyncGetVersion(SiHdl hdl, SPWuint32 *pmajor, SPWuint32 *pminor);
enum SpwRetVal SiSyncGetNumberOfFunctions(SiHdl hdl, SPWuint32 *pnumberOfFunctions);
enum SpwRetVal SiSyncGetFunction(SiHdl hdl, SPWuint32 index, SPWint32 *pabsoluteFunctionNumber, WCHAR name[], SPWuint32 *pmaxNameLen);
enum SpwRetVal SiSyncGetButtonAssignment(SiHdl hdl, SPWuint32 buttonNumber, SPWint32 *passignedFunctionIndex);
enum SpwRetVal SiSyncSetButtonAssignment(SiHdl hdl, SPWuint32 buttonNumber, SPWint32 functionIndex);
enum SpwRetVal SiSyncSetButtonAssignmentAbsolute(SiHdl hdl, SPWuint32 buttonNumber, SPWint32 absoluteFunctionNumber);
enum SpwRetVal SiSyncSetButtonAssignmentV3DKey(SiHdl hdl, V3DKey v3dkey, SiAppCmdID appCmdId);
enum SpwRetVal SiSyncSetButtonName(SiHdl hdl, SPWuint32 buttonNumber, const WCHAR name[]);
enum SpwRetVal SiSyncGetAxisLabel(SiHdl hdl, SPWuint32 axisNumber, WCHAR name[], SPWuint32 *pmaxNameLen);
enum SpwRetVal SiSyncSetAxisLabel(SiHdl hdl, SPWuint32 axisNumber, const WCHAR name[]);
enum SpwRetVal SiSyncGetOrientation(SiHdl hdl, SPWint32 axes[6]);
enum SpwRetVal SiSyncSetOrientation(SiHdl hdl, const SPWint32 axes[6]);
enum SpwRetVal SiSyncGetFilter(SiHdl hdl, SiSyncFilter i, SiSyncFilterValue *pv);
enum SpwRetVal SiSyncSetFilter(SiHdl hdl, SiSyncFilter i, SiSyncFilterValue v);
enum SpwRetVal SiSyncGetAxesState(SiHdl hdl, SiSyncAxesState *pa);
enum SpwRetVal SiSyncSetAxesState(SiHdl hdl, SiSyncAxesState a);
enum SpwRetVal SiSyncSetInfoLine(SiHdl hdl, SPWint32 duration, const WCHAR text[]);
enum SpwRetVal SiSyncGetScaleOverall(SiHdl hdl, SPWfloat32 *pv);
enum SpwRetVal SiSyncSetScaleOverall(SiHdl hdl, SPWfloat32 v);
enum SpwRetVal SiSyncGetScaleTx(SiHdl hdl, SPWfloat32 *pv);
enum SpwRetVal SiSyncSetScaleTx(SiHdl hdl, SPWfloat32 v);
enum SpwRetVal SiSyncGetScaleTy(SiHdl hdl, SPWfloat32 *pv);
enum SpwRetVal SiSyncSetScaleTy(SiHdl hdl, SPWfloat32 v);
enum SpwRetVal SiSyncGetScaleTz(SiHdl hdl, SPWfloat32 *pv);
enum SpwRetVal SiSyncSetScaleTz(SiHdl hdl, SPWfloat32 v);
enum SpwRetVal SiSyncGetScaleRx(SiHdl hdl, SPWfloat32 *pv);
enum SpwRetVal SiSyncSetScaleRx(SiHdl hdl, SPWfloat32 v);
enum SpwRetVal SiSyncGetScaleRy(SiHdl hdl, SPWfloat32 *pv);
enum SpwRetVal SiSyncSetScaleRy(SiHdl hdl, SPWfloat32 v);
enum SpwRetVal SiSyncGetScaleRz(SiHdl hdl, SPWfloat32 *pv);
enum SpwRetVal SiSyncSetScaleRz(SiHdl hdl, SPWfloat32 v);
enum SpwRetVal SiSyncInvokeAbsoluteFunction(SiHdl hdl, SiSyncAbsFunctionNumber i);
enum SpwRetVal SiSyncSetButtonState(SiHdl hdl, SPWuint32 buttonNumber, SiSyncButtonState state);
enum SpwRetVal SiGetButtonName(SiHdl hdl, SPWuint32 buttonNumber, SiButtonName *pname);
enum SpwRetVal SiGetButtonV3DK(SiHdl hdl, SPWuint32 buttonNumber, SPWuint32 *pV3DK);
enum SpwRetVal SiGetButtonNameV3DK(SiHdl hdl, SPWuint32 V3DK, SiButtonName *pname);
enum SpwRetVal SiGetDeviceName(SiHdl hdl, SiDeviceName *pname);
enum SpwRetVal SiGetDeviceImageFileName(SiHdl hdl, char name[], SPWuint32 *pmaxNameLen);
HICON SiGetCompanyIcon(void);
enum SpwRetVal SiGetCompanyLogoFileName(char name[], SPWuint32 *pmaxNameLen);
enum SpwRetVal SiSyncSuspendFileWriting(SiHdl hdl);
enum SpwRetVal SiSyncResumeFileWriting(SiHdl hdl);
void *SiGetConnectionID(SiHdl hdl);
enum SpwRetVal SiSyncInvokeActionID(SPWuint32 hashCode, SPWbool press, const WCHAR actionID[]);
enum SpwRetVal SiSyncCreateButtonBank(SiHdl hdl, const WCHAR bankName[]);
enum SpwRetVal SiSyncDeleteButtonBank(SiHdl hdl, const WCHAR bankName[]);
enum SpwRetVal SiSyncSetCurrentButtonBank(SiHdl hdl, const WCHAR bankName[]);
enum SpwRetVal SiSyncPreviousButtonBank(SiHdl hdl);
enum SpwRetVal SiSyncNextButtonBank(SiHdl hdl);
enum SpwRetVal SiSyncGetCurrentButtonBank(SiHdl hdl, WCHAR bankName[], SPWuint32 *pmaxBankNameLen);
enum SpwRetVal SiSyncSetGrabSyncID(SiHdl hdl, SPWuint32 syncID);
enum SpwRetVal SiSyncSetSyncID(SiHdl hdl, SPWuint32 syncID);
SPWint32 SiMessageBox(HWND hwnd, const WCHAR message[], const WCHAR caption[], SPWuint32 message_type);
void SiOpenWinInitEx(SiOpenDataEx *pData, HWND hWnd);
void SiOpenWinAddHintBoolEnum(SiOpenDataEx *pData, SiHintEnum hint, SPWbool value);
void SiOpenWinAddHintIntEnum(SiOpenDataEx *pData, SiHintEnum hint, SPWint32 value);
void SiOpenWinAddHintFloatEnum(SiOpenDataEx *pData, SiHintEnum hint, SPWfloat32 value);
void SiOpenWinAddHintStringEnum(SiOpenDataEx *pData, SiHintEnum hint, WCHAR *value);
void SiOpenWinAddHintBool(SiOpenDataEx *pData, WCHAR *hint, SPWbool value);
void SiOpenWinAddHintInt(SiOpenDataEx *pData, WCHAR *hint, SPWint32 value);
void SiOpenWinAddHintFloat(SiOpenDataEx *pData, WCHAR *hint, SPWfloat32 value);
void SiOpenWinAddHintString(SiOpenDataEx *pData, WCHAR *hint, WCHAR *value);
SiHdl SiOpenEx(const WCHAR *pAppName, SiDevID devID, const SiTypeMask *pTMask, int mode, const SiOpenDataEx *pData);
SiHdl SiOpenPortEx(const WCHAR *pAppName, const SiDevPort *pPort, int mode, const SiOpenDataEx *pData);
#ifdef __cplusplus
}
#endif
#endif /* #ifndef SIAPP_H */
#ifndef siappcmd_H_INCLUDED_
#ifndef siappcmd_H_INCLUDED_
#define siappcmd_H_INCLUDED_
/* siappcmd.h */
/*
* Copyright notice:
* (c) 2013-2016 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit and this file is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*/
/************************************************************************************
* File History
*
* $Id: siappcmd.h 13306 2016-08-18 19:00:54Z ngomes $
*
*/
/************************************************************************************
* File Description:
This 3Dconnexion application extension is a set of methods that allows users to
press buttons on a 3dconnexion device to invoke arbitrary actions.
A 3dconnexion utility is responsible for supporting user customization of 3D Input
device buttons. The application is responsible for passing application action
information to the 3dconnexion library, and for invoking actions identified by the
3dconnexion application extension.
The application invokes the following library functions.
SiAppCmdWriteActionSet
The application calls this function to write a context sensitive set of actions
to the 3dconnexion library. The action set is passed as a tree consisting of
categories and actions. An application may have either only one set of actions
through the whole life time of the application, or may change the set of actions
depending on the current working environment or context.
SiAppCmdActivateActionSet
The application calls this function immediately after enabling an action set,
passing the id for an action tree previously written to the 3dconnexion library.
If the application enables a new action set, it will also need to write the whole
action tree (using SiAppCmdWriteActions) to the 3dconnexion library.
Data structures are described in siappcmd_types.h
The functions are described in detail below.
***********************************************************************************************/
#include <si.h>
#include <siappcmd_types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*------------------------------------+---------------------------------------
SiAppCmdWriteActionSet
SiAppCmdWriteActionSet is invoked by the application to communicate a set of actions
(application commands) to the 3Dconnexion library. The library caches the action information
to support user customization of action-button mappings.
The application must pass the entire action tree on each invocation of SiAppCmdWriteActionSet
for a particular environment or context.
Parameters:
Sihdl - active 3dware connection
SiActionNode_t* - action_tree (memory owned by the function caller)
Result:
SPW_NO_ERROR
SI_BAD_HANDLE
--------------------------------------+-------------------------------------*/
#pragma warning (push)
#pragma warning (disable : 4995)
enum SpwRetVal SiAppCmdWriteActionSet(SiHdl hdl, const SiActionNode_t *action_tree);
#pragma warning (pop)
#pragma deprecated(SiAppCmdWriteActionSet)
/*------------------------------------+---------------------------------------
SiAppCmdWriteActions
SiAppCmdWriteActions is invoked by the application to communicate a set of actions
(application commands) to the 3Dconnexion library. The library caches the action information
to support user customization of action-button mappings.
The application must pass the entire action tree on each invocation of SiAppCmdWriteActionSet
for a particular environment or context.
Parameters:
Sihdl - active 3dware connection
SiActionNodeEx_t* - action_tree (memory owned by the function caller)
Result:
SPW_NO_ERROR
SI_BAD_HANDLE
--------------------------------------+-------------------------------------*/
enum SpwRetVal SiAppCmdWriteActions(SiHdl hdl, const SiActionNodeEx_t *action_tree);
/*------------------------------------+---------------------------------------
SiAppCmdWriteActionImages
SiAppCmdWriteActionImages is invoked by the application to communicate the images
associated with application commands to the 3Dconnexion library. The library caches
the image information to support user customization of action-button mappings.
Parameters:
Sihdl - active 3dware connection
SiImage_t[] - array of images
SPWuint32 - the number of elements in the image array
Result:
SPW_NO_ERROR
SI_BAD_HANDLE
--------------------------------------+-------------------------------------*/
enum SpwRetVal SiAppCmdWriteActionImages(SiHdl hdl, const SiImage_t images[], SPWuint32 image_count);
/*------------------------------------+---------------------------------------
SiAppCmdActivateActionSet
SiAppCmdActivateActionSet is invoked by the application after enabling an action set.
The action tree passed in consists of a single action set node identifying the
the action set.
The function activates the action set named in the id.
Parameters:
Sihdl - active 3dware connection
char* - action set id (memory owned by the function caller)
Result:
SPW_NO_ERROR
SI_BAD_HANDLE
SI_BAD_VALUE
--------------------------------------+-------------------------------------*/
enum SpwRetVal SiAppCmdActivateActionSet(SiHdl hdl, const char *action_set_id);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* siappcmd_H_INCLUDED_ */
#ifndef siappcmd_types_H_INCLUDED_
#ifndef siappcmd_types_H_INCLUDED_
#define siappcmd_types_H_INCLUDED_
/* siappcmd_types.h */
/*
* Copyright notice:
* (c) 2013-2016 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit and this file is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*/
/************************************************************************************
* File History
*
* $Id: siappcmd_types.h 14470 2017-09-26 06:37:48Z mbonk $
*
* 11/05/15 MSB Added size and description fields to SiActionNode_t.
* This will break the compilation as the size field needs setting and the
* type field has moved.
*/
/************************************************************************************
* File Description:
This header file describes the variable types used in the 3dconnexion interface
that allows a user to assign an arbitrary action to a 3dconnexion device button.
Data structures are described in detail below.
***********************************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_MSC_VER) && (_MSC_VER<1600)
typedef unsigned __int32 uint32_t;
typedef unsigned __int8 uint8_t;
#if _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#else
#include <stdint.h>
#endif
typedef enum siActionNodeType_e
{
SI_ACTIONSET_NODE = 0
, SI_CATEGORY_NODE
, SI_ACTION_NODE
} SiActionNodeType_t;
/*------------------------------------+---------------------------------------
SiActionNodeEx_t
The application passes a pointer to a structure of type SiActionNodeEx_t to
the function SiAppCmdWriteActionSet
A set of actions is composed of a linked list of SiActionNodeEx_t structures.
Sibling nodes are linked by the next field of the structure and child nodes
by the children field. The root node of the tree represents the name of the
action set while the leaf nodes of the tree represent the actions that can be
assigned to buttons and invoked by the user. The intermediate nodes represent
categories and sub-categories for the actions. An example of this would be the
menu item structure in a menu bar. The menus in the menu bar would be
represented by the SiActionNodeEx_t structures with type SI_CATEGORY_NODE pointed
to by each successively linked next field and the first menu item of each menu
represented by the structure pointed to by their child fields (the rest of the
menu items in each menu would again be linked by the next fields).
size
The size field must always be the byte size of siActionNodeEx_s
type
The type field specifies one of the following values.
SI_ACTIONSET_NODE
SI_CATEGORY_NODE
SI_ACTION_NODE
The root node (and only the root node) of the tree always has type
SI_ACTIONSET_NODE. Only the leaf nodes of the tree have type SI_ACTION_NODE.
All intermediate nodes have type SI_CATEGORY_NODE.
id
The id field specifies a UTF8 string identifier for the action set,
category, or action represented by the node. The field is always non-NULL.
This string needs to remain constant across application sessions and more
or less constant across application releases. The id is used by the
application to identify an action.
label
The label field specifies a UTF8 localized/internationalized name
for the action set, category, or action represented by the node. The label
field can be NULL for the root and intermediate category nodes that are not
explicitly presented to users. All leaf (action) and intermediate nodes
containing leaf nodes have non-NULL labels. If the application only has a
single action tree set, then the label of the root (context) node can also
be NULL.
description
The description field specifies a UTF8 localized/internationalized tooltip
for the action set, category, or action represented by the node. The description
field can be NULL for the root and intermediate category nodes that are not
explicitly presented to users. Leaf (action) nodes should have non-NULL descriptions.
--------------------------------------+-------------------------------------*/
#if __clang__
__attribute__((deprecated))
#elif _MSC_VER
#pragma deprecated(SiActionNode_t)
#endif
typedef struct siActionNode_s
{
struct siActionNode_s *next;
struct siActionNode_s *children;
const char *id;
const char *label;
SiActionNodeType_t type;
} SiActionNode_t;
typedef struct siActionNodeEx_s
{
uint32_t size;
SiActionNodeType_t type;
struct siActionNodeEx_s *next;
struct siActionNodeEx_s *children;
const char *id;
const char *label;
const char *description;
} SiActionNodeEx_t;
/*------------------------------------+---------------------------------------
SiImage_t
The application passes a pointer to an array of type SiImage_t to
the function SiAppCmdWriteActionImages
size
The size field specifies the size of the SiImage_t type in bytes.
id
The id field specifies a UTF8 string identifier for the image. The field
is always non-NULL. This string needs to remain constant across application
sessions and more or less constant across application releases.
The id is used by the application to identify the image. To associate an
image with a command the id needs to be identical to the value of the
SiActionNodeEx_t::id of the action.
siImageData_s::size
The siImageData_s::size field specifies the size of the data pointed to
by the siImageData_s::data field in bytes.
siImageData_s::data
The image field contains a pointer to the image. The image may be in coded
in any recognizable format.
--------------------------------------+-------------------------------------*/
typedef enum eSiImageType {
e_none = 0
, e_image_file
, e_resource_file
, e_image
} SiImageType_t;
struct siResource_s {
const char *file_name;
const char *id;
const char *type;
uint32_t index;
};
struct siImageFile_s {
const char *file_name;
uint32_t index;
};
struct siImageData_s {
const uint8_t *data;
uintptr_t size;
uint32_t index;
};
typedef struct siImage_s
{
uint32_t size;
SiImageType_t type;
const char *id;
union {
struct siResource_s resource;
struct siImageFile_s file;
struct siImageData_s image;
};
} SiImage_t;
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* siappcmd_types_H_INCLUDED_ */
\ No newline at end of file
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
* spwdata.h -- datatypes
*
*
* This contains the only acceptable type definitions for 3Dconnexion
* products. Needs more work.
*
*----------------------------------------------------------------------
*
* Copyright notice:
* Copyright (c) 1996-2015 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*----------------------------------------------------------------------
*
* 10/27/15 Added 64bit definitions for non ms-compilers
*/
#ifndef SPWDATA_H
#define SPWDATA_H
static char spwdataCvsId[] = "(C) 1996-2015 3Dconnexion: $Id: spwdata.h 11976 2015-10-27 10:51:11Z mbonk $";
#if defined (_MSC_VER)
typedef __int64 SPWint64;
#else
typedef int64_t SPWint64;
#endif
typedef long SPWint32;
typedef short SPWint16;
typedef char SPWint8;
typedef long SPWbool;
#if defined (_MSC_VER)
typedef unsigned __int64 SPWuint64;
#else
typedef uint64_t SPWuint64;
#endif
typedef unsigned long SPWuint32;
typedef unsigned short SPWuint16;
typedef unsigned char SPWuint8;
typedef float SPWfloat32;
typedef double SPWfloat64;
#endif /* SPWDATA_H */
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
* spwerror.h -- 3DxWare function return values
*
* This file contains all the 3Dconnexion standard error return
* return values for functions
*
*----------------------------------------------------------------------
*
* Copyright (c) 1996-2015 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*
*/
#ifndef _SPWERROR_H_
#define _SPWERROR_H_
static char spwerrorCvsId[]="(C) 1996-2015 3Dconnexion: $Id: spwerror.h 11571 2015-07-15 08:19:31Z jwick $";
enum SpwRetVal /* Error return values. */
{
SPW_NO_ERROR, /* No error. */
SPW_ERROR, /* Error -- function failed. */
SI_BAD_HANDLE, /* Invalid 3DxWare handle. */
SI_BAD_ID, /* Invalid device ID. */
SI_BAD_VALUE, /* Invalid argument value. */
SI_IS_EVENT, /* Event is a 3DxWare event. */
SI_SKIP_EVENT, /* Skip this 3DxWare event. */
SI_NOT_EVENT, /* Event is not a 3DxWare event. */
SI_NO_DRIVER, /* 3DxWare driver is not running. */
SI_NO_RESPONSE, /* 3DxWare driver is not responding. */
SI_UNSUPPORTED, /* The function is unsupported by this version. */
SI_UNINITIALIZED, /* 3DxWare input library is uninitialized. */
SI_WRONG_DRIVER, /* Driver is incorrect for this 3DxWare version. */
SI_INTERNAL_ERROR, /* Internal 3DxWare error. */
SI_BAD_PROTOCOL, /* The transport protocol is unknown. */
SI_OUT_OF_MEMORY, /* Unable to malloc space required. */
SPW_DLL_LOAD_ERROR, /* Could not load siapp dlls */
SI_NOT_OPEN, /* 3D mouse device not open */
SI_ITEM_NOT_FOUND, /* Item not found */
SI_UNSUPPORTED_DEVICE, /* The device is not supported */
SI_NOT_ENOUGH_MEMORY, /* Not enough memory (but not a malloc problem) */
SI_SYNC_WRONG_HASHCODE, /* Wrong hash code sent to a Sync function */
SI_INCOMPATIBLE_PROTOCOL_MIX, /* Attempt to mix MWM and S80 protocol in invalid way */
SI_DISABLED /* Functionality is currently disabled */
};
typedef enum SpwRetVal SpwReturnValue;
#endif /* _SPWERROR_H_ */
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
* spwmacro.h -- cpp macros we ALWAYS use.
*
* $Id: spwmacro.h 11091 2015-01-09 11:02:45Z jwick $
*
* We always seem to use the same macros.
* This is the place we define them.
*
*----------------------------------------------------------------------
*/
/*
* Copyright notice:
* Copyright (c) 1998-2015 3Dconnexion. All rights reserved.
*
* This file and source code are an integral part of the "3Dconnexion
* Software Developer Kit", including all accompanying documentation,
* and is protected by intellectual property laws. All use of the
* 3Dconnexion Software Developer Kit is subject to the License
* Agreement found in the "LicenseAgreementSDK.txt" file.
* All rights not expressly granted by 3Dconnexion are reserved.
*/
#ifndef SPWMACRO_H
#define SPWMACRO_H
#define SPW_FALSE (0)
#define SPW_TRUE (!SPW_FALSE)
#define SPW_MAX(a,b) (((a)>(b))?(a):(b))
#define SPW_MIN(a,b) (((a)<(b))?(a):(b))
#define SPW_ABS(a) (((a)<0)?(-(a)):(a))
#define SPW_SIGN(a) ((a)>=0?1:-1)
#define SPW_BIND(min,n,max) (SPW_MIN((max),SPW_MAX((min),(n))))
#define SPW_NUM_ELEMENTS_IN(a) (sizeof(a)/sizeof((a)[0]))
#define SPW_PI 3.14159265358979324f
#define SPW_DEG_TO_RAD(d) ((d)*SPW_PI/180.0f)
#define SPW_RAD_TO_DEG(r) ((r)*180.0f/SPW_PI)
#define SPW_LENGTH_OF(a) (sizeof(a)/sizeof((a)[0]))
#define SPW_END_OF(a) (&(a)[SPW_LENGTH_OF(a)-1])
#define SPW_SQ(a) ((a)*(a))
#define SPW_ABSDIFF(a, b) (fabs((double) (a) - (b)))
#endif
/*-----------------------------------------------------------------------------
/*-----------------------------------------------------------------------------
*
* spwmath.h: SpaceWare Math Library public definitions
*
* $Id: spwmath.h 9452 2013-10-07 10:20:47Z jwick $
*
*-----------------------------------------------------------------------------
*
*/
#ifndef SPW_MATH_H
#define SPW_MATH_H
#define SPW_MATH_MAJOR 3
#define SPW_MATH_MINOR 0
#define SPW_MATH_UPDATE 0
#define SPW_MATH_BUILD 7
#define SPW_MATH_VERSION "MATH version 3.0"
#define SPW_MATH_DATE "March 27, 1998"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef EXPORT_FUNCTIONS
#define DLL_EXPORT __declspec(dllexport)
#define CALL_TYPE __stdcall
#else
#define DLL_EXPORT
#define CALL_TYPE __stdcall
#endif
/* PUBLIC VARIABLES & DEFINES */
#if !defined(__GL_GL_H__) && !defined(SPW_NO_MATRIX)
typedef float Matrix[4][4];
#endif
DLL_EXPORT void SPW_ArbitraryAxisToMatrix (Matrix, const float[3], float);
DLL_EXPORT int SPW_CompareMatrices (const Matrix, const Matrix);
DLL_EXPORT float SPW_DotProduct (const float [3], const float [3]);
DLL_EXPORT float SPW_GetMatrixScale (const Matrix);
DLL_EXPORT void SPW_InvertMatrix (Matrix, const Matrix);
DLL_EXPORT void SPW_LookAtUpVectorToMatrix (Matrix, const float [3], const float [3],
const float [3]);
DLL_EXPORT void SPW_MatrixToArbitraryAxis (float [3], float *, const Matrix);
DLL_EXPORT float SPW_MatrixDeterminant (const Matrix);
DLL_EXPORT void SPW_MatrixToLookAtUpVector (float [3], float [3], float [3],
const Matrix);
DLL_EXPORT void SPW_Mult44x44 (Matrix, const Matrix, const Matrix);
DLL_EXPORT void SPW_MultFull14x44 (float [3], const float [3], const Matrix);
DLL_EXPORT void SPW_Mult14x44 (float [3], const float [3], const Matrix);
DLL_EXPORT void SPW_Mult33x33 (Matrix, const Matrix, const Matrix);
DLL_EXPORT void SPW_Mult13x33 (float [3], const float [3], const Matrix);
DLL_EXPORT int SPW_OrthoNormMatrix (Matrix);
DLL_EXPORT float SPW_VectorLength (const float [3]);
DLL_EXPORT void SPW_TransposeMatrix (Matrix, const Matrix);
DLL_EXPORT void SPW_CopyMatrix (Matrix, const Matrix);
DLL_EXPORT void SPW_ScaleMatrix (Matrix, const Matrix, float);
DLL_EXPORT void SPW_GetTranslationMatrix (Matrix, const Matrix);
DLL_EXPORT void SPW_InitializeMatrix (Matrix, float, float, float, float,
float, float, float, float,
float, float, float, float,
float, float, float, float);
DLL_EXPORT void SPW_MakeIdentityMatrix (Matrix);
DLL_EXPORT void SPW_NormalizeVector (float [3], float [3]);
DLL_EXPORT void SPW_CrossProduct (float [3], const float [3], const float [3]);
DLL_EXPORT void SPW_PrintMatrix (const char *, const Matrix);
DLL_EXPORT void SPW_PrintVector (const char *, const float [3]);
DLL_EXPORT void SPW_PrintSpaceballData (const char *, const float [7]);
DLL_EXPORT void SPW_HighValuePassFilter (float *, int);
#ifdef __cplusplus
}
#endif
#endif /* SPW_MATH_H */
#include "Navigation3D.h"
#include "Navigation3D.h"
#include <exception>
/// <summary>
/// 全局初始化3D鼠标
/// </summary>
void three_mouse_global_init()
{
try
{
ZeroMemory(device_datas, sizeof(device_datas));
}
catch (const std::exception&)
{
}
}
/// <summary>
/// 销毁3D鼠标
/// </summary>
void three_mouse_global_dispose()
{
try
{
SiTerminate();
}
catch (const std::exception&)
{
}
}
/// <summary>
/// 获取3D鼠标个数
/// </summary>
/// <returns>3D鼠标个数</returns>
int three_mouse_get_device_number()
{
try
{
return SiGetNumDevices();
}
catch (const std::exception&)
{
return -1;
}
}
/// <summary>
/// 打开3D鼠标设备
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="id">编号</param>
/// <returns>3D鼠标数据</returns>
ThreeDDeviceData* three_mouse_open_device(HWND hWnd, int id)
{
try
{
if (SiInitialize() == SPW_DLL_LOAD_ERROR) //init the 3DxWare input library
{
return NULL;
}
ThreeDDeviceData* device_data = new ThreeDDeviceData();
ZeroMemory(device_data, sizeof(ThreeDDeviceData));
device_data->id = id;
SiOpenData oData;
SiOpenWinInit(&oData, hWnd);
device_data->device = SiOpen("Navigation3D00", id, SI_NO_MASK, SI_EVENT, &oData);
if (device_data->device == NULL)
{
delete device_data;
SiTerminate();
return NULL;
}
SiGrabDevice(device_data->device, TRUE);
device_data->WM_3DMOUSE = RegisterWindowMessage(L"SpaceWareMessage00");
device_datas[id] = device_data;
return NULL;
}
catch (const std::exception&)
{
return NULL;
}
}
/// <summary>
/// 处理3D鼠标消息
/// </summary>
/// <param name="id">设备编号</param>
/// <param name="wParam">窗口消息</param>
/// <param name="lParam">窗口消息</param>
/// <returns>3D鼠标数据</returns>
ThreeDMouseData* three_mouse_on_message(int id, WPARAM wParam, LPARAM lParam)
{
try
{
if (id == 0 || id > 100)
return NULL;
ThreeDDeviceData* device_data = device_datas[id];
if (device_data == NULL)
return NULL;
ThreeDMouseData* data = new ThreeDMouseData();
data->result = 0;
data->tx = 0;
data->ty = 0;
data->tz = 0;
data->rx = 0;
data->ry = 0;
data->rz = 0;
SiSpwEvent Event; /* 3DxWare Event */
SiGetEventData EData; /* 3DxWare Event Data */
/* init Window platform specific data for a call to SiGetEvent */
SiGetEventWinInit(&EData, device_data->WM_3DMOUSE, wParam, lParam);
/* check whether msg was a 3D mouse event and process it */
if (SiGetEvent(device_data->device, 0, &EData, &Event) == SI_IS_EVENT)
{
switch (Event.type)
{
case SI_MOTION_EVENT:
data->result = 1;
data->tx = Event.u.spwData.mData[SI_TX];
data->ty = Event.u.spwData.mData[SI_TY];
data->tz = Event.u.spwData.mData[SI_TZ];
data->rx = Event.u.spwData.mData[SI_RX];
data->ry = Event.u.spwData.mData[SI_RY];
data->rz = Event.u.spwData.mData[SI_RZ];
break;
case SI_ZERO_EVENT:
data->result = 1;
data->tx = 0;
data->ty = 0;
data->tz = 0;
data->rx = 0;
data->ry = 0;
data->rz = 0;
break;
case SI_BUTTON_EVENT:
break;
} /* end switch */
} /* end SiGetEvent */
return (data);
}
catch (const std::exception&)
{
return NULL;
}
}
/// <summary>
/// 销毁3D鼠标指针
/// </summary>
/// <param name="ptr">指针</param>
void three_mouse_dispose_ptr(void* ptr)
{
try
{
delete ptr;
}
catch (const std::exception&)
{
}
}
\ No newline at end of file
#pragma once
#pragma once
#include <Windows.h>
#include <si.h>
#include <siapp.h>
extern "C" {
/// <summary>
/// 3D鼠标设备数据
/// </summary>
__declspec(dllimport) typedef struct
{
/// <summary>
/// 设备编号
/// </summary>
int id;
/// <summary>
/// 3D鼠标设备
/// </summary>
SiHdl device;
/// <summary>
/// 3D鼠标消息
/// </summary>
int WM_3DMOUSE;
} ThreeDDeviceData;
/// <summary>
/// 3D鼠标数据
/// </summary>
__declspec(dllimport) typedef struct
{
/// <summary>
/// 返回值为1时成功获取到3D鼠标数据
/// </summary>
long result;
/// <summary>
/// TX 值
/// </summary>
long tx;
/// <summary>
/// TY 值
/// </summary>
long ty;
/// <summary>
/// TZ 值
/// </summary>
long tz;
/// <summary>
/// RX 值
/// </summary>
long rx;
/// <summary>
/// RY 值
/// </summary>
long ry;
/// <summary>
/// RZ 值
/// </summary>
long rz;
/// <summary>
/// 事件
/// </summary>
long si_event;
} ThreeDMouseData;
/// <summary>
/// 设备数据信息
/// </summary>
ThreeDDeviceData* device_datas[20];
/// <summary>
/// 全局初始化3D鼠标
/// </summary>
__declspec(dllimport) void three_mouse_global_init();
/// <summary>
/// 全局销毁3D鼠标
/// </summary>
__declspec(dllimport) void three_mouse_global_dispose();
/// <summary>
/// 获取3D鼠标个数
/// </summary>
/// <returns>3D鼠标个数</returns>
__declspec(dllimport) int three_mouse_get_device_number();
/// <summary>
/// 打开3D鼠标设备
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="id">编号</param>
/// <returns>3D鼠标数据</returns>
__declspec(dllimport) ThreeDDeviceData* three_mouse_open_device(HWND hWnd, int id);
/// <summary>
/// 处理3D鼠标消息
/// </summary>
/// <param name="id">设备编号</param>
/// <param name="wParam">窗口消息</param>
/// <param name="lParam">窗口消息</param>
/// <returns>3D鼠标数据</returns>
__declspec(dllimport) ThreeDMouseData* three_mouse_on_message(int id, WPARAM wParam, LPARAM lParam);
/// <summary>
/// 销毁3D鼠标指针
/// </summary>
/// <param name="ptr">指针</param>
__declspec(dllimport) void three_mouse_dispose_ptr(void* ptr);
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{d1aa6399-2000-42ba-a577-d50bc5fca393}</ProjectGuid>
<RootNamespace>VIZFrameworkCoreNavigation3D</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>E:\Projects\VIZ.Framework\VIZ.Framework.Core.Navigation3D\Inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>E:\Projects\VIZ.Framework\VIZ.Framework.Core.Navigation3D\Lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>siapp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>E:\Projects\VIZ.Framework\VIZ.Framework.Core.Navigation3D\Inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>E:\Projects\VIZ.Framework\VIZ.Framework.Core.Navigation3D\Lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>siapp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Navigation3D.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Navigation3D.cpp" />
<ClCompile Include="window_test.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Navigation3D.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Navigation3D.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="window_test.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
#include <windows.h>
#include <windows.h>
#include "Navigation3D.h"
#include <iostream>
using namespace std;
//声明函数
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
//主函数WinMain()
int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine, _In_ int nShowCmd)
{
//窗口类名
TCHAR cls_name[] = TEXT("3DMouseTest");
//设计窗口类
WNDCLASSEX wce = { 0 };
wce.cbSize = sizeof(WNDCLASSEX); //结构体大小
wce.style = CS_HREDRAW | CS_VREDRAW; //大小改变,水平和垂直重绘
wce.lpfnWndProc = WindowProc; //窗口回调函数地址
wce.cbClsExtra = 0; //类的附加数据
wce.cbWndExtra = 0; //窗口的附加数据
wce.hInstance = hInstance; //应用程序实例句柄
wce.hIcon = LoadIcon(NULL, IDI_APPLICATION); //大图标
wce.hIconSm = wce.hIcon; //小图标
wce.hCursor = LoadCursor(NULL, IDC_ARROW); //光标
wce.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); //背景色
wce.lpszMenuName = NULL; //菜单
wce.lpszClassName = cls_name; //窗口类的名称
//注册窗口类
//ATOM nres = RegisterClassEx(&wce);
if (FALSE == RegisterClassEx(&wce))
return 1;
//创建窗口
HWND hWnd = CreateWindowEx(
WS_EX_APPWINDOW, //窗口的扩展样式
cls_name, //窗口类名
TEXT("3DMouseTest"), //窗口标题
WS_OVERLAPPEDWINDOW, //窗口风格样式
200, 120, 600, 400, //窗口x,y,宽度,高度
NULL, //父窗口句柄
NULL, //菜单句柄
hInstance, //应用程序实例句柄
NULL); //附加数据
//回调函数要写上默认的处理DefWindowProc,不然创建失败
if (!hWnd)
return 1;
//显示,更新窗口
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
//添加加速键表
HACCEL hAccel = NULL;
/*::LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_ACCELERATOR1);*/
// =======================================================================
// 初始化3D鼠标
three_mouse_global_init();
three_mouse_open_device(hWnd, 1);
// =======================================================================
//消息循环
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(hWnd, hAccel, &msg))//有加速键表时用这,没有就不用
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// =======================================================================
// 销毁3D鼠标
three_mouse_global_dispose();
// =======================================================================
return 0;
}
//窗口消息处理函数
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
ThreeDMouseData* mouse_data = three_mouse_on_message(1, wParam, lParam);
if (mouse_data != NULL && mouse_data->result == TRUE)
{
}
switch (uMsg)
{
case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default: break;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ BOOL init_3D_Mouse(HWND hWnd)
{
try
{
if (SiInitialize() == SPW_DLL_LOAD_ERROR) //init the 3DxWare input library
if (SiInitialize() != SPW_NO_ERROR) //init the 3DxWare input library
{
return FALSE;
}
......@@ -24,9 +24,40 @@ BOOL init_3D_Mouse(HWND hWnd)
return FALSE;
}
SiGrabDevice(device, 1);
if (SiGrabDevice(device, TRUE) != SPW_NO_ERROR)
{
SiTerminate();
return FALSE;
}
WM_3DMOUSE = RegisterWindowMessage(L"SpaceWareMessage00");
if (WM_3DMOUSE == 0)
{
return FALSE;
}
return TRUE;
}
catch (const std::exception&)
{
return FALSE;
}
}
/*
* @ 3D鼠标是否完成初始化
* @ Return: 是否初始化完成
*/
BOOL is_init_3D_Mouse()
{
try
{
if (device == NULL || WM_3DMOUSE == 0)
return FALSE;
SPWbool result = SiIsInitialized();
if (result != TRUE)
return FALSE;
return TRUE;
}
......@@ -46,6 +77,7 @@ void dispose_3D_Mouse()
SiTerminate();
device = NULL;
WM_3DMOUSE = 0;
}
catch (const std::exception&)
{
......
......@@ -38,6 +38,12 @@ extern "C" {
__declspec(dllimport) BOOL init_3D_Mouse(HWND hWnd);
/*
* @ 3D鼠标是否完成初始化
* @ Return: 是否初始化完成
*/
__declspec(dllimport) BOOL is_init_3D_Mouse();
/*
* @ 销毁3D鼠标
*/
__declspec(dllimport) void dispose_3D_Mouse();
......
#include <windows.h>
#include "Navigation3D.h"
#include <iostream>
using namespace std;
//声明函数
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
//主函数WinMain()
int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine, _In_ int nShowCmd)
{
//窗口类名
TCHAR cls_name[] = TEXT("3DMouseTest");
//设计窗口类
WNDCLASSEX wce = { 0 };
wce.cbSize = sizeof(WNDCLASSEX); //结构体大小
wce.style = CS_HREDRAW | CS_VREDRAW; //大小改变,水平和垂直重绘
wce.lpfnWndProc = WindowProc; //窗口回调函数地址
wce.cbClsExtra = 0; //类的附加数据
wce.cbWndExtra = 0; //窗口的附加数据
wce.hInstance = hInstance; //应用程序实例句柄
wce.hIcon = LoadIcon(NULL, IDI_APPLICATION); //大图标
wce.hIconSm = wce.hIcon; //小图标
wce.hCursor = LoadCursor(NULL, IDC_ARROW); //光标
wce.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); //背景色
wce.lpszMenuName = NULL; //菜单
wce.lpszClassName = cls_name; //窗口类的名称
//注册窗口类
//ATOM nres = RegisterClassEx(&wce);
if (FALSE == RegisterClassEx(&wce))
return 1;
//创建窗口
HWND hWnd = CreateWindowEx(
WS_EX_APPWINDOW, //窗口的扩展样式
cls_name, //窗口类名
TEXT("3DMouseTest"), //窗口标题
WS_OVERLAPPEDWINDOW, //窗口风格样式
200, 120, 600, 400, //窗口x,y,宽度,高度
NULL, //父窗口句柄
NULL, //菜单句柄
hInstance, //应用程序实例句柄
NULL); //附加数据
//回调函数要写上默认的处理DefWindowProc,不然创建失败
if (!hWnd)
return 1;
//显示,更新窗口
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
//添加加速键表
HACCEL hAccel = NULL;
/*::LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_ACCELERATOR1);*/
// =======================================================================
// 初始化3D鼠标
three_mouse_global_init();
three_mouse_open_device(hWnd, 1);
// =======================================================================
//消息循环
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(hWnd, hAccel, &msg))//有加速键表时用这,没有就不用
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// =======================================================================
// 销毁3D鼠标
three_mouse_global_dispose();
// =======================================================================
return 0;
}
//窗口消息处理函数
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
ThreeDMouseData* mouse_data = three_mouse_on_message(1, wParam, lParam);
if (mouse_data != NULL && mouse_data->result == TRUE)
{
}
switch (uMsg)
{
case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default: break;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
\ No newline at end of file
......@@ -21,6 +21,13 @@ namespace VIZ.Framework.Core
public extern static bool init_3D_Mouse(IntPtr hWnd);
/// <summary>
/// 3D鼠标是否完成初始化
/// </summary>
/// <returns>3D鼠标是否完成初始化</returns>
[DllImport("VIZ.Framework.Core.Navigation3D.dll")]
public extern static bool is_init_3D_Mouse();
/// <summary>
/// 销毁3D鼠标
/// </summary>
[DllImport("VIZ.Framework.Core.Navigation3D.dll")]
......
......@@ -11,16 +11,29 @@ namespace VIZ.Framework.Core
/// </summary>
public class Navigation3DDataInfo
{
/// <summary>
/// TX 值
/// </summary>
public int tx;
/// <summary>
/// TY 值
/// </summary>
public int ty;
/// <summary>
/// TZ 值
/// </summary>
public int tz;
/// <summary>
/// RX 值
/// </summary>
public int rx;
/// <summary>
/// RY 值
/// </summary>
public int ry;
/// <summary>
/// RZ 值
/// </summary>
public int rz;
}
}
......@@ -43,16 +43,23 @@ namespace VIZ.Framework.Core
{
WindowInteropHelper windowInteropHelper = new WindowInteropHelper(window);
// 初始化3D鼠标
bool init_result = Navigation3DHelper.init_3D_Mouse(windowInteropHelper.Handle);
if (!init_result)
return false;
// 注册窗口消息
HwndSource source = HwndSource.FromHwnd(windowInteropHelper.Handle);
source.AddHook(Hook);
IntPtr handle = windowInteropHelper.Handle;
// 启动初始化3D鼠标任务
ExecuteInitNavigation3D(handle);
// 3秒之后再次执行一次初始化
Task.Run(() =>
{
Task.Delay(3000).Wait();
ExecuteInitNavigation3D(handle);
});
return true;
}
catch (Exception ex)
......@@ -106,5 +113,25 @@ namespace VIZ.Framework.Core
return new IntPtr(1);
}
/// <summary>
/// 执行初始化3D鼠标
/// </summary>
/// <param name="handle">窗口句柄</param>
private static void ExecuteInitNavigation3D(IntPtr handle)
{
try
{
// 销毁3D鼠标
Navigation3DHelper.dispose_3D_Mouse();
// 初始化3D鼠标
Navigation3DHelper.init_3D_Mouse(handle);
}
catch (Exception ex)
{
log.Error(ex);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Core
{
/// <summary>
/// 3D鼠标TCP管理器
/// </summary>
public static class Navigation3DTcpManager
{
/// <summary>
/// 命令
/// </summary>
public static string Command { get; set; }
/// <summary>
/// 值
/// </summary>
public static int Value { get; set; }
/// <summary>
/// 映射值
/// </summary>
public static int MappingValue { get; set; }
}
}
......@@ -91,6 +91,8 @@
<Compile Include="Core\Converter\ByteSizeConverter.cs" />
<Compile Include="Core\Converter\Bool2SolidColorBrushConverter.cs" />
<Compile Include="Core\Converter\StringAppendConverter.cs" />
<Compile Include="Core\Debug\DebugDomain.cs" />
<Compile Include="Core\Debug\DebugMessage.cs" />
<Compile Include="Core\Enum\EnumHelper.cs" />
<Compile Include="Core\Helper\ByteHelper.cs" />
<Compile Include="Core\Helper\CmdHelper.cs" />
......@@ -139,7 +141,6 @@
<Compile Include="Expand\ThreeDMouse\Core\Navigation3DHelper.cs" />
<Compile Include="Expand\ThreeDMouse\Navigation3DDataInfo.cs" />
<Compile Include="Expand\ThreeDMouse\Navigation3DMapping.cs" />
<Compile Include="Expand\ThreeDMouse\Navigation3DTcpManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Expand\SharpDx\RawRectangleFExpand.cs" />
<Compile Include="Expand\SharpDx\SharpDxColorHelper.cs" />
......
using log4net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Management;
using VIZ.Framework.Core;
using VIZ.Framework.Connection;
using VIZ.Framework.Module;
using System.Reflection;
using VIZ.Framework.Domain;
namespace VIZ.Framework.Module
{
/// <summary>
/// 应用程序启动 -- 调试窗口
/// </summary>
public class AppSetup_DebugWindow : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_DebugWindow));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 调试窗口";
/// <summary>
/// 调试窗口
/// </summary>
private DebugWindow DebugWindow;
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
if (ApplicationDomain.IS_DEBUG)
{
WPFHelper.BeginInvoke(() =>
{
this.DebugWindow = new DebugWindow();
this.DebugWindow.Show();
});
}
return true;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
WPFHelper.BeginInvoke(() =>
{
if (this.DebugWindow != null)
{
this.DebugWindow.Close();
}
});
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Connection;
using log4net;
using System.Diagnostics;
using VIZ.Framework.Core;
namespace VIZ.Framework.Module
{
/// <summary>
/// 3D鼠标命令行解释器
/// </summary>
public class Navigation3DCommandProvider : ConnCommandLinePackageProvider
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(Navigation3DCommandProvider));
/// <summary>
/// 3D鼠标命令行解释器
/// </summary>
/// <param name="mappings">映射集合</param>
public Navigation3DCommandProvider(List<Navigation3DMapping> mappings)
{
this.Mappings = mappings;
}
/// <summary>
/// 映射值
/// </summary>
public List<Navigation3DMapping> Mappings { get; private set; }
/// <summary>
/// 执行命令
/// </summary>
/// <param name="info">命令行信息</param>
protected override void Execute(ConnCommandLineInfo info)
{
if (this.Mappings == null || this.Mappings.Count == 0)
return;
string[] args = info.Command.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
string cmd = null;
int value1 = 0;
int value2 = 0;
if (args.Length >= 1)
{
cmd = args[0];
}
if (args.Length >= 2)
{
int.TryParse(args[1], out value1);
}
if (args.Length >= 3)
{
int.TryParse(args[2], out value2);
}
int temp = Math.Abs(value2);
Navigation3DMapping first = this.Mappings.FirstOrDefault();
Navigation3DMapping last = this.Mappings.LastOrDefault();
Navigation3DTcpManager.Command = cmd;
if (temp == 0 || temp < first.MinValue)
{
Navigation3DTcpManager.Value = 0;
Navigation3DTcpManager.MappingValue = 0;
return;
}
if (temp >= last.MaxValue)
{
Navigation3DTcpManager.Value = value2;
Navigation3DTcpManager.MappingValue = (value2 > 0 ? 1 : -1) * last.MappingValue;
return;
}
Navigation3DMapping mapping = this.Mappings.FirstOrDefault(p => temp >= p.MinValue && temp < p.MaxValue);
if (mapping == null)
return;
Navigation3DTcpManager.Value = value2;
Navigation3DTcpManager.MappingValue = (value2 > 0 ? 1 : -1) * mapping.MappingValue;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Connection;
using log4net;
using System.Runtime.Remoting.Messaging;
using VIZ.Framework.Core;
namespace VIZ.Framework.Module
{
/// <summary>
/// 3D鼠标TCP监听器
/// </summary>
public class Navigation3DTcpListener : TcpConnectionListener
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(Navigation3DTcpListener));
/// <summary>
/// 监听器键
/// </summary>
public const string LISTENER_KEY = "Navigation3DTcpListener";
/// <summary>
/// 监听器客户端键
/// </summary>
public const string LISTENER_CLIENT_KEY = "Navigation3DTcpListener_CLIENT";
/// <summary>
/// 3D鼠标TCP监听器
/// </summary>
/// <param name="ip">IP地址</param>
/// <param name="port">端口</param>
/// <param name="mappings">映射集合</param>
public Navigation3DTcpListener(string ip, int port, List<Navigation3DMapping> mappings) : base(ip, port)
{
this.Key = LISTENER_KEY;
this.Mappings = mappings;
}
/// <summary>
/// 映射集合
/// </summary>
public List<Navigation3DMapping> Mappings { get; private set; }
/// <summary>
/// 创建终结点管理器
/// </summary>
/// <param name="tcpClient">TCP客户端</param>
/// <returns>TCP终结点管理器</returns>
protected override TcpEndpointManager CreateEndpointManager(TcpClient tcpClient)
{
TcpEndpointManager manager = new TcpEndpointManager(LISTENER_CLIENT_KEY, tcpClient);
manager.PackageProvider = new Navigation3DCommandProvider(this.Mappings);
return manager;
}
}
}
......@@ -53,6 +53,9 @@
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\VIZ.H2V\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
......@@ -74,12 +77,20 @@
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Page Include="Debug\DebugWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Debug\DebugViewModel.cs" />
<Compile Include="Debug\DebugWindow.xaml.cs">
<DependentUpon>DebugWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
......@@ -98,6 +109,7 @@
<Compile Include="Setup\AppSetupContext.cs" />
<Compile Include="Setup\IAppSetup.cs" />
<Compile Include="Setup\Message\AppShutDownMessage.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_DebugWindow.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_ApplicationSafe.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_Helper.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_CatchUnhandledException.cs" />
......@@ -108,8 +120,6 @@
<Compile Include="Setup\Provider\Load\AppSetup_Monitor.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_ComputerResource.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_Single.cs" />
<Compile Include="ThreeDMouse\TCP\Navigation3DCommandProvider.cs" />
<Compile Include="ThreeDMouse\TCP\Navigation3DTcpListener.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.39" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
</packages>
\ No newline at end of file
......@@ -79,6 +79,24 @@ namespace VIZ.Framework.Storage
public string VIDEO_CLIP_BOX_MASK_COLOR { get; set; }
/// <summary>
/// 剪切框中心轴宽度
/// </summary>
[Ini(Section = "Video", DefaultValue = "2", Type = typeof(double))]
public string VIDEO_CLIP_BOX_CENTER_AXIS_WIDTH { get; set; }
/// <summary>
/// 剪切框中心轴颜色
/// </summary>
[Ini(Section = "Video", DefaultValue = "#FF000000", Type = typeof(RawColor4))]
public string VIDEO_CLIP_BOX_CENTER_AXIS_COLOR { get; set; }
/// <summary>
/// 剪切框中心轴透明度
/// </summary>
[Ini(Section = "Video", DefaultValue = "0.4", Type = typeof(double))]
public string VIDEO_CLIP_BOX_CENTER_AXIS_OPACITY { get; set; }
/// <summary>
/// 视频边线检测多边形区域透明度
/// </summary>
[Ini(Section = "Video", DefaultValue = "0.15", Type = typeof(double))]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment