Exemplo n.º 1
0
        private void Add(bool hasParent, TreeIter parent, string prefix, object obj, bool loadMembers, bool raw)
        {
            IObjectViewer viewer;

            if (raw)
            {
                viewer = ObjectViewerDirectory.Standard;
            }
            else
            {
                viewer = ObjectViewerDirectory.Choose(obj);
            }

            ObjectViewHeader header = viewer.GetHeader(obj);

            if (!loadMembers)
            {
                if (hasParent)
                {
                    parent = store.AppendValues(parent, prefix + header.Description, GtkProofBox.Box(obj), false);
                }
                else
                {
                    parent = store.AppendValues(prefix + header.Description, GtkProofBox.Box(obj), false);
                }
            }

            if (header.HasMembers || header.AllowRawView)
            {
                if (loadMembers)
                {
                    List <Tupple <string, object> > members = viewer.GetMembers(obj);

                    foreach (Tupple <string, object> member in members)
                    {
                        Add(true, parent, member.A + " = ", member.B, false, false);
                    }

                    if (header.AllowRawView)
                    {
                        parent = store.AppendValues(parent, "Raw view", GtkProofBox.Box(obj), true);

                        ObjectViewHeader rawHeader = ObjectViewerDirectory.Standard.GetHeader(obj);

                        if (rawHeader.HasMembers)
                        {
                            store.AppendValues(parent, "**load on expand placeholder**", null, false);
                        }
                    }
                }
                else
                {
                    store.AppendValues(parent, "**load on expand placeholder**", null);
                }
            }
        }
Exemplo n.º 2
0
        private bool OnUpdatesTimeout()
        {
            lock (updates)
            {
                foreach (ListTupple update in updates)
                {
                    if (update == null)
                    {
                        stack.Pop();
                    }
                    else
                    {
                        Source source = (Source)update[0];
                        string label  = (string)update[1];
                        object tag    = update[2];
                        object link   = update[3];

                        GtkProofBox linkBox = null;

                        if (link != null)
                        {
                            linkBox = new GtkProofBox(tags[link]);
                            label   = label + " ->";
                        }

                        TreeIter iter;

                        if (stack.Count == 0)
                        {
                            iter = store.AppendValues(label, source, linkBox);
                        }
                        else
                        {
                            iter = store.AppendValues(stack.Peek(), label, source, linkBox);
                        }

                        stack.Push(iter);

                        if (tag != null)
                        {
                            TreePath path = store.GetPath(iter);
                            tags[tag] = path;
                        }
                    }
                }

                updates.Clear();
            }

            return(true);
        }
Exemplo n.º 3
0
        private void OnMenuShowObject(object obj, EventArgs args)
        {
            TreeIter iter;

            view.Selection.GetSelected(out iter);

            object viewed = store.GetValue(iter, VALUE_OBJECT);

            viewed = GtkProofBox.Unbox(viewed);

            if (ObjectViewed != null)
            {
                ObjectViewed(viewed);
            }
        }
Exemplo n.º 4
0
        private void OnTreeRowActivated(object obj, RowActivatedArgs args)
        {
            TreeIter iter;

            store.GetIter(out iter, args.Path);

            GtkProofBox linkBox = (GtkProofBox)store.GetValue(iter, VALUE_LINK);

            if (linkBox != null)
            {
                TreePath link = (TreePath)linkBox.Contents;
                view.ExpandToPath(link);
                view.SetCursor(link, column, false);

                return;
            }

            Source source = (Source)store.GetValue(iter, VALUE_SOURCE);

            if ((source != null) && (SourceSelected != null))
            {
                SourceSelected(source, true);
            }
        }
Exemplo n.º 5
0
        private bool OnUpdatesTimeout()
        {
            lock (updates)
            {
                foreach (ListTupple update in updates)
                {
                    if (update == null)
                    {
                        stack.Pop();
                    }
                    else
                    {
                        Source source = (Source) update[0];
                        string label = (string) update[1];
                        object tag = update[2];
                        object link = update[3];
                        
                        GtkProofBox linkBox = null;
                        
                        if (link != null)
                        {
                            linkBox = new GtkProofBox(tags[link]);
                            label = label + " ->";
                        }
                        
                        TreeIter iter;

                        if (stack.Count == 0)
                            iter = store.AppendValues(label, source, linkBox);
                        else
                            iter = store.AppendValues(stack.Peek(), label, source, linkBox);
                        
                        stack.Push(iter);
                        
                        if (tag != null)
                        {
                            TreePath path = store.GetPath(iter);
                            tags[tag] = path;
                        }
                    }
                }
                
                updates.Clear();
            }
            
            return true;
        }
Exemplo n.º 6
0
 private void Add(TreeIter parent, string prefix, string node)
 {
     store.AppendValues(parent, prefix + TextEscape.Quote(node), GtkProofBox.Box(node));
 }