예제 #1
0
        /// <summary>
        /// Redraws the Class view
        /// </summary>
        /// <param name="clObject">Main object of the class view</param>
        public void DrawClassView(DrawableClassObject clObject)
        {
            //     if (IsDrawingBoardOpen) CloseDrawingBoardBegin();
            ClassCanvas.DrawClass(clObject);

            _currentClass = clObject;
        }
예제 #2
0
        void ToolStripMenuItem1Click(object sender, System.EventArgs e)
        {
            ClassCanvasItem item = ClassCanvas.CreateItemFromType(new DefaultClass(cu, "ClassDiagram.ClassCanvasItem"));

            item.X = 20;
            item.Y = 20;
            classcanvas.AddCanvasItem(item);
        }
        protected override void OnOwnerChanged(EventArgs e)
        {
            base.OnOwnerChanged(e);
            ToolBarComboBox box1 = (ToolBarComboBox)this.ComboBox;

            comboBox = box1.ComboBox;
            comboBox.DropDownStyle = ComboBoxStyle.DropDown;
            comboBox.Items.AddRange(new object[] { "10%", "25%", "50%", "75%",
                                                   "100%", "125%", "150%", "175%", "200%",
                                                   "250%", "300%", "350%", "400%" });

            ClassCanvas canvas = Canvas;

            if (canvas != null)
            {
                canvas.ZoomChanged += CanvasZoomChanged;
            }
            comboBox.TextChanged += ComboBoxTextChanged;
        }
예제 #4
0
        public override void Run()
        {
            IProject p        = ProjectService.CurrentProject;
            string   filename = Path.Combine(p.Directory, p.Name + ".cd");

            if (p == null)
            {
                return;
            }

            /*if (p.IsFileInProject(filename))
             * {
             *      ProjectItem pi = p.Items.Find(
             *              delegate(ProjectItem pItem)
             *              { return pItem.FileName == filename; }
             *      );
             * }
             * else*/
            {
                //MessageBox.Show("Creating a new class diagram file named "+"\"+p.Directory+filename);
                ClassCanvas classcanvas = new ClassCanvas();

                IProjectContent pc = ParserService.GetProjectContent(p);
                //float x = 20, y = 20;
                //float max_h = 0;

                foreach (IClass ct in pc.Classes)
                {
                    ClassCanvasItem classitem = ClassCanvas.CreateItemFromType(ct);
                    classcanvas.AddCanvasItem(classitem);
                }

                classcanvas.AutoArrange();
                XmlDocument xmlDocument = classcanvas.WriteToXml();
                FileUtility.ObservedSave(
                    newFileName => SaveAndOpenNewClassDiagram(p, newFileName, xmlDocument),
                    filename, FileErrorPolicy.ProvideAlternative
                    );
            }
        }
예제 #5
0
        void InitBtnClick(object sender, System.EventArgs e)
        {
            float x = 20, y = 20;
            float max_h = 0;

            foreach (IClass ct in pc.Classes)
            {
                ClassCanvasItem classitem = ClassCanvas.CreateItemFromType(ct);
                classitem.X = x;
                classitem.Y = y;
                classcanvas.AddCanvasItem(classitem);
                x += classitem.Width + 20;
                if (classitem.Height > max_h)
                {
                    max_h = classitem.Height;
                }
                if (x > 1000)
                {
                    x     = 20;
                    y    += max_h + 20;
                    max_h = 0;
                }
            }
        }