]> git.lyx.org Git - lyx.git/blobdiff - src/Session.h
revert erroneous previous commit.
[lyx.git] / src / Session.h
index 8e18885259b785970f3a98418459045a1382d6aa..d673da22e950121849a8be5707c14b6f83fde558 100644 (file)
@@ -21,9 +21,6 @@
 #include <vector>
 #include <map>
 
-// used by at least frontends/qt4/GuiPref.cpp
-const long maxlastfiles = 20;
-
 /** This session file maintains
   1. the latest documents loaded (lastfiles)
   2. cursor positions of files closed (lastfilepos)
@@ -263,125 +260,6 @@ private:
 };
 
 
-class ToolbarSection : SessionSection
-{
-public:
-       /// information about a toolbar, not all information can be
-       /// saved/restored by all frontends, but this class provides
-       /// a superset of things that can be managed by session.
-       class ToolbarInfo
-       {
-       public:
-               ///
-               ToolbarInfo()
-                       : state(ON), location(NOTSET), posx(0), posy(0)
-               {}
-               ///
-               //ToolbarInfo(int s, int loc, int x = 0, int y = 0)
-       //              : state(State(s)), location(Location(loc)), posx(x), posy(y)
-       //      {}
-
-       public:
-               enum State {
-                       ON,
-                       OFF,
-                       AUTO
-               };
-
-               /// on/off/auto
-               State state;
-
-               /// location: this can be intepreted differently.
-               enum Location {
-                       TOP,
-                       BOTTOM,
-                       LEFT,
-                       RIGHT,
-                       NOTSET
-               };
-
-               Location location;
-
-               /// x-position of the toolbar
-               int posx;
-
-               /// y-position of the toolbar
-               int posy;
-
-               /// potentially, icons
-       };
-
-       struct ToolbarItem {
-               std::string key;
-               ToolbarInfo info;
-       };
-
-       /// info for each toolbar
-       typedef std::vector<ToolbarItem> ToolbarList;
-
-
-public:
-       ///
-       void read(std::istream & is);
-
-       ///
-       void write(std::ostream & os) const;
-
-       /// return reference to toolbar info, create a new one if needed
-       ToolbarInfo & load(std::string const & name);
-
-       /// toolbar begin
-       ToolbarList::const_iterator begin() { return toolbars.begin(); }
-
-       /// toolbar end
-       ToolbarList::const_iterator end() { return toolbars.end(); }
-
-private:
-       /// toolbar information
-       ToolbarList toolbars;
-};
-
-/// comparison operator to sort toolbars, the rules are:
-///        ON before OFF
-///     TOP < BOTTOM < LEFT < RIGHT
-///     Line at each side
-///     order in each line
-bool operator<(ToolbarSection::ToolbarItem const & a,
-       ToolbarSection::ToolbarItem const & b);
-
-
-class SessionInfoSection : SessionSection
-{
-public:
-       ///
-       typedef std::map<std::string, std::string> MiscInfo;
-
-public:
-       ///
-       void read(std::istream & is);
-
-       ///
-       void write(std::ostream & os) const;
-
-       /** set session info
-               @param key key of the value to store
-               @param value value, a string without newline ('\n')
-       */
-       void save(std::string const & key, std::string const & value);
-
-       /** load session info
-               @param key a key to extract value from the session file
-               @param release whether or not clear the value. Default to true
-                       since most of such values are supposed to be used only once.
-       */
-       std::string const load(std::string const & key, bool release = true);
-
-private:
-       /// a map to save session info
-       MiscInfo sessioninfo;
-};
-
-
 class Session
 {
 public:
@@ -405,16 +283,9 @@ public:
        BookmarksSection & bookmarks() { return bookmarks_; }
        ///
        BookmarksSection const & bookmarks() const { return bookmarks_; }
-       ///
-       ToolbarSection & toolbars() { return toolbars_; }
-       ///
-       ToolbarSection const & toolbars() const { return toolbars_; }
-       ///
-       SessionInfoSection & sessionInfo() { return session_info; }
-       ///
-       SessionInfoSection const & sessionInfo() const { return session_info; }
 
 private:
+       friend class LyX;
        /// uncopiable
        Session(Session const &);
        void operator=(Session const &);
@@ -437,12 +308,12 @@ private:
        LastFilePosSection last_file_pos;
        ///
        BookmarksSection bookmarks_;
-       ///
-       ToolbarSection toolbars_;
-       ///
-       SessionInfoSection session_info;
 };
 
-}
+/// This is a singleton class. Get the instance.
+/// Implemented in LyX.cpp.
+Session & theSession();
+
+} // lyx
 
 #endif