Example #1
0
 public void StylusUp(RealTimeStylus s,
                      StylusUpData data)
 {
     tabletHandler.TabletLeft = ButtonState.Released;
     if (tabletHandler.PendingTabletUpdate)
     {
         return;
     }
 }
Example #2
0
        /// <summary>
        /// Occurs when the stylus leaves the digitizer surface.
        /// Retrieve the packet array for this stylus and use it to create
        /// a new stoke.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusAsyncPlugin.StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            // Retrieve the packet array from the hashtable using the cursor id as a key.
            int        stylusId = data.Stylus.Id;
            List <int> collected;

            if (!this.m_PacketsTable.TryGetValue(stylusId, out collected))
            {
                // If ink collection was disabled on StylusDown or if the user is erasing,
                // then ignore these packets.
                return;
            }

            int strokeId = this.m_StrokeIdTable[stylusId];

            // Also get the DrawingAttributes which were in effect on StylusDown.
            DrawingAttributes atts = this.m_DrawingAttributesTable[stylusId];

            // Remove this entry from the hash tables since it is no longer needed.
            this.m_PacketsTable.Remove(stylusId);
            this.m_DrawingAttributesTable.Remove(stylusId);

            // Add the newly collected packet data from StylusUp to the array.
            collected.AddRange(data.GetData());

            // Assemble the completed information we'll need to create the stroke.
            int[] packets = collected.ToArray();
            TabletPropertyDescriptionCollection tabletProperties =
                sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);

            // Now that we have the data, we're ready to create the stroke and add it to our Ink object.
            using (Synchronizer.Lock(this)) { // Ensure that this.(RealTime)InkSheetModel aren't changed unexpectedly.
                // If there is no Ink object, then probably the SlideViewer is not looking at a slide,
                // so discard the stroke.  Otherwise, create the stroke from the collected packets.
                // Also discard the stroke if we have no DrawingAttributes.

                if (this.InkSheetModel != null && atts != null)
                {
                    int inkStrokeId;
                    using (Synchronizer.Lock(this.InkSheetModel.Ink.Strokes.SyncRoot)) {
                        Stroke stroke = this.InkSheetModel.Ink.CreateStroke(packets, tabletProperties);
                        stroke.DrawingAttributes = atts.Clone();
                        inkStrokeId = stroke.Id;
                    }
                    // Note that this ink stroke's Id is different from the strokeId used by the RealTimeInkSheetModel.
                    this.InkSheetModel.OnInkAdded(new StrokesEventArgs(new int[] { inkStrokeId }));
                }

                if (this.RealTimeInkSheetModel != null)
                {
                    this.RealTimeInkSheetModel.OnStylusUp(stylusId, strokeId, data.GetData());
                }
            }
        }
Example #3
0
        /// <summary>
        /// Occurs when the stylus leaves 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.StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            int stylusId = data.Stylus.Id;

            // Handle the final stroke
            if (this.collectedPacketsTable.ContainsKey(stylusId))
            {
                this.HandleStroke(stylusId);
                this.RemoveStroke(stylusId);
            }
        }
Example #4
0
 void IStylusSyncPlugin.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     if (_touch.TouchUp != null)
     {
         _form.BeginInvoke((Action)(() =>
         {
             foreach (var arg in GetEvents(data))
             {
                 _touch.TouchUp(sender, arg);
             }
         }));
     }
 }
Example #5
0
        /// <summary>
        /// Occurs when the stylus leaves 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.StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            using (Synchronizer.Lock(this)) {
                this.HandlePackets(data);

                GraphicsPath boundary  = ((GraphicsPath)this.m_SelectionBoundaryTable[data.Stylus.Id]);
                ArrayList    collected = ((ArrayList)this.m_SelectionPointsTable[data.Stylus.Id]);
                Debug.Assert((boundary == null) == (collected == null));
                if (boundary != null)
                {
                    using (Synchronizer.Lock(this)) {
                        if (this.InkSheetModel != null)
                        {
                            Point[] lasso = ((Point[])collected.ToArray(typeof(Point)));

                            using (Synchronizer.Lock(this.InkSheetModel.SyncRoot)) {
                                if (boundary.GetBounds() == RectangleF.Empty || lasso.Length <= 2)
                                {
                                    // Either of the above cases can cause Ink.HitTest to throw an ArgumentException.
                                    this.InkSheetModel.Selection = null;
                                }
                                else
                                {
                                    using (Synchronizer.Lock(this.InkSheetModel.Ink.Strokes.SyncRoot)) {
                                        this.InkSheetModel.Selection = this.InkSheetModel.Ink.HitTest(lasso, 50f);
                                    }
                                }
                            }
                        }
                    }

                    this.m_SelectionPointsTable.Remove(data.Stylus.Id);
                    this.m_SelectionBoundaryTable.Remove(data.Stylus.Id);
                    this.m_Display.Invalidate(Rectangle.Round(boundary.GetBounds(new Matrix(), SelectionBoundaryPenOuter)));
                }
            }
        }
        /// <summary>
        /// Occurs when the stylus leaves the digitizer surface.
        /// Retrieve the packet array for this stylus and use it to create
        /// a new stoke.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        public void StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            // Retrieve the packet array from the hashtable using the cursor id
            // as a key.  Then, clean this entry from the hash since it is no
            // longer needed.
            ArrayList collectedPackets = (ArrayList)myPackets[data.Stylus.Id];

            myPackets.Remove(data.Stylus.Id);

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

            // Create the stroke using the specified drawing attributes.
            int[] packets = (int[])(collectedPackets.ToArray(typeof(int)));
            TabletPropertyDescriptionCollection tabletProperties = myRealTimeStylus.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);

            Stroke stroke = myInk.CreateStroke(packets, tabletProperties);

            if (stroke != null)
            {
                stroke.DrawingAttributes.Color = myDynamicRenderer.DrawingAttributes.Color;
                stroke.DrawingAttributes.Width = myDynamicRenderer.DrawingAttributes.Width;
            }
        }
Example #7
0
 // Pen-up notification handler.
 // Decrements finger-down counter.
 //      sender      RTS event sender object
 //      data        event arguments
 public void StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     --cntContacts;  // Decrement finger-down counter
 }
Example #8
0
 /// <summary>
 /// Occurs when the stylus leaves 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.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     this.HandlePackets(sender, data);
 }
 /// <summary>
 /// Occurs when the stylus leaves 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.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     this.m_Core.StylusUp(data.Stylus.Id, 0, data.GetData());
 }
        /// <summary>
        /// Occurs when the stylus leaves the digitizer surface.
        /// Retrieve the packet array for this stylus and use it to create
        /// a new stoke.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusAsyncPlugin.StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            // Retrieve the packet array from the hashtable using the cursor id as a key.
            int stylusId = data.Stylus.Id;
            List<int> collected;
            if (!this.m_PacketsTable.TryGetValue(stylusId, out collected)) {
                // If ink collection was disabled on StylusDown or if the user is erasing,
                // then ignore these packets.
                return;
            }

            int strokeId = this.m_StrokeIdTable[stylusId];

            // Also get the DrawingAttributes which were in effect on StylusDown.
            DrawingAttributes atts = this.m_DrawingAttributesTable[stylusId];

            // Remove this entry from the hash tables since it is no longer needed.
            this.m_PacketsTable.Remove(stylusId);
            this.m_DrawingAttributesTable.Remove(stylusId);

            // Add the newly collected packet data from StylusUp to the array.
            collected.AddRange(data.GetData());

            // Assemble the completed information we'll need to create the stroke.
            int[] packets = collected.ToArray();
            TabletPropertyDescriptionCollection tabletProperties =
                sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);

            // Now that we have the data, we're ready to create the stroke and add it to our Ink object.
            using(Synchronizer.Lock(this)) { // Ensure that this.(RealTime)InkSheetModel aren't changed unexpectedly.
                // If there is no Ink object, then probably the SlideViewer is not looking at a slide,
                // so discard the stroke.  Otherwise, create the stroke from the collected packets.
                // Also discard the stroke if we have no DrawingAttributes.

                if(this.InkSheetModel != null && atts != null) {
                    int inkStrokeId;
                    using (Synchronizer.Lock(this.InkSheetModel.Ink.Strokes.SyncRoot)) {
                        Stroke stroke = this.InkSheetModel.Ink.CreateStroke(packets, tabletProperties);
                        stroke.DrawingAttributes = atts.Clone();
                        inkStrokeId = stroke.Id;
                    }
                    // Note that this ink stroke's Id is different from the strokeId used by the RealTimeInkSheetModel.
                    this.InkSheetModel.OnInkAdded(new StrokesEventArgs(new int[] { inkStrokeId }));
                }

                if(this.RealTimeInkSheetModel != null) {
                    this.RealTimeInkSheetModel.OnStylusUp(stylusId, strokeId, data.GetData());
                }
            }
        }
 public void StylusUp( RealTimeStylus sender, StylusUpData data )
 {
     Debug.Assert( PendingStylusStroke != null );
     lock ( StylusStrokes ) {
         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);
         }
         PendingStylusStroke.Completed = true;
         PendingStylusStroke = null;
     }
     Form.Invalidate();
 }
 public void StylusUp(RealTimeStylus sender, StylusUpData data)
 {
 }
Example #13
0
        public void StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            if(touchesOnScreen.ContainsKey(data.Stylus.Id)){
                touchesOnScreen.Remove(data.Stylus.Id);
            }
            label1.Text = "u " + tangiblePattern.Count.ToString();
            Tablet tablet = sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId);
            switch (tablet.DeviceKind)
            {
                case TabletDeviceKind.Mouse:

                case TabletDeviceKind.Pen:
                    if (prevPoint == null)
                        return;
                    prevPoint.x = 0;
                    prevPoint.y = 0;
                    break;
                case TabletDeviceKind.Touch:
                    TRPoint touchPoint = new TRPoint();
                    touchPoint.x = data[0];
                    touchPoint.y = data[1];

                    if (TangibleRecognizerTab.SelectedTab.Equals(DrawingTab))
                    {
                        recognizer.touchEnded(data.Stylus.Id, touchPoint);
                    }

                    break;
            }
               /* ArrayList collectedPackets = (ArrayList)myPackets[data.Stylus.Id];
            myPackets.Remove(data.Stylus.Id);

            collectedPackets.AddRange(data.GetData());

            int[] packets = (int[])(collectedPackets.ToArray(typeof(int)));
            TabletPropertyDescriptionCollection tabletProperties =
                myRealTimeStylus.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);
            Stroke stroke = myInk.CreateStroke(packets, tabletProperties);
            if (stroke != null)
            {
                stroke.DrawingAttributes.Color = myDynamicRenderer.DrawingAttributes.Color;
                stroke.DrawingAttributes.Width = myDynamicRenderer.DrawingAttributes.Width;
            }*/
        }
 /// <summary>
 /// Occurs when the stylus leaves the digitizer surface.
 /// Use this notification 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 StylusUp(RealTimeStylus sender,  StylusUpData data)
 {
     ModifyPacketData(data);
 }
Example #15
0
 void IStylusSyncPlugin.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
 }
        /// <summary>
        /// Occurs when the stylus leaves 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.StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            int stylusId = data.Stylus.Id;

            // Handle the final stroke
            if (this.collectedPacketsTable.ContainsKey(stylusId)) {
                this.HandleStroke(stylusId);
                this.RemoveStroke(stylusId);
            }
        }
Example #17
0
 /// <summary>
 /// Occurs when the stylus leaves 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.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     this.HandlePackets(sender, data);
 }
 void IStylusSyncPlugin.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
 }
Example #19
0
 // Token: 0x06002FCB RID: 12235
 // RVA: 0x00023865 File Offset: 0x00021A65
 public void StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     this.class571_0.buttonState_0 = 0;
 }
 // Pen-up notification handler.
 // Decrements finger-down counter.
 //      sender      RTS event sender object
 //      data        event arguments
 public void StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     --cntContacts;  // Decrement finger-down counter
 }
Example #21
0
 /// <summary>
 /// Occurs when the stylus leaves the digitizer surface.
 /// Retrieve the packet array for this stylus and use it to create
 /// a new stoke.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     this.ModifyPacketData(data);
 }
Example #22
0
 public void StylusUp(RealTimeStylus sender, StylusUpData data)
 {
 }
Example #23
0
 /// <summary>
 /// Occurs when the stylus leaves 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.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     this.m_Core.StylusUp(data.Stylus.Id, 0, data.GetData());
 }
Example #24
0
 /// <summary>
 /// Occurs when the stylus leaves the digitizer surface.
 /// Use this notification 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 StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     ModifyPacketData(data);
 }
Example #25
0
        /// <summary>
        /// Occurs when the stylus leaves 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.StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            using(Synchronizer.Lock(this)) {
                this.HandlePackets(data);

                GraphicsPath boundary = ((GraphicsPath) this.m_SelectionBoundaryTable[data.Stylus.Id]);
                ArrayList collected = ((ArrayList) this.m_SelectionPointsTable[data.Stylus.Id]);
                Debug.Assert((boundary == null) == (collected == null));
                if(boundary != null) {
                    using(Synchronizer.Lock(this)) {
                        if(this.InkSheetModel != null) {
                            Point[] lasso = ((Point[]) collected.ToArray(typeof(Point)));

                            using(Synchronizer.Lock(this.InkSheetModel.SyncRoot)) {
                                if (boundary.GetBounds() == RectangleF.Empty || lasso.Length <= 2) {
                                    // Either of the above cases can cause Ink.HitTest to throw an ArgumentException.
                                    this.InkSheetModel.Selection = null;
                                } else {
                                    using (Synchronizer.Lock(this.InkSheetModel.Ink.Strokes.SyncRoot)) {
                                        this.InkSheetModel.Selection = this.InkSheetModel.Ink.HitTest(lasso, 50f);
                                    }
                                }
                            }
                        }
                    }

                    this.m_SelectionPointsTable.Remove(data.Stylus.Id);
                    this.m_SelectionBoundaryTable.Remove(data.Stylus.Id);
                    this.m_Display.Invalidate(Rectangle.Round(boundary.GetBounds(new Matrix(), SelectionBoundaryPenOuter)));
                }
            }
        }
        /// <summary>
        /// Occurs when the stylus leaves the digitizer surface.
        /// Retrieve the packet array for this stylus and use it to create
        /// a new stoke.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        public void StylusUp(RealTimeStylus sender, StylusUpData data)
        {
            // Retrieve the packet array from the hashtable using the cursor id
            // as a key.  Then, clean this entry from the hash since it is no
            // longer needed.
            ArrayList collectedPackets = (ArrayList)myPackets[data.Stylus.Id];
            myPackets.Remove(data.Stylus.Id);

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

            // Create the stroke using the specified drawing attributes.
            int[] packets = (int[])(collectedPackets.ToArray(typeof(int)));
            TabletPropertyDescriptionCollection tabletProperties = myRealTimeStylus.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);

            Stroke stroke = myInk.CreateStroke(packets, tabletProperties);
            if (stroke != null)
            {
                stroke.DrawingAttributes.Color = myDynamicRenderer.DrawingAttributes.Color;
                stroke.DrawingAttributes.Width = myDynamicRenderer.DrawingAttributes.Width;
            }
        }
 /// <summary>
 /// Occurs when the stylus leaves the digitizer surface.
 /// Retrieve the packet array for this stylus and use it to create
 /// a new stoke.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.StylusUp(RealTimeStylus sender, StylusUpData data)
 {
     this.ModifyPacketData(data);
 }