Example #1
0
        // Pen-down notification handler.
        // Sets the color for the newly started stroke and increments finger-down counter.
        //      sender      RTS event sender object
        //      data        event arguments
        public void StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // Set new stroke color to the DrawingAttributes of the DynamicRenderer
            // If there are no fingers down, this is a primary contact
            dynamicRenderer.DrawingAttributes.Color = touchColor.GetColor(cntContacts == 0);

            ++cntContacts;  // Increment finger-down counter
        }
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// Allocate a new array to store the packet data for this stylus.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        public void StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // Allocate an empty array to store the packet data that will be
            // collected for this stylus.
            ArrayList collectedPackets = new ArrayList();

            // Add the packet data from StylusDown to the array
            collectedPackets.AddRange(data.GetData());

            // Insert the array into a hashtable using the stylus id as a key.
            myPackets.Add(data.Stylus.Id, collectedPackets);
        }
Example #3
0
 void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
 {
     if (_touch.TouchDown != null)
     {
         _form.BeginInvoke((Action)(() =>
         {
             foreach (var arg in GetEvents(data))
             {
                 _touch.TouchDown(sender, arg);
             }
         }));
     }
 }
Example #4
0
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            //Debug.WriteLine("StylusDown");
            Tablet currentTablet = sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId);

            if (currentTablet.DeviceKind == TabletDeviceKind.Touch)
            {
                // The stylus id
                int stylusId = data.Stylus.Id;

                // Store the packets in the collected packets
                List <int> collected = new List <int>(data.GetData());
                this.collectedPacketsTable[stylusId] = collected;

                // Store the tablet properties
                this.tabletPropertiesTable[stylusId] = sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);
            }
        }
Example #5
0
        // Copied from the RealTimeStylus InkCollection example from
        // the Microsoft Tablet PC API Sample Applications collection.

        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // An inverted stylus is reserved for the eraser.
            if (data.Stylus.Inverted)
            {
                return;
            }
            // Ignore if a touch input
            if (m_TouchSupported)
            {
                try {
                    if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Touch)
                    {
                        return;
                    }
                }
                catch {
                    m_TouchSupported = false;
                }
            }

            this.m_Core.StylusDown(data.Stylus.Id, 0, data.GetData(),
                                   sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId));
        }
Example #6
0
        // Based on the RealTimeStylus examples from the Microsoft Tablet PC API Sample Applications collection.

        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            using (Synchronizer.Lock(this)) {
                if (!this.Enabled)
                {
                    return;
                }

                // An inverted stylus is reserved for the eraser.
                if (data.Stylus.Inverted)
                {
                    return;
                }

                // Ignore if a touch input
                if (m_TouchSupported)
                {
                    try {
                        if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Touch)
                        {
                            return;
                        }
                    }
                    catch {
                        m_TouchSupported = false;
                    }
                }

                // Replace the existing selection boundary.
                this.m_SelectionPointsTable[data.Stylus.Id]   = new ArrayList();
                this.m_SelectionBoundaryTable[data.Stylus.Id] = new GraphicsPath();
                this.m_SelectionPreviousPointTable.Remove(data.Stylus.Id);

                this.HandlePackets(data);
            }
        }
        // Copied from the RealTimeStylus InkCollection example from
        // the Microsoft Tablet PC API Sample Applications collection.
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// Allocate a new array to store the packet data for this stylus.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusAsyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // An inverted stylus is reserved for the eraser.
            if(data.Stylus.Inverted) return;

            int stylusId = data.Stylus.Id;

            // Allocate an empty array to store the packet data that will be
            // collected for this stylus.
            List<int> collectedPackets = new List<int>();

            // Add the packet data from StylusDown to the array
            collectedPackets.AddRange(data.GetData());

            // Insert the array into a hashtable using the stylus id as a key.
            this.m_PacketsTable[stylusId] = collectedPackets;

            // Also store the current DrawingAttributes.  This is necessary because the default
            // DynamicRenderer (which will be used in conjunction with the ink stored by this collector)
            // only updates its DrawingAttributes on StylusDown.
            this.m_DrawingAttributesTable[stylusId] = this.m_DrawingAttributes;

            // Increment the current stroke id.
            int strokeId;
            if (!this.m_StrokeIdTable.TryGetValue(stylusId, out strokeId))
                this.m_StrokeIdTable[stylusId] = (strokeId = 0);
            else this.m_StrokeIdTable[stylusId] = ++strokeId;

            // And send the packets to anybody who's listening to the RealTimeInk.
            using(Synchronizer.Lock(this)) {
                if(this.RealTimeInkSheetModel != null) {
                    TabletPropertyDescriptionCollection tabletProperties =
                        sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);
                    this.RealTimeInkSheetModel.OnStylusDown(stylusId, strokeId, data.GetData(), tabletProperties);
                }
            }
        }
        // Copied from the RealTimeStylus InkCollection example from
        // the Microsoft Tablet PC API Sample Applications collection.
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // An inverted stylus is reserved for the eraser.
            if(data.Stylus.Inverted) return;

            this.m_Core.StylusDown(data.Stylus.Id, 0, data.GetData(),
                sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId));
        }
 public void StylusDown( RealTimeStylus sender, StylusDownData data )
 {
     if (!StylusStates.ContainsKey(data.Stylus)) StylusStates.Add( data.Stylus, new StylusState(data.Stylus) );
     var state = StylusStates[data.Stylus];
     Debug.Assert( PendingStylusStroke == null );
     PendingStylusStroke = new Stroke() { MouseButtons = state.Barrel ? MouseButtons.Right : MouseButtons.Left };
     for ( int i=0 ; i<data.Count ; i += data.PacketPropertyCount ) {
         var point = new PointF(data[i+0]*FormDpiX/2540f, data[i+1]*FormDpiY/2540f);
         if ( point != PendingStylusStroke.Points.LastOrDefault() ) PendingStylusStroke.Points.Add(point);
     }
     lock ( StylusStrokes ) StylusStrokes.Enqueue(PendingStylusStroke);
     Form.Invalidate();
 }
Example #10
0
        // Based on the RealTimeStylus examples from the Microsoft Tablet PC API Sample Applications collection.
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            using(Synchronizer.Lock(this)) {
                if(!this.Enabled) return;

                // An inverted stylus is reserved for the eraser.
                if(data.Stylus.Inverted) return;

                // Replace the existing selection boundary.
                this.m_SelectionPointsTable[data.Stylus.Id] = new ArrayList();
                this.m_SelectionBoundaryTable[data.Stylus.Id] = new GraphicsPath();
                this.m_SelectionPreviousPointTable.Remove(data.Stylus.Id);

                this.HandlePackets(data);
            }
        }
Example #11
0
 public void StylusDown(RealTimeStylus s,
                        StylusDownData data)
 {
     tabletHandler.PendingTabletUpdate = true;
     tabletHandler.TabletLeft          = ButtonState.Pressed;
 }
 public void StylusDown(RealTimeStylus sender, StylusDownData data)
 {
 }
Example #13
0
        public void StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            Tablet tablet = sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId);
            TRPoint point = new TRPoint();
            point.x = data[0]; point.y = data[1];
            // Since the packet data is in Ink Space coordinates, we need to convert to Pixels...
            point.x = (int)Math.Round((float)point.x * (float)graphics.DpiX / 2540.0F);
            point.y = (int)Math.Round((float)point.y * (float)graphics.DpiY / 2540.0F);
            switch (tablet.DeviceKind)
            {
                case TabletDeviceKind.Mouse:

                case TabletDeviceKind.Pen:
                    if (TangibleRecognizerTab.SelectedTab.Equals(LearningPhaseTab))
                    {
                        if (Math.Abs(point.x - leftLineX) <= 10)
                        {
                            prevPoint = point;
                        }
                        else if (Math.Abs(point.x - rightLineX) <= 10)
                        {
                            prevPoint = point;
                        }
                        else if (Math.Abs(point.y - topLineY) <= 10)
                        {
                            prevPoint = point;
                        }
                        else if (Math.Abs(point.y - bottomLineY) <= 10)
                        {
                            prevPoint = point;
                        }
                    }
                    break;
                case TabletDeviceKind.Touch:
                    TRPoint touchPoint = new TRPoint();
                    touchPoint.x = data[0];
                    touchPoint.y = data[1];

                    touchesOnScreen.Add(data.Stylus.Id, touchPoint);
                    tangiblePattern = (Hashtable) touchesOnScreen.Clone();
                    label1.Text = tangiblePattern.Count.ToString();
                    if (TangibleRecognizerTab.SelectedTab.Equals(DrawingTab))
                    {
                        recognizer.touchBegan(data.Stylus.Id, touchPoint);
                        VectorInt recognizedIndex = recognizer.getRecognizedObject();
                        if (recognizedIndex.Count > 0)
                        {
                            drawRecognizedObject(recognizedIndex);
                        }

                    }
                    break;
            }
        }
        // Pen-down notification handler.
        // Sets the color for the newly started stroke and increments finger-down counter.
        //      sender      RTS event sender object
        //      data        event arguments
        public void StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // Set new stroke color to the DrawingAttributes of the DynamicRenderer
            // If there are no fingers down, this is a primary contact
            dynamicRenderer.DrawingAttributes.Color = touchColor.GetColor(cntContacts == 0);

            ++cntContacts;  // Increment finger-down counter
        }
Example #15
0
 void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
 {
 }
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            //Debug.WriteLine("StylusDown");
            Tablet currentTablet = sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId);
            if (currentTablet.DeviceKind == TabletDeviceKind.Touch) {
                // The stylus id
                int stylusId = data.Stylus.Id;

                // Store the packets in the collected packets
                List<int> collected = new List<int>(data.GetData());
                this.collectedPacketsTable[stylusId] = collected;

                // Store the tablet properties
                this.tabletPropertiesTable[stylusId] = sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);
            }
        }
 // Based on the RealTimeStylus Packet Filter example from
 // the Microsoft Tablet PC API Sample Applications collection.
 /// <summary>
 /// Occurs when the stylus touches the digitizer surface.
 /// Allocate a new array to store the packet data for this stylus.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
 {
     this.ModifyPacketData(data);
 }
 void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
 {
 }
Example #19
0
 // Token: 0x06002FCA RID: 12234
 // RVA: 0x0002384B File Offset: 0x00021A4B
 public void StylusDown(RealTimeStylus sender, StylusDownData data)
 {
     this.class571_0.bool_1 = true;
     this.class571_0.buttonState_0 = 1;
 }
Example #20
0
 // Based on the RealTimeStylus examples from the Microsoft Tablet PC API Sample Applications collection.
 /// <summary>
 /// Occurs when the stylus touches the digitizer surface.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
 {
     this.HandlePackets(sender, data);
 }
 /// <summary>
 /// Occurs when the stylus touches the digitizer surface.
 /// Use this notificaton to constrain the packet data within 
 /// a specified rectangle.  
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 public void StylusDown(RealTimeStylus sender,  StylusDownData data)
 {
     ModifyPacketData(data);
 }
Example #22
0
        // Based on the RealTimeStylus examples from the Microsoft Tablet PC API Sample Applications collection.

        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            this.HandlePackets(sender, data);
        }
Example #23
0
        // Based on the RealTimeStylus Packet Filter example from
        // the Microsoft Tablet PC API Sample Applications collection.

        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// Allocate a new array to store the packet data for this stylus.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            this.ModifyPacketData(data);
        }
Example #24
0
 public void StylusDown(RealTimeStylus sender, StylusDownData data)
 {
 }
        // Copied from the RealTimeStylus InkCollection example from
        // the Microsoft Tablet PC API Sample Applications collection.
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // An inverted stylus is reserved for the eraser.
            if(data.Stylus.Inverted) return;
            // Ignore if a touch input
            if (m_TouchSupported) {
                try {
                    if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Touch)
                        return;
                }
                catch {
                    m_TouchSupported = false;
                }
            }

            this.m_Core.StylusDown(data.Stylus.Id, 0, data.GetData(),
                sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId));
        }
Example #26
0
 /// <summary>
 /// Occurs when the stylus touches the digitizer surface.
 /// Use this notificaton to constrain the packet data within
 /// a specified rectangle.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 public void StylusDown(RealTimeStylus sender, StylusDownData data)
 {
     ModifyPacketData(data);
 }
Example #27
0
        // Copied from the RealTimeStylus InkCollection example from
        // the Microsoft Tablet PC API Sample Applications collection.

        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// Allocate a new array to store the packet data for this stylus.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusAsyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // An inverted stylus is reserved for the eraser.
            if (data.Stylus.Inverted)
            {
                return;
            }
            // Ignore if a touch input;
            if (m_TouchSupported)
            {
                try {
                    if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Touch)
                    {
                        return;
                    }
                }
                catch {
                    m_TouchSupported = false;
                }
            }

            int stylusId = data.Stylus.Id;


            // Allocate an empty array to store the packet data that will be
            // collected for this stylus.
            List <int> collectedPackets = new List <int>();

            // Add the packet data from StylusDown to the array
            collectedPackets.AddRange(data.GetData());

            // Insert the array into a hashtable using the stylus id as a key.
            this.m_PacketsTable[stylusId] = collectedPackets;

            // Also store the current DrawingAttributes.  This is necessary because the default
            // DynamicRenderer (which will be used in conjunction with the ink stored by this collector)
            // only updates its DrawingAttributes on StylusDown.
            this.m_DrawingAttributesTable[stylusId] = this.m_DrawingAttributes;

            // Increment the current stroke id.
            int strokeId;

            if (!this.m_StrokeIdTable.TryGetValue(stylusId, out strokeId))
            {
                this.m_StrokeIdTable[stylusId] = (strokeId = 0);
            }
            else
            {
                this.m_StrokeIdTable[stylusId] = ++strokeId;
            }

            // And send the packets to anybody who's listening to the RealTimeInk.
            using (Synchronizer.Lock(this)) {
                if (this.RealTimeInkSheetModel != null)
                {
                    TabletPropertyDescriptionCollection tabletProperties =
                        sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);
                    this.RealTimeInkSheetModel.OnStylusDown(stylusId, strokeId, data.GetData(), tabletProperties);
                }
            }
        }
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// Allocate a new array to store the packet data for this stylus.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        public void StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            // Allocate an empty array to store the packet data that will be
            // collected for this stylus.
            ArrayList collectedPackets = new ArrayList();

            // Add the packet data from StylusDown to the array
            collectedPackets.AddRange(data.GetData());

            // Insert the array into a hashtable using the stylus id as a key.
            myPackets.Add(data.Stylus.Id, collectedPackets);
        }
Example #29
0
        // Based on the RealTimeStylus examples from the Microsoft Tablet PC API Sample Applications collection.
        /// <summary>
        /// Occurs when the stylus touches the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data)
        {
            using(Synchronizer.Lock(this)) {
                if(!this.Enabled) return;

                // An inverted stylus is reserved for the eraser.
                if(data.Stylus.Inverted) return;

                // Ignore if a touch input
                if (m_TouchSupported) {
                    try {
                        if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Touch)
                            return;
                    }
                    catch {
                        m_TouchSupported = false;
                    }
                }

                // Replace the existing selection boundary.
                this.m_SelectionPointsTable[data.Stylus.Id] = new ArrayList();
                this.m_SelectionBoundaryTable[data.Stylus.Id] = new GraphicsPath();
                this.m_SelectionPreviousPointTable.Remove(data.Stylus.Id);

                this.HandlePackets(data);
            }
        }