]> git.lyx.org Git - features.git/commitdiff
parlist-16-a.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 22 May 2003 10:47:31 +0000 (10:47 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 22 May 2003 10:47:31 +0000 (10:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6999 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/ChangeLog
src/insets/ChangeLog
src/insets/insetfloat.C
src/lyx_cb.C
src/rowpainter.C
src/support/ChangeLog
src/support/lstrings.C
src/support/lstrings.h
src/tabular.C

index fc1ac3a97ea110087fc9dbf59f67bd016a17aa29..b5dc13b8a733461af0f671f1bba8a915ff84d74f 100644 (file)
@@ -764,10 +764,9 @@ bool BufferView::ChangeInsets(Inset::Code code,
        ParIterator end = buffer()->par_iterator_end();
        for (ParIterator it = buffer()->par_iterator_begin();
             it != end; ++it) {
-               Paragraph * par = &*(*it);
                bool changed_inset = false;
-               for (InsetList::iterator it2 = par->insetlist.begin();
-                    it2 != par->insetlist.end(); ++it2) {
+               for (InsetList::iterator it2 = it->insetlist.begin();
+                    it2 != it->insetlist.end(); ++it2) {
                        if (it2.getInset()->lyxCode() == code) {
                                InsetCommand * inset = static_cast<InsetCommand *>(it2.getInset());
                                if (inset->getContents() == from) {
@@ -784,7 +783,7 @@ bool BufferView::ChangeInsets(Inset::Code code,
                        // The test it.size()==1 was needed to prevent crashes.
                        // How to set the cursor corretly when it.size()>1 ??
                        if (it.size() == 1) {
-                               text->setCursorIntern(par, 0);
+                               text->setCursorIntern(*it, 0);
                                text->redoParagraphs(text->cursor,
                                                     boost::next(text->cursor.par()));
                                text->fullRebreak();
index 314498edae2208ceecf46d1768aa0b80eb9f9bb9..a95d555b6b9d08957c83de6a9c669df55a6f321a 100644 (file)
@@ -1,3 +1,13 @@
+2003-05-22  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * tabular.C (SetMultiColumn): ws changes
+
+       * rowpainter.C (paintFirst): get rid of a ->previous
+
+       * lyx_cb.C (getPossibleLabel): parlist simplification
+
+       * BufferView.C (ChangeInsets): simplify slightly.
+
 2003-05-20  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * LyXAction.C: new lfun space-insert, kill protected-space-insert
@@ -11,7 +21,7 @@
 
        * BufferView.C:
        * BufferView_pimpl.C:
-       * buffer.[Ch]:  
+       * buffer.[Ch]:
        * lyxfunc.C:
        * undo_funcs.C: return a ParIterator from getParFromID.
 
index d6ac8879c9d606313c262734588f0a9bf53a730b..74bff0e640e22aefbf6d748c8f2377687bc9665c 100644 (file)
@@ -1,3 +1,7 @@
+2003-05-22  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * insetfloat.C (addToToc): parlist simplfication
+
 2003-05-20  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * insetspace.[Ch]: added (new space insets)
index d987fc3ec84463959c2c291e1894706bfc6ce643..7c164979a50f4fa3d838fdab20450524cc26a35c 100644 (file)
@@ -365,16 +365,14 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
        ParIterator pit(inset.paragraphs.begin(), inset.paragraphs);
        ParIterator end(inset.paragraphs.end(), inset.paragraphs);
 
-       // Find a caption layout in one of the (child inset's) pars
+a      // Find a caption layout in one of the (child inset's) pars
        for (; pit != end; ++pit) {
-               Paragraph * tmp = &*(*pit);
-
-               if (tmp->layout()->name() == caplayout) {
+               if (pit->layout()->name() == caplayout) {
                        string const name = floatname(params_.type, buf->params);
                        string const str =
                                tostr(toclist[name].size() + 1)
-                               + ". " + tmp->asString(buf, false);
-                       toc::TocItem const item(tmp->id(), 0 , str);
+                               + ". " + pit->asString(buf, false);
+                       toc::TocItem const item(pit->id(), 0 , str);
                        toclist[name].push_back(item);
                }
        }
index 63e7aa4a9b24f43dad330ea68bbb9d49efe1d943..56caaafc3e0d4b80239c5d921a74f7bd4fa49121 100644 (file)
@@ -420,15 +420,18 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
 
 string const getPossibleLabel(BufferView const & bv)
 {
-       Paragraph * par = &*bv.getLyXText()->cursor.par();
-       LyXLayout_ptr layout = par->layout();
-       if (layout->latextype == LATEX_PARAGRAPH && par->previous()) {
-               Paragraph * par2 = par->previous();
+       ParagraphList::iterator pit = bv.getLyXText()->cursor.par();
+       ParagraphList & plist = bv.getLyXText()->ownerParagraphs();
 
-               LyXLayout_ptr const & layout2 = par2->layout();
+       LyXLayout_ptr layout = pit->layout();
+
+       if (layout->latextype == LATEX_PARAGRAPH && pit != plist.begin()) {
+               ParagraphList::iterator pit2 = boost::prior(pit);
+
+               LyXLayout_ptr const & layout2 = pit2->layout();
 
                if (layout2->latextype != LATEX_PARAGRAPH) {
-                       par = par2;
+                       pit = pit2;
                        layout = layout2;
                }
        }
@@ -442,7 +445,7 @@ string const getPossibleLabel(BufferView const & bv)
            lyxrc.label_init_length < 0)
                text.erase();
 
-       string par_text = par->asString(bv.buffer(), false);
+       string par_text = pit->asString(bv.buffer(), false);
        for (int i = 0; i < lyxrc.label_init_length; ++i) {
                if (par_text.empty())
                        break;
index 78d2f6545f01eaeb0f88c07c39d2abba5634887e..8a738fdc412bb009f37fd53dbcac2661e798fc4e 100644 (file)
@@ -634,7 +634,7 @@ void RowPainter::paintFirst()
        LyXLayout_ptr const & layout = pit_->layout();
 
        if (buffer->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
-               if (pit_->previous()) {
+               if (pit_ != text_.ownerParagraphs().begin()) {
                        if (layout->latextype == LATEX_PARAGRAPH
                                && !pit_->getDepth()) {
                                y_top += buffer->params.getDefSkip().inPixels(bv_);
index 738e6c8d304993dad19df7276b2781e4fd50602f..72e33c3073ea091e810fb30772fcb75711eb486c 100644 (file)
@@ -1,3 +1,7 @@
+2003-05-22  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * lstrings.[Ch] (prefixIs,suffixIs,subst): remove variants taking
+       char const *.
 
 2003-05-19  André Pönitz  <poenitz@gmx.net>
 
@@ -21,7 +25,7 @@
 2003-05-12  André Pönitz  <poenitz@gmx.net>
 
        * lstrings.[Ch]: bformat() as wrapper around boost::format
-       
+
        * lyxstring.h: enable templatized constructor
 
 2003-05-06  Lars Gullik Bjønnes  <larsbj@gullik.net>
index 29766f641e10ecd9318df57974fe40e7ae857e28..1a047933fe78e134c0637ca571f7f081084cad95 100644 (file)
@@ -280,30 +280,6 @@ string const ascii_lowercase(string const & a)
 }
 
 
-bool prefixIs(string const & a, char const * pre)
-{
-       lyx::Assert(pre);
-
-       size_t const l = strlen(pre);
-       string::size_type const alen = a.length();
-
-       if (l > alen || a.empty())
-               return false;
-       else {
-#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
-               // Delete this code when the compilers get a bit better.
-               return ::strncmp(a.c_str(), pre, l) == 0;
-#else
-               // This is the code that we really want to use
-               // but until gcc ships with a basic_string that
-               // implements std::string correctly we have to
-               // use the code above.
-               return a.compare(0, l, pre, l) == 0;
-#endif
-       }
-}
-
-
 bool prefixIs(string const & a, string const & pre)
 {
        string::size_type const prelen = pre.length();
@@ -328,31 +304,6 @@ bool suffixIs(string const & a, char c)
 }
 
 
-bool suffixIs(string const & a, char const * suf)
-{
-       lyx::Assert(suf);
-
-       size_t const suflen = strlen(suf);
-       string::size_type const alen = a.length();
-
-       if (suflen > alen)
-               return false;
-       else {
-#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
-               // Delete this code when the compilers get a bit better.
-               string tmp(a, alen - suflen);
-               return ::strncmp(tmp.c_str(), suf, suflen) == 0;
-#else
-               // This is the code that we really want to use
-               // but until gcc ships with a basic_string that
-               // implements std::string correctly we have to
-               // use the code above.
-               return a.compare(alen - suflen, suflen, suf) == 0;
-#endif
-       }
-}
-
-
 bool suffixIs(string const & a, string const & suf)
 {
        string::size_type const suflen = suf.length();
@@ -462,23 +413,6 @@ string const subst(string const & a, char oldchar, char newchar)
 }
 
 
-string const subst(string const & a,
-                  char const * oldstr, string const & newstr)
-{
-       lyx::Assert(oldstr);
-
-       string lstr(a);
-       string::size_type i = 0;
-       string::size_type olen = strlen(oldstr);
-       while ((i = lstr.find(oldstr, i)) != string::npos) {
-               lstr.replace(i, olen, newstr);
-               i += newstr.length(); // We need to be sure that we dont
-               // use the same i over and over again.
-       }
-       return lstr;
-}
-
-
 string const subst(string const & a,
                   string const & oldstr, string const & newstr)
 {
@@ -704,7 +638,7 @@ string bformat(string const & fmt, string const & arg1, string const & arg2,
                % STRCONV(arg3) % STRCONV(arg4)).str());
 }
 
-#else 
+#else
 
 string bformat(string const & fmt, string const & arg1)
 {
index 71ab15cfbad7e265f2cb33015645640a14955c10..771cba3d6fb3307f29eb412a983330ce9a3b3ac3 100644 (file)
@@ -84,18 +84,12 @@ string const lowercase(string const &);
 ///
 string const uppercase(string const &);
 
-/// Does the string start with this prefix?
-bool prefixIs(string const &, char const *);
-
 /// Does the string start with this prefix?
 bool prefixIs(string const &, string const &);
 
 /// Does the string end with this char?
 bool suffixIs(string const &, char);
 
-/// Does the string end with this suffix?
-bool suffixIs(string const &, char const *);
-
 /// Does the string end with this suffix?
 bool suffixIs(string const &, string const &);
 
@@ -152,10 +146,6 @@ bool regexMatch(string const & a, string const & pattern);
 /// Substitute all \a oldchar with \a newchar
 string const subst(string const & a, char oldchar, char newchar);
 
-/// Substitutes all instances of \a oldstr with \a newstr
-string const subst(string const & a,
-            char const * oldstr, string const & newstr);
-
 /// substitutes all instances of \a oldstr with \a newstr
 string const subst(string const & a,
                   string const & oldstr, string const & newstr);
index 91a51ecca38ef997b4a3d3e5bd7b5c21a1c03fde..1a51d8ee18d72b45e6a8100f79e946806ec5d43f 100644 (file)
@@ -1337,14 +1337,14 @@ void LyXTabular::SetMultiColumn(Buffer * buffer, int cell, int number)
        cellinfo_of_cell(cell)->right_line = column_info[column_of_cell(cell+number-1)].right_line;
 #if 1
        for (int i = 1; i < number; ++i) {
-               cellinfo_of_cell(cell+i)->multicolumn = CELL_PART_OF_MULTICOLUMN;
+               cellinfo_of_cell(cell + i)->multicolumn = CELL_PART_OF_MULTICOLUMN;
                cellinfo_of_cell(cell)->inset.appendParagraphs(buffer,
                        cellinfo_of_cell(cell+i)->inset.paragraphs);
-               cellinfo_of_cell(cell+i)->inset.clear(false);
+               cellinfo_of_cell(cell + i)->inset.clear(false);
        }
 #else
        for (number--; number > 0; --number) {
-               cellinfo_of_cell(cell+number)->multicolumn = CELL_PART_OF_MULTICOLUMN;
+               cellinfo_of_cell(cell + number)->multicolumn = CELL_PART_OF_MULTICOLUMN;
        }
 #endif
        set_row_column_number_info();