private void RC3_MouseDoubleClick(object sender, MouseEventArgs e) { Song song = Global.Instance.Song; if (song == null) { return; } if ((CurrOver != null) && (CurrOver.HasProperties)) { endselection(); endhover(); prvover = null; CurrOver.ShowDialog(Global.Instance.Song); // show propr dialog //var dlg = CurrOver.PropertyWindow(); ////dlg.FormBorderStyle = FormBorderStyle.None; //dlg.MaximizeBox = false; //dlg.MinimizeBox = false; //dlg.StartPosition = FormStartPosition.CenterScreen; //dlg.ShowDialog(); } }
protected virtual VizCmd CmdCopy(VizCmd vizCmd) { //Viz viz = (Viz)JsonConvert.DeserializeObject((string)(vizCmd.obj), typeof(Lyric)); Viz viz = vizCmd.viz; viz.ResetPoints(Global.Instance.Song); Global.Instance.Song.Vizs.Add(viz); vizCmd.cmd = Cmd.Delete; return(vizCmd); }
private void CntxtMenu_Click(object sender, EventArgs e) { ToolStripMenuItem tsmi = (ToolStripMenuItem)sender; CntxtMenuItem cmi = (CntxtMenuItem)tsmi.Tag; Viz viz = (Viz)tsmi.Owner.Tag; var does = cmi.Handler(viz, CntxtMenuMouseLocation); if (does != null) { if (does.Any(c => c.cmd == Cmd.Insert)) { Global.Instance.Song.Selected.Clear(); } var undoes = new List <VizCmd>(); foreach (VizCmd cmd in does) { if (cmd != null) { VizCmd chain; if (cmd.viz != null) { if ((chain = cmd.viz.XeqCmd(cmd)) != null) { undoes.Add(chain); } } else if (cmd.obj is Dictionary <string, object> ) { Dictionary <string, object> dict = cmd.obj as Dictionary <string, object>; object obj; if ((dict != null) && (dict.TryGetValue("type", out obj)) && (obj is Type)) { Type typ = obj as Type; if (typ == typeof(Lyric)) { Lyric lyr = Global.Instance.Song.CreateLyric((string)dict["text"], (TimeMark)dict["tm"]); cmd.cmd = Cmd.Delete; cmd.viz = lyr; undoes.Add(cmd); } } } } } if (undoes.Count > 0) { Global.Instance.Song.Remember(undoes); //Recalculate(true); } } }
public IEnumerable <VizCmd> cmCopy(Viz viz = null) { copied.Clear(); if (selected.Count == 0) { copied.Add(viz); } else { copied.AddRange(selected); } return(null); }
public IEnumerable <VizCmd> cmDelete(Viz viz = null) { if (selected.Count == 0) { return(new List <VizCmd>() { new VizCmd(viz, Cmd.Delete) }); } else { return(selected.Select(v => new VizCmd(v, Cmd.Delete)).ToList()); } }
public IEnumerable <VizCmd> cmDuplicate(Viz viz = null) { if (selected.Count == 0) { return(new List <VizCmd>() { new VizCmd(viz.Clone(), Cmd.Insert) }); } else { return(selected.Select(v => new VizCmd(v.Clone(), Cmd.Insert)).ToList()); } }
private void endhover() { switch (hoverMode) { case HoverMode.Prehover: // pre hovertimer.Stop(); //toolStripStatusLabel3.Text = "stop timer"; hoverMode = HoverMode.Off; break; case HoverMode.Active: toolTip1.Hide(this); //toolStripStatusLabel3.Text = "end hover"; hoverMode = HoverMode.Off; break; } prvover = null; }
private static IEnumerable <VizCmd> cmPaste(Viz viz, System.Drawing.Point MouseLocation) { Song song = Global.Instance.Song; Viz frst = song.Copied[0]; int newBeat = song.Beat(MouseLocation.X + Global.Lft); int oldBeat = song.Beat(frst.StartPoint.X); int offset = newBeat - oldBeat; List <VizCmd> cmds = new List <VizCmd>(song.Copied.Count); foreach (var src in song.Copied) { Lyric dst = (Lyric)src.Clone(); int beat = song.Beat(dst.StartPoint.X); float newTime = dst.StartPoint.X + (Global.Instance.Song.TimePoints.Keys[beat + offset] - Global.Instance.Song.TimePoints.Keys[beat]); dst.timemark = Global.Instance.Song.NormalizedTimeMark((int)newTime); cmds.Add(new VizCmd(dst, Cmd.Insert)); } return(cmds); }
public void Select(Viz viz, bool ShiftKey) { if (viz.IsSelectable) { if (ShiftKey || (!viz.IsMultiSelectable) || ((Selected.Count > 0) && (viz.GetType() != Selected[0].GetType()))) { Selected.Clear(); } if (Selected.Contains(viz)) { Selected.Remove(viz); } else { Selected.Add(viz); } } else { Selected.Clear(); } }
public VizCmd(Viz viz, Cmd cmd, object obj = null) { this.viz = viz; this.cmd = cmd; this.obj = obj; }
private static IEnumerable <VizCmd> cmInsert(Viz viz, System.Drawing.Point MouseLocation) { TimeMark tm = Global.Instance.Song.NormalizedTimeMark(Global.Lft + MouseLocation.X); return(Lyric.AddDialog("", tm)); }
private void RC3_MouseMove(object sender, MouseEventArgs e) { if (hovertimer == null) { hovertimer = new System.Timers.Timer(1000); hovertimer.AutoReset = false; hovertimer.Enabled = false; hovertimer.SynchronizingObject = this; hovertimer.Elapsed += beginhover; } var song = Global.Instance.Song; if (song != null) { if (song.DragMode == DragMode.Predrag) { if (!((Math.Abs(e.X - hoverpos.X) < Global.HoverDragSensitivity) && (Math.Abs(e.Y - hoverpos.Y) < Global.HoverDragSensitivity))) { song.DragMode = DragMode.Active; if (!dragShift) { song.Selected.Clear(); } dragCount = song.Selected.Count; if ((CurrOver != null) && (CurrOver.IsSelectable)) { if ((!song.Selected.Contains(CurrOver)) && ((song.Selected.Count == 0) || ((CurrOver.IsMultiSelectable) //&& (song.Selected.Count > 0) && (CurrOver.GetType() == song.Selected[0].GetType())))) { song.Selected.Add(CurrOver); } } } } if (song.DragMode == DragMode.Active) { song.DragEnd = e.Location; var dragBox = song.DragBox; foreach (Viz viz in song.Vizs) { if (dragBox.Contains(viz.Rectangle)) { if (!song.Selected.Contains(viz) && ((song.Selected.Count == 0) || (viz.GetType() == song.Selected[0].GetType()))) { song.Selected.Add(viz); } } else { if (song.Selected.IndexOf(viz) >= dragCount) { song.Selected.Remove(viz); } } } } // toolStripStatusLabel2.Text = e.Location.ToString(); int x = e.X; int y = e.Y; //int x1 = x + hScrollBar1.Value; int x1 = x + prioroffset; if (song != null && song.Vizs != null) { var over = Enumerable.Reverse(song.Vizs).Where(s => s.StartPoint.X <= x1 && x1 <= s.EndPoint.X && s.StartPoint.Y <= y && y <= s.EndPoint.Y).FirstOrDefault(); if (over != CurrOver) { CurrOver = over; //if (dragging) //{ // if ((dragOver != null) && dragOver.IsSelectable) // { // dragOver = CurrOver; // if ((!CurrOver.IsMultiSelectable) || (CurrOver.GetType() != song.Selected[0].GetType())) // { // song.Selected.Clear(); // } // if (song.Selected.Contains(CurrOver)) // song.Selected.Remove(CurrOver); // else // song.Selected.Add(CurrOver); // } //} } if (over != null) { //over = x1 / 100 * 100; if (prvover != over) { if (prvover != null) { //toolStripStatusLabel1.Text = "Leave:" + prvover.ToString(); endhover(); } } else { if (hoverMode == HoverMode.Prehover) { if ((Math.Abs(e.X - hoverpos.X) < Global.HoverDragSensitivity) && (Math.Abs(e.Y - hoverpos.Y) < Global.HoverDragSensitivity)) { return; } endhover(); } } //toolStripStatusLabel1.Text = "Over:" + over.ToString() + ":" + hoverstat.ToString(); if (hoverMode == HoverMode.Off) { if (over.HasToolTip) { //toolStripStatusLabel3.Text = "pre hover"; prvover = over; hoverMode = HoverMode.Prehover; hoverpos = e.Location; hovertimer.Start(); } } } else // not/no longer over { if (prvover == null) { return; } endhover(); //toolStripStatusLabel3.Text = "leave:" + prvover.ToString(); } } } }
private static IEnumerable <VizCmd> cmExit(Viz viz, System.Drawing.Point MouseLocation) { return(null); }
private static IEnumerable <VizCmd> cmInsert(Viz viz, System.Drawing.Point MouseLocation) => null;
private static IEnumerable <VizCmd> cmDelete(Viz viz, System.Drawing.Point MouseLocation) => Global.Instance.Song.cmDelete(viz);
public PropDialogData(Func <PropDialogItem[]> GetPropDialogItems, Viz Viz, Action <Viz> Handler) { this.GetPropDialogItems = GetPropDialogItems; this.Viz = Viz; this.Handler = Handler; }