internal override bool linkChanges(ChartObject obj, PointF pt) { if (table != obj) return true; if (row != table.rowFromPt(pt)) return true; return false; }
public ChartObject(ChartObject prototype) { flowChart = prototype.flowChart; rect = prototype.rect; rcSaved = rect; tag = prototype.tag; constructed = false; modifying = false; modifyHandle = 0; modifyDX = modifyDY = 0; locked = prototype.locked; subordinateGroup = null; masterGroup = null; cycleProtect = false; cycleDetected = false; zIndex = 0; font = (Font)prototype.font.Clone(); penDashStyle = prototype.PenDashStyle; penWidth = prototype.PenWidth; shadowOffsetX = prototype.shadowOffsetX; shadowOffsetY = prototype.shadowOffsetY; shadowColor = prototype.shadowColor; invisible = prototype.invisible; selected = false; printable = prototype.printable; manipulators = new ArrayList(); toolTip = prototype.toolTip; ptOrg = prototype.ptOrg; ptEnd = prototype.ptEnd; ptSavedOrg = prototype.ptSavedOrg; ptSavedEnd = prototype.ptSavedEnd; ptMdfLast = ptEnd; frameColor = prototype.frameColor; fillColor = prototype.fillColor; pen = (Pen)prototype.pen.Clone(); brush = prototype.brush; brush.AddRef(); subordinateGroup = masterGroup = null; ignoreLayout = prototype.ignoreLayout; runtimeData = new SortedList(); weight = prototype.weight; hyperLink = prototype.hyperLink; }
internal Expander(ChartObject item) : base(item) { if (imgExpanded == null || imgCollapsed == null) { ResourceManager rm = new ResourceManager( "MindFusion.FlowChartX.Icons", this.GetType().Assembly); imgExpanded = (Icon)rm.GetObject("mnp_collapse"); imgCollapsed = (Icon)rm.GetObject("mnp_expand"); } }
public InteractionState( ChartObject currentObject, int selectionHandle, Action action) { this.currentObject = currentObject; this.selectionHandle = selectionHandle; this.action = action; completing = false; itemDeleted = false; invalidRect = new RectangleF(0, 0, 0, 0); cycleRoots = new ChartObjectCollection(); affectedArrows = new ArrowCollection(); splitToChangeOrient = true; }
internal bool removeObject(ChartObject obj) { bool objExists = ObjectInSelection(obj); if (objExists) { selectedItems.Remove(obj); switch (obj.getType()) { case ItemType.Box: selectedBoxes.Remove((Box)obj); break; case ItemType.ControlHost: selectedHosts.Remove((ControlHost)obj); break; case ItemType.Table: selectedTables.Remove((Table)obj); break; case ItemType.Arrow: selectedArrows.Remove((Arrow)obj); break; } obj.setSelected(false); recalcRect(); } return objExists; }
internal void addObjToSelection(ChartObject obj) { if (obj.getSelected()) return; selectedItems.Add(obj); obj.setSelected(true); switch (obj.getType()) { case ItemType.Box: selectedBoxes.Add((Box)obj); break; case ItemType.ControlHost: selectedHosts.Add((ControlHost)obj); break; case ItemType.Table: selectedTables.Add((Table)obj); break; case ItemType.Arrow: selectedArrows.Add((Arrow)obj); break; } rect = Utilities.unionNonEmptyRects(rect, obj.getRotatedBounds()); }
public void AddObject(ChartObject obj) { if (obj == null) return; addObjToSelection(obj); if (flowChart.ActiveObject != null) flowChart.fireDeactivationEvent(); flowChart.ActiveObject = obj; flowChart.fireActivationEvent(); flowChart.invalidate(getRepaintRect(false)); flowChart.fireSelectionChanged(); }
public ItemEventArgs(ChartObject item) { this.item = item; }
/// <summary> /// Common method converts any Flowchart object into corresponded /// DXF string /// </summary> /// <param name="co">Flowchart object</param> /// <returns>Corresponded DXF string</returns> public string ChartObject2String(ChartObject co) { string sResult = null; RectangleF rect = RectangleF.Empty; PointF pt0 = PointF.Empty, pt1 = PointF.Empty, pt2 = PointF.Empty, pt3 = PointF.Empty; Color crFill = Color.Transparent , crLine = Color.Transparent; string sFill = ""; PointF[] pts = null; GraphicsPath gr = null; StringFormat centerFormat = null; RectangleF captionRect = RectangleF.Empty; try { centerFormat = new StringFormat(); if ( centerFormat!=null ) { centerFormat.Alignment = StringAlignment.Center; centerFormat.LineAlignment = StringAlignment.Center; } // If porcessed object is Box if ( co is Box) { Box oBox = co as Box; rect = oBox.BoundingRect; gr = new GraphicsPath(FillMode.Winding); sResult = ""; provider.ControlTracking(true); Box2Str(oBox,0,ref gr,ref sResult); provider.ControlTracking(false); // Getting fill color crFill = ExtractColor(oBox.Brush, oBox.FillColor); // Checking does the box has embedded image if ( oBox.Image == null ) { if (!IsTransparent(crFill, oBox)) { // Processing point array to eliminate duplicated points // ( required by DXF POLYLINE ) pts = MakePtsUnique(gr.PathPoints as PointF[]); sFill = String.Format(provider, "0\nHATCH\n 100\nAcDbEntity\n{0:HAN} 8\n{0}\n 62\n{10:ACI}\n 100\nAcDbHatch\n 10\n0\n 20\n0\n 30\n0\n 210\n0\n 220\n0\n 230\n1\n 2\n{1}\n 70\n{2}\n 71\n{3}\n 91\n{4}\n 92\n{5}\n 72\n{6}\n 73\n{7}\n 93\n{8}\n{9}{0:LIST} 75\n0\n 76\n1\n 47\n1\n 98\n0\n", HATCH_LAYER,"SOLID", "1", "1", "1","7", "0", "1", pts.Length , Pt2String(pts,crFill, HATCH_LAYER, DxLineType.ltHatch, DashStyle.Solid, 1), crFill); AddEntity(String.Format("FILL{0:X3}",oBox.ZIndex),sFill); } } else { AddImage(oBox.BoundingRect, oBox.Image.Clone() as Image, NextID(), oBox.ImageAlign,m_FlowChart.BackColor); } if ( !oBox.Transparent ) AddEntity(String.Format("BOX{0:X3}", oBox.ZIndex),sResult); AddText(oBox); if ( gr!=null ) gr.Dispose(); } else if ( co is Arrow ) // if object is Arrow { Arrow oArrow = co as Arrow; sResult = Pt2String(PtColl2Pts(oArrow.ControlPoints),oArrow.Pen.Color, ARROW_LAYER, (oArrow.Style == ArrowStyle.Bezier) ? DxLineType.ltBezier : DxLineType.ltSingle, oArrow.Pen.DashStyle, oArrow.Pen.Width); AddEntity(String.Format("ARROW{0:X3}", oArrow.ZIndex),sResult); AddText(oArrow); sFill = ""; crFill = ExtractColor(oArrow.Brush, oArrow.Pen.Color); sResult = ArrowHead2Str(oArrow.BaseShape, oArrow.Pen.Color, oArrow.Pen.DashStyle , crFill, ref sFill); AddEntity(String.Format("ABASE{0:X3}", oArrow.ZIndex),sResult); if ( sFill!="" ) AddEntity(String.Format("FILLBASE{0:X3}",oArrow.ZIndex),sFill); sFill = ""; sResult = ArrowHead2Str(oArrow.HeadShape, oArrow.Pen.Color, oArrow.Pen.DashStyle , crFill, ref sFill); AddEntity(String.Format("AHEAD{0:X3}", oArrow.ZIndex),sResult); if ( sFill!="" ) AddEntity(String.Format("FILLHEAD{0:X3}",oArrow.ZIndex),sFill); } else if ( co is Table) // If object is table { Table oTable = co as Table; rect = oTable.BoundingRect; float fX = 0, fY = 0, fW = 0, fH = 0; int RowCount = oTable.CurrScrollRow , ColCount = 0, AutoColls = 0; float fCellW = 0, fCellH = 0, fCellX = 0, fCellY = 0 , rh =0, fStepW = 0, fSumW =0; bool CellIsSpanned = false; string sTemp = ""; fX = rect.X; fY = rect.Y; fW = rect.Width; fH = rect.Height; // Processing table's frame crFill = ExtractColor(oTable.Brush, oTable.FillColor); AddRect(rect, oTable.ZIndex, Color.Transparent, crFill, oTable.TextColor,oTable.Pen.DashStyle, "", null, null); // Processing table caption's frame if ( oTable.CaptionHeight!=0 ) { AddText(oTable); captionRect = new RectangleF(fX, fY, fW, oTable.CaptionHeight); } // Pre-process table cells sTemp = ""; fW = 0; fH = 0; fCellX = fX; fCellY = fY + oTable.CaptionHeight; AutoColls = 0; fSumW =0; foreach ( Table.Column col in oTable.Columns) { if (col.ColumnStyle == ColumnStyle.AutoWidth ) AutoColls++; else fSumW+=col.Width; } // Process table cells considering 'spaning cells' while (RowCount<oTable.Rows.Count) { if ( RowCount!=oTable.CurrScrollRow ) rh = oTable.Rows[RowCount-1].Height; else rh = 0; fCellY+=rh; if ( fCellY > oTable.BoundingRect.Bottom - rh) break; while (ColCount<oTable.Columns.Count ) { if ( ColCount!=0) fCellX+= oTable.Columns[ColCount-1].Width; Table.Cell cell = oTable[ColCount, RowCount]; if ( cell.Tag is string) sTemp = cell.Tag.ToString(); else sTemp = ""; if (sTemp!="span" ) { fCellH = 0; for (int i = RowCount; i <RowCount + cell.RowSpan; i++) { fCellH+= oTable.Rows[i].Height; fCellW = 0; bool bPass = true; for (int j = ColCount; j < ColCount + cell.ColumnSpan; j++) { if (( oTable.Columns[ColCount].ColumnStyle == ColumnStyle.AutoWidth ) && bPass) { fStepW = ( oTable.BoundingRect.Width - fSumW ) / AutoColls; bPass = false; } else fStepW = oTable.Columns[j].Width; fCellW+=fStepW; oTable[j,i].Tag = "span"; } } if ( AutoColls == 0 ) { if ( ColCount == ( oTable.Columns.Count -1) ) fCellW += ( oTable.BoundingRect.Width - fSumW); } // Calculating cell's rectangle dimensions RectangleF cellRect = new RectangleF(fCellX, fCellY, fCellW, fCellH); CellIsSpanned = ((cell.ColumnSpan>1) || ( cell.RowSpan>1)); if ( oTable.CellFrameStyle == CellFrameStyle.None) crLine = Color.Transparent; else crLine = oTable.FrameColor; // Adding cell's frame and fill AddRect(cellRect, oTable.ZIndex, crLine , crFill, oTable.TextColor, oTable.Pen.DashStyle, "", /*cell.Text*/ ( oTable.Font == null ) ? m_FlowChart.Font : oTable.Font , CellIsSpanned ? centerFormat : cell.TextFormat); // Adding cell's text AddText(cell, oTable, cellRect ); // Adding cell's picture if any exists if (cell.Image != null) AddImage(cellRect, cell.Image.Clone() as Image, NextID(), cell.ImageAlign, oTable.FillColor); } ColCount++; } fCellX = fX; ColCount = 0; RowCount++; } // Adding caption's fill if ( oTable.CaptionHeight!=0 ) { AddRect(captionRect, oTable.ZIndex, oTable.FrameColor, Color.Transparent, oTable.CaptionColor, oTable.Pen.DashStyle, oTable.CaptionPlainText, ( oTable.Font == null ) ? m_FlowChart.Font : oTable.Font , oTable.CaptionFormat); } // Adding table body fill AddRect(rect, oTable.ZIndex, oTable.Pen.Color, Color.Transparent, oTable.TextColor,oTable.Pen.DashStyle, "", null, null); } else { throw new Exception("Unknown chart object type detected"); } } catch ( Exception ex ) { sResult = null; m_status = ex.Message; Trace.WriteLine(String.Format("{0} error {1}\n","ChartObject2String",ex.Message)); } return sResult; }
internal ItemState(ChartObject item) { this.item = item; }
public bool Contains(ChartObject obj) { return List.Contains(obj); }
void HV_TranslateArrow(ChartObject obj) { if (obj.getType() == ItemType.Arrow) { Arrow arrow = (Arrow)obj; if (arrow.bothEndsSelected() && !arrowsToMove.Contains(arrow) && arrow.Origin.canModify(8) && arrow.Destination.canModify(8)) { arrowsToMove.Add(arrow); return; } if (arrow.Origin.getModifying() && arrow.Destination.getModifying() && !arrowsToMove.Contains(arrow) && relatedInteraction != null && !relatedInteraction.affectedArrows.Contains(arrow)) { arrowsToMove.Add(arrow); return; } } }
internal ItemState(ChartObject item) { this.item = item; }
public bool Contains(ChartObject obj) { return(List.Contains(obj)); }
public HitTestEventArgs(ChartObject item, PointF mousePosition) { this.item = item; this.mousePosition = mousePosition; this.hitResult = -1; }
public void Remove(ChartObject a) { List.Remove(a); }
public void Insert(int i, ChartObject a) { List.Insert(i, a); }
public void Add(ChartObject a) { List.Add(a); }
private void updateNSARect(ChartObject obj) { RectangleF rcObj = obj.getRepaintRect(true); if (obj.getType() == ItemType.Arrow) { Arrow arrow = (Arrow)obj; arrow.updatePosFromOrgAndDest(false); } }
public void Insert(int i, ChartObject a) { List.Insert(i, a); }
/// <summary> /// checks whether an item shouldn't be moved by the Selection object itself, either because /// its group master moves it, or if it's an arrow whose origin or dest. nodes aren't modified; /// this method is intended to be called only from updateModify /// </summary> private bool ignoreItem(ChartObject item, InteractionState ist) { if (item is Node && item.MasterGroup != null) { // ignore the item if its group master is already moving if (item.MasterGroup.MainObject.getModifying() && !ist.cycleRoots.Contains(item)) return true; } // ignore arrows whose source and destination aren't modified Arrow arrow = item as Arrow; if (arrow != null) { if (!arrow.Origin.getModifying() && !arrow.Destination.getModifying()) return true; } return parentSelected(item, false); }
public DrawEventArgs(Graphics graphics, ChartObject item) { this.graphics = graphics; this.item = item; }
/// <summary> /// Creates a MAP tag HTML source /// </summary> public string CreateImageMap(string mapName) { // image map coordinate system starts from 0, 0, so we might have // to offset the AREA coordinates to make them match the diagram items docOffsetX = flowChart.DocExtents.X; docOffsetY = flowChart.DocExtents.Y; string html = TAB + "<MAP NAME=\"" + mapName + "\">\r\n"; // create an AREA tag for each node for (int i = flowChart.Objects.Count - 1; i >= 0; i--) { ChartObject item = flowChart.Objects[i]; if (!item.Visible) { continue; } Node node = item as Node; if (item.HyperLink != "") { html += TAB + TAB; string areaTag = "<AREA SHAPE="; if (node != null) { if (node is Box) { Box b = node as Box; switch (b.Style) { case BoxStyle.Rectangle: case BoxStyle.RoundedRectangle: // SHAPE="RECT" areaTag += createRectArea(b.BoundingRect); break; case BoxStyle.Shape: case BoxStyle.Ellipse: case BoxStyle.Delay: case BoxStyle.Rhombus: // SHAPE="POLY" areaTag += createPolyArea(b.getOutlinePoly()); break; } } if (node is ControlHost) { // SHAPE="RECT" areaTag = areaTag + createRectArea(node.BoundingRect); } if (node is Table) { Table t = node as Table; // use whole bounding rect if cell AREAs won't be generated RectangleF rect = t.BoundingRect; if (areasForTableCells) { rect.Height = t.CaptionHeight; } areaTag = areaTag + createRectArea(rect); } } else { areaTag += createPolyArea(item.getOutlinePoly()); } areaTag += "\r\n"; areaTag += TAB + TAB + TAB + "HREF=\"" + item.HyperLink + "\" "; areaTag += "TARGET=\"" + linkTarget + "\" "; areaTag += "TITLE=\"" + item.ToolTip + "\">"; if (CreatingArea != null) { AreaEventArgs args = new AreaEventArgs(areaTag, item); CreatingArea(this, args); areaTag = args.AreaTag; } html += areaTag + "\r\n"; } if (node != null) { if (areasForTableCells && node is Table) { html += createCellAreas(node as Table); } if (node.Expandable && expandBtnHyperLink != "") { html += createExpBtnArea(node); } } } html += TAB + "</MAP>\r\n"; return(html); }
internal override bool linkChanges(ChartObject obj, PointF pt) { return(true); }
public void Add(ChartObject a) { List.Add(a); }
public Scroller(ChartObject item) : base(item) { }
public void Remove(ChartObject a) { List.Remove(a); }
// ************ placement ************ internal override bool containsPoint(PointF pt) { ChartObject obj = flowChart.GetObjectAt(pt, true); return(obj != null && obj.Selected); }
internal override bool sameNode(Link otherLink) { ChartObject obj = otherLink.getNode(); return(obj != null && obj == host); }
private bool HV_ModifyTranslate(ChartObject obj) { obj.modifyTranslate(modifyDX, modifyDY, false); return(true); }
/// <summary> /// Check whether color passed is transparent /// </summary> /// <param name="cr">Color value</param> /// <param name="co">Object of the color</param> /// <returns>true if color is transparent false otherwise</returns> public static bool IsTransparent(Color cr, ChartObject co) { if (cr.A==0 ) return true; if ( co is Box ) { if ((co as Box).Transparent) return true; } return false; }
internal abstract bool linkChanges(ChartObject obj, PointF pt);
// ************ selected objects ************ public void Toggle(ChartObject obj) { if (obj == null) return; // remove the object if it's already selected if (ObjectInSelection(obj)) { bool activeObjChanged = obj == flowChart.ActiveObject; removeObject(obj); if (activeObjChanged && selectedItems.Count > 0) { if (flowChart.ActiveObject != null) flowChart.fireDeactivationEvent(); flowChart.ActiveObject = selectedItems[0]; flowChart.fireActivationEvent(); } if (activeObjChanged && selectedItems.Count == 0) { if (flowChart.ActiveObject != null) flowChart.fireDeactivationEvent(); flowChart.ActiveObject = null; } recalcRect(); } // add to selection else if (!obj.notInteractive()) { if (!allowMultiSel) clear(); addObjToSelection(obj); if (flowChart.ActiveObject != null) flowChart.fireDeactivationEvent(); flowChart.ActiveObject = obj; flowChart.fireActivationEvent(); } flowChart.fireSelectionChanged(); }
protected void AV_UpdIntscIncoming(ChartObject obj) { Arrow arrow = (Arrow)obj; if (!arrow.isReflexive()) arrow.updateIntersections(); }
public void Change(ChartObject obj) { clear(); if (obj == null || obj.notInteractive()) { if (flowChart.ActiveObject != null) flowChart.fireDeactivationEvent(); flowChart.ActiveObject = null; } else { // change the selection addObjToSelection(obj); if (flowChart.ActiveObject != null) flowChart.fireDeactivationEvent(); flowChart.ActiveObject = obj; flowChart.fireActivationEvent(); } flowChart.fireSelectionChanged(); recalcRect(); }
protected void AV_StartModOutgoing(ChartObject obj, InteractionState ist) { Arrow arrow = (Arrow)obj; arrow.startModifyOrg(ist); }
public bool RemoveObject(ChartObject obj) { RectangleF invArea = getRepaintRect(false); if (!removeObject(obj)) return false; if (!flowChart.ActiveObject.Selected) { if (flowChart.ActiveObject != null) flowChart.fireDeactivationEvent(); flowChart.ActiveObject = selectedItems.Count > 0 ? selectedItems[0] : null; if (flowChart.ActiveObject != null) flowChart.fireActivationEvent(); } if (!flowChart.LayoutSuspended) flowChart.invalidate(invArea); flowChart.fireSelectionChanged(); return true; }
protected void AV_StartModIncoming(ChartObject obj, InteractionState ist) { Arrow arrow = (Arrow)obj; arrow.startModifyEnd(ist); }
public bool ObjectInSelection(ChartObject obj) { foreach (ChartObject selObj in selectedItems) if (selObj == obj) return true; return false; }
protected void AV_EndModOutgoing(ChartObject obj) { Arrow arrow = (Arrow)obj; arrow.updatePosFromOrgAndDest(true); arrow.completeModify(); }
private bool parentSelected(ChartObject obj, bool checkCycles) { // for arrows check if the objects they are linked to are selected if (obj.getType() == ItemType.Arrow) { Arrow arrow = (Arrow)obj; if (arrow.getOrgnLink().getNode().Selected) return true; if (arrow.getDestLink().getNode().Selected) return true; } // doesn't have parent at all if (!obj.isAttached()) return false; // has a parent, but it is not selected if (!obj.getContainingGroup().MainObject.Selected) return false; // is the group master in a cycle if (!checkCycles) { if (obj.getGroupMaster() == obj) return false; } else { if (obj.getGroupMasterCC() == obj) return false; } // true in all other cases return true; }
protected void AV_EndModIncoming(ChartObject obj) { Arrow arrow = (Arrow)obj; if (!arrow.isReflexive()) { arrow.updatePosFromOrgAndDest(true); arrow.completeModify(); } }
private bool HV_ModifyTranslate(ChartObject obj) { obj.modifyTranslate(modifyDX, modifyDY, false); return true; }
protected void AV_Cancel(ChartObject obj, InteractionState ist) { Arrow arrow = (Arrow)obj; arrow.cancelModify(ist); }
internal abstract bool linkChanges(ChartObject obj, PointF pt);
internal Manipulator(ChartObject item) { this.item = item; }