]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlVCLog.C
controller-view split of FormLog and FormVCLog.
[lyx.git] / src / frontends / controllers / ControlVCLog.C
1 /* This file is part of
2  * ====================================================== 
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 2001 The LyX Team.
7  *
8  * ======================================================
9  *
10  * \file ControlVCLog.h
11  * \author John Levon, moz@compsoc.man.ac.uk
12  * \author Angus Leeming <a.leeming@ic.ac.uk>
13  */
14
15 #ifdef __GNUG__
16 #pragma implementation
17 #endif
18
19 #include <config.h>
20 #include "buffer.h"
21 #include "ButtonController.h"
22 #include "ControlVCLog.h"
23 #include "LyXView.h"
24 #include "Dialogs.h"
25 #include "lyxrc.h"
26 #include "ViewBase.h"
27
28 using SigC::slot;
29
30 ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
31         : ControlConnectBD(lv, d)
32 {
33         d_.showVCLogFile.connect(slot(this, &ControlVCLog::show));
34 }
35
36
37 void ControlVCLog::show()
38 {
39         if (!lv_.view()->available())
40                 return;
41
42         logfile_ = lv_.view()->buffer()->lyxvc.getLogFile();
43
44         bc().readOnly(isReadonly());
45         view().show();
46 }
47
48
49 void ControlVCLog::update()
50 {
51         if (!lv_.view()->available())
52                 return;
53
54         logfile_ = lv_.view()->buffer()->lyxvc.getLogFile();
55         
56         bc().readOnly(isReadonly());
57         view().update();
58
59         lyx::unlink(logfile_); 
60 }
61
62
63 void ControlVCLog::hide()
64 {
65         logfile_.erase();
66         disconnect();
67         view().hide();
68 }