private void OnPorling() { if (Enabled) { if (AnchorZoomX != Pane.Zoom.X) { AnchorZoomX = Pane.Zoom.X; AnchorDate = DateTime.Now; PrevScrollX = 0; } var td = DateTime.Now - AnchorDate; var x = Hot.TimelineParts.GetScRect(TarPane, CodeRect.FromLTRB(0, -1, (int)(td.TotalSeconds * 120), -1)).Width / 120; var dx = x - PrevScrollX; PrevScrollX = x; if (dx >= 0) { Pane.Scroll = ScreenPos.FromInt(Pane.Scroll.X - dx, Pane.Scroll.Y); } else { AnchorZoomX = -1; } } Timer.AddTrigger(20, OnPorling); Pane.Invalidate(null); }
public override bool Draw(IRichPane rp) { if (IsMasking) { var sr = rp.GetPaneRect(); rp.Graphics.DrawString("PAUSE", _font, Brushes.DarkGray, sr.LT.X + 48, sr.RB.Y - 42); } else { // Left side RED curtain var sr = rp.GetPaneRect(); var W = 240; var rc1 = ScreenRect.FromLTWH(sr.LT.X, sr.LT.Y, W, sr.Height); rp.Graphics.FillRectangle(new LinearGradientBrush(new Point(0, 0), new PointF(W, 0), Color.FromArgb(128, 255, 0, 0), Color.FromArgb(0, 255, 0, 0)), rc1); // Now pointer RED curtain var now = DateTime.Now; now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); var rc2 = GetScRect(rp, CodeRect.FromLTRB((int)(now - Hot.FirstSpeech).TotalSeconds, 0, 0, 0)); rc2 = ScreenRect.FromLTRB(rc2.LT.X, sr.LT.Y, sr.RB.X, sr.RB.Y); rp.Graphics.FillRectangle(new LinearGradientBrush(new Point(rc2.LT.X, rc2.LT.Y), new PointF(rc2.RB.X, rc2.RB.Y), Color.FromArgb(8, 255, 0, 0), Color.FromArgb(96, 255, 0, 0)), rc2); // REC LABEL if (++_cnt % 2 == 0) { rp.Graphics.DrawString("REC", _font, Brushes.Yellow, sr.LT.X + 48, sr.RB.Y - 42); } } return(true); }
public CodeRect TalkPosCoder(LayoutRect rect, PartsBase target) { return(CodeRect.FromLTRB( rect.LT.X / DataHot.LayoutPixelPerSecond, FindRowIDByLayoutY(rect.LT.Y), rect.RB.X / DataHot.LayoutPixelPerSecond, FindRowIDByLayoutY(rect.RB.Y))); }
/// <summary> /// Make layout position /// </summary> /// <param name="cd">X=Second from First Speech / Y=Speech Device ID</param> /// <param name="target"></param> /// <returns></returns> public LayoutRect TalkPositioner(CodeRect cd, PartsBase target) { return(LayoutRect.FromLTRB( cd.LT.X * DataHot.LayoutPixelPerSecond, MakeTopByRowID(cd.LT.Y), cd.RB.X * DataHot.LayoutPixelPerSecond, MakeBottomByRowID(cd.RB.Y))); }
public override void Start(NamedId who) { var td = DateTime.Now - Hot.FirstSpeech; var x = Hot.TimelineParts.GetScRect(TarPane, CodeRect.FromLTRB(0, -1, (int)(td.TotalSeconds * 12), -1)).Width / 12; var p = FeatureLogPanelCustom.IsLogDrawing ? 70 : 90; Pane.Scroll = ScreenPos.FromInt(-x + Pane.GetPaneRect().Width *p / 100, Pane.Scroll.Y); Pane.Invalidate(null); }
private void Jump(int offsetSx = 0) { Box.BackColor = BgColor; var line = Box.Text; try { var cpos = Hot.TimelineParts.GetCdPos(TarPane, TarPane.GetPaneRect().LT); var tartime = Hot.FirstSpeech + TimeSpan.FromSeconds(cpos.X); var tardate = new DateTime(tartime.Year, tartime.Month, tartime.Day); var cs = line.Split(':').Select(a => a.Trim()).Where(a => !string.IsNullOrEmpty(a)).ToArray(); // Set new time text DateTime settime; switch (cs.Length) { case 1: settime = GetTime(cs[0], tartime); break; case 2: settime = GetTime(cs[0], cs[1], tartime); break; case 3: settime = GetTime(cs[0], cs[1], cs[2], tartime); break; default: settime = default; break; } // Scroll if (settime != default) { Box.Text = lastTimeText = settime.ToString(TimeUtil.FormatHMS); Box.SelectAll(); var spos = Hot.TimelineParts.GetScRect(TarPane, CodeRect.FromLTWH((int)(settime - Hot.FirstSpeech).TotalSeconds, 0, 0, 0)); Pane.Scroll = ScreenPos.FromInt(Pane.Scroll.X - spos.LT.X + offsetSx, Pane.Scroll.Y); Token.Add(FeatureAutoScroll.TokenAutoScrollOFF, this); Pane.Invalidate(null); GetRoot().FlushFeatureTriggers(); } } catch { Box.BackColor = Color.DarkRed; } }
private void ProcUpdate(SpeechEvent se, int totime, PartsTalkBar tar) { if (tar == null) { return; } tar.Text = se.Text; tar.Rect = CodeRect.FromLTRB(Math.Min(totime - 1, tar.Rect.LT.X), tar.Rect.LT.Y, totime, tar.Rect.RB.Y); if (se.Action == SpeechEvent.Actions.Canceled) { tar.IsCancelled = true; } }
public override void OnInitInstance() { base.OnInitInstance(); Hot.FirstSpeech = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute / 10 * 10, 0); TarPane = Pane.GetPane("GuiViewMain"); Hot.AddRowID(ROWID_TIMELINE, orderNo: 100, layoutHeight: 24); // Set Timeline Height Hot.AddRowID(-999, 101, 4); // Dummy Space Hot.TimelineParts = new PartsTimeline { Hot = Hot, Rect = CodeRect.FromLTRB(0, ROWID_TIMELINE, 0, ROWID_TIMELINE), PartsPositioner = TalkPositioner, PartsPositionCorder = TalkPosCoder, }; Parts.Add(TarPane, Hot.TimelineParts); }
private void ProcStart(SpeechEvent se, int totime) { var p1 = (int)(se.TimeGenerated - Hot.FirstSpeech).TotalSeconds; if (p1 > totime - 1) { p1 = totime - 1; } var pt = new PartsTalkBar { SessionID = se.SessionID, TimeTalkStarted = se.TimeGenerated, PartsPositioner = base.TalkPositioner, PartsPositionCorder = base.TalkPosCoder, Rect = CodeRect.FromLTRB( l: p1, r: totime, t: se.RowID, b: se.RowID), }; Parts.Add(TarPane, pt, LayerTalkBar); }
public override bool Draw(IRichPane rp) { var paneRect = rp.GetPaneRect(); var sr0 = GetScRect(rp); var sr = ScreenRect.FromLTRB(paneRect.LT.X, paneRect.LT.Y, paneRect.RB.X, paneRect.LT.Y + sr0.Height); rp.Graphics.SmoothingMode = SmoothingMode.HighQuality; rp.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(64, 0, 32, 64)), sr); // Background var nowr = GetScRect(rp, CodeRect.FromLTRB((int)(DateTime.Now - Hot.FirstSpeech).TotalSeconds, 0, 0, 0)); var span = GetSpan(rp); var sec1 = GetCdPos(rp, sr.LT).X; // Code.X --> Seconds from Hot.FirstSpeech var sec0 = sec1 / span * span; int sec; for (sec = sec0; ; sec += span) { var time = Hot.FirstSpeech + TimeSpan.FromSeconds(sec); if (time + TimeSpan.FromSeconds(1) > DateTime.Now) { break; } var r = GetScRect(rp, CodeRect.FromLTRB(sec, 0, 0, 0)); if (r.LT.X > sr.RB.X) { break; } // LINE if (Math.Abs(r.LT.X - nowr.LT.X) > 8) { rp.Graphics.DrawLine(new Pen(Color.FromArgb((time.Second % 10 == 0 ? 128 : 72), Color.SteelBlue), 0.5f), r.LT.X, sr.RB.Y - (time.Second == 0 ? 8 : 2), r.LT.X, paneRect.RB.Y); } // SECOND LABEL if (time.Second != 0 && Math.Abs(r.LT.X - nowr.LT.X) > 16) { rp.Graphics.DrawString(time.ToString("ss"), FontSec, Brushes.DarkGray, r.LT.X, sr.RB.Y - 6, new StringFormat { Alignment = StringAlignment.Center, Trimming = StringTrimming.None, }); } } span = Math.Max(span, 60); sec = sec / span * span; var x = paneRect.RB.X + 999; for (; ; sec -= span) { var time = Hot.FirstSpeech + TimeSpan.FromSeconds(sec); if (time >= DateTime.Now) { continue; } var r = GetScRect(rp, CodeRect.FromLTRB(sec, 0, 0, 0)); // TIME LABEL var a = (int)Math.Max(0.0, Math.Min((double)(x - 32) / 110 * 255, 255)); var br = a >= 255 ? Brushes.White : new SolidBrush(Color.FromArgb(a, Color.White)); x = Math.Max(r.LT.X, 16); if (Math.Abs(x - nowr.LT.X) > 36) { rp.Graphics.DrawString(time.ToString(TimeUtil.FormatHM), FontTime, br, x, sr.LT.Y + 2, new StringFormat { Alignment = StringAlignment.Center, Trimming = StringTrimming.None, }); } if (r.LT.X < 0) { break; } } // DRAW NOW { // LINE rp.Graphics.DrawLine(Pens.DarkGreen, nowr.LT.X, sr.RB.Y, nowr.LT.X, paneRect.RB.Y); // SECOND LABEL rp.Graphics.DrawString(DateTime.Now.ToString("ss"), FontSecNow, Brushes.LimeGreen, nowr.LT.X, sr.RB.Y - 8, new StringFormat { Alignment = StringAlignment.Center, Trimming = StringTrimming.None, }); // TIME LABEL rp.Graphics.DrawString(DateTime.Now.ToString(TimeUtil.FormatHM), FontTimeNow, Brushes.LimeGreen, nowr.LT.X, sr.LT.Y + 1, new StringFormat { Alignment = StringAlignment.Center, Trimming = StringTrimming.None, }); } // rp.Graphics.DrawLine(Pens.White, paneRect.RT, paneRect.LB); // for TEST return(true); }