コード例 #1
0
 public TextProperties(My_Text figure, EntityDrawningCore core)
 {
     InitializeComponent();
     this.figure = figure;
     this.core   = core;
     LoadData();
 }
コード例 #2
0
        public void CreateNewText()
        {
            My_Text text = new My_Text(this);

            UnselectAll();
            SelectedFigure = text;
            SelectedFigures.Add(text);
            picture.FigureList.Add(text);
            Lock = true;
        }
コード例 #3
0
        public void ShowTextproperties()
        {
            if (SelectedFigure is My_Text == false)
            {
                return;
            }
            My_Text        text     = SelectedFigure as My_Text;
            TextProperties textprop = new TextProperties(text, this);

            textprop.ShowDialog();
            AddToHistory();
        }
コード例 #4
0
ファイル: My_Text.cs プロジェクト: cuijialang/HDL_ANTLR4
        public My_Text(My_Text item)
            : base(item)
        {
            this.Text         = item.Text;
            this.center_point = item.center_point;
            this.Font         = item.Font;

            mouse_move = MouseMove;
            mouse_down = MouseDown;
            mouse_up   = MouseUp;
            draw       = Draw;
        }
コード例 #5
0
ファイル: My_Port.cs プロジェクト: cuijialang/HDL_ANTLR4
        public My_Port(EntityDrawningCore core, PortType type, bool Inverse)
            : base(core)
        {
            this.Inverse = Inverse;
            this.type    = type;
            Name         = "New_Port";

            TextLabel       = new My_Text(core, Name, new Point(0, 0));
            TextLabel.Owner = this;

            vhdPort = new vhdPort();

            draw       = Draw;
            mouse_move = MouseMoveCreateNew;
            mouse_down = MouseDownCreateNew;
            mouse_up   = MouseUpCreateNew;
        }
コード例 #6
0
ファイル: My_Port.cs プロジェクト: cuijialang/HDL_ANTLR4
        public My_Port(EntityDrawningCore core, String Name, PortType type, bool Inverse, vhdPort vhdPort, Point point1, Point point2)
            : base(core)
        {
            this.Inverse = Inverse;
            this.type    = type;
            this.Name    = Name;
            this.point1  = point1;
            this.point2  = point2;
            this.vhdPort = vhdPort;

            TextLabel       = new My_Text(core, Name, new Point(0, 0));
            TextLabel.Owner = this;

            draw       = Draw;
            mouse_move = MouseMove;
            mouse_down = MouseDown;
            mouse_up   = MouseUp;
        }
コード例 #7
0
ファイル: My_Port.cs プロジェクト: cuijialang/HDL_ANTLR4
        public My_Port(My_Port item)
            : base(item)
        {
            point1 = item.point1;
            point2 = item.point2;

            Inverse   = item.Inverse;
            type      = item.type;
            this.Name = item.Name;

            this.vhdPort = item.vhdPort;

            TextLabel       = new My_Text(item.TextLabel);
            TextLabel.Owner = this;

            mouse_move = MouseMove;
            mouse_down = MouseDown;
            mouse_up   = MouseUp;
            draw       = Draw;
        }
コード例 #8
0
        private void GenerateFigures()
        {
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            int InPortsCount  = SelectedEntity.ports.Count((f) => f.inout == portInOut.In);
            int OutPortsCount = SelectedEntity.ports.Count - InPortsCount;

            int Max_Input_Port = 0;
            int Max_Out_Port   = 0;

            foreach (vhdPort p in SelectedEntity.ports)
            {
                if ((p.inout == portInOut.In) && (p.name.Length > Max_Input_Port))
                {
                    Max_Input_Port = p.name.Length;
                }
                if ((p.inout != portInOut.Out) && (p.name.Length > Max_Out_Port))
                {
                    Max_Out_Port = p.name.Length;
                }
            }

            int width  = (SelectedEntity.name.Length + Max_Input_Port + Max_Out_Port) * 10 + 10;
            int height = (Math.Max(InPortsCount, OutPortsCount)) * 15;

            Point Location = new Point(200, 200);

            My_Rectangle rect = new My_Rectangle(core, new Rectangle(200, 200, width, height));

            rect.zIndex--;
            My_Line line1 = new My_Line(core, new Point(200 + Max_Input_Port * 10, 200), new Point(200 + 10 * Max_Input_Port, 200 + height));

            line1.zIndex++;
            My_Line line2 = new My_Line(core, new Point(200 + width - 10 * Max_Out_Port, 200), new Point(200 + width - 10 * Max_Out_Port, 200 + height));

            line2.zIndex++;
            My_Text text = new My_Text(core, SelectedEntity.name, new Point(200 + (width / 2), 200 + (height / 2)));

            int delta = (InPortsCount != 0)?height / InPortsCount:0;
            int index = 0;

            foreach (vhdPort p in SelectedEntity.ports)
            {
                if (p.inout != portInOut.In)
                {
                    continue;
                }

                My_Port port = new My_Port(core, p.name, My_Port.PortType.Simple, false, p, new Point(190, 200 + delta / 2 + delta * index), new Point(200, 200 + delta / 2 + delta * index));
                port.TextLabel.CenterPoint = new Point(port.CenterPoint.X + Max_Input_Port * 5, port.CenterPoint.Y);
                port.zIndex++;
                figures.Add(port);
                index++;
            }

            delta = (InPortsCount != 0) ? height / OutPortsCount : 0;
            index = 0;
            foreach (vhdPort p in SelectedEntity.ports)
            {
                if (p.inout == portInOut.In)
                {
                    continue;
                }

                My_Port port = new My_Port(core, p.name, My_Port.PortType.Simple, false, p, new Point(200 + width + 10, 200 + delta / 2 + delta * index), new Point(200 + width, 200 + delta / 2 + delta * index));
                port.TextLabel.CenterPoint = new Point(port.CenterPoint.X - Max_Input_Port * 5, port.CenterPoint.Y);
                port.zIndex++;
                figures.Add(port);
                index++;
            }

            figures.Add(rect);
            figures.Add(line1);
            figures.Add(line2);
            figures.Add(text);
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        }