Ejemplo n.º 1
0
        public void loadFrom(BinaryReader reader, PersistContext ctx)
        {
            x             = reader.ReadInt16();
            y             = reader.ReadInt16();
            allowIncoming = reader.ReadBoolean();
            allowOutgoing = reader.ReadBoolean();
            markStyle     = (MarkStyle)reader.ReadInt32();
            color         = ctx.loadColor();

            if (ctx.FileVersion > 5)
            {
                // new in file format 6
                col = reader.ReadInt32();

                if (ctx.FileVersion > 6)
                {
                    // new in file format 7
                    tag = null;
                    bool tagAvailable = reader.ReadBoolean();
                    if (tagAvailable)
                    {
                        tag = ctx.loadTag();
                    }

                    if (ctx.FileVersion > 22)
                    {
                        // new in file format 23
                        toolTip = reader.ReadString();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
        {
            rect          = ctx.loadRectF();
            constructed   = reader.ReadBoolean();
            locked        = reader.ReadBoolean();
            zIndex        = reader.ReadInt32();
            penDashStyle  = (DashStyle)reader.ReadInt32();
            penWidth      = (float)reader.ReadDouble();
            shadowOffsetX = (float)reader.ReadDouble();
            shadowOffsetY = (float)reader.ReadDouble();
            invisible     = reader.ReadBoolean();
            selected      = reader.ReadBoolean();

            tag = null;
            bool tagAvailable = reader.ReadBoolean();

            if (tagAvailable)
            {
                tag = ctx.loadTag();
            }

            manipulators = new ArrayList();

            font    = ctx.loadFont();
            toolTip = reader.ReadString();

            ctx.loadReference(this);
            ctx.loadReference(this);

            if (ctx.FileVersion > 9)
            {
                // new in file format 10
                shadowColor  = ctx.loadColor();
                ignoreLayout = reader.ReadBoolean();

                if (ctx.FileVersion > 14)
                {
                    // new in file format 15
                    printable = reader.ReadBoolean();

                    if (ctx.FileVersion > 15)
                    {
                        // new in file format 16
                        weight = reader.ReadSingle();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
        {
            ctx.loadReference(this);
            prevRect = ctx.loadRectF();
            int c = reader.ReadInt32();

            for (int i = 0; i < c; ++i)
            {
                Attachment atch = (Attachment)ctx.loadObject();
                attachments.Add(atch);
            }
            ctx.loadReference(this);
            visible = reader.ReadBoolean();

            tag = null;
            bool tagAvailable = reader.ReadBoolean();

            if (tagAvailable)
            {
                tag = ctx.loadTag();
            }

            if (ctx.FileVersion > 16)
            {
                // new in save format 17
                autoDeleteItems = reader.ReadBoolean();

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

                    if (ctx.FileVersion > 21)
                    {
                        // new in save format 22
                        followMasterRotation = reader.ReadBoolean();
                    }
                }
            }
        }
Ejemplo n.º 4
0
			public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
			{
				toolTip = "";
				hyperLink = "";

				text = reader.ReadString();
				textFormat = ctx.loadStringFormat();
				ctx.loadReference(this);

				if (ctx.FileVersion > 5)
				{
					// new in save format 6
					picturePos = (ImageAlign)reader.ReadInt32();
					picture = ctx.loadImage();

					if (ctx.FileVersion > 13)
					{
						// new in save format 14
						textColor = ctx.loadColor();
						ctx.loadReference(this);	// brush

						if (ctx.FileVersion > 17)
						{
							// new in save format 18
							toolTip = reader.ReadString();

							if (ctx.FileVersion > 18)
							{
								// new in save format 19
								hyperLink = reader.ReadString();

								if (ctx.FileVersion > 21)
								{
									// new in save format 22
									columnSpan = reader.ReadInt32();
									rowSpan = reader.ReadInt32();

									tag = null;
									bool tagAvailable = reader.ReadBoolean();
									if (tagAvailable)
										tag = ctx.loadTag();
								}
							}
						}
					}
				}

				txOptions = new Text.LayoutOptions();
				txLayout = new Text.Layout();
			}
Ejemplo n.º 5
0
		/// <summary>
		/// Loads the FlowChart document from a stream.
		/// </summary>
		public void LoadFromStream(Stream stream)
		{
			try
			{
				loading = true;
				SuspendLayout();
				ClearAll();

				PersistContext ctx = new PersistContext(stream, this);
				ctx.readHeader();

				// read basic-type flowchart properties
				DocInfoVer1 docInfo1 = (DocInfoVer1)ctx.loadObject();
				DocInfoVer2 docInfo2 = (DocInfoVer2)ctx.loadObject();
				docInfo1.apply(this);
				docInfo2.apply(this);

				textFormat = ctx.loadStringFormat();
				Font = ctx.loadFont();
				BackgroundImage = ctx.loadImage();

				// read diagram objects
				zOrder = (ChartObjectCollection)ctx.loadObject();
				groups = (GroupCollection)ctx.loadObject();
				selection = (Selection)ctx.loadObject();

				ctx.loadReference(this);

				if (ctx.FileVersion > 2)
				{
					shapeTemplate = (ShapeTemplate)ctx.loadObject();

					if (ctx.FileVersion > 3)
					{
						Brush.RestoreBrushes(this, new BinaryReader(stream), ctx);
						boxPen = (Pen)ctx.loadObject();
						arrowPen = (Pen)ctx.loadObject();
						tablePen = (Pen)ctx.loadObject();
						ctx.loadReference(this);
						ctx.loadReference(this);
						ctx.loadReference(this);

						boxSelStyle = (HandlesStyle)ctx.reader.ReadInt32();
						tableSelStyle = (HandlesStyle)ctx.reader.ReadInt32();

						if (ctx.FileVersion > 4)
						{
							// new in save format 5
							allowLinksRepeat = ctx.reader.ReadBoolean();

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

								if (ctx.FileVersion > 7)
								{
									// new in save format 8
									routeArrows = ctx.reader.ReadBoolean();
									arrowsRetainForm = ctx.reader.ReadBoolean();
									arrowTextStyle = (ArrowTextStyle)ctx.reader.ReadInt32();
									tableLinkStyle = (TableLinkStyle)ctx.reader.ReadInt32();

									if (ctx.FileVersion >= 12)
									{
										// new in save format 12
										measureUnit = (GraphicsUnit)ctx.reader.ReadInt32();

										docExtentsMin = ctx.loadRectF();

										if (ctx.FileVersion > 13)
										{
											// new in save format 14
											expandBtnPos = (ExpandButtonPosition)ctx.reader.ReadInt32();

											// not used anymore
											ctx.reader.ReadInt32();
											ctx.reader.ReadInt32();

											enableStyledText = ctx.reader.ReadBoolean();
											usePolyTextLt = ctx.reader.ReadBoolean();
											ctx.loadReference(this);	// brush

											if (ctx.FileVersion > 16)
											{
												// new in save format 17
												arrowText = ctx.reader.ReadString();
												boxText = ctx.reader.ReadString();
												arrowCrossings = (ArrowCrossings)ctx.reader.ReadInt32();
												gridStyle = (GridStyle)ctx.reader.ReadInt32();
												crossRadius = ctx.reader.ReadSingle();

												if (ctx.FileVersion > 19)
												{
													// new in save format 20
													ctx.loadReference(this);	// exteriorBrush
													arrowsSnapToBorders = ctx.reader.ReadBoolean();
													arrowSelStyle = (HandlesStyle)ctx.reader.ReadInt32();

													if (ctx.FileVersion > 20)
													{
														// new in save format 21
														Tag = null;
														bool tagAvailable = ctx.reader.ReadBoolean();
														if (tagAvailable)
															Tag = ctx.loadTag();

														if (ctx.FileVersion > 26)
														{
															// new in save format 27
															roundedArrows = ctx.reader.ReadBoolean();
															roundedArrowsRadius = ctx.reader.ReadSingle();
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}

				// finish load
				ctx.loadRemainingObjects();
				ctx.setReferences();

				// add the objects to their specialized collections
				foreach (ChartObject obj in zOrder)
					addToObjColl(obj);
				foreach (Group group in groups)
					group.updateObjCol();

				Brush.freeUnusedBrushes();

				foreach (ChartObject obj in zOrder)
					obj.onLoad();

				dirty = false;
				Invalidate();
			}
			finally
			{
				loading = false;
				ResumeLayout(true);
			}
		}
Ejemplo n.º 6
0
		public override void loadFrom(BinaryReader reader, PersistContext ctx)
		{
			base.loadFrom(reader, ctx);

			enabledHandles = (Handles)reader.ReadInt64();
			ctrlMouseAction = (HostMouseAction)reader.ReadInt32();
			ctx.loadReference(this); // incoming arrows
			ctx.loadReference(this); // outgoing arrows

			// Load control
			if (reader.ReadBoolean())
			{
				string assemblyName = reader.ReadString();
				string typeName = reader.ReadString();

				System.Type type = Utilities.getLoadedType(typeName, assemblyName);
				if (type == null)
					throw new FileLoadException("Cannot load hosted control of type " + typeName);

				ConstructorInfo ctorInfo = type.GetConstructor(System.Type.EmptyTypes);

				// Instantiate
				Control = (System.Windows.Forms.Control)ctorInfo.Invoke(null);

				// Read properties
				while (reader.ReadBoolean())
				{
					string propName = reader.ReadString();
					object val = ctx.loadTag();
					try
					{
						PropertyInfo prop = type.GetProperty(propName);
						prop.SetValue(_control, val, null);
					}
					catch
					{
						// Exceptions happen
					}
				}

				flowChart.fireControlHostDeserializing(this, reader);
			}
			else
			{
				Control = null;
			}

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

				if (ctx.FileVersion > 21)
				{
					// new in save format 22
					selStyle = (HandlesStyle)reader.ReadInt32();
				}
			}
		}
Ejemplo n.º 7
0
		public void loadFrom(BinaryReader reader, PersistContext ctx)
		{
			x = reader.ReadInt16();
			y = reader.ReadInt16();
			allowIncoming = reader.ReadBoolean();
			allowOutgoing = reader.ReadBoolean();
			markStyle = (MarkStyle)reader.ReadInt32();
			color = ctx.loadColor();

			if (ctx.FileVersion > 5)
			{
				// new in file format 6
				col = reader.ReadInt32();

				if (ctx.FileVersion > 6)
				{
					// new in file format 7
					tag = null;
					bool tagAvailable = reader.ReadBoolean();
					if (tagAvailable)
						tag = ctx.loadTag();

					if (ctx.FileVersion > 22)
					{
						// new in file format 23
						toolTip = reader.ReadString();
					}
				}
			}
		}
Ejemplo n.º 8
0
		public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
		{
			ctx.loadReference(this);
			prevRect = ctx.loadRectF();
			int c = reader.ReadInt32();
			for (int i = 0; i < c; ++i)
			{
				Attachment atch = (Attachment)ctx.loadObject();
				attachments.Add(atch);
			}
			ctx.loadReference(this);
			visible = reader.ReadBoolean();

			tag = null;
			bool tagAvailable = reader.ReadBoolean();
			if (tagAvailable)
				tag = ctx.loadTag();

			if (ctx.FileVersion > 16)
			{
				// new in save format 17
				autoDeleteItems = reader.ReadBoolean();

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

					if (ctx.FileVersion > 21)
					{
						// new in save format 22
						followMasterRotation = reader.ReadBoolean();
					}
				}
			}
		}
Ejemplo n.º 9
0
		public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
		{
			rect = ctx.loadRectF();
			constructed = reader.ReadBoolean();
			locked = reader.ReadBoolean();
			zIndex = reader.ReadInt32();
			penDashStyle = (DashStyle)reader.ReadInt32();
			penWidth = (float)reader.ReadDouble();
			shadowOffsetX = (float)reader.ReadDouble();
			shadowOffsetY = (float)reader.ReadDouble();
			invisible = reader.ReadBoolean();
			selected = reader.ReadBoolean();

			tag = null;
			bool tagAvailable = reader.ReadBoolean();
			if (tagAvailable)
				tag = ctx.loadTag();

			manipulators = new ArrayList();

			font = ctx.loadFont();
			toolTip = reader.ReadString();

			ctx.loadReference(this);
			ctx.loadReference(this);

			if (ctx.FileVersion > 9)
			{
				// new in file format 10
				shadowColor = ctx.loadColor();
				ignoreLayout = reader.ReadBoolean();

				if (ctx.FileVersion > 14)
				{
					// new in file format 15
					printable = reader.ReadBoolean();

					if (ctx.FileVersion > 15)
					{
						// new in file format 16
						weight = reader.ReadSingle();
					}
				}
			}
		}
Ejemplo n.º 10
0
        public override void loadFrom(BinaryReader reader, PersistContext ctx)
        {
            base.loadFrom(reader, ctx);

            enabledHandles  = (Handles)reader.ReadInt64();
            ctrlMouseAction = (HostMouseAction)reader.ReadInt32();
            ctx.loadReference(this);             // incoming arrows
            ctx.loadReference(this);             // outgoing arrows

            // Load control
            if (reader.ReadBoolean())
            {
                string assemblyName = reader.ReadString();
                string typeName     = reader.ReadString();

                System.Type type = Utilities.getLoadedType(typeName, assemblyName);
                if (type == null)
                {
                    throw new FileLoadException("Cannot load hosted control of type " + typeName);
                }

                ConstructorInfo ctorInfo = type.GetConstructor(System.Type.EmptyTypes);

                // Instantiate
                Control = (System.Windows.Forms.Control)ctorInfo.Invoke(null);

                // Read properties
                while (reader.ReadBoolean())
                {
                    string propName = reader.ReadString();
                    object val      = ctx.loadTag();
                    try
                    {
                        PropertyInfo prop = type.GetProperty(propName);
                        prop.SetValue(_control, val, null);
                    }
                    catch
                    {
                        // Exceptions happen
                    }
                }

                flowChart.fireControlHostDeserializing(this, reader);
            }
            else
            {
                Control = null;
            }

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

                if (ctx.FileVersion > 21)
                {
                    // new in save format 22
                    selStyle = (HandlesStyle)reader.ReadInt32();
                }
            }
        }