示例#1
0
        private void getArrowsToMove(InteractionState ist)
        {
            arrowsToMove.Clear();

            // translate arrows if attachment type is 'to corner'
            if (mainObj is Node)
            {
                // get arrows of nodes attached 'to corner'
                ArrowCollection arrowsToCheck = new ArrowCollection();
                foreach (Attachment att in Attachments)
                {
                    if (att.type == AttachTo.FixedCorner ||
                        att.type == AttachTo.SideMiddle)
                    {
                        Node node = att.node;
                        node.getAllIncomingArrows(arrowsToCheck);
                        node.getAllOutgoingArrows(arrowsToCheck);
                    }
                }

                // check if arrow points must be translated by this group
                foreach (Arrow a in arrowsToCheck)
                {
                    if (mustTranslateArrow(a) && !arrowsToMove.Contains(a) &&
                        !ist.affectedArrows.Contains(a))
                    {
                        arrowsToMove.Add(a);
                        ist.affectedArrows.Add(a);
                    }
                }
            }
        }
示例#2
0
        internal Path(MindFusion.LayoutSystem.Path path)
        {
            _nodes = new ChartObjectCollection();
            _links = new ArrowCollection();
            _items = new ChartObjectCollection();

            foreach (FCNode node in path.Nodes)
            {
                _nodes.Add(node.Node);
            }
            foreach (FCLink link in path.Links)
            {
                _links.Add(link.Arrow);
            }
            foreach (object item in path.Items)
            {
                if (item is FCLink)
                {
                    _items.Add((item as FCLink).Arrow);
                }
                else
                {
                    _items.Add((item as FCNode).Node);
                }
            }
        }
示例#3
0
        private void buildTree(Node node)
        {
            if (objects.Contains(node))
            {
                if (!strict)
                {
                    return;
                }
                throw new NotATreeException();
            }
            objects.Add(node);

            // get the appropriate arrows
            ArrowCollection arrows = new ArrowCollection();

            if (reversedDir)
            {
                node.getAllIncomingArrows(arrows);
            }
            else
            {
                node.getAllOutgoingArrows(arrows);
            }

            // build subtrees recursively
            foreach (Arrow a in arrows)
            {
                if (enumArrows)
                {
                    objects.Add(a);
                }
                buildTree(reversedDir ? a.Origin : a.Destination);
            }
        }
示例#4
0
		public Node(Node prototype) : base(prototype)
		{
			incomingArrows = new ArrowCollection();
			outgoingArrows = new ArrowCollection();
			AnchorPattern = prototype.AnchorPattern;
			obstacle = prototype.obstacle;
			constraints = (NodeConstraints)prototype.constraints.Clone();
			enabledHandles = prototype.enabledHandles;
			boolValues = prototype.boolValues;
		}
示例#5
0
        public ArrowCollection Clone()
        {
            ArrowCollection ac = new ArrowCollection();

            foreach (Arrow a in this)
            {
                ac.Add(a);
            }
            return(ac);
        }
示例#6
0
		public Node(FlowChart parent) : base(parent)
		{
			incomingArrows = new ArrowCollection();
			outgoingArrows = new ArrowCollection();
			anchorPattern = null;
			obstacle = true;
			constraints = new NodeConstraints();
			enabledHandles = Handles.All;
			boolValues = 0xFFFF;
		}
示例#7
0
        public Group(FlowChart parent)
        {
            flowChart       = parent;
            mainObj         = null;
            cycleProtect    = false;
            attachments     = new ArrayList();
            autoDeleteItems = false;
            tag             = null;
            visible         = true;

            attachedObjects = new ChartObjectCollection();
            arrowsToMove    = new ArrowCollection();

            expandable           = false;
            followMasterRotation = false;
        }
示例#8
0
        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;
        }
示例#9
0
		internal Path(MindFusion.LayoutSystem.Path path)
		{
			_nodes = new ChartObjectCollection();
			_links = new ArrowCollection();
			_items = new ChartObjectCollection();

			foreach (FCNode node in path.Nodes)
				_nodes.Add(node.Node);
			foreach (FCLink link in path.Links)
				_links.Add(link.Arrow);
			foreach (object item in path.Items)
			{
				if (item is FCLink)
					_items.Add((item as FCLink).Arrow);
				else
					_items.Add((item as FCNode).Node);
			}
		}
示例#10
0
		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;
		}
示例#11
0
        internal void onRedimArrowsDeleted(Table table)
        {
            if (!undoEnabled)
            {
                return;
            }

            // record table structure after arrows are deleted
            currRedimCmd.recordState();

            // remaining arrows will be possibly scrolled up or down
            // record their state here; better optimize this to include
            // just affected arrows (TODO)
            ArrowCollection ac = table.GetAllArrows();

            foreach (Arrow arrow in ac)
            {
                currRedimCmd.AddSubCmd(new ModifyItemCmd(arrow));
            }
        }
示例#12
0
        public Group(Group prototype)
        {
            flowChart    = prototype.flowChart;
            mainObj      = prototype.mainObj;
            cycleProtect = false;
            attachments  = (ArrayList)prototype.attachments.Clone();
            for (int i = 0; i < attachments.Count; ++i)
            {
                attachments[i] = (attachments[i] as Attachment).Clone();
            }

            autoDeleteItems = prototype.autoDeleteItems;
            tag             = prototype.tag;
            visible         = prototype.visible;

            attachedObjects = new ChartObjectCollection();
            updateObjCol();
            arrowsToMove = new ArrowCollection();

            expandable           = prototype.expandable;
            followMasterRotation = prototype.followMasterRotation;
        }
示例#13
0
		private void buildTree(Node node)
		{
			if (objects.Contains(node))
			{
				if (!strict) return;
				throw new NotATreeException();
			}
			objects.Add(node);

			// get the appropriate arrows
			ArrowCollection arrows = new ArrowCollection();
			if (reversedDir)
				node.getAllIncomingArrows(arrows);
			else
				node.getAllOutgoingArrows(arrows);

			// build subtrees recursively
			foreach (Arrow a in arrows)
			{
				if (enumArrows) objects.Add(a);
				buildTree(reversedDir ? a.Origin : a.Destination);
			}
		}
示例#14
0
		internal Selection(FlowChart parent) : base(parent)
		{
			pen = new Pen(Color.Black);
			brush = null;

			style = SelectionStyle.SelectionHandles;
			constructed = true;

			selectedBoxes = new BoxCollection();
			selectedHosts = new ControlHostCollection();
			selectedTables = new TableCollection();
			selectedArrows = new ArrowCollection();

			selectedItems = new ChartObjectCollection();

			allowMultiSel = true;

			arrowsToMove = new ChartObjectCollection();

			frameColor = SystemColors.Highlight;
			fillColor = SystemColors.Highlight;

			includeItemsIfIntersect = true;
		}
示例#15
0
        internal Selection(FlowChart parent) : base(parent)
        {
            pen   = new Pen(Color.Black);
            brush = null;

            style       = SelectionStyle.SelectionHandles;
            constructed = true;

            selectedBoxes  = new BoxCollection();
            selectedHosts  = new ControlHostCollection();
            selectedTables = new TableCollection();
            selectedArrows = new ArrowCollection();

            selectedItems = new ChartObjectCollection();

            allowMultiSel = true;

            arrowsToMove = new ChartObjectCollection();

            frameColor = SystemColors.Highlight;
            fillColor  = SystemColors.Highlight;

            includeItemsIfIntersect = true;
        }
示例#16
0
		public ArrowCollection Clone()
		{
			ArrowCollection ac = new ArrowCollection();
			foreach (Arrow a in this)
				ac.Add(a);
			return ac;
		}
示例#17
0
			public virtual void setReference(int refId, IPersists obj)
			{
				switch (refId)
				{
				case 1:
					table = (Table)obj;
					break;
				case 2:
					incomingArrows = (ArrowCollection)obj;
					break;
				case 3:
					outgoingArrows = (ArrowCollection)obj;
					break;
				case 4:
					relatedOneToMany = (TableCollection)obj;
					break;
				case 5:
					relatedManyToOne = (TableCollection)obj;
					break;
				}
			}
示例#18
0
		/// <summary>
		/// Initializes a new instance of the FlowChart class.
		/// </summary>
		public FlowChart()
		{
			license = LicenseManager.Validate(typeof(FlowChart), this);

			measureUnit = GraphicsUnit.Millimeter;

			// set control styles for flicker-free redraw
			SetStyle(ControlStyles.UserPaint, true);
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			SetStyle(ControlStyles.Opaque, true);
			SetStyle(ControlStyles.ResizeRedraw, true);

			// we want to process keyboard input
			SetStyle(ControlStyles.Selectable, true);
     
			// init static objects
			lock (syncRoot)
			{
				Arrow.initHeadTemplates();
				CustomCursors.Init(new ResourceManager(
					"MindFusion.FlowChartX.Cursors", typeof(ChartObject).Assembly));
			}

			mouseMoved = false;

			boxFillColor = Color.FromArgb(220, 220, 255);
			boxFrameColor = Color.Black;
			arrowColor = Color.Black;
			arrowTextStyle = ArrowTextStyle.Center;
			arrowFillColor = Color.FromArgb(120, 220, 255);
			tableFrameColor = Color.Black;
			tableFillColor = Color.FromArgb(180, 160, 160);
			penDashStyle = DashStyle.Solid;
			penWidth = 0;
			BackColor = Color.FromArgb(170, 170, 200);

			// grid properties
			alignToGrid = true;
			showGrid = false;
			gridColor = Color.FromArgb(140, 140, 150);
			gridSizeX = 4;
			gridSizeY = 4;
			gridStyle = GridStyle.Points;

			// shadows properties
			shadowOffsetX = 1;
			shadowOffsetY = 1;
			shadowColor = Color.FromArgb(110, 110, 140);
			shadowsStyle = ShadowsStyle.OneLevel;

			activeMnpColor = Color.White;
			selMnpColor = Color.FromArgb(170, 170, 170);
			disabledMnpColor = Color.FromArgb(200, 0, 0);

			textFormat = new StringFormat();
			textFormat.Alignment = StringAlignment.Center;
			textFormat.LineAlignment = StringAlignment.Center;

			// Set some flags, because otherwise the serializer
			// generates noncompilable code
			textFormat.FormatFlags = StringFormatFlags.NoFontFallback;

			imagePos = ImageAlign.Document;

			boxStyle = BoxStyle.RoundedRectangle;
			tableStyle = TableStyle.Rectangle;

			boxPen = new Pen(boxFrameColor, penWidth);
			boxBrush = new SolidBrush(boxFillColor);
			boxBrush.AddRef();
			arrowPen = new Pen(arrowColor, penWidth);
			arrowBrush = new SolidBrush(arrowFillColor);
			arrowBrush.AddRef();
			tablePen = new Pen(tableFrameColor, penWidth);
			tableBrush = new SolidBrush(tableFillColor);
			tableBrush.AddRef();

			exteriorBrush = null;
			brush = new SolidBrush(BackColor);
			brush.AddRef();

			boxes = new BoxCollection();
			controlHosts = new ControlHostCollection();
			tables = new TableCollection();
			arrows = new ArrowCollection();
			selection = new Selection(this);
			selectionOnTop = true;

			groups = new GroupCollection();

			zOrder = new ChartObjectCollection();

			textColor = Color.Black;
			arrowStyle = MindFusion.FlowChartX.ArrowStyle.Polyline;
			arrowSegments = 1;
			activeObject = null;

			modificationStart = ModificationStyle.SelectedOnly;
			autoHandlesObj = null;
			autoAnchorsObj = null;

			interaction = null;

			scrollX = scrollY = 0;
			zoomFactor = 100.0f;
			allowRefLinks = true;
			Behavior = BehaviorType.FlowChart;
			arrowEndsMovable = true;
			selectAfterCreate = true;

			// init default custom draw properties
			boxCustomDraw = CustomDraw.None;
			tableCustomDraw = CustomDraw.None;
			cellCustomDraw = CustomDraw.None;
			arrowCustomDraw = CustomDraw.None;

			restrObjsToDoc = RestrictToDoc.Intersection;
			dynamicArrows = false;
			arrowsSnapToBorders = false;
			arrowsRetainForm = false;
			arrowCascadeOrientation = Orientation.Auto;

			curPointer = Cursors.Arrow;
			curCannotCreate = Cursors.No;
			curModify = Cursors.SizeAll;
			curArrowStart = Cursors.Hand;
			curArrowEnd = Cursors.Hand;
			curArrowCannotCreate = Cursors.No;
			curHorzResize = Cursors.SizeWE;
			curVertResize = Cursors.SizeNS;
			curMainDgnlResize = Cursors.SizeNWSE;
			curSecDgnlResize = Cursors.SizeNESW;
			curRotateShape = CustomCursors.Rotate;
			panCursor = Cursors.NoMove2D;

			tableRowsCount = 4;
			tableColumnsCount = 2;
			tableRowHeight = 6;
			tableColWidth = 18;
			tableCaptionHeight = 5;
			tableCaption = "Table";
			tableCellBorders = CellFrameStyle.System3D;

			selHandleSize = 2;

			showDisabledHandles = true;
			arrowSelStyle = HandlesStyle.SquareHandles;
			boxSelStyle = HandlesStyle.SquareHandles;
			chostSelStyle = HandlesStyle.HatchHandles;
			tableSelStyle = HandlesStyle.DashFrame;

			recursiveExpand = false;
			expandOnIncoming = false;
			boxesExpandable = false;
			tablesScrollable = false;
			tablesExpandable = false;
			controlHostsExpandable = false;

			arrowHead = ArrowHead.Arrow;
			arrowBase = ArrowHead.None;
			arrowInterm = ArrowHead.None;

			arrowHeadSize = 5;
			arrowBaseSize = 5;
			arrowIntermSize = 5;

			ShowScrollbars = true;
			DocExtents = new RectangleF(0, 0, 210, 297);

			autoScroll = true;
			autoScrDX = autoScrDY = 0;

			dirty = false;
			antiAlias = SmoothingMode.None;
			textRendering = TextRenderingHint.SystemDefault;
			sortGroupsByZ = false;

			// tooltips
			showToolTips = true;
			toolTip = "";
			toolTipCtrl = new ToolTip();
			toolTipCtrl.Active = showToolTips;

			shapeRotation = 0;
			DefaultShape = ShapeTemplate.FromId("Cylinder");

			inplaceEditAllowed = false;
			inplaceObject = null;
			nowEditing = false;
			inplaceEditFont = (Font)Font.Clone();
			inplaceAcceptOnEnter = false;
			inplaceCancelOnEsc = true;

			allowSplitArrows = false;

			printOptions = new PrintOptions(this);
			printOptions.EnableBackground = false;
			printOptions.EnableBackgroundImage = false;
			printOptions.PaintControls = true;

			displayOptions = new PrintOptions(this);
			renderOptions = displayOptions;

			previewOptions = new PreviewOptions();

			allowLinksRepeat = true;
			showAnchors = ShowAnchors.Auto;
			snapToAnchor = SnapToAnchor.OnCreate;

			beginPrintHandler = new PrintEventHandler(this.BeginPrint);
			printPageHandler = new PrintPageEventHandler(this.PrintPage);
			printRect = new RectangleF(0, 0, 1, 1);

			usePolyTextLt = false;

			userAction = false;

			tableLinkStyle = TableLinkStyle.Rows;

			undoManager = new UndoManager(this);

			defaultControlType = typeof(System.Windows.Forms.Button);
			hostedCtrlMouseAction = HostMouseAction.SelectHost;

			dummy = new DummyNode(this);
			allowUnconnectedArrows = false;
			allowUnanchoredArrows = true;

			autoSizeDoc = MindFusion.FlowChartX.AutoSize.None;
			panMode = false;

			enableStyledText = false;

			expandBtnPos = ExpandButtonPosition.OuterRight;
			focusLost = false;

			hitTestPriority = HitTestPriority.NodesBeforeArrows;

			boxText = arrowText = "";

			// arrow crossings
			arrowCrossings = ArrowCrossings.Straight;
			crossRadius = 1.5f;
			redrawNonModified = false;

			roundRectFactor = 1;

			scriptHelper = new ScriptHelper(this);

			// link routing options
			routingOptions = new RoutingOptions(this);
			routingGrid = new RoutingGrid(this);
			routeArrows = false;
			dontRouteForAwhile = false;

			validityChecks = true;
			_modifierKeyActions = new ModifierKeyActions();
			middleButtonAction = MouseButtonAction.None;
			forceCacheRedraw = false;

			showHandlesOnDrag = true;
			mergeThreshold = 0;

			expandButtonAction = ExpandButtonAction.ExpandTreeBranch;
		}
示例#19
0
		internal override void getAllIncomingArrows(ArrowCollection ac)
		{
			base.getAllIncomingArrows(ac);

			if (rowsList == null) return;
			foreach (Row r in rowsList)
				foreach (Arrow a in r.IncomingArrows)
				{
					if (!ac.Contains(a))
						ac.Add(a);
				}
		}
示例#20
0
			public Row(Table table)
			{
				height = 22;
				incomingArrows = new ArrowCollection();
				outgoingArrows = new ArrowCollection();
				relatedOneToMany = new TableCollection();
				relatedManyToOne= new TableCollection();
				this.table = table;
				anchorPattern = null;

				header = false;
				expanded = true;
			}
示例#21
0
		public Group(Group prototype)
		{
			flowChart = prototype.flowChart;
			mainObj = prototype.mainObj;
			cycleProtect = false;
			attachments = (ArrayList)prototype.attachments.Clone();
			for (int i = 0; i < attachments.Count; ++i)
				attachments[i] = (attachments[i] as Attachment).Clone();

			autoDeleteItems = prototype.autoDeleteItems;
			tag = prototype.tag;
			visible = prototype.visible;

			attachedObjects = new ChartObjectCollection();
			updateObjCol();
			arrowsToMove = new ArrowCollection();

			expandable = prototype.expandable;
			followMasterRotation = prototype.followMasterRotation;
		}
示例#22
0
		internal override void visitArrows(
			CollectionVisitor outgVstr,
			CollectionVisitor incmVstr,
			ArrowCollection excluded)
		{
			if (excluded == null)
			{
				visitArrows(outgVstr, incmVstr);
				return;
			}

			base.visitArrows(outgVstr, incmVstr, excluded);

			if (rowsList != null)
			{
				for (int i = 0; i < rowsCount; ++i)
				{
					foreach(Arrow a in ((Row)rowsList[i]).OutgoingArrows)
						if (!excluded.Contains(a))
							outgVstr.accept(a);
					foreach(Arrow a in ((Row)rowsList[i]).IncomingArrows)
						if (!excluded.Contains(a))
							incmVstr.accept(a);
				}
			}
		}
示例#23
0
		internal ArrowCollection getArrowsFromZ(bool lessThan, int z)
		{
			ArrowCollection arrows = new ArrowCollection();

			if (lessThan)
			{
				for (int i = z - 1; i >= 0; i--)
				{
					ChartObject obj = this.zOrder[i];
					if (obj is Arrow)
						arrows.Add(obj as Arrow);
				}
			}
			else
			{
				for (int i = z + 1; i < zOrder.Count; i++)
				{
					ChartObject obj = zOrder[i];
					if (obj is Arrow)
						arrows.Add(obj as Arrow);
				}
			}

			return arrows;
		}
示例#24
0
		private void getArrowsToMove(InteractionState ist)
		{
			arrowsToMove.Clear();

			// translate arrows if attachment type is 'to corner'
			if (mainObj is Node)
			{
				// get arrows of nodes attached 'to corner'
				ArrowCollection arrowsToCheck = new ArrowCollection();
				foreach (Attachment att in Attachments)
				{
					if (att.type == AttachTo.FixedCorner ||
						att.type == AttachTo.SideMiddle)
					{
						Node node = att.node;
						node.getAllIncomingArrows(arrowsToCheck);
						node.getAllOutgoingArrows(arrowsToCheck);
					}
				}

				// check if arrow points must be translated by this group
				foreach (Arrow a in arrowsToCheck)
				{
					if (mustTranslateArrow(a) && !arrowsToMove.Contains(a) &&
						!ist.affectedArrows.Contains(a))
					{
						arrowsToMove.Add(a);
						ist.affectedArrows.Add(a);
					}
				}
			}
		}
示例#25
0
		internal virtual void deleteArrows()
		{
			ArrowCollection toDelete = new ArrowCollection();
			getAllIncomingArrows(toDelete);
			getAllOutgoingArrows(toDelete);

			foreach (Arrow arrow in toDelete)
				flowChart.deleteItem(arrow);
		}
示例#26
0
		internal virtual void visitArrows(
			CollectionVisitor outgVstr,
			CollectionVisitor incmVstr,
			ArrowCollection excluded)
		{
			if (excluded == null)
			{
				visitArrows(outgVstr, incmVstr);
				return;
			}

			foreach (Arrow arrow in outgoingArrows)
				if (!excluded.Contains(arrow))
					outgVstr.accept(arrow);
			foreach (Arrow arrow in incomingArrows)
				if (!excluded.Contains(arrow))
					incmVstr.accept(arrow);
		}
示例#27
0
		public ArrowCollection GetAllArrows()
		{
			ArrowCollection ac = new ArrowCollection();
			getAllIncomingArrows(ac);
			getAllOutgoingArrows(ac);
			return ac;
		}
示例#28
0
		internal virtual void getAllIncomingArrows(ArrowCollection ac)
		{
			foreach (Arrow a in incomingArrows)
				if (!ac.Contains(a))
					ac.Add(a);
		}
示例#29
0
		public Group(FlowChart parent)
		{
			flowChart = parent;
			mainObj = null;
			cycleProtect = false;
			attachments = new ArrayList();
			autoDeleteItems = false;
			tag = null;
			visible = true;

			attachedObjects = new ChartObjectCollection();
			arrowsToMove = new ArrowCollection();

			expandable = false;
			followMasterRotation = false;
		}