]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormAboutlyx.C
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / FormAboutlyx.C
index e1b7ee7ea1c461852d236c42ddc0974eae039ba0..963a5db4a23abd048eaa4a9f7777eff4616fdf49 100644 (file)
@@ -1,83 +1,93 @@
 /**
  * \file FormAboutlyx.C
- * Copyright 2001 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Edwin Leuven, leuven@fee.uva.nl
- * \author Angus Leeming, a.leeming@.ac.uk
+ * \author Edwin Leuven
+ * \author Angus Leeming
+ * \author Rob Lahaye
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include <config.h>
 
+
+#include "FormAboutlyx.h"
 #include "xformsBC.h"
 #include "ControlAboutlyx.h"
-#include "FormAboutlyx.h"
-#include "form_aboutlyx.h"
+#include "forms/form_aboutlyx.h"
 #include "xforms_helpers.h"
-#include "Lsstream.h"
+#include "support/std_sstream.h"
+#include "version.h"
+
+#include "lyx_forms.h"
+
+using std::ostringstream;
+
+
+namespace {
+
+#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
+bool const scalableTabfolders = false;
+#else
+bool const scalableTabfolders = true;
+#endif
 
-using std::getline;
+} // namespace anon
 
-typedef FormCB<ControlAboutlyx, FormDB<FD_form_aboutlyx> > base_class;
 
-FormAboutlyx::FormAboutlyx(ControlAboutlyx & c)
-       : base_class(c, _("About LyX"))
+typedef FormController<ControlAboutlyx, FormView<FD_aboutlyx> > base_class;
+
+FormAboutlyx::FormAboutlyx(Dialog & parent)
+       : base_class(parent, _("About LyX"), scalableTabfolders)
 {}
 
-FL_FORM * FormAboutlyx::form() const
-{
-    if (dialog_.get()) return dialog_->form;
-    return 0;
-}
 
 void FormAboutlyx::build()
 {
-       dialog_.reset(build_aboutlyx());
+       dialog_.reset(build_aboutlyx(this));
 
        // create version tab
-       version_.reset(build_tab_version());
-       fl_set_object_label(version_->text_version, 
-                           controller().getVersion().c_str());
-       fl_set_object_label(version_->text_copyright, 
-                           controller().getCopyright().c_str());
-
-       // create license and warranty tab
-       license_.reset(build_tab_license());
-       
-       string str = formatted(controller().getLicense(),
-                              license_->text_license->w-10);
-       fl_set_object_label(license_->text_license, str.c_str());
-
-       str = formatted(controller().getDisclaimer(),
-                       license_->text_warranty->w-10);
-       fl_set_object_label(license_->text_warranty, str.c_str());
-
-       // create credits
-       credits_.reset(build_tab_credits());
-       stringstream ss;
-       fl_add_browser_line(credits_->browser_credits, 
-                           controller().getCredits(ss).str().c_str());
-
-       // stack tabs
-       fl_addto_tabfolder(dialog_->tabbed_folder,_("Copyright and Version"),
-                      version_->form);
-       fl_addto_tabfolder(dialog_->tabbed_folder,_("License and Warranty"),
-                      license_->form);
-       fl_addto_tabfolder(dialog_->tabbed_folder,_("Credits"),
-                      credits_->form);
-
-       fl_set_form_maxsize( dialog_->form,
-                            dialog_->form->w,  dialog_->form->h);
+       version_.reset(build_aboutlyx_version(this));
 
-       // Manage the cancel/close button
-       bc().setCancel(dialog_->close);
-}
+       ostringstream vs;
+       vs << controller().getVersion()
+          << '\n' << lyx_version_info;
+
+       fl_add_browser_line(version_->browser_version, vs.str().c_str());
 
+       // create credits tab
+       credits_.reset(build_aboutlyx_credits(this));
 
+       ostringstream crs;
+       controller().getCredits(crs);
 
+       fl_add_browser_line(credits_->browser_credits, crs.str().c_str());
 
+       // create license tab
+       license_.reset(build_aboutlyx_license(this));
+       int const width = license_->browser_license->w - 10;
 
+       ostringstream cs;
+       cs << controller().getCopyright() << "\n\n"
+          << formatted(controller().getLicense(), width) << "\n\n"
+          << formatted(controller().getDisclaimer(), width);
+
+       fl_add_browser_line(license_->browser_license, cs.str().c_str());
+
+       // Enable the tabfolder to be rescaled correctly.
+       if (scalableTabfolders)
+               fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
+
+       // Stack tabs
+       fl_addto_tabfolder(dialog_->tabfolder, _("Version").c_str(),
+                          version_->form);
+       fl_addto_tabfolder(dialog_->tabfolder, _("Credits").c_str(),
+                          credits_->form);
+       fl_addto_tabfolder(dialog_->tabfolder, _("License").c_str(),
+                          license_->form);
+
+       // Manage the cancel/close button
+       bcview().setCancel(dialog_->button_close);
+}