]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormAboutlyx.C
Introduce LFUN_PRINT.
[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
16 #include "FormAboutlyx.h"
17 #include "xformsBC.h"
18 #include "ControlAboutlyx.h"
19 #include "forms/form_aboutlyx.h"
20 #include "xforms_helpers.h"
21 #include "support/std_sstream.h"
22 #include "version.h"
23
24 #include "lyx_forms.h"
25
26 using std::ostringstream;
27
28
29 namespace {
30
31 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
32 bool const scalableTabfolders = false;
33 #else
34 bool const scalableTabfolders = true;
35 #endif
36
37 } // namespace anon
38
39
40 typedef FormController<ControlAboutlyx, FormView<FD_aboutlyx> > base_class;
41
42 FormAboutlyx::FormAboutlyx(Dialog & parent)
43         : base_class(parent, _("About LyX"), scalableTabfolders)
44 {}
45
46
47 void FormAboutlyx::build()
48 {
49         dialog_.reset(build_aboutlyx(this));
50
51         // create version tab
52         version_.reset(build_aboutlyx_version(this));
53
54         ostringstream vs;
55         vs << controller().getVersion()
56            << '\n' << lyx_version_info;
57
58         fl_add_browser_line(version_->browser_version, vs.str().c_str());
59
60         // create credits tab
61         credits_.reset(build_aboutlyx_credits(this));
62
63         ostringstream crs;
64         controller().getCredits(crs);
65
66         fl_add_browser_line(credits_->browser_credits, crs.str().c_str());
67
68         // create license tab
69         license_.reset(build_aboutlyx_license(this));
70         int const width = license_->browser_license->w - 10;
71
72         ostringstream cs;
73         cs << controller().getCopyright() << "\n\n"
74            << formatted(controller().getLicense(), width) << "\n\n"
75            << formatted(controller().getDisclaimer(), width);
76
77         fl_add_browser_line(license_->browser_license, cs.str().c_str());
78
79         // Enable the tabfolder to be rescaled correctly.
80         if (scalableTabfolders)
81                 fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
82
83         // Stack tabs
84         fl_addto_tabfolder(dialog_->tabfolder, _("Version").c_str(),
85                            version_->form);
86         fl_addto_tabfolder(dialog_->tabfolder, _("Credits").c_str(),
87                            credits_->form);
88         fl_addto_tabfolder(dialog_->tabfolder, _("License").c_str(),
89                            license_->form);
90
91         // Manage the cancel/close button
92         bcview().setCancel(dialog_->button_close);
93 }