Revert "explorer: misc"
[ede] / newexplorer / src / ExplorerWindow.ec
index a1b1aa6..0bd9c17 100644 (file)
@@ -9,7 +9,7 @@ enum ExplorerToolId
    browse,
    panelTree, panelSearch,
    addressBar,
-   refresh,
+   refreshView,
    viewList, viewDetails, viewIcons, viewCards, viewShowcase, viewCustom,
    previewPictures
 };
@@ -23,7 +23,6 @@ class ExplorerWindow : Window
    hasMinimize = true;
    hasClose = true;
    size = { 840, 480 };
-   minClientSize = { 600, 300 };
    nativeDecorations = true;
 
    IconBag<ExplorerToolId> iconBag
@@ -48,7 +47,7 @@ class ExplorerWindow : Window
 
          "<:ecere>emblems/unreadable.png",     /* addressBar */
 
-         "<:ecere>actions/viewRefresh.png",          /* refresh */
+         "<:ecere>actions/viewRefresh.png",          /* refreshView */
 
          ":view-list.png",                                        /* viewList */
          ":view-details.png",                                     /* viewDetails */
@@ -73,75 +72,31 @@ 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 refresh { toolBar, this, id = ExplorerToolId::refresh };
+   ToolButton refreshView
+   {
+      toolBar, this, id = ExplorerToolId::refreshView;
+
+      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+      {
+         fsb.Refresh();
+         return true;
+      }
+   };
    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
    {
@@ -161,13 +116,25 @@ class ExplorerWindow : Window
 
       bool NotifyModified(PathBox pathBox)
       {
-         view.path = pathBox.path;
+         fsb.path = pathBox.path;
          return true;
       }
    };
-   FlipStacker { toolBar, spring = previous };
    Window s6 { toolBar, size = { w = 8 } };
-   ToolButton goUp { toolBar, this, id = ExplorerToolId::goUp };
+   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;
+      }
+   };
    Window s7 { toolBar, size = { w = 8 } };
    GroupToggleToolButton selectedPanel;
    GroupToggleToolButton panelTree   { toolBar, this, id = ExplorerToolId::panelTree, selected = &selectedPanel, checked = true };
@@ -182,11 +149,28 @@ 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 };
+   ToggleToolButton previewPictures
+   {
+      toolBar, this, id = ExplorerToolId::previewPictures;
+
+      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+      {
+         fsb.previewPictures = button.checked;
+         return true;
+      }
+   };
 
    Window s10 { toolBar, size = { w = 8 } };
-   ToolButton newWindow { toolBar, this, id = ExplorerToolId::newWindow };
-   Window s11 { 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;
+      }
+   };
 
    /*void OnDestroy()
    {
@@ -205,63 +189,20 @@ class ExplorerWindow : Window
       iconBag.Unload();
    }
 
-   Stacker panels
+   FileSystemBox fsb
    {
       stack, this;
-      gap = 0;
-      direction = horizontal;
-      background = yellow;//activeBorder;
-      //opacity = 1.0f;
-
+      //anchor = { left = 0, top = 4, right = 0, bottom = 0 };
       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 = view.path;
+      addressBar.path = fsb.path;
       return true;
    }
 }
-
-//class TreeFileSystemBox : FileSystemBox { }