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