Esempio n. 1
0
        public void MoveDown()
        {
            // check if there is slice below, if not create it!
            if (activeSliceNode == slices.First)
            {
                System.Console.WriteLine("Creating new slice below");
                AddSliceBelow();
            }
            else
            {
                // just move down
                activeSlice.DeActivate();
                activeSliceNode.Previous.Value.ActivateNode(activeSlice.Path);
                activeSlice     = activeSliceNode.Previous.Value;
                activeSliceNode = activeSliceNode.Previous;
                //activeSlice.ShowLabels();
                activeSliceHeight--;

                // TODO: Destroy textures of slice more than 1 above
                // for now just dont render

                foreach (var slice in slices)
                {
                    if (slice.SliceHeight - activeSliceHeight >= 2)
                    {
                        slice.Visible = false;
                    }
                }
            }
        }
Esempio n. 2
0
        public void AddSliceAbove(String path)
        {
            // destroy all existing slices above us
            while (activeSliceNode != slices.Last)
            {
                slices.Last.Value.Destroy();
                slices.RemoveLast();
            }

            // make new slice
            FileSlice upperSlice = new FileSlice(path, activeSliceHeight + 1, parentWindow);

            // set its position
            Vector3 newSlicePosition = activeSlice.Position + (Vector3.UnitY * SLICE_SPACING);

            // it is now directly above us, move it to line up with parent
            newSlicePosition.Z += activeSlice.ActiveBox[1] * 6.0f;
            newSlicePosition.X -= activeSlice.ActiveBox[0] * 6.0f;

            upperSlice.Position = newSlicePosition;
            upperSlice.ResetVisible();

            activeSlice.HideLabels();

            activeSliceNode      = slices.AddLast(upperSlice);
            activeSlice          = upperSlice;
            activeSlice.Scale    = 0f;
            activeSlice.IsScaled = true;

            activeSliceHeight++;
        }
Esempio n. 3
0
        public void MoveUp()
        {
            // Check there is a slice above us to move up to
            if (activeSliceNode == slices.Last)
            {
                System.Console.WriteLine("Denying move up, no upper slice!");
                return;
            }
            //before doing anything set the slice 2 above to visible
            if (activeSliceNode.Next.Next != null)
            {
                activeSliceNode.Next.Next.Value.Visible = true;
            }

            activeSlice.HideLabels();

            // set slice above us to be active
            activeSlice     = activeSliceNode.Next.Value;
            activeSliceNode = activeSliceNode.Next;
            activeSlice.Activate();


            activeSliceHeight++;

            // TODO: Destroy textures of slices more than 1 below
        }
Esempio n. 4
0
        public int Reset(String path)
        {
            Trace.WriteLine("SliceManager.Reset");
            // destroy gl textures
            foreach (var slice in slices)
            {
                slice.Destroy();
            }
            // destroy slices
            slices.Clear();

            // reset height
            activeSliceHeight = 0;

            // make new fileSlice, set to active
            activeSlice = new FileSlice(path, activeSliceHeight, parentWindow);
            activeSlice.FillFileSliceWithDrives();

            if (activeSlice.ShowAllText)
            {
                activeSlice.GenerateAllTextures();
            }
            else
            {
                activeSlice.ResetVisible();
            }
            activeSlice.Scale    = 0f;
            activeSlice.IsScaled = true;

            // add to slice list
            activeSliceNode = slices.AddLast(activeSlice);

            return(activeSliceHeight);
        }
Esempio n. 5
0
        public void AddSliceAbove(String path)
        {
            // destroy all existing slices above us
            while(activeSliceNode != slices.Last) {
                slices.Last.Value.Destroy();
                slices.RemoveLast();
            }

            // make new slice
            FileSlice upperSlice = new FileSlice(path, activeSliceHeight +1, parentWindow);

            // set its position
            Vector3 newSlicePosition = activeSlice.Position + (Vector3.UnitY * SLICE_SPACING);

            // it is now directly above us, move it to line up with parent
            newSlicePosition.Z += activeSlice.ActiveBox[1] * 6.0f;
            newSlicePosition.X -= activeSlice.ActiveBox[0] * 6.0f;

            upperSlice.Position = newSlicePosition;
            upperSlice.ResetVisible();

            activeSlice.HideLabels();

            activeSliceNode = slices.AddLast(upperSlice);
            activeSlice = upperSlice;
            activeSlice.Scale = 0f;
            activeSlice.IsScaled = true;

            activeSliceHeight++;
        }
Esempio n. 6
0
        public int AddSliceBelow()
        {
            Trace.WriteLine("AddSliceBelow");
            String parentPath;

            // check if we are at the root
            try {
                parentPath = Directory.GetParent(activeSlice.Path).FullName;
            } catch {
                return(activeSliceHeight);
            }

            // make new slice
            FileSlice lowerSlice = new FileSlice(parentPath, activeSliceHeight - 1, parentWindow);

            // set its position
            Vector3 newSlicePosition = activeSlice.Position - (Vector3.UnitY * SLICE_SPACING);

            // it is now directly below us, move it to line up with parent
            lowerSlice.ActivateNode(activeSlice.Path);
            newSlicePosition.Z -= lowerSlice.ActiveBox[1] * 6.0f;
            newSlicePosition.X += lowerSlice.ActiveBox[0] * 6.0f;

            lowerSlice.Position = newSlicePosition;
            lowerSlice.ResetVisible();

            activeSliceNode = slices.AddFirst(lowerSlice);

            activeSlice = lowerSlice;

            activeSliceHeight--;

            foreach (var slice in slices)
            {
                if (slice.SliceHeight - activeSliceHeight >= 2)
                {
                    slice.Visible = false;
                }
            }

            return(activeSliceHeight);
        }
Esempio n. 7
0
        public void AddSliceAbove(FileSlice activeNodeChildSlice)
        {
            Trace.WriteLine("AddSliceAbove");
            // destroy all existing slices above us
            while (activeSliceNode != slices.Last)
            {
                slices.Last.Value.Destroy();
                slices.RemoveLast();
            }

            // set its position
            Vector3 newSlicePosition = activeSlice.Position + (Vector3.UnitY * SLICE_SPACING);

            // it is now directly above us, move it to line up with parent
            newSlicePosition.Z += activeSlice.ActiveBox[1] * 6.0f;
            newSlicePosition.X -= activeSlice.ActiveBox[0] * 6.0f;

            activeNodeChildSlice.Position = newSlicePosition;

            //Dimm all nodes in current activeSlice, as it will be replaced with a new one in a second
            activeSlice.HideAllNodes();

            activeSliceNode = slices.AddLast(activeNodeChildSlice);
            activeSlice     = activeNodeChildSlice;

            if (activeSlice.ShowAllText)
            {
                activeSlice.GenerateAllTextures();
            }
            else
            {
                activeSlice.ResetVisible();
            }

            activeSlice.Scale    = 0f;
            activeSlice.IsScaled = true;

            activeSliceHeight++;
        }
Esempio n. 8
0
        public int Reset(String path)
        {
            // destroy gl textures
            foreach (var slice in slices)
            {
                slice.Destroy();
            }
            // destroy slices
            slices.Clear();

            // reset height
            activeSliceHeight = 0;

            // make new fileSlice, set to active
            activeSlice          = new FileSlice(path, activeSliceHeight, parentWindow);
            activeSlice.Scale    = 0f;
            activeSlice.IsScaled = true;

            // add to slice list
            activeSliceNode = slices.AddLast(activeSlice);

            return(activeSliceHeight);
        }
Esempio n. 9
0
    private void ToParent(bool clearAbove)
    {
        inTransition = false;

        if(clearAbove) {
            slices.MoveDownClear();
        } else {
            slices.MoveDown();
        }
        sliceToFade = slices.ActiveSlice;

        glwidget1.HasFocus = true;
        fadeOut = false;
        inVerticalTransition = true;
        ChangedActive();
        ActivateTransition();
        statusbar6.Pop(0);
        statusbar6.Push(0, " " + slices.ActiveSlice.NumFiles + " items");
        entry4.Text = slices.ActiveSlice.Path;
    }
Esempio n. 10
0
 public void SetParent(FileSlice newParent)
 {
     parentSlice = newParent;
 }
Esempio n. 11
0
        public static FileNode GetFileNode(int nodeType, String fileName, FileSlice owner)
        {
            int fileDisplayList;

            if(listGenerated[nodeType]) {
                fileDisplayList = displayLists[nodeType];
            } else {
                fileDisplayList = displayLists[nodeType] = GenerateDisplayList(nodeType);
            }

            GLib.File fi = GLib.FileFactory.NewForPath(fileName);

            FileNode node = new FileNode(fi.Basename);
            node.File = fileName;
            //node.NumChildren = fi.
            GLib.FileInfo info = fi.QueryInfo("access::can-execute,thumbnail::path,filesystem::readonly,time::modified", GLib.FileQueryInfoFlags.None, null);
            node.SetDisplayList(fileDisplayList);

            node.SetParent(owner);

            if(nodeType == DIR_NODE) {
                node.IsDirectory = true;
                try {
                    node.NumDirs = Directory.GetDirectories(fileName).Length;
                    node.NumFiles = Directory.GetFiles(fileName).Length;
                    node.NumChildren = node.NumDirs + node.NumFiles;
                    node.DirHeight = GetHeightForFolder(node.NumChildren);
                } catch {
                    node.NumChildren = 0;
                    node.DirHeight = 1f;
                }
            } else {
                String description = Gnome.Vfs.Mime.GetDescription(fi.QueryInfo("standard::content-type", GLib.FileQueryInfoFlags.None, null).ContentType);
                if(description == null) {
                    // use the extension
                    String[] split = node.FileName.Split('.');
                    if(split.Length > 1) {
                        description = split[split.Length-1] + " file";
                    } else {
                        // no extension either
                        description = "unknown";
                    }
                }
                node.Description = description;

                if(info.GetAttributeBoolean("filesystem::readonly")) {
                    node.IsReadOnly = true;
                } else if(info.GetAttributeBoolean("access::can-execute")) {
                    node.IsExecutable = true;
                } else {
                    node.TypeColour = NodeManager.GetColourForNode(node);
                }
            }

            node.ModifyTime = ConvertFromUnixTimestamp(Convert.ToUInt64(info.GetAttributeAsString("time::modified")));
            //Console.WriteLine(node.File + " : " + node.ModifyTime.ToString("MMMM dd, yyyy"));

            string previewPath = info.GetAttributeByteString("thumbnail::path");
            if(previewPath != null) {
                node.ThumbFileName = previewPath;
            }

            return node;
        }
Esempio n. 12
0
        public void MoveUp()
        {
            // Check there is a slice above us to move up to
            if(activeSliceNode == slices.Last) {
                System.Console.WriteLine("Denying move up, no upper slice!");
                return;
            }
            //before doing anything set the slice 2 above to visible
            if(activeSliceNode.Next.Next != null) {
                activeSliceNode.Next.Next.Value.Visible = true;
            }

            activeSlice.HideLabels();

            // set slice above us to be active
            activeSlice = activeSliceNode.Next.Value;
            activeSliceNode = activeSliceNode.Next;
            activeSlice.Activate();

            activeSliceHeight++;

            // TODO: Destroy textures of slices more than 1 below
        }
Esempio n. 13
0
    private void NodeActivated()
    {
        FileNode activeNode = slices.ActiveSlice.GetActiveNode();
        if(activeNode.IsDirectory) {
            int numFiles;
            int numFolders;
            try {
                numFiles = Directory.GetFiles(activeNode.File).Length;
                numFolders = Directory.GetDirectories(activeNode.File).Length;
            } catch(Exception e) {
                glwidget1.HasFocus = true;
                statusbar6.Pop(0);
                statusbar6.Push(0, " Error viewing folder - " + activeNode.File + " : " + e.Message);
                return;
            }

            if(numFiles + numFolders == 0) {
                glwidget1.HasFocus = true;
                statusbar6.Pop(0);
                statusbar6.Push(0, " Not Viewing Empty Folder - " + activeNode.File);
                return;
            }
            inVerticalTransition = true;
            fadeOut = true;
            scaleIn = true;
            sliceToFade = slices.ActiveSlice;
            slices.AddSliceAbove(activeNode.File);
            ChangedActive();
            ActivateTransition();
            statusbar6.Pop(0);
            statusbar6.Push(0, " " + slices.ActiveSlice.NumFiles + " items");
            entry4.Text = slices.ActiveSlice.Path;
        } else {
            // launch the file!
            System.Console.WriteLine("Launching " + activeNode.File);
            // TODO: Launch using GIO
            System.Diagnostics.Process.Start(activeNode.File);
            statusbar6.Pop(0);
            statusbar6.Push(0, " Launched " + activeNode.File);

        }
    }
Esempio n. 14
0
 private void NavUp()
 {
     sliceToFade = slices.ActiveSlice;
     slices.MoveUp();
     inVerticalTransition = true;
     fadeOut = true;
     ActivateTransition();
     ChangedActive();
     statusbar6.Pop(0);
     statusbar6.Push(0, " " + slices.ActiveSlice.NumFiles + " items");
     entry4.Text = slices.ActiveSlice.Path;
 }
Esempio n. 15
0
        public static FileNode GetFileNode(int nodeType, String fileName, FileSlice owner)
        {
            int fileDisplayList;

            if (listGenerated[nodeType])
            {
                fileDisplayList = displayLists[nodeType];
            }
            else
            {
                fileDisplayList = displayLists[nodeType] = GenerateDisplayList(nodeType);
            }


            GLib.File fi = GLib.FileFactory.NewForPath(fileName);

            FileNode node = new FileNode(fi.Basename);

            node.File = fileName;
            //node.NumChildren = fi.
            GLib.FileInfo info = fi.QueryInfo("access::can-execute,thumbnail::path,filesystem::readonly,time::modified", GLib.FileQueryInfoFlags.None, null);
            node.SetDisplayList(fileDisplayList);

            node.SetParent(owner);

            if (nodeType == DIR_NODE)
            {
                node.IsDirectory = true;
                try {
                    node.NumDirs     = Directory.GetDirectories(fileName).Length;
                    node.NumFiles    = Directory.GetFiles(fileName).Length;
                    node.NumChildren = node.NumDirs + node.NumFiles;
                    node.DirHeight   = GetHeightForFolder(node.NumChildren);
                } catch {
                    node.NumChildren = 0;
                    node.DirHeight   = 1f;
                }
            }
            else
            {
                String description = Gnome.Vfs.Mime.GetDescription(fi.QueryInfo("standard::content-type", GLib.FileQueryInfoFlags.None, null).ContentType);
                if (description == null)
                {
                    // use the extension
                    String[] split = node.FileName.Split('.');
                    if (split.Length > 1)
                    {
                        description = split[split.Length - 1] + " file";
                    }
                    else
                    {
                        // no extension either
                        description = "unknown";
                    }
                }
                node.Description = description;

                if (info.GetAttributeBoolean("filesystem::readonly"))
                {
                    node.IsReadOnly = true;
                }
                else if (info.GetAttributeBoolean("access::can-execute"))
                {
                    node.IsExecutable = true;
                }
                else
                {
                    node.TypeColour = NodeManager.GetColourForNode(node);
                }
            }


            node.ModifyTime = ConvertFromUnixTimestamp(Convert.ToUInt64(info.GetAttributeAsString("time::modified")));
            //Console.WriteLine(node.File + " : " + node.ModifyTime.ToString("MMMM dd, yyyy"));

            string previewPath = info.GetAttributeByteString("thumbnail::path");

            if (previewPath != null)
            {
                node.ThumbFileName = previewPath;
            }

            return(node);
        }
Esempio n. 16
0
        public int AddSliceBelow()
        {
            String parentPath;

            // check if we are at the root
            try {
                parentPath = Directory.GetParent(activeSlice.Path).FullName;
            } catch {
                return activeSliceHeight;
            }

            // make new slice
            FileSlice lowerSlice = new FileSlice(parentPath, activeSliceHeight -1, parentWindow);

            // set its position
            Vector3 newSlicePosition = activeSlice.Position - (Vector3.UnitY * SLICE_SPACING);

            // it is now directly below us, move it to line up with parent
            lowerSlice.ActivateNode(activeSlice.Path);
            newSlicePosition.Z -= lowerSlice.ActiveBox[1] * 6.0f;
            newSlicePosition.X += lowerSlice.ActiveBox[0] * 6.0f;

            lowerSlice.Position = newSlicePosition;
            lowerSlice.ResetVisible();

            activeSliceNode = slices.AddFirst(lowerSlice);

            activeSlice = lowerSlice;

            activeSliceHeight--;

            foreach(var slice in slices) {
                if(slice.SliceHeight - activeSliceHeight >= 2) {
                    slice.Visible = false;
                }
            }

            return activeSliceHeight;
        }
Esempio n. 17
0
        public int Reset(String path)
        {
            // destroy gl textures
            foreach(var slice in slices) {
                slice.Destroy();
            }
            // destroy slices
            slices.Clear();

            // reset height
            activeSliceHeight = 0;

            // make new fileSlice, set to active
            activeSlice = new FileSlice(path, activeSliceHeight, parentWindow);
            activeSlice.Scale = 0f;
            activeSlice.IsScaled = true;

            // add to slice list
            activeSliceNode = slices.AddLast(activeSlice);

            return activeSliceHeight;
        }
Esempio n. 18
0
 public void SetParent(FileSlice newParent)
 {
     parentSlice = newParent;
 }
Esempio n. 19
0
        public void MoveDown()
        {
            // check if there is slice below, if not create it!
            if(activeSliceNode == slices.First) {
                System.Console.WriteLine("Creating new slice below");
                AddSliceBelow();
            } else {
                // just move down
                activeSlice.DeActivate();
                activeSliceNode.Previous.Value.ActivateNode(activeSlice.Path);
                activeSlice = activeSliceNode.Previous.Value;
                activeSliceNode = activeSliceNode.Previous;
                //activeSlice.ShowLabels();
                activeSliceHeight--;

                // TODO: Destroy textures of slice more than 1 above
                // for now just dont render

                foreach(var slice in slices) {
                    if(slice.SliceHeight - activeSliceHeight >= 2) {
                        slice.Visible = false;
                    }
                }
            }
        }