]> git.lyx.org Git - lyx.git/commitdiff
Gnomified FormError.
authorBaruch Even <baruch@lyx.org>
Tue, 3 Apr 2001 21:00:26 +0000 (21:00 +0000)
committerBaruch Even <baruch@lyx.org>
Tue, 3 Apr 2001 21:00:26 +0000 (21:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1881 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gnome/Dialogs.C
src/frontends/gnome/FormError.C
src/frontends/gnome/FormError.h
src/frontends/gnome/Makefile.am
src/frontends/gnome/dialogs/diaerror.glade [new file with mode: 0644]
src/frontends/gnome/dialogs/diainsertindex.glade

index a64315eed5a3d7198313ec8e2ed420621e50b335..f90f5bf91f1cee1e142de83e96bd38240d6dfeba 100644 (file)
@@ -24,6 +24,7 @@
 #include "ControlCitation.h"
 #include "ControlCopyright.h"
 #include "ControlCredits.h"
+#include "ControlError.h"
 #include "ControlInclude.h"
 #include "ControlLog.h"
 #include "ControlUrl.h"
@@ -34,6 +35,7 @@
 #include "FormUrl.h"
 #include "FormCredits.h"
 #include "FormCopyright.h"
+#include "FormError.h"
 
 /*
 #include "FormBibitem.h"
@@ -44,7 +46,6 @@
 #include "FormVCLog.h"
 
 #include "FormDocument.h"
-#include "FormError.h"
 #include "FormExternal.h" 
 #include "FormGraphics.h"
 #include "FormInclude.h"
@@ -73,6 +74,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));
+       add(new GUIError<FormError, gnomeBC>(*lv, *this));
 
 /*     
        splash_.reset(new FormSplash(lv, this));
@@ -88,7 +90,6 @@ Dialogs::Dialogs(LyXView * lv)
        add(new FormCitation(lv, this));
        
        add(new FormDocument(lv, this));
-       add(new FormError(lv, this));
        add(new FormExternal(lv, this));
        add(new FormGraphics(lv, this));
        add(new FormInclude(lv, this));
index ae8635c75e93a2e7c39fe37ed05f26caec97138f..a7dcf11c0a9c1a910be4d5c64e33eda4ffbf79ae 100644 (file)
 // -*- C++ -*-
 /* This file is part of
- * ====================================================== 
+ * =================================================
+ * 
+ *          LyX, The Document Processor
+ *          Copyright 1995-2000 The LyX Team.
  *
- *           LyX, The Document Processor
+ * ================================================= 
  *
- *           Copyright 2000 The LyX Team.
- *
- * ======================================================
+ * \author Baruch Even
  */
 
-#include <config.h>
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include "gettext.h"
-#include "Dialogs.h"
+#include <config.h>
+
+#include "gnomeBC.h"
 #include "FormError.h"
-#include "LyXView.h"
-#include "buffer.h"
-#include "lyxfunc.h"
 
-#include <gtk--/label.h>
-#include <gtk--/box.h>
 #include <gtk--/button.h>
-#include <gtk--/buttonbox.h>
-#include <gnome--/stock.h>
-#include <gtk--/separator.h>
-#include <gtk--/alignment.h>
+#include <gtk--/text.h>
 
-// temporary solution for LyXView
-#include "mainapp.h"
-extern GLyxAppWin * mainAppWin;
+FormError::FormError(ControlError & c)
+       : FormCB<ControlError>(c, "diaerror.glade", "DiaError")
+{}
 
 
-FormError::FormError(LyXView * lv, Dialogs * d)
-       : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(0)
+void FormError::build()
 {
-  // let the dialog be shown
-  // These are permanent connections so we won't bother
-  // storing a copy because we won't be disconnecting.
-  d->showError.connect(slot(this, &FormError::showInset));
-}
+       // Connect the buttons.
+       close_btn()->clicked.connect(SigC::slot(this, &FormError::CloseClicked));
 
+       // Manage the buttons state
+       bc().setCancel(close_btn());
 
-FormError::~FormError()
-{
-  hide();
+       // Make sure everything is in the correct state.
+       bc().refresh();
 }
 
-void FormError::showInset( InsetError * const inset )
-{
-  if( dialog_!=0 || inset == 0 ) return;
-  
-  inset_ = inset;
-  ih_ = inset_->hideDialog.connect(slot(this, &FormError::hide));
-
-  show();
-}
 
-void FormError::show()
+void FormError::update()
 {
-  if (!dialog_)
-    {
-      using namespace Gtk::Box_Helpers;
-      
-      Gtk::Label * label = manage( new Gtk::Label(inset_->getContents()) );
-      Gtk::Box * hbox = manage( new Gtk::HBox() );
-      Gtk::Button * b_close = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CLOSE) ) );
-      Gtk::Alignment * alg1 = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
-      Gtk::Alignment * mbox = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
-      
-      // set up spacing
-      hbox->set_spacing(4);
-
-      // packing
-      alg1->add(*b_close);
-      
-      hbox->children().push_back(Element(*label, false, false));
-      hbox->children().push_back(Element(*manage(new Gtk::VSeparator()), false, false));
-      hbox->children().push_back(Element(*alg1, false, false));
-
-      mbox->add(*hbox);
-      
-      // packing dialog to main window
-      dialog_ = mbox;
-      mainAppWin->add_action(*dialog_, _(" Error "));
-
-      // setting focus
-      GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_close->gtkobj()), GTK_CAN_DEFAULT);
-      gtk_widget_grab_focus (GTK_WIDGET(b_close->gtkobj()));
-      gtk_widget_grab_default (GTK_WIDGET(b_close->gtkobj()));
-
-      // connecting signals
-      b_close->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
-      dialog_->destroy.connect(slot(this, &FormError::free));
-
-      u_ = d_->updateBufferDependent.connect(slot(this, &FormError::updateSlot));
-      h_ = d_->hideBufferDependent.connect(slot(this, &FormError::hide));
-    }
+       textarea()->insert(controller().params());
 }
 
-void FormError::updateSlot(bool buffchanged)
-{
-  if (buffchanged) hide();
-}
 
-void FormError::hide()
+Gtk::Button * FormError::close_btn() const
 {
-  if (dialog_!=0) mainAppWin->remove_action();
+       return getWidget<Gtk::Button>("button_close");
 }
 
-void FormError::free()
-{
-  if (dialog_!=0)
-    {
-      dialog_ = 0;
-      u_.disconnect();
-      h_.disconnect();
-      inset_ = 0;
-      ih_.disconnect();
-    }
-}
 
-void FormError::apply()
+Gtk::Text * FormError::textarea() const
 {
+       return getWidget<Gtk::Text>("textarea");
 }
-
index ee39e17f64188ef7d735cbe2b674ba14fe1bca65..e8a57302d34b708a556794769b1c4e77ffd7cf27 100644 (file)
@@ -1,13 +1,15 @@
 // -*- C++ -*-
 /* 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 Baruch Even
+ * */
 
 #ifndef FORMERROR_H
 #define FORMERROR_H
 #pragma interface
 #endif
 
-#include "DialogBase.h"
-#include "LString.h"
-#include "insets/inseterror.h"
+#include "ControlError.h"
+#include "GnomeBase.h"
 
-#include <gtk--/container.h>
+namespace Gtk {
+class Button;
+class Text;
+}
 
-/** This class provides an Gnome implementation of the FormError Dialog.
+/**
+ * This class implements the dialog to show error messages.
  */
-class FormError : public DialogBase {
+class FormError : public FormCB<ControlError> {
 public:
-  ///
-  FormError(LyXView *, Dialogs *);
-  ///
-  ~FormError();
+       ///
+       FormError(ControlError & c);
+       ///
+       ~FormError() {};
+
+       void apply() {};
+       void update();
+       
 private:
-  /// Slot launching dialog to an existing inset
-  void showInset( InsetError * const );
-  
-  /// Update dialog before showing it
-  virtual void update() { }
-  virtual void updateSlot(bool = false);
-  /// Apply from dialog (modify or create inset)
-  virtual void apply();
-  /// Explicitly free the dialog.
-  void free();
-  /// Create the dialog if necessary, update it and display it.
-  void show();
-  /// Hide the dialog.
-  void hide();
-  
-  /** 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_;
-  /// pointer to the inset passed through showInset (if any)
-  InsetError * inset_;
-  /// Update connection.
-  SigC::Connection u_;
-  /// Hide connection.
-  SigC::Connection h_;
-  /// inset::hide connection.
-  SigC::Connection ih_;
+       /// Build the dialog
+       void build();
+
+       /// Returns true if the dialog input is in a valid state.
+       bool validate() const {return true;};
+
 
-  /// Real GUI implementation.
-  Gtk::Container * dialog_;
+       void CloseClicked() { CancelButton(); }
+       
+       /// The close button
+       Gtk::Button * close_btn() const;
+       Gtk::Text * textarea() const;
 };
 
 #endif
index c28731921eb1e97faaafd8de33e8cf3af767e896..e20ceb6c5aa732d6e726df49cd669c02d1875c58 100644 (file)
@@ -83,6 +83,8 @@ libgnome_la_SOURCES = \
        FormCopyright.h \
        FormCredits.C \
        FormCredits.h \
+       FormError.C \
+       FormError.h \
        FormUrl.C \
        FormUrl.h \
        Menubar_pimpl.C \
diff --git a/src/frontends/gnome/dialogs/diaerror.glade b/src/frontends/gnome/dialogs/diaerror.glade
new file mode 100644 (file)
index 0000000..ffbec04
--- /dev/null
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+  <name>diainserturl</name>
+  <program_name>diainserturl</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>diainserturl_interface.c</main_source_file>
+  <main_header_file>diainserturl_interface.h</main_header_file>
+  <handler_source_file>diainserturl_callbacks.c</handler_source_file>
+  <handler_header_file>diainserturl_callbacks.h</handler_header_file>
+</project>
+
+<widget>
+  <class>GnomeDialog</class>
+  <name>DiaError</name>
+  <title>Error</title>
+  <type>GTK_WINDOW_DIALOG</type>
+  <position>GTK_WIN_POS_NONE</position>
+  <modal>False</modal>
+  <allow_shrink>False</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-vbox1</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_area1</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>button_close</name>
+       <can_default>True</can_default>
+       <can_focus>True</can_focus>
+       <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
+      </widget>
+    </widget>
+
+    <widget>
+      <class>GtkScrolledWindow</class>
+      <name>scrolledwindow1</name>
+      <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
+      <vscrollbar_policy>GTK_POLICY_NEVER</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>textarea</name>
+       <width>250</width>
+       <height>200</height>
+       <can_focus>True</can_focus>
+       <editable>False</editable>
+       <text></text>
+      </widget>
+    </widget>
+  </widget>
+</widget>
+
+</GTK-Interface>
index 7bd4732c58f5574dbe2deed9ae40613e122de226..98c6b88121c91b6e386f6cad22434bae59f0575b 100644 (file)
@@ -21,9 +21,9 @@
 
 <widget>
   <class>GnomeDialog</class>
-  <name>DiaInsertIndex</name>
+  <name>DiaIndex</name>
   <border_width>2</border_width>
-  <title>Insert Index</title>
+  <title>Insert/Update Index</title>
   <type>GTK_WINDOW_DIALOG</type>
   <position>GTK_WIN_POS_NONE</position>
   <modal>False</modal>
        <widget>
          <class>GtkEntry</class>
          <child_name>GnomeEntry:entry</child_name>
-         <name>combo-entry1</name>
+         <name>keyword</name>
          <can_default>True</can_default>
          <has_default>True</has_default>
          <can_focus>True</can_focus>