]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormCopyright.C
major GUII cleanup + Baruchs patch + Angus's patch + removed a couple of generated...
[lyx.git] / src / frontends / xforms / FormCopyright.C
1 /* FormCopyright.C
2  * FormCopyright Interface Class Implementation
3  */
4
5 #include <config.h>
6
7 #include FORMS_H_LOCATION
8
9 #ifdef __GNUG__
10 #pragma implementation
11 #endif
12
13 #include "xform_macros.h"
14 #include "form_copyright.h"
15 #include "FormCopyright.h"
16 #include "Dialogs.h"
17 #include "LyXView.h"
18 #include "lyx_gui_misc.h"
19 #include "gettext.h"
20
21 C_RETURNCB(FormCopyright, WMHideCB)
22 C_GENERICCB(FormCopyright, OKCB)
23
24 FormCopyright::FormCopyright(LyXView * lv, Dialogs * d)
25         : dialog_(0), lv_(lv), d_(d), h_(0)
26 {
27         // let the dialog be shown
28         // This is a permanent connection so we won't bother
29         // storing a copy because we won't be disconnecting.
30         d->showCopyright.connect(slot(this, &FormCopyright::show));
31 }
32
33
34 FormCopyright::~FormCopyright()
35 {
36         delete dialog_;
37 }
38
39
40 void FormCopyright::build()
41 {
42         dialog_ = build_copyright();
43         fl_set_form_atclose(dialog_->form,
44                             C_FormCopyrightWMHideCB, 0);
45 }
46
47
48 void FormCopyright::show()
49 {
50         if (!dialog_) {
51                 build();
52         }
53
54         if (dialog_->form->visible) {
55                 fl_raise_form(dialog_->form);
56         } else {
57                 fl_show_form(dialog_->form,
58                              FL_PLACE_MOUSE,
59                              FL_FULLBORDER,
60                              _("Copyright and Warranty"));
61                 h_ = d_->hideAll.connect(slot(this, &FormCopyright::hide));
62         }
63 }
64
65
66 void FormCopyright::hide()
67 {
68         if (dialog_
69             && dialog_->form
70             && dialog_->form->visible) {
71                 fl_hide_form(dialog_->form);
72                 h_.disconnect();
73         }
74 }
75
76
77 int FormCopyright::WMHideCB(FL_FORM * form, void *)
78 {
79         // Ensure that the signal h is disconnected even if the
80         // window manager is used to close the dialog.
81         FormCopyright * pre = static_cast<FormCopyright*>(form->u_vdata);
82         pre->hide();
83         return FL_CANCEL;
84 }
85
86
87 void FormCopyright::OKCB(FL_OBJECT * ob, long)
88 {
89         FormCopyright * pre = static_cast<FormCopyright*>(ob->form->u_vdata);
90         pre->hide();
91 }