예제 #1
0
		public ControlHost(FlowChart parent) : base(parent)
		{
			ctrlMouseAction = parent.HostedCtrlMouseAction;

			mouseDownHandler = null;
			mouseUpHandler = null;

			// ChartObject expects these to be valid
			pen = (Pen)parent.BoxPen.Clone();
			brush = parent.BoxBrush;
			brush.AddRef();

			System.Type controlType = parent.DefaultControlType;
			_control = null;
			if (controlType != null)
			{
				// Instantiate the control
				ConstructorInfo ctorInfo =
					controlType.GetConstructor(System.Type.EmptyTypes);

				Control ctrl = (System.Windows.Forms.Control)ctorInfo.Invoke(null);
				if (ctrl != null)
					ctrl.Visible = false;
				setControl(ctrl);
			}

			setExpandable(parent.ControlHostsExpandable);
			setExpanded(true);

			selStyle = parent.ControlHostHandlesStyle;
		}
예제 #2
0
		public XmlReader(FlowChart diagram)
		{
			_diagram = diagram;

			// Create default options
			_options = new XmlReaderOptions();

			// Create the property map, which
			// maps the old property names to the new property names
			_propertyMap = new Hashtable();

			_propertyMap["ExpandBtnPos"] = "ExpandButtonPosition";
			_propertyMap["SelStyle"] = "HandlesStyle";
			_propertyMap["BoxSelStyle"] = "BoxHandlesStyle";
			_propertyMap["TableCellBorders"] = "CellFrameStyle";
			_propertyMap["TableSelStyle"] = "TableHandlesStyle";
			_propertyMap["MnpHandlesMask"] = "EnabledHandles";
			_propertyMap["CellBorders"] = "CellFrameStyle";
			_propertyMap["ArrowSelStyle"] = "ArrowHandlesStyle";
			_propertyMap["TableRowsCount"] = "TableRowCount";
			_propertyMap["TableColumnsCount"] = "TableColumnCount";
			_propertyMap["ShapeRotation"] = "ShapeOrientation";
			_propertyMap["PrpStartOrientation"] = "CascadeOrientation";
			_propertyMap["PrpArrowStartOrnt"] = "ArrowCascadeOrientation";
			_propertyMap["PrpHorzFirst"] = "CascadeStartHorizontal";
			_propertyMap["ArrowsSplittable"] = "AllowSplitArrows";
			_propertyMap["Picture"] = "Image";
			_propertyMap["PicturePos"] = "ImageAlign";
		}
예제 #3
0
		internal void saveCommand(Command cmd, FlowChart flowChart)
		{
			if (maxDepth == 0 || !flowChart.confirmRecordAction(cmd))
			{
				cmd.freeUndoResources();
				return;
			}

			if (currCmd < commands.Count - 1)
			{
				for (int i = currCmd + 1; i < commands.Count; ++i)
					commands[i].freeRedoResources();
				commands.RemoveRange(currCmd + 1, commands.Count - currCmd - 1);
			}

			commands.Add(cmd);
			currCmd++;

			if (commands.Count > maxDepth)
			{
				commands[0].freeUndoResources();
				commands.RemoveAt(0);
				currCmd--;
			}

			flowChart.fireActionRecorded(cmd);
		}
예제 #4
0
		public Overview()
		{
			// Set some styles
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			SetStyle(ControlStyles.DoubleBuffer, true);
			SetStyle(ControlStyles.ResizeRedraw, true);
			SetStyle(ControlStyles.UserPaint, true);

			document		= null;
			options			= new MindFusion.FlowChartX.PrintOptions(null);
			smoothMode		= SmoothingMode.Default;
			scaleFactor		= 30;
			fitToAll		= false;
			marginalColor	= Color.FromArgb(35, Color.Black);

			// Initialize rendering options
			options.EnableShadows			= true;
			options.EnableImages			= true;
			options.EnableInterior			= true;
			options.EnableBackground		= true;
			options.EnableBackgroundImage	= true;
			options.EnableText				= true;
			options.PaintControls			= true;

			// Auto scroll
			autoScroll = true;
			autoScrDX = autoScrDY = 0;
		}
예제 #5
0
		/// <summary>
		/// Initializes a new instance of the HtmlBuilder class.
		/// </summary>
		/// <param name="fc">The FlowChart object whose contents will generate the image map.</param>
		public HtmlBuilder(FlowChart fc)
		{
			flowChart = fc;
			linkTarget = "_self";
			areasForTableCells = false;
			expandBtnHyperLink = "";
		}
예제 #6
0
		/// <summary>
		/// initialize the routing grid
		/// </summary>
		internal RoutingGrid(FlowChart flowChart)
		{
			this.flowChart = flowChart;
			costGrid = null;
			closedGrid = null;
			openGrid = null;
		}
예제 #7
0
		internal void start(PointF point, FlowChart fc)
		{
			cycleRoots.Clear();
			affectedArrows.Clear();
			startPoint = currentPoint = point;

			if (action == Action.Split)
			{
				invalidRect = currentObject.getRepaintRect(true);
				return;
			}

			if (action == Action.Create)
			{
				fc.raiseInitEvent(currentObject);
				currentObject.startCreate(point);
			}

			if (action == Action.Modify)
			{
				fc.fireBeginModifyEvent(currentObject, point, selectionHandle);
				currentObject.startModify(point, selectionHandle, this);
			}

			invalidRect = currentObject.getRepaintRect(action == Action.Modify);
		}
예제 #8
0
		public FrmPrintPreview(FlowChart fc, string docName)
		{
			InitializeComponent();

            Landscape = false;
            flowChart = fc;
            DocumentName = docName;

            toolBarBtnActPrint.ToolTipText		= "Print";
			toolBarBtnActZoomAuto.ToolTipText	= "Zoom";
			toolBarBtnOnePage.ToolTipText		= "One Page";
			toolBarBtnTwoPages.ToolTipText		= "Two Pages";
			toolBarBtnThreePages.ToolTipText	= "Three Pages";
			toolBarBtnFourPages.ToolTipText		= "Four Pages";
			toolBarBtnSixPages.ToolTipText		= "Six Pages";
			toolBarBtnFirstPage.ToolTipText		= "First Page";
			toolBarBtnPrevPage.ToolTipText		= "Previous Page";
			toolBarBtnNextPage.ToolTipText		= "Next Page";
			toolBarBtnLastPage.ToolTipText		= "Last Page";
			toolBarBtnScale.ToolTipText		= "Fit to Page";
			toolBarBtnOrientation.ToolTipText	= "Landscape";

			fitToPage = false;
			orgScaleFactor = flowChart.PrintOptions.Scale;
			scaleChange = flowChart.PrintOptions.Scale / 5;

			// add the installed printers to the printers menu
			EventHandler printerHandler = new EventHandler(miPrinterMenu_Click);
			foreach (String printerName in PrinterSettings.InstalledPrinters)
				printerMenu.MenuItems.Add(printerName, printerHandler);
		}
예제 #9
0
파일: Group.cs 프로젝트: ChrisMoreton/Test3
    internal void Remove(FlowChart flowChart)
    {

      if (Box != null)
        flowChart.DeleteObject(Box);

      if (Node != null)
        Node.Remove();
    }
예제 #10
0
파일: Node.cs 프로젝트: ChrisMoreton/Test3
		public Node(FlowChart parent) : base(parent)
		{
			incomingArrows = new ArrowCollection();
			outgoingArrows = new ArrowCollection();
			anchorPattern = null;
			obstacle = true;
			constraints = new NodeConstraints();
			enabledHandles = Handles.All;
			boolValues = 0xFFFF;
		}
예제 #11
0
		internal RoutingOptions(FlowChart flowChart)
		{
			this.flowChart = flowChart;

			startOrientation = Orientation.Auto;
			endOrientation = Orientation.Auto;
			triggerRerouting = RerouteArrows.WhenModified;

			anchoring = Anchoring.Ignore;

			SetDefaultMode();
		}
예제 #12
0
		internal UndoManager(FlowChart document)
		{
			this.document = document;

			defaultCmdContext = new CommandContext(document);
			history = new CommandHistory();

			resetContext();

			// disable undo by default, it might be too expensive
			// in memory and CPU cycles
			undoEnabled = false;
		}
예제 #13
0
파일: Item.cs 프로젝트: ChrisMoreton/Test3
    internal void Remove(FlowChart flowChart)
    {

      if (Model != null)
        flowChart.DeleteObject(Model);

      if (Graphic != null)
        flowChart.DeleteObject(Graphic);

      if (Text != null)
        flowChart.DeleteObject(Text);

      if (Node != null)
        Node.Remove();
    }
예제 #14
0
		public ControlHost(FlowChart parent, System.Windows.Forms.Control control) :
			base(parent)
		{
			ctrlMouseAction = parent.HostedCtrlMouseAction;

			// ChartObject expects these to be valid
			pen = (Pen)parent.BoxPen.Clone();
			brush = parent.BoxBrush;
			brush.AddRef();

			if (control != null)
				control.Visible = false;
			setControl(control);

			setExpandable(parent.ControlHostsExpandable);
			setExpanded(true);
		}
예제 #15
0
		public ShapeToolBar()
		{
			document				= null;

			shapeFillColor			= Color.FromArgb(150, 180, 210);
			images					= new ImageList();
			showImages				= true;
			showText				= false;
			applyToSelection		= true;

			allowDrag				= false;
			defaultBoxSize			= new Size(20, 20);
			imageSize				= new Size(16, 16);

			ButtonClick  += new ToolBarButtonClickEventHandler(OnButtonClick);

			shapes = null;
		}
예제 #16
0
파일: Box.cs 프로젝트: ChrisMoreton/Test3
		public Box(FlowChart parent) : base(parent)
		{
			pen = (Pen)flowChart.BoxPen.Clone();
			brush = flowChart.BoxBrush;
			brush.AddRef();

			style = parent.BoxStyle;

			fillColor = parent.BoxFillColor;
			frameColor = parent.BoxFrameColor;

			image = null;
			transparent = false;

			text = parent.BoxText;
			ftext = null;
			textFormat = new StringFormat(parent.TextFormat);
			textColor = parent.TextColor;

			customDraw = parent.BoxCustomDraw;

			shapeRotation = flowChart.ShapeOrientation;
			rotationAngle = 0;
			rotateContents = false;
			shapeTemplate = null;
			if (style == BoxStyle.Shape)
				Shape = flowChart.DefaultShape;

			setExpandable(flowChart.BoxesExpandable);
			setExpanded(true);

			picturePos = ImageAlign.Fit;

			selStyle = flowChart.BoxHandlesStyle;

			useTextLayout = flowChart.PolyTextLayout;
			useStyledText = flowChart.EnableStyledText;
			txOptions = new Text.LayoutOptions();
			txLayout = new Text.Layout();
			updateText();
			layoutText();
		}
예제 #17
0
		public PrintOptions(FlowChart document)
		{
			documentName = " - Untitled - ";
			headerFormat = "%D , Page %P";
			scale = 100.0f;
			enableShadows = true;
			enableImages = true;
			enableInterior = true;
			enableAnchors = false;
			enableBackground = true;
			enableBackgroundImage = true;
			enableText = true;
			paintControls = false;

			this.document = document;

			pageWidth = pageHeight = 0;

			// init the margins to the PrintDocument defaults of 1 inch
			margins = new Margins(100, 100, 100, 100);
		}
예제 #18
0
		/// <summary>
		/// ChartObject constructor
		/// </summary>
		public ChartObject(FlowChart parent)
		{
			flowChart = parent;
			rect = new RectangleF(0, 0, 20, 20);
			tag = null;
			constructed = false;
			modifying = false;
			locked = false;
			subordinateGroup = null;
			masterGroup = null;
			cycleProtect = false;
			cycleDetected = false;
			zIndex = 0;

			font = (Font)parent.Font.Clone();

			penDashStyle = parent.PenDashStyle;
			penWidth = parent.PenWidth;

			shadowOffsetX = flowChart.ShadowOffsetX;
			shadowOffsetY = flowChart.ShadowOffsetY;
			shadowColor = parent.ShadowColor;

			invisible = false;
			selected = false;
			printable = true;

			manipulators = new ArrayList();
			toolTip = "";

			ignoreLayout = false;

			runtimeData = new SortedList();

			weight = 1;
			hyperLink = "";
		}
예제 #19
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;
		}
예제 #20
0
		/// <summary>
		/// Helper class constructor
		/// </summary>
		/// <param name="filePath">Path of the DXF file</param>
		/// <param name="fChart">Flowchart object reference</param>
		/// <param name="ExportTextAsMultiline">ExportTextAsMultiline property value</param>
		/// <param name="ExportExternalImages">ExportExternalImages property value</param>
		/// <param name="NamePattern">Image files name pattern</param>
		/// <param name="ImagePath">Path for image files saving</param>
		public DxfHelper( string filePath, FlowChart fChart, bool ExportTextAsMultiline, bool ExportExternalImages, 
			              string NamePattern, string ImagePath)
		{
			try
			{
			
				// Preparing for writing DXF file
				m_filePath = filePath;
				m_StreamWriter = new StreamWriter(filePath,	false ,	Encoding.ASCII);
				if ( m_StreamWriter	== null)
					throw new Exception("Can't open	DXF	file");

				m_ExportTextAsMultiline = ExportTextAsMultiline;
				m_ExportExternalImages = ExportExternalImages;
				provider = new UnitFormatter( m_UnitScale, ".");
				m_FlowChart = fChart;
				FileNamePattern = NamePattern;
				BasedPath = ImagePath;
				doc = new XmlDocument();

				if ( doc == null )
					throw new Exception("Can't create XML repository");

				// Getting temporarily XML storage from resource
				try
				{
					StreamReader sr = new StreamReader(Assembly.GetExecutingAssembly().
						GetManifestResourceStream("MindFusion.Diagramming.Export.DxfExporter.xml"),Encoding.ASCII);
					if ( sr == null )
						throw new Exception("Can't open stream");

					string XmlContent = sr.ReadToEnd();
					if (XmlContent == "")
						throw new Exception("Can't read content");

					doc.LoadXml(XmlContent);
			
				}
				catch (Exception)				
				{
					throw new Exception("Error loading XML template from resource");
				}
				
				
				// Hashing some temporarily XML nodes for future use
				nodeRoot = doc.DocumentElement;
				
				if ( nodeRoot == null )
					throw new Exception("Can't create nodeRoot");

				HashNode("header", ref nodeHeader);
				HashNode("tables", ref nodeTables);
				HashNode("tables/ltypes", ref nodeLtypes);
				HashNode("tables/style", ref nodeStyle);
				HashNode("tables/layer", ref nodeLayers);
				HashNode("blocks", ref nodeBlocks);
				HashNode("entities", ref nodeEntities);
				HashNode("objects", ref nodeObjects);
				
				// Setting background group				
				XmlNode node = nodeEntities.AppendChild(doc.CreateNode(XmlNodeType.Element,BACKGROUND_LAYER, ""));
				if ( node != null )
					node.InnerText = String.Format(provider, "  0\nSOLID\n  100\nAcDbEntity\n    5\n{10:X3}\n  8\n{9}\n  62\n{8:ACI}\n  100\nAcDbTrace\n  10\n{0:U}\n  20\n{1:U}\n  11\n{2:U}\n  21\n{3:U}\n  12\n{4:U}\n  22\n{5:U}\n  13\n{6:U}\n  23\n{7:U}\n",
						0, 0,
						m_FlowChart.DocExtents.Width, 0,
						0, m_FlowChart.DocExtents.Height,
						m_FlowChart.DocExtents.Width ,m_FlowChart.DocExtents.Height,
						m_FlowChart.BackColor,
						BACKGROUND_LAYER,
						99);
			
				
				// Indicates that object was initialized successfully
				m_valid	= true;
			}
				
			catch (	Exception ex )
			{
				m_valid	= false;
				m_status = ex.Message;
				Trace.WriteLine(String.Format("{0} error {1}\n","DxfHelper.Construct",ex.Message));
			}

		

		}
예제 #21
0
			internal void apply(FlowChart fc)
			{
				fc.toolTip = toolTip;
			}
예제 #22
0
파일: Table.cs 프로젝트: ChrisMoreton/Test3
		public Table(FlowChart parent) : base(parent)
		{
			captionBackBrush = null;
			hasSpanningCells = false;
			coveredCells = null;
			maxRowSpan = 1;

			pen = (Pen)flowChart.TablePen.Clone();
			brush = parent.TableBrush;
			brush.AddRef();

			this.cells = null;
			this.rowsList = null;
			this.colsList = null;
			columnWidth = parent.TableColWidth;
			rowHeight = parent.TableRowHeight;
			redimTable(parent.TableColumnCount, parent.TableRowCount);

			caption = parent.TableCaption;
			captionColor = Color.FromArgb(0, 0, 0);
			fillColor = parent.TableFillColor;
			frameColor = parent.TableFrameColor;
			captionFormat = new StringFormat();
			captionFormat.Alignment = StringAlignment.Center;
			captionFormat.LineAlignment = StringAlignment.Center;
			captionHeight = parent.TableCaptionHeight;

			this.picture = null;

			cellBorders = parent.CellFrameStyle;
			setScrollable(parent.TablesScrollable);
			currScrollRow = 0;

			setExpandable(parent.TablesExpandable);
			setExpanded(true);

			textColor = parent.TextColor;
			picturePos = ImageAlign.Fit;

			selStyle = parent.TableHandlesStyle;
			style = parent.TableStyle;

			rowAnchorPattern = null;

			customDraw = parent.TableCustomDraw;
			cellCustomDraw = parent.CellCustomDraw;

			linkStyle = parent.TableLinkStyle;

			lastAnchorForTable = false;
			lastFoundAnchor = new PointF(0, 0);

			useStyledText = flowChart.EnableStyledText;
			txOptions = new Text.LayoutOptions();
			txLayout = new Text.Layout();
			updateText();
			layoutText();

			hasHeaderRows = false;
			offsetHeaderRows = false;

			if (imageExpand == null)
			{
				lock (typeof(Table))
				{
					if (imageExpand == null)
					{
						ResourceManager rm = new ResourceManager(
							"MindFusion.FlowChartX.Icons", typeof(ChartObject).Assembly);
						imageExpand = rm.GetObject("mnp_rowexpand") as Image;
						imageCollapse = rm.GetObject("mnp_rowcollapse") as Image;
					}
				}
			}
		}
예제 #23
0
        /// <summary>
        /// Main method to export Flowchart.NET into SVG
        /// </summary>
        /// <param name="flowChart">Flowchart.NET object reference</param>
        /// <param name="filePath">String path of the target SVG file</param>
        /// <returns>String report or error description</returns>
        public string Export(FlowChart flowChart, string filePath)
        {
            string sResult = "";

            try
            {
                // Initializing variables
                pChart = flowChart;

                if (pChart == null)
                {
                    throw new Exception("Empty chart reference was passed");
                }

                if (filePath == null)
                {
                    throw new Exception("Empty VDX path was passed");
                }

                // Getting screen resolution 'Pix-Per-Inch' parameter
                IntPtr        hWnd = SvgManager.GetActiveWindow();
                System.IntPtr hDC  = SvgManager.GetDC(hWnd);
                PixPerInch      = SvgManager.GetDeviceCaps(hDC, 88);
                PixPerInchFirst = PixPerInch;


                // Getting FlowChartX document's dimensions

                double OffsetX = 0, OffsetY = 0;

                OffsetX   = pChart.DocExtents.X;
                OffsetY   = pChart.DocExtents.Y;
                DocLeft   = pChart.DocExtents.Left;
                DocTop    = pChart.DocExtents.Top;
                DocRight  = pChart.DocExtents.Right;
                DocBottom = pChart.DocExtents.Bottom;

                lDocX = DocRight - DocLeft;
                lDocY = DocBottom - DocTop;


                lDocX = pChart.DocExtents.Width;
                lDocY = pChart.DocExtents.Height;

                // Calculating FlowChartX document's dimensions	in INCHES

                sMan = new SvgManager(String.Format("{0}px", Unit2Pix(lDocX)), String.Format("{0}px", Unit2Pix(lDocY)), PixPerInch, pChart.MeasureUnit, m_GlueLines, pChart);


                // Preparing item's enumeration

                ResetID();

                // Processing items [ Tables ]

                foreach (MindFusion.FlowChartX.Table Table in pChart.Tables)
                {
                    if (Table == null)
                    {
                        continue;
                    }

                    CreateTable(Table);
                }

                // Processing items [ Boxes ]

                ArrayList.Adapter(pChart.Boxes).Sort(new BoxComparer(true));
                foreach (MindFusion.FlowChartX.Box Box in pChart.Boxes)
                {
                    if (Box == null)
                    {
                        continue;
                    }

                    CreateBox(Box);
                }

                // Processing items [ Arrows ]

                foreach (MindFusion.FlowChartX.Arrow Arrow in pChart.Arrows)
                {
                    if (Arrow == null)
                    {
                        continue;
                    }

                    CreateArrow(Arrow);
                }



                sMan.Save(filePath);
            }
            catch (Exception ex)
            {
                sResult = String.Format("Error occured when exporting: {0}", ex.Message);
                Trace.WriteLine(String.Format("{0} error {1}\n", "ExportVDX", ex.Message));
            }

            return(sResult);
        }
예제 #24
0
    static void Main()
    {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);

      FlowChart flowchart = new FlowChart();

      Config config = new Config();
      if (config.TestUrl(new System.Uri("ipc://SysCAD.Service/Global")))
      {
        config.Syncxxx();

        Dictionary<String, Bitmap> modelThumbnails = new Dictionary<String, Bitmap>();
        Dictionary<String, Bitmap> graphicThumbnails = new Dictionary<String, Bitmap>();

        foreach (String key in config.ModelStencils.Keys)
        {
          ModelStencil stencil = config.ModelStencils[key];
          flowchart.DocExtents = flowchart.ClientToDoc(new System.Drawing.Rectangle(0, 0, 17, 17));
          flowchart.ShadowsStyle = ShadowsStyle.None;
          flowchart.BackColor = System.Drawing.SystemColors.Window;
          flowchart.AntiAlias = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
          RectangleF boxRect = flowchart.ClientToDoc(new System.Drawing.Rectangle(1, 1, 13, 13));
          Box box = flowchart.CreateBox(boxRect.X, boxRect.Y, boxRect.Width, boxRect.Height);
          box.Style = BoxStyle.Shape;
          box.Shape = GetShapeTemplate(stencil);
          box.FillColor = System.Drawing.Color.FromArgb(150, System.Drawing.Color.BurlyWood);
          box.FrameColor = System.Drawing.Color.FromArgb(255, System.Drawing.Color.BurlyWood);
          box.Locked = true;
          modelThumbnails.Add(key, flowchart.CreateImage());
          flowchart.DeleteObject(box);
        }

        Application.Run(new TestAppForm(modelThumbnails, config.ModelStencils));
      }
    }
예제 #25
0
    internal void Remove(FlowChart flowChart)
    {
      if (ModelBox != null)
        flowChart.DeleteObject(ModelBox);

      if (GraphicBox != null)
        flowChart.DeleteObject(GraphicBox);

      if (TextBox != null)
        flowChart.DeleteObject(TextBox);

      if (Node != null)
        Node.Remove();
    }
예제 #26
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ThingEditorForm));
     this.splitter1    = new System.Windows.Forms.Splitter();
     this.panel2       = new System.Windows.Forms.Panel();
     this.panel6       = new System.Windows.Forms.Panel();
     this.flowChart1   = new MindFusion.FlowChartX.FlowChart();
     this.splitter3    = new System.Windows.Forms.Splitter();
     this.panel5       = new System.Windows.Forms.Panel();
     this.thingEditor1 = new SysCAD.ThingEditor.ThingEditorCtrl(graphicThing);
     this.mainMenu1    = new System.Windows.Forms.MainMenu(this.components);
     this.menuItem1    = new System.Windows.Forms.MenuItem();
     this.menuItem3    = new System.Windows.Forms.MenuItem();
     this.menuItem6    = new System.Windows.Forms.MenuItem();
     this.menuItem10   = new System.Windows.Forms.MenuItem();
     this.menuItem9    = new System.Windows.Forms.MenuItem();
     this.menuItem8    = new System.Windows.Forms.MenuItem();
     this.menuItem11   = new System.Windows.Forms.MenuItem();
     this.menuItem12   = new System.Windows.Forms.MenuItem();
     this.menuItem13   = new System.Windows.Forms.MenuItem();
     this.menuItem7    = new System.Windows.Forms.MenuItem();
     this.panel2.SuspendLayout();
     this.panel6.SuspendLayout();
     this.panel5.SuspendLayout();
     this.SuspendLayout();
     //
     // splitter1
     //
     this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.splitter1.Dock        = System.Windows.Forms.DockStyle.Bottom;
     this.splitter1.Location    = new System.Drawing.Point(0, 397);
     this.splitter1.Name        = "splitter1";
     this.splitter1.Size        = new System.Drawing.Size(832, 6);
     this.splitter1.TabIndex    = 1;
     this.splitter1.TabStop     = false;
     //
     // panel2
     //
     this.panel2.Controls.Add(this.panel6);
     this.panel2.Controls.Add(this.splitter3);
     this.panel2.Controls.Add(this.panel5);
     this.panel2.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.panel2.Location = new System.Drawing.Point(0, 0);
     this.panel2.Name     = "panel2";
     this.panel2.Size     = new System.Drawing.Size(832, 397);
     this.panel2.TabIndex = 2;
     //
     // panel6
     //
     this.panel6.Controls.Add(this.flowChart1);
     this.panel6.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.panel6.Location = new System.Drawing.Point(502, 0);
     this.panel6.Name     = "panel6";
     this.panel6.Size     = new System.Drawing.Size(330, 397);
     this.panel6.TabIndex = 2;
     //
     // flowChart1
     //
     this.flowChart1.ActiveMnpColor     = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
     this.flowChart1.BoxStyle           = MindFusion.FlowChartX.BoxStyle.Shape;
     this.flowChart1.CurrentCursor      = System.Windows.Forms.Cursors.Default;
     this.flowChart1.Cursor             = System.Windows.Forms.Cursors.Default;
     this.flowChart1.DefaultControlType = typeof(System.Windows.Forms.Button);
     this.flowChart1.DocExtents         = ((System.Drawing.RectangleF)(resources.GetObject("flowChart1.DocExtents")));
     this.flowChart1.Dock              = System.Windows.Forms.DockStyle.Fill;
     this.flowChart1.Font              = new System.Drawing.Font("Microsoft Sans Serif", 4F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(0)));
     this.flowChart1.InplaceEditFont   = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.flowChart1.Location          = new System.Drawing.Point(0, 0);
     this.flowChart1.Name              = "flowChart1";
     this.flowChart1.ShowToolTips      = false;
     this.flowChart1.Size              = new System.Drawing.Size(330, 397);
     this.flowChart1.TabIndex          = 0;
     this.flowChart1.TableFrameColor   = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
     this.flowChart1.TableHandlesStyle = MindFusion.FlowChartX.HandlesStyle.HatchFrame;
     //
     // splitter3
     //
     this.splitter3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.splitter3.Location    = new System.Drawing.Point(496, 0);
     this.splitter3.Name        = "splitter3";
     this.splitter3.Size        = new System.Drawing.Size(6, 397);
     this.splitter3.TabIndex    = 1;
     this.splitter3.TabStop     = false;
     //
     // panel5
     //
     this.panel5.Controls.Add(this.thingEditor1);
     this.panel5.Dock     = System.Windows.Forms.DockStyle.Left;
     this.panel5.Location = new System.Drawing.Point(0, 0);
     this.panel5.Name     = "panel5";
     this.panel5.Size     = new System.Drawing.Size(496, 397);
     this.panel5.TabIndex = 0;
     //
     // thingEditor1
     //
     this.thingEditor1.Dock      = System.Windows.Forms.DockStyle.Fill;
     this.thingEditor1.GridColor = System.Drawing.Color.DarkGray;
     this.thingEditor1.GridSize  = 10;
     this.thingEditor1.GridStyle = SysCAD.ThingEditor.ThingEditorCtrl.EGridStyle.GrdLine;
     this.thingEditor1.Location  = new System.Drawing.Point(0, 0);
     this.thingEditor1.Name      = "thingEditor1";
     this.thingEditor1.PenColor  = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(255)))));
     //this.thingEditor1.ShowScrollbars = true;
     this.thingEditor1.Size          = new System.Drawing.Size(496, 397);
     this.thingEditor1.TabIndex      = 0;
     this.thingEditor1.Text          = "thingEditor1";
     this.thingEditor1.ShapeChanged += new SysCAD.ThingEditor.ShapeChangeEventHandler(this.thingEditor1_ShapeChanged);
     //
     // mainMenu1
     //
     this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem1
     });
     //
     // menuItem1
     //
     this.menuItem1.Index = 0;
     this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem3,
         this.menuItem6,
         this.menuItem10,
         this.menuItem9,
         this.menuItem8,
         this.menuItem11,
         this.menuItem12,
         this.menuItem13,
         this.menuItem7
     });
     this.menuItem1.Text = "&File";
     //
     // menuItem3
     //
     this.menuItem3.Index  = 0;
     this.menuItem3.Text   = "&New";
     this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
     //
     // menuItem6
     //
     this.menuItem6.Index = 1;
     this.menuItem6.Text  = "-";
     //
     // menuItem10
     //
     this.menuItem10.Index  = 2;
     this.menuItem10.Text   = "Background Color";
     this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
     //
     // menuItem9
     //
     this.menuItem9.Index  = 3;
     this.menuItem9.Text   = "Grid Color";
     this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
     //
     // menuItem8
     //
     this.menuItem8.Index  = 4;
     this.menuItem8.Text   = "Pen Color";
     this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
     //
     // menuItem11
     //
     this.menuItem11.Index = 5;
     this.menuItem11.Text  = "-";
     //
     // menuItem12
     //
     this.menuItem12.Index  = 6;
     this.menuItem12.Text   = "Set Grid Size";
     this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
     //
     // menuItem13
     //
     this.menuItem13.Index = 7;
     this.menuItem13.Text  = "-";
     //
     // menuItem7
     //
     this.menuItem7.Index  = 8;
     this.menuItem7.Text   = "Exit";
     this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(832, 403);
     this.Controls.Add(this.panel2);
     this.Controls.Add(this.splitter1);
     this.Menu = this.mainMenu1;
     this.Name = "Form1";
     this.Text = "Thing Editor";
     this.panel2.ResumeLayout(false);
     this.panel6.ResumeLayout(false);
     this.panel5.ResumeLayout(false);
     this.ResumeLayout(false);
 }
예제 #27
0
		/// <summary>
		/// Method exports Flowchart.NET drawing into Autodesk DXF version 14 format
		/// </summary>
		/// <param name="flowChart">Flowchart reference</param>
		/// <param name="filePath">Output DXF file path to be saved</param>
		/// <returns>Empty string if call was succeded error description otherwise</returns>
		public void Export(FlowChart flowChart, string filePath)
		{
			string sResult = "";

			try
			{

				// Validating input parameters
				if ( flowChart == null )
					throw new Exception("Empty chart reference passed");

				if ( filePath == null )
					throw new Exception("Empty path string passed");

				
				// Parsing input file path extracting directory and file names
				int nIdx = filePath.LastIndexOf("\\");
				int nLen = filePath.Length;
				FileNamePattern = filePath.Substring(nIdx + 1, nLen - ( nIdx + 5));
				BasedPath = filePath.Substring(0, nIdx);
				
				// Creating DxfHelper object passing filePath as a parameter
				m_DxfHelper = new DxfHelper(filePath, flowChart, m_ExportTextAsMultiline, m_ExportExternalImages,
					                        FileNamePattern, BasedPath );
				if ( m_DxfHelper == null )
					throw new Exception("Error creating DXF helper object");

				if (!m_DxfHelper.IsValid())
					throw new Exception(String.Format("DXF helper object isn't valid({0})", m_DxfHelper.GetStatus()));

				// Storing Flowchart control reference for future use
				m_flowChart = flowChart;

				
				// Sorting chart shapes by 'ZIndex' key
				ArrayList.Adapter(flowChart.Boxes).Sort(new DxfHelper.BoxComparer(true));

				// Processing shapes
				foreach ( Box oBox in flowChart.Boxes)
				{

					
					if ( oBox == null )
						continue;
			
					m_DxfHelper.ChartObject2String(oBox);
				
				}

				// Processing arrows
				foreach ( Arrow oArrow in flowChart.Arrows)
				{

					
					if ( oArrow == null )
						continue;
			
					m_DxfHelper.ChartObject2String(oArrow);
					
				
				}
				
				// Processing tables
				foreach ( Table oTable in flowChart.Tables)
				{

					
					if ( oTable == null )
						continue;
			
					m_DxfHelper.ChartObject2String(oTable);
					
				
				}
				
				// Saving prepared DXF file to disk and cleaning up
				m_DxfHelper.Save();
				m_DxfHelper = null;
                m_flowChart = null;

			}
			catch ( Exception ex )
			{
				sResult = String.Format("Error occured when exporting: {0}",ex.Message);
				Trace.WriteLine(String.Format("{0} error {1}\n","Export.DXF",ex.Message));
			}
		}
예제 #28
0
		/// <summary>
		/// Copies the current selection of items to the clipboard.
		/// </summary>
		/// <param name="copy">true if you want data to remain on the Clipboard after this application exits; otherwise, false.</param>
		/// <param name="groups">true to copy item groups; otherwise, false.</param>
		/// <returns>true if items were successfully copied; otherwise, false.</returns>
		public bool CopyToClipboard(bool copy, bool groups)
		{
			bool result = false;

			// create clones of selected items
			ItemsAndGroups data = copySelection(this, true, groups);
			if (data == null) return false;

			// add the clones to an empty flowchart document
			FlowChart clipHelper = new FlowChart();
			if (pasteSelection(clipHelper, data, null, 0, 0))
			{
				// save the clones into a memory stream
				MemoryStream stream = new MemoryStream(40960);
				clipHelper.SaveToStream(stream, true);

				// copy the memory stream to clipboard
				Clipboard.SetDataObject(stream, copy);

				result = true;
			}
			clipHelper.Dispose();

			return result;
		}
예제 #29
0
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
      this.components = new System.ComponentModel.Container();
      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ThingEditorForm));
      this.splitter1 = new System.Windows.Forms.Splitter();
      this.panel2 = new System.Windows.Forms.Panel();
      this.panel6 = new System.Windows.Forms.Panel();
      this.flowChart1 = new MindFusion.FlowChartX.FlowChart();
      this.splitter3 = new System.Windows.Forms.Splitter();
      this.panel5 = new System.Windows.Forms.Panel();
      this.thingEditor1 = new SysCAD.ThingEditor.ThingEditorCtrl(graphicThing);
      this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
      this.menuItem1 = new System.Windows.Forms.MenuItem();
      this.menuItem3 = new System.Windows.Forms.MenuItem();
      this.menuItem6 = new System.Windows.Forms.MenuItem();
      this.menuItem10 = new System.Windows.Forms.MenuItem();
      this.menuItem9 = new System.Windows.Forms.MenuItem();
      this.menuItem8 = new System.Windows.Forms.MenuItem();
      this.menuItem11 = new System.Windows.Forms.MenuItem();
      this.menuItem12 = new System.Windows.Forms.MenuItem();
      this.menuItem13 = new System.Windows.Forms.MenuItem();
      this.menuItem7 = new System.Windows.Forms.MenuItem();
      this.panel2.SuspendLayout();
      this.panel6.SuspendLayout();
      this.panel5.SuspendLayout();
      this.SuspendLayout();
      // 
      // splitter1
      // 
      this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
      this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom;
      this.splitter1.Location = new System.Drawing.Point(0, 397);
      this.splitter1.Name = "splitter1";
      this.splitter1.Size = new System.Drawing.Size(832, 6);
      this.splitter1.TabIndex = 1;
      this.splitter1.TabStop = false;
      // 
      // panel2
      // 
      this.panel2.Controls.Add(this.panel6);
      this.panel2.Controls.Add(this.splitter3);
      this.panel2.Controls.Add(this.panel5);
      this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
      this.panel2.Location = new System.Drawing.Point(0, 0);
      this.panel2.Name = "panel2";
      this.panel2.Size = new System.Drawing.Size(832, 397);
      this.panel2.TabIndex = 2;
      // 
      // panel6
      // 
      this.panel6.Controls.Add(this.flowChart1);
      this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
      this.panel6.Location = new System.Drawing.Point(502, 0);
      this.panel6.Name = "panel6";
      this.panel6.Size = new System.Drawing.Size(330, 397);
      this.panel6.TabIndex = 2;
      // 
      // flowChart1
      // 
      this.flowChart1.ActiveMnpColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
      this.flowChart1.BoxStyle = MindFusion.FlowChartX.BoxStyle.Shape;
      this.flowChart1.CurrentCursor = System.Windows.Forms.Cursors.Default;
      this.flowChart1.Cursor = System.Windows.Forms.Cursors.Default;
      this.flowChart1.DefaultControlType = typeof(System.Windows.Forms.Button);
      this.flowChart1.DocExtents = ((System.Drawing.RectangleF)(resources.GetObject("flowChart1.DocExtents")));
      this.flowChart1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.flowChart1.Font = new System.Drawing.Font("Microsoft Sans Serif", 4F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(0)));
      this.flowChart1.InplaceEditFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
      this.flowChart1.Location = new System.Drawing.Point(0, 0);
      this.flowChart1.Name = "flowChart1";
      this.flowChart1.ShowToolTips = false;
      this.flowChart1.Size = new System.Drawing.Size(330, 397);
      this.flowChart1.TabIndex = 0;
      this.flowChart1.TableFrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
      this.flowChart1.TableHandlesStyle = MindFusion.FlowChartX.HandlesStyle.HatchFrame;
      // 
      // splitter3
      // 
      this.splitter3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
      this.splitter3.Location = new System.Drawing.Point(496, 0);
      this.splitter3.Name = "splitter3";
      this.splitter3.Size = new System.Drawing.Size(6, 397);
      this.splitter3.TabIndex = 1;
      this.splitter3.TabStop = false;
      // 
      // panel5
      // 
      this.panel5.Controls.Add(this.thingEditor1);
      this.panel5.Dock = System.Windows.Forms.DockStyle.Left;
      this.panel5.Location = new System.Drawing.Point(0, 0);
      this.panel5.Name = "panel5";
      this.panel5.Size = new System.Drawing.Size(496, 397);
      this.panel5.TabIndex = 0;
      // 
      // thingEditor1
      // 
      this.thingEditor1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.thingEditor1.GridColor = System.Drawing.Color.DarkGray;
      this.thingEditor1.GridSize = 10;
      this.thingEditor1.GridStyle = SysCAD.ThingEditor.ThingEditorCtrl.EGridStyle.GrdLine;
      this.thingEditor1.Location = new System.Drawing.Point(0, 0);
      this.thingEditor1.Name = "thingEditor1";
      this.thingEditor1.PenColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(255)))));
      //this.thingEditor1.ShowScrollbars = true;
      this.thingEditor1.Size = new System.Drawing.Size(496, 397);
      this.thingEditor1.TabIndex = 0;
      this.thingEditor1.Text = "thingEditor1";
      this.thingEditor1.ShapeChanged += new SysCAD.ThingEditor.ShapeChangeEventHandler(this.thingEditor1_ShapeChanged);
      // 
      // mainMenu1
      // 
      this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem1});
      // 
      // menuItem1
      // 
      this.menuItem1.Index = 0;
      this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem3,
            this.menuItem6,
            this.menuItem10,
            this.menuItem9,
            this.menuItem8,
            this.menuItem11,
            this.menuItem12,
            this.menuItem13,
            this.menuItem7});
      this.menuItem1.Text = "&File";
      // 
      // menuItem3
      // 
      this.menuItem3.Index = 0;
      this.menuItem3.Text = "&New";
      this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
      // 
      // menuItem6
      // 
      this.menuItem6.Index = 1;
      this.menuItem6.Text = "-";
      // 
      // menuItem10
      // 
      this.menuItem10.Index = 2;
      this.menuItem10.Text = "Background Color";
      this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
      // 
      // menuItem9
      // 
      this.menuItem9.Index = 3;
      this.menuItem9.Text = "Grid Color";
      this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
      // 
      // menuItem8
      // 
      this.menuItem8.Index = 4;
      this.menuItem8.Text = "Pen Color";
      this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
      // 
      // menuItem11
      // 
      this.menuItem11.Index = 5;
      this.menuItem11.Text = "-";
      // 
      // menuItem12
      // 
      this.menuItem12.Index = 6;
      this.menuItem12.Text = "Set Grid Size";
      this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
      // 
      // menuItem13
      // 
      this.menuItem13.Index = 7;
      this.menuItem13.Text = "-";
      // 
      // menuItem7
      // 
      this.menuItem7.Index = 8;
      this.menuItem7.Text = "Exit";
      this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
      // 
      // Form1
      // 
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(832, 403);
      this.Controls.Add(this.panel2);
      this.Controls.Add(this.splitter1);
      this.Menu = this.mainMenu1;
      this.Name = "Form1";
      this.Text = "Thing Editor";
      this.panel2.ResumeLayout(false);
      this.panel6.ResumeLayout(false);
      this.panel5.ResumeLayout(false);
      this.ResumeLayout(false);

		}
예제 #30
0
		public bool PasteFromClipboard(float dx, float dy, bool unconnectedArrows)
		{
			bool result = false;
			IDataObject dataObj = null;
			FlowChart clipHelper= null;
			
			try
			{
				// try getting clipboard data; might throw exceptions
				dataObj = Clipboard.GetDataObject();

				// is there anything of interest in the clipboard ?
				if (dataObj != null && dataObj.GetDataPresent(typeof(MemoryStream)))
				{
					MemoryStream stream = dataObj.
						GetData(typeof(MemoryStream)) as MemoryStream;
					stream.Seek(0, SeekOrigin.Begin);

					// load the stream into an empty flowchart document
					// might throw FileLoadException exceptions
					clipHelper = new FlowChart();
					clipHelper.LoadFromStream(stream);
					foreach (ChartObject item in clipHelper.Objects)
						item.Selected = true;

					// now copy items
					ItemsAndGroups data =
						copySelection(clipHelper, unconnectedArrows, true);
					if (data != null)
					{
						// that returns the active composite if somebody has already created one
						CompositeCmd composite = UndoManager.StartComposite("_fcnet_");

						// add the copied items to the document
						result = pasteSelection(this, data, composite, dx, dy);

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

						// fire *pasted events
						foreach (ChartObject item in data.items)
							fireItemPasted(item);
					}
				}
			}
			catch (Exception)
			{
				// data could not be retrieved from the clipboard
				// or it was of unrecognized format
				return false;
			}
			finally
			{
				if (clipHelper != null)
					clipHelper.Dispose();
			}

			return result;
		}
예제 #31
0
		private bool pasteSelection(FlowChart doc, ItemsAndGroups data,
			CompositeCmd cmd, float dx, float dy)
		{
			if (data.items.Count == 0) return false;
			doc.Selection.Clear();

			// add nodes
			foreach (ChartObject item in data.items)
			{
				if (item is Node)
				{
					doc.Add(item);
					doc.Selection.AddObject(item);
				}
			}

			Hashtable arrowPoints = null;
			if (dx != 0 || dy != 0)
				arrowPoints = new Hashtable();

			foreach (ChartObject item in data.items)
			{
				if (item is Arrow)
				{
					Arrow arrow = item as Arrow;

					doc.Add(arrow);
					doc.Selection.AddObject(arrow);

					if (arrowPoints != null)
						arrowPoints.Add(arrow, arrow.ControlPoints.Clone());
				}
			}

			// add groups
			foreach (Group group in data.groups)
				doc.Add(group);

			if (dx != 0 || dy != 0)
			{
				// offset nodes
				foreach (ChartObject item in data.items)
				{
					if (item is Node && item.MasterGroup == null)
					{
						ModifyItemCmd mc = (cmd == null) ? null : new ModifyItemCmd(item);

						Node node = item as Node;
						RectangleF rect = node.BoundingRect;
						rect.Offset(dx, dy);
						node.BoundingRect = rect;

						if (mc != null)
						{
							mc.Execute(true);
							cmd.AddSubCmd(mc);
						}
					}
				}

				// offset arrows
				foreach (ChartObject item in data.items)
				{
					if (item is Arrow)
					{
						ModifyItemCmd mc = (cmd == null) ? null : new ModifyItemCmd(item);

						Arrow arrow = item as Arrow;
						arrow.Points = arrowPoints[arrow] as PointCollection;
						for (int i = 0; i < arrow.ControlPoints.Count; ++i)
						{
							PointF pt = arrow.ControlPoints[i];
							arrow.ControlPoints[i] = new PointF(pt.X + dx, pt.Y + dy);
						}
						arrow.UpdateFromPoints();

						if (mc != null)
						{
							mc.Execute(true);
							cmd.AddSubCmd(mc);
						}
					}
				}
			}

			return true;
		}
예제 #32
0
		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);
		}