]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlDialog.tmpl
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlDialog.tmpl
1 // -*- C++ -*-
2 /**
3  * \file ControlDialog.tmpl
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS
10  *
11  * ControlDialog is a base class and so these templatised methods will be
12  * instantiated if this file is #included in the derived classes' .C file.
13  */
14
15 #include "ControlDialog.h"
16
17 #include "ButtonController.h"
18 #include "ViewBase.h"
19
20
21 template <class Base>
22 ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
23         : Base(lv, d), dialog_built_(false)
24 {}
25
26
27 template <class Base>
28 void ControlDialog<Base>::show()
29 {
30         if (this->isBufferDependent() && !this->bufferIsAvailable())
31                 return;
32
33         this->connect();
34
35         if (!dialog_built_) {
36                 this->view().build();
37                 dialog_built_ = true;
38         }
39
40         setParams();
41         if (this->emergency_exit_) {
42                 hide();
43                 return;
44         }
45
46         this->bc().readOnly(this->bufferIsReadonly());
47         this->view().show();
48
49         // The widgets may not be valid, so refresh the button controller
50         this->bc().refresh();
51 }
52
53
54 template <class Base>
55 void ControlDialog<Base>::update()
56 {
57         if (this->isBufferDependent() && !this->bufferIsAvailable())
58                 return;
59
60         setParams();
61         if (this->emergency_exit_) {
62                 hide();
63                 return;
64         }
65
66         this->bc().readOnly(this->bufferIsReadonly());
67         this->view().update();
68
69         // The widgets may not be valid, so refresh the button controller
70         this->bc().refresh();
71 }
72
73
74 template <class Base>
75 void ControlDialog<Base>::hide()
76 {
77         this->emergency_exit_ = false;
78         clearParams();
79
80         this->disconnect();
81         this->view().hide();
82 }