]> git.lyx.org Git - lyx.git/blobdiff - src/filedlg.h
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / filedlg.h
index a8a75ebd17c86ec596c10748aa19c376d57119b2..2633d708824a5806196a1c32aa58de861e276495 100644 (file)
 // -*- C++ -*-
 /* This file is part of
-* ======================================================
-* 
-*           LyX, The Document Processor
-*        
-*           Copyright (C) 1995 1996 Matthias Ettrich
-*           and the LyX Team.
-*
-*======================================================*/
-
-#ifndef __FILEDLG_H__
-#define __FILEDLG_H__
+ * ====================================================== 
+ 
+ *           LyX, The Document Processor
+ *        
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#ifndef FILEDLG_H
+#define FILEDLG_H
 
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-#include "LString.h"
+#include <vector>
+#include <sigc++/signal_system.h>
 
-// necessary for xForms related stuff
+#include "LString.h"
 #include FORMS_H_LOCATION
 #include "form1.h"
 
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::Object;
+using SigC::Connection;
+#endif
 
-/// User cache class definition
-class UserCache
-{
-public:
-       ///
-       UserCache(LString const & pszName = LString(), uid_t ID = 0, 
-                 UserCache *pRoot = NULL);
-       ///
-       ~UserCache();
-       // interface
-       /// seeks user name from user ID
-       LString Find(uid_t ID);
-private:
-       ///
-       uid_t ID;
-       ///
-       LString pszName;
-       ///
-       UserCache *pNext, *pRoot;
-       // internal methods
-       /// creates a new user entry
-       UserCache *Add(uid_t ID);
-};
-extern UserCache lyxUserCache;
-
-
-/// Group cache class definition
-class GroupCache
-{
+/// LyXDirEntry internal structure definition
+class LyXDirEntry {
 public:
        ///
-       GroupCache(LString const & pszName = LString(), gid_t ID = 0,
-                  GroupCache *pRoot = NULL);
-       ///
-       ~GroupCache();
-       // interface
-       /// seeks group name from group ID
-       LString Find(gid_t ID);
-
-private:
-       ///
-       gid_t ID;
+       string pszName;
        ///
-       LString pszName;
+       string pszDisplayed;
        ///
-       GroupCache *pNext, *pRoot;
-       // internal methods
-       /// creates a new group entry
-       GroupCache *Add(gid_t ID);
-};
-extern GroupCache lyxGroupCache;
-
-
-/// LyXDirEntry internal structure definition
-class LyXDirEntry
-{
-private:
-       friend class LyXFileDlg;    
-       LString pszName;
-       LString pszDisplayed;
-       LString pszLsEntry;
-       /// compares two LyXDirEntry objects content (used by qsort)
-       static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2);
-       LyXDirEntry() {};
+       string pszLsEntry;
 };
 
 
 /// FileDlg class definition
-class LyXFileDlg 
+class LyXFileDlg : public Object
 {
 public:
        ///
        LyXFileDlg();
        ///
        ~LyXFileDlg();
+
        /// sets file selector user button action
-       void SetButton(int iIndex, LString const & pszName = LString(), 
-                      LString const & pszPath = LString());
+       void SetButton(int iIndex, string const & pszName = string(), 
+                      string const & pszPath = string());
        /// gets last dialog directory
-       LString GetDirectory();
+       string const GetDirectory() const;
        /// launches dialog and returns selected file
-       LString Select(LString const & pszTitle = LString(),
-                      LString const & pszPath = LString(),
-                      LString const & pszMask = LString(), 
-                      LString const & pszSuggested = LString());
+       string const Select(string const & pszTitle = string(),
+                      string const & pszPath = string(),
+                      string const & pszMask = string(), 
+                      string const & pszSuggested = string());
        /// XForms objects callback (static)
        static void FileDlgCB(FL_OBJECT *, long);
        /// Callback for double click in list
        static void DoubleClickCB(FL_OBJECT *, long);
+       /// Handle Cancel CB from WM close
+       static int CancelCB(FL_FORM *, void *);
 private:
-       // data
-       static FD_FileDlg *pFileDlgForm;
-       static LyXFileDlg *pCurrentDlg;
-       LString pszUserPath1;
-       LString pszUserPath2;
-       LString pszDirectory;
-       LString pszMask;
-       LString pszFileName;
+       /// data
+       static FD_FileDlg * pFileDlgForm;
+       ///
+       static LyXFileDlg * pCurrentDlg;
+       ///
+       string pszUserPath1;
+       ///
+       string pszUserPath2;
+       ///
+       string pszDirectory;
+       ///
+       string pszMask;
+       ///
+       string pszFileName;
+       ///
        int iDepth;
+       ///
        int iLastSel;
+       ///
        long lLastTime;
-       LString pszInfoLine;
-       LyXDirEntry *pCurrentNames;
-       int iNumNames;
-
+       ///
+       string pszInfoLine;
+       ///
+       typedef std::vector<LyXDirEntry> DirEntries;
+       ///
+       DirEntries direntries;
+       ///
        bool force_cancel;
+       ///
        bool force_ok;
 
-       // internal functions
+       /** Redraw the form (on receipt of a Signal indicating, for example,
+           that the xform colors have been re-mapped).
+       */
+       void redraw();
        /// updates dialog list to match class directory
        void Reread();
        /// sets dialog current directory
-       void SetDirectory(LString const & pszPath);
+       void SetDirectory(string const & pszPath);
        /// sets dialog file mask
-       void SetMask(LString const & pszNewMask);
+       void SetMask(string const & pszNewMask);
        /// sets dialog information line
-       void SetInfoLine(LString const & pszLine);
+       void SetInfoLine(string const & pszLine);
        /// handle dialog during file selection
        bool RunDialog();
        /// Handle callback from list
@@ -148,10 +117,10 @@ private:
        bool HandleDoubleClick();
        /// Handle OK button call
        bool HandleOK();
-       /// Handle Cancel CB from WM close
-       static int CancelCB(FL_FORM *, void *);
        /// Simulates a click on OK/Cancel
        void Force(bool);
+       /// Redraw connection.
+       Connection r_;
 };
 
 #endif