public DialogSequenceBorder(SequenceData sequence, SequenceView viewer) { InitializeComponent(); if (sequence == null) { throw new ArgumentNullException("sequence", "'sequence' cannot be null"); } _sequence = sequence; _viewer = viewer; refreshList(); refreshOutput(); setDialogName(); targetColumnIndexControl1.AttachSequence(sequence); //switch(sequence.Type) { //case SequenceType.Numeric: // comboBoxSequenceType.SelectedIndex = 0; // break; //case SequenceType.NumericLabel: // comboBoxSequenceType.SelectedIndex = 1; // break; //case SequenceType.Label: // comboBoxSequenceType.SelectedIndex = 2; // break; //} }
private void OnChangeData( ) { DashboardView.Refresh( ); SequenceView.Refresh( ); SignalView.Refresh( ); SetControls( ); }
public void EnsureFocusedViewVisible() { SequenceView selectedView = _viewerController.GetFocusedView(); if (selectedView != null) { int panelHeight = panelViewerMain.DisplayRectangle.Height; int offset = vScrollBarViewer.Value; int panelY = panelViewerMain.DisplayRectangle.Top; int y = selectedView.Location.Y; int height = selectedView.Height; int newOffset = offset; if (y < panelY + _ensureVisibleMargin) { newOffset += y - (panelY + _ensureVisibleMargin); } else if (y + height > panelY + panelHeight - _ensureVisibleMargin) { newOffset += y + height - (panelY + panelHeight - _ensureVisibleMargin); } newOffset = Math.Max(vScrollBarViewer.Minimum, Math.Min(newOffset, vScrollBarViewer.Maximum)); if (newOffset != offset) { vScrollBarViewer.Value = newOffset; this.Invoke(new EventHandler(onAllocateViewer), this, new EventArgs()); } } }
private void menuLockEdit_Click(object sender, EventArgs e) { SequenceView view = _viewerController.GetFocusedView(); if (view == null) { return; } view.IsLocked = !view.IsLocked; }
private void menuLargeViewHeight_Click(object sender, EventArgs e) { SequenceView view = _viewerController.GetFocusedView(); if (view == null) { return; } view.RequestedHeight = SequenceView.LargeHeight; }
/// <summary> /// 既定のコンストラクタ /// </summary> /// <param title="controller">コントローラ</param> /// <param title="current">選択されたシーケンス</param> public SequenceProcEnv(SequenceViewerController controller) : this(controller, null) { SequenceView tmp = controller.GetFocusedView(); if (tmp != null) { _selectedSequence = tmp.Sequence; } }
private void menuHideView_Click(object sender, EventArgs e) { SequenceView view = _viewerController.GetFocusedView(); if (view == null) { return; } view.IsHidden = !view.IsHidden; }
public ScriptVariable Call(IList <ScriptVariable> args, ScriptConsole console) { if (args == null) { throw new ArgumentNullException("args", "args cannot be null"); } if (args.Count < 1) { throw new ArgumentException("args must have one or more elements", "args"); } if (args[0] == null) { throw new ArgumentException("first element of args cannot be null", "args"); } string viewerName = args[0].ToString(); SequenceView viewer = SequenceViewerController.Singleton.GetViewByTitle(viewerName); if (viewer == null) { throw new ArgumentException("first element of args must be resultSequence name : " + viewerName, "args"); } SequenceProcEnv env2 = new SequenceProcEnv(console.SequenceController, viewer.Sequence); IList <ProcParam <SequenceProcEnv> > parameters = this.Operation.GetParameters() ?? new ProcParam <SequenceProcEnv> [0]; if (args.Count != parameters.Count + 1) { throw new ArgumentException(string.Format(global::MotionDataHandler.Properties.Settings.Default.Msg_NumberOfArgumentsRequired, parameters.Count + 1)); } for (int i = 0; i < parameters.Count; i++) { string errorStr = ""; if (!parameters[i].FromScriptVariable(env2, args[i + 1], ref errorStr)) { throw new ArgumentException(string.Format(global::MotionDataHandler.Properties.Settings.Default.Msg_InvalidNthArgument + ": {1}", i + 1, errorStr ?? ""), "args"); } } SequenceData resultSequence = this.Operation.Operate(parameters, env2); ScriptVariable ret = null; if (resultSequence != null) { console.SequenceController.AddSequence(resultSequence, viewer.IsLocked); ret = new StringVariable(resultSequence.Title); } console.SequenceController.DoAllocationChanged(); if (this.Operation.ReplacesInternalData) { env2.SelectedSequence.IsDataChanged = true; } return(ret); }
public ScriptVariable Call(IList <ScriptVariable> args, SequenceViewerController controller) { string title = args[0].ToString(); SequenceView view = controller.GetViewByTitle(title); if (view == null) { return(null); } return(new ListVariable(view.Sequence.Values.EnumerateTime().Select(v => new NumberVariable(v)))); }
private void OnCloseMenuItem(object sender, EventArgs e) { //Document = null; DashboardView.Instance( ).Hide( ); SequenceView.Instance( ).Hide( ); SignalView.Instance( ).Hide( ); if (Program.Document != null) { Program.Document.Close( ); } Program.Document = null; SetControls( ); }
private void menuUnzoomSelected_Click(object sender, EventArgs e) { SequenceView view = _viewerController.GetFocusedView(); if (view != null) { view.UnzoomSelected(); } else if (TimeController.Singleton.IsSelecting) { TimeController.Singleton.UnzoomSelectedRange(); } }
private void menuLabelingBorder_Click(object sender, EventArgs e) { SequenceView view = _viewerController.GetFocusedView(); if (view == null) { return; } DialogSequenceBorder dialog = new DialogSequenceBorder(view.Sequence, view); dialog.AttachIPluginHost(_pluginHost); dialog.ShowDialog(); view.DoRefreshView(); }
public ScriptVariable Call(IList <ScriptVariable> args, SequenceViewerController controller) { string title = args[0].ToString(); SequenceView view = controller.GetViewByTitle(title); if (view == null) { return(null); } if (args.Count < 2 || args[1].IsNull()) { List <ListVariable> ret = new List <ListVariable>(); foreach (var pair in view.Sequence.Values.Enumerate()) { ret.Add(new ListVariable(pair.Value.Select(v => v.HasValue ? new NumberVariable(v.Value) : null))); } return(new ListVariable(ret)); } else { IList <ScriptVariable> list = args[1].ToList(); if (list != null) { int[] indices = list.Select(p => Convert.ToInt32(p.ToNumber())).ToArray(); List <ListVariable> ret = new List <ListVariable>(); foreach (var pair in view.Sequence.Values.Enumerate()) { List <NumberVariable> numbers = new List <NumberVariable>(); foreach (int index in indices) { decimal?value = pair.Value[index]; numbers.Add(value.HasValue ? new NumberVariable(value.Value) : null); } ret.Add(new ListVariable(numbers)); } return(new ListVariable(ret)); } else { int index = Convert.ToInt32(args[1].ToNumber()); List <NumberVariable> ret = new List <NumberVariable>(); foreach (var pair in view.Sequence.Values.Enumerate()) { decimal?value = pair.Value[index]; ret.Add(value.HasValue ? new NumberVariable(value.Value) : null); } return(new ListVariable(ret)); } } }
public ScriptVariable Call(IList <ScriptVariable> args, SequenceViewerController controller) { string title = args[0].ToString(); decimal beginTime = args[1].ToNumber(); string label = args[2].ToString(); SequenceView viewer = controller.GetViewByTitle(title); if (viewer == null) { return(new BooleanVariable(false)); } viewer.Sequence.SetLabelAt(beginTime, label); return(new BooleanVariable(true)); }
private void menuViewHeight_DropDownOpening(object sender, EventArgs e) { SequenceView view = _viewerController.GetFocusedView(); if (view == null) { return; } menuMinimumViewHeight.Checked = view.Height == SequenceView.MinimumHeight; menuSmallViewHeight.Checked = view.Height == SequenceView.SmallHeight; menuMediumViewHeight.Checked = view.Height == SequenceView.MediumHeight; menuLargeViewHeight.Checked = view.Height == SequenceView.LargeHeight; textViewHeight.Text = view.Height.ToString(); }
private void textViewHeight_TextChanged(object sender, EventArgs e) { SequenceView view = _viewerController.GetFocusedView(); if (view == null) { return; } int height; if (int.TryParse(textViewHeight.Text, out height)) { view.RequestedHeight = height; } }
public ScriptVariable Call(IList <ScriptVariable> args, SequenceViewerController controller) { string title = args[0].ToString(); decimal lower = args[1].ToNumber(); decimal upper = args[2].ToNumber(); string label = args[3].ToString(); SequenceView viewer = controller.GetViewByTitle(title); if (viewer == null) { return(new BooleanVariable(false)); } viewer.Sequence.Borders.SetBorderRange(lower, upper, label); return(new BooleanVariable(true)); }
private void TimeValueSequenceForm_Load(object sender, EventArgs e) { showDustBox(false); _viewerController.AttachParentControl(this); _viewerController.AllocationChanged += onAllocateViewer; _viewerController.DataChanged += onDataChanged; _viewerController.VisibleRangeChanged += onVisibleTimeChanged; _viewerController.GetSequenceOperations(System.Reflection.Assembly.GetExecutingAssembly(), SequenceType.None); _viewerController.StatusMessageChanged += onStatusMessageChanged; _viewerController.FocusedViewChanged += _viewerController_FocusedViewChanged; if (_viewerController.GetSequenceList().Count == 0) { var scratch = new SequenceView(); scratch.Type = SequenceType.Label; scratch.SetDefaultHeight(true); scratch.SuspendRefresh(); _viewerController.AddView(scratch); _viewerController.IsDataChanged = false; scratch.Sequence.IsDataChanged = false; scratch.IsDataModified = false; scratch.ResumeRefresh(true); } else { _viewerController.DoAllocationChanged(); } TimeController.Singleton.SettingsChanged += onSelectionAutoScrollChanged; TimeController.Singleton.SettingsChanged += onLoopModeChanged; TimeController.Singleton.IsPlayingChanged += onPlayingChanged; TimeController.Singleton.CurrentTimeChanged += onCurrentTimeChanged; _viewerController.AttachTimeController(TimeController.Singleton); changeSaveStateEnabled(); timeSelectionControlGlobal.AttachTimeController(TimeController.Singleton); timeSelectionControlLocal.AttachTimeController(TimeController.Singleton); TimeController.Singleton.SetVisibleTime(TimeController.Singleton.VisibleBeginTime, TimeController.Singleton.VisibleEndTime); TimeController.Singleton.DoSettingsChanged(); TimeController.Singleton.DoIsPlayingChanged(); setRenderingMode(true); ToolTip tip = new ToolTip(); tip.SetToolTip(pictResetScale, "Reset Scale"); }
private void OnLoad(object sender, EventArgs e) { if (File.Exists(Program.DockPanelConfig)) { try { dockPanel.LoadFromXml(Program.DockPanelConfig, _deserializeDockContent); DashboardView.Hide( ); SequenceView.Hide( ); SignalView.Hide( ); } catch { File.Delete(Program.DockPanelConfig); } } SetControls( ); }
private void setSequenceList() { listViewSequence.Items.Clear(); SequenceView focusedViewer = _controller.GetFocusedView(); SequenceData focusedData = null; if (focusedViewer != null) { focusedData = focusedViewer.Sequence; } foreach (var data in _controller.GetSequenceList()) { if ((data.Type & SequenceType.Label) != 0) { ListViewItem item = new ListViewItem(data.Title); item.Checked = focusedData == data; listViewSequence.Items.Add(item); } } }
private void menuView_DropDownOpening(object sender, EventArgs e) { SequenceView selectedView = _viewerController.GetFocusedView(); bool zoom = selectedView != null && (selectedView.IsTimeRangeSelected || selectedView.IsValueRangeSelected); zoom = zoom || TimeController.Singleton.IsSelecting; menuZoomSelected.Enabled = zoom; menuUnzoomSelected.Enabled = zoom; menuHideView.Enabled = selectedView != null; menuViewHeight.Enabled = selectedView != null; menuHideView.Checked = selectedView != null && selectedView.IsHidden; menuReorderView.Enabled = selectedView != null && _viewerController.GetViewList().Count >= 2; if (selectedView != null) { menuReorderView.DropDownItems.Clear(); menuReorderView.DropDownItems.AddRange(_viewerController.GetReorderMenus(selectedView).ToArray()); } menuFastRenderingEnabled.Checked = _viewerController.FastRenderingMode; menuActiveView.DropDownItems.Clear(); foreach (SequenceView view in _viewerController.GetViewList()) { SequenceView tmpView = view; Image img = null; switch (view.Sequence.Type) { case SequenceType.Label: img = Properties.Resources.label_mini; break; case SequenceType.Numeric: img = Properties.Resources.graph_mini; break; } ToolStripMenuItem item = new ToolStripMenuItem(view.Sequence.Title, img, (s, e2) => { tmpView.Focus(); }); item.Checked = view.IsFocused; menuActiveView.DropDownItems.Add(item); } }
private void menuEdit_DropDownOpening(object sender, EventArgs e) { SequenceView view = _viewerController.GetFocusedView(); if (view == null || view.IsLocked) { menuSetLabel.Enabled = false; } else { menuSetLabel.DropDownItems.Clear(); ToolStripTextBox text = new ToolStripTextBox("textLabel"); text.TextChanged += (sender2, e2) => { view.SetLabelForSelected(text.Text); }; text.KeyDown += (sender2, e2) => { if (e2.KeyCode == Keys.Enter) { menuEdit.DropDown.Close(); } }; menuSetLabel.DropDownItems.Add(text); menuSetLabel.DropDownItems.Add(new ToolStripSeparator()); foreach (string label in view.Sequence.Borders.GetLabelNames(true)) { string tmpLabel = label; ToolStripMenuItem item = new ToolStripMenuItem(string.Format("「{0}」", label), null, (sender2, e2) => { view.SetLabelForSelected(tmpLabel); }); menuSetLabel.DropDownItems.Add(item); } menuSetLabel.Enabled = true; } menuLabelingBorder.Enabled = view != null && (view.Sequence.Type & SequenceType.Numeric) != 0; menuLockEdit.Enabled = view != null; menuLockEdit.Checked = view != null && view.IsLocked; }
private void toolStripMenuItem1_DropDownOpening(object sender, EventArgs e) { SequenceViewerController controller = _viewerController; if (controller == null) { return; } SequenceView focusedView = controller.GetFocusedView(); if (focusedView == null) { menuLastOperation.Enabled = false; menuOperateLabelSequence.Enabled = false; menuOperateValueSequence.Enabled = false; return; } if (controller.LastOperation != null) { bool labelMode = (controller.LastOperation.OperationTargetType & SequenceType.Label) != 0 && focusedView.Type != SequenceType.Numeric; bool valueMode = (controller.LastOperation.OperationTargetType & SequenceType.Numeric) != 0 && focusedView.Type != SequenceType.Label; if (labelMode || valueMode) { menuLastOperation.DropDown.Items.Clear(); foreach (var item in controller.GetLastOperationToolStripItems()) { menuLastOperation.DropDown.Items.Add(item); } menuLastOperation.Enabled = true; } else { menuLastOperation.Enabled = false; } } else { menuLastOperation.Enabled = false; } if (focusedView.Type != SequenceType.Numeric) { menuOperateLabelSequence.DropDownItems.Clear(); foreach (var item in controller.GetOperationToolStripItems(SequenceType.Label)) { menuOperateLabelSequence.DropDownItems.Add(item); } menuOperateLabelSequence.Enabled = true; } else { menuOperateLabelSequence.Enabled = false; } if (focusedView.Type != SequenceType.Label) { menuOperateValueSequence.DropDownItems.Clear(); foreach (var item in controller.GetOperationToolStripItems(SequenceType.Numeric)) { menuOperateValueSequence.DropDownItems.Add(item); } menuOperateValueSequence.Enabled = true; } else { menuOperateValueSequence.Enabled = false; } }
private void onAllocateViewer(object sender, EventArgs e) { // 各SequenceViewerを描画する if (this.InvokeRequired) { this.BeginInvoke(new EventHandler(onAllocateViewer), sender, e); return; } IList <SequenceView> viewers = _viewerController.GetViewList(); // スクロールバーの長さ設定 int sumHeight = 16 + viewers.Sum(v => v.RequestedHeight); if (vScrollBarViewer.Value < 0) { vScrollBarViewer.Value = 0; } int supValue = sumHeight - panelViewerMain.Height; supValue = Math.Min(Math.Max(supValue, 0), vScrollBarViewer.Maximum); if (vScrollBarViewer.Value > supValue) { vScrollBarViewer.Value = supValue; } vScrollBarViewer.Minimum = 0; vScrollBarViewer.Maximum = sumHeight; vScrollBarViewer.LargeChange = panelViewerMain.Height; vScrollBarViewer.Enabled = sumHeight > panelViewerMain.Height; panelViewerList.SuspendLayout(); panelViewerMain.SuspendLayout(); try { // 前回にあって今回ないViewerを取り除く List <Control> prevControls = new List <Control>(); foreach (var control in panelViewerMain.Controls) { prevControls.Add(control as Control); } foreach (var prev in prevControls) { SequenceView prevViewer = prev as SequenceView; if (prevViewer == null || !viewers.Contains(prevViewer)) { panelViewerMain.Controls.Remove(prev); } } // 位置を設定しながら配置 int top = panelViewerMain.DisplayRectangle.Top - vScrollBarViewer.Value; foreach (var view in viewers) { view.SuspendLayout(); try { view.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; view.Location = new Point(0, top); view.Size = new Size(panelViewerMain.ClientSize.Width, view.RequestedHeight); top += view.RequestedHeight; if (!panelViewerMain.Controls.Contains(view)) { panelViewerMain.Controls.Add(view); } } finally { view.ResumeLayout(); } } } finally { panelViewerList.ResumeLayout(); panelViewerMain.ResumeLayout(); } }
private void OnSequenceMenuItem(object sender, EventArgs e) { SequenceView.Instance().Show(); }