diff --git a/src/frontends/gnome/ChangeLog b/src/frontends/gnome/ChangeLog index bae1f4078c..65f61aa88c 100644 --- a/src/frontends/gnome/ChangeLog +++ b/src/frontends/gnome/ChangeLog @@ -1,3 +1,13 @@ +2001-04-02 Michael Koziarski + + * FormCopyright.[Ch]: Reimplemented as an MVC dialog. + + * gnome_helpers.C: Some castings to avoid compilation break. + +2001-04-01 Baruch Even + + * GUIRuntime.C (initApplication): Changed strings to non-static. + 2001-03-30 Baruch Even * FormCredits.C: Added the formatting of the credits text. diff --git a/src/frontends/gnome/Dialogs.C b/src/frontends/gnome/Dialogs.C index fc7683fee7..721ab5351b 100644 --- a/src/frontends/gnome/Dialogs.C +++ b/src/frontends/gnome/Dialogs.C @@ -33,13 +33,13 @@ #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(*lv, *this)); add(new GUICredits(*lv, *this)); + add(new GUICopyright(*lv, *this)); /* splash_.reset(new FormSplash(lv, this)); @@ -80,13 +81,11 @@ Dialogs::Dialogs(LyXView * lv) add(new GUIBibtex(*lv, *this)); add(new GUICharacter(*lv, *this)); //add(new GUICitation(*lv, *this)); - //add(new GUICopyright(*lv, *this)); add(new GUILog(*lv, *this)); add(new GUIVCLog(*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)); diff --git a/src/frontends/gnome/FormCopyright.C b/src/frontends/gnome/FormCopyright.C index 6af7a579c8..beb74ea464 100644 --- a/src/frontends/gnome/FormCopyright.C +++ b/src/frontends/gnome/FormCopyright.C @@ -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 */ +#ifdef __GNUG__ +#pragma implementation +#endif + #include -#include "gettext.h" -#include "Dialogs.h" + +#include "debug.h" + +#include "gnomeBC.h" #include "FormCopyright.h" +#include "gnome_helpers.h" -FormCopyright::FormCopyright(LyXView * lv, Dialogs * d) - : dialog_(0), lv_(lv), d_(d), h_(0) +#include +#include + + +FormCopyright::FormCopyright(ControlCopyright & c) + : FormCB(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() { - 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 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("copyright_button_ok"); } - -void FormCopyright::hide() +Gtk::Label * FormCopyright::disclaimer() { - if (dialog_!=0) { - dialog_->hide(); - - h_.disconnect(); - destroy_.disconnect(); - - delete dialog_; - dialog_ = 0; - } + return getWidget("copyright_disclaimer"); +} + +Gtk::Label * FormCopyright::copyright() +{ + return getWidget("copyright_copyright"); +} + +Gtk::Label * FormCopyright::license() +{ + return getWidget("copyright_license"); } diff --git a/src/frontends/gnome/FormCopyright.h b/src/frontends/gnome/FormCopyright.h index 2e5489e21a..f8d3287172 100644 --- a/src/frontends/gnome/FormCopyright.h +++ b/src/frontends/gnome/FormCopyright.h @@ -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 + * */ #ifndef FORMCOPYRIGHT_H #define FORMCOPYRIGHT_H -#include "DialogBase.h" -#include +#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 { 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 - - diff --git a/src/frontends/gnome/GUIRunTime.C b/src/frontends/gnome/GUIRunTime.C index b650a37c0c..4e924a03b6 100644 --- a/src/frontends/gnome/GUIRunTime.C +++ b/src/frontends/gnome/GUIRunTime.C @@ -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; diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am index 29c1335520..1d87c7a937 100644 --- a/src/frontends/gnome/Makefile.am +++ b/src/frontends/gnome/Makefile.am @@ -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 \ diff --git a/src/frontends/gnome/gnome_helpers.C b/src/frontends/gnome/gnome_helpers.C index faa4e70678..b76f1ab563 100644 --- a/src/frontends/gnome/gnome_helpers.C +++ b/src/frontends/gnome/gnome_helpers.C @@ -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(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(GDK_FONT_XFONT (font)) + , font_atom, &atom); } if (status) { diff --git a/src/frontends/gnome/gnome_helpers.h b/src/frontends/gnome/gnome_helpers.h index a011eb3715..8c7094e0fe 100644 --- a/src/frontends/gnome/gnome_helpers.h +++ b/src/frontends/gnome/gnome_helpers.h @@ -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