Ejemplo n.º 1
0
    private void OnEditPath(object o, EventArgs args)
    {
        IPathObject pathObject = (IPathObject)application.CurrentTilemap;

        if (pathObject.Path == null)
        {
            pathObject.Path = new Path();
            pathObject.Path.Nodes.Add(new Path.Node());
        }
        application.SetToolPath();
    }
Ejemplo n.º 2
0
    private void PopupMenu(int button)
    {
        if (selectedObjects.Count == 0)
        {
            return;
        }

        if (activeObject is ControlPoint)
        {
            return;
        }

        bool groupCloneable = true;             //foreach cycle to get required statistics

        foreach (IObject selectedObject in selectedObjects)
        {
            groupCloneable &= selectedObject is ICloneable;
        }

        Menu popupMenu = new Menu();

        MenuItem cloneItem = new MenuItem("Clone");

        cloneItem.Activated += OnClone;
        cloneItem.Sensitive  = groupCloneable;
        popupMenu.Append(cloneItem);

        if (selectedObjects.Count == 1 && selectedObjects[0] is IPathObject)
        {
            IPathObject pathObject = (IPathObject)selectedObjects[0];

            MenuItem editPathItem = new MenuItem("Edit Path");
            editPathItem.Activated += OnEditPath;
            popupMenu.Append(editPathItem);

            if (pathObject.PathRemovable)
            {
                MenuItem deletePathItem = new MenuItem("Delete Path");
                deletePathItem.Sensitive  = pathObject.Path != null;
                deletePathItem.Activated += OnDeletePath;
                popupMenu.Append(deletePathItem);
            }
        }

        MenuItem deleteItem = new ImageMenuItem(Stock.Delete, null);

        deleteItem.Activated += OnDelete;
        popupMenu.Append(deleteItem);

        popupMenu.ShowAll();
        popupMenu.Popup();
    }
Ejemplo n.º 3
0
    private void OnDeletePath(object o, EventArgs args)
    {
        IPathObject pathObject = (IPathObject)application.CurrentTilemap;

        if (pathObject.Path != null)
        {
            Command command = new PropertyChangeCommand("Removed path of Tilemap " + application.CurrentTilemap.Name + " (" + application.CurrentTilemap.ZPos + ")",
                                                        FieldOrProperty.Lookup(typeof(Tilemap).GetProperty("Path")),
                                                        application.CurrentTilemap,
                                                        null);
            command.Do();
            UndoManager.AddCommand(command);
        }
    }
Ejemplo n.º 4
0
    private void OnDeletePath(object o, EventArgs args)
    {
        if (!(currentObject is IPathObject))
        {
            return;
        }
        IPathObject pathObject = (IPathObject)currentObject;

        if (pathObject.Path != null)
        {
            pathObject.Path = null;
            //application.SetEditor(null);
        }
    }
Ejemplo n.º 5
0
    private void OnDeletePath(object o, EventArgs args)
    {
        IPathObject pathObject = (IPathObject)selectedObjects[0];

        if (pathObject.Path != null)
        {
            Command command = new PropertyChangeCommand("Removed path from " + selectedObjects[0],
                                                        LispReader.FieldOrProperty.Lookup(typeof(IPathObject).GetProperty("Path")),
                                                        selectedObjects[0],
                                                        null);
            command.Do();
            UndoManager.AddCommand(command);
        }
    }
Ejemplo n.º 6
0
    private void OnEditPath(object o, EventArgs args)
    {
        if (!(currentObject is IPathObject))
        {
            return;
        }
        IPathObject pathObject = (IPathObject)currentObject;

        if (pathObject.Path == null)
        {
            pathObject.Path = new Path();
            pathObject.Path.Nodes.Add(new Path.Node());
        }
        application.SetEditor(new PathEditor(application, pathObject.Path));
    }
Ejemplo n.º 7
0
    public void EditProperties(object Object, string title)
    {
        propertiesView.SetObject(Object, title);

        if (Object is Path || Object is Path.Node)
        {
            return;                     //We want to keep currently edited IPathObject
        }
        if (Object is IPathObject)
        {
            iPathToEdit        = (IPathObject)Object;
            ToolPath.Sensitive = true;
        }
        else
        {
            iPathToEdit        = null;
            ToolPath.Sensitive = false;
        }
    }
Ejemplo n.º 8
0
 public static UnoConfig Get(IPathObject obj)
 {
     return(Current.GetDirectoryConfig(Path.GetDirectoryName(obj.FullPath)));
 }
Ejemplo n.º 9
0
    public void FinishRead()
    {
        width  = 0;
        height = 0;
        foreach (Tilemap tmap in this.GetObjects(typeof(Tilemap)))
        {
            if (tmap.Width > width)
            {
                width = tmap.Width;
            }
            if (tmap.Height > height)
            {
                height = tmap.Height;
            }
            tmap.UpdatePos();
        }

        if (!String.IsNullOrEmpty(Music))
        {
            GameObjects.Add(new MusicObject(Music));
            Music = String.Empty;
        }

        if (!(GameObjects.Exists(x => x is AmbientLightObject)))
        {
            GameObjects.Add(new AmbientLightObject(AmbientLight));
            AmbientLight = new Drawing.Color(1f, 1f, 1f);
        }

        List <IGameObject> new_gameobjects = new List <IGameObject>();

        foreach (IGameObject obj in this.GetObjects())
        {
            if (obj is IPathObject)
            {
                IPathObject path_obj = (IPathObject)obj;
                if (path_obj is PathGameObject)
                {
                    // don't touch
                }
                else if (path_obj.Path != null)
                {
                    PathGameObject new_path_gameobject = new PathGameObject();

                    new_path_gameobject.Path = path_obj.Path;
                    path_obj.Path            = null;
                    path_obj.PathRef         = new_path_gameobject.EntityName;

                    new_gameobjects.Add(new_path_gameobject);
                }
            }
        }
        GameObjects.AddRange(new_gameobjects);

        if (GetObjects(typeof(MusicObject)).Count == 0)
        {
            Add(new MusicObject());
        }

        if (GetObjects(typeof(AmbientLightObject)).Count == 0)
        {
            Add(new AmbientLightObject());
        }
    }
Ejemplo n.º 10
0
    public void EditProperties(object Object, string title)
    {
        propertiesView.SetObject(Object, title);

        if (Object is Path || Object is Path.Node)
            return;		//We want to keep currently edited IPathObject
        if (Object is IPathObject) {
            iPathToEdit = (IPathObject) Object;
            ToolPath.Sensitive = true;
        } else {
            iPathToEdit = null;
            ToolPath.Sensitive = false;
        }
    }