]> git.lyx.org Git - features.git/commitdiff
Added FormCredits dialog (MVC version) by Michael Koziarski.
authorBaruch Even <baruch@lyx.org>
Thu, 29 Mar 2001 14:47:17 +0000 (14:47 +0000)
committerBaruch Even <baruch@lyx.org>
Thu, 29 Mar 2001 14:47:17 +0000 (14:47 +0000)
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

src/frontends/gnome/ChangeLog
src/frontends/gnome/Dialogs.C
src/frontends/gnome/FormCredits.C [new file with mode: 0644]
src/frontends/gnome/FormCredits.h [new file with mode: 0644]
src/frontends/gnome/FormUrl.C
src/frontends/gnome/GnomeBase.C
src/frontends/gnome/Makefile.am
src/frontends/gnome/dialogs/diahelpcredits.glade [new file with mode: 0644]

index 450d5ca8d2131a83b4214c567f335da68807dd6f..678690a01d42625c1f9d74b7946223fee2e11fed 100644 (file)
@@ -1,3 +1,22 @@
+2001-03-29  Baruch Even  <baruch@lyx.org>
+
+       * 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  <michael@koziarski.org>
+
+       * 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  <baruch@lyx.org>
 
        * Various files: Fixes to get the gnome frontend to compile again. 
index 210f26804df7319ef0c252ceae8f4b63aaa4a820..fc7683fee7819f6dce5cf9733ec48d73826ea242 100644 (file)
 #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<void> Dialogs::redrawGUI;
 Dialogs::Dialogs(LyXView * lv)
 {
        add(new GUIUrl<FormUrl, gnomeBC>(*lv, *this));
+       add(new GUICredits<FormCredits, gnomeBC>(*lv, *this));
+
 /*     
        splash_.reset(new FormSplash(lv, this));
 
@@ -78,7 +81,6 @@ Dialogs::Dialogs(LyXView * lv)
        add(new GUICharacter<FormCharacter, xformsBC>(*lv, *this));
        //add(new GUICitation<FormCitation, xformsBC>(*lv, *this));
        //add(new GUICopyright<FormCopyright, xformsBC>(*lv, *this));
-       add(new GUICredits<FormCredits, xformsBC>(*lv, *this));
        add(new GUILog<FormLog, xformsBC>(*lv, *this));
        add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
 
diff --git a/src/frontends/gnome/FormCredits.C b/src/frontends/gnome/FormCredits.C
new file mode 100644 (file)
index 0000000..9f693ac
--- /dev/null
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+/* This file is part of
+ * =================================================
+ * 
+ *          LyX, The Document Processor
+ *          Copyright 1995-2000 The LyX Team.
+ *
+ * ================================================= 
+ *
+ * \author Michael Koziarski <michael@koziarski.org>
+ */
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <config.h>
+
+#include "gnomeBC.h"
+#include "FormCredits.h"
+
+#include <gnome--/dialog.h>
+#include <gtk--/button.h>
+#include <gtk--/text.h>
+
+FormCredits::FormCredits(ControlCredits & c)
+       : FormCB<ControlCredits>(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<Gnome::Dialog>("DiaHelpCredits");
+}
+
+Gtk::Text * FormCredits::text()
+{
+       return getWidget<Gtk::Text>("credits_text");
+}
+
+Gtk::Button * FormCredits::ok()
+{
+       return getWidget<Gtk::Button>("credits_button_ok");
+}
diff --git a/src/frontends/gnome/FormCredits.h b/src/frontends/gnome/FormCredits.h
new file mode 100644 (file)
index 0000000..b924ff1
--- /dev/null
@@ -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 <michael@koziarski.org>
+ * */
+
+#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<ControlCredits> {
+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
index 0b4ea0fd08fd26baf3d161a5545bfea40e054b14..b3b3a02b42b982b72acfd4d461a0d4124b336e93 100644 (file)
@@ -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();
 }
 
 
index 631d5f2c506e7dc0fc1bbb67764e5cec04c539cb..de37831333c39bbb53520b88628940d04bb0e865 100644 (file)
@@ -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_));
 }
 
        
index 9789632a9c9ff9a8b9123a44eafe42a122e40e31..8338d1132b6278857a61337e72436c3762633217 100644 (file)
@@ -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 (file)
index 0000000..f3d2254
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+  <name>diahelpcredits</name>
+  <program_name>diahelpcredits</program_name>
+  <directory></directory>
+  <source_directory></source_directory>
+  <pixmaps_directory>pixmaps</pixmaps_directory>
+  <language>C</language>
+  <gnome_support>True</gnome_support>
+  <gettext_support>True</gettext_support>
+  <use_widget_names>True</use_widget_names>
+  <output_main_file>False</output_main_file>
+  <output_build_files>False</output_build_files>
+  <gnome_help_support>True</gnome_help_support>
+  <main_source_file>diahelpcredits_interface.c</main_source_file>
+  <main_header_file>diahelpcredits_interface.h</main_header_file>
+  <handler_source_file>diahelpcredits_callbacks.c</handler_source_file>
+  <handler_header_file>diahelpcredits_callbacks.h</handler_header_file>
+</project>
+
+<widget>
+  <class>GnomeDialog</class>
+  <name>DiaHelpCredits</name>
+  <type>GTK_WINDOW_DIALOG</type>
+  <position>GTK_WIN_POS_NONE</position>
+  <modal>False</modal>
+  <default_height>300</default_height>
+  <allow_shrink>True</allow_shrink>
+  <allow_grow>True</allow_grow>
+  <auto_shrink>False</auto_shrink>
+  <auto_close>False</auto_close>
+  <hide_on_close>True</hide_on_close>
+
+  <widget>
+    <class>GtkVBox</class>
+    <child_name>GnomeDialog:vbox</child_name>
+    <name>dialog-vbox3</name>
+    <homogeneous>False</homogeneous>
+    <spacing>8</spacing>
+    <child>
+      <padding>4</padding>
+      <expand>True</expand>
+      <fill>True</fill>
+    </child>
+
+    <widget>
+      <class>GtkHButtonBox</class>
+      <child_name>GnomeDialog:action_area</child_name>
+      <name>dialog-action_area3</name>
+      <layout_style>GTK_BUTTONBOX_END</layout_style>
+      <spacing>8</spacing>
+      <child_min_width>85</child_min_width>
+      <child_min_height>27</child_min_height>
+      <child_ipad_x>7</child_ipad_x>
+      <child_ipad_y>0</child_ipad_y>
+      <child>
+       <padding>0</padding>
+       <expand>False</expand>
+       <fill>True</fill>
+       <pack>GTK_PACK_END</pack>
+      </child>
+
+      <widget>
+       <class>GtkButton</class>
+       <name>credits_button_ok</name>
+       <can_default>True</can_default>
+       <has_default>True</has_default>
+       <can_focus>True</can_focus>
+       <has_focus>True</has_focus>
+       <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+      </widget>
+    </widget>
+
+    <widget>
+      <class>GtkVBox</class>
+      <name>vbox4</name>
+      <homogeneous>False</homogeneous>
+      <spacing>0</spacing>
+      <child>
+       <padding>0</padding>
+       <expand>True</expand>
+       <fill>True</fill>
+      </child>
+
+      <widget>
+       <class>GtkLabel</class>
+       <name>label8</name>
+       <label>All these people have contributed to the LyX project, Thanks,
+
+Matthias</label>
+       <justify>GTK_JUSTIFY_CENTER</justify>
+       <wrap>False</wrap>
+       <xalign>0.5</xalign>
+       <yalign>0.5</yalign>
+       <xpad>0</xpad>
+       <ypad>0</ypad>
+       <child>
+         <padding>0</padding>
+         <expand>False</expand>
+         <fill>False</fill>
+       </child>
+      </widget>
+
+      <widget>
+       <class>GtkScrolledWindow</class>
+       <name>scrolledwindow1</name>
+       <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
+       <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
+       <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
+       <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
+       <child>
+         <padding>0</padding>
+         <expand>True</expand>
+         <fill>True</fill>
+       </child>
+
+       <widget>
+         <class>GtkText</class>
+         <name>credits_text</name>
+         <can_focus>True</can_focus>
+         <editable>False</editable>
+         <text>
+</text>
+       </widget>
+      </widget>
+    </widget>
+  </widget>
+</widget>
+
+</GTK-Interface>