]> git.lyx.org Git - features.git/commitdiff
Changed FormCopyright to MVC.
authorBaruch Even <baruch@lyx.org>
Mon, 2 Apr 2001 10:24:07 +0000 (10:24 +0000)
committerBaruch Even <baruch@lyx.org>
Mon, 2 Apr 2001 10:24:07 +0000 (10:24 +0000)
Casting changes in gnome_helpers
Removal of unneeded static from variables in GUIRuntime.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1870 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gnome/ChangeLog
src/frontends/gnome/Dialogs.C
src/frontends/gnome/FormCopyright.C
src/frontends/gnome/FormCopyright.h
src/frontends/gnome/GUIRunTime.C
src/frontends/gnome/Makefile.am
src/frontends/gnome/gnome_helpers.C
src/frontends/gnome/gnome_helpers.h

index bae1f4078ceebe80d0cc5def8bf40d82b9a5b327..65f61aa88ceffe993c2313ad0b50a58faedcb514 100644 (file)
@@ -1,3 +1,13 @@
+2001-04-02  Michael Koziarski  <michael@koziarski.org>
+
+       * FormCopyright.[Ch]: Reimplemented as an MVC dialog.
+
+       * gnome_helpers.C: Some castings to avoid compilation break.
+
+2001-04-01  Baruch Even  <baruch@lyx.org>
+
+       * GUIRuntime.C (initApplication):  Changed strings to non-static.
+
 2001-03-30  Baruch Even  <baruch@lyx.org>
 
        * FormCredits.C: Added the formatting of the credits text.
index fc7683fee7819f6dce5cf9733ec48d73826ea242..721ab5351be86798f2c478417468c9f49f88f779 100644 (file)
 
 #include "FormUrl.h"
 #include "FormCredits.h"
+#include "FormCopyright.h"
 
 /*
 #include "FormBibitem.h"
 #include "FormBibtex.h"
 #include "FormCharacter.h"
 #include "FormCitation.h"
-#include "FormCopyright.h"
 #include "FormLog.h"
 #include "FormVCLog.h"
 
@@ -72,6 +72,7 @@ Dialogs::Dialogs(LyXView * lv)
 {
        add(new GUIUrl<FormUrl, gnomeBC>(*lv, *this));
        add(new GUICredits<FormCredits, gnomeBC>(*lv, *this));
+       add(new GUICopyright<FormCopyright, gnomeBC>(*lv, *this));
 
 /*     
        splash_.reset(new FormSplash(lv, this));
@@ -80,13 +81,11 @@ Dialogs::Dialogs(LyXView * lv)
        add(new GUIBibtex<FormBibtex, xformsBC>(*lv, *this));
        add(new GUICharacter<FormCharacter, xformsBC>(*lv, *this));
        //add(new GUICitation<FormCitation, xformsBC>(*lv, *this));
-       //add(new GUICopyright<FormCopyright, xformsBC>(*lv, *this));
        add(new GUILog<FormLog, xformsBC>(*lv, *this));
        add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
 
        // For now we use the gnome non MVC dialogs
        add(new FormCitation(lv, this));
-       add(new FormCopyright(lv, this));
        
        add(new FormDocument(lv, this));
        add(new FormError(lv, this));
index 6af7a579c866f481f2eab0ecaa931a90b5b8e3e1..beb74ea464baae3dfbf92796e7b57c7be7ec09c7 100644 (file)
@@ -1,72 +1,62 @@
+// -*- C++ -*-
 /* This file is part of
- * ====================================================== 
+ * =================================================
  * 
- *           LyX, The Document Processor
- *       
- *          Copyright 2000 The LyX Team.
+ *          LyX, The Document Processor
+ *          Copyright 1995-2000 The LyX Team.
  *
- * ====================================================== */
-
-/* FormCopyright.C
- * FormCopyright Interface Class Implementation
+ * ================================================= 
+ *
+ * \author Michael Koziarski <michael@koziarski.org>
  */
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
 #include <config.h>
-#include "gettext.h"
-#include "Dialogs.h"
+
+#include "debug.h"
+
+#include "gnomeBC.h"
 #include "FormCopyright.h"
+#include "gnome_helpers.h"
+
+#include <gtk--/button.h>
+#include <gtk--/label.h>
 
-FormCopyright::FormCopyright(LyXView * lv, Dialogs * d)
-       : dialog_(0), lv_(lv), d_(d), h_(0)
+
+FormCopyright::FormCopyright(ControlCopyright & c)
+       : FormCB<ControlCopyright>(c, "diahelpcopyright.glade", "DiaHelpCopyright")
 {
-       // let the dialog be shown
-       // This is a permanent connection so we won't bother
-       // storing a copy because we won't be disconnecting.
-       d->showCopyright.connect(slot(this, &FormCopyright::show));
 }
 
 
-FormCopyright::~FormCopyright()
+void FormCopyright::build()
 {
-       if (dialog_!=0) hide();
+       ok()->clicked.connect(SigC::slot(this, &FormCopyright::CancelClicked));
+       copyright()->set(controller().getCopyright());
+       license()->set(controller().getLicence());
+       disclaimer()->set(controller().getDisclaimer());
 }
 
 
-void FormCopyright::show()
+Gtk::Button * FormCopyright::ok()
+{
+       return getWidget<Gtk::Button>("copyright_button_ok");
+}
+
+Gtk::Label * FormCopyright::disclaimer()
 {
-       if(dialog_!=0) { // "About" box hasn't been closed, so just raise it
-               Gdk_Window dialog_win(dialog_->get_window());
-               dialog_win.show();
-               dialog_win.raise();
-       }
-       else { // create new "About" dialog box
-               vector<string> authors; //0. Authors are not listed in LyX copyright dialogbox.
-               
-               dialog_ = new Gnome::About(PACKAGE, VERSION,
-                                          _("(C) 1995 by Matthias Ettrich, \n1995-2000 LyX Team"),
-                                          authors,
-                                          _("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.\nLyX 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."),
-                                          0);
-               
-               // it should be disconnected before deleting dialog_ in FormCopyright::hide()
-               destroy_ = dialog_->destroy.connect(slot(this, &FormCopyright::hide));
-               
-               dialog_->show();
-               
-               h_ = d_->hideAll.connect(slot(this, &FormCopyright::hide));
-       }
+       return getWidget<Gtk::Label>("copyright_disclaimer");
 }
 
+Gtk::Label * FormCopyright::copyright()
+{
+       return getWidget<Gtk::Label>("copyright_copyright");
+}
 
-void FormCopyright::hide()
+Gtk::Label * FormCopyright::license()
 {
-       if (dialog_!=0) {
-               dialog_->hide();
-               
-               h_.disconnect();
-               destroy_.disconnect();
-               
-               delete dialog_;
-               dialog_ = 0;
-       }
+       return getWidget<Gtk::Label>("copyright_license");
 }
index 2e5489e21a81ac782e88d2c5ec0ac05dc37ac097..f8d3287172de197363d0e9e1b53bd0fbc1da41c3 100644 (file)
@@ -1,59 +1,55 @@
 // -*- C++ -*-
-/* FormCopyright.h
- * FormCopyright Interface Class
- * This file is part of
- * ====================================================== 
+/* This file is part of
+ * =================================================
+ * 
+ *          LyX, The Document Processor
+ *          Copyright 1995 Matthias Ettrich.
+ *          Copyright 1995-2000 The LyX Team.
  *
- *           LyX, The Document Processor
+ * ================================================= 
  *
- *           Copyright 2000 The LyX Team.
- *
- * ======================================================
- */
+ * \author Michael Koziarski <michael@koziarski.org>
+ * */
 
 #ifndef FORMCOPYRIGHT_H
 #define FORMCOPYRIGHT_H
 
-#include "DialogBase.h"
-#include <gnome--/about.h>
+#ifdef __GNUG__
+#pragma interface
+#endif
 
-class Dialogs;
-// same arguement as in Dialogs.h s/LyX/UI/
-class LyXView;
+#include "ControlCopyright.h"
+#include "GnomeBase.h"
 
-/** This class provides an GTK-- implementation of the FormCopyright Dialog.
+namespace Gtk {
+class Button;
+class Label;
+}
+
+/**
+ * This class implements the dialog to show the copyright.
  */
-class FormCopyright : public DialogBase {
+class FormCopyright : public FormCB<ControlCopyright> {
 public:
-       /// #FormCopyright x(LyXFunc ..., Dialogs ...);#
-       FormCopyright(LyXView *, Dialogs *);
        ///
-       ~FormCopyright();
-private:
-       /// Create the dialog if necessary, update it and display it.
-       void show();
-       /// Hide the dialog.
-       void hide();
-       /// Not used but we've got to implement it.
-       void update() {}
+       FormCopyright(ControlCopyright & c);
+       ///
+       ~FormCopyright() {};
 
-       /// Real GUI implementation.
-        Gnome::About * dialog_;
-       /** Which LyXFunc do we use?
-           We could modify Dialogs to have a visible LyXFunc* instead and
-           save a couple of bytes per dialog.
-       */
-       LyXView * lv_;
-       /** Which Dialogs do we belong to?
-           Used so we can get at the signals we have to connect to.
-       */
-       Dialogs * d_;
-       /// Hide connection.
-       SigC::Connection h_;
-       /// Destroy connection.
-       SigC::Connection destroy_;
+       void apply() {}; 
+       void update() {};
+       
+private:
+       
+       /// Build the dialog
+       void build();
+       Gtk::Button * ok();
+       void CancelClicked() { CancelButton(); }
+       Gtk::Label * disclaimer();
+       Gtk::Label * copyright();
+       Gtk::Label * license();
+       /// The ok button
+       
 };
 
 #endif
-
-
index b650a37c0ca1fcd467dcb58cab8378baa5818034..4e924a03b6bd9705b525f065c7c1de212f437a13 100644 (file)
@@ -71,8 +71,8 @@ int GUIRunTime::initApplication(int, char * argv[])
 
        // I belive that this should be done at a later stage, in
        // lyx_gui, the same place as xforms does the same. (Lgb)
-       static string app_id(PACKAGE);
-       static string app_version(VERSION);
+       string app_id(PACKAGE);
+       string app_version(VERSION);
        static Gnome::Main  a(app_id, app_version, 1, argv);
        glade_gnome_init(); // Initialize the glade library.
        static GLyxAppWin   appWin;
index 29c1335520b4f445e838f4f49d5f961e127d1f29..1d87c7a93758c5a3a9ceb59bb05922dc832a90f1 100644 (file)
@@ -82,10 +82,12 @@ libgnome_la_SOURCES = \
        pixbutton.h \
        GnomeBase.C \
        GnomeBase.h \
+       FormCopyright.C \
+       FormCopyright.h \
        FormCredits.C \
        FormCredits.h \
        FormUrl.C \
-       FormUrl.h 
+       FormUrl.h
 
 # These still have to be added. Sooner or later. ARRae-20000411
 #      GUI_defaults.C \
index faa4e70678c9005da6b9e761f264de13125f7fa3..b76f1ab563614178e7353eade3af49e38b3af1ed 100644 (file)
@@ -26,7 +26,6 @@ string get_font_name(Gdk_Font const & font)
 }
 
 
-extern "C"
 gchar *
 get_font_name (const GdkFont * font)
 {
@@ -45,14 +44,18 @@ get_font_name (const GdkFont * font)
                gint num_fonts;
                gchar **font_names;
 
-               num_fonts = XFontsOfFontSet (XFontSet(GDK_FONT_XFONT (font)), &font_structs, &font_names);
+               num_fonts = XFontsOfFontSet (
+                               static_cast<XFontSet>(GDK_FONT_XFONT (font))
+                               , &font_structs, &font_names);
 #ifdef E_FONT_VERBOSE
                g_print ("Fonts of fontset:\n");
                for (i = 0; i < num_fonts; i++) g_print ("  %s\n", font_names[i]);
 #endif
                status = XGetFontProperty (font_structs[0], font_atom, &atom);
        } else {
-               status = XGetFontProperty ( (XFontStruct*)GDK_FONT_XFONT (font), font_atom, &atom);
+               status = XGetFontProperty ( 
+                               static_cast<XFontStruct*>(GDK_FONT_XFONT (font))
+                               , font_atom, &atom);
        }
 
        if (status) {
index a011eb3715ce5bba55192dffd0f59225877186b9..8c7094e0fe52cb25929634090171416502d7d1be 100644 (file)
@@ -49,7 +49,6 @@ string get_font_name(Gdk_Font const & font);
  *
  * This function was lifted from e-font.c from the gabber package.
  */
-extern "C"
 gchar * get_font_name(GdkFont const * font);
 
 #endif