Beispiel #1
0
        public bool Equal(Cdn.Object second)
        {
            bool raw_ret = cdn_object_equal(Handle, second == null ? IntPtr.Zero : second.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
Beispiel #2
0
        public Cdn.Object Copy()
        {
            IntPtr raw_ret = cdn_object_copy(Handle);

            Cdn.Object ret = GLib.Object.GetObject(raw_ret, true) as Cdn.Object;
            return(ret);
        }
Beispiel #3
0
        public Cdn.Object CopyAsTemplate()
        {
            IntPtr raw_ret = cdn_object_new_from_template(Handle);

            Cdn.Object ret = GLib.Object.GetObject(raw_ret, true) as Cdn.Object;
            return(ret);
        }
Beispiel #4
0
        public Cdn.Object GetVariableTemplate(Cdn.Variable variable, bool match_full)
        {
            IntPtr raw_ret = cdn_object_get_variable_template(Handle, variable == null ? IntPtr.Zero : variable.Handle, match_full);

            Cdn.Object ret = GLib.Object.GetObject(raw_ret) as Cdn.Object;
            return(ret);
        }
Beispiel #5
0
        public bool ImportsObject(Cdn.Object objekt)
        {
            bool raw_ret = cdn_import_imports_object(Handle, objekt == null ? IntPtr.Zero : objekt.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
Beispiel #6
0
        public GLib.SList GetAutoTemplatesForChild(Cdn.Object child)
        {
            IntPtr raw_ret = cdn_node_get_auto_templates_for_child(Handle, child == null ? IntPtr.Zero : child.Handle);

            GLib.SList ret = new GLib.SList(raw_ret);
            return(ret);
        }
Beispiel #7
0
        public Cdn.Object FindObject(string selector)
        {
            IntPtr native_selector = GLib.Marshaller.StringToPtrGStrdup(selector);
            IntPtr raw_ret         = cdn_node_find_object(Handle, native_selector);

            Cdn.Object ret = GLib.Object.GetObject(raw_ret) as Cdn.Object;
            GLib.Marshaller.Free(native_selector);
            return(ret);
        }
Beispiel #8
0
        public Cdn.Object GetChild(string name)
        {
            IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
            IntPtr raw_ret     = cdn_node_get_child(Handle, native_name);

            Cdn.Object ret = GLib.Object.GetObject(raw_ret) as Cdn.Object;
            GLib.Marshaller.Free(native_name);
            return(ret);
        }
Beispiel #9
0
        private void Scan(Cdn.Object obj)
        {
            Cdn.Function f = obj as Cdn.Function;

            if (f != null)
            {
                foreach (var v in obj.Variables)
                {
                    if ((v.Flags & Cdn.VariableFlags.FunctionArgument) == 0)
                    {
                        d_functionHelperVariables.Add(v);
                    }
                }

                return;
            }
            else
            {
                d_variables.AddRange(obj.Variables);
            }

            Cdn.Node grp = obj as Cdn.Node;

            if (grp != null && grp.InitialState != null)
            {
                var states = AddEventStateContainer(grp);
                EventStateContainerAdd(states, grp, grp.InitialState);
            }

            ScanEvent(obj as Cdn.Event);

            foreach (Cdn.Variable prop in obj.Variables)
            {
                if (prop.Actions.Length != 0)
                {
                    d_actionedVariables[prop] = prop.Actions;
                }

                AddFlaggedVariable(prop);
            }

            if (grp == null)
            {
                return;
            }

            if (grp.HasSelfEdge)
            {
                Scan((Cdn.Object)grp.SelfEdge);
            }

            foreach (Cdn.Object child in grp.Children)
            {
                Scan(child);
            }
        }
Beispiel #10
0
        public void Dispose()
        {
            if (d_object != null)
            {
                DisconnectWrapped();

                d_object.Dispose();
                d_object = null;
            }
        }
Beispiel #11
0
        public unsafe bool Add(Cdn.Object objekt)
        {
            IntPtr error   = IntPtr.Zero;
            bool   raw_ret = cdn_node_add(Handle, objekt == null ? IntPtr.Zero : objekt.Handle, out error);
            bool   ret     = raw_ret;

            if (error != IntPtr.Zero)
            {
                throw new GLib.GException(error);
            }
            return(ret);
        }
Beispiel #12
0
        public unsafe bool UnapplyTemplate(Cdn.Object templ)
        {
            IntPtr error   = IntPtr.Zero;
            bool   raw_ret = cdn_object_unapply_template(Handle, templ == null ? IntPtr.Zero : templ.Handle, out error);
            bool   ret     = raw_ret;

            if (error != IntPtr.Zero)
            {
                throw new GLib.GException(error);
            }
            return(ret);
        }
Beispiel #13
0
        public unsafe bool VerifyRemoveChild(Cdn.Object child)
        {
            IntPtr error   = IntPtr.Zero;
            bool   raw_ret = cdn_node_verify_remove_child(Handle, child == null ? IntPtr.Zero : child.Handle, out error);
            bool   ret     = raw_ret;

            if (error != IntPtr.Zero)
            {
                throw new GLib.GException(error);
            }
            return(ret);
        }
Beispiel #14
0
        public static unsafe Cdn.Selector Parse(Cdn.Object root, string s)
        {
            IntPtr native_s = GLib.Marshaller.StringToPtrGStrdup(s);
            IntPtr error    = IntPtr.Zero;
            IntPtr raw_ret  = cdn_selector_parse(root == null ? IntPtr.Zero : root.Handle, native_s, out error);

            Cdn.Selector ret = GLib.Object.GetObject(raw_ret) as Cdn.Selector;
            GLib.Marshaller.Free(native_s);
            if (error != IntPtr.Zero)
            {
                throw new GLib.GException(error);
            }
            return(ret);
        }
Beispiel #15
0
 protected virtual void OnChildRemoved(Cdn.Object objekt)
 {
     GLib.Value      ret             = GLib.Value.Empty;
     GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
     GLib.Value[]    vals            = new GLib.Value [2];
     vals [0] = new GLib.Value(this);
     inst_and_params.Append(vals [0]);
     vals [1] = new GLib.Value(objekt);
     inst_and_params.Append(vals [1]);
     g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
     foreach (GLib.Value v in vals)
     {
         v.Dispose();
     }
 }
Beispiel #16
0
 public Selector(Cdn.Object root) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(Selector))
     {
         ArrayList vals  = new ArrayList();
         ArrayList names = new ArrayList();
         if (root != null)
         {
             names.Add("root");
             vals.Add(new GLib.Value(root));
         }
         CreateNativeObject((string[])names.ToArray(typeof(string)), (GLib.Value[])vals.ToArray(typeof(GLib.Value)));
         return;
     }
     Raw = cdn_selector_new(root == null ? IntPtr.Zero : root.Handle);
 }
Beispiel #17
0
 public IntegratorState(Cdn.Object objekt) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(IntegratorState))
     {
         ArrayList vals  = new ArrayList();
         ArrayList names = new ArrayList();
         if (objekt != null)
         {
             names.Add("objekt");
             vals.Add(new GLib.Value(objekt));
         }
         CreateNativeObject((string[])names.ToArray(typeof(string)), (GLib.Value[])vals.ToArray(typeof(GLib.Value)));
         return;
     }
     Raw = cdn_integrator_state_new(objekt == null ? IntPtr.Zero : objekt.Handle);
 }
Beispiel #18
0
        protected void SetWrappedObject(Cdn.Object obj)
        {
            DisconnectWrapped();

            if (d_object != null)
            {
                d_object.Data[WrapperDataKey] = null;
            }

            var oldobj = d_object;

            d_object = obj;

            if (d_object != null)
            {
                d_object.Data[WrapperDataKey] = this;
            }

            ConnectWrapped();
            WrappedObjectChanged(this, oldobj);
        }
Beispiel #19
0
        protected Wrapper(Cdn.Object obj) : base()
        {
            d_links = new List <Edge>();

            d_object = obj;

            if (obj.SupportsLocation())
            {
                int x;
                int y;

                obj.GetLocation(out x, out y);

                Allocation.X = x;
                Allocation.Y = y;
            }

            ConnectWrapped();

            obj.Data[WrapperDataKey] = this;
        }
Beispiel #20
0
        private string UniqueVariableName(Cdn.Object obj, string name)
        {
            if (obj.Variable(name) == null)
            {
                return(name);
            }

            int i = 0;

            while (true)
            {
                var nm = String.Format("{0}_{1}", name, i);

                if (obj.Variable(nm) == null)
                {
                    return(nm);
                }

                ++i;
            }
        }
Beispiel #21
0
        protected virtual bool OnVerifyAddChild(Cdn.Object p0, IntPtr p1)
        {
            GLib.Value      ret             = new GLib.Value(GLib.GType.Boolean);
            GLib.ValueArray inst_and_params = new GLib.ValueArray(3);
            GLib.Value[]    vals            = new GLib.Value [3];
            vals [0] = new GLib.Value(this);
            inst_and_params.Append(vals [0]);
            vals [1] = new GLib.Value(p0);
            inst_and_params.Append(vals [1]);
            vals [2] = new GLib.Value(p1);
            inst_and_params.Append(vals [2]);
            g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
            foreach (GLib.Value v in vals)
            {
                v.Dispose();
            }
            bool result = (bool)ret;

            ret.Dispose();
            return(result);
        }
Beispiel #22
0
        private Cdn.Variable FindSame(Cdn.Network nout, Cdn.Variable v)
        {
            var parent = v.Object;

            Stack <Cdn.Object> parents = new Stack <Object>();

            while (parent != null && parent.Parent != null)
            {
                parents.Push(parent);
                parent = parent.Parent;
            }

            Cdn.Object outParent = nout;

            while (outParent != null && parents.Count > 0)
            {
                parent = parents.Pop();

                var node = outParent as Cdn.Node;

                if (node != null)
                {
                    outParent = node.GetChild(parent.Id);
                }
                else
                {
                    outParent = null;
                }
            }

            if (outParent != null)
            {
                return(outParent.Variable(v.Name));
            }
            else
            {
                return(null);
            }
        }
Beispiel #23
0
        public static Wrapper Wrap(Cdn.Object obj)
        {
            if (obj == null)
            {
                return(null);
            }

            if (obj.Data.ContainsKey(WrapperDataKey))
            {
                return(obj.Data[WrapperDataKey] as Wrapper);
            }

            Type cdnType = obj.GetType();

            if (!s_typeMapping.ContainsKey(cdnType))
            {
                Console.Error.WriteLine("Could not find wrapper for type `{0}'", cdnType);
                return(null);
            }

            return((Wrapper)s_typeMapping[cdnType].Invoke(new object[] { obj }));
        }
Beispiel #24
0
        private void AddAll(GLib.Object obj, Dictionary <GLib.Object, bool> ret)
        {
            ret[obj] = true;

            Cdn.Object o = obj as Cdn.Object;

            Cdn.Node grp = obj as Cdn.Node;

            if (grp != null)
            {
                foreach (Cdn.Object child in grp.Children)
                {
                    AddAll(child, ret);
                }

                foreach (string name in grp.VariableInterface.Names)
                {
                    d_selected[grp.Variable(name)] = true;
                }
            }

            if (o != null)
            {
                foreach (Cdn.Variable prop in o.Variables)
                {
                    d_selected[prop] = true;
                }
            }

            Cdn.Edge link = obj as Cdn.Edge;

            if (link != null)
            {
                foreach (Cdn.EdgeAction action in link.Actions)
                {
                    d_selected[action] = true;
                }
            }
        }
Beispiel #25
0
 public void PrependObject(Cdn.Object objekt)
 {
     cdn_compile_context_prepend_object(Handle, objekt == null ? IntPtr.Zero : objekt.Handle);
 }
Beispiel #26
0
 protected Object(Cdn.Object obj) : base(obj)
 {
     Renderer = new Renderers.Node(this);
 }
Beispiel #27
0
		public void Set(IntPtr gerror, Cdn.Object objekt, Cdn.Variable property, Cdn.EdgeAction action, Cdn.Expression expression) {
			cdn_compile_error_set(Handle, gerror, objekt == null ? IntPtr.Zero : objekt.Handle, property == null ? IntPtr.Zero : property.Handle, action == null ? IntPtr.Zero : action.Handle, expression == null ? IntPtr.Zero : expression.Handle);
		}