예제 #1
0
        private void viewer_MouseMove(object sender, WF.MouseEventArgs e)
        {
            if (_mouseDown)
            {
                return;
            }
            if (!_options.HiliteNode)
            {
                return;
            }

            GD.Node node = GetObjectAt(e.X, e.Y) as GD.Node;

            bool refresh = false;

            if (!_options.HiliteLazy)
            {
                if (UnHilite())
                {
                    refresh = true;
                }
            }

            if (node != null)
            {
                if (_options.HiliteLazy)
                {
                    if (UnHilite())
                    {
                        refresh = true;
                    }
                }

                if (Hilite(node))
                {
                    refresh = true;
                }
            }

            if (refresh)
            {
                _viewer.DrawingPanel.Invalidate();
            }
        }
예제 #2
0
        private void viewer_MouseDoubleClick(object sender, WF.MouseEventArgs e)
        {
            _cancelClick = true;

            GD.Node  node = GetObjectAt(e.X, e.Y) as GD.Node;
            BaseItem item = GetItem(node);

            if (item == null)
            {
                // Use double click on whitespace to toggle ignores visible.
                hideShowLocalIgnoresToolStripMenuItem_Click(null, null);
            }
            else
            {
                // Use double click to toggle ignore status.
                List <BaseItem> list = GetItemList(node);
                _sidePanel.ToggleList(list);
                if (_sidePanel.AutoRefreshCheckBox.Checked)
                {
                    ForceRefresh();
                }
            }
        }
예제 #3
0
        private void ShowContextMenu(int x, int y)
        {
            _menuSelectedNode = GetObjectAt(x, y) as GD.Node;

            contextMenuStrip1.Show(this, x, y + _toolheight);
        }
예제 #4
0
        private BaseItem GetItem(GD.Node node)
        {
            BaseItem item = null;

            if (node != null && node.UserData != null)
            {
                if (node.UserData is BaseItem)
                {
                    item = node.UserData as BaseItem;
                }
                else if (node.UserData is List<BaseItem>)
                {
                    // Iterate over nodes with multiple items.
                    if (_prevNode == node) _prevIdx++;
                    else _prevIdx = 0;

                    List<BaseItem> list = node.UserData as List<BaseItem>;
                    item = list[_prevIdx % list.Count];
                }
                else _logView.Debug("GetItem reports invalid UserData");
                _prevNode = node;
            }

            return item;
        }
예제 #5
0
        protected object AddNode(string id, string caption, Color color, BaseItem item, bool allowDuplicates)
        {
            if (_ignoreSidePanelItems && _sidePanel.Lookup(id)) return null;

            GD.Node node = null;

            if (_addedNodes.ContainsKey(id))
            {
                if (allowDuplicates)
                {
                    node = (GD.Node)_addedNodes[id];

                    if (node.UserData is BaseItem)
                    {
                        List<BaseItem> list = new List<BaseItem>();
                        list.Add((BaseItem)node.UserData);
                        list.Add(item);
                        node.UserData = list;
                    }
                    else if (node.UserData is List<BaseItem>)
                    {
                        List<BaseItem> list = node.UserData as List<BaseItem>;
                        list.Add(item);
                    }
                    else _logView.Debug("AddNode reports invalid UserData");
                }
            }
            else
            {
                // NB Don't add it to the graph yet.
                node = new GD.Node(id);

                node.UserData = (object)item;
                node.Attr.Label = caption;

                GD.Color gcolor = new GD.Color(color.A, color.R, color.G, color.B);
                node.Attr.Fillcolor = gcolor;

                _addedNodes.Add(id, node);
            }

            return node;
        }