fix some buggy constructs with stringstream

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2127 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-06-14 17:58:49 +00:00
parent 3eaf3246be
commit 15a0218c0f
9 changed files with 147 additions and 84 deletions

View 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

View 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());
}
}

View 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:

View 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, ':');

View 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);

View 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();
}

View 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");

View 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;
}

View 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());
}
}