]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormCopyright.C
try this for distinguishing inner and outer tabs
[lyx.git] / src / frontends / xforms / FormCopyright.C
index 5a8ecdc14d1a1c407699b1117698936f9d4f5de4..edfe5acc4a78dc4b0b275b34abb7ff247aed9a2d 100644 (file)
 #pragma implementation
 #endif
 
-#include "xform_macros.h"
-#include "form_copyright.h"
-#include "FormCopyright.h"
 #include "Dialogs.h"
 #include "LyXView.h"
-#include "lyx_gui_misc.h"
-#include "gettext.h"
-
-C_RETURNCB(FormCopyright, WMHideCB)
-C_GENERICCB(FormCopyright, OKCB)
+#include "form_copyright.h"
+#include "FormCopyright.h"
+#include "xform_helpers.h"
 
-FormCopyright::FormCopyright(LyXView * lv, Dialogs * d)
-       : dialog_(0), lv_(lv), d_(d), h_(0)
+FormCopyright::FormCopyright( LyXView * lv, Dialogs * d        )
+       : FormBaseBI(lv, d, _("Copyright and Warranty"), new OkCancelPolicy),
+         dialog_(0)
 {
        // let the dialog be shown
        // This is a permanent connection so we won't bother
@@ -33,76 +29,41 @@ FormCopyright::FormCopyright(LyXView * lv, Dialogs * d)
 
 FormCopyright::~FormCopyright()
 {
-       free();
-}
-
-
-void FormCopyright::build()
-{
-  dialog_ = build_copyright();
-}
-
-
-void FormCopyright::show()
-{
-       if (!dialog_) {
-               build();
-               fl_set_form_atclose(dialog_->form_copyright,
-                                   C_FormCopyrightWMHideCB, 0);
-       }
-
-       if (dialog_->form_copyright->visible) {
-               fl_raise_form(dialog_->form_copyright);
-       } else {
-               fl_show_form(dialog_->form_copyright,
-                            FL_PLACE_MOUSE,
-                            FL_FULLBORDER,
-                            _("Copyright and Warranty"));
-               h_ = d_->hideAll.connect(slot(this, &FormCopyright::hide));
-       }
-}
-
-
-void FormCopyright::hide()
-{
-       if (dialog_
-           && dialog_->form_copyright
-           && dialog_->form_copyright->visible) {
-               fl_hide_form(dialog_->form_copyright);
-               h_.disconnect();
-       }
-       free();
-}
-
-
-void FormCopyright::free()
-{
-       // we don't need to delete h here because
-       // hide() does that after disconnecting.
-       if (dialog_) {
-               if (dialog_->form_copyright
-                   && dialog_->form_copyright->visible) {
-                       hide();
-               }
-               fl_free_form(dialog_->form_copyright);
-               delete dialog_;
-               dialog_ = 0;
-       }
+       delete dialog_;
 }
 
 
-int FormCopyright::WMHideCB(FL_FORM * form, void *)
+FL_FORM * FormCopyright::form() const
 {
-       // Ensure that the signal h is disconnected even if the
-       // window manager is used to close the dialog.
-       FormCopyright * pre = static_cast<FormCopyright*>(form->u_vdata);
-       pre->hide();
-       return FL_CANCEL;
+       if (dialog_ ) return dialog_->form;
+       return 0;
 }
 
 
-void FormCopyright::OKCB(FL_OBJECT * ob, long)
+void FormCopyright::build()
 {
-       FormCopyright * pre = static_cast<FormCopyright*>(ob->form->u_vdata);
-       pre->hide();
+       dialog_ = build_copyright();
+
+       // Workaround dumb xforms sizing bug
+       minw_ = form()->w;
+       minh_ = form()->h;
+
+       string str = _("LyX is Copyright (C) 1995 by Matthias Ettrich, 1995-2000 LyX Team");
+       str = formatted(str, dialog_->text_copyright->w-10,
+                       FL_NORMAL_SIZE, FL_NORMAL_STYLE);
+       fl_set_object_label(dialog_->text_copyright, str.c_str());
+
+       str = _("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.");
+       str = formatted(str, dialog_->text_licence->w-10,
+                       FL_NORMAL_SIZE, FL_NORMAL_STYLE);
+       fl_set_object_label(dialog_->text_licence, str.c_str());
+
+       str = _("LyX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.");
+       str = formatted(str, dialog_->text_disclaimer->w-10,
+                       FL_NORMAL_SIZE, FL_NORMAL_STYLE);
+       fl_set_object_label(dialog_->text_disclaimer, str.c_str());
+       
+        // Manage the cancel/close button
+       bc_.setCancel(dialog_->button_cancel);
+       bc_.refresh();
 }