]> git.lyx.org Git - features.git/commitdiff
controller-view split for TOC popup.
authorAngus Leeming <leeming@lyx.org>
Fri, 30 Mar 2001 19:24:28 +0000 (19:24 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 30 Mar 2001 19:24:28 +0000 (19:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1863 a592a061-630c-0410-9148-cb99ea01b6c8

17 files changed:
src/ChangeLog
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlToc.C [new file with mode: 0644]
src/frontends/controllers/ControlToc.h [new file with mode: 0644]
src/frontends/controllers/GUI.h
src/frontends/controllers/Makefile.am
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormCitation.h
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormToc.h
src/frontends/xforms/form_toc.C
src/frontends/xforms/form_toc.h
src/frontends/xforms/forms/form_toc.fd
src/lyxfunc.C

index fce7eaf50cc07f76f0ae6a02adf6cc5edd63bec4..4268394534ab0f204e86c6b1a272c6379703d681 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-30  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * lyxfunc.C (Dispatch): prevent crash in LFUN_GOTO_PARAGRAPH when
+       the LyXParagraph * is 0.
+
 2001-03-29  Juergen Vigna  <jug@sad.it>
 
        * vspace.C: added support for %, c%, p%, l%.
index d0f779f39f880e92af522cb3a594134af7ab0109..9d2c68d84963577182639d2e64ff2be6bfabf10e 100644 (file)
@@ -1,3 +1,10 @@
+2001-03-30  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * ControlToc.[Ch]: new files; a controller for the TOC popup.
+
+       * GUI.h:
+       * Makefile.am: associated changes with all of the above.
+
 2001-03-30  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * ControlExternal.C: bug fixes. Can now apply changes to the inset
diff --git a/src/frontends/controllers/ControlToc.C b/src/frontends/controllers/ControlToc.C
new file mode 100644 (file)
index 0000000..0f46bde
--- /dev/null
@@ -0,0 +1,113 @@
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlToc.C
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "ControlToc.h"
+#include "buffer.h"
+#include "Dialogs.h"
+#include "LyXView.h"
+#include "lyxfunc.h"
+#include "support/lstrings.h" // tostr
+
+using std::vector;
+using SigC::slot;
+
+ControlToc::ControlToc(LyXView & lv, Dialogs & d)
+       : ControlCommand(lv, d, LFUN_TOC_INSERT)
+{
+       d_.showTOC.connect(slot(this, &ControlToc::showInset));
+       d_.createTOC.connect(slot(this, &ControlToc::createInset));
+}
+
+
+void ControlToc::Goto(int const & id) const
+{
+       string const tmp = tostr(id);
+       lv_.getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp);
+}
+
+
+vector<string> const ControlToc::getTypes() const
+{
+       vector<string> types;
+
+       Buffer::Lists const tmp = lv_.view()->buffer()->getLists();
+
+       Buffer::Lists::const_iterator cit = tmp.begin();
+       Buffer::Lists::const_iterator end = tmp.end();
+
+       for (; cit != end; ++cit) {
+               types.push_back(cit->first.c_str());
+       }
+
+       return types;
+}
+
+
+Buffer::SingleList const ControlToc::getContents(string const & type) const
+{
+       Buffer::SingleList contents;
+       
+       Buffer::TocItem noContent(0, 0, string());
+
+       // This shouldn't be possible...
+       if (!lv_.view()->available()) {
+               noContent.str = _("*** No Document ***");
+               contents.push_back(noContent);
+               return contents;
+       }
+
+       Buffer::Lists tmp = lv_.view()->buffer()->getLists();
+
+       Buffer::Lists::iterator it = tmp.find(type);
+
+       if (it == tmp.end()) {
+               noContent.str = _("*** No Lists ***");
+               contents.push_back(noContent);
+               return contents;
+       }
+
+       return it->second;
+}
+
+
+namespace toc 
+{
+
+string getType(string const & cmdName)
+{
+       string type;
+
+       // It would be nice to have a map to extract this info.
+       // Does one already exist, Lars?
+       if (cmdName == "tableofcontents" )
+               type = "TOC";
+
+       else if (cmdName == "listofalgorithms" )
+               type = "algorithm";
+
+       else if (cmdName == "listoffigures" )
+               type = "figure";
+
+       else
+               type = "table";
+
+       return type;
+}
+} // namespace toc 
diff --git a/src/frontends/controllers/ControlToc.h b/src/frontends/controllers/ControlToc.h
new file mode 100644 (file)
index 0000000..cc06c42
--- /dev/null
@@ -0,0 +1,50 @@
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlToc.h
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#ifndef CONTROLTOC_H
+#define CONTROLTOC_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ControlCommand.h"
+#include "buffer.h" // Buffer::SingleList
+
+/** A controller for TOC dialogs.
+ */
+class ControlToc : public ControlCommand
+{
+public:
+       ///
+       ControlToc(LyXView &, Dialogs &);
+
+       /// Goto this paragraph id
+       void Goto(int const & id) const;
+
+       /// Returns a vector of list types in the document
+       std::vector<string> const getTypes() const;
+
+       /// Given a type, returns the contents
+       Buffer::SingleList const getContents(string const & type) const;
+};
+
+namespace toc 
+{
+    /** Given the cmdName of the TOC param, returns the type used
+       by ControlToc::getContents() */
+       string getType(string const & cmdName);
+
+} // namespace toc
+
+#endif // CONTROLTOC_H
index cc66e2dc58d7f249eaeb3bfbb37edcbd6b29ec69..7f95c4eb7b6a03c52184fd362c39f145de6e5559 100644 (file)
@@ -294,6 +294,20 @@ public:
 };
 
 
+/** Specialization for Toc dialog
+ */
+class ControlToc;
+
+template <class GUIview, class GUIbc>
+class GUIToc :
+       public GUI<ControlToc, GUIview, OkCancelPolicy, GUIbc> {
+public:
+       ///
+       GUIToc(LyXView & lv, Dialogs & d)
+               : GUI<ControlToc, GUIview, OkCancelPolicy, GUIbc>(lv, d) {}
+};
+
+
 /** Specialization for TabularCreate dialog
  */
 class ControlTabularCreate;
index 69636dd8d59adf8ddb0ad95e710efd9e4818319e..ec940ff01feaefc3a36a2351042479fb9b89c154 100644 (file)
@@ -65,6 +65,8 @@ libcontrollers_la_SOURCES=\
        ControlSplash.h \
        ControlTabularCreate.C \
        ControlTabularCreate.h \
+       ControlToc.C \
+       ControlToc.h \
        ControlUrl.C \
        ControlUrl.h \
        ControlVCLog.C \
index d2d8bd097a8f6117e53ef55aeebf070c05f6dc2d..f8485fb51e48ba75fe4490d6d31e29a17a204e2e 100644 (file)
@@ -1,3 +1,12 @@
+2001-03-30  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * FormMathsPanel.C (c-tor): set button controller cancel label to close.
+
+       * FormToc.[Ch]:
+       * forms/form_toc.fd: implemented controller-view split.
+
+       * Dialogs.C: associated changes.
+
 2001-03-30  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormCitation.C:
index 2783a4cc2a927545a9a9a10fd8ffaf47a3605d37..0bb03c43c0f9729241109f4e3d7372c5d3e67ae5 100644 (file)
@@ -38,6 +38,7 @@
 #include "ControlSearch.h"
 #include "ControlSplash.h"
 #include "ControlTabularCreate.h"
+#include "ControlToc.h"
 #include "ControlUrl.h"
 #include "ControlVCLog.h"
 
@@ -63,6 +64,7 @@
 #include "form_search.h"
 #include "form_splash.h"
 #include "form_tabular_create.h"
+#include "form_toc.h"
 #include "form_url.h"
 
 #include "FormBibitem.h"
@@ -84,6 +86,7 @@
 #include "FormSearch.h"
 #include "FormSplash.h"
 #include "FormTabularCreate.h"
+#include "FormToc.h"
 #include "FormUrl.h"
 #include "FormVCLog.h"
 
@@ -92,7 +95,6 @@
 #include "FormParagraph.h"
 #include "FormPreferences.h"
 #include "FormTabular.h"
-#include "FormToc.h"
 
 // Signal enabling all visible popups to be redrawn if so desired.
 // E.g., when the GUI colours have been remapped.
@@ -120,6 +122,7 @@ Dialogs::Dialogs(LyXView * lv)
        add(new GUIRef<FormRef, xformsBC>(*lv, *this));
        add(new GUISearch<FormSearch, xformsBC>(*lv, *this));
        add(new GUITabularCreate<FormTabularCreate, xformsBC>(*lv, *this));
+       add(new GUIToc<FormToc, xformsBC>(*lv, *this));
        add(new GUIUrl<FormUrl, xformsBC>(*lv, *this));
        add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
 
@@ -128,7 +131,6 @@ Dialogs::Dialogs(LyXView * lv)
        add(new FormParagraph(lv, this));
        add(new FormPreferences(lv, this));
        add(new FormTabular(lv, this));
-       add(new FormToc(lv, this));
        
        // reduce the number of connections needed in
        // dialogs by a simple connection here.
index 415387cf359405a5c76d982eb6581d1e4c61f35f..8f235a759da5f2d7700a622f4f6896d5c62f64aa 100644 (file)
@@ -3,7 +3,7 @@
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2000-2001 The LyX Team.
  *
  * ======================================================
  *
index a353636ecd2897c6c376b324ebf9934b1f71af1b..b40c33c57e9467eb9994eb35580f4f380165eb38 100644 (file)
@@ -1,13 +1,13 @@
-// -*- C++ -*-
 /* This file is part of
  * ====================================================== 
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2000-2001 The LyX Team.
  *
  * ======================================================
  *
+ * \file FormCitation.h
  * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
index a1581e7f623af191bee8cf5649e0548369186f90..0f206660f8ed31384d7f14b75319cfc817f668b3 100644 (file)
@@ -55,7 +55,7 @@ using SigC::slot;
 
 FormMathsPanel::FormMathsPanel(LyXView * lv, Dialogs * d)
        : FormBaseBD(lv, d, _("Maths Panel")),
-         active_(0)
+         active_(0), bc_("Close")
 {
        deco_.reset(  new FormMathsDeco(  lv, d, *this));
        delim_.reset( new FormMathsDelim( lv, d, *this));
@@ -263,7 +263,7 @@ void FormMathsPanel::mathDisplay() const
 
 FormMathsSub::FormMathsSub(LyXView * lv, Dialogs * d, FormMathsPanel const & p,
                           string const & t)
-       : FormBaseBD(lv, d, t), parent_(p)
+    : FormBaseBD(lv, d, t), parent_(p), bc_("Close")
 {}
 
 
index f69f633e7cc06a1768085b1806dbea118b528491..d818a0707810935803647c02fe912ca5e67317cd 100644 (file)
@@ -1,81 +1,45 @@
-// -*- C++ -*-
 /* This file is part of
  * ====================================================== 
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2000-2001 The LyX Team.
  *
  * ======================================================
+ *
+ * \file FormToc.C
+ * \author Angus Leeming, a.leeming@ic.ac.uk
  */
 
 #include <config.h>
 #include <vector>
 
-#include FORMS_H_LOCATION
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-
-#include "Dialogs.h"
+#include "xformsBC.h"
+#include "ControlToc.h"
 #include "FormToc.h"
-#include "LyXView.h"
 #include "form_toc.h"
-#include "lyxtext.h"
-#include "lyxfunc.h"
-#include "support/lstrings.h"
-
-using std::vector;
-using SigC::slot;
-
-// The current code uses the apply() for handling the Update button and the
-// type-of-table selection and cancel() for the close button.  This is a little
-// confusing to the button controller so I've made an IgnorantPolicy to cover
-// this situation since the dialog doesn't care about buttons. ARRae 20001013
-FormToc::FormToc(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Table of Contents")),
-         dialog_(0)
-{
-       // let the dialog be shown
-       // These are permanent connections so we won't bother
-       // storing a copy because we won't be disconnecting.
-       d->showTOC.connect(slot(this, &FormToc::showInset));
-       d->createTOC.connect(slot(this, &FormToc::createInset));
-}
-
+#include "helper_funcs.h" // getStringFromVector
+#include "support/lstrings.h" // frontStrip, strip
 
-FL_FORM * FormToc::form() const
-{
-       if (dialog_.get())
-               return dialog_->form;
-       return 0;
-}
 
+typedef FormCB<ControlToc, FormDB<FD_form_toc> > base_class;
 
-void FormToc::disconnect()
-{
-       toclist.clear();
-       FormCommand::disconnect();
-}
+FormToc::FormToc(ControlToc & c)
+       : base_class(c, _("Table of Contents"))
+{}
 
 
 void FormToc::build()
 {
        dialog_.reset(build_toc());
 
-#if 0
-       fl_addto_choice(dialog_->choice_toc_type,
-                       _(" TOC | LOF | LOT | LOA "));
-#else
-       Buffer::Lists const tmp = lv_->view()->buffer()->getLists();
-       Buffer::Lists::const_iterator cit = tmp.begin();
-       Buffer::Lists::const_iterator end = tmp.end();
-       for (; cit != end; ++cit) {
-               fl_addto_choice(dialog_->choice_toc_type, cit->first.c_str());
-       }
-#endif
+       string const choice =
+               " " + getStringFromVector(controller().getTypes(), " | ") + " ";
+       fl_addto_choice(dialog_->choice_toc_type, choice.c_str());
 
         // Manage the cancel/close button
        bc().setCancel(dialog_->button_cancel);
@@ -85,122 +49,65 @@ void FormToc::build()
 
 void FormToc::update()
 {
-#if 0
-       Buffer::TocType type;
+       updateType();
+       updateContents();
+}
 
-       if (params.getCmdName() == "tableofcontents" )
-               type = Buffer::TOC_TOC;
 
-       else if (params.getCmdName() == "listofalgorithms" )
-               type = Buffer::TOC_LOA;
+ButtonPolicy::SMInput FormToc::input(FL_OBJECT *, long)
+{
+       updateContents();
 
-       else if (params.getCmdName() == "listoffigures" )
-               type = Buffer::TOC_LOF;
+       unsigned int const choice = fl_get_browser( dialog_->browser_toc );
+       if (0 < choice && choice - 1 < toclist_.size()) {
+               controller().Goto(toclist_[choice-1].par->id());
+       }
 
-       else
-               type = Buffer::TOC_LOT;
-       
-       fl_set_choice( dialog_->choice_toc_type, type+1 );
-#else
-#warning Reimplement (Lgb)
-#endif
-       updateToc();
+       return ButtonPolicy::SMI_VALID;
 }
 
 
-void FormToc::updateToc()
+void FormToc::updateType()
 {
-#if 0
-       if (!lv_->view()->available()) {
-               toclist.clear();
-               fl_clear_browser( dialog_->browser_toc );
-               fl_add_browser_line( dialog_->browser_toc,
-                                    _("*** No Document ***"));
-               return;
-       }
-
-       vector<vector<Buffer::TocItem> > tmp =
-               lv_->view()->buffer()->getTocList();
-       int type = fl_get_choice( dialog_->choice_toc_type ) - 1;
-
-       // Check if all elements are the same.
-       if (toclist.size() == tmp[type].size()) {
-               unsigned int i = 0;
-               for (; i < toclist.size(); ++i) {
-                       if (toclist[i] !=  tmp[type][i])
-                               break;
+       string const type = toc::getType(controller().params().getCmdName());
+       
+       fl_set_choice(dialog_->choice_toc_type, 1);
+       for (int i = 1;
+            i <= fl_get_choice_maxitems(dialog_->choice_toc_type); ++i) {
+               string const choice =
+                       fl_get_choice_item_text(dialog_->choice_toc_type, i);
+
+               if (choice == type) {
+                       fl_set_choice(dialog_->choice_toc_type, i);
+                       break;
                }
-               if (i >= toclist.size()) return;
        }
+}
 
-       // List has changed. Update browser
-       toclist = tmp[type];
-
-       static Buffer * buffer = 0;
-       int topline = 0;
-       int line = 0;
-       if (buffer == lv_->view()->buffer()) {
-               topline = fl_get_browser_topline( dialog_->browser_toc );
-               line = fl_get_browser( dialog_->browser_toc );
-       } else
-               buffer = lv_->view()->buffer();
-
-       fl_clear_browser( dialog_->browser_toc );
-
-       for (vector<Buffer::TocItem>::const_iterator it = toclist.begin();
-            it != toclist.end(); ++it)
-               fl_add_browser_line( dialog_->browser_toc,
-                                    (string(4 * (*it).depth, ' ')
-                                     + (*it).str).c_str());
-
-       fl_set_browser_topline( dialog_->browser_toc, topline );
-       fl_select_browser_line( dialog_->browser_toc, line );
-#else
-#warning Fix Me! (Lgb)
-       if (!lv_->view()->available()) {
-               toclist.clear();
-               fl_clear_browser( dialog_->browser_toc );
-               fl_add_browser_line( dialog_->browser_toc,
-                                    _("*** No Document ***"));
-               return;
-       }
 
-       Buffer::Lists tmp = lv_->view()->buffer()->getLists();
+void FormToc::updateContents()
+{
        string const type =
-               fl_get_choice_item_text(dialog_->choice_toc_type,
-                                       fl_get_choice(dialog_->choice_toc_type));
+               frontStrip(strip(fl_get_choice_text(dialog_->choice_toc_type)));
 
-       Buffer::Lists::iterator it = tmp.find(type);
+       Buffer::SingleList const contents = controller().getContents(type);
 
-       if (it != tmp.end()) {
-               // Check if all elements are the same.
-               if (toclist == it->second) {
-                       return;
-               }
-       } else if (it == tmp.end()) {
-               toclist.clear();
-               fl_clear_browser(dialog_->browser_toc);
-               fl_add_browser_line(dialog_->browser_toc,
-                                   _("*** No Lists ***"));
+       // Check if all elements are the same.
+       if (toclist_ == contents) {
                return;
        }
        
        // List has changed. Update browser
-       toclist = it->second;
+       toclist_ = contents;
 
-       static Buffer * buffer = 0;
-       int topline = 0;
-       int line = 0;
-       if (buffer == lv_->view()->buffer()) {
-               topline = fl_get_browser_topline(dialog_->browser_toc);
-               line = fl_get_browser( dialog_->browser_toc );
-       } else
-               buffer = lv_->view()->buffer();
+       unsigned int const topline =
+               fl_get_browser_topline(dialog_->browser_toc);
+       unsigned int const line = fl_get_browser(dialog_->browser_toc);
 
-       fl_clear_browser(dialog_->browser_toc);
+       fl_clear_browser( dialog_->browser_toc );
 
-       Buffer::SingleList::const_iterator cit = toclist.begin();
-       Buffer::SingleList::const_iterator end = toclist.end();
+       Buffer::SingleList::const_iterator cit = toclist_.begin();
+       Buffer::SingleList::const_iterator end = toclist_.end();
        
        for (; cit != end; ++cit) {
                string const line = string(4 * cit->depth, ' ') + cit->str;
@@ -209,19 +116,4 @@ void FormToc::updateToc()
        
        fl_set_browser_topline(dialog_->browser_toc, topline);
        fl_select_browser_line(dialog_->browser_toc, line);
-#endif
-}
-
-bool FormToc::input(FL_OBJECT *, long)
-{
-       updateToc();
-
-       unsigned int const choice = fl_get_browser( dialog_->browser_toc );
-       if (0 < choice && choice - 1 < toclist.size()) {
-               string const tmp = tostr(toclist[choice-1].par->id());
-               lv_->getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp);
-       }
-
-       return true;
 }
index ad7ec136bf1d0eb6bfab28274798615dfefd61de..215b0c1a7a828236a85c2ee943f5b27755768f3c 100644 (file)
@@ -1,67 +1,56 @@
-// -*- C++ -*-
 /* This file is part of
  * ====================================================== 
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2000-2001 The LyX Team.
  *
  * ======================================================
+ *
+ * \file FormToc.h
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
 #ifndef FORMTOC_H
 #define FORMTOC_H
 
-#include <boost/smart_ptr.hpp>
-
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-#include "FormInset.h"
+#include "FormBase.h"
 #include "buffer.h"
 
+class ControlToc;
 struct FD_form_toc;
 
 /** This class provides an XForms implementation of the FormToc Dialog.
  */
-class FormToc : public FormCommand {
+class FormToc : public FormCB<ControlToc, FormDB<FD_form_toc> > {
 public:
        ///
-       FormToc(LyXView *, Dialogs *);
-private:
-       /// Pointer to the actual instantiation of the ButtonController.
-       virtual xformsBC & bc();
-       /// Disconnect signals. Also perform any necessary housekeeping.
-       virtual void disconnect();
+       FormToc(ControlToc &);
 
+private:
+       /// not needed
+       virtual void apply() {}
        /// Build the dialog
        virtual void build();
-       /// bool indicates if a buffer switch took place
-       virtual void updateSlot(bool) { update(); }
        /// Update dialog before showing it
        virtual void update();
        /// Filter the inputs on callback from xforms
-       virtual bool input( FL_OBJECT *, long);
-       /// Pointer to the actual instantiation of the xforms form
-       virtual FL_FORM * form() const;
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
+
        ///
-       void updateToc();
+       void updateType();
        ///
+       void updateContents();
+
+       /// Fdesign generated method
        FD_form_toc * build_toc();
 
        ///
-       Buffer::SingleList toclist;
-       /// Real GUI implementation.
-       boost::scoped_ptr<FD_form_toc> dialog_;
-       /// The ButtonController
-       ButtonController<OkCancelPolicy, xformsBC> bc_;
+       Buffer::SingleList toclist_;
 };
 
-
-inline
-xformsBC & FormToc::bc()
-{
-       return bc_;
-}
-#endif
+#endif // FORMTOC_H
index 61869625b57ddbe2736447bfdff64916654df446..46538a0e389634d05a3258ce7468c88631055a25 100644 (file)
@@ -27,7 +27,7 @@ FD_form_toc * FormToc::build_toc()
   obj = fl_add_box(FL_UP_BOX, 0, 0, 420, 340, "");
   fdui->browser_toc = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 400, 280, "");
     fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
-    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
   {
     char const * const dummy = N_("Update|#U");
     fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 300, 100, 30, idex(_(dummy)));
@@ -35,7 +35,7 @@ FD_form_toc * FormToc::build_toc()
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
   {
     char const * const dummy = N_("Type|#T");
     fdui->choice_toc_type = obj = fl_add_choice(FL_NORMAL_CHOICE, 60, 300, 130, 30, idex(_(dummy)));
@@ -43,7 +43,7 @@ FD_form_toc * FormToc::build_toc()
   }
     fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
   {
     char const * const dummy = N_("Close|^[^M");
     fdui->button_cancel = obj = fl_add_button(FL_RETURN_BUTTON, 310, 300, 100, 30, idex(_(dummy)));
@@ -51,7 +51,7 @@ FD_form_toc * FormToc::build_toc()
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0);
+    fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
   fl_end_form();
 
   fdui->form->fdui = fdui;
index 0e0780902a380c86d8db0618908295ff147ab081..38556cf0b207bec0b4b186973fac434d32972750 100644 (file)
@@ -5,8 +5,8 @@
 #define FD_form_toc_h_
 
 /** Callbacks, globals and object handlers **/
-extern  "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long);
-extern  "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
 
 
 /**** Forms and Objects ****/
index 8b38ad414e482de5a9642970c5ab0a61b32e9d31..75624447cd64ffffffec60ea0efde689dc61efbd 100644 (file)
@@ -45,7 +45,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_SouthEast
 name: browser_toc
-callback: C_FormBaseDeprecatedInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -63,7 +63,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_update
-callback: C_FormBaseDeprecatedInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -81,7 +81,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: choice_toc_type
-callback: C_FormBaseDeprecatedInputCB
+callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
@@ -99,7 +99,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_cancel
-callback: C_FormBaseDeprecatedCancelCB
+callback: C_FormBaseCancelCB
 argument: 0
 
 ==============================
index 32816df66182d0deece9b8a6060e3285d70cf47d..d1843badfca188e7d5dc1efe9cb21cbf4ac48ae9 100644 (file)
@@ -1227,6 +1227,8 @@ string const LyXFunc::Dispatch(int ac,
                int id;
                istr >> id;
                LyXParagraph * par = TEXT()->GetParFromID(id);
+               if (par == 0)
+                       break;
 
                // Set the cursor
                TEXT()->SetCursor(owner->view(), par, 0);