コード例 #1
0
ファイル: Table.cs プロジェクト: ChrisMoreton/Test3
		public override void loadFrom(BinaryReader reader, PersistContext ctx)
		{
			base.loadFrom(reader, ctx);
			hasHeaderRows = false;

			hasSpanningCells = false;
			ctx.loadReference(this);	// load cells
			ctx.loadReference(this);	// load rows
			ctx.loadReference(this);	// load columns
			currScrollRow = reader.ReadInt32();
			scrollable = reader.ReadBoolean();
			setScrollable(scrollable);
			fillColor = ctx.loadColor();
			frameColor = ctx.loadColor();
			caption = reader.ReadString();
			captionColor = ctx.loadColor();
			captionFormat = ctx.loadStringFormat();

			captionHeight = (float)reader.ReadDouble();
			cellBorders = (CellFrameStyle)reader.ReadInt32();
			rowsCount = reader.ReadInt32();
			rowHeight = (float)reader.ReadDouble();
			columnsCount = reader.ReadInt32();
			columnWidth = (float)reader.ReadDouble();
			textColor = ctx.loadColor();
			picturePos = (ImageAlign)reader.ReadInt32();

			picture = ctx.loadImage();

			pen.Width = PenWidth;
			pen.Color = frameColor;
			pen.DashStyle = PenDashStyle;
			brush.Release();
			brush = new SolidBrush(fillColor);
			brush.AddRef();

			if (ctx.FileVersion > 3)
			{
				pen = (Pen)ctx.loadObject();
				ctx.loadReference(this);

				selStyle = (HandlesStyle)reader.ReadInt32();

				if (ctx.FileVersion > 5)
				{
					// new in save format 6
					rowAnchorPattern = ctx.loadAnchorPattern();
					enabledHandles = (Handles)reader.ReadInt64();
					style = (TableStyle)reader.ReadInt32();

					if (ctx.FileVersion > 7)
					{
						// new in file format 8
						linkStyle = (TableLinkStyle)reader.ReadInt32();

						if (ctx.FileVersion > 8)
						{
							// new in save format 9
							anchorPattern = ctx.loadAnchorPattern();

							// Load table arrows
							ctx.loadReference(this);
							ctx.loadReference(this);

							if (ctx.FileVersion > 13)
							{
								// new in save format 14
								setExpanded(reader.ReadBoolean());
								setExpandable(reader.ReadBoolean());
								useStyledText = reader.ReadBoolean();

								if (ctx.FileVersion > 18)
								{
									// new in save format 19
									customDraw = (CustomDraw)reader.ReadInt32();
									cellCustomDraw = (CustomDraw)reader.ReadInt32();

									if (ctx.FileVersion > 21)
									{
										// new in save format 22
										offsetHeaderRows = reader.ReadBoolean();

										if (ctx.FileVersion > 24)
										{
											// new in save format 25
											ctx.loadReference(this);	// captionBackBrush
										}
									}
								}
							}
						}
					}
				}
			}

			resetCoveredCells();
			updateText();
			layoutText();
		}
コード例 #2
0
ファイル: Arrow.cs プロジェクト: ChrisMoreton/Test3
		public override void loadFrom(BinaryReader reader, PersistContext ctx)
		{
			base.loadFrom(reader, ctx);

			style = (ArrowStyle)reader.ReadInt32();
			penColor = ctx.loadColor();
			ctx.loadReference(this);
			ctx.loadReference(this);
			segmentCount = reader.ReadInt16();
			text = reader.ReadString();
			textColor = ctx.loadColor();
			arrowHead = (ArrowHead)reader.ReadInt32();
			arrowBase = (ArrowHead)reader.ReadInt32();
			arrowInterm = (ArrowHead)reader.ReadInt32();
			headSize = (float)reader.ReadDouble();
			baseSize = (float)reader.ReadDouble();
			intermSize = (float)reader.ReadDouble();
			fillColor = ctx.loadColor();
			dynamic = reader.ReadBoolean();
			cascadeOrientation = (Orientation)reader.ReadInt32();
			cascadeStartHorizontal = reader.ReadBoolean();
			reflexive = reader.ReadBoolean();
			ctx.loadReference(this);
			ctx.loadReference(this);

			ahHead = new ArrowHeadShape(headSize);
			ahBase = new ArrowHeadShape(baseSize);
			ahInterm = new ArrowHeadShape(intermSize);

			headTemplates[(int)arrowHead].initArrowHead(ahHead);
			headTemplates[(int)arrowBase].initArrowHead(ahBase);
			headTemplates[(int)arrowInterm].initArrowHead(ahInterm);

			pen.Width = PenWidth;
			pen.Color = frameColor;
			pen.DashStyle = PenDashStyle;
			brush.Release();
			brush = new SolidBrush(fillColor);
			brush.AddRef();
			headPen.Width = PenWidth;
			headPen.Color = frameColor;
			headPen.DashStyle = PenDashStyle;

			if (ctx.FileVersion > 3)
			{
				pen = (Pen)ctx.loadObject();
				ctx.loadReference(this);

				if (ctx.FileVersion > 4)
				{
					// new in file format 5
					allowMoveStart = reader.ReadBoolean();
					allowMoveEnd = reader.ReadBoolean();
					orgnAnchor = reader.ReadInt32();
					destAnchor = reader.ReadInt32();

					if (ctx.FileVersion > 7)
					{
						// new in file format 8
						autoRoute = reader.ReadBoolean();
						retainForm = reader.ReadBoolean();
						textStyle = (ArrowTextStyle)reader.ReadInt32();

						if (ctx.FileVersion > 9)
						{
							// new in file format 10
							headPen = (Pen)ctx.loadObject();

							if (ctx.FileVersion > 16)
							{
								// new in file format 17
								customDraw = (CustomDraw)reader.ReadInt32();

								if (ctx.FileVersion > 19)
								{
									// new in file format 20
									snapToNodeBorder = reader.ReadBoolean();
									selStyle = (HandlesStyle)ctx.reader.ReadInt32();

									if (ctx.FileVersion > 25)
									{
										// new in file format 26
										hyperLink = reader.ReadString();

										if (ctx.FileVersion > 28)
										{
											// new in file format 29
											drawCrossings = reader.ReadBoolean();
										}
									}
								}
							}
						}
					}
				}
			}

			updateText();
		}
コード例 #3
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;
		}
コード例 #4
0
ファイル: Box.cs プロジェクト: ChrisMoreton/Test3
		public override void loadFrom(BinaryReader reader, PersistContext ctx)
		{
			base.loadFrom(reader, ctx);

			int intStyle = 0;
			ShapeTemplate polyShape = null;

			setExpanded(reader.ReadBoolean());
			setExpandable(reader.ReadBoolean());
			enabledHandles = (Handles)reader.ReadInt64();
			intStyle = reader.ReadInt32();
			if (intStyle == 4) // Polygon
				style = BoxStyle.Shape;
			else
				style = (BoxStyle)intStyle;
			fillColor = ctx.loadColor();
			frameColor = ctx.loadColor();
			picturePos = (ImageAlign)reader.ReadInt32();
			text = reader.ReadString();
			textColor = ctx.loadColor();
			textFormat = ctx.loadStringFormat();
			transparent = reader.ReadBoolean();

			// this was used with the now obsolete bsPolygon boxes
			if (ctx.FileVersion < 22)
			{
				ctx.loadPtfArray();
				int c = reader.ReadInt32();
				byte[] b = reader.ReadBytes(c);

				if (intStyle == 4) // Polygon
					polyShape = new ShapeTemplate(b);
			}

			ctx.loadReference(this);
			ctx.loadReference(this);
			ArrowAnchor anchorIncoming =(ArrowAnchor)reader.ReadInt32();
			ArrowAnchor anchorOutgoing= (ArrowAnchor)reader.ReadInt32();
			customDraw = (CustomDraw)reader.ReadInt32();

			image = ctx.loadImage();

			pen.Width = PenWidth;
			pen.Color = frameColor;
			pen.DashStyle = PenDashStyle;
			brush.Release();
			brush = new SolidBrush(fillColor);
			brush.AddRef();

			if (ctx.FileVersion > 2)
			{
				if (ctx.FileVersion < 6)
				{
					shapeTemplate = (ShapeTemplate)ctx.loadObject();
					shapeData = (ShapeTemplate.PathData)ctx.loadObject();
				}

				if (ctx.FileVersion > 3)
				{
					pen = (Pen)ctx.loadObject();
					ctx.loadReference(this);

					selStyle = (HandlesStyle)reader.ReadInt32();

					if (ctx.FileVersion > 4)
					{
						// new in save format 5
						anchorPattern = ctx.loadAnchorPattern();

						if (ctx.FileVersion > 5)
						{
							// new in save format 6
							PolyTextLayout = reader.ReadBoolean();
							ShapeOrientation = (float)reader.ReadDouble();

							int hasShape = reader.ReadInt32();
							if (hasShape != -1)
							{
								string shpId = reader.ReadString();
								if (shpId == "")
								{
									shapeTemplate = (ShapeTemplate)ctx.loadObject();
									shapeData = (ShapeTemplate.PathData)ctx.loadObject();
								}
								else
								{
									ShapeTemplate stvalue = ShapeTemplate.FromId(shpId);
									ShapeTemplate newVal = flowChart.DefaultShape;
									if (stvalue != null)
										newVal = stvalue;
									if (newVal.Id == "")
										shapeTemplate = (ShapeTemplate)newVal.Clone();
									else
										shapeTemplate = newVal;
									shapeData = null;
								}
								updateShapePoints();
							}

							if (intStyle == 4) // Polygon
							{
								shapeTemplate = polyShape;
								shapeData = null;

								updateShapePoints();
							}

							if (ctx.FileVersion > 12)
							{
								// new in save format 13
								// now loaded in Node::loadFrom
								if (ctx.FileVersion < 15)
									hyperLink = reader.ReadString();

								if (ctx.FileVersion > 13)
								{
									// new in save format 14
									useStyledText = reader.ReadBoolean();

									if (ctx.FileVersion > 21)
									{
										// new in save format 22
										rotationAngle = reader.ReadSingle();
										rotateContents = reader.ReadBoolean();
									}
								}
							}
						}
					}
				}
			}

			updateText();
			layoutText();
		}