// Process feedback from the leaf UI elemets. void ProcessUIFeedback(FeedbackQueue.RecordBase record) { // Delete request if (record is FeedbackQueue.DeleteNodeRecord) { var removeNode = ((FeedbackQueue.DeleteNodeRecord)record).node; if (Node.ActiveNode == removeNode) { Node.ActiveNode = null; } // Remove related links. foreach (var node in _patch.nodeList) { node.RemoveLinksTo(removeNode, _patch); } // Remove the node. removeNode.RemoveFromPatch(_patch); // Rescan the patch and repaint. _patch.Rescan(); Repaint(); } // Inlet button pressed if (record is FeedbackQueue.InletButtonRecord) { var info = (FeedbackQueue.InletButtonRecord)record; if (_wiring == null) { _wiring = new WiringState(info.node, info.inlet); } else { // Currently in wiring: try to make a link. _wiring.node.TryLinkTo(_wiring.outlet, info.node, info.inlet); _wiring = null; } } // Outlet button pressed if (record is FeedbackQueue.OutletButtonRecord) { var info = (FeedbackQueue.OutletButtonRecord)record; if (_wiring == null) { _wiring = new WiringState(info.node, info.outlet); } else { // Currently in wiring: try to make a link. info.node.TryLinkTo(info.outlet, _wiring.node, _wiring.inlet); _wiring = null; } } // Force to end wiring. //_wiring = null; }
// Process feedback from the leaf UI elemets. void ProcessUIFeedback(FeedbackQueue.RecordBase record) { // Delete request if (record is FeedbackQueue.DeleteNodeRecord) { var removeNode = ((FeedbackQueue.DeleteNodeRecord)record).node; // Remove related links. foreach (var node in _patch.nodeList) { node.RemoveLinksTo(removeNode, _patch); } // Remove the node. removeNode.RemoveFromPatch(_patch); // Reset the editor state. ResetState(); } // Inlet button pressed if (record is FeedbackQueue.InletButtonRecord) { var info = (FeedbackQueue.InletButtonRecord)record; if (_wiring == null) { // Not in wiring: show the context menu. ShowNodeButtonMenu(info.node, info.inlet, null); } else { // Currently in wiring: try to make a link. _wiring.node.TryLinkTo(_wiring.outlet, info.node, info.inlet); } } // Outlet button pressed if (record is FeedbackQueue.OutletButtonRecord) { var info = (FeedbackQueue.OutletButtonRecord)record; if (_wiring == null) { // Not in wiring: show the context menu. ShowNodeButtonMenu(info.node, null, info.outlet); } else { // Currently in wiring: try to make a link. info.node.TryLinkTo(info.outlet, _wiring.node, _wiring.inlet); } } // Force to end wiring. _wiring = null; }