From acc7e9789ec79f67c2444b2b325eeca93f6fa578 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 6 Nov 2000 15:47:22 +0000 Subject: [PATCH] Add a bunch of c_str() for string stream uses; remove lyxfunc symbol-insert. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1200 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 19 +++++++++++++++++++ lib/bind/fi_menus.bind | 12 ++++++------ lib/bind/sciword.bind | 2 +- src/LyXAction.C | 1 - src/Spacing.C | 2 +- src/buffer.C | 4 ++-- src/frontends/xforms/FormPreferences.C | 2 +- src/insets/insettabular.C | 2 +- src/lyxfunc.C | 4 ++-- src/paragraph.C | 4 ++-- src/support/filetools.C | 2 +- src/support/lyxstring.C | 2 ++ 12 files changed, 38 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index a11c45e674..ba2bae0ad6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2000-11-06 Jean-Marc Lasgouttes + * src/support/lyxstring.C: add a couple "using" directives. + + * src/frontends/xforms/FormPreferences.C (ColoursLoadBrowser): add + a .c_str() here too for good measure. + * src/Spacing.C (set): ditto. + * src/lyxfunc.C (Dispatch): ditto. + + * src/insets/insettabular.C (copySelection): change .str() to + .str().c_str() to fix problems with lyxstring. + * src/support/filetools.C (GetFileContents): ditto. + * src/buffer.C (asciiParagraph): ditto. + * src/paragraph.C (String): ditto. + + * lib/bind/fi_menus.bind: change symbol-insert to math-insert. + * lib/bind/sciword.bind: ditto. + + * src/LyXAction.C (init): remove "symbol-insert" function, which + shared LFUN_INSERT_MATH with "math-insert". + * lib/configure.m4: == is not a valid operator for command test. * src/lyxrc.C: add using directive. diff --git a/lib/bind/fi_menus.bind b/lib/bind/fi_menus.bind index 03c257047b..1ba86c0cba 100644 --- a/lib/bind/fi_menus.bind +++ b/lib/bind/fi_menus.bind @@ -149,12 +149,12 @@ # Math menu # -\bind "M-e m" "symbol-insert frac" -\bind "M-e n" "symbol-insert sqrt" -\bind "M-e e" "symbol-insert ^" -\bind "M-e a" "symbol-insert _" -\bind "M-e s" "symbol-insert sum" -\bind "M-e i" "symbol-insert int" +\bind "M-e m" "math-insert frac" +\bind "M-e n" "math-insert sqrt" +\bind "M-e e" "math-insert ^" +\bind "M-e a" "math-insert _" +\bind "M-e s" "math-insert sum" +\bind "M-e i" "math-insert int" \bind "M-e t" "math-mode" \bind "M-e k" "math-display" #bind "M-e p" "display-math-panel-or-something" # What function to use? diff --git a/lib/bind/sciword.bind b/lib/bind/sciword.bind index 577d71d769..cd13a48e8a 100644 --- a/lib/bind/sciword.bind +++ b/lib/bind/sciword.bind @@ -147,7 +147,7 @@ \bind "C-s e" "math-insert sum" \bind "C-s p" "math-insert prod" \bind "C-s i" "math-insert infty" -\bind "C-s x" "symbol-insert times" +\bind "C-s x" "math-insert times" # My own embellishments for symbols I use often. diff --git a/src/LyXAction.C b/src/LyXAction.C index d46ffab334..83db226881 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -381,7 +381,6 @@ void LyXAction::init() { LFUN_SETXY, "server-set-xy", "", ReadOnly }, { LFUN_SET_COLOR, "set-color", "", Noop }, { LFUN_SPELLCHECK, "spellchecker", "", Noop }, - { LFUN_INSERT_MATH, "symbol-insert", "", Noop }, { LFUN_SHIFT_TAB, "tab-backward", "", Noop }, { LFUN_TAB, "tab-forward", "", Noop }, { LFUN_TABINSERT, "tab-insert", "", Noop }, diff --git a/src/Spacing.C b/src/Spacing.C index b80f55ffb1..3d39cf4e32 100644 --- a/src/Spacing.C +++ b/src/Spacing.C @@ -56,7 +56,7 @@ void Spacing::set(Spacing::Space sp, float val) void Spacing::set(Spacing::Space sp, string const & val) { float fval; - istringstream istr(val); + istringstream istr(val.c_str()); istr >> fval; set(sp, fval); } diff --git a/src/buffer.C b/src/buffer.C index 152f7de180..74c7d6eb58 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1647,7 +1647,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, if ((inset = par->GetInset(i))) { if (!inset->Ascii(this, buffer)) { string dummy; - string s = rsplit(buffer.str(), + string s = rsplit(buffer.str().c_str(), dummy, '\n'); currlinelen += s.length(); } else { @@ -1698,7 +1698,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, break; } } - return buffer.str(); + return buffer.str().c_str(); } diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 3724c564b0..cc6d19333e 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -438,7 +438,7 @@ bool FormPreferences::ColoursLoadBrowser(string const & filename) RGB col; string name; - istringstream iss(line); + istringstream iss(line.c_str()); iss >> col.r >> col.g >> col.b; while (iss.good()) { string next; diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index f97392473b..88b234dfc4 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -1950,7 +1950,7 @@ bool InsetTabular::copySelection(BufferView * bv) ostringstream sstr; paste_tabular->Ascii(bv->buffer(), sstr); - bv->stuffClipboard(sstr.str()); + bv->stuffClipboard(sstr.str().c_str()); return true; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 1e4c7d1d64..9a78e88860 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -2051,7 +2051,7 @@ string const LyXFunc::Dispatch(int ac, cur_value = par->spacing.getValue(); } - istringstream istr(argument); + istringstream istr(argument.c_str()); string tmp; istr >> tmp; @@ -2350,7 +2350,7 @@ string const LyXFunc::Dispatch(int ac, case LFUN_GOTO_PARAGRAPH: { - istringstream istr(argument); + istringstream istr(argument.c_str()); int id; istr >> id; diff --git a/src/paragraph.C b/src/paragraph.C index d3e63a193b..ffdb776e7f 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -3935,7 +3935,7 @@ string const LyXParagraph::String(Buffer const * buffer, bool label) GetInset(i)->LyxCode() == Inset::MATH_CODE) { std::ostringstream ost; GetInset(i)->Ascii(buffer, ost); - s += subst(ost.str(),'\n',' '); + s += subst(ost.str().c_str(),'\n',' '); } } @@ -3975,7 +3975,7 @@ string const LyXParagraph::String(Buffer const * buffer, else if (c == META_INSET) { std::ostringstream ost; GetInset(i)->Ascii(buffer, ost); - s += ost.str(); + s += ost.str().c_str(); } } diff --git a/src/support/filetools.C b/src/support/filetools.C index c1052a180a..c9605aa7f8 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -746,7 +746,7 @@ string const GetFileContents(string const & fname) if (ifs && ofs) { ofs << ifs.rdbuf(); ifs.close(); - return ofs.str(); + return ofs.str().c_str(); } } lyxerr << "LyX was not able to read file '" << fname << "'" << endl; diff --git a/src/support/lyxstring.C b/src/support/lyxstring.C index 7bd6d90f2f..e3fd5d3e60 100644 --- a/src/support/lyxstring.C +++ b/src/support/lyxstring.C @@ -24,6 +24,8 @@ #include "LAssert.h" using std::min; +using std::istream; +using std::ostream; // This class is supposed to be functionaly equivalent to a // standard conformant string. This mean among others that we