コード例 #1
0
ファイル: StructureView.cs プロジェクト: Zekka/labyrinth3
        private void draw_link(Labyrinth.Plot.Link l, Graphics g, Rectangle rect)
        {
            Node node1 = this.find_node(l.LHS);
            Node node2 = this.find_node(l.RHS);

            if (node1 == null || node2 == null)
            {
                return;
            }
            int    num1     = (int)((double)node1.Position.X * (double)rect.Width) + rect.Left;
            PointF position = node1.Position;
            int    num2     = (int)((double)position.Y * (double)rect.Height) + rect.Top;
            PointF pointF1  = new PointF((float)num1, (float)num2);

            position = node2.Position;
            int num3 = (int)((double)position.X * (double)rect.Width) + rect.Left;

            position = node2.Position;
            int    num4    = (int)((double)position.Y * (double)rect.Height) + rect.Top;
            PointF pointF2 = new PointF((float)num3, (float)num4);

            g.DrawLine(SystemPens.ControlText, pointF1, pointF2);
            if (this.fShowText)
            {
                PointF pointF3 = this.get_intersection(pointF2, pointF1, this.rect_for_node(node1, rect));
                PointF pointF4 = this.get_intersection(pointF1, pointF2, this.rect_for_node(node2, rect));
                if (this.fShowArrows)
                {
                    if (l.Direction == LinkDirection.Single || l.Direction == LinkDirection.Double)
                    {
                        pointF4 = this.find_arrow_point(pointF3, pointF4);
                    }
                    if (l.Direction == LinkDirection.Double)
                    {
                        pointF3 = this.find_arrow_point(pointF4, pointF3);
                    }
                }
                SizeF      textSize   = this.get_text_size(l.Description, this.fSmallFont);
                RectangleF rectangleF = new RectangleF(new PointF((float)(((double)pointF3.X + (double)pointF4.X) / 2.0 - (double)textSize.Width / 2.0), (float)(((double)pointF3.Y + (double)pointF4.Y) / 2.0 - (double)textSize.Height / 2.0)), textSize);
                g.FillRectangle(SystemBrushes.FromSystemColor(this.BackColor), rectangleF);
                g.DrawString(l.Description, this.fSmallFont, SystemBrushes.WindowText, rectangleF, this.fStringFormat);
            }
            if (!this.fShowArrows)
            {
                return;
            }
            if (l.Direction == LinkDirection.Single || l.Direction == LinkDirection.Double)
            {
                this.draw_arrow(node1, node2, g, rect);
            }
            if (l.Direction != LinkDirection.Double)
            {
                return;
            }
            this.draw_arrow(node2, node1, g, rect);
        }
コード例 #2
0
ファイル: SearchPage.cs プロジェクト: Zekka/labyrinth3
 private void open_link(Labyrinth.Plot.Link l)
 {
     if (new LinkDlg(l).ShowDialog() != DialogResult.OK)
     {
         return;
     }
     foreach (Structure structure in LabyrinthData.Project.Structures)
     {
         if (structure.Links.Contains(l))
         {
             this.OnStructureModified(new StructureEventArgs(structure));
             break;
         }
     }
 }
コード例 #3
0
ファイル: SearchPage.cs プロジェクト: Zekka/labyrinth3
        private void ResultProperties_Click(object sender, EventArgs e)
        {
            if (this.SelectedResult == null)
            {
                return;
            }
            Element data1 = this.SelectedResult.Data as Element;

            if (data1 != null)
            {
                this.open_element(data1);
            }
            else
            {
                Structure data2 = this.SelectedResult.Data as Structure;
                if (data2 != null)
                {
                    this.open_structure(data2);
                }
                else
                {
                    Timeline data3 = this.SelectedResult.Data as Timeline;
                    if (data3 != null)
                    {
                        this.open_timeline(data3);
                    }
                    else
                    {
                        Annotation data4 = this.SelectedResult.Data as Annotation;
                        if (data4 != null)
                        {
                            this.open_annotation(data4);
                        }
                        else
                        {
                            Labyrinth.Plot.Link data5 = this.SelectedResult.Data as Labyrinth.Plot.Link;
                            if (data5 == null)
                            {
                                return;
                            }
                            this.open_link(data5);
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: StructureView.cs プロジェクト: Zekka/labyrinth3
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            Point client = this.PointToClient(Cursor.Position);

            this.fSelectedNode = this.node_at_point(client);
            if (this.fSelectedNode != null)
            {
                this.fStructure.Nodes.Remove(this.fSelectedNode);
                this.fStructure.Nodes.Add(this.fSelectedNode);
                Rectangle rectangle = this.rect_for_node(this.fSelectedNode, this.ClientRectangle);
                this.fOffset = new Size(client.X - rectangle.X - rectangle.Width / 2, client.Y - rectangle.Y - rectangle.Height / 2);
                if (this.fAddingLink)
                {
                    if (this.fFirstNode == null)
                    {
                        this.fFirstNode = this.fSelectedNode;
                    }
                    else
                    {
                        if (this.fSelectedNode != this.fFirstNode)
                        {
                            Labyrinth.Plot.Link l = new Labyrinth.Plot.Link();
                            l.LHS         = this.fFirstNode.ElementID;
                            l.RHS         = this.fSelectedNode.ElementID;
                            l.Description = "";
                            if (new LinkDlg(l).ShowDialog() == DialogResult.OK)
                            {
                                this.fStructure.Links.Add(l);
                                this.OnStructureModified(new EventArgs());
                            }
                        }
                        this.fAddingLink = false;
                        this.fFirstNode  = (Node)null;
                    }
                }
            }
            else
            {
                this.fAddingLink = false;
                this.fFirstNode  = (Node)null;
            }
            this.Refresh();
        }
コード例 #5
0
ファイル: LinkDlg.cs プロジェクト: Zekka/labyrinth3
        public LinkDlg(Labyrinth.Plot.Link l)
        {
            this.InitializeComponent();
            foreach (LinkDirection linkDirection in Enum.GetValues(typeof(LinkDirection)))
            {
                this.DirBox.Items.Add((object)linkDirection);
            }
            this.fLink = l;
            int index1 = LabyrinthData.Project.Elements.IndexOf(l.LHS);

            if (index1 != -1)
            {
                this.FromNameLbl.Text = LabyrinthData.Project.Elements[index1].Name;
            }
            int index2 = LabyrinthData.Project.Elements.IndexOf(l.RHS);

            if (index2 != -1)
            {
                this.ToNameLbl.Text = LabyrinthData.Project.Elements[index2].Name;
            }
            this.DescBox.Text        = this.fLink.Description;
            this.DirBox.SelectedItem = (object)this.fLink.Direction;
        }
コード例 #6
0
ファイル: SearchPage.cs プロジェクト: Zekka/labyrinth3
        private void ResultOpen_Click(object sender, EventArgs e)
        {
            if (this.SelectedResult == null)
            {
                return;
            }
            Element data1 = this.SelectedResult.Data as Element;

            if (data1 != null)
            {
                this.OnElementActivated(new ElementEventArgs(data1));
            }
            else
            {
                Structure data2 = this.SelectedResult.Data as Structure;
                if (data2 != null)
                {
                    this.OnStructureActivated(new StructureEventArgs(data2));
                }
                else
                {
                    Timeline data3 = this.SelectedResult.Data as Timeline;
                    if (data3 != null)
                    {
                        this.OnTimelineActivated(new TimelineEventArgs(data3));
                    }
                    else
                    {
                        Annotation data4 = this.SelectedResult.Data as Annotation;
                        if (data4 != null)
                        {
                            Element  details1 = this.SelectedResult.Details as Element;
                            Timeline details2 = this.SelectedResult.Details as Timeline;
                            if (details1 != null)
                            {
                                this.OnElementActivated(new ElementEventArgs(details1));
                            }
                            else if (details2 != null)
                            {
                                this.OnTimelineActivated(new TimelineEventArgs(details2));
                            }
                            else
                            {
                                this.open_annotation(data4);
                            }
                        }
                        else
                        {
                            Labyrinth.Plot.Link data5 = this.SelectedResult.Data as Labyrinth.Plot.Link;
                            if (data5 == null)
                            {
                                return;
                            }
                            Structure details = this.SelectedResult.Details as Structure;
                            if (details != null)
                            {
                                this.OnStructureActivated(new StructureEventArgs(details));
                            }
                            else
                            {
                                this.open_link(data5);
                            }
                        }
                    }
                }
            }
        }