explorer: misc
[ede] / newexplorer / src / ExplorerWindow.ec
index 0bd9c17..a1b1aa6 100644 (file)
@@ -9,7 +9,7 @@ enum ExplorerToolId
    browse,
    panelTree, panelSearch,
    addressBar,
-   refreshView,
+   refresh,
    viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewCustom,
    previewPictures
 };
@@ -23,6 +23,7 @@ class ExplorerWindow : Window
    hasMinimize = true;
    hasClose = true;
    size = { 840, 480 };
+   minClientSize = { 600, 300 };
    nativeDecorations = true;
 
    IconBag<ExplorerToolId> iconBag
@@ -47,7 +48,7 @@ class ExplorerWindow : Window
 
          "<:ecere>emblems/unreadable.png",     /* addressBar */
 
-         "<:ecere>actions/viewRefresh.png",          /* refreshView */
+         "<:ecere>actions/viewRefresh.png",          /* refresh */
 
          ":view-list.png",                                        /* viewList */
          ":view-details.png",                                     /* viewDetails */
@@ -72,31 +73,75 @@ class ExplorerWindow : Window
       //moveable = false;
    };
 
-   ToolBar<ExplorerToolId> toolBar
+   ToolBar/*<ExplorerToolId>*/ toolBar
    {
       stack, this;
       iconBag = iconBag;
       size = { h = 32 };
       //moveable = false;
+
+      void NotifyToolClick(ToolButton button)
+      {
+         ExplorerToolId id = (ExplorerToolId)button.id;
+         switch(id)
+         {
+            case none:
+               break;
+            case newWindow:
+               ExplorerWindow { }.Create();
+               break;
+            case goBack:
+            case goForward:
+               break;
+            case goUp:
+            {
+               char * path = view.path;
+               char * newPath = new char[strlen(path)];
+               StripLastDirectory(path, newPath);
+               view.path = newPath;
+               delete newPath;
+               break;
+            }
+            case panelTree:
+               // TODO TOFIX : need to fix Stacker for this to work
+               tree.visible = button.checked;
+               //search.visible = !button.checked;
+               panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed
+               break;
+            case panelSearch:
+               // TODO TOFIX : need to fix Stacker for this to work
+               //search.visible = button.checked;
+               tree.visible = !button.checked;
+               panels.size = { panels.size.w, panels.size.h }; // TOFIX : another Stacker fix needed
+               break;
+            case refresh:
+               if(tree.visible)
+                  tree.Refresh();
+               view.Refresh();
+               break;
+            case previewPictures:
+               view.previewPictures = button.checked;
+               view.Refresh();
+               break;
+            case viewList:
+            case viewDetails:
+            case viewIcons:
+            case viewCards:
+            case viewShowcase:
+               //SwitchViews(toolId);
+               break;
+         }
+      }
    };
 
    Window s1 { toolBar, size = { w = 8 } };
-   ToolButton goBack    { toolBar, this, id = ExplorerToolId::goBack };
+   ToolButton goBack { toolBar, this, id = ExplorerToolId::goBack };
    Window s2 { toolBar, size = { w = 2 } };
    ToolButton goForward { toolBar, this, id = ExplorerToolId::goForward };
    Window s3 { toolBar, size = { w = 2 } };
-   ToolButton refreshView
-   {
-      toolBar, this, id = ExplorerToolId::refreshView;
-
-      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
-      {
-         fsb.Refresh();
-         return true;
-      }
-   };
+   ToolButton refresh { toolBar, this, id = ExplorerToolId::refresh };
    Window s4 { toolBar, size = { w = 2 } };
-   ToolButton goHome    { toolBar, this, id = ExplorerToolId::goHome };
+   ToolButton goHome { toolBar, this, id = ExplorerToolId::goHome };
    Window s5 { toolBar, size = { w = 8 } };
    PathBox addressBar
    {
@@ -116,25 +161,13 @@ class ExplorerWindow : Window
 
       bool NotifyModified(PathBox pathBox)
       {
-         fsb.path = pathBox.path;
+         view.path = pathBox.path;
          return true;
       }
    };
+   FlipStacker { toolBar, spring = previous };
    Window s6 { toolBar, size = { w = 8 } };
-   ToolButton goUp
-   {
-      toolBar, this, id = ExplorerToolId::goUp;
-
-      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
-      {
-         char * path = fsb.path;
-         char * newPath = new char[strlen(path)];
-         StripLastDirectory(path, newPath);
-         fsb.path = newPath;
-         delete newPath;
-         return true;
-      }
-   };
+   ToolButton goUp { toolBar, this, id = ExplorerToolId::goUp };
    Window s7 { toolBar, size = { w = 8 } };
    GroupToggleToolButton selectedPanel;
    GroupToggleToolButton panelTree   { toolBar, this, id = ExplorerToolId::panelTree, selected = &selectedPanel, checked = true };
@@ -149,28 +182,11 @@ class ExplorerWindow : Window
    OptionToolButton viewShowcase { toolBar, this, id = ExplorerToolId::viewShowcase, selected = &selectedView };
    selectedView = viewList;
    Window s9 { toolBar, size = { w = 8 } };
-   ToggleToolButton previewPictures
-   {
-      toolBar, this, id = ExplorerToolId::previewPictures;
-
-      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
-      {
-         fsb.previewPictures = button.checked;
-         return true;
-      }
-   };
+   ToggleToolButton previewPictures { toolBar, this, id = ExplorerToolId::previewPictures };
 
    Window s10 { toolBar, size = { w = 8 } };
-   ToolButton newWindow
-   {
-      toolBar, this, id = ExplorerToolId::newWindow;
-
-      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
-      {
-         ExplorerWindow { }.Create();
-         return true;
-      }
-   };
+   ToolButton newWindow { toolBar, this, id = ExplorerToolId::newWindow };
+   Window s11 { toolBar, size = { w = 8 } };
 
    /*void OnDestroy()
    {
@@ -189,20 +205,63 @@ class ExplorerWindow : Window
       iconBag.Unload();
    }
 
-   FileSystemBox fsb
+   Stacker panels
    {
       stack, this;
-      //anchor = { left = 0, top = 4, right = 0, bottom = 0 };
+      gap = 0;
+      direction = horizontal;
+      background = yellow;//activeBorder;
+      //opacity = 1.0f;
+
       anchor.left = 0;
       anchor.bottom = 0;
       anchor.right = 0;
+   };
+
+   //FlipStacker flipStack { stack, spring = previous };
+
+   /*SearchPanel searchPanel
+   {
+      panels, this;
+   };*/
+
+   /*Tree*/FileSystemBox tree
+   {
+      panels, this;
+      size = { w = 240 };
+      anchor.top = 0;
+      anchor.bottom = 0;
+      navigateFolders = true;
+      treeBranches = true;
+      foldersOnly = true;
+      borderStyle = none;
+      visible = false;
+   };
+
+   FileSystemBox view
+   {
+      panels, this;
+      anchor.top = 0;
+      anchor.bottom = 0;
+      anchor.right = 0;
       locationBox = addressBar;
       navigateFolders = true;
+      borderStyle = none;
    };
 
+   // Preview / Showcase
+   /*PreviewArea previewArea
+   {
+      panels, this;
+   };*/
+
+   //FlipStacker flipPanels { panels, spring = previous };
+
    bool OnPostCreate()
    {
-      addressBar.path = fsb.path;
+      addressBar.path = view.path;
       return true;
    }
 }
+
+//class TreeFileSystemBox : FileSystemBox { }