Ejemplo n.º 1
0
        void OutlineTreeIconFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            var    pixRenderer = (CellRendererPixbuf)cell;
            object o           = model.GetValue(iter, 0);

            if (o is DNode)
            {
                var icon = DCompletionData.GetNodeIcon(o as DNode);
                if (icon != (Core.IconId)null)
                {
                    pixRenderer.Pixbuf = ImageService.GetPixbuf(icon.Name, IconSize.Menu);
                }
            }
            else if (o is D_Parser.Dom.Statements.StatementContainingStatement)
            {
                pixRenderer.Pixbuf = ImageService.GetPixbuf("gtk-add", IconSize.Menu);
            }
        }
Ejemplo n.º 2
0
        private void UpdatePath(object sender, Mono.TextEditor.DocumentLocationEventArgs e)
        {
            var ast = Document.ParsedDocument as ParsedDModule;

            if (ast == null)
            {
                return;
            }

            var SyntaxTree = ast.DDom;

            if (SyntaxTree == null)
            {
                return;
            }

            // Resolve the hovered piece of code
            var        loc          = new CodeLocation(Document.Editor.Caret.Location.Column, Document.Editor.Caret.Location.Line);
            IStatement stmt         = null;
            var        currentblock = DResolver.SearchBlockAt(SyntaxTree, loc, out stmt) as IBlockNode;

            //could be an enum value, which is not IBlockNode
            if (currentblock is DEnum)
            {
                foreach (INode nd in (currentblock as DEnum).Children)
                {
                    if ((nd is DEnumValue) &&
                        ((nd.Location <= loc) && (nd.EndLocation >= loc)))
                    {
                        currentblock = nd as IBlockNode;
                        break;
                    }
                }
            }

            List <PathEntry> result = new List <PathEntry>();
            INode            node   = currentblock;

            while ((node != null) && ((node is IBlockNode) || (node is DEnumValue)))
            {
                PathEntry entry;

                var icon = DCompletionData.GetNodeIcon(node as DNode);

                entry          = new PathEntry(icon.IsNull?null: ImageService.GetPixbuf(icon.Name, IconSize.Menu), node.Name + DParameterDataProvider.GetNodeParamString(node));
                entry.Position = EntryPosition.Left;
                entry.Tag      = node;
                //do not include the module in the path bar
                if ((node.Parent != null) && !((node is DNode) && (node as DNode).IsAnonymous))
                {
                    result.Insert(0, entry);
                }
                node = node.Parent;
            }

            if (!((currentblock is DMethod) || (currentblock is DEnumValue)))
            {
                PathEntry noSelection = new PathEntry(GettextCatalog.GetString("No Selection"))
                {
                    Tag = new NoSelectionCustomNode(currentblock)
                };
                result.Add(noSelection);
            }

            var prev = CurrentPath;

            CurrentPath = result.ToArray();
            OnPathChanged(new DocumentPathChangedEventArgs(prev));
        }
Ejemplo n.º 3
0
        public Gdk.Pixbuf GetIcon(int n)
        {
            var icon = DCompletionData.GetNodeIcon(memberList[n] as DNode);

            return(ImageService.GetPixbuf(icon.Name, IconSize.Menu));
        }