// Creates a shadow from a shape. Should only be called from PathMaker // event handlers when things are loaded, added, etc. public static Shadow MakeShapeShadow(Shape shape) { ShapeTypes shapeType = Common.GetShapeType(shape); Shadow shadow = null; switch (shapeType) { case ShapeTypes.CallSubDialog: shadow = new CallSubDialogShadow(shape); break; case ShapeTypes.ChangeLog: shadow = new ChangeLogShadow(shape); break; case ShapeTypes.AppDesc: shadow = new AppDescShadow(shape); break; case ShapeTypes.PrefixList: shadow = new PrefixListShadow(shape); break; case ShapeTypes.Comment: shadow = new IgnoredShadow(shape); break; case ShapeTypes.Connector: shadow = new ConnectorShadow(shape); break; case ShapeTypes.Data: shadow = new DataShadow(shape); break; case ShapeTypes.Decision: shadow = new DecisionShadow(shape); break; case ShapeTypes.DocTitle: shadow = new DocTitleShadow(shape); break; case ShapeTypes.HangUp: shadow = new HangUpShadow(shape); break; case ShapeTypes.Interaction: shadow = new InteractionShadow(shape); break; case ShapeTypes.None: break; case ShapeTypes.OffPageRef: shadow = new OffPageRefShadow(shape); break; case ShapeTypes.OnPageRefIn: shadow = new OnPageRefInShadow(shape); break; case ShapeTypes.OnPageRefOut: shadow = new OnPageRefOutShadow(shape); break; case ShapeTypes.Page: break; case ShapeTypes.Placeholder: shadow = new IgnoredShadow(shape); break; case ShapeTypes.Play: shadow = new PlayShadow(shape); break; case ShapeTypes.Return: shadow = new ReturnShadow(shape); break; case ShapeTypes.Start: shadow = new StartShadow(shape); break; case ShapeTypes.SubDialog: shadow = new SubDialogShadow(shape); break; case ShapeTypes.Transfer: shadow = new TransferShadow(shape); break; } return shadow; }
void OnConnectAdd(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) // The 1D connector is always the To and 2D shapes are always the From 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("Adding connector to bogus 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.OnConnectAddOutput(nonConnectorShadow); nonConnectorShadow.OnConnectAddInput(connectorShadow); } else { connectorShadow.OnConnectAddInput(nonConnectorShadow); nonConnectorShadow.OnConnectAddOutput(connectorShadow); } } }
// Creates a shadow from a shape. Should only be called from PathMaker // event handlers when things are loaded, added, etc. public static Shadow MakeShapeShadow(Shape shape) { ShapeTypes shapeType = Common.GetShapeType(shape); Shadow shadow = null; switch (shapeType) { case ShapeTypes.CallSubDialog: shadow = new CallSubDialogShadow(shape); break; case ShapeTypes.ChangeLog: shadow = new ChangeLogShadow(shape); break; case ShapeTypes.AppDesc: shadow = new AppDescShadow(shape); break; case ShapeTypes.PrefixList: shadow = new PrefixListShadow(shape); break; case ShapeTypes.Comment: shadow = new IgnoredShadow(shape); break; case ShapeTypes.Connector: shadow = new ConnectorShadow(shape); break; case ShapeTypes.Data: shadow = new DataShadow(shape); break; case ShapeTypes.Decision: shadow = new DecisionShadow(shape); break; case ShapeTypes.DocTitle: shadow = new DocTitleShadow(shape); break; case ShapeTypes.HangUp: shadow = new HangUpShadow(shape); break; case ShapeTypes.Interaction: shadow = new InteractionShadow(shape); break; case ShapeTypes.None: break; case ShapeTypes.OffPageRef: shadow = new OffPageRefShadow(shape); break; case ShapeTypes.OnPageRefIn: shadow = new OnPageRefInShadow(shape); break; case ShapeTypes.OnPageRefOut: shadow = new OnPageRefOutShadow(shape); break; case ShapeTypes.Page: break; case ShapeTypes.Placeholder: shadow = new IgnoredShadow(shape); break; case ShapeTypes.Play: shadow = new PlayShadow(shape); break; case ShapeTypes.Return: shadow = new ReturnShadow(shape); break; case ShapeTypes.Start: shadow = new StartShadow(shape); break; case ShapeTypes.SubDialog: shadow = new SubDialogShadow(shape); break; case ShapeTypes.Transfer: shadow = new TransferShadow(shape); break; } return(shadow); }