コード例 #1
0
ファイル: ObjectWindow.cs プロジェクト: tedneward/katahdin
        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);
                }
            }
        }
コード例 #2
0
ファイル: GrammarWindow.cs プロジェクト: tedneward/katahdin
        private void AddNode(TreeIter parent, OptionsNode optionsNode)
        {
            parent = store.AppendValues(parent, "options", optionsNode);

            Dictionary <string, object> options = new Dictionary <string, object>();

            if (optionsNode.BuildTextNodes.HasValue)
            {
                options["buildTextNodes"] = optionsNode.BuildTextNodes.Value;
            }

            if (optionsNode.RecursionBehaviour.HasValue)
            {
                options["recursionBehaviour"] = optionsNode.RecursionBehaviour.Value;
            }

            if (optionsNode.DropPrecedence.HasValue)
            {
                options["dropPrecedence"] = optionsNode.DropPrecedence.Value;
            }

            if (optionsNode.Whitespace.HasValue)
            {
                options["whitespace"] = optionsNode.Whitespace.Value;
            }

            if (optionsNode.Exclude.HasValue)
            {
                options["exclude"] = optionsNode.Exclude.Value;
            }

            foreach (KeyValuePair <string, object> option in options)
            {
                store.AppendValues(parent, option.Key + " = "
                                   + ObjectViewerDirectory.GetDescription(option.Value), optionsNode);
            }

            AddNode(parent, optionsNode.Body);
        }
コード例 #3
0
ファイル: ObjectWindow.cs プロジェクト: tedneward/katahdin
 private static string GetTitle(object obj)
 {
     return(ObjectViewerDirectory.GetDescription(obj));
 }