Example #1
0
    public override void OnInspectorGUI()
    {
        WrapperNode component = ((WrapperNode)target);

        if (component != null)
        {
            EditorGUILayout.LabelField("Object:", component.name);
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Property", "\tShow\t Input\t Output");
                EditorGUILayout.EndHorizontal();
            }

            if (component.properties != null)
            {
                for (int idx = 0; idx < component.properties.Length; ++idx)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(component.properties[idx].name);
                    component.__isShown[idx]  = EditorGUILayout.Toggle(component.__isShown[idx]);
                    component.__isInput[idx]  = EditorGUILayout.Toggle(component.__isInput[idx]);
                    component.__isOutput[idx] = EditorGUILayout.Toggle(component.__isOutput[idx]);
                    EditorGUILayout.EndHorizontal();
                }
            }
        }
        EditorGUILayout.Separator();
        foreach (string c in component.connections)
        {
            EditorGUILayout.LabelField(c);
        }
    }
Example #2
0
        void OnTreeViewRowActivated(object o, RowActivatedArgs args)
        {
            WrapperNode node = d_treeview.NodeStore.FindPath(args.Path);

            if (node != null)
            {
                Activated(this, new WrapperNode[] { node });
            }
        }
Example #3
0
        private void OnRendererToggleToggled(object o, ToggledArgs args)
        {
            WrapperNode node = d_treeview.NodeStore.FindPath(args.Path);

            if (node != null)
            {
                node.Checked = !node.Checked;
            }
        }
Example #4
0
        private bool FilterFunc(Node node)
        {
            WrapperNode wp = (WrapperNode)node;

            if (!String.IsNullOrEmpty(d_searchText) && !wp.FilterName.ToLowerInvariant().Contains(d_searchText))
            {
                if (d_selected == null)
                {
                    return(false);
                }
                else if (wp.Wrapper != null && !d_selected.ContainsKey(wp.Wrapper.WrappedObject))
                {
                    return(false);
                }
                else if (wp.Variable != null && !d_selected.ContainsKey(wp.Variable))
                {
                    return(false);
                }
                else if (wp.Action != null && !d_selected.ContainsKey(wp.Action))
                {
                    return(false);
                }
            }

            Wrappers.Edge link = wp.Wrapper as Wrappers.Edge;

            if (link != null && (link.Input != null || link.Output != null))
            {
                return(false);
            }

            bool ret = true;

            if (d_filterStorage != null)
            {
                d_filterStorage(wp, ref ret);
            }

            return(ret);
        }
Example #5
0
            public int Sort(WrapperNode b)
            {
                HeaderType ad = DerivedHeaderType;
                HeaderType bd = b.DerivedHeaderType;

                if (ad != bd)
                {
                    return(((int)ad).CompareTo((int)bd));
                }

                if (d_wrapper == null)
                {
                    return(-1);
                }
                else if (b.Wrapper == null)
                {
                    return(1);
                }
                else
                {
                    return(Name.CompareTo(b.Name));
                }
            }
Example #6
0
            private void UpdateInconsistency(WrapperNode node, bool val)
            {
                if (val != d_checked)
                {
                    if (!d_inconsistent.Contains(node))
                    {
                        d_inconsistent.Add(node);
                        EmitChanged();
                    }
                }
                else
                {
                    if (d_inconsistent.Contains(node))
                    {
                        d_inconsistent.Remove(node);
                        EmitChanged();
                    }
                }

                if (Parent != null && Parent is WrapperNode)
                {
                    ((WrapperNode)Parent).UpdateInconsistency(node, val);
                }
            }
Example #7
0
 private void OnNodeToggled(WrapperNode node)
 {
     Toggled(this, node);
 }
Example #8
0
        public WrappersTree(Wrappers.Node parent) : base(false, 0)
        {
            d_treeview = new Widgets.TreeView <WrapperNode>();
            d_group    = parent;

            TreeViewColumn col;

            col = new TreeViewColumn();

            d_rendererToggle = new CellRendererToggle();
            col.PackStart(d_rendererToggle, false);
            col.SetAttributes(d_rendererToggle,
                              "active", WrapperNode.Column.Checked,
                              "inconsistent", WrapperNode.Column.Inconsistent);

            d_rendererToggle.Toggled += OnRendererToggleToggled;

            d_rendererIcon = new CellRendererPixbuf();
            col.PackStart(d_rendererIcon, false);
            col.SetAttributes(d_rendererIcon, "pixbuf", WrapperNode.Column.Icon);

            d_rendererName = new CellRendererText();
            col.PackStart(d_rendererName, true);
            col.SetAttributes(d_rendererName, "text", WrapperNode.Column.Name, "sensitive", WrapperNode.Column.Sensitive);

            d_treeview.AppendColumn(col);

            d_treeview.HeadersVisible       = false;
            d_treeview.NodeStore.SortColumn = 0;
            d_treeview.ShowExpanders        = false;
            d_treeview.LevelIndentation     = 6;
            d_treeview.EnableSearch         = false;
            d_treeview.SearchColumn         = -1;
            d_treeview.Selection.Mode       = SelectionMode.Multiple;

            d_treeview.StartInteractiveSearch += OnTreeViewInteractiveSearch;

            d_treeview.RowActivated  += OnTreeViewRowActivated;
            d_treeview.PopulatePopup += OnTreeViewPopulatePopup;
            d_treeview.KeyPressEvent += OnTreeViewKeyPressEvent;

            // Keep expanded
            d_treeview.Model.RowInserted += delegate(object o, RowInsertedArgs args) {
                TreeRowReference r = new TreeRowReference(d_treeview.Model, args.Path);

                GLib.Idle.Add(delegate {
                    if (r.Valid())
                    {
                        d_treeview.ExpandToPath(r.Path);
                    }

                    return(false);
                });
            };

            d_treeview.NodeStore.NodeAdded += delegate(Node par, Node child) {
                WrapperNode n = (WrapperNode)child;
                n.Toggled += OnNodeToggled;

                foreach (WrapperNode c in n.Descendents)
                {
                    c.Toggled += OnNodeToggled;
                }
            };

            d_treeview.NodeStore.NodeRemoved += delegate(Node par, Node child, int wasAtIndex) {
                WrapperNode n = (WrapperNode)child;
                n.Toggled -= OnNodeToggled;

                foreach (WrapperNode c in n.Descendents)
                {
                    c.Toggled -= OnNodeToggled;
                }
            };

            Build(parent);

            d_treeview.Show();

            ScrolledWindow wd = new ScrolledWindow();

            wd.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            wd.ShadowType = ShadowType.EtchedIn;
            wd.Add(d_treeview);
            wd.Show();

            PackStart(wd, true, true, 0);

            HBox hbox = new HBox(false, 3);

            hbox.Show();

            d_entry = new Entry();
            d_entry.Show();

            Image img = new Image(Gtk.Stock.Find, IconSize.Button);

            img.Show();

            d_label = new Label("");
            d_label.Show();

            hbox.PackStart(img, false, false, 0);
            hbox.PackStart(d_label, false, false, 0);
            hbox.PackStart(d_entry, true, true, 0);
            hbox.BorderWidth = 6;

            PackStart(hbox, false, false, 0);

            d_entry.Changed       += HandleEntryChanged;
            d_entry.KeyPressEvent += HandleEntryKeyPressEvent;

            d_treeview.ExpandAll();
            d_treeview.NodeStore.Filter(FilterFunc);
        }
Example #9
0
        public override IEnumerator <Tup> GetEnumerator()
        {
            var wrapper = new WrapperNode(Heading, While(Heading, _source, _whifunc.Call));

            return(wrapper.GetEnumerator());
        }