Beispiel #1
0
 private void RightFilePane_OnFocusEvent(object sender, EventArgs e)
 {
     LeftFilePane.DeactivatePane();
     RightFilePane.ActivatePane();
     m_activePane     = RightFilePane;
     PathTextBox.Text = m_activePane.CurrentPath;
     UpdateTitleBar();
 }
Beispiel #2
0
 private void FilePane_OnSyncronisationRequested(object sender, EventArgs e)
 {
     if (m_activePane == LeftFilePane)
     {
         RightFilePane.SetDirectory(m_activePane.CurrentPath, null, FilePane.GrabFocusType.NoFocusChange);
     }
     else
     {
         LeftFilePane.SetDirectory(m_activePane.CurrentPath, null, FilePane.GrabFocusType.NoFocusChange);
     }
 }
Beispiel #3
0
        private void ChangeViewFilter_Click(object sender, EventArgs e)
        {
            m_viewMask = 0;

            if (showSystemFilesToolStripMenuItem.Checked)
            {
                m_viewMask |= ViewFilter.ViewMask.ShowSystem;
            }

            if (showHiddenFilesToolStripMenuItem.Checked)
            {
                m_viewMask |= ViewFilter.ViewMask.ShowHidden;
            }

            if (showDotFilesToolStripMenuItem.Checked)
            {
                m_viewMask |= ViewFilter.ViewMask.ShowDot;
            }

            LeftFilePane.SetViewMask(m_viewMask);
            RightFilePane.SetViewMask(m_viewMask);

            BuildDrivesTreeView();
        }
Beispiel #4
0
        private void RangerMainForm_Load(object sender, EventArgs e)
        {
            string configFilename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"YellowDroid\Ranger\settings.txt");

            m_config.Load(configFilename);

            LayoutFromConfig();

            m_smallImageList.ColorDepth = ColorDepth.Depth32Bit;
            m_smallImageList.ImageSize  = new System.Drawing.Size(16, 16);
            m_iconListManager           = new IconListManager(m_smallImageList);
            DrivesTreeView.ImageList    = m_smallImageList;

            LeftFilePane.LoadFromConfig(m_config, "left_");
            LeftFilePane.Initialise(m_smallImageList, m_iconListManager, m_supportedImageExtensions, m_windowManager, m_thumbnailCache);
            //LeftFilePane.ListView.SmallImageList = m_smallImageList;
            //LeftFilePane.IconListManager = m_iconListManager;
            //LeftFilePane.SupportedImageExtensions = m_supportedImageExtensions;
            //LeftFilePane.WindowManager = m_windowManager;

            RightFilePane.LoadFromConfig(m_config, "right_");
            RightFilePane.Initialise(m_smallImageList, m_iconListManager, m_supportedImageExtensions, m_windowManager, m_thumbnailCache);
            //RightFilePane.ListView.SmallImageList = m_smallImageList;
            //RightFilePane.IconListManager = m_iconListManager;
            //RightFilePane.SupportedImageExtensions = m_supportedImageExtensions;
            //RightFilePane.WindowManager = m_windowManager;

            // View Mask
            if (m_config.GetValue("showhiddenfiles", false.ToString()) != false.ToString())
            {
                m_viewMask |= ViewFilter.ViewMask.ShowHidden;
                showHiddenFilesToolStripMenuItem.Checked = true;
            }

            if (m_config.GetValue("showsystemfiles", false.ToString()) != false.ToString())
            {
                m_viewMask |= ViewFilter.ViewMask.ShowSystem;
                showSystemFilesToolStripMenuItem.Checked = true;
            }

            if (m_config.GetValue("showdotfiles", false.ToString()) != false.ToString())
            {
                m_viewMask |= ViewFilter.ViewMask.ShowDot;
                showDotFilesToolStripMenuItem.Checked = true;
            }

            DefaultEditorPath = m_config.GetValue("defaulteditorpath");

            LeftFilePane.SetViewMask(m_viewMask);
            RightFilePane.SetViewMask(m_viewMask);

            // Pane paths

            string firstReadyDrivePath = BuildDrivesTreeView();

            // Bookmarks
            SetBookmarksFromConfig();

            string leftDefaultPath  = m_config.GetValue("leftpath", firstReadyDrivePath);
            string rightDefaultPath = m_config.GetValue("rightpath", firstReadyDrivePath);

            LeftFilePane.OnFocusEvent  += LeftFilePane_OnFocusEvent;
            RightFilePane.OnFocusEvent += RightFilePane_OnFocusEvent;

            LeftFilePane.OnPathChangedEvent  += FilePane_OnPathChangedEvent;
            RightFilePane.OnPathChangedEvent += FilePane_OnPathChangedEvent;

            LeftFilePane.OnSyncronisationRequested  += FilePane_OnSyncronisationRequested;
            RightFilePane.OnSyncronisationRequested += FilePane_OnSyncronisationRequested;

            LeftFilePane.OnSearchRequested  += FilePane_OnSearchRequested;
            RightFilePane.OnSearchRequested += FilePane_OnSearchRequested;

            m_activePane = LeftFilePane;

            RightFilePane.SetDirectory(rightDefaultPath);
            LeftFilePane.SetDirectory(leftDefaultPath);

            // Drive monitor
            WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2 OR EventType = 3");

            m_driveWatcher.EventArrived += DriveWatcher_EventArrived;
            m_driveWatcher.Query         = query;
            m_driveWatcher.Start();

            /*
             * // Add the system recycle bin icon to the button
             * int dummyIcon;
             * var icon = Etier.IconHelper.IconReader.GetStockIcon(Etier.IconHelper.Shell32.SHSTOCKICONID.SIID_RECYCLER, out dummyIcon);
             * RecycleBinButton.Image = icon.ToBitmap();
             */

            this.Closing += new System.ComponentModel.CancelEventHandler(this.MyOnClosing);
        }
Beispiel #5
0
        private void MyOnClosing(object o, System.ComponentModel.CancelEventArgs e)
        {
            m_driveWatcher.Stop();
            LeftFilePane.ShutdownFileWatcher();
            RightFilePane.ShutdownFileWatcher();

            m_config.Clear();

            if (this.WindowState != FormWindowState.Minimized)
            {
                m_config.SetValue("maximised", (this.WindowState == FormWindowState.Minimized).ToString());
                m_config.SetValue("xpos", this.Location.X.ToString());
                m_config.SetValue("ypos", this.Location.Y.ToString());
                m_config.SetValue("width", this.Size.Width.ToString());
                m_config.SetValue("height", this.Size.Height.ToString());
            }

            m_config.SetValue("treeviewsplitterdistance", FilePaneSplitContainer.SplitterDistance.ToString());

            m_config.SetValue("leftpath", LeftFilePane.CurrentPath);
            m_config.SetValue("rightpath", RightFilePane.CurrentPath);

            m_config.SetValue("showhiddenfiles", m_viewMask.HasFlag(ViewFilter.ViewMask.ShowHidden).ToString());
            m_config.SetValue("showsystemfiles", m_viewMask.HasFlag(ViewFilter.ViewMask.ShowSystem).ToString());
            m_config.SetValue("showdotfiles", m_viewMask.HasFlag(ViewFilter.ViewMask.ShowDot).ToString());

            if (DefaultEditorPath != null)
            {
                m_config.SetValue("defaulteditorpath", DefaultEditorPath);
            }

            int i = 0;

            foreach (ToolStripItem item in NavigationToolStrip.Items)
            {
                if (item.Tag is BookmarkDirectoryTag)
                {
                    var tag = item.Tag as BookmarkDirectoryTag;
                    m_config.SetValue($"bookmark{i}", $"Toolbar|Directory|{tag.DisplayName}|{tag.Path}");
                    i++;
                }
                else if (item.Tag is BookmarkFileTag)
                {
                    var tag = item.Tag as BookmarkFileTag;
                    m_config.SetValue($"bookmark{i}", $"Toolbar|File|{tag.DisplayName}|{tag.Path}");
                    i++;
                }
            }

            foreach (TreeNode item in DrivesTreeView.Nodes[0].Nodes)
            {
                if (item.Tag is BookmarkDirectoryTag)
                {
                    var tag = item.Tag as BookmarkDirectoryTag;
                    m_config.SetValue($"bookmark{i}", $"Tree|Directory|{tag.DisplayName}|{tag.Path}");
                    i++;
                }
                else if (item.Tag is BookmarkFileTag)
                {
                    var tag = item.Tag as BookmarkFileTag;
                    m_config.SetValue($"bookmark{i}", $"Tree|File|{tag.DisplayName}|{tag.Path}");
                    i++;
                }
            }

            LeftFilePane.SaveToConfig(m_config, "left_");
            RightFilePane.SaveToConfig(m_config, "right_");

            m_config.Save();

            m_windowManager.ClosingRangerWindow(this);
        }