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