From 1af7d3700724834e40ad8636bc9a56cdc3b19b15 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sat, 27 Jul 2019 11:52:38 -0400
Subject: [PATCH] New layout icons

---
 cFileSystemPane.java |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/cFileSystemPane.java b/cFileSystemPane.java
index 98b5413..05e14ef 100644
--- a/cFileSystemPane.java
+++ b/cFileSystemPane.java
@@ -18,6 +18,7 @@
     iCallBack owner;
     
     JButton refreshButton;
+    JButton rootButton;
     JButton loadButton;
     JButton printButton;
     JButton replaceButton;
@@ -39,7 +40,7 @@
         //ToolTipManager.sharedInstance().registerComponent(jTree);
         jTree.setCellRenderer(new cFileSystemModel.Renderer());
         
-        ResetModel();
+        ResetModel(true);
 
         JScrollPane tree = new JScrollPane(jTree);
         //jTree.addTreeSelectionListener(this);
@@ -64,11 +65,13 @@
         
         fileCommsnds.add(loadButton = new JButton("Load")); //, aConstraints);
                 loadButton.setToolTipText("Load selected file(s)");
-        fileCommsnds.add(refreshButton = new JButton("Refresh")); //, aConstraints);
-                refreshButton.setToolTipText("Refresh entire tree");
-        
-        refreshButton.addActionListener(this);
-        loadButton.addActionListener(this);
+                loadButton.addActionListener(this);
+        fileCommsnds.add(refreshButton = new JButton("User")); //, aConstraints);
+                refreshButton.setToolTipText("Refresh user tree");
+                refreshButton.addActionListener(this);
+        fileCommsnds.add(rootButton = new JButton("Root")); //, aConstraints);
+                rootButton.setToolTipText("Refresh root tree");
+                rootButton.addActionListener(this);
         
         if (Globals.ADVANCED)
         {
@@ -114,7 +117,7 @@
 //            /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
     }
 
-    void ResetModel()
+    void ResetModel(boolean user)
     {
         cFilter filter = new cFilter();
         
@@ -134,9 +137,11 @@
         filter.add("tga");
         filter.add("bmp"); // not supported
         
+        File root = java.io.File.listRoots()[0];
+        File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();
+        
         jTree.setModel(new cFileSystemModel(
-                //java.io.File.listRoots()[1])
-                javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(),
+                user?defaultDirectory:root,
                 filter
         ));
     }
@@ -167,7 +172,13 @@
     {
         if(event.getSource() == refreshButton)
         {
-            ResetModel();
+            ResetModel(true);
+            return;
+        }
+        
+        if(event.getSource() == rootButton)
+        {
+            ResetModel(false);
             return;
         }
         

--
Gitblit v1.6.2