void OnGUI()
        {
            // Doc dropdown:
            DocumentEntry entry = DomInspector.DocumentDropdown(Entry);

            if (entry == null)
            {
                return;
            }

            ReflowDocument reflowDoc = entry.Document as ReflowDocument;

            if (reflowDoc == null)
            {
                Entry = entry;
                PowerUIEditor.HelpBox("Not a suitable document (it can't be styled).");
                return;
            }

            if (Entry != entry)
            {
                // Changed!
                Entry            = entry;
                ComputedNodeData = null;

                // Rebuild list of stylesheets.
                RebuildSheets(reflowDoc);
            }

            // Draw a refresh button:
            if (GUILayout.Button("Refresh sheets"))
            {
                // Refresh now:
                RebuildSheets(reflowDoc);
            }

            // Draw dropdown list now!
            int selectedIndex = EditorGUILayout.Popup(SheetIndex, SheetNames);

            if (selectedIndex != SheetIndex || ComputedNodeData == null)
            {
                SheetIndex = selectedIndex;

                try{
                    BuildString(reflowDoc.styleSheets[SheetIndex]);
                }catch (Exception e) {
                    ComputedNodeData = "<b>Error whilst building node data</b>\r\n" + e.ToString();
                }
            }

            GUILayout.Label(ComputedNodeData);
        }
Exemple #2
0
        void OnGUI()
        {
            // Doc dropdown:
            Entry = DocumentDropdown(Entry);

            if (Entry == null)
            {
                return;
            }

            if (ActiveUnfolded == null)
            {
                ActiveUnfolded = new Dictionary <Node, bool>();
            }

            EditorGUI.indentLevel = 0;

            // For each node in the document..
            DrawNode(Entry.Document);
        }