]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbrestorepanel.h
Add version strings
[bacula/bacula] / bacula / src / wx-console / wxbrestorepanel.h
index 015a6d4ceef995fb8f5590f9c466805b91053447..30cd8fae72c0908376470d7979f24d7b8600ceb4 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ *
+ *   wxbPanel for restoring files
+ *
+ *    Nicolas Boichat, April-May 2004
+ *
+ *    Version $Id$
+ */
 /*
    Copyright (C) 2004 Kern Sibbald and John Walker
 
@@ -32,6 +40,7 @@
 #include <wx/treectrl.h>
 #include <wx/gauge.h>
 #include <wx/stattext.h>
+#include <wx/splitter.h>
 
 #include "wxbutils.h"
 
@@ -39,7 +48,7 @@
 #include "wxbtreectrl.h"
 #include "wxblistctrl.h"
 
-class wxbTreeListPanel;
+WX_DECLARE_LIST(wxEvent, wxbEventList);
 
 /*
  * wxbPanel for restoring files
@@ -75,8 +84,9 @@ class wxbRestorePanel : public wxbPanel
       /* List files and directories for a specified tree item */
       void CmdList(wxTreeItemId item);
 
-      /* Mark a treeitem (directory) or a listitem (file or directory) */
-      void CmdMark(wxTreeItemId treeitem, long listitem);
+      /* Mark a treeitem (directory) or several listitems (file or directory),
+       * state defines if it should mark (1), unmark (0), or switch state (-1) */
+      void CmdMark(wxTreeItemId treeitem, long* listitems, int listsize, int state = -1);
 
 /* General functions and variables */
       //bool ended; /* The last command send has finished */
@@ -85,21 +95,9 @@ class wxbRestorePanel : public wxbPanel
       long totfilemessages; /* When restoring, number of files to be restored */
       wxString jobid;
 
-      /* Parse a table in tableParser */
-      wxbTableParser* CreateAndWaitForParser(wxString cmd);
-
-      /* Run a command, and waits until result is fully received,
-       * if keepresults is true, returns a valid pointer to a wxbDataTokenizer
-       * containing the data. */
-      wxbDataTokenizer* WaitForEnd(wxString cmd, bool keepresults = false, bool linebyline = true);
-
-      /* Run a command, and waits until prompt result is fully received,
-       * if keepresults is true, returns a valid pointer to a wxbPromptParser
-       * containing the data. */
-      wxbPromptParser* WaitForPrompt(wxString cmd, bool keepresults = false);
-
-      /* Run a dir command, and waits until result is fully received. */
-      void UpdateTreeItem(wxTreeItemId item, bool updatelist);
+      /* Run a dir command, and waits until result is fully received.
+       * If recurse is true, update the children too. */
+      void UpdateTreeItem(wxTreeItemId item, bool updatelist, bool recurse);
 
       /* Parse dir command results. */
       wxString* ParseList(wxString line);
@@ -113,8 +111,11 @@ class wxbRestorePanel : public wxbPanel
       /* Update a tree item parents' state */
       void UpdateTreeItemState(wxTreeItemId item);
 
-      /* Refresh a tree item, and all its children. */
-      void RefreshTree(wxTreeItemId item);
+      /* Refresh the whole tree. */
+      void RefreshTree();
+      
+      /* Refresh file list */
+      void RefreshList();
       
       /* Update first config, adapting settings to the job name selected */
       void UpdateFirstConfig();
@@ -148,6 +149,8 @@ class wxbRestorePanel : public wxbPanel
 
 /* UI related */
       bool working; // A command is running, discard GUI events
+      void SetWorking(bool working);
+      bool IsWorking();
       bool markWhenListingDone;
       wxTreeItemId currentTreeItem; // Currently selected tree item
 
@@ -155,22 +158,38 @@ class wxbRestorePanel : public wxbPanel
       void EnableConfig(bool enable);
 
 /* Event handling */
-      void OnStart(wxEvent& WXUNUSED(event));
-      void OnCancel(wxEvent& WXUNUSED(event));
+//      wxbEventList* pendingEvents; /* Stores event sent while working */ //EVTQUEUE
+//      bool processing; /* True if pendingEvents is being processed */ //EVTQUEUE
+
+//      virtual void AddPendingEvent(wxEvent& event);
+//      virtual bool ProcessEvent(wxEvent& event); //EVTQUEUE
+
+      void OnStart(wxCommandEvent& event);
+      void OnCancel(wxCommandEvent& event);
+      
       void OnTreeChanging(wxTreeEvent& event);
       void OnTreeExpanding(wxTreeEvent& event);
       void OnTreeChanged(wxTreeEvent& event);
       void OnTreeMarked(wxbTreeMarkedEvent& event);
+      void OnTreeAdd(wxCommandEvent& event);
+      void OnTreeRemove(wxCommandEvent& event);
+      void OnTreeRefresh(wxCommandEvent& event);
+      
       void OnListMarked(wxbListMarkedEvent& event);
       void OnListActivated(wxListEvent& event);
+      void OnListChanged(wxListEvent& event);
+      void OnListAdd(wxCommandEvent& event);
+      void OnListRemove(wxCommandEvent& event);
+      void OnListRefresh(wxCommandEvent& event);
+      
       void OnConfigUpdated(wxCommandEvent& event);
-      void OnConfigOk(wxEvent& WXUNUSED(event));
-      void OnConfigApply(wxEvent& WXUNUSED(event));
-      void OnConfigCancel(wxEvent& WXUNUSED(event));
+      void OnConfigOk(wxCommandEvent& WXUNUSED(event));
+      void OnConfigApply(wxCommandEvent& WXUNUSED(event));
+      void OnConfigCancel(wxCommandEvent& WXUNUSED(event));
 
 /* Components */
       wxBoxSizer *centerSizer; /* Center sizer */
-      wxbTreeListPanel *treelistPanel; /* Panel which contains tree and list */
+      wxSplitterWindow *treelistPanel; /* Panel which contains tree and list */
       wxbConfigPanel *configPanel; /* Panel which contains initial restore options */
       wxbConfigPanel *restorePanel; /* Panel which contains final restore options */
 
@@ -178,40 +197,24 @@ class wxbRestorePanel : public wxbPanel
 
       wxButton* start;
       wxButton* cancel;
+      
       wxbTreeCtrl* tree;
+      wxButton* treeadd;
+      wxButton* treeremove;
+      wxButton* treerefresh;
+      
       wxbListCtrl* list;
-      wxGauge* gauge;
-
-      /*wxButton*     cfgOk;
-      wxButton*     cfgApply;
-      wxButton*     cfgCancel;*/
+      wxButton* listadd;
+      wxButton* listremove;
+      wxButton* listrefresh;
       
+      wxGauge* gauge;
+     
       long cfgUpdated; //keeps which config fields have been updated
-      
-      /*wxStaticText* cfgJobname;
-      wxStaticText* cfgBootstrap;
-      wxTextCtrl*   cfgWhere;
-      wxChoice*     cfgReplace;
-      wxChoice*     cfgFileset;
-      wxChoice*     cfgClient;
-      wxStaticText* cfgStorage;
-      wxTextCtrl*   cfgWhen;
-      wxTextCtrl*   cfgPriority;*/
-
-      friend class wxbTreeListPanel;
 
-      DECLARE_EVENT_TABLE();    
-};
+      friend class wxbSplitterWindow;
 
-class wxbTreeListPanel: public wxPanel {
-public:
-     wxbTreeListPanel(wxbRestorePanel* parent);
-private:
-     void OnTreeMarked(wxbTreeMarkedEvent& event);
-     void OnListMarked(wxbListMarkedEvent& event);
-     DECLARE_EVENT_TABLE(); 
-     wxbRestorePanel* parent;
+      DECLARE_EVENT_TABLE();    
 };
 
 #endif // WXBRESTOREPANEL_H
-