]> git.lyx.org Git - features.git/commitdiff
Few fixes for the kde frontend.
authorDekel Tsur <dekelts@tau.ac.il>
Fri, 26 Jan 2001 17:24:09 +0000 (17:24 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Fri, 26 Jan 2001 17:24:09 +0000 (17:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1405 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/frontends/kde/ChangeLog
src/frontends/kde/FormPrint.h
src/frontends/kde/FormRef.C
src/frontends/kde/FormRef.h
src/frontends/kde/dlg/lengthentry.C
src/frontends/kde/refdlg.C
src/support/ChangeLog
src/support/lyxstring.C
src/vspace.C

index 3216f9355f7750a36d18f56c25a29cb198a78856..24255bf70a5e1b105869143f2031d72f82922e68 100644 (file)
@@ -1,3 +1,7 @@
+2001-01-26  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * vspace.C (isValidLength): Fix for empty input string.
+
 2001-01-26  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * LyXAction.C (init): change description of LFUN_FIGURE to
index 1b5e5ea0ee74406bd1568eb28fa9681eae8f3093..6634b776d5ed50d33d331ac0fcca41927b3623d3 100644 (file)
@@ -1,3 +1,15 @@
+2001-01-26  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * dlg/lengthentry.C: Move the '#include <config.h>' to the top
+       (fix compilation with lyxstring).
+
+       * FormPrint.h: Fix for namespace-less compilers. 
+
+       * refdlg.C (RefDialog): Use InsetRef::types.
+
+       * FormRef.C (update, apply): Use InsetRef::getName and
+       InsetRef::getType.
+       
 2000-01-24  John Levon  <moz@compsoc.man.ac.uk>
 
        * FormParagraph.C: update readonly in correct
index 467626a2a003d6a073d4e7f531bde1af35ab2027..e87ea188805272f6bd1141e60e02cb59ccab2c59 100644 (file)
@@ -22,6 +22,10 @@ class Dialogs;
 class LyXView;
 class PrintDialog;
 
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::Connection;
+#endif
+
 class FormPrint : public DialogBase, public noncopyable {
 public: 
        /**@name Constructors and Destructors */
@@ -57,9 +61,9 @@ private:
        Dialogs * d_;
        
        /// Hide connection.
-       SigC::Connection h_;
+       Connection h_;
        /// Update connection.
-       SigC::Connection u_;
+       Connection u_;
 };
 
 #endif
index a9c66440dc69f9220d2333257ef713e046bd5173..cd53a7303b3ff676a7866a930a30eac6f105cade 100644 (file)
@@ -23,6 +23,7 @@
 #include "lyxfunc.h"
 #include "refdlg.h"
 #include "debug.h"
+#include "insets/insetref.h"
 
 #include <qtooltip.h>
 
@@ -30,7 +31,7 @@ using std::endl;
 
 FormRef::FormRef(LyXView *v, Dialogs *d)
        : dialog_(0), lv_(v), d_(d), inset_(0), h_(0), u_(0), ih_(0),
-       sort(0), gotowhere(GOTOREF), type(REF), refs(0)
+       sort(0), gotowhere(GOTOREF), refs(0)
 {
        // let the dialog be shown
        // This is a permanent connection so we won't bother
@@ -172,22 +173,8 @@ void FormRef::update(bool switched)
        dialog_->reference->setText(params.getContents().c_str());
        dialog_->refname->setText(params.getOptions().c_str());
 
-       if (params.getCmdName()=="pageref") {
-               type = PAGEREF;
-               dialog_->type->setCurrentItem(1);
-       } else if (params.getCmdName()=="vref") {
-               type = VREF;
-               dialog_->type->setCurrentItem(2);
-       } else if (params.getCmdName()=="vpageref") {
-               type = VPAGEREF;
-               dialog_->type->setCurrentItem(3);
-       } else if (params.getCmdName()=="prettyref") {
-               type = PRETTYREF;
-               dialog_->type->setCurrentItem(4);
-       } else {
-               type = REF;
-               dialog_->type->setCurrentItem(0);
-       }
+       if (inset_)
+               dialog_->type->setCurrentItem(InsetRef::getType(params.getCmdName()));
 
        dialog_->buttonGoto->setText(_("&Goto reference"));
        QToolTip::remove(dialog_->buttonGoto); 
@@ -221,26 +208,7 @@ void FormRef::apply()
        if (!lv_->view()->available())
                return;
 
-       switch (dialog_->type->currentItem()) {
-               case 0:
-                       params.setCmdName("ref");
-                       break;
-               case 1:
-                       params.setCmdName("pageref");
-                       break;
-               case 2:
-                       params.setCmdName("vref");
-                       break;
-               case 3:
-                       params.setCmdName("vpageref");
-                       break;
-               case 4:
-                       params.setCmdName("prettyref");
-                       break;
-               default:
-                       lyxerr[Debug::GUI] << "Unknown Ref Type" << endl;
-       }
-
+       params.setCmdName(InsetRef::getName(dialog_->type->currentItem()));
        params.setContents(dialog_->reference->text());
        params.setOptions(dialog_->refname->text());
 
index 9d1750ec3648819394348ca22dfcc6245107f924..12fa636b56f4c4c1b11be25da984152724946c56 100644 (file)
@@ -52,10 +52,6 @@ public:
        void close();
  
 private: 
-       enum Type {
-               REF, PAGEREF, VREF, VPAGEREF, PRETTYREF
-       }; 
-
        enum GotoType {
                GOTOREF, GOTOBACK
        };
@@ -103,9 +99,6 @@ private:
        /// where to go
        GotoType gotowhere;
  
-       /// current type
-       Type type;
        /// available references
        std::vector< string > refs;
 };
index 3135178efd70be9a85e59fc00d072447f3fd8b9c..c1be409f4f8def1a7ada50bd813d40361e608476 100644 (file)
@@ -4,6 +4,8 @@
  * John Levon, moz@compsoc.man.ac.uk
  */
 
+#include <config.h>
+
 #include "lengthentry.h"
 
 #include <qlayout.h>
@@ -11,8 +13,6 @@
 #include <qcombobox.h>
 
 #include "support/lstrings.h"
-
-#include <config.h>
 #include <gettext.h>
 
 #include "debug.h"
@@ -125,7 +125,7 @@ bool LengthEntry::setFromLengthStr(const string & str)
        string val;
 
        lyxerr[Debug::GUI] << "setFromLengthStr: " << str << endl;
-       
+
        string::size_type i = str.find_first_not_of("0123456789.,");
 
        setValue(strToDbl(str.substr(0, i)));
index 017d1d88a0c524e90bf26141fdbaaabe9c2250a5..032442f3a31e6fe71910ded5a11a85ff24993e26 100644 (file)
@@ -15,8 +15,9 @@
 
 #include <config.h>
 #include "refdlg.h"
-
 #include "dlg/helpers.h"
+#include "insets/insetref.h"
+
 
 #ifdef CXX_WORKING_NAMESPACES
 using kde_helpers::setSizeHint;
@@ -65,11 +66,8 @@ RefDialog::RefDialog(FormRef *form, QWidget *parent, const char *name, bool, WFl
        sort->setMaximumSize(sort->sizeHint());
  
        type = new QComboBox(this);
-       type->insertItem(_("Reference"));
-       type->insertItem(_("Page number"));
-       type->insertItem(_("Ref on page xxx"));
-       type->insertItem(_("on page xxx"));
-       type->insertItem(_("Pretty reference"));
+       for (int i = 0; !InsetRef::types[i].latex_name.empty(); ++i)
+               type->insertItem(_(InsetRef::types[i].gui_name.c_str()));
        setSizeHint(type);
         
        labeltype = new QLabel(this); 
index ce40df4569704f459917650f22a1cc75ead9652b..6d918d0858864b00e83fc535b38e36706cc41a26 100644 (file)
@@ -1,3 +1,7 @@
+2001-01-26  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * lyxstring.C: Fix some assertions.
+
 2001-01-23  Dekel Tsur  <dekelts@tau.ac.il>
 
        * lstrings.C (strip): Add a fix for compilers with broken
index ff25d6fba9060330e9e037e858d805578b629a7e..bc17eef026a3cc8252fabeecf664c69c4a86c7a7 100644 (file)
@@ -1046,7 +1046,7 @@ lyxstring::size_type lyxstring::rfind(value_type c, size_type i) const
 lyxstring::size_type lyxstring::find_first_of(lyxstring const & a,
                                              size_type i) const
 {
-       Assert(i < rep->sz); // OURS!
+       Assert(i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
@@ -1060,7 +1060,7 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
                                              size_type i,
                                              size_type n) const
 {
-       Assert(ptr && i < rep->sz); // OURS!
+       Assert(ptr && i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
        if (!n) return npos;
 
@@ -1074,7 +1074,7 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
 lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
                                              size_type i) const
 {
-       Assert(ptr && i < rep->sz); // OURS!
+       Assert(ptr && i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
@@ -1086,7 +1086,7 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
 
 lyxstring::size_type lyxstring::find_first_of(value_type c, size_type i) const
 {
-       Assert(i < rep->sz); // OURS!
+       Assert(i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
@@ -1158,7 +1158,7 @@ lyxstring::size_type lyxstring::find_first_not_of(lyxstring const & a,
        TestlyxstringInvariant(this);
 
        if (!rep->sz) return npos;
-       Assert(i < rep->sz);
+       Assert(i <= rep->sz);
        for (size_type t = i; t < rep->sz; ++t) {
                if (a.find(rep->s[t]) == npos) return t;
        }
@@ -1170,7 +1170,7 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
                                                  size_type i,
                                                  size_type n) const
 {
-       Assert(ptr && i < rep->sz); // OURS!
+       Assert(ptr && i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
 
        if (!n) return (i < rep->sz) ? i : npos;
@@ -1184,7 +1184,7 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
 lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
                                                  size_type i) const
 {
-       Assert(ptr && i < rep->sz); // OURS!
+       Assert(ptr && i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
@@ -1198,7 +1198,7 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type c,
                                                  size_type i) const
 {
        if (!rep->sz) return npos;
-       Assert(i < rep->sz); // OURS!
+       Assert(i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
@@ -1293,7 +1293,7 @@ lyxstring & lyxstring::replace(size_type i, size_type n, lyxstring const & x,
 lyxstring & lyxstring::replace(size_type i, size_type n,
                               value_type const * p, size_type n2)
 {
-       Assert(p && i < rep->sz); // OURS!
+       Assert(p && i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
 
        rep = rep->get_own_copy();
@@ -1304,7 +1304,7 @@ lyxstring & lyxstring::replace(size_type i, size_type n,
 
 lyxstring & lyxstring::replace(size_type i, size_type n, value_type const * p)
 {
-       Assert(p && i < rep->sz); // OURS!
+       Assert(p && i <= rep->sz); // OURS!
        TestlyxstringInvariant(this);
 
        return replace(i, min(n, rep->sz), p, (!p) ? 0 : strlen(p));
index d12ecb820a497080a57fba93f34d1ffd60d2b6c5..3c46446067bca30d7c3984ac1cbd93db4b7f183b 100644 (file)
@@ -249,6 +249,8 @@ bool isValidLength(string const & data, LyXLength * result)
        /// The parser may seem overkill for lengths without 
        /// glue, but since we already have it, using it is
        /// easier than writing something from scratch.
+       if (data.empty())
+               return true;
 
         string   buffer(data);
        int       pattern_index = 0;