Beispiel #1
0
        /// <summary>
        /// Returns the default digitizing context, with useful context overrides.
        /// </summary>
        /// <param name="options_I">caller's options; OR'd into context options</param>
        /// <returns>A valid context object or null on error.</returns>
        public static CWintabContext GetDefaultDigitizingContext(ECTXOptionValues options_I = 0)
        {
            // Send all possible data bits (not including extended data).
            // This is redundant with CWintabContext initialization, which
            // also inits with PK_PKTBITS_ALL.
            uint PACKETDATA = (uint)EWintabPacketBit.PK_PKTBITS_ALL;  // The Full Monty
            uint PACKETMODE = (uint)EWintabPacketBit.PK_BUTTONS;

            CWintabContext context = GetDefaultContext(EWTICategoryIndex.WTI_DEFCONTEXT);

            if (context != null)
            {
                // Add digitizer-specific context tweaks.
                context.PktMode = 0;        // all data in absolute mode (set EWintabPacketBit bit(s) for relative mode)
                context.SysMode = false;    // system cursor tracks in absolute mode (zero)

                // Add caller's options.
                context.Options |= (uint)options_I;

                // Set the context data bits.
                context.PktData   = PACKETDATA;
                context.PktMode   = PACKETMODE;
                context.MoveMask  = PACKETDATA;
                context.BtnUpMask = context.BtnDnMask;
            }

            return(context);
        }
Beispiel #2
0
        /// <summary>
        /// Returns the default system context, with useful context overrides.
        /// </summary>
        /// <param name="options_I">caller's options; OR'd into context options</param>
        /// <returns>A valid context object or null on error.</returns>
        public static CWintabContext GetDefaultSystemContext(ECTXOptionValues options_I = 0)
        {
            // Send all possible data bits (not including extended data).
            // This is redundant with CWintabContext initialization, which
            // also inits with PK_PKTBITS_ALL.
            uint PACKETDATA = (uint)EWintabPacketBit.PK_PKTBITS_ALL;  // The Full Monty
            uint PACKETMODE = (uint)EWintabPacketBit.PK_BUTTONS;

            CWintabContext context = GetDefaultContext(EWTICategoryIndex.WTI_DEFSYSCTX);

            if (context != null)
            {
                // TODO: Add system-specific context tweaks.

                // Add caller's options.
                context.Options |= (uint)options_I;

                // Make sure we get data packet messages.
                context.Options |= (uint)ECTXOptionValues.CXO_MESSAGES;

                // Set the context data bits.
                context.PktData   = PACKETDATA;
                context.PktMode   = PACKETMODE;
                context.MoveMask  = PACKETDATA;
                context.BtnUpMask = context.BtnDnMask;
            }

            return(context);
        }
Beispiel #3
0
        /// <summary>
        /// Returns the default digitizing context, with useful context overrides. 
        /// </summary>
        /// <param name="options_I">caller's options; OR'd into context options</param>
        /// <returns>A valid context object or null on error.</returns>
        public static CWintabContext GetDefaultDigitizingContext(ECTXOptionValues options_I = 0)
        {
            // Send all possible data bits (not including extended data).
            // This is redundant with CWintabContext initialization, which
            // also inits with PK_PKTBITS_ALL.
            uint PACKETDATA = (uint)EWintabPacketBit.PK_PKTBITS_ALL;  // The Full Monty
            uint PACKETMODE = (uint)EWintabPacketBit.PK_BUTTONS;

            CWintabContext context = GetDefaultContext(EWTICategoryIndex.WTI_DEFCONTEXT);

            if ( context != null )
            {
                // Add digitizer-specific context tweaks.
                context.PktMode = 0;        // all data in absolute mode (set EWintabPacketBit bit(s) for relative mode)
                context.SysMode = false;    // system cursor tracks in absolute mode (zero)

                // Add caller's options.
                context.Options |= (uint)options_I;

                // Set the context data bits.
                context.PktData = PACKETDATA;
                context.PktMode = PACKETMODE;
                context.MoveMask = PACKETDATA;
                context.BtnUpMask = context.BtnDnMask;
            }

            return context;
        }
Beispiel #4
0
        /// <summary>
        /// デフォルトのコンテキスト情報を取得する
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static WintabLogContext GetDefaultSystemContext(ECTXOptionValues options)
        {
            // パケットのサイズは、指定したビットによって可変となる。
            // 全てのビットを指定し、パケットのサイズを固定にする。
            uint pktData = (uint)EWintabPacketBit.PK_PKTBITS_ALL;
            uint pktMode = (uint)EWintabPacketBit.PK_BUTTONS;

            // デフォルトのコンテキストの取得
            WintabLogContext context = new WintabLogContext();

            // メモリの確保
            IntPtr pContext = WintabMemoryUtility.AllocUnmanagedBuffer(context);

            try
            {
                uint sz = WintabFunctions.WTInfoA((uint)EWTICategoryIndex.WTI_DEFSYSCTX, 0, pContext);
                context = WintabMemoryUtility.MarshalUnmanagedBuffer <WintabLogContext>(pContext, sz);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("GetDefaultSystemContext : " + ex.Message);
                throw ex;
            }
            finally
            {
                // メモリの開放を忘れないこと
                WintabMemoryUtility.FreeUnmanagedBuffer(pContext);
            }

            // パケットメッセージを受信するために指定
            context.lcOptions |= (uint)ECTXOptionValues.CXO_MESSAGES;
            // 指定されたオプション
            context.lcOptions |= (uint)options;

            // コンテキストのビット設定
            context.lcPktData   = pktData;
            context.lcPktMode   = pktMode;
            context.lcMoveMask  = pktData;
            context.lcBtnUpMask = context.lcBtnDnMask;

            return(context);
        }
        /// <summary>
        /// Returns the default system context, with useful context overrides.
        /// </summary>
        /// <param name="options_I">caller's options; OR'd into context options</param>
        /// <returns>A valid context object or null on error.</returns>
        public static CWintabContext GetDefaultSystemContext(ECTXOptionValues options_I = 0)
        {
            // Send all possible data bits (not including extended data).
            // This is redundant with CWintabContext initialization, which
            // also inits with PK_PKTBITS_ALL.
            uint PACKETDATA = (uint)EWintabPacketBit.PK_PKTBITS_ALL;  // The Full Monty
            uint PACKETMODE = (uint)EWintabPacketBit.PK_BUTTONS;

            CWintabContext context = GetDefaultContext(EWTICategoryIndex.WTI_DEFSYSCTX);

            if (context != null)
            {
                // TODO: Add system-specific context tweaks.

                // Add caller's options.
                context.Options |= (uint)options_I;

                // Make sure we get data packet messages.
                context.Options |= (uint) ECTXOptionValues.CXO_MESSAGES;

                // Set the context data bits.
                context.PktData = PACKETDATA;
                context.PktMode = PACKETMODE;
                context.MoveMask = PACKETDATA;
                context.BtnUpMask = context.BtnDnMask;
            }

            return context;
        }