private void ImageSpotsEditorView_MouseDown(object sender, MouseEventArgs e) { if (p_image == null) { return; } Point rel = p_image.AbsToRel(showRect, new Point(e.X, e.Y)); p_movedSpot = null; p_resizedSpot = null; MNReferencedSpot lastSpot = CurrentSpot; CurrentSpot = null; if (e.Button == System.Windows.Forms.MouseButtons.Left) { if (p_image.HasSpots()) { foreach (MNReferencedSpot spot in p_image.SafeSpots) { //if (lastSpot != null && spot == lastSpot) { for (int anchorIndex = 0; anchorIndex < 2; anchorIndex++) { Point A = spot.AbsoluteAnchor(showRect, anchorIndex); Debugger.Log(0, "", "Anchor " + anchorIndex + ": " + A.X + ", " + A.Y + "; e:" + e.X + ", " + e.Y + "\n"); if (Math.Abs(A.X - e.X) <= 6 && Math.Abs(A.Y - e.Y) <= 6) { CurrentSpot = spot; p_resizedSpot = spot; p_resizedAnchor = anchorIndex; break; } } } if (p_resizedSpot != null) { break; } if (spot.Contains(rel)) { CurrentSpot = spot; p_movedSpot = spot; Point A = spot.AbsoluteCenter(showRect); p_moveCenterCorr = new Point(e.X - A.X, e.Y - A.Y); MNNotificationCenter.BroadcastMessage(p_image, "ObjectSelected", spot); break; } } } } else if (e.Button == System.Windows.Forms.MouseButtons.Right) { } }
private void addNewRectToolStripMenuItem_Click(object sender, EventArgs e) { if (p_image == null) { return; } MNReferencedSpot spot = CreateSpot(MNRefSpotShape.Rectangle); p_image.Modified = true; p_image.SafeSpots.Add(spot); Invalidate(); }
private void addTriangleTaggedAreaToolStripMenuItem_Click(object sender, EventArgs e) { if (p_image == null) { return; } MNReferencedSpot spot = CreateSpot(MNRefSpotShape.Triangle); spot.ContentType = SMContentType.TaggedArea; p_image.SafeSpots.Add(spot); p_image.Modified = true; Invalidate(); }
private MNReferencedSpot CreateSpot(MNRefSpotShape shape) { MNReferencedSpot spot; spot = new MNReferencedSpot(); spot.Shape = shape; spot.Center = lastRelUp; spot.AnchorA = new Point(10, 0); spot.AnchorB = new Point(0, 10); DialogSpotName d = new DialogSpotName(); d.ShowDialog(); spot.Name = d.SpotText; spot.ContentId = d.SpotText; spot.ContentType = SMContentType.Audio; return(spot); }
private void addNewRectToolStripMenuItem_Click(object sender, EventArgs e) { if (p_image == null) { return; } MNReferencedSpot spot = new MNReferencedSpot(); spot.Shape = MNRefSpotShape.Rectangle; spot.Center = lastRelUp; spot.AnchorA = new Point(10, 0); spot.AnchorB = new Point(0, 10); p_image.SafeSpots.Add(spot); p_image.Modified = true; Invalidate(); }
private void ImageSpotsEditorView_MouseUp(object sender, MouseEventArgs e) { if (p_image == null) { return; } if (e.Button == System.Windows.Forms.MouseButtons.Left) { p_movedSpot = null; p_resizedSpot = null; if (p_image.HasSpots()) { } } else if (e.Button == System.Windows.Forms.MouseButtons.Right) { lastPointUp = new Point(e.X, e.Y); lastRelUp = p_image.AbsToRel(showRect, lastPointUp); contextMenuStrip1.Show(PointToScreen(lastPointUp)); } }