]> git.lyx.org Git - features.git/commitdiff
Gnome Error&Ref popups, change LyXParagraph::size_type, many tweaks to help cxx compile
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 Oct 2000 15:17:42 +0000 (15:17 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 Oct 2000 15:17:42 +0000 (15:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1109 a592a061-630c-0410-9148-cb99ea01b6c8

20 files changed:
ChangeLog
po/POTFILES.in
src/MenuBackend.C
src/buffer.C
src/buffer.h
src/bufferlist.C
src/converter.C
src/converter.h
src/frontends/gnome/FormError.C [new file with mode: 0644]
src/frontends/gnome/FormError.h [new file with mode: 0644]
src/frontends/gnome/FormRef.C [new file with mode: 0644]
src/frontends/gnome/FormRef.h [new file with mode: 0644]
src/frontends/gnome/Makefile.am
src/frontends/gnome/pixbutton.h
src/frontends/support/Makefile.am
src/insets/figinset.C
src/layout.C
src/lyxfunc.C
src/lyxparagraph.h
src/lyxtext.h

index 5b01767a4ea1f470768180c1044af370b1cb3a3d..ddb68201131145585481f7ee7c8577241b125fae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2000-10-12  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * src/converter.C (runLaTeX): constify buffer argument
+       (scanLog): ditto.
+
+       * src/frontends/support/Makefile.am (INCLUDES): fix.
+
+       * src/buffer.h: add std:: qualifier
+       * src/insets/figinset.C (addpidwait): ditto
+       * src/MenuBackend.C: ditto
+       * src/buffer.C: ditto
+       * src/bufferlist.C: ditto
+       * src/layout.C: ditto
+       * src/lyxfunc.C: ditto
+
+2000-10-11  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * src/lyxtext.h (bidi_level): change return type to
+       LyXParagraph::size_type. 
+
+       * src/lyxparagraph.h: change size_type to
+       TextContainer::difference_type. This should really be
+       TextContainer::size_type, but we need currently to support signed
+       values. 
+
+2000-10-11  Marko Vendelin <markov@ioc.ee>
+       * src/frontends/gnome/FormError.h
+       * src/frontends/gnome/FormRef.C
+       * src/frontends/gnome/FormRef.h
+       * src/frontends/gnome/FormError.C
+       * src/frontends/gnome/Makefile.am
+       * src/frontends/gnome/pixbutton.h: FormError and FormRef are ported 
+       to Gnome frontend. Both dialogs use "action" area.
+
 2000-10-12  Baruch Even  <baruch.even@writeme.com>
 
        * src/graphics/GraphicsCacheItem_pimpl.C:
 
 2000-10-11  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
-       * src/support/translator.h: move helper template clsses to
-       lyxfunctional.h, inlcude 2support/lyxfunctional.h"
+       * src/support/translator.h: move helper template classes to
+       lyxfunctional.h, include "support/lyxfunctional.h"
 
        * src/support/lyxmanip.h: add delaration of fmt
 
        (compare_memfun_t): new template class
        (compare_memfun): helper template function
        (equal_1st_in_pair): moved here from translator
-       (equal_2nd_in_pair): moved here from translatro
+       (equal_2nd_in_pair): moved here from translator
 
        * src/support/fmt.C: new file
-       (fmt): new func, can be used for a printf substute when still
+       (fmt): new func, can be used for a printf substitute when still
        using iostreams ex. lyxerr << fmg("Hello %s", "Jürgen") << endl;
 
-       * src/support/StrPool.C: add some comment
+       * src/support/StrPool.C: add some comments
 
        * src/support/Makefile.am (libsupport_la_SOURCES): add fmt.C and
        lyxfunctional.h
        return NULL
 
        * src/bufferlist.C: add <functional>, "support/lyxmanip.h",
-       "support/lyxfunctional.h", remove currentview variable.
+       "support/lyxfunctional.h", remove current_view variable.
        (resize): use std::for_each with std::mem_fun
        (getFileNames): use std::copy with back_inserter_fun
        (getBuffer): change arg type to unsigned int
        * src/buffer.h: add typedefs for iterator_category, value_type
        difference_type, pointer and reference for inset_iterator
        add postfix ++ for inset_iterator
-       make isnet_iterator::getPos() const
+       make inset_iterator::getPos() const
 
        * src/buffer.C: added support/lyxmanip.h
        (readFile): use lyxerr << fmt instead of printf
        (makeLaTeXFile): use std::copy to write out encodings
-       
 
        * src/Painter.C (text): rewrite slightly to avoid extra font variable
 
 
        * src/LColor.C (getGUIName): remove c_str()
 
-       * several files: change all occurances of fl_display to
+       * several files: change all occurrences of fl_display to
        fl_get_display() 
 
        * config/lyxinclude.m4 (LYX_PROG_CXX): add a 2.97 clause so
-       that -pedantid is not used for gcc 2.97 (cvs gcc)
+       that -pedantic is not used for gcc 2.97 (cvs gcc)
 
        * boost/Makefile.am: begin slowly to prepare for a real boost lib
 
index f0d27987a316d6ec133781c99846311fbce465a6..48d0764b7ff2a14104889a093fa3a7e6a7cc396f 100644 (file)
@@ -16,8 +16,10 @@ src/filedlg.C
 src/FontLoader.C
 src/form1.C
 src/frontends/gnome/FormCitation.C
+src/frontends/gnome/FormError.C
 src/frontends/gnome/FormIndex.C
 src/frontends/gnome/FormPrint.C
+src/frontends/gnome/FormRef.C
 src/frontends/gnome/FormToc.C
 src/frontends/gnome/FormUrl.C
 src/frontends/gnome/Menubar_pimpl.C
index 0777155d022f2d8ce8606a93027787c71e967383..acd8603743b7443c3283e19b84bdbc11cb893171 100644 (file)
@@ -34,6 +34,7 @@ extern BufferList bufferlist;
 using std::endl;
 using std::vector;
 using std::pair;
+using std::find_if;
 
 // This is the global menu definition
 MenuBackend menubackend;
index eb5b792e98101a35caa49ec8174528928e955ee7..ce8236d8a9a519c3f95e8be8042904ab644d3724 100644 (file)
@@ -1889,8 +1889,8 @@ void Buffer::makeLaTeXFile(string const & fname,
                                        encodings.insert((*it)->encoding()->LatexName());
 
                        ofs << "\\usepackage[";
-                       copy(encodings.begin(), encodings.end(),
-                            ostream_iterator<string>(ofs, ","));
+                       std::copy(encodings.begin(), encodings.end(),
+                                 std::ostream_iterator<string>(ofs, ","));
                        ofs << doc_encoding << "]{inputenc}\n";
                        texrow.newline();
                } else if (params.inputenc != "default") {
index 1fb0bbff59cff8cc8753e3b331a06c3da4ab3824..ca1e2692bea41dae2480effdfbd4cc720c7d996e 100644 (file)
@@ -413,7 +413,7 @@ public:
        ///
        class inset_iterator {
        public:
-               typedef input_iterator_tag iterator_category;
+               typedef std::input_iterator_tag iterator_category;
                typedef Inset value_type;
                typedef ptrdiff_t difference_type;
                typedef Inset * pointer;
index 08173d2c81ecc548923c4d69b6d3b38c8e184c7e..ce9b10dda2227fd82d7c276865260638af752fd2 100644 (file)
@@ -43,6 +43,8 @@
 using std::vector;
 using std::find;
 using std::endl;
+using std::find_if;
+using std::for_each;
 
 //
 // Class BufferStorage
index 8103832070945a7824fbaabb1a903fa7d4c90270..179de6ee1bdcdfd9864eef359d8b561806932d2b 100644 (file)
@@ -447,7 +447,7 @@ string const Converter::SplitFormat(string const & str, string & format)
        return using_format;
 }
 
-bool Converter::scanLog(Buffer * buffer, string const & command,
+bool Converter::scanLog(Buffer const * buffer, string const & command,
                        string const & filename)
 {
        BufferView * bv = buffer->getUser();
@@ -494,7 +494,7 @@ bool Converter::scanLog(Buffer * buffer, string const & command,
        return true;
 }
 
-bool Converter::runLaTeX(Buffer * buffer, string const & command)
+bool Converter::runLaTeX(Buffer const * buffer, string const & command)
 {
        
        BufferView * bv = buffer->getUser();
index 33d45392c95636f5f78b95920d8d4f62b20da348..8e282352f3ae736b05de1949344e6ba1c4e60f37 100644 (file)
@@ -123,11 +123,11 @@ public:
 private:
        ///
        static
-       bool scanLog(Buffer * buffer, string const & command, 
+       bool scanLog(Buffer const * buffer, string const & command, 
                     string const & filename);
        ///
        static
-       bool runLaTeX(Buffer * buffer, string const & command);
+       bool runLaTeX(Buffer const * buffer, string const & command);
        ///
        static
        std::vector<Command> commands;
diff --git a/src/frontends/gnome/FormError.C b/src/frontends/gnome/FormError.C
new file mode 100644 (file)
index 0000000..18e04ce
--- /dev/null
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "gettext.h"
+#include "Dialogs.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>
+
+// temporary solution for LyXView
+#include "mainapp.h"
+extern GLyxAppWin * mainAppWin;
+
+
+FormError::FormError(LyXView * lv, Dialogs * d)
+       : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL)
+{
+  // 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));
+}
+
+
+FormError::~FormError()
+{
+  hide();
+}
+
+void FormError::showInset( InsetError * const inset )
+{
+  if( dialog_!=NULL || inset == 0 ) return;
+  
+  inset_ = inset;
+  ih_ = inset_->hide.connect(slot(this, &FormError::hide));
+
+  show();
+}
+
+void FormError::show()
+{
+  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_, N_(" 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::update));
+      h_ = d_->hideBufferDependent.connect(slot(this, &FormError::hide));
+    }
+}
+      
+void FormError::update()
+{
+}
+
+void FormError::hide()
+{
+  if (dialog_!=NULL) mainAppWin->remove_action();
+}
+
+void FormError::free()
+{
+  if (dialog_!=NULL)
+    {
+      dialog_ = NULL;
+      u_.disconnect();
+      h_.disconnect();
+      inset_ = 0;
+      ih_.disconnect();
+    }
+}
+
+void FormError::apply()
+{
+}
+
diff --git a/src/frontends/gnome/FormError.h b/src/frontends/gnome/FormError.h
new file mode 100644 (file)
index 0000000..66f8b40
--- /dev/null
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#ifndef FORMERROR_H
+#define FORMERROR_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "DialogBase.h"
+#include "LString.h"
+#include "boost/utility.hpp"
+#include "insets/inseterror.h"
+
+#include <gtk--/container.h>
+
+/** This class provides an Gnome implementation of the FormError Dialog.
+ */
+class FormError : public DialogBase, public noncopyable {
+public:
+  ///
+  FormError(LyXView *, Dialogs *);
+  ///
+  ~FormError();
+private:
+  /// Slot launching dialog to an existing inset
+  void showInset( InsetError * const );
+  
+  /// Update dialog before showing it
+  virtual void update();
+  /// 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.
+  Connection u_;
+  /// Hide connection.
+  Connection h_;
+  /// inset::hide connection.
+  Connection ih_;
+
+  /// Real GUI implementation.
+  Gtk::Container * dialog_;
+};
+
+#endif
diff --git a/src/frontends/gnome/FormRef.C b/src/frontends/gnome/FormRef.C
new file mode 100644 (file)
index 0000000..6616e6e
--- /dev/null
@@ -0,0 +1,452 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+
+#include "gettext.h"
+#include "Dialogs.h"
+#include "FormRef.h"
+#include "LyXView.h"
+#include "buffer.h"
+#include "lyxfunc.h"
+
+#include <gtk--/box.h>
+#include <gtk--/buttonbox.h>
+#include <gtk--/alignment.h>
+#include <gtk--/separator.h>
+#include <gtk--/label.h>
+#include <gtk--/scrolledwindow.h>
+#include <gtk--/entry.h>
+#include <gtk--/table.h>
+
+#include <gtk--/menu.h>
+#include <gtk--/menuitem.h>
+
+// temporary solution for LyXView
+#include "mainapp.h"
+extern GLyxAppWin * mainAppWin;
+
+using SigC::bind;
+
+// configuration keys
+static string const CONF_ENTRY_NAME("FormRef_name");
+
+// goto button labels
+static string const GOTO_REF_LABEL(N_("Goto reference"));
+static string const GOTO_BACK_LABEL(N_("Go back"));
+
+FormRef::FormRef(LyXView * lv, Dialogs * d)
+       : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL)
+{
+  // let the dialog be shown
+  // These are permanent connections so we won't bother
+  // storing a copy because we won't be disconnecting.
+  d->showRef.connect(slot(this, &FormRef::showInset));
+  d->createRef.connect(slot(this, &FormRef::createInset));
+}
+
+
+FormRef::~FormRef()
+{
+  hide();
+}
+
+void FormRef::showInset( InsetCommand * const inset )
+{
+  if( dialog_!=NULL || inset == 0 ) return;
+  
+  inset_ = inset;
+  ih_ = inset_->hide.connect(slot(this, &FormRef::hide));
+
+  acttype_ = EDIT;
+  
+  params = inset->params();
+  showStageAction();
+}
+
+
+void FormRef::createInset( string const & arg )
+{
+  if( dialog_!=NULL ) return;
+  
+  acttype_ = INSERT;
+
+  params.setFromString( arg );
+
+  refs = lv_->buffer()->getLabelList();
+
+  if (refs.empty()) showStageError(_("*** No labels found in document ***"));
+  else showStageSelect();
+}
+
+void FormRef::showStageError(string const & mess)
+{
+  if (!dialog_)
+    {
+      using namespace Gtk::Box_Helpers;
+
+      Gtk::Alignment * alig = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
+      Gtk::Box * box = manage( new Gtk::HBox() );
+
+      b_cancel = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL) ) );
+
+      box->set_spacing(4);
+
+      box->children().push_back(Element(*manage( new Gtk::Label(mess) ), false, false));
+      box->children().push_back(Element(*manage(new Gtk::VSeparator()), false, false));
+      box->children().push_back(Element(*b_cancel, false, false));
+
+      alig->add(*box);
+
+      // packing dialog to main window
+      dialog_ = alig;
+      mainAppWin->add_action(*dialog_, N_(" Reference "));
+
+      // setting focus
+      gtk_widget_grab_focus (GTK_WIDGET(b_cancel->gtkobj()));
+
+      // connecting signals
+      b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
+      dialog_->destroy.connect(slot(this, &FormRef::free));
+
+      u_ = d_->updateBufferDependent.connect(slot(this, &FormRef::update));
+      h_ = d_->hideBufferDependent.connect(slot(this, &FormRef::hide));
+    }
+}
+      
+
+void FormRef::showStageSelect()
+{
+  if (!dialog_)
+    {
+      using namespace Gtk::Box_Helpers;
+
+      Gtk::Box * mbox = manage( new Gtk::HBox() );
+      Gtk::ButtonBox * bbox = manage( new Gtk::VButtonBox() );
+      Gtk::Alignment * alig = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
+      Gtk::ScrolledWindow * sw = manage( new Gtk::ScrolledWindow() );
+
+      // constructing CList
+      vector<string> colnames;
+      colnames.push_back("INVISIBLE");
+      list_ = manage( new Gtk::CList(colnames) );
+
+      // populating CList
+      vector<string> r;
+      vector<string>::const_iterator end = refs.end();
+      for (vector<string>::const_iterator it = refs.begin(); it != end; ++it)
+       {
+         r.clear();
+         r.push_back(*(it));
+         list_->rows().push_back(r);
+       }
+      list_->rows()[0].select(); // there is always at least one item. otherwise we go to stateError
+      
+      b_ok = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_OK) ) );
+      b_cancel = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL) ) );
+
+      // policy
+      list_->set_selection_mode(GTK_SELECTION_BROWSE); // this ensures that we have always item selected
+      list_->column_titles_hide();
+
+      sw->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+      // set up spacing
+      mbox->set_spacing(2);
+      bbox->set_spacing(4);
+
+      // pack widgets
+      sw->add(*list_);
+
+      bbox->children().push_back(Element(*b_ok, false, false));
+      bbox->children().push_back(Element(*b_cancel, false, false));
+
+      alig->add( *bbox );
+      
+      mbox->children().push_back(Element(*sw, true, true));
+      mbox->children().push_back(Element(*manage(new Gtk::VSeparator()), false, false));
+      mbox->children().push_back(Element(*alig, false, false));
+      
+      // packing dialog to main window
+      dialog_ = mbox;
+      mainAppWin->add_action(*dialog_, N_(" Reference: Select reference "), true);
+
+      // setting focus
+      GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_ok->gtkobj()), GTK_CAN_DEFAULT);
+      GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_cancel->gtkobj()), GTK_CAN_DEFAULT);
+      GTK_WIDGET_SET_FLAGS (GTK_WIDGET(list_->gtkobj()), GTK_CAN_DEFAULT);
+      gtk_widget_grab_focus (GTK_WIDGET(list_->gtkobj()));
+      gtk_widget_grab_default (GTK_WIDGET(b_ok->gtkobj()));
+
+      // connecting signals
+      b_ok->clicked.connect(slot(this, &FormRef::moveFromSelectToAction));
+      b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
+
+      dialog_->destroy.connect(slot(this, &FormRef::free));
+
+      u_ = d_->updateBufferDependent.connect(slot(this, &FormRef::update));
+      h_ = d_->hideBufferDependent.connect(slot(this, &FormRef::hide));
+    }
+}
+
+void FormRef::moveFromSelectToAction()
+{
+  params.setContents( list_->selection()[0][0].get_text() );
+
+  // moves to stage "search"
+  mainAppWin->remove_action();
+  showStageAction();
+}
+
+void FormRef::showStageAction()
+{
+  if (!dialog_)
+    {
+      using namespace Gtk::Box_Helpers;
+
+      Gtk::Table * table = manage( new Gtk::Table(2, 2, FALSE) );
+      Gtk::Box * mbox = manage( new Gtk::HBox() );
+      Gtk::ButtonBox * bbox = manage( new Gtk::HButtonBox() );
+
+      b_goto = manage(new Gnome::PixButton(GOTO_REF_LABEL, GNOME_STOCK_PIXMAP_JUMP_TO));
+      gototype_ = GOREF;
+      
+      name_ = manage( new Gnome::Entry() );
+
+      choice_ = manage( new Gtk::OptionMenu() );
+      
+      b_ok = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_OK) ) );
+      b_cancel = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL) ) );
+      
+      // set up spacing
+      table->set_row_spacings(4);
+      table->set_col_spacings(4);
+
+      mbox->set_spacing(4);
+
+      bbox->set_spacing(4);
+      bbox->set_layout(GTK_BUTTONBOX_SPREAD);
+
+      // configure entries
+      name_->set_history_id(CONF_ENTRY_NAME);
+      name_->set_max_saved(10);
+      name_->load_history();
+      name_->set_use_arrows_always(true);
+      if( lv_->buffer()->isLatex() ) name_->set_sensitive(false); // Name is irrelevant to LaTeX documents
+
+      // fill choice
+      Gtk::Menu * menu = manage( new Gtk::Menu() );
+      Gtk::MenuItem * e;
+      
+      e = manage( new Gtk::MenuItem(N_("Ref")) );
+      e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), REF));
+      e->show();
+      menu->append( *e );
+
+      e = manage( new Gtk::MenuItem(N_("Page")) );
+      e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), PAGEREF));
+      e->show();
+      menu->append( *e );
+
+      e = manage( new Gtk::MenuItem(N_("TextRef")) );
+      e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), VREF));
+      e->show();
+      menu->append( *e );
+
+      e = manage( new Gtk::MenuItem(N_("TextPage")) );
+      e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), VPAGEREF));
+      e->show();
+      menu->append( *e );
+
+      e = manage( new Gtk::MenuItem(N_("PrettyRef")) );
+      e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), PRETTYREF));
+      e->show();
+      menu->append( *e );
+
+      choice_-> set_menu ( *menu );
+
+      switch ( getType() ) {
+      case REF:        { choice_-> set_history(0); break; }
+      case PAGEREF:    { choice_-> set_history(1); break; }
+      case VREF:       { choice_-> set_history(2); break; }
+      case VPAGEREF:   { choice_-> set_history(3); break; }
+      case PRETTYREF:  { choice_-> set_history(4); break; }
+      }
+
+      changeType( getType() );
+      
+      // filling widgets with data
+      name_->get_entry()->set_text(params.getOptions());
+      
+
+      // pack widgets
+      bbox->children().push_back(Element(*b_goto, false, false));
+      bbox->children().push_back(Element(*b_ok, false, false));
+      bbox->children().push_back(Element(*b_cancel, false, false));
+      
+      table->attach( *manage( new Gtk::Label(N_("Type:")) ), 0, 1, 0, 1, 0, 0 );
+      table->attach( *manage( new Gtk::Label(N_("Name:")) ), 0, 1, 1, 2, 0, 0 );
+      table->attach( *choice_, 1, 2, 0, 1 );
+      table->attach( *name_, 1, 2, 1, 2 );
+
+      mbox->children().push_back(Element(*table, true, true));
+      mbox->children().push_back(Element(*manage( new Gtk::VSeparator() ), false, false ));
+      mbox->children().push_back(Element(*bbox, false, false));
+
+      // packing dialog to main window
+      dialog_ = mbox;
+      mainAppWin->add_action(*dialog_, string(N_(" Reference: ")) + params.getContents() + string(" "));
+
+      // setting focus
+      GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_cancel->gtkobj()), GTK_CAN_DEFAULT);
+      GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_ok->gtkobj()), GTK_CAN_DEFAULT);
+      GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_goto->gtkobj()), GTK_CAN_DEFAULT);
+      gtk_widget_grab_default (GTK_WIDGET(b_ok->gtkobj()));
+      gtk_widget_grab_focus (GTK_WIDGET(choice_->gtkobj()));
+
+      // connecting signals
+      b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
+      b_ok->clicked.connect(slot(this, &FormRef::apply));
+      b_goto->clicked.connect(slot(this, &FormRef::gotoRef));
+
+      dialog_->destroy.connect(slot(this, &FormRef::free));
+
+      u_ = d_->updateBufferDependent.connect(slot(this, &FormRef::update));
+      h_ = d_->hideBufferDependent.connect(slot(this, &FormRef::hide));
+    }
+}
+
+void FormRef::hide()
+{
+  if (dialog_!=NULL) mainAppWin->remove_action();
+}
+
+void FormRef::free()
+{
+  if (dialog_!=NULL)
+    {
+      dialog_ = NULL;
+      u_.disconnect();
+      h_.disconnect();
+      inset_ = 0;
+      ih_.disconnect();
+    }
+}
+
+void FormRef::gotoRef()
+{
+  switch (gototype_) {
+  case GOREF:
+    {
+      lv_->getLyXFunc()-> Dispatch(LFUN_REF_GOTO, params.getContents());
+
+      gototype_ = GOBACK;
+      b_goto->set_text(GOTO_BACK_LABEL);
+      break;
+    }
+  case GOBACK:
+    {
+      lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
+
+      gototype_ = GOREF;
+      b_goto->set_text(GOTO_REF_LABEL);
+      break;
+    }
+  }
+}
+
+void FormRef::apply()
+{
+  if ( lv_->buffer()->isReadonly() )
+    return;
+  
+  params.setCmdName(getName(reftype_));
+  params.setOptions(name_->get_entry()->get_text());
+  
+  if (inset_ != 0)
+    {
+      // Only update if contents have changed
+      if (params != inset_->params())
+       {
+         inset_->setParams(params);
+         lv_->view()->updateInset(inset_, true);
+       }
+    }
+  else
+    {
+      lv_->getLyXFunc()->Dispatch(LFUN_REF_INSERT,
+                                 params.getAsString());
+    }
+
+  // save configuration
+  name_->save_history();
+  
+  // hide the dialog
+  hide();
+}
+
+void FormRef::changeType(Type t)
+{
+  reftype_ = t;
+}
+
+FormRef::Type FormRef::getType() const
+{
+  Type type;
+  
+  if( params.getCmdName() == "ref" )
+    type = REF;
+  
+  else if( params.getCmdName() == "pageref" )
+    type = PAGEREF;
+  
+  else if( params.getCmdName() == "vref" )
+    type = VREF;
+  
+  else if( params.getCmdName() == "vpageref" )
+    type = VPAGEREF;
+  
+  else
+    type = PRETTYREF;
+  
+  return type;
+}
+
+
+string FormRef::getName( Type type ) const
+{
+  string name;
+  
+  switch( type ) {
+  case REF:
+    name = "ref";
+    break;
+  case PAGEREF:
+    name = "pageref";
+    break;
+  case VREF:
+    name = "vref";
+    break;
+  case VPAGEREF:
+    name = "vpageref";
+    break;
+  case PRETTYREF:
+    name = "prettyref";
+    break;
+  }
+  
+  return name;
+}
diff --git a/src/frontends/gnome/FormRef.h b/src/frontends/gnome/FormRef.h
new file mode 100644 (file)
index 0000000..e3aa8ee
--- /dev/null
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#ifndef FORMREF_H
+#define FORMREF_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "DialogBase.h"
+#include "LString.h"
+#include "boost/utility.hpp"
+#include "insets/insetcommand.h"
+
+#include <gtk--/container.h>
+#include <gtk--/clist.h>
+#include <gtk--/button.h>
+#include <gnome--/entry.h>
+#include <gtk--/optionmenu.h>
+#include <gtk--/menu.h>
+#include "pixbutton.h"
+
+/** This class provides an Gnome implementation of the FormRef Dialog.
+ */
+class FormRef : public DialogBase, public noncopyable {
+public:
+  ///
+  FormRef(LyXView *, Dialogs *);
+  ///
+  ~FormRef();
+private:
+  ///
+  enum Type{
+    ///
+    REF,
+    ///
+    PAGEREF,
+    ///
+    VREF,
+    ///
+    VPAGEREF,
+    ///
+    PRETTYREF
+  };
+  ///
+  enum Goto{
+    ///
+    GOREF,
+    ///
+    GOBACK
+  };
+  ///
+  enum ActionType {
+    ///
+    INSERT,
+    ///
+    EDIT
+  };
+
+  /// Slot launching dialog to (possibly) create a new inset
+  void createInset( string const & );
+  /// Slot launching dialog to an existing inset
+  void showInset( InsetCommand * const );
+  
+  /// Update dialog before showing it (not used in this implementation)
+  virtual void update() { hide(); }
+  /// Apply from dialog (modify or create inset)
+  virtual void apply();
+  /// Explicitly free the dialog.
+  void free();
+  /// dummy function
+  virtual void show() { }
+  /// Show selection of the references
+  void showStageSelect();
+  /// Edit properties
+  void showStageAction();
+  /// Error (no labels)
+  void showStageError(string const & mess);
+  /// Hide the dialog.
+  void hide();
+  /// Go to reference or return back
+  void gotoRef();
+  
+  /// moves from Search to Select "stage"
+  void moveFromSelectToAction();
+
+  /// changes the type of the reference
+  void changeType(Type);
+  ///
+  Type getType() const;
+  ///
+  string getName( Type type ) const;
+
+  /** 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)
+  InsetCommand * inset_;
+  /// the nitty-griity. What is modified and passed back
+  InsetCommandParams params;
+  /// Update connection.
+  Connection u_;
+  /// Hide connection.
+  Connection h_;
+  /// inset::hide connection.
+  Connection ih_;
+  /// 
+  std::vector<string> refs;
+  ///
+  Type reftype_;
+  ///
+  Goto gototype_;
+  ///
+  ActionType acttype_;
+  
+  /// Real GUI implementation.
+  Gtk::Container * dialog_;
+  Gtk::CList * list_;
+  Gtk::Button * b_ok;
+  Gtk::Button * b_cancel;
+  Gnome::Entry * name_;
+  Gtk::OptionMenu * choice_;
+  Gnome::PixButton * b_goto;
+};
+
+#endif
index 7a0c1f634aaefc609961cfe014161daae617b27c..908f4bdc279d4c558064b42dcb815a201f3420ac 100644 (file)
@@ -43,8 +43,12 @@ libgnome_la_SOURCES = \
        FormCitation.h \
        FormCopyright.C \
        FormCopyright.h \
+       FormError.C \
+       FormError.h \
        FormPrint.C \
        FormPrint.h \
+       FormRef.C \
+       FormRef.h \
        FormUrl.C \
        FormUrl.h \
        FormIndex.C \
index 1d058ca132d6e2bd938307b2e83e301ebf463b03..3afdf9371a2c86a13727499f488b6e2a57039cd5 100644 (file)
@@ -28,7 +28,7 @@ namespace Gnome
     PixButton(string label, string pixname): Button()
     {
       Gtk::Box * b = manage( new Gtk::HBox() );
-      Gtk::Label * l = manage( new Gtk::Label(label) );
+      l = manage( new Gtk::Label(label) );
       Gnome::Pixmap * p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, pixname.c_str()) ) );
 
       b->set_spacing(3);
@@ -46,8 +46,11 @@ namespace Gnome
 
     guint get_accelkey() { return accelkey_; }
 
+    void set_text(string const & newlabel) { l->set_text(newlabel); }
+
   protected:
     guint accelkey_;
+    Gtk::Label * l;
   };
 }
 
index 34958972c27ef4ede686f8d0cf728efebdfda3c4..18b44b6111d4d5340046c56ab3dd0c59d81c73ff 100644 (file)
@@ -4,8 +4,8 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
 noinst_LTLIBRARIES = libfrontendsupport.la
 LIBS =
 ETAGS_ARGS = --lang=c++
-INCLUDES = -I${srcdir}/../ $(SIGC_CFLAGS)
+INCLUDES = -I${srcdir}/../../ $(SIGC_CFLAGS)
 
 libfrontendsupport_la_SOURCES = \
        LyXImage.h \
-       LyXImage.C
+       LyXImage.C 
index 297a4de03e88814d2880895b86e37c2bb24d9b5f..1e1f8fbbb927212b985ea0a4f11fa96131b3ad4f 100644 (file)
@@ -139,7 +139,7 @@ void addpidwait(int pid)
        if (lyxerr.debugging()) {
                lyxerr << "Pids to wait for: \n";
                copy(pidwaitlist.begin(), pidwaitlist.end(),
-                    ostream_iterator<int>(lyxerr, "\n"));
+                    std::ostream_iterator<int>(lyxerr, "\n"));
                lyxerr << flush;
        }
 }
index 0132a875f69af0861854207930c33727d31ccd20..bad3b274118812ec634e630be50b5cb6c8520857 100644 (file)
@@ -30,6 +30,8 @@ using std::pair;
 using std::make_pair;
 using std::sort;
 using std::endl;
+using std::find_if;
+using std::remove_if;
 
 // Global variable: textclass table.
 LyXTextClassList textclasslist;
index 81e322dab8089bbff9f99a8f384565d3594f3891..7ad857a8e8ddff6d052afe5401078d926572635d 100644 (file)
@@ -90,7 +90,7 @@
 
 using std::pair;
 using std::endl;
-
+using std::find_if;
 
 extern void InsertAsciiFile(BufferView *, string const &, bool);
 extern void math_insert_symbol(string const &);
index 03e938bb40e6ae5277c009d0bcd54e04839f36de..2910c15807bb072f48c27d8d73265b45980b3124 100644 (file)
@@ -124,14 +124,17 @@ public:
        ///
        typedef std::vector<value_type> TextContainer;
        ///
-       typedef int size_type;
+       /* This should be TextContainer::size_type, but we need
+          signed values for now.
+       */
+       typedef TextContainer::difference_type size_type;
 
        ///
        LyXParagraph();
-       /// this konstruktor inserts the new paragraph in a list
+       /// this constructor inserts the new paragraph in a list
        explicit
        LyXParagraph(LyXParagraph * par);
-       /// the destruktors removes the new paragraph from the list
+       /// the destructor removes the new paragraph from the list
        ~LyXParagraph();
 
        ///
index b1acc90325804564599465397d88179c246e5b70..8bf6cceb935038ea055fb372756889b1ac4b5333 100644 (file)
@@ -506,7 +506,7 @@ public:
        }
        ///
        inline
-       int bidi_level(LyXParagraph::size_type pos) const {
+       LyXParagraph::size_type bidi_level(LyXParagraph::size_type pos) const {
                if (bidi_start == -1)
                        return 0;
                else