Esempio n. 1
0
        internal virtual FlowChartContainer GetContent(FlowChartModel model)
        {
            FlowChartContainer container = new FlowChartContainer();

            model.Items.ForEach(x => container.Items.Add(x.GetComponent()));
            return(container);
        }
Esempio n. 2
0
        internal override void Save(FlowChartModel model)
        {
            FlowChartContainer newContent = Util.ConvertFromJSON <FlowChartContainer>(Util.GetJSONString(GetContent(model)));
            FlowChartContainer container  = UndoBuffers.LastOrDefault();

            if (container == null)
            {
                newContent.DisplayName = DateTime.Now.ToString("HH:mm:ss");
                UndoBuffers.Add(newContent);
            }
            else
            {
                string oDisplayName = container.DisplayName;
                container.DisplayName  = "";
                newContent.DisplayName = "";

                if (Util.GetJSONString(newContent) != Util.GetJSONString(container))
                {
                    newContent.DisplayName = DateTime.Now.ToString("HH:mm:ss");
                    UndoBuffers.Add(newContent);
                    if (UndoBuffers.Count > 10)
                    {
                        UndoBuffers.RemoveAt(0);
                    }
                }
                container.DisplayName = oDisplayName;
            }
        }
Esempio n. 3
0
        internal DefaultInputTool(FlowChartModel model, FlowChartPage view)
        {
            this.Model = model;
            this.View  = view;

            View.MouseDown        += new System.Windows.Forms.MouseEventHandler(View_MouseDown);
            View.MouseUp          += new System.Windows.Forms.MouseEventHandler(View_MouseUp);
            View.MouseMove        += new System.Windows.Forms.MouseEventHandler(View_MouseMove);
            View.KeyDown          += new System.Windows.Forms.KeyEventHandler(View_KeyDown);
            View.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(View_MouseDoubleClick);
            View.MouseWheel       += new MouseEventHandler(View_MouseWheel);
            view.DragMouse        += new Action <float, float>(view_DragMouse);
        }
Esempio n. 4
0
        internal override void Save(FlowChartModel model)
        {
            float ZoomFactor = 4.0f;

            using (Bitmap bmp = new Bitmap((int)(601 * ZoomFactor), (int)(851 * ZoomFactor)))
            {
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    System.Drawing.Drawing2D.Matrix mx = new System.Drawing.Drawing2D.Matrix(ZoomFactor, 0, 0, ZoomFactor, 0, 0);
                    g.Transform = mx;

                    g.PageUnit = GraphicsUnit.Pixel;
                    g.Clear(Color.White);
                    g.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                    g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                    g.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.High;

                    model.Items.ForEach(x =>
                    {
                        x.View.Draw(g);
                    });

                    g.Save();

                    ImageFormat fm = ImageFormat.Bmp;
                    if (Path.GetExtension(fileName).ToLower() == ".png")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Png;
                    }
                    else if (Path.GetExtension(fileName).ToLower() == ".jpg")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Jpeg;
                    }
                    else if (Path.GetExtension(fileName).ToLower() == ".jpeg")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Jpeg;
                    }
                    else if (Path.GetExtension(fileName).ToLower() == ".gif")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Gif;
                    }
                    else if (Path.GetExtension(fileName).ToLower() == ".tiff")
                    {
                        fm = System.Drawing.Imaging.ImageFormat.Tiff;
                    }
                    bmp.Save(fileName, fm);
                }
            }
        }
 public ObjectCreateVisitor(FlowChartModel model, FlowChartComponent component)
 {
     this.model     = model;
     this.component = component;
 }
Esempio n. 6
0
        internal override void Save(FlowChartModel model)
        {
            string strContent = Util.GetJSONString(GetContent(model));

            File.WriteAllText(fileName, strContent);
        }
Esempio n. 7
0
 internal abstract void Save(FlowChartModel model);
Esempio n. 8
0
 public ObjectModifyVisitor(FlowChartModel model)
 {
     this.model = model;
 }