From: Baruch Even Date: Thu, 29 Mar 2001 14:47:17 +0000 (+0000) Subject: Added FormCredits dialog (MVC version) by Michael Koziarski. X-Git-Tag: 1.6.10~21376 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a266390f648f17cc2ea138098169d329bb7b3804;p=features.git Added FormCredits dialog (MVC version) by Michael Koziarski. Fixed some minor bugs in the MVC support in gnome. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1852 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/gnome/ChangeLog b/src/frontends/gnome/ChangeLog index 450d5ca8d2..678690a01d 100644 --- a/src/frontends/gnome/ChangeLog +++ b/src/frontends/gnome/ChangeLog @@ -1,3 +1,22 @@ +2001-03-29 Baruch Even + + * FormUrl.C (d-tor): + * FormCredits.C (d-tor): Removed the dialog_->destroy(), it was causing + crashes on exit. + + * GnomeBase.C (d-tor): Added a check for times when the xml wasn't loaded. + +2001-03-29 Michael Koziarski + + * Dialogs.C: Uncommented FormCredits in the #include and instantiate it. + + * Makefile.am: Added FormCredits.[Ch] + + * FormCredits.[Ch]: Created FormCredits dialog using libglade + approach. Text needs to be formatted still. + + * dialogs/diahelpcredits.glade: Created file. + 2001-03-26 Baruch Even * Various files: Fixes to get the gnome frontend to compile again. diff --git a/src/frontends/gnome/Dialogs.C b/src/frontends/gnome/Dialogs.C index 210f26804d..fc7683fee7 100644 --- a/src/frontends/gnome/Dialogs.C +++ b/src/frontends/gnome/Dialogs.C @@ -32,13 +32,14 @@ #include "GUI.h" #include "FormUrl.h" +#include "FormCredits.h" + /* #include "FormBibitem.h" #include "FormBibtex.h" #include "FormCharacter.h" #include "FormCitation.h" #include "FormCopyright.h" -#include "FormCredits.h" #include "FormLog.h" #include "FormVCLog.h" @@ -70,6 +71,8 @@ SigC::Signal0 Dialogs::redrawGUI; Dialogs::Dialogs(LyXView * lv) { add(new GUIUrl(*lv, *this)); + add(new GUICredits(*lv, *this)); + /* splash_.reset(new FormSplash(lv, this)); @@ -78,7 +81,6 @@ Dialogs::Dialogs(LyXView * lv) add(new GUICharacter(*lv, *this)); //add(new GUICitation(*lv, *this)); //add(new GUICopyright(*lv, *this)); - add(new GUICredits(*lv, *this)); add(new GUILog(*lv, *this)); add(new GUIVCLog(*lv, *this)); diff --git a/src/frontends/gnome/FormCredits.C b/src/frontends/gnome/FormCredits.C new file mode 100644 index 0000000000..9f693acc9f --- /dev/null +++ b/src/frontends/gnome/FormCredits.C @@ -0,0 +1,92 @@ +// -*- C++ -*- +/* This file is part of + * ================================================= + * + * LyX, The Document Processor + * Copyright 1995-2000 The LyX Team. + * + * ================================================= + * + * \author Michael Koziarski + */ + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include + +#include "gnomeBC.h" +#include "FormCredits.h" + +#include +#include +#include + +FormCredits::FormCredits(ControlCredits & c) + : FormCB(c, "diahelpcredits.glade", "DiaHelpCredits") + , dialog_(0) +{ + +} + + +FormCredits::~FormCredits() +{ + //dialog_->destroy(); +} + + +void FormCredits::build() +{ + dialog_ = dialog(); + + // It is better to show an OK button, but the policy require that we + // got a click on "Cancel" + ok()->clicked.connect(SigC::slot(this, &FormCredits::CancelClicked)); + + std::stringstream ss; + text()->insert(controller().getCredits(ss).str()); +} + + +void FormCredits::show() +{ + if (!dialog_) + build(); + + update(); + dialog_->show(); +} + + +void FormCredits::hide() +{ + dialog_->hide(); +} + + +void FormCredits::apply() +{ +} + + +void FormCredits::update() +{ +} + + +Gnome::Dialog * FormCredits::dialog() +{ + return getWidget("DiaHelpCredits"); +} + +Gtk::Text * FormCredits::text() +{ + return getWidget("credits_text"); +} + +Gtk::Button * FormCredits::ok() +{ + return getWidget("credits_button_ok"); +} diff --git a/src/frontends/gnome/FormCredits.h b/src/frontends/gnome/FormCredits.h new file mode 100644 index 0000000000..b924ff1053 --- /dev/null +++ b/src/frontends/gnome/FormCredits.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +/* This file is part of + * ================================================= + * + * LyX, The Document Processor + * Copyright 1995 Matthias Ettrich. + * Copyright 1995-2000 The LyX Team. + * + * ================================================= + * + * \author Michael Koziarski + * */ + +#ifndef FORMCREDITS_H +#define FORMCREDITS_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlCredits.h" +#include "GnomeBase.h" + +namespace Gnome { +class Dialog; +} + +namespace Gtk { +class Button; +class Text; +} + +/** + * This class implements the dialog to show the credits. + */ +class FormCredits : public FormCB { +public: + /// + FormCredits(ControlCredits & c); + /// + ~FormCredits(); + + void apply(); + + void hide(); + void show(); + void update(); + +private: + + /// Build the dialog + void build(); + + /// get the dialog + Gnome::Dialog * dialog(); + + void CancelClicked() { CancelButton(); } + + /// The ok button + Gtk::Button * ok(); + + Gtk::Text * text(); + + // Hold the dialog. + Gnome::Dialog * dialog_; +}; + +#endif diff --git a/src/frontends/gnome/FormUrl.C b/src/frontends/gnome/FormUrl.C index 0b4ea0fd08..b3b3a02b42 100644 --- a/src/frontends/gnome/FormUrl.C +++ b/src/frontends/gnome/FormUrl.C @@ -34,7 +34,7 @@ FormUrl::~FormUrl() // Note that there is no need to destroy the class itself, it seems // like everything is managed inside it. Deleting the class itself will // a crash at the end of the program. - dialog_->destroy(); + //dialog_->destroy(); } diff --git a/src/frontends/gnome/GnomeBase.C b/src/frontends/gnome/GnomeBase.C index 631d5f2c50..de37831333 100644 --- a/src/frontends/gnome/GnomeBase.C +++ b/src/frontends/gnome/GnomeBase.C @@ -25,7 +25,8 @@ GnomeBase::GnomeBase(ControlBase & c, string const & glade_file, string const & GnomeBase::~GnomeBase() { - gtk_object_unref(GTK_OBJECT(xml_)); + if (xml_) + gtk_object_unref(GTK_OBJECT(xml_)); } diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am index 9789632a9c..8338d1132b 100644 --- a/src/frontends/gnome/Makefile.am +++ b/src/frontends/gnome/Makefile.am @@ -81,6 +81,8 @@ libgnome_la_SOURCES = \ pixbutton.h \ GnomeBase.C \ GnomeBase.h \ + FormCredits.C \ + FormCredits.h \ FormUrl.C \ FormUrl.h diff --git a/src/frontends/gnome/dialogs/diahelpcredits.glade b/src/frontends/gnome/dialogs/diahelpcredits.glade new file mode 100644 index 0000000000..f3d22547d0 --- /dev/null +++ b/src/frontends/gnome/dialogs/diahelpcredits.glade @@ -0,0 +1,132 @@ + + + + + diahelpcredits + diahelpcredits + + + pixmaps + C + True + True + True + False + False + True + diahelpcredits_interface.c + diahelpcredits_interface.h + diahelpcredits_callbacks.c + diahelpcredits_callbacks.h + + + + GnomeDialog + DiaHelpCredits + GTK_WINDOW_DIALOG + GTK_WIN_POS_NONE + False + 300 + True + True + False + False + True + + + GtkVBox + GnomeDialog:vbox + dialog-vbox3 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area3 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + credits_button_ok + True + True + True + True + GNOME_STOCK_BUTTON_OK + + + + + GtkVBox + vbox4 + False + 0 + + 0 + True + True + + + + GtkLabel + label8 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkScrolledWindow + scrolledwindow1 + GTK_POLICY_AUTOMATIC + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkText + credits_text + True + False + + + + + + + + +