override public void OnBeforeShapeDelete() { // clean up our connections to other states - ConnectDelete is not called when the shape is deleted Connect c = GetConnect(false); if (c == null) { return; } // determine which end of the connector is connected to the nonConnectorShadow // In this case, it's always the c.FromCell that tells us bool arrowSide = false; if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName)) { arrowSide = true; } Shadow connectedToShadow = PathMaker.LookupShadowByShape(c.ToSheet); if (connectedToShadow != null) { if (arrowSide) { connectedToShadow.OnConnectDeleteInput(this); } else { connectedToShadow.OnConnectDeleteOutput(this); } } else { Common.ErrorMessage("Connector goes to unknown shape " + c.ToSheet.Name); } }
void OnConnectDelete(Connects connects) { if (SuspendConnectHandlingToMoveAConnectionPoint) { return; } foreach (Connect c in connects) { // each connection should be between a 1D shape (connector or comment) and a 2D shape (everything else) // seems like the fromsheet is always the 1D shape but this should be bulletproof if it changes Shape connector = null; Shape nonConnector = null; if (c.FromSheet.OneD != 0) { connector = c.FromSheet; } else { nonConnector = c.FromSheet; } if (connector == null && c.ToSheet.OneD != 0) { connector = c.ToSheet; } else if (nonConnector == null && c.ToSheet.OneD == 0) { nonConnector = c.ToSheet; } // not sure what it is but we don't care about it if (connector == null || nonConnector == null) { return; } Shadow connectorShadow = LookupShadowByShape(connector); Shadow nonConnectorShadow = LookupShadowByShape(nonConnector); if (connectorShadow == null || nonConnectorShadow == null) { Common.ErrorMessage("Deleting connection from invalid shapes..."); return; } // an ignored shadow (like a comment) can sometimes have links // but shouldn't be added as a transition - it's irrelevant IgnoredShadow ignored = connectorShadow as IgnoredShadow; if (ignored != null) { return; } // determine which end of the connector is connected to the nonConnectorShadow bool arrowSide = false; if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName)) { arrowSide = true; } if (arrowSide) { connectorShadow.OnConnectDeleteOutput(nonConnectorShadow); nonConnectorShadow.OnConnectDeleteInput(connectorShadow); } else { connectorShadow.OnConnectDeleteInput(nonConnectorShadow); nonConnectorShadow.OnConnectDeleteOutput(connectorShadow); } } FixHourGlassAfterConfusingVisio(); }