Changed FormCopyright to MVC.

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
This commit is contained in:
Baruch Even 2001-04-02 10:24:07 +00:00
parent 49b87a72c3
commit 04ff598331
8 changed files with 103 additions and 104 deletions

View 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.

View File

@ -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<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));

View 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"
FormCopyright::FormCopyright(LyXView * lv, Dialogs * d)
: dialog_(0), lv_(lv), d_(d), h_(0)
#include <gtk--/button.h>
#include <gtk--/label.h>
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()
{
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::Button>("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<Gtk::Label>("copyright_disclaimer");
}
Gtk::Label * FormCopyright::copyright()
{
return getWidget<Gtk::Label>("copyright_copyright");
}
Gtk::Label * FormCopyright::license()
{
return getWidget<Gtk::Label>("copyright_license");
}

View 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

View 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;

View 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 \

View 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) {

View 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