]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormAboutlyx.C
fix crash with "save as"
[lyx.git] / src / frontends / xforms / FormAboutlyx.C
1 /**
2  * \file FormAboutlyx.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  * \author Angus Leeming
8  * \author Rob Lahaye
9  *
10  * Full author contact details are available in file CREDITS
11  */
12
13 #include <config.h>
14
15 #ifdef __GNUG__
16 #pragma implementation
17 #endif
18
19 #include "FormAboutlyx.h"
20 #include "xformsBC.h"
21 #include "ControlAboutlyx.h"
22 #include "forms/form_aboutlyx.h"
23 #include "xforms_helpers.h"
24 #include "Lsstream.h"
25 #include "version.h"
26
27 #include FORMS_H_LOCATION
28
29
30 typedef FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > base_class;
31
32 FormAboutlyx::FormAboutlyx()
33         : base_class(_("About LyX"), false)
34 {}
35
36
37 void FormAboutlyx::build()
38 {
39         dialog_.reset(build_aboutlyx(this));
40
41         // create version tab
42         version_.reset(build_aboutlyx_version(this));
43
44         ostringstream vs;
45         vs << controller().getVersion()
46            << '\n' << lyx_version_info;
47
48         fl_add_browser_line(version_->browser_version, vs.str().c_str());
49
50         // create credits tab
51         credits_.reset(build_aboutlyx_credits(this));
52
53         ostringstream crs;
54         controller().getCredits(crs);
55
56         fl_add_browser_line(credits_->browser_credits, crs.str().c_str());
57
58         // create license tab
59         license_.reset(build_aboutlyx_license(this));
60         int const width = license_->browser_license->w - 10;
61
62         ostringstream cs;
63         cs << controller().getCopyright() << "\n\n"
64            << formatted(controller().getLicense(), width) << "\n\n"
65            << formatted(controller().getDisclaimer(), width);
66
67         fl_add_browser_line(license_->browser_license, cs.str().c_str());
68
69         // stack tabs
70         fl_addto_tabfolder(dialog_->tabfolder, _("Version"),
71                            version_->form);
72         fl_addto_tabfolder(dialog_->tabfolder, _("Credits"),
73                            credits_->form);
74         fl_addto_tabfolder(dialog_->tabfolder, _("License"),
75                            license_->form);
76
77         // work-around xforms bug re update of folder->x, folder->y coords.
78         setPrehandler(dialog_->tabfolder);
79
80         // Manage the cancel/close button
81         bc().setCancel(dialog_->button_close);
82 }