]> git.lyx.org Git - features.git/commitdiff
fix some buggy constructs with stringstream
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 14 Jun 2001 17:58:49 +0000 (17:58 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 14 Jun 2001 17:58:49 +0000 (17:58 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2127 a592a061-630c-0410-9148-cb99ea01b6c8

po/POTFILES.in
src/BufferView_pimpl.C
src/ChangeLog
src/Chktex.C
src/LaTeX.C
src/bufferview_funcs.C
src/importer.C
src/lyx_main.C
src/lyxfunc.C

index 55116f108364fddb3d945acb3b8d139eb80db3f2..53c323e68cbdc6e5eaf0f6424b13199f2eae1389 100644 (file)
@@ -10,8 +10,8 @@ src/CutAndPaste.C
 src/debug.C
 src/exporter.C
 src/ext_l10n.h
-src/figureForm.C
 src/figure_form.C
+src/figureForm.C
 src/FontLoader.C
 src/frontends/controllers/ButtonController.h
 src/frontends/controllers/character.C
@@ -89,67 +89,67 @@ src/frontends/qt2/paragraphdlgimpl.C
 src/frontends/qt2/tabularcreatedlgimpl.C
 src/frontends/xforms/combox.C
 src/frontends/xforms/FileDialog.C
-src/frontends/xforms/FormBibitem.C
 src/frontends/xforms/form_bibitem.C
-src/frontends/xforms/FormBibtex.C
+src/frontends/xforms/FormBibitem.C
 src/frontends/xforms/form_bibtex.C
+src/frontends/xforms/FormBibtex.C
 src/frontends/xforms/form_browser.C
-src/frontends/xforms/FormCharacter.C
 src/frontends/xforms/form_character.C
-src/frontends/xforms/FormCitation.C
+src/frontends/xforms/FormCharacter.C
 src/frontends/xforms/form_citation.C
-src/frontends/xforms/FormCopyright.C
+src/frontends/xforms/FormCitation.C
 src/frontends/xforms/form_copyright.C
-src/frontends/xforms/FormCredits.C
+src/frontends/xforms/FormCopyright.C
 src/frontends/xforms/form_credits.C
-src/frontends/xforms/FormDocument.C
+src/frontends/xforms/FormCredits.C
 src/frontends/xforms/form_document.C
-src/frontends/xforms/FormError.C
+src/frontends/xforms/FormDocument.C
 src/frontends/xforms/form_error.C
-src/frontends/xforms/FormExternal.C
+src/frontends/xforms/FormError.C
 src/frontends/xforms/form_external.C
-src/frontends/xforms/FormFiledialog.C
+src/frontends/xforms/FormExternal.C
 src/frontends/xforms/form_filedialog.C
-src/frontends/xforms/FormGraphics.C
+src/frontends/xforms/FormFiledialog.C
 src/frontends/xforms/form_graphics.C
-src/frontends/xforms/FormInclude.C
+src/frontends/xforms/FormGraphics.C
 src/frontends/xforms/form_include.C
-src/frontends/xforms/FormIndex.C
+src/frontends/xforms/FormInclude.C
 src/frontends/xforms/form_index.C
+src/frontends/xforms/FormIndex.C
 src/frontends/xforms/FormLog.C
 src/frontends/xforms/FormMathsBitmap.C
-src/frontends/xforms/FormMathsDeco.C
 src/frontends/xforms/form_maths_deco.C
-src/frontends/xforms/FormMathsDelim.C
+src/frontends/xforms/FormMathsDeco.C
 src/frontends/xforms/form_maths_delim.C
-src/frontends/xforms/FormMathsMatrix.C
+src/frontends/xforms/FormMathsDelim.C
 src/frontends/xforms/form_maths_matrix.C
-src/frontends/xforms/FormMathsPanel.C
+src/frontends/xforms/FormMathsMatrix.C
 src/frontends/xforms/form_maths_panel.C
-src/frontends/xforms/FormMathsSpace.C
+src/frontends/xforms/FormMathsPanel.C
 src/frontends/xforms/form_maths_space.C
-src/frontends/xforms/FormMinipage.C
+src/frontends/xforms/FormMathsSpace.C
 src/frontends/xforms/form_minipage.C
-src/frontends/xforms/FormParagraph.C
+src/frontends/xforms/FormMinipage.C
 src/frontends/xforms/form_paragraph.C
-src/frontends/xforms/FormPreamble.C
+src/frontends/xforms/FormParagraph.C
 src/frontends/xforms/form_preamble.C
-src/frontends/xforms/FormPreferences.C
+src/frontends/xforms/FormPreamble.C
 src/frontends/xforms/form_preferences.C
-src/frontends/xforms/FormPrint.C
+src/frontends/xforms/FormPreferences.C
 src/frontends/xforms/form_print.C
-src/frontends/xforms/FormRef.C
+src/frontends/xforms/FormPrint.C
 src/frontends/xforms/form_ref.C
-src/frontends/xforms/FormSearch.C
+src/frontends/xforms/FormRef.C
 src/frontends/xforms/form_search.C
-src/frontends/xforms/FormTabular.C
+src/frontends/xforms/FormSearch.C
 src/frontends/xforms/form_tabular.C
-src/frontends/xforms/FormTabularCreate.C
+src/frontends/xforms/FormTabular.C
 src/frontends/xforms/form_tabular_create.C
-src/frontends/xforms/FormToc.C
+src/frontends/xforms/FormTabularCreate.C
 src/frontends/xforms/form_toc.C
-src/frontends/xforms/FormUrl.C
+src/frontends/xforms/FormToc.C
 src/frontends/xforms/form_url.C
+src/frontends/xforms/FormUrl.C
 src/frontends/xforms/FormVCLog.C
 src/frontends/xforms/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
index d3278201ed32d7298a49caf1deb112d3e17eb5bd..52d01f62ce0c798c6d300cb1b932298c1d5db2ec 100644 (file)
@@ -1122,8 +1122,9 @@ void BufferView::Pimpl::savePosition(unsigned int i)
                                      bv_->text->cursor.par()->id(),
                                      bv_->text->cursor.pos());
        if (i > 0) {
-               string const str = _("Saved bookmark") + ' ' + tostr(i);
-               owner_->message(str);
+               ostringstream str;
+               str << _("Saved bookmark") << ' ' << i;
+               owner_->message(str.str().c_str());
        }
 }
 
@@ -1153,8 +1154,9 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
 
        update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
        if (i > 0) {
-               string const str = _("Moved to bookmark") + ' ' + tostr(i);
-               owner_->message(str);
+               ostringstream str;
+               str << _("Moved to bookmark") << ' ' << i;
+               owner_->message(str.str().c_str());
        }
 }
 
@@ -1390,19 +1392,24 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
        if (!IsLyXFilename(filename))
                filename += ".lyx";
 
+       string const disp_fn(MakeDisplayPath(filename));
+       
        // Inserts document
-       string const s1 = _("Inserting document") + ' '
-               + MakeDisplayPath(filename) + " ...";
-       owner_->message(s1);
+       ostringstream s1;
+       s1 << _("Inserting document") << ' '
+          << disp_fn << " ...";
+       owner_->message(s1.str().c_str());
        bool const res = bv_->insertLyXFile(filename);
        if (res) {
-               string const str = _("Document") + ' '
-                       + MakeDisplayPath(filename) + ' ' + _("inserted.");
-               owner_->message(str);
+               ostringstream str;
+               str << _("Document") << ' ' << disp_fn
+                   << ' ' << _("inserted.");
+               owner_->message(str.str().c_str());
        } else {
-               string const str = _("Could not insert document") + ' '
-                       + MakeDisplayPath(filename);
-               owner_->message(str);
+               ostringstream str;
+               str << _("Could not insert document") << ' '
+                   << disp_fn;
+               owner_->message(str.str().c_str());
        }
 }
 
index 03d6860ec9a54ff46a1f73647212428e8de5d8f8..809edaf0f6396212174f99f91348397c21daaad9 100644 (file)
@@ -1,3 +1,19 @@
+2001-06-14  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * lyxfunc.C (Dispatch): use stringstream
+       (MenuNew): use stringstream
+       (Open): use stringstream
+
+       * importer.C (Import): use stringstream
+
+       * bufferview_funcs.C (CurrentState): use stringstream
+
+       * LaTeX.C (run): use stringstream
+
+       * BufferView_pimpl.C (savePosition): use stringstream
+       (restorePosition): use stringstream
+       (MenuInsertLyXFile): use stringstream
+
 2001-06-14  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * BufferView.C:
index dd7b410b0296087c38cf69c942e3796a68e86929..e0b3991379df9d3f8c589d2bbe4f92ab754d4dba 100644 (file)
@@ -68,7 +68,11 @@ int Chktex::scanLogFile(TeXErrors & terr)
 
        ifstream ifs(tmp.c_str());
        while (getline(ifs, token)) {
-               string srcfile, line, pos, warno, warning;
+               string srcfile;
+               string line;
+               string pos;
+               string warno;
+               string warning;
                token = split(token, srcfile, ':');
                token = split(token, line, ':');
                token = split(token, pos, ':');
index 15c13cb833d6bdff23c27a8773931ed581a76f78..a8106ccf2fd5f4ff3f811f22d8e967b8834441c5 100644 (file)
@@ -174,7 +174,12 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
 
        ++count;
        lyxerr[Debug::LATEX] << "Run #" << count << endl;
-       if (lfun) lfun->Dispatch(LFUN_MESSAGE, _("LaTeX run number") + ' ' + tostr(count));
+       if (lfun) {
+               ostringstream str;
+               str << _("LaTeX run number") << ' ' << count;
+               lfun->Dispatch(LFUN_MESSAGE, str.str().c_str());
+       }
+       
        
        //WriteStatus(lfun, string(_("LaTeX run number ")) + tostr(count));
        this->operator()();
@@ -251,7 +256,12 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                        << "Dep. file has changed or rerun requested" << endl;
                lyxerr[Debug::LATEX]
                        << "Run #" << count << endl;
-               if (lfun) lfun->Dispatch(LFUN_MESSAGE, _("LaTeX run number") + ' ' + tostr(count));
+               if (lfun) {
+                       ostringstream str;
+                       str << _("LaTeX run number") << ' ' << count;
+                       lfun->Dispatch(LFUN_MESSAGE, str.str().c_str());
+               }
+               
 //             WriteStatus(minib,
 //                         string(_("LaTeX run number ")) + tostr(count));
                this->operator()();
@@ -302,7 +312,12 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                rerun = false;
                ++count;
                lyxerr[Debug::LATEX] << "Run #" << count << endl;
-               if (lfun) lfun->Dispatch(LFUN_MESSAGE, _("LaTeX run numger") + ' ' + tostr(count));
+               if (lfun) {
+                       ostringstream str;
+                       str << _("LaTeX run number") << ' ' << count;
+                       lfun->Dispatch(LFUN_MESSAGE, str.str().c_str());
+               }
+               
 //             WriteStatus(minib, string(_("LaTeX run number ")) + tostr(count));
                this->operator()();
                scanres = scanLogFile(terr);
index 28c3c62e354704ae60c28ba816d565298f67bec5..065e488036c43571f215c5d114b5f171c6b2a116 100644 (file)
@@ -191,7 +191,8 @@ void FontSize(BufferView * bv, string const & size)
 // Returns the current font and depth as a message. 
 string const CurrentState(BufferView * bv)
 {
-       string state;
+       ostringstream state;
+
        if (bv->available()) { 
                // I think we should only show changes from the default
                // font. (Asger)
@@ -203,31 +204,37 @@ string const CurrentState(BufferView * bv)
                        .TextClass(buffer->params.textclass)
                        .defaultfont();
                font.reduce(defaultfont);
-               state = _("Font: ") + font.stateText(&buffer->params);
+
+               state << _("Font:") << ' '
+                     << font.stateText(&buffer->params);
+               
                // The paragraph depth
                int depth = text->GetDepth();
-               if (depth > 0) 
-                       state += string(_(", Depth: ")) + tostr(depth);
+               if (depth > 0)
+                       state << _(", Depth: ") << depth;
+               
                // The paragraph spacing, but only if different from
                // buffer spacing.
                if (!text->cursor.par()->params.spacing().isDefault()) {
                        Spacing::Space cur_space =
                                text->cursor.par()->params.spacing().getSpace();
-                       state += _(", Spacing: ");
+                       state << _(", Spacing: ");
+
                        switch (cur_space) {
                        case Spacing::Single:
-                               state += _("Single");
+                               state << _("Single");
+                               
                                break;
                        case Spacing::Onehalf:
-                               state += _("Onehalf");
+                               state << _("Onehalf");
                                break;
                        case Spacing::Double:
-                               state += _("Double");
+                               state << _("Double");
                                break;
                        case Spacing::Other:
-                               state += _("Other (");
-                               state += tostr(text->cursor.par()->params.spacing().getValue());
-                               state += ")";
+                               state << _("Other (")
+                                     << text->cursor.par()->params.spacing().getValue()
+                                     << ")";
                                break;
                        case Spacing::Default:
                                // should never happen, do nothing
@@ -235,7 +242,7 @@ string const CurrentState(BufferView * bv)
                        }
                }
        }
-       return state;
+       return state.str().c_str();
 }
 
 
index a486d7b8c8890ea2de7d7189a30ee6b5aae3cfdc..58f1c87b28b421c3ff456cfa1122182967bd4ef6 100644 (file)
@@ -37,8 +37,9 @@ bool Importer::Import(LyXView * lv, string const & filename,
                      string const & format)
 {
        string const displaypath = MakeDisplayPath(filename);
-       string const s1 = _("Importing") + ' ' + displaypath + "...";
-       lv->message(s1);
+       ostringstream s1;
+       s1 << _("Importing") << ' ' << displaypath << "...";
+       lv->message(s1.str().c_str());
 
        string const lyxfile = ChangeExtension(filename, ".lyx");
 
index 2a8c8456657d347bb523f92531cb82144cb70a50..6249bec5e7542d11a7ea7f35b49c6c3867f7c77b 100644 (file)
@@ -587,7 +587,7 @@ bool LyX::ReadRcFile(string const & name)
                                    << " in " << lyxrc_path << endl;
                if (lyxrc.read(lyxrc_path) < 0) { 
                        WriteAlert(_("LyX Warning!"), 
-                                  _("Error while reading ")+lyxrc_path+".",
+                                  _("Error while reading ") + lyxrc_path + ".",
                                   _("Using built-in defaults."));
                        return false;
                }
index 6f6a4156a83e4f19cb35527467b992a151120d4b..94a1710e48c05fce2334d490a504f6be315f2273 100644 (file)
@@ -869,11 +869,10 @@ string const LyXFunc::Dispatch(int ac,
                
        case LFUN_MENUWRITE:
                if (!owner->buffer()->isUnnamed()) {
-                       string const s1 = _("Saving document") + ' '
-                               + MakeDisplayPath(owner->buffer()->fileName()
-                                                 + "...");
-                       
-                       owner->message(s1);
+                       ostringstream s1;
+                       s1 << _("Saving document") << ' '
+                          << MakeDisplayPath(owner->buffer()->fileName() + "...");
+                       owner->message(s1.str().c_str());
                        MenuWrite(owner->view(), owner->buffer());
                } else
                        WriteAs(owner->view(), owner->buffer());
@@ -1043,10 +1042,10 @@ string const LyXFunc::Dispatch(int ac,
                        AllowInput(owner->view());
                        break;
                }
-               string const str = _("Opening help file") + ' '
-                       + MakeDisplayPath(fname) + "...";
-               
-               owner->message(str);
+               ostringstream str;
+               str << _("Opening help file") << ' '
+                   << MakeDisplayPath(fname) << "...";
+               owner->message(str.str().c_str());
                owner->view()->buffer(bufferlist.loadLyXFile(fname,false));
                AllowInput(owner->view());
                break;
@@ -1568,14 +1567,22 @@ void LyXFunc::MenuNew(bool fromTemplate)
                                        MakeDisplayPath(s, 50),
                                        _("Do you want to open the document?"))) {
                                // loads document
-                               owner->message(_("Opening document") + ' '
-                                              + MakeDisplayPath(s) + "...");
-                               XFlush(fl_get_display());
+                               string const disp_fn(MakeDisplayPath(s));
+                               
+                               ostringstream str;
+                               str << _("Opening  document") << ' '
+                                   << disp_fn << "...";
+                               
+                               owner->message(str.str().c_str());
+                               //XFlush(fl_get_display());
                                owner->view()->buffer(
                                        bufferlist.loadLyXFile(s));
-                               owner->message(_("Document") + ' '
-                                              + MakeDisplayPath(s) + ' '
-                                              + _("opened."));
+                               ostringstream str2;
+                               str2 << _("Document") << ' '
+                                    << disp_fn << ' ' << _("opened.");
+                               
+                               owner->message(str2.str().c_str());
+
                                return;
                        }
                }
@@ -1667,17 +1674,23 @@ void LyXFunc::Open(string const & fname)
                filename += ".lyx";
 
        // loads document
-       owner->message(_("Opening document") + ' '
-                      + MakeDisplayPath(filename) + "...");
+       string const disp_fn(MakeDisplayPath(filename));
+
+       ostringstream str;
+       str << _("Opening document") << ' ' << disp_fn << "...";
+       
+       owner->message(str.str().c_str());
+
        Buffer * openbuf = bufferlist.loadLyXFile(filename);
        if (openbuf) {
                owner->view()->buffer(openbuf);
-               owner->message(_("Document") + ' '
-                              + MakeDisplayPath(filename)
-                              + ' ' + _("opened."));
+               ostringstream str;
+               str << _("Document") << ' ' << disp_fn << ' ' << _("opened.");
+               owner->message(str.str().c_str());
        } else {
-               owner->message(_("Could not open document") + ' '
-                              + MakeDisplayPath(filename));
+               ostringstream str;
+               str << _("Could not open docuent") << ' ' << disp_fn;
+               owner->message(str.str().c_str());
        }
 }