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