]> git.lyx.org Git - features.git/commitdiff
remove return arg from fullRebreak, fix last "Standards", new operaotr>> for lyxstrin...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 1 May 2002 22:17:09 +0000 (22:17 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 1 May 2002 22:17:09 +0000 (22:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4108 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/WorkArea.C
src/buffer.C
src/frontends/xforms/ChangeLog
src/insets/insetfloat.C
src/insets/insetindex.C
src/insets/insetindex.h
src/insets/insettext.C
src/lyxtext.h
src/screen.C
src/support/ChangeLog
src/support/filetools.C
src/support/lyxstring.C
src/text2.C

index 87f5e13afcc691f169550d1b3de7f9469adc73b2..5b41de1b1e806d0e0f6edd6d98c72e69c91aad2a 100644 (file)
@@ -1092,20 +1092,19 @@ void BufferView::Pimpl::update()
                screen_->update(bv_->text, bv_);
                bool fitc = false;
                while (bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
-                       if (bv_->text->fullRebreak(bv_)) {
-                               st = LyXText::NEED_MORE_REFRESH;
-                               bv_->text->setCursor(bv_, bv_->text->cursor.par(),
-                                                                        bv_->text->cursor.pos());
-                               if (bv_->text->selection.set()) {
-                                       bv_->text->setCursor(bv_, bv_->text->selection.start,
-                                                                 bv_->text->selection.start.par(),
-                                                                 bv_->text->selection.start.pos());
-                                       bv_->text->setCursor(bv_, bv_->text->selection.end,
-                                                                 bv_->text->selection.end.par(),
-                                                                 bv_->text->selection.end.pos());
-                               }
-                               fitc = true;
+                       bv_->text->fullRebreak(bv_);
+                       st = LyXText::NEED_MORE_REFRESH;
+                       bv_->text->setCursor(bv_, bv_->text->cursor.par(),
+                                            bv_->text->cursor.pos());
+                       if (bv_->text->selection.set()) {
+                               bv_->text->setCursor(bv_, bv_->text->selection.start,
+                                                    bv_->text->selection.start.par(),
+                                                    bv_->text->selection.start.pos());
+                               bv_->text->setCursor(bv_, bv_->text->selection.end,
+                                                    bv_->text->selection.end.par(),
+                                                    bv_->text->selection.end.pos());
                        }
+                       fitc = true;
                        bv_->text->status(bv_, st);
                        screen_->update(bv_->text, bv_);
                }
@@ -1655,6 +1654,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch: action["
                              << action <<"] arg[" << argument << "]" << endl;
 
+       LyXTextClass const & tclass = textclasslist[buffer_->params.textclass];
+
        switch (action) {
                // --- Misc -------------------------------------------
        case LFUN_APPENDIX:
@@ -1675,7 +1676,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                InsetCommandParams p;
                p.setCmdName("tableofcontents");
                Inset * inset = new InsetTOC(p);
-               if (!insertInset(inset, "Standard"))
+               if (!insertInset(inset, tclass.defaultLayoutName()))
                        delete inset;
                break;
        }
@@ -1802,15 +1803,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
 
                // Derive layout number from given argument (string)
                // and current buffer's textclass (number). */
-               textclass_type tclass = buffer_->params.textclass;
-               bool hasLayout =
-                       textclasslist[tclass].hasLayout(argument);
+               bool hasLayout = tclass.hasLayout(argument);
                string layout = argument;
 
                // If the entry is obsolete, use the new one instead.
                if (hasLayout) {
-                       string const & obs = textclasslist[tclass][layout]
-                               .obsoleted_by();
+                       string const & obs = tclass[layout].obsoleted_by();
                        if (!obs.empty())
                                layout = obs;
                }
@@ -2488,7 +2486,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        {
                LyXText * lt = bv_->getLyXText();
 
-               LyXLayout const & style = textclasslist[buffer_->params.textclass][lt->cursor.par()->layout()];
+               LyXLayout const & style = tclass[lt->cursor.par()->layout()];
 
                if (style.free_spacing) {
                        lt->insertChar(bv_, ' ');
@@ -3209,7 +3207,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        {
                InsetCommandParams p("printindex");
                Inset * inset = new InsetPrintIndex(p);
-               if (!insertInset(inset, "Standard"))
+               if (!insertInset(inset, tclass.defaultLayoutName()))
                        delete inset;
        }
        break;
@@ -3218,7 +3216,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        {
                InsetCommandParams p("lyxparent", argument);
                Inset * inset = new InsetParent(p, *buffer_);
-               if (!insertInset(inset, "Standard"))
+               if (!insertInset(inset, tclass.defaultLayoutName()))
                        delete inset;
        }
 
@@ -3243,7 +3241,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        case LFUN_FLOAT_LIST:
                if (floatList.typeExist(argument)) {
                        Inset * inset = new InsetFloatList(argument);
-                       if (!insertInset(inset, "Standard"))
+                       if (!insertInset(inset, tclass.defaultLayoutName()))
                                delete inset;
                } else {
                        lyxerr << "Non-existent float type: "
index 5a4b257c06474b0c1046e68138e208c8ceafb254..b5351307602db44b4b78ccf73b4c9c3d26a69850 100644 (file)
@@ -1,3 +1,19 @@
+2002-05-02  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * screen.C (drawFromTo): change sine fullRebreak always return
+       true.
+
+       * buffer.C (parseSingleLyXformat2Token): reindent some
+
+       * BufferView_pimpl.C (update): change since fullRebreak always
+       return true.
+       (Dispatch): git rid of the last hardcoded "Standard"s.
+
+2002-05-01  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * text2.[Ch] (fullRebreak): make it return void now that we always
+       returned true.
+
 2002-04-30  Juergen Vigna  <jug@sad.it>
 
        * buffer.C (parseSingleLyXformat2Token): reset the font before the
 
 2002-04-29  Dekel Tsur  <dekelts@tau.ac.il>
 
-       * buffer.C (parseSingleLyXformat2Token): Fix reading of old format 
+       * buffer.C (parseSingleLyXformat2Token): Fix reading of old format
        minipages: use col% instead of p%, and also use the current font.
        (makeLaTeXFile): Fix use babel condition.
        (parseSingleLyXformat2Token): Correct font when reading old floats.
 
 2002-04-28  Dekel Tsur  <dekelts@tau.ac.il>
 
-       * BufferView_pimpl.C (Dispatch): Check that float type exists when 
+       * BufferView_pimpl.C (Dispatch): Check that float type exists when
        inserting list of floats.
 
 2002-04-25  Herbert Voss  <voss@lyx.org>
 
 2002-04-23  Mike Ressler  <mike.ressler@alum.mit.edu>
 
-       * lyxtextclass.[Ch]: add layout keyword ProvidesNatbib. 
+       * lyxtextclass.[Ch]: add layout keyword ProvidesNatbib.
 
        * LaTeXFeatures.C: do not add \usepackage{natbib} to tex file if
        natbib is provided by the LaTeX class.
-       
+
 2002-04-23  Juergen Vigna  <jug@sad.it>
 
        * BufferView_pimpl.[Ch]: remove use of wrong and unneeded insetSleep/
        * tabular.C (OldFormatRead): check also for \\end_inset as Lars
        changed the read and substituted \\end_float with \\end_inset!
 
-       * BufferView_pimpl.C (cursorPrevious): 
+       * BufferView_pimpl.C (cursorPrevious):
        (cursorNext): fixed to make it work with rows heigher than the work
        area without moving the cursor only the draw of the row.
        (workAreaMotionNotify): fix jumping over high rows.
index 232e2e1651cf2f64688d471dcb43fdf8fb990d55..cb114c60e0ba2df45a6b1c895ca5962aaa37ad16 100644 (file)
@@ -401,6 +401,9 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                LyXLookupString(ev, dummy, 1, &keysym);
 #else
                XLookupString(xke, dummy, 1, &keysym, 0);
+//             int num_keys = XLookupString(xke, dummy, 10, &keysym, &xcs);
+//             lyxerr << "We have " << num_keys << " keys in the returned buffer" << endl;
+//             lyxerr << "Our dummy string is " << dummy << endl;
 #endif
                if (lyxerr.debugging(Debug::KEY)) {
                        char const * tmp = XKeysymToString(key);
index c3e987b9597ebc6e85322d6f43ed654ca58e6507..9f4d9ef31741177bf51c98c501c7f08b26f6d14e 100644 (file)
@@ -488,7 +488,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                font = LyXFont(LyXFont::ALL_INHERIT, params.language);
                if (file_format < 216 && params.language->lang() == "hebrew")
                        font.setLanguage(default_language);
-               
+
 #ifndef NO_COMPABILITY
                if (compare_no_case(layoutname, "latex") == 0) {
                        ert_comp.active = true;
@@ -1240,19 +1240,86 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
        // minipage. Currently I am not investing any effort
        // in fixing those cases.
 
-       //lyxerr << "Call depth: " << call_depth << endl;
+//     lyxerr << "Call depth: " << call_depth << endl;
+//     lyxerr << "Checkminipage: " << checkminipage << endl;
+
        if (checkminipage && (call_depth == 1)) {
-       checkminipage = false;
-       if (minipar && (minipar != par) &&
-           (par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE))
-       {
-               lyxerr << "minipages in a row" << endl;
-               if (par->params().pextraStartMinipage()) {
-                       lyxerr << "start new minipage" << endl;
-                       // minipages in a row
-                       par->previous()->next(0);
-                       par->previous(0);
+               checkminipage = false;
+               if (minipar && (minipar != par) &&
+                   (par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
+                       lyxerr << "minipages in a row" << endl;
+                       if (par->params().pextraStartMinipage()) {
+                               lyxerr << "start new minipage" << endl;
+                               // minipages in a row
+                               par->previous()->next(0);
+                               par->previous(0);
+
+                               Paragraph * tmp = minipar;
+                               while (tmp) {
+                                       tmp->params().pextraType(0);
+                                       tmp->params().pextraWidth(string());
+                                       tmp->params().pextraWidthp(string());
+                                       tmp->params().pextraAlignment(0);
+                                       tmp->params().pextraHfill(false);
+                                       tmp->params().pextraStartMinipage(false);
+                                       tmp = tmp->next();
+                               }
+                               // create a new paragraph to insert the
+                               // minipages in the following case
+                               if (par->params().pextraStartMinipage() &&
+                                   !par->params().pextraHfill()) {
+                                       Paragraph * p = new Paragraph;
+                                       p->layout(textclasslist[params.textclass].defaultLayoutName());
+
+                                       p->previous(parBeforeMinipage);
+                                       parBeforeMinipage->next(p);
+                                       p->next(0);
+                                       p->params().depth(parBeforeMinipage->params().depth());
+                                       parBeforeMinipage = p;
+                               }
+                               InsetMinipage * mini = new InsetMinipage(params);
+                               mini->pos(static_cast<InsetMinipage::Position>(par->params().pextraAlignment()));
+                               mini->pageWidth(LyXLength(par->params().pextraWidth()));
+                               if (!par->params().pextraWidthp().empty()) {
+                                       lyxerr << "WP:" << mini->pageWidth().asString() << endl;
+                                       mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
+                               }
+                               Paragraph * op = mini->firstParagraph();
+                               mini->inset.paragraph(par);
+                               //
+                               // and free the old ones!
+                               //
+                               while(op) {
+                                       Paragraph * pp = op->next();
+                                       delete op;
+                                       op = pp;
+                               }
+                               // Insert the minipage last in the
+                               // previous paragraph.
+                               if (par->params().pextraHfill()) {
+                                       parBeforeMinipage->insertChar
+                                               (parBeforeMinipage->size(),
+                                                Paragraph::META_HFILL, font);
+                               }
+                               parBeforeMinipage->insertInset
+                                       (parBeforeMinipage->size(), mini, font);
 
+                               minipar = par;
+                       } else {
+                               lyxerr << "new minipage par" << endl;
+                               //nothing to do just continue reading
+                       }
+
+               } else if (minipar && (minipar != par)) {
+                       lyxerr << "last minipage par read" << endl;
+                       // The last paragraph read was not part of a
+                       // minipage but the par linked list is...
+                       // So we need to remove the last par from the
+                       // rest
+                       if (par->previous())
+                               par->previous()->next(0);
+                       par->previous(parBeforeMinipage);
+                       parBeforeMinipage->next(par);
                        Paragraph * tmp = minipar;
                        while (tmp) {
                                tmp->params().pextraType(0);
@@ -1263,28 +1330,44 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                                tmp->params().pextraStartMinipage(false);
                                tmp = tmp->next();
                        }
-                       // create a new paragraph to insert the
-                       // minipages in the following case
-                       if (par->params().pextraStartMinipage() &&
-                           !par->params().pextraHfill()) {
-                               Paragraph * p = new Paragraph;
-                               p->layout(textclasslist[params.textclass].defaultLayoutName());
+                       depth = parBeforeMinipage->params().depth();
+                       // and set this depth on the par as it has not been set already
+                       par->params().depth(depth);
+                       minipar = parBeforeMinipage = 0;
+               } else if (!minipar &&
+                          (par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
+                       // par is the first paragraph in a minipage
+                       lyxerr << "begin minipage" << endl;
+                       // To minimize problems for
+                       // the users we will insert
+                       // the first minipage in
+                       // a sequence of minipages
+                       // in its own paragraph.
+                       Paragraph * p = new Paragraph;
+                       p->layout(textclasslist[params.textclass].defaultLayoutName());
+                       p->previous(par->previous());
+                       p->next(0);
+                       p->params().depth(depth);
+                       par->params().depth(0);
+                       depth = 0;
+                       if (par->previous())
+                               par->previous()->next(p);
+                       par->previous(0);
+                       parBeforeMinipage = p;
+                       minipar = par;
+                       if (!first_par || (first_par == par))
+                               first_par = p;
 
-                               p->previous(parBeforeMinipage);
-                               parBeforeMinipage->next(p);
-                               p->next(0);
-                               p->params().depth(parBeforeMinipage->params().depth());
-                               parBeforeMinipage = p;
-                       }
                        InsetMinipage * mini = new InsetMinipage(params);
-                       mini->pos(static_cast<InsetMinipage::Position>(par->params().pextraAlignment()));
-                       mini->pageWidth(LyXLength(par->params().pextraWidth()));
+                       mini->pos(static_cast<InsetMinipage::Position>(minipar->params().pextraAlignment()));
+                       mini->pageWidth(LyXLength(minipar->params().pextraWidth()));
                        if (!par->params().pextraWidthp().empty()) {
-                           lyxerr << "WP:" << mini->pageWidth().asString() << endl;
-                           mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
+                               lyxerr << "WP:" << mini->pageWidth().asString() << endl;
+                               mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
                        }
+
                        Paragraph * op = mini->firstParagraph();
-                       mini->inset.paragraph(par);
+                       mini->inset.paragraph(minipar);
                        //
                        // and free the old ones!
                        //
@@ -1293,100 +1376,17 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                                delete op;
                                op = pp;
                        }
+
                        // Insert the minipage last in the
                        // previous paragraph.
-                       if (par->params().pextraHfill()) {
+                       if (minipar->params().pextraHfill()) {
                                parBeforeMinipage->insertChar
                                        (parBeforeMinipage->size(),
                                         Paragraph::META_HFILL, font);
                        }
                        parBeforeMinipage->insertInset
                                (parBeforeMinipage->size(), mini, font);
-
-                       minipar = par;
-               } else {
-                       lyxerr << "new minipage par" << endl;
-                       //nothing to do just continue reading
-               }
-
-       } else if (minipar && (minipar != par)) {
-               lyxerr << "last minipage par read" << endl;
-               // The last paragraph read was not part of a
-               // minipage but the par linked list is...
-               // So we need to remove the last par from the
-               // rest
-               if (par->previous())
-                       par->previous()->next(0);
-               par->previous(parBeforeMinipage);
-               parBeforeMinipage->next(par);
-               Paragraph * tmp = minipar;
-               while (tmp) {
-                       tmp->params().pextraType(0);
-                       tmp->params().pextraWidth(string());
-                       tmp->params().pextraWidthp(string());
-                       tmp->params().pextraAlignment(0);
-                       tmp->params().pextraHfill(false);
-                       tmp->params().pextraStartMinipage(false);
-                       tmp = tmp->next();
-               }
-               depth = parBeforeMinipage->params().depth();
-               // and set this depth on the par as it has not been set already
-               par->params().depth(depth);
-               minipar = parBeforeMinipage = 0;
-       } else if (!minipar &&
-                  (par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE))
-       {
-               // par is the first paragraph in a minipage
-               lyxerr << "begin minipage" << endl;
-               // To minimize problems for
-               // the users we will insert
-               // the first minipage in
-               // a sequence of minipages
-               // in its own paragraph.
-               Paragraph * p = new Paragraph;
-               p->layout(textclasslist[params.textclass].defaultLayoutName());
-               p->previous(par->previous());
-               p->next(0);
-               p->params().depth(depth);
-               par->params().depth(0);
-               depth = 0;
-               if (par->previous())
-                       par->previous()->next(p);
-               par->previous(0);
-               parBeforeMinipage = p;
-               minipar = par;
-               if (!first_par || (first_par == par))
-                       first_par = p;
-
-               InsetMinipage * mini = new InsetMinipage(params);
-               mini->pos(static_cast<InsetMinipage::Position>(minipar->params().pextraAlignment()));
-               mini->pageWidth(LyXLength(minipar->params().pextraWidth()));
-               if (!par->params().pextraWidthp().empty()) {
-                   lyxerr << "WP:" << mini->pageWidth().asString() << endl;
-                   mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
-               }
-
-               Paragraph * op = mini->firstParagraph();
-               mini->inset.paragraph(minipar);
-               //
-               // and free the old ones!
-               //
-               while(op) {
-                       Paragraph * pp = op->next();
-                       delete op;
-                       op = pp;
-               }
-
-               // Insert the minipage last in the
-               // previous paragraph.
-               if (minipar->params().pextraHfill()) {
-                       parBeforeMinipage->insertChar
-                               (parBeforeMinipage->size(),
-                                Paragraph::META_HFILL, font);
-               }
-               parBeforeMinipage->insertInset
-                       (parBeforeMinipage->size(), mini, font);
-       }
+               }
        }
        // End of pextra_minipage compability
        --call_depth;
@@ -3712,7 +3712,7 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
                        string const opt = par->bibkey->getOptions();
                        string const ref = par->asString(this, false);
                        string const info = opt + "TheBibliographyRef" + ref;
-                       
+
                        keys.push_back(StringPair(key, info));
                }
                par = par->next();
index 8d8acf7ef59f826219ba19419a5b42d265456701..ce4929d3e2830c20e6aaedc4fcc017fd7a1ab632 100644 (file)
@@ -1,10 +1,10 @@
 2002-04-30  Rob Lahaye <lahaye@users.sourceforge.net>
        * FormDocument.C: "USletter" -> "US letter" etc.
-                         "Other" -> "Custom".
+                         "Other" -> "Custom".
        * FormParagraph.C: "Other" -> "Custom"
        * FormPreferences.C: "USletter" -> "US letter" etc.
        * forms/form_document.fd: 'Papersize" -> "Paper size"
-                                 style consistency
+                                 style consistency
        * forms/form_preferences.fd: style consistency
 
 2002-04-30  Angus Leeming  <a.leeming@ic.ac.uk>
@@ -34,7 +34,7 @@
 
        * FormBibtex.C:
        * FormCitation.C: fix two typos
+
 2002-04-29  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormCharacter.h:
@@ -53,7 +53,7 @@
 
        * FormMathsPanel.C: translate Close
        * FormGraphics.C: a little more translation
+
 2002-04-22  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormCitation.C (apply, input): ensure that the choice is always valid.
index 369efd9808a432713b9e474680e708dde7d4edee..862647426aeb725ed58fb89e0274ba245c087f3f 100644 (file)
@@ -109,7 +109,7 @@ string floatname(string const & type)
 
        return _(it->second.name());
 }
+
 } // namespace anon
 
 
index 7c220fb782ae7d23c407295f7247187ebf396bd4..1e673e71ec8eae643ce69a22388fb36e8fd1c69a 100644 (file)
@@ -39,8 +39,9 @@ void InsetIndex::edit(BufferView * bv, bool)
 
 int InsetIndex::docbook(Buffer const *, ostream & os) const
 {
-  os << "<indexterm><primary>" << getContents() << "</primary></indexterm>";
-  return 0;
+       os << "<indexterm><primary>" << getContents()
+          << "</primary></indexterm>";
+       return 0;
 }
 
 
@@ -54,6 +55,7 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
        : InsetCommand(p)
 {}
 
+
 string const InsetPrintIndex::getScreenLabel(Buffer const *) const
 {
        return _("Index");
index ec68765ac03b271b0fe11414cd76c3312274cbdd..88c76bab6b3538e196082236615450a688f9e4c1 100644 (file)
@@ -60,13 +60,15 @@ public:
        ///
        void edit(BufferView *, bool = true) {}
        ///
-       EDITABLE editable() const{ return NOT_EDITABLE; }
+       EDITABLE editable() const { return NOT_EDITABLE; }
        ///
        bool display() const { return true; }
        ///
        Inset::Code lyxCode() const;
        ///
        string const getScreenLabel(Buffer const *) const;
+       ///
+       virtual bool needFullRow() const { return true; }
 };
 
 #endif
index ba60be164b679c1a86213e7fcc44320e15d2c63d..c4062bdba881a83ec654e4b534fedb05db367e3a 100644 (file)
@@ -463,20 +463,20 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                int yf = y_offset + first;
                y = 0;
                while ((row != 0) && (yf < ph)) {
-                       lt->getVisibleRow(bv, y+y_offset+first, int(x), row,
-                                               y+lt->first_y, cleared);
+                       lt->getVisibleRow(bv, y + y_offset + first, int(x),
+                                         row, y + lt->first_y, cleared);
                        if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
                                lt->need_break_row = row;
-                               if (lt->fullRebreak(bv)) {
-                                       lt->setCursor(bv, lt->cursor.par(),lt->cursor.pos());
-                                       if (lt->selection.set()) {
-                                               lt->setCursor(bv, lt->selection.start,
-                                                                         lt->selection.start.par(),
-                                                                         lt->selection.start.pos());
-                                               lt->setCursor(bv, lt->selection.end,
-                                                                         lt->selection.end.par(),
-                                                                         lt->selection.end.pos());
-                                       }
+                               lt->fullRebreak(bv);
+                               lt->setCursor(bv, lt->cursor.par(),
+                                             lt->cursor.pos());
+                               if (lt->selection.set()) {
+                                       lt->setCursor(bv, lt->selection.start,
+                                                     lt->selection.start.par(),
+                                                     lt->selection.start.pos());
+                                       lt->setCursor(bv, lt->selection.end,
+                                                     lt->selection.end.par(),
+                                                     lt->selection.end.pos());
                                }
                                break;
                        }
index 62247add0ac8dc1451a814e66f7a1771fb4f1e89..da5e852beb77470adb0de0394c9e490ef6509c22 100644 (file)
@@ -177,9 +177,8 @@ public:
        ///
        void insertInset(BufferView *, Inset * inset);
 
-       /** Completes the insertion with a full rebreak.
-           Returns true if something was broken. */
-       bool fullRebreak(BufferView *);
+       /** Completes the insertion with a full rebreak. */
+       void fullRebreak(BufferView *);
 
        ///
        mutable Row * need_break_row;
index 83c19bc19a7a471c2d3bafffeb827ab0a4da7daf..9db572309eab25f8f5ff08104b9dd3f2fdc505c5 100644 (file)
@@ -130,10 +130,10 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
                                    x_offset, row, y + text->first_y);
                internal = internal && (st != LyXText::CHANGED_IN_DRAW);
                while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
-                       if (text->fullRebreak(bv)) {
-                               st = LyXText::NEED_MORE_REFRESH;
-                               text->setCursor(bv, text->cursor.par(), text->cursor.pos());
-                       }
+                       text->fullRebreak(bv);
+                       st = LyXText::NEED_MORE_REFRESH;
+                       text->setCursor(bv, text->cursor.par(),
+                                       text->cursor.pos());
                        text->status(bv, st);
                        text->getVisibleRow(bv, y + y_offset,
                                            x_offset, row, y + text->first_y);
index b04d48b26c6be2c065af79bb8d320c62f4d95c44..26c96af68ea804a0c4a2d184f9c6f8369425581b 100644 (file)
@@ -1,3 +1,7 @@
+2002-05-02  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * lyxstring.C (operator>>): try a new version of the operator>>
+
 2002-04-14  Herbert Voss  <voss@perce.de>
 
        * lstrings.[Ch]: move the getVectorFromString and the vice versa
@@ -11,7 +15,7 @@
 
 2002-04-08  Herbert Voss  <voss@perce.de>
 
-       * filetools.C (getExtFromContents): get tgif run 
+       * filetools.C (getExtFromContents): get tgif run
 
 2002-04-08  Angus Leeming  <a.leeming@ic.ac.uk>
 
index 9cae0881615eebcd818588d250b8f904416f2952..98272b0e0e6ce333fc5cbcad83ce7b60d5830a2c 100644 (file)
@@ -1043,7 +1043,7 @@ string const getExtFromContents(string const & filename)
                        break;
                }
 
-               std::getline(ifs, str);
+               getline(ifs, str);
                lyxerr[Debug::GRAPHICS] << "Scanstring: " << str << endl;
 
                string const stamp = str.substr(0,2);
@@ -1103,7 +1103,7 @@ string const getExtFromContents(string const & filename)
                                        format =  "xwd";
                                }
                        }
-                       
+
                        firstLine = false;
                }
 
@@ -1362,7 +1362,7 @@ string const readBB_from_PSFile(string const & file)
        // end of the file. Than we have in the header:
        // %%BoundingBox: (atend)
        // In this case we must check the end.
-       string const file_ = zippedFile(file) ? 
+       string const file_ = zippedFile(file) ?
                string(unzipFile(file)) : string(file);
        string const format = getExtFromContents(file_);
        if (format != "eps" && format != "ps")
@@ -1371,10 +1371,9 @@ string const readBB_from_PSFile(string const & file)
        std::ifstream is(file_.c_str());
        while (is) {
                string s;
-               std::getline(is,s);
-               if (contains(s,"%%BoundingBox:") && !contains(s,"atend")) 
+               getline(is,s);
+               if (contains(s,"%%BoundingBox:") && !contains(s,"atend"))
                        return (frontStrip(s.substr(14)));
        }
        return string();
 }
-
index 621239d640f9a0514ffe3188c58c51985ff278c4..150b6f8162d1feb0a8eafe88f1d9e37964d0be3e 100644 (file)
@@ -1732,16 +1732,9 @@ void swap(lyxstring & str1, lyxstring & str2)
 
 #include <iostream>
 
+#if 0
 istream & operator>>(istream & is, lyxstring & s)
 {
-#if 0
-       // very bad solution
-       char * nome = new char[1024];
-       is >> nome;
-       lyxstring tmp(nome);
-       delete [] nome;
-       if (!tmp.empty()) s = tmp;
-#else
        // better solution
        int w = is.width(0);
        s.clear();
@@ -1752,9 +1745,44 @@ istream & operator>>(istream & is, lyxstring & s)
                if (--w == 1) break;
        }
        if (s.empty()) is.setstate(std::ios::failbit);
-#endif
        return is;
 }
+#else
+istream & operator>>(istream & is, lyxstring & str)
+{
+       typedef istream            istream_type;
+       typedef int         int_type;
+       typedef std::streambuf streambuf_type;
+       typedef string     string_type;
+       typedef string::size_type         size_type;
+       size_type extracted = 0;
+
+//     istream_type::sentry cerb(is, false);
+//     if (cerb) {
+               str.erase();
+               std::streamsize w = is.width();
+               size_type n;
+               n = w > 0 ? static_cast<size_type>(w) : str.max_size();
+
+               int_type const eof = EOF;
+               streambuf_type * sb = is.rdbuf();
+               int_type c = sb->sgetc();
+
+               while (extracted < n
+                      && c != eof && !isspace(c)) {
+                       str += c;
+                       ++extracted;
+                       c = sb->snextc();
+               }
+               if (c == eof)
+                       is.setstate(std::ios::eofbit);
+               is.width(0);
+//     }
+       if (!extracted)
+               is.setstate(std::ios::failbit);
+       return is;
+}
+#endif
 
 
 ostream & operator<<(ostream & o, lyxstring const & s)
index 7853e655051189b6bf89f45456719b55bc88907c..71f861cc8124604459edc73a46d7ce14f1f9cda5 100644 (file)
@@ -900,18 +900,17 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
 }
 
 
-bool LyXText::fullRebreak(BufferView * bview)
+void LyXText::fullRebreak(BufferView * bview)
 {
        if (!firstrow) {
                init(bview);
-               return true;
+               return;
        }
        if (need_break_row) {
                breakAgain(bview, need_break_row);
                need_break_row = 0;
-               return true;
+               return;
        }
-       return true;
 }