]> git.lyx.org Git - features.git/commitdiff
Convert labels to unicode
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 12 Oct 2006 10:50:45 +0000 (10:50 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 12 Oct 2006 10:50:45 +0000 (10:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15305 a592a061-630c-0410-9148-cb99ea01b6c8

18 files changed:
src/BufferView.C
src/BufferView.h
src/buffer.C
src/buffer.h
src/frontends/controllers/ControlRef.C
src/frontends/controllers/ControlRef.h
src/frontends/gtk/GRef.C
src/frontends/qt3/QRef.C
src/frontends/qt3/QRef.h
src/frontends/qt4/QRef.C
src/frontends/qt4/QRef.h
src/insets/insetbase.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetlabel.C
src/insets/insetlabel.h
src/mathed/InsetMathHull.C
src/mathed/InsetMathHull.h

index fe2d180398761f216faac8325d44de291ed03cec..1a2314885c87c619b03c1f291a0879e55b03c30f 100644 (file)
@@ -765,13 +765,13 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                break;
 
        case LFUN_LABEL_GOTO: {
-               string label = lyx::to_utf8(cmd.argument());
+               docstring label = cmd.argument();
                if (label.empty()) {
                        InsetRef * inset =
                                getInsetByCode<InsetRef>(cursor_,
                                                         InsetBase::REF_CODE);
                        if (inset) {
-                               label = inset->getContents();
+                               label = lyx::from_utf8(inset->getContents());
                                savePosition(0);
                        }
                }
@@ -1148,10 +1148,10 @@ void BufferView::setCursorFromRow(int row)
 }
 
 
-void BufferView::gotoLabel(string const & label)
+void BufferView::gotoLabel(docstring const & label)
 {
        for (InsetIterator it = inset_iterator_begin(buffer_->inset()); it; ++it) {
-               vector<string> labels;
+               vector<docstring> labels;
                it->getLabelList(*buffer_, labels);
                if (find(labels.begin(),labels.end(),label) != labels.end()) {
                        setCursor(it);
index 2481c286ba771d2696d41cb0f361e33def8e83f7..9825e8fbc5cfa49bba3f9fddb309f0658180bf4e 100644 (file)
@@ -137,7 +137,7 @@ public:
        LyXText const * getLyXText() const;
 
        /// move cursor to the named label
-       void gotoLabel(std::string const & label);
+       void gotoLabel(lyx::docstring const & label);
 
        /// set the cursor based on the given TeX source row
        void setCursorFromRow(int row);
index a783755e67ba6cf0207b77a44587f14a2d19a4a6..703e54e7ea74994006a121a46b53b73fe8e8b300 100644 (file)
@@ -1150,7 +1150,7 @@ void Buffer::validate(LaTeXFeatures & features) const
 }
 
 
-void Buffer::getLabelList(vector<string> & list) const
+void Buffer::getLabelList(vector<docstring> & list) const
 {
        /// if this is a child document and the parent is already loaded
        /// Use the parent's list instead  [ale990407]
@@ -1563,7 +1563,7 @@ void Buffer::changeRefsIfUnique(string const & from, string const & to, InsetBas
        //FIXME: This does not work for child documents yet.
        BOOST_ASSERT(code == InsetBase::CITE_CODE || code == InsetBase::REF_CODE);
        // Check if the label 'from' appears more than once
-       vector<string> labels;
+       vector<docstring> labels;
 
        if (code == InsetBase::CITE_CODE) {
                vector<pair<string, string> > keys;
@@ -1572,11 +1572,13 @@ void Buffer::changeRefsIfUnique(string const & from, string const & to, InsetBas
                vector<pair<string, string> >::const_iterator bend = keys.end();
 
                for (; bit != bend; ++bit)
-                       labels.push_back(bit->first);
+                       // FIXME UNICODE
+                       labels.push_back(lyx::from_utf8(bit->first));
        } else
                getLabelList(labels);
 
-       if (lyx::count(labels.begin(), labels.end(), from) > 1)
+       // FIXME UNICODE
+       if (lyx::count(labels.begin(), labels.end(), lyx::from_utf8(from)) > 1)
                return;
 
        for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
index d6d26d302a60aefe5499e5bcfd735dbb75949620..301622f9d26ee1332974097b3a2234e361e642f3 100644 (file)
@@ -254,7 +254,7 @@ public:
        /// of loaded child documents).
        std::vector<std::string> const & getBibfilesCache() const;
        ///
-       void getLabelList(std::vector<std::string> &) const;
+       void getLabelList(std::vector<lyx::docstring> &) const;
 
        ///
        void changeLanguage(Language const * from, Language const * to);
index 37a9b33e8ce0603004ca3b7ff5619a81b24df6cb..958500d62a552771cb9cbec2c9fe2cd479d842b0 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
 
+using lyx::docstring;
+
 using std::vector;
 using std::string;
 
@@ -34,10 +36,10 @@ ControlRef::ControlRef(Dialog & d)
 {}
 
 
-vector<string> const ControlRef::getLabelList(string const & name) const
+vector<docstring> const ControlRef::getLabelList(string const & name) const
 {
        Buffer const & buf = *theBufferList().getBuffer(makeAbsPath(name));
-       vector<string> list;
+       vector<docstring> list;
        buf.getLabelList(list);
        return list;
 }
index eeefb38c4856eee59189516083473d9c4abdd577..acc93b235044e54b9c2f69d835afdd185c1f050c 100644 (file)
@@ -26,7 +26,7 @@ public:
        ///
        ControlRef(Dialog &);
        ///
-       std::vector<std::string> const getLabelList(std::string const &) const;
+       std::vector<lyx::docstring> const getLabelList(std::string const &) const;
        ///
        void gotoRef(std::string const &);
        ///
index fc062423bcd32f5c9e941ea7653e7b9960d58e33..691d34f5a5080728187be0ac31a24e5611a57db7 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <libglademm.h>
 
+using lyx::docstring;
+
 using std::string;
 using std::vector;
 
@@ -213,15 +215,15 @@ void GRef::update_labels()
                buffernum=0;
 
        string const name = controller().getBufferName(buffernum);
-       vector<string> keys = controller().getLabelList(name);
+       vector<docstring> keys = controller().getLabelList(name);
        refListStore_ = Gtk::ListStore::create(refColumns);
 
        if (!keys.empty()) {
-               vector<string>::const_iterator it = keys.begin();
-               vector<string>::const_iterator end = keys.end();
+               vector<docstring>::const_iterator it = keys.begin();
+               vector<docstring>::const_iterator end = keys.end();
                for (;it != keys.end(); ++it) {
                        Gtk::TreeModel::iterator iter =refListStore_->append();
-                       (*iter)[refColumns.name] = *it;
+                       (*iter)[refColumns.name] = lyx::to_utf8(*it);
                }
                refview_->set_sensitive(true);
        } else {
index 0b33f3b72cc6c35b88a6d1a56efa066df957efac..a444683e3b154fa6c318c3a30dd4c8b5a0b2b815 100644 (file)
@@ -29,6 +29,8 @@
 #include <qtooltip.h>
 
 
+using lyx::docstring;
+
 using std::vector;
 using std::string;
 
@@ -180,7 +182,7 @@ void QRef::redoRefs()
        // the first item inserted
        QString const tmp(dialog_->referenceED->text());
 
-       for (std::vector<string>::const_iterator iter = refs_.begin();
+       for (std::vector<docstring>::const_iterator iter = refs_.begin();
                iter != refs_.end(); ++iter) {
                dialog_->refsLB->insertItem(toqstr(*iter));
        }
index f3a79fb21ca7a3a91ddfc78a6b43049dee91d678..be0edf780a8d2b7441e6342a08866b2528dd2394 100644 (file)
@@ -71,7 +71,7 @@ private:
        int restored_buffer_;
 
        /// the references
-       std::vector<std::string> refs_;
+       std::vector<lyx::docstring> refs_;
 };
 
 } // namespace frontend
index 11984b30c44a4217a4df4cbc75adeca92b19a3fd..2dc65b6671fe08c2c4f5e5557e2925e34d3414f1 100644 (file)
@@ -29,6 +29,8 @@
 #include <QToolTip>
 
 
+using lyx::docstring;
+
 using std::vector;
 using std::string;
 
@@ -181,7 +183,7 @@ void QRef::redoRefs()
        // the first item inserted
        QString const tmp(dialog_->referenceED->text());
 
-       for (std::vector<string>::const_iterator iter = refs_.begin();
+       for (std::vector<docstring>::const_iterator iter = refs_.begin();
                iter != refs_.end(); ++iter) {
                dialog_->refsLW->addItem(toqstr(*iter));
        }
index e9848ee2fcb2b3aa13850de6f1e7c8c8e4efad5f..d48de08d55c643fb7c68d06f8bc53f984598181d 100644 (file)
@@ -74,7 +74,7 @@ private:
        int restored_buffer_;
 
        /// the references
-       std::vector<std::string> refs_;
+       std::vector<lyx::docstring> refs_;
 };
 
 } // namespace frontend
index 08232c3e4b6ea4c88972237ad5a5aa9fccd8e2ad..805248428104bd5940b9999b4b5c9269fe787999 100644 (file)
@@ -178,7 +178,7 @@ public:
        virtual void validate(LaTeXFeatures &) const {}
        /// Appends \c list with all labels found within this inset.
        virtual void getLabelList(Buffer const &,
-                                 std::vector<std::string> & /* list */) const {}
+                                 std::vector<lyx::docstring> & /* list */) const {}
 
        /// describe content if cursor inside
        virtual void infoize(std::ostream &) const {}
index a1a4da035d6ed3cefc92c6264ed38a23436e506f..e904a40a09e38f79a034ece5e0f8c48d32d85895 100644 (file)
@@ -574,7 +574,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
 
 
 void InsetInclude::getLabelList(Buffer const & buffer,
-                               std::vector<string> & list) const
+                               std::vector<docstring> & list) const
 {
        if (loadIfNeeded(buffer, params_)) {
                string const included_file = includedFilename(buffer, params_);
index c1e7649dd3d35cb506e98d061f2e7a7e3370e57f..6b911ce5630feded40487bb60456bfeac5d2bda1 100644 (file)
@@ -47,7 +47,7 @@ public:
         *  \param list the list of labels in the child buffer.
         */
        void getLabelList(Buffer const & buffer,
-                         std::vector<std::string> & list) const;
+                         std::vector<lyx::docstring> & list) const;
        /** Fills \c keys
         *  \param buffer the Buffer containing this inset.
         *  \param keys the list of bibkeys in the child buffer.
index 675bb0ace516bb0dd168cc9956d2d0d85cc976c4..8cf00afa7614e2edc6bd6e4a67e88be0239eba85 100644 (file)
@@ -45,9 +45,10 @@ std::auto_ptr<InsetBase> InsetLabel::doClone() const
 }
 
 
-void InsetLabel::getLabelList(Buffer const &, std::vector<string> & list) const
+void InsetLabel::getLabelList(Buffer const &, std::vector<docstring> & list) const
 {
-       list.push_back(getContents());
+       // FIXME UNICODE
+       list.push_back(lyx::from_utf8(getContents()));
 }
 
 
index d4ba049a31fdc81460249e2cffc4f21cceeda1fd..255f503f420dacd131cda1da46e39b77ed15e259 100644 (file)
@@ -25,7 +25,7 @@ public:
        ///
        InsetBase::Code lyxCode() const { return InsetBase::LABEL_CODE; }
        /// Appends \c list with this label
-       void getLabelList(Buffer const &, std::vector<std::string> & list) const;
+       void getLabelList(Buffer const &, std::vector<lyx::docstring> & list) const;
        ///
        int latex(Buffer const &, std::ostream &,
                  OutputParams const &) const;
index 927e533acb05bf8e683a496f5fa8cafc6612a89b..ac27c50a4802190f922fbafca1df87f16d29d000 100644 (file)
@@ -463,11 +463,12 @@ bool InsetMathHull::display() const
 }
 
 
-void InsetMathHull::getLabelList(Buffer const &, vector<string> & labels) const
+void InsetMathHull::getLabelList(Buffer const &, vector<docstring> & labels) const
 {
        for (row_type row = 0; row < nrows(); ++row)
                if (!label_[row].empty() && nonum_[row] != 1)
-                       labels.push_back(label_[row]);
+                       // FIXME UNICODE
+                       labels.push_back(lyx::from_utf8(label_[row]));
 }
 
 
index 08d1833d785d593c7f139bd93790d8e94c5dc1ec..e2db6d5910e7d7f69b3b1798cdb9552da493b2ad 100644 (file)
@@ -53,7 +53,7 @@ public:
        bool ams() const;
        /// Appends \c list with all labels found within this inset.
        void getLabelList(Buffer const &,
-                         std::vector<std::string> & list) const;
+                         std::vector<lyx::docstring> & list) const;
        ///
        void validate(LaTeXFeatures & features) const;
        /// identifies HullInset