public void SelectControllersAndOutputs(ControllersAndOutputsSet controllersAndOutputs, Boolean updateScrollPosition = false) { _currentControllersControl.SelectedControllersAndOutputs = controllersAndOutputs; if (updateScrollPosition) { _currentControllersControl.UpdateScrollPosition(); } }
private void _updateControllerDetails(ControllersAndOutputsSet controllersAndOutputs) { int controllerCount = 0; int patchedCount = 0; int unpatchedCount = 0; _controllerInputs = new List<PatchStatusItem<IDataFlowComponent>>(); foreach (KeyValuePair<IControllerDevice, HashSet<int>> controllersAndOutput in controllersAndOutputs) { controllerCount++; IControllerDevice controller = controllersAndOutput.Key; foreach (int outputIndex in controllersAndOutput.Value) { if (outputIndex > controller.Outputs.Length) { Logging.Warn("passed an output index greater than the controller output length: " + controller.Name + ", " + outputIndex); continue; } bool patched; if (controller.Outputs[outputIndex].Source == null || controller.Outputs[outputIndex].Source.Component == null) { unpatchedCount++; patched = false; } else { patchedCount++; patched = true; } _controllerInputs.Add(new PatchStatusItem<IDataFlowComponent>((controller as OutputController).GetDataFlowComponentForOutput(controller.Outputs[outputIndex]), patched)); } } labelControllerCount.Text = controllerCount.ToString(); labelOutputCount.Text = (patchedCount + unpatchedCount).ToString(); labelPatchedOutputCount.Text = patchedCount.ToString(); labelUnpatchedOutputCount.Text = unpatchedCount.ToString(); buttonUnpatchControllers.Enabled = patchedCount > 0; if (checkBoxReverseOutputOrder.Checked) { _controllerInputs.Reverse(); } labelFirstOutput.Text = ""; labelLastOutput.Text = ""; if (_controllerInputs.Any()) { IControllerDevice controller; int outputIndex; VixenSystem.OutputControllers.getOutputDetailsForDataFlowComponent(_controllerInputs.First().Item, out controller, out outputIndex); labelFirstOutput.Text = string.Format("{0} #{1}", controller.Name, outputIndex + 1); VixenSystem.OutputControllers.getOutputDetailsForDataFlowComponent(_controllerInputs.Last().Item, out controller, out outputIndex); labelLastOutput.Text = string.Format("{0} #{1}", controller.Name, outputIndex + 1); } }
public ControllersAndOutputsSet BuildSelectedControllersAndOutputs() { ControllersAndOutputsSet result = new ControllersAndOutputsSet(); foreach (TreeNode node in controllerTree.SelectedTreeNodes) { IControllerDevice controller = node.Tag as IControllerDevice; int outputIndex = -1; if (controller == null) { if (node.Tag is int) { outputIndex = (int)node.Tag; controller = node.Parent.Tag as IControllerDevice; if (controller == null) { Logging.Error("node parent is not a controller: " + node.Name); } } } if (controller != null) { HashSet <int> selectedOutputs; result.TryGetValue(controller, out selectedOutputs); if (selectedOutputs == null) { selectedOutputs = new HashSet <int>(); result[controller] = selectedOutputs; } // if there wasn't a specific output that this was about, add all outputs for the controller if (outputIndex < 0) { for (int i = 0; i < controller.OutputCount; i++) { selectedOutputs.Add(i); } } else { selectedOutputs.Add(outputIndex); } } else { Logging.Error("can't figure out what controller the node maps to: " + node.Name); } } return(result); }
private void buttonSelectDestinationOutputs_Click(object sender, EventArgs e) { ControllersAndOutputsSet controllersAndOutputs = new ControllersAndOutputsSet(); foreach (ElementNode selectedElement in SelectedElements) { foreach (ElementNode leafElementNode in selectedElement.GetLeafEnumerator()) { if (leafElementNode == null || leafElementNode.Element == null) { continue; } IDataFlowComponent component = VixenSystem.DataFlow.GetComponent(leafElementNode.Element.Id); if (component == null) { continue; } IEnumerable <IDataFlowComponent> outputComponents = _findComponentsOfTypeInTreeFromComponent(component, typeof(CommandOutputDataFlowAdapter)); foreach (IDataFlowComponent outputComponent in outputComponents) { IControllerDevice controller; int outputIndex; VixenSystem.OutputControllers.getOutputDetailsForDataFlowComponent(outputComponent, out controller, out outputIndex); if (controller == null) { continue; } if (!controllersAndOutputs.ContainsKey(controller)) { controllersAndOutputs[controller] = new HashSet <int>(); } controllersAndOutputs[controller].Add(outputIndex); } } } if (controllersAndOutputs.Count == 0) { var msg = new MessageBoxForm("No controller patch points found.", "Not Found", MessageBoxButtons.OK, SystemIcons.Information); msg.ShowDialog(this); } else { MasterForm.SelectControllersAndOutputs(controllersAndOutputs, true); } }
private void buttonSelectDestinationOutputs_Click(object sender, EventArgs e) { ControllersAndOutputsSet controllersAndOutputs = new ControllersAndOutputsSet(); foreach (ElementNode selectedElement in SelectedElements) { foreach (ElementNode leafElementNode in selectedElement.GetLeafEnumerator()) { if (leafElementNode == null || leafElementNode.Element == null) { continue; } IDataFlowComponent component = VixenSystem.DataFlow.GetComponent(leafElementNode.Element.Id); if (component == null) { continue; } IEnumerable <IDataFlowComponent> outputComponents = _findComponentsOfTypeInTreeFromComponent(component, typeof(CommandOutputDataFlowAdapter)); foreach (IDataFlowComponent outputComponent in outputComponents) { IControllerDevice controller; int outputIndex; VixenSystem.OutputControllers.getOutputDetailsForDataFlowComponent(outputComponent, out controller, out outputIndex); if (controller == null) { continue; } if (!controllersAndOutputs.ContainsKey(controller)) { controllersAndOutputs[controller] = new HashSet <int>(); } controllersAndOutputs[controller].Add(outputIndex); } } } MasterForm.SelectControllersAndOutputs(controllersAndOutputs); }
private void _updateControllerDetails(ControllersAndOutputsSet controllersAndOutputs) { int controllerCount = 0; int patchedCount = 0; int unpatchedCount = 0; _controllerInputs = new List <PatchStatusItem <IDataFlowComponent> >(); foreach (KeyValuePair <IControllerDevice, HashSet <int> > controllersAndOutput in controllersAndOutputs) { controllerCount++; IControllerDevice controller = controllersAndOutput.Key; foreach (int outputIndex in controllersAndOutput.Value) { if (outputIndex > controller.Outputs.Length) { Logging.Warn("passed an output index greater than the controller output length: " + controller.Name + ", " + outputIndex); continue; } bool patched; if (controller.Outputs[outputIndex].Source == null || controller.Outputs[outputIndex].Source.Component == null) { unpatchedCount++; patched = false; } else { patchedCount++; patched = true; } _controllerInputs.Add(new PatchStatusItem <IDataFlowComponent>((controller as OutputController).GetDataFlowComponentForOutput(controller.Outputs[outputIndex]), patched)); } } labelControllerCount.Text = controllerCount.ToString(); labelOutputCount.Text = (patchedCount + unpatchedCount).ToString(); labelPatchedOutputCount.Text = patchedCount.ToString(); labelUnpatchedOutputCount.Text = unpatchedCount.ToString(); }
public void UpdateControllerDetails(ControllersAndOutputsSet controllersAndOutputs) { _updateControllerDisplay(controllersAndOutputs); }
public ControllersAndOutputsSet BuildSelectedControllersAndOutputs() { ControllersAndOutputsSet result = new ControllersAndOutputsSet(); foreach (TreeNode node in controllerTree.SelectedTreeNodes) { IControllerDevice controller = node.Tag as IControllerDevice; int outputIndex = -1; if (controller == null) { if (node.Tag is int) { outputIndex = (int) node.Tag; controller = node.Parent.Tag as IControllerDevice; if (controller == null) { Logging.Error("node parent is not a controller: " + node.Name); } } } if (controller != null) { HashSet<int> selectedOutputs; result.TryGetValue(controller, out selectedOutputs); if (selectedOutputs == null) { selectedOutputs = new HashSet<int>(); result[controller] = selectedOutputs; } // if there wasn't a specific output that this was about, add all outputs for the controller if (outputIndex < 0) { for (int i = 0; i < controller.OutputCount; i++) { selectedOutputs.Add(i); } } else { selectedOutputs.Add(outputIndex); } } else { Logging.Error("can't figure out what controller the node maps to: " + node.Name); } } return result; }
public void SelectControllersAndOutputs(ControllersAndOutputsSet controllersAndOutputs) { _currentControllersControl.SelectedControllersAndOutputs = controllersAndOutputs; }
public void SelectControllersAndOutputs(ControllersAndOutputsSet controllersAndOutputs) { _currentControllersControl.SelectedControllersAndOutputs = controllersAndOutputs; }
public void UpdateControllerDetails(ControllersAndOutputsSet controllersAndOutputs) { _cachedControllersAndOutputs = controllersAndOutputs; _updateControllerDetails(controllersAndOutputs); _updatePatchingSummary(); }
private void _UpdateEverything(IEnumerable <ElementNode> selectedNodes, ControllersAndOutputsSet controllersAndOutputs) { _UpdateElementDetails(selectedNodes); _updateControllerDetails(controllersAndOutputs); _updatePatchingSummary(); }
public void SelectControllersAndOutputs(ControllersAndOutputsSet controllersAndOutputs, Boolean updateScrollPosition = false) { _currentControllersControl.SelectedControllersAndOutputs = controllersAndOutputs; if (updateScrollPosition) _currentControllersControl.UpdateScrollPosition(); }
private void _updateControllerShapesFromControllersAndOutputs(ControllersAndOutputsSet controllersAndOutputs) { if (controllersAndOutputs == null) return; diagramDisplay.DoSuspendUpdate(); List<ControllerShape> oldControllerShapes = _controllerShapes; Dictionary<IOutputDevice, ControllerShape> oldControllerToControllerShape = _controllerToControllerShape; List<OutputShape> oldOutputShapes = _outputShapes; _controllerShapes = new List<ControllerShape>(); _controllerToControllerShape = new Dictionary<IOutputDevice, ControllerShape>(); _outputShapes = new List<OutputShape>(); foreach (KeyValuePair<IControllerDevice, HashSet<int>> pair in controllersAndOutputs) { ControllerShape controllerShape = null; oldControllerToControllerShape.TryGetValue(pair.Key, out controllerShape); if (controllerShape == null) { _CreateShapeFromController(pair.Key, pair.Value); } else { _updateControllerShapeFromOutputSet(controllerShape, pair.Value); _addControllerShapeToList(controllerShape, _controllerShapes); _addControllerShapeToControllerMap(controllerShape, _controllerToControllerShape); } } // compare the new lists to the old ones, and delete any that aren't persisted in the new lists foreach (ControllerShape controllerShape in oldControllerShapes.Except(_controllerShapes).ToArray()) { _RemoveShapeFromDiagram(controllerShape, false); } diagramDisplay.DoResumeUpdate(); }
private void _updateControllerDisplay(ControllersAndOutputsSet controllersAndOutputs) { diagramDisplay.DoSuspendUpdate(); List<Shape> selectedShapes = _getCurrentlySelectedShapes().ToList(); _updateControllerShapesFromControllersAndOutputs(controllersAndOutputs); _ResizeAndPositionControllerShapes(); UpdateConnections(); _selectShapesIfPresent(selectedShapes); diagramDisplay.DoResumeUpdate(); ZoomToFitAll(); }
private void _InitializeControllerShapesFromControllers(ControllersAndOutputsSet controllersAndOutputs) { diagramDisplay.DoSuspendUpdate(); _controllerShapes = new List<ControllerShape>(); _controllerToControllerShape = new Dictionary<IOutputDevice, ControllerShape>(); _outputShapes = new List<OutputShape>(); foreach (KeyValuePair<IControllerDevice, HashSet<int>> pair in controllersAndOutputs) { _CreateShapeFromController(pair.Key, pair.Value); } diagramDisplay.DoResumeUpdate(); }
private void _InitializeControllerShapesFromControllers(IEnumerable<IOutputDevice> controllers) { ControllersAndOutputsSet data = new ControllersAndOutputsSet(); foreach (IControllerDevice controller in controllers) { HashSet<int> outputs = new HashSet<int>(); for (int i = 0; i < controller.OutputCount; i++) { outputs .Add(i); } data[controller] = outputs; } _InitializeControllerShapesFromControllers(data); }
private void buttonSelectDestinationOutputs_Click(object sender, EventArgs e) { ControllersAndOutputsSet controllersAndOutputs = new ControllersAndOutputsSet(); foreach (ElementNode selectedElement in SelectedElements) { foreach (ElementNode leafElementNode in selectedElement.GetLeafEnumerator()) { if (leafElementNode == null || leafElementNode.Element == null) continue; IDataFlowComponent component = VixenSystem.DataFlow.GetComponent(leafElementNode.Element.Id); if (component == null) continue; IEnumerable<IDataFlowComponent> outputComponents = _findComponentsOfTypeInTreeFromComponent(component, typeof (CommandOutputDataFlowAdapter)); foreach (IDataFlowComponent outputComponent in outputComponents) { IControllerDevice controller; int outputIndex; VixenSystem.OutputControllers.getOutputDetailsForDataFlowComponent(outputComponent, out controller, out outputIndex); if (controller == null) continue; if (!controllersAndOutputs.ContainsKey(controller)) controllersAndOutputs[controller] = new HashSet<int>(); controllersAndOutputs[controller].Add(outputIndex); } } } MasterForm.SelectControllersAndOutputs(controllersAndOutputs, true); }
public ControllerSelectionEventArgs(ControllersAndOutputsSet controllersAndOutputs) { ControllersAndOutputs = controllersAndOutputs; }
public void UpdateControllerSelection(ControllersAndOutputsSet controllersAndOutputs) { _updateControllerDisplay(controllersAndOutputs); }