]> git.lyx.org Git - lyx.git/blob - src/lyxvc.h
use the new bufferstorage (this change only deletes all references to the old one
[lyx.git] / src / lyxvc.h
1 // -*- C++ -*-
2
3 #ifndef LYX_VC_H
4 #define LYX_VC_H
5
6 #ifdef __GNUG__
7 #pragma interface
8 #endif
9
10 #include "LString.h"
11 #include "latexoptions.h"
12
13 class VCS;
14 class Buffer;
15
16 /** Version Control for LyX.
17     This is the class giving the verison control features to LyX. It is
18     intended to support different kinds of version control, but at this point
19     we will only support RCS. Later CVS is a likely candidate for support.
20     The support in LyX is based loosely upon the version control in GNU Emacs,
21     but is not as extensive as that one. See examples/VC.lyx for a simple
22     tutorial and manual for the use of the version control system in LyX.
23     
24     LyXVC use this algorithm when it searches for VC files:
25     for RCS it searches for <filename>,v and RCS/<filename>,v similar
26     should be done for CVS. By doing this there doesn't need to be any
27     special support for VC in the lyx format, and this is especially good
28     when the lyx format will be a subset of LaTeX.
29 */
30 class LyXVC {
31 public:
32         ///
33         LyXVC();
34         ///
35         ~LyXVC();
36         /** Not a good name perhaps. This function should be called whenever
37           LyX loads a file. This function then checks for a master VC file
38           (for RCS this is *,v or RCS/ *,v) if this file is found, the loaded
39           file is assumed to be under controll by VC (only RCS so far), and
40           the appropiate actions is taken. Returns true if the file is under
41           control by a VCS.
42           */
43         bool file_found_hook(string const & fn);
44         
45         /** This function should be run when a file is requested for loading,
46           but it does not exist. This function will then check for a VC master
47           file with the same name (see above function). If this exists the
48           user should be asked if he/her wants to checkout a version for
49           viewing/editing. Returns true if the file is under control by a VCS
50           and the user wants to view/edit it.
51           */
52         static bool file_not_found_hook(string const & fn);
53
54         ///
55         void buffer(Buffer *);
56
57         /// Register the document as an VC file.
58         void registrer();
59
60         /// Unlock and commit changes.
61         void checkIn();
62
63         /// Lock and prepare to edit document.
64         void checkOut();
65
66         /// Revert to last version
67         void revert();
68
69         /// Undo last check-in.
70         void undoLast();
71
72         ///
73         void viewLog(string const &);
74
75         ///
76         void showLog();
77
78         /// 
79         void toggleReadOnly();
80         
81         /// Is the document under administration by RCS?
82         bool inUse();
83
84         /// Returns the version number.
85         string const & version() const;
86
87         /// Returns the userid of the person who has locked the doc.
88         string const & locker() const;
89
90         ///
91         static void logClose(FL_OBJECT *, long);
92         ///
93         static void logUpdate(FL_OBJECT *, long);
94 protected:
95 private:
96         ///
97         Buffer * owner_;
98         
99         ///
100         VCS * vcs;
101
102         ///
103         FD_LaTeXLog * browser; // FD_LaTeXLog is just a browser with a
104         // close button. Unfortunately we can not use the standard callbacks.
105 };
106
107 #endif