internal bool setMainObject(ChartObject main) { if (main == null) { return(false); } if (main.getType() != ItemType.Arrow && main.getType() != ItemType.Box && main.getType() != ItemType.Table && main.getType() != ItemType.ControlHost) { return(false); } if (!main.setGroup(this)) { return(false); } mainObj = main; if (mainObj.getType() == ItemType.Arrow) { prevPoints = ((Arrow)mainObj).Points.Clone(); } else { prevRect = mainObj.getBoundingRect(); prevRotation = (mainObj as Node).rotation(); } return(true); }
private void fireDblClickedEvent(ChartObject obj, PointF pt, MouseButtons mb) { RectangleF rc = obj.getBoundingRect(); float dx = pt.X - rc.X; float dy = pt.Y - rc.Y; int row = 0, col = 0; switch (obj.getType()) { case ItemType.Box: Box box = (Box)obj; if (inplaceEditAllowed && Enabled && !box.notInteractive() && confirmBoxInplaceEdit(box)) startInplaceEdit(new NodeInplaceEditable(box), box.getEditRect()); if (BoxDblClicked != null) BoxDblClicked(this, new BoxMouseArgs(box, mb, dx, dy, pt)); break; case ItemType.ControlHost: ControlHost host = (ControlHost)obj; if (ControlHostDblClicked != null) ControlHostDblClicked(this, new ControlHostMouseArgs(host, mb, dx, dy, pt)); break; case ItemType.Table: Table table = (Table)obj; if (table.cellFromPt(pt, ref row, ref col)) { if (inplaceEditAllowed && Enabled && !table.notInteractive() && confirmTableInplaceEdit(table, row, col)) { startInplaceEdit(table[col, row], table[col, row].getEditRect()); lastClickedCol = col; lastClickedRow = row; } if (TableCellDblClicked != null) { TableCellDblClicked(this, new TableMouseArgs( table, mb, dx, dy, col, row)); } } else { if (inplaceEditAllowed && Enabled && !table.notInteractive() && confirmTableInplaceEdit(table, -1, -1)) startInplaceEdit(new NodeInplaceEditable(table), table.getEditRect()); if (TableDblClicked != null) TableDblClicked(this, new TableMouseArgs(table, mb, dx, dy, pt)); } break; case ItemType.Arrow: if (ArrowDblClicked != null) ArrowDblClicked(this, new ArrowMouseArgs((Arrow)obj, mb, dx, dy, pt)); break; } }
internal void fireClickedEvent(ChartObject obj, PointF pt, MouseButtons mb) { RectangleF rc = obj.getBoundingRect(); float dx = pt.X - rc.X; float dy = pt.Y - rc.Y; int row = 0, col = 0; bool cellClicked; switch (obj.getType()) { case ItemType.Box: if (BoxClicked != null) BoxClicked(this, new BoxMouseArgs((Box)obj, mb, dx, dy, pt)); break; case ItemType.ControlHost: if (ControlHostClicked != null) ControlHostClicked(this, new ControlHostMouseArgs((ControlHost)obj, mb, dx, dy, pt)); break; case ItemType.Table: // raise TableCellClicked if a cell has been clicked and // an event handler is registered for the event cellClicked = ((Table)obj).cellFromPt(pt, ref row, ref col); if (cellClicked && TableCellClicked != null) { TableCellClicked(this, new TableMouseArgs( (Table)obj, mb, dx, dy, col, row)); } // otherwise raise TableClicked else { TableMouseArgs args = new TableMouseArgs((Table)obj, mb, dx, dy, pt); if (cellClicked) { args.col = col; args.row = row; } if (TableClicked != null) TableClicked(this, args); } break; case ItemType.Arrow: if (ArrowClicked != null) ArrowClicked(this, new ArrowMouseArgs((Arrow)obj, mb, dx, dy, pt)); break; } }
private RectangleF calcSelectionRect(ChartObject obj, PointF pt) { RectangleF rc = new RectangleF(0, 0, 0, 0); if (obj != null) { rc = obj.getBoundingRect(); } else { rc.X = pt.X; rc.Y = pt.Y; } return rc; }
internal bool setMainObject(ChartObject main) { if (main == null) return false; if (main.getType() != ItemType.Arrow && main.getType() != ItemType.Box && main.getType() != ItemType.Table && main.getType() != ItemType.ControlHost) return false; if (!main.setGroup(this)) return false; mainObj = main; if (mainObj.getType() == ItemType.Arrow) { prevPoints = ((Arrow)mainObj).Points.Clone(); } else { prevRect = mainObj.getBoundingRect(); prevRotation = (mainObj as Node).rotation(); } return true; }
internal void updateObjects(InteractionState ist) { if (cycleProtect) { return; } cycleProtect = true; if (!flowChart.DisabledGroups) { foreach (Arrow arrow in arrowsToMove) { arrow.translatePoints( mainObj.getBoundingRect().X - prevRect.X, mainObj.getBoundingRect().Y - prevRect.Y); } } for (int i = 0; i < attachments.Count; i++) { Attachment att = (Attachment)attachments[i]; switch (att.type) { case AttachTo.FixedCorner: updateToCornerAttachment(att, ist); break; case AttachTo.SideMiddle: updateSideMiddleAttachment(att, ist); break; case AttachTo.Proportional: updatePropAttachment(att, ist); break; case AttachTo.ArrowPoint: if (!updateToPointAttachment(att, ist)) { return; } break; case AttachTo.ArrowSegment: if (!updateToSegmentAttachment(att, ist)) { return; } break; case AttachTo.LongestHSegment: updateLongestSegmAttachment(att, ist); break; } } if (mainObj.getType() == ItemType.Arrow) { prevPoints = ((Arrow)mainObj).Points.Clone(); } else { prevRect = mainObj.getBoundingRect(); prevRotation = (mainObj as Node).rotation(); } cycleProtect = false; }