コード例 #1
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);
                }
            }
        }
コード例 #2
0
ファイル: Collections.cs プロジェクト: ChrisMoreton/Test3
		public ChartObjectCollection Clone()
		{
			ChartObjectCollection oc = new ChartObjectCollection();
			foreach (ChartObject co in this)
				oc.Add(co);
			return oc;
		}
コード例 #3
0
ファイル: TreeEnumerator.cs プロジェクト: ChrisMoreton/Test3
		private TreeEnumerator(Node root,
			bool enumArrows, bool strict, bool reversedDir)
		{
			objects = new ChartObjectCollection();
			this.enumArrows = enumArrows;
			this.reversedDir = reversedDir;
			this.strict = strict;
			buildTree(root);
			internalEnum = objects.GetEnumerator();
		}
コード例 #4
0
 private TreeEnumerator(Node root,
                        bool enumArrows, bool strict, bool reversedDir)
 {
     objects          = new ChartObjectCollection();
     this.enumArrows  = enumArrows;
     this.reversedDir = reversedDir;
     this.strict      = strict;
     buildTree(root);
     internalEnum = objects.GetEnumerator();
 }
コード例 #5
0
        public ChartObjectCollection Clone()
        {
            ChartObjectCollection oc = new ChartObjectCollection();

            foreach (ChartObject co in this)
            {
                oc.Add(co);
            }
            return(oc);
        }
コード例 #6
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;
        }
コード例 #7
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;
		}
コード例 #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
ファイル: FCPath.cs プロジェクト: ChrisMoreton/Test3
		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
        internal void destroySelf(bool redo)
        {
            flowChart.fireGroupDestroyed(this);

            // let the master object know that it no longer has a subordinate group
            if (mainObj != null)
            {
                mainObj.setGroup(null);
            }
            mainObj = null;

            // if called for redo, there are already GroupDetachCmd
            // commands attached to this one, so do not create them again
            if (!redo)
            {
                ChartObjectCollection delItems = autoDeleteItems ?
                                                 attachedObjects.Clone() : null;

                // GroupDetachCmd always removes an attachment from
                // the array, so that cycle will end for sure
                while (attachments.Count > 0)
                {
                    GroupDetachCmd cmd = new GroupDetachCmd(
                        this, (Attachment)attachments[attachments.Count - 1]);
                    cmd.Execute();
                }

                // if autoDeleteItems is enabled, delete all subordinate items
                if (delItems != null)
                {
                    foreach (ChartObject item in delItems)
                    {
                        flowChart.deleteItem(item);
                    }
                    delItems.Clear();
                    delItems = null;
                }
            }

            // remove from flowchart's list of groups
            flowChart.deleteGroup(this);
        }
コード例 #11
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;
        }
コード例 #12
0
        internal override void completeCreate(PointF end)
        {
            base.completeCreate(end);

            clear();

            ChartObjectCollection newSel = new ChartObjectCollection();

            flowChart.getIntersectingObjects(rect,
                                             newSel, allowMultiSel, includeItemsIfIntersect);
            foreach (ChartObject obj in newSel)
            {
                addObjToSelection(obj);
            }
            newSel.Clear();

            if (selectedItems.Count == 0)
            {
                if (flowChart.ActiveObject != null)
                {
                    flowChart.fireDeactivationEvent();
                }
                flowChart.ActiveObject = null;
            }
            else if (flowChart.ActiveObject == null ||
                     !flowChart.ActiveObject.Selected)
            {
                if (flowChart.ActiveObject != null)
                {
                    flowChart.fireDeactivationEvent();
                }
                flowChart.ActiveObject = selectedItems[0];
                flowChart.fireActivationEvent();
            }

            flowChart.fireSelectionChanged();

            recalcRect();
        }
コード例 #13
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;
        }
コード例 #14
0
ファイル: Selection.cs プロジェクト: ChrisMoreton/Test3
		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
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		public bool CutToClipboard(bool copy)
		{
			if (Selection.Objects.Count == 0) return false;

			if (CopyToClipboard(copy))
			{
				// that returns the active composite if somebody has already created one
				CompositeCmd composite = UndoManager.StartComposite("_fcnet_");

				// delete selected items
				ChartObjectCollection temp = new ChartObjectCollection();
				foreach (ChartObject item in Selection.Objects)
					temp.Add(item);

				Selection.Clear();

				foreach (ChartObject item in temp)
					DeleteObject(item);

				if (composite != null && composite.Title == "_fcnet_")
				{
					// this is our own composite cmd
					composite.Title = "Cut";
					composite.Execute();
				}

				return true;
			}

			return false;
		}
コード例 #16
0
ファイル: Group.cs プロジェクト: ChrisMoreton/Test3
		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;
		}
コード例 #17
0
ファイル: Selection.cs プロジェクト: ChrisMoreton/Test3
		internal override void completeCreate(PointF end)
		{
			base.completeCreate(end);

			clear();

			ChartObjectCollection newSel = new ChartObjectCollection();
			flowChart.getIntersectingObjects(rect,
				newSel, allowMultiSel, includeItemsIfIntersect);
			foreach (ChartObject obj in newSel)
				addObjToSelection(obj);
			newSel.Clear();

			if (selectedItems.Count == 0)
			{
				if (flowChart.ActiveObject != null)
					flowChart.fireDeactivationEvent();
				flowChart.ActiveObject = null;
			}
			else if (flowChart.ActiveObject == null ||
				!flowChart.ActiveObject.Selected)
			{
				if (flowChart.ActiveObject != null)
					flowChart.fireDeactivationEvent();
				flowChart.ActiveObject = selectedItems[0];
				flowChart.fireActivationEvent();
			}

			flowChart.fireSelectionChanged();

			recalcRect();
		}
コード例 #18
0
ファイル: Group.cs プロジェクト: ChrisMoreton/Test3
		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;
		}
コード例 #19
0
 public ItemsAndGroups(ChartObjectCollection items, GroupCollection groups)
 {
     this.items  = items;
     this.groups = groups;
 }
コード例 #20
0
ファイル: ItemsAndGroups.cs プロジェクト: ChrisMoreton/Test3
		public ItemsAndGroups(ChartObjectCollection items, GroupCollection groups)
		{
			this.items = items;
			this.groups = groups;
		}
コード例 #21
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		private ItemsAndGroups copySelection(
			FlowChart doc, bool unconnectedArrows, bool copyGroups)
		{
			if (doc.Selection.Objects.Count == 0)
				return null;

			// determine which items and groups to copy
			ChartObjectCollection items = new ChartObjectCollection();
			GroupCollection groups = new GroupCollection();
			Hashtable indexMap = new Hashtable();
			for (int i = 0; i < doc.Selection.Objects.Count; ++i)
			{
				ChartObject item = doc.Selection.Objects[i];

				// do not copy unconncted arrows if specified
				if (!unconnectedArrows && item is Arrow)
				{
					Arrow arrow = item as Arrow;
					if (!arrow.IsConnected) continue;
				}

				indexMap[item] = items.Count;
				items.Add(item);
				
				if (copyGroups && item.SubordinateGroup != null)
					groups.Add(item.SubordinateGroup);
			}

			// add subordinated group items
			foreach (Group group in groups)
			{
				foreach (ChartObject item in group.AttachedObjects)
				{
					if (!items.Contains(item))
					{
						indexMap[item] = items.Count;
						items.Add(item);
					}
				}
			}

			// copy nodes
			for (int i = 0; i < items.Count; ++i)
			{
				ChartObject item = items[i];

				if (item is Box) items[i] = new Box((Box)item);
				if (item is ControlHost) items[i] = new ControlHost((ControlHost)item);
				if (item is Table) items[i] = new Table((Table)item);
			}

			// copy arrows, linking them to node clones
			for (int i = 0; i <  items.Count; ++i)
			{
				if (items[i] is Arrow)
				{
					Arrow arrow = items[i] as Arrow;

					int srcIndex = indexMap.Contains(arrow.Origin) ?
						(int)indexMap[arrow.Origin] : -1;
					int dstIndex = indexMap.Contains(arrow.Destination) ?
						(int)indexMap[arrow.Destination] : -1;

					items[i] = new Arrow(arrow,
						srcIndex == -1 ? Dummy : items[srcIndex] as Node,
						dstIndex == -1 ? Dummy : items[dstIndex] as Node);
				}
			}

			// copy groups
			for (int i = 0; i < groups.Count; ++i)
			{
				Group group = new Group(groups[i]);
				groups[i] = group;
				group.setMainObject(items[(int)indexMap[group.MainObject]]);

				foreach (Attachment atc in group.Attachments)
				{
					atc.node = items[(int)indexMap[atc.node]] as Node;
					atc.node.putInGroup(group);
				}
				group.updateObjCol();
			}

			return new ItemsAndGroups(items, groups);
		}
コード例 #22
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		internal void getIntersectingObjects(RectangleF rect,
			ChartObjectCollection objects, bool multiple, bool ifIntersect)
		{
			RectangleF rcSel = Utilities.normalizeRect(rect);

			if (ifIntersect)
			{
				foreach (ChartObject obj in zOrder)
				{
					RectangleF rcObjRect = obj.getRotatedBounds();
					if (!obj.notInteractive() && rcObjRect.IntersectsWith(rcSel))
					{
						objects.Add(obj);
						if (!multiple) return;
					}
				}
			}
			else
			{
				foreach (ChartObject obj in zOrder)
				{
					RectangleF rcObjRect = obj.getRotatedBounds();
					if (!obj.notInteractive() && rcSel.Contains(rcObjRect))
					{
						objects.Add(obj);
						if (!multiple) return;
					}
				}
			}
		}
コード例 #23
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		internal void setZOrder(ChartObjectCollection zOrder)
		{
			this.zOrder = zOrder;
			updateZOrder(0);
		}
コード例 #24
0
ファイル: FlowChart.cs プロジェクト: ChrisMoreton/Test3
		/// <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;
		}