From: Lars Gullik Bjønnes Date: Sun, 28 Jul 2002 22:50:13 +0000 (+0000) Subject: Rename strip to rtrim X-Git-Tag: 1.6.10~18737 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=043298544c6338b3de3503876d17054faef149fc;p=features.git Rename strip to rtrim Rename frontStrip to ltrim Add new trim function. modify source for this change. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4801 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 4c27a3ef7a..ddb2f7c16d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2002-07-29 Lars Gullik Bjønnes + + * many files: strip,frontStrip -> trim,ltrim,rtrim + 2002-07-28 Lars Gullik Bjønnes * PrinterParams.h: remove extern containsOnly, and include diff --git a/src/LaTeX.C b/src/LaTeX.C index cf2f884fe9..0fb01690f4 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -430,7 +430,7 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info) regex reg4("\\\\@input\\{([^}]+)\\}"); while (getline(ifs, token)) { - token = strip(token, "\r"); + token = rtrim(token, "\r"); smatch sub; if (regex_match(token, sub, reg1)) { string data = sub[1]; @@ -679,7 +679,7 @@ void LaTeX::deplog(DepTable & head) string foundfile; string token; getline(ifs, token); - token = strip(token, "\r"); + token = rtrim(token, "\r"); if (token.empty()) continue; smatch sub; diff --git a/src/LyXAction.C b/src/LyXAction.C index d4b3381a3b..9c1ac78791 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -534,7 +534,7 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const // Returns an action tag from a string. int LyXAction::LookupFunc(string const & func) const { - string const func2 = frontStrip(strip(func)); + string const func2 = trim(func); if (func2.empty()) return LFUN_NOACTION; // split action and arg diff --git a/src/buffer.C b/src/buffer.C index 2810843d66..fce9ca959e 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1060,7 +1060,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, params.footskip = lex.getString(); } else if (token == "\\paperfontsize") { lex.nextToken(); - params.fontsize = strip(lex.getString()); + params.fontsize = rtrim(lex.getString()); } else if (token == "\\papercolumns") { lex.nextToken(); params.columns = lex.getInteger(); @@ -1073,7 +1073,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, } } else if (token == "\\paperpagestyle") { lex.nextToken(); - params.pagestyle = strip(lex.getString()); + params.pagestyle = rtrim(lex.getString()); } else if (token == "\\bullet") { lex.nextToken(); int const index = lex.getInteger(); @@ -1128,7 +1128,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, params.tocdepth = lex.getInteger(); } else if (token == "\\spacing") { lex.next(); - string const tmp = strip(lex.getString()); + string const tmp = rtrim(lex.getString()); Spacing::Space tmp_space = Spacing::Default; float tmp_val = 0.0; if (tmp == "single") { @@ -1153,7 +1153,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, } } else if (token == "\\paragraph_spacing") { lex.next(); - string const tmp = strip(lex.getString()); + string const tmp = rtrim(lex.getString()); if (tmp == "single") { par->params().spacing(Spacing(Spacing::Single)); } else if (tmp == "onehalf") { @@ -2338,7 +2338,7 @@ void Buffer::makeLaTeXFile(ostream & os, string strOptions(options.str().c_str()); if (!strOptions.empty()) { - strOptions = strip(strOptions, ","); + strOptions = rtrim(strOptions, ","); os << '[' << strOptions << ']'; } @@ -3853,8 +3853,8 @@ bool Buffer::dispatch(string const & command, bool * result) { // Split command string into command and argument string cmd; - string line = frontStrip(command); - string const arg = strip(frontStrip(split(line, cmd, ' '))); + string line = ltrim(command); + string const arg = trim(split(line, cmd, ' ')); return dispatch(lyxaction.LookupFunc(cmd), arg, result); } diff --git a/src/bufferparams.C b/src/bufferparams.C index 504e9c9eed..3ccf77567b 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -81,7 +81,7 @@ void BufferParams::writeFile(ostream & os) const // then the the preamble if (!preamble.empty()) { // remove '\n' from the end of preamble - string const tmppreamble = strip(preamble, "\n"); + string const tmppreamble = rtrim(preamble, "\n"); os << "\\begin_preamble\n" << tmppreamble << "\n\\end_preamble\n"; diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index c5529e938a..d2b310704d 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2002-07-29 Lars Gullik Bjønnes + + * several files: strip,frontStrip -> trim,ltrim,rtrim + 2002-07-28 Lars Gullik Bjønnes * biblio.C (parseBibTeX): modify because of strip changes diff --git a/src/frontends/controllers/ControlSendto.C b/src/frontends/controllers/ControlSendto.C index 7eb8376e22..8b36d6f664 100644 --- a/src/frontends/controllers/ControlSendto.C +++ b/src/frontends/controllers/ControlSendto.C @@ -98,7 +98,7 @@ void ControlSendto::setFormat(Format const * fmt) void ControlSendto::setCommand(string const & cmd) { - command_ = strip(frontStrip(cmd)); + command_ = trim(cmd); } diff --git a/src/frontends/controllers/biblio.C b/src/frontends/controllers/biblio.C index 629e495c48..62d3a48d0f 100644 --- a/src/frontends/controllers/biblio.C +++ b/src/frontends/controllers/biblio.C @@ -159,10 +159,10 @@ string const familyName(string const & name) // "F. Surname" string::size_type idx = fname.find(","); if (idx != string::npos) - return frontStrip(fname.substr(0,idx)); + return ltrim(fname.substr(0, idx)); idx = fname.rfind("."); if (idx != string::npos) - fname = frontStrip(fname.substr(idx+1)); + fname = ltrim(fname.substr(idx + 1)); // test if we have a LaTeX Space in front if (fname[0] == '\\') return fname.substr(2); @@ -185,8 +185,7 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key) return string(); } - string const opt = - strip(frontStrip(it->second.substr(0, pos-1))); + string const opt = trim(it->second.substr(0, pos - 1)); if (opt.empty()) return string(); @@ -213,7 +212,7 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key) for (vector::iterator it = authors.begin(); it != authors.end(); ++it) { - *it = familyName(strip(*it)); + *it = familyName(rtrim(*it)); } author = authors[0]; @@ -242,7 +241,7 @@ string const getYear(InfoMap const & map, string const & key) } string const opt = - strip(frontStrip(it->second.substr(0, pos-1))); + trim(it->second.substr(0, pos - 1)); if (opt.empty()) return string(); @@ -296,7 +295,7 @@ string const getInfo(InfoMap const & map, string const & key) string::size_type const pos = it->second.find(separator); if (pos != string::npos) { string::size_type const pos2 = pos + separator.size(); - string const info = strip(frontStrip(it->second.substr(pos2))); + string const info = trim(it->second.substr(pos2)); return info; } @@ -341,7 +340,7 @@ string const getInfo(InfoMap const & map, string const & key) if (!year.empty()) result << ", " << year; - string const result_str = strip(result.str().c_str()); + string const result_str = rtrim(result.str().c_str()); if (!result_str.empty()) return result_str; @@ -363,7 +362,7 @@ searchKeys(InfoMap const & theMap, if (start < keys.begin() || start >= keys.end()) return keys.end(); - string search_expr = frontStrip(strip(expr)); + string search_expr = trim(expr); if (search_expr.empty()) return keys.end(); @@ -387,7 +386,7 @@ string const parseBibTeX(string data, string const & findkey) string dummy = token(data,'\n', Entries); while (!dummy.empty()) { dummy = subst(dummy, '\t', ' '); // no tabs - dummy = frontStrip(dummy); // no leading spaces + dummy = ltrim(dummy); // no leading spaces // ignore lines with a beginning '%' or ignore all right of % string::size_type const idx = dummy.empty() ? string::npos : dummy.find('%'); @@ -451,10 +450,10 @@ string const parseBibTeX(string data, string const & findkey) // Clean-up. // 1. Spaces - data = strip(data); + data = rtrim(data); // 2. if there is no opening '{' then a closing '{' is probably cruft. if (!contains(data, '{')) - data = strip(data, "}"); + data = rtrim(data, "}"); // happens, when last keyword string::size_type const idx = !data.empty() ? data.find('=') : string::npos; @@ -462,14 +461,13 @@ string const parseBibTeX(string data, string const & findkey) if (idx == string::npos) return string(); - data = data.substr(idx); - data = frontStrip(strip(data)); + data = trim(data.substr(idx)); if (data.length() < 2 || data[0] != '=') { // a valid entry? return string(); } else { // delete '=' and the following spaces - data = frontStrip(frontStrip(data, "=")); + data = ltrim(data, " ="); if (data.length() < 2) { return data; // not long enough to find delimiters } else { @@ -482,7 +480,7 @@ string const parseBibTeX(string data, string const & findkey) } else { // no {} and no "", pure data but with a // possible ',' at the end - return strip(data, ","); + return rtrim(data, ","); } string tmp = data.substr(keypos); while (tmp.find('{') != string::npos && diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 95061db07e..0c4336f8f5 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,25 +1,29 @@ +2002-07-29 Lars Gullik Bjønnes + + * several file: strip,frontStrip -> trim,ltrim,rtrim + 2002-07-25 John Levon * Toolbar_pimpl.C: fix tooltips - + 2002-07-25 John Levon * QCommandEdit.C: * Toolbar_pimpl.C: make Tab work in the content pane - + 2002-07-25 John Levon * Menubar_pimpl.C: split create/fill of menus into two functions - + 2002-07-25 John Levon * Menubar_pimpl.C: make it compile again - + 2002-07-24 John Levon * Menubar_pimpl.C: make it compile again - + 2002-07-24 Angus Leeming * FileDialog_private.C (done): add a false to the arguments passed to @@ -48,15 +52,15 @@ * ui/QCitationDialog.ui: layout fix * ui/QExternalDialog.ui: idem * TODO: update - + 2002-07-23 John Levon * QCommandBuffer.C: real compile fix - + 2002-07-22 John Levon * QLyXKeySym.C: return 0 when text_ is empty - for getISOEncoded() + for getISOEncoded() 2002-07-22 John Levon @@ -65,26 +69,26 @@ * QtView.C: * Toolbar_pimpl.h: * Toolbar_pimpl.C: remove dead code - + 2002-07-22 John Levon * lyx_gui.C: add exit() so we don't busy loop ! - + 2002-07-22 John Levon * QCommandEdit.C: complete if right at end of line - + * QLyXKeySym.C: cleanup comments - + * QtView.C: prefer const int - + * qlkey.h: fix some transliteration errors... - + 2002-07-22 John Levon * Toolbar_pimpl.h: * Toolbar_pimpl.C: remove ->push() - + 2002-07-22 Edwin Leuven * QCitationDialog.C: fix loop search and info update after selecting @@ -95,31 +99,31 @@ * ui/QBibtexDialog.ui: style browser * QBibtex.C: idem * QBibtexDialog.C: idem - + * ui/QRefDialog.ui: document combo * QRef.C: idem - + * QInclude.C: new layout * ui/QIncludeDialog.ui: new layout - + * ui/QCitationDialog.ui: new layout - + * ui/QExternalDialog.ui: new layout - + * QGraphics.C: Compile fix - - * TODO: + + * TODO: 2002-07-22 John Levon * Menubar_pimpl.h: * Menubar_pimpl.C: implement check/disable, submenus - + 2002-07-22 John Levon * Toolbar_pimpl.h: * Toolbar_pimpl.C: implement getLayoutList() - + 2002-07-21 Jean-Marc Lasgouttes * Toolbar_pimpl.C: use BufferParams::getLyXTextClass @@ -128,27 +132,27 @@ * QToc.h: * QToc.C: compile fixes, default to depth_(1) - + 2002-07-21 John Levon * Menubar_pimpl.C: change for removed menubar stuff - + 2002-07-21 John Levon * QtView.C: reset idle timer on message() - + 2002-07-20 John Levon * QLImage.C: various fixes - - * QWorkArea.C: set focus proxy - + + * QWorkArea.C: set focus proxy + * qscreen.C: don't show cursor when in command buffer - + * Makefile.am: * moc/Makefile.am: * QMiniBuffer.h: - * QMiniBuffer.C: + * QMiniBuffer.C: * QCommandBuffer.h: * QCommandBuffer.C: * QCommandEdit.h: @@ -159,18 +163,18 @@ 2002-07-19 John Levon * QWorkArea.C: remove unnecessary include - + 2002-07-18 John Levon * QtView.C: * Toolbar_pimpl.C: * lyx_gui.C: verboseDispatch() is now dispatch() - + 2002-07-07 Edwin Leuven * QParagraph.[Ch]: Add paragraph dialog - * QParagraphDialog.[Ch]: - * ui/QParagraphDialog.[Ch]: + * QParagraphDialog.[Ch]: + * ui/QParagraphDialog.[Ch]: * Makefile.am: * Makefile.dialogs: * guiapi.C: @@ -178,49 +182,49 @@ 2002-07-17 John Levon * QtView.C: basic statusbar show - + 2002-07-17 John Levon * QLImage.C: add using std - + 2002-07-15 John Levon * QLImage.h: * QLImage.C: remove getPixmap() add isDrawable() - + 2002-07-14 John Levon * io_callback.h: * lyx_gui.C: make set_read_callback() work - + 2002-07-14 John Levon * lyx_gui.C: add set_read_callback() - - * Makefile.am: + + * Makefile.am: * xforms/*: remove - + 2002-07-13 John Levon * QtView.C: add a status bar - - * Toolbar_pimpl.C: minor fixes - * lyx_gui.C: implement hexname() + * Toolbar_pimpl.C: minor fixes + + * lyx_gui.C: implement hexname() 2002-07-12 John Levon * lyx_gui.C: move init_graphics() to parse_init() - + 2002-07-12 John Levon * Toolbar_pimpl.h: * Toolbar_pimpl.C: remove unused (de)activate() - + 2002-07-12 John Levon - * lyx_gui.C: implement update_fonts(), font_available() - + * lyx_gui.C: implement update_fonts(), font_available() + 2002-07-12 John Levon * lyx_gui.C: add un-needed update_color() @@ -229,7 +233,7 @@ * QtView.h: * QtView.C: remove unused methods - + 2002-07-12 John Levon * Makefile.am: @@ -241,23 +245,23 @@ * QLPainter.C: draw images * QWorkArea.C: implement clipboard as much as possible - + 2002-07-11 John Levon * dialog files: add unused Dialogs paramater to allow compile - + * QtView.C: * QMiniBuffer.h: * QMiniBuffer.C: * Makefile.am: add QMiniBuffer (placeholder) - + * TODO: add - + * Toolbar_pimpl.h: * Toolbar_pimpl.C: compile fix * lyx_gui.C: add hexname() place holder - + 2002-07-04 André Pönitz * xforms/Makefile.am: replace XFORMSGIMAGE by XFORMSIMAGE @@ -288,42 +292,42 @@ 2002-06-21 John Levon * qfont_metrics.C: fix variable names - + 2002-06-21 John Levon * QWorkArea.C: remove dead splash code - + 2002-06-21 John Levon * QContentPane.C: restore calls to workAreaResize() - * QLyXKeySym.h: tidy + * QLyXKeySym.h: tidy + + * QWorkArea.h: remove redraw() - * QWorkArea.h: remove redraw() - * QWorkArea.C: remove resize() - + 2002-06-20 John Levon * guiapi.C: createIndex() changed - + 2002-06-20 John Levon * QWorkArea.h: remove unused resize(...) - + 2002-06-20 John Levon * QWorkArea.h: remove unused stuff - + 2002-06-19 John Levon * QContentPane.h: * QContentPane.C: remove focus/unfocus events - + 2002-06-19 John Levon * QWorkArea.h: remove unused methods - + 2002-06-19 John Levon * LyXKeySymFactory.C: add @@ -334,12 +338,12 @@ * QLyXKeySym.h: * QLyXKeySym.C: get keyboard partly working - * qfont_metrics.C: fix compile - + * qfont_metrics.C: fix compile + 2002-06-19 John Levon * Makefile.am: add the new files ... - + * Dialogs.C: * guiapi.C: * all dialogs: implement new dialog stuff, fix compile @@ -353,13 +357,13 @@ * QContentPane.h: * QContentPane.C: new widget for containing a lyx document - + * QLPainter.h: * QLPainter.C: qt painter object - + * QWorkArea.h: * QWorkArea.C: Qt version of the work area - + * QtView.h: * QtView.C: Qt version of LyXView @@ -367,26 +371,26 @@ * Toolbar_pimpl.C: * Menubar_pimpl.h: * Menubar_pimpl.C: initial Qt versions - + * WorkAreaFactory.C: generate a QWorkArea - - * emptytable.C: add a resize grippie - + + * emptytable.C: add a resize grippie + * qfont_loader.h: * qfont_loader.C: font loader for Qt - + * qfont_metrics.h: * qfont_metrics.C: font metrics for Qt - + * qlkey.h: convert Qt key symbol into a name - + * qscreen.h: * qscreen.C: Qt version of screen - + * moc/Makefile.am: add new files - + * xforms/Makefile.am: remove all xforms dialogs - + 2002-06-10 Lars Gullik Bjønnes * Qt2BC.C: do not include ButtonController.tmpl @@ -394,7 +398,7 @@ 2002-05-23 John Levon * QtLyXView.h: moved into frontends/ - + 2002-05-22 Lars Gullik Bjønnes * QDocument.h: use more specific smart_ptr header. diff --git a/src/frontends/qt2/QBibtex.C b/src/frontends/qt2/QBibtex.C index efd89f45ea..75a75e8cea 100644 --- a/src/frontends/qt2/QBibtex.C +++ b/src/frontends/qt2/QBibtex.C @@ -60,7 +60,7 @@ void QBibtex::update_contents() while (!bibs.empty()) { bibs = split(bibs, bib, ','); - bib = frontStrip(strip(bib)); + bib = trim(bib); if (!bib.empty()) dialog_->databaseLB->inSort(bib.c_str()); } @@ -79,7 +79,7 @@ void QBibtex::update_contents() bibstyle = ""; } else dialog_->bibtocCB->setChecked(false); - + vector const str = getVectorFromString( controller().getBibStyles(),"\n"); diff --git a/src/frontends/qt2/QCitation.C b/src/frontends/qt2/QCitation.C index e31deb7ffa..ca20bdcf6e 100644 --- a/src/frontends/qt2/QCitation.C +++ b/src/frontends/qt2/QCitation.C @@ -179,7 +179,7 @@ void QCitation::updateBrowser(QListBox* browser, for (vector::const_iterator it = keys.begin(); it < keys.end(); ++it) { - string const key = frontStrip(strip(*it)); + string const key = trim(*it); // FIXME: why the .empty() test ? if (!key.empty()) browser->insertItem(key.c_str()); diff --git a/src/frontends/qt2/QParagraph.C b/src/frontends/qt2/QParagraph.C index b408d77dd0..48a4b84326 100644 --- a/src/frontends/qt2/QParagraph.C +++ b/src/frontends/qt2/QParagraph.C @@ -41,7 +41,7 @@ using std::bind2nd; using std::remove_if; typedef Qt2CB > base_class; - + QParagraph::QParagraph(ControlParagraph & c, Dialogs &) : base_class(c, _("Paragraph Layout")) {} @@ -57,13 +57,13 @@ void QParagraph::build_dialog() vector::iterator del = remove_if(units_.begin(), units_.end(), bind2nd(contains_functor(), "%")); units_.erase(del, units_.end()); - + for (vector::const_iterator it = units_.begin(); it != units_.end(); ++it) { dialog_->unitAbove->insertItem(it->c_str()); dialog_->unitBelow->insertItem(it->c_str()); } - + // Manage the ok, apply, restore and cancel/close buttons bc().setOK(dialog_->okPB); bc().setApply(dialog_->applyPB); @@ -102,11 +102,11 @@ VSpace setVSpaceFromWidgets(int spacing, break; case 6: string s; - string const length = strip(frontStrip(value)); + string const length = trim(value); if (isValidGlueLength(length)) { s = length; } else if (!length.empty()){ - string u = strip(frontStrip(unit)); + string u = trim(unit); u = subst(u, "%%", "%"); s = length + u; } @@ -127,21 +127,21 @@ void QParagraph::apply() // If a vspace kind is "Length" but there's no text in // the input field, reset the kind to "None". if (dialog_->spacingAbove->currentItem()==5 - && dialog_->valueAbove->text().isEmpty()) + && dialog_->valueAbove->text().isEmpty()) dialog_->spacingAbove->setCurrentItem(0); - + VSpace const space_top = setVSpaceFromWidgets(dialog_->spacingAbove->currentItem(), string(dialog_->valueAbove->text()), string(dialog_->unitAbove->currentText()), dialog_->keepAbove->isChecked()); - + controller().params().spaceTop(space_top); /* SPACING BELOW */ if (dialog_->spacingBelow->currentItem()==5 - && dialog_->valueBelow->text().isEmpty()) + && dialog_->valueBelow->text().isEmpty()) dialog_->spacingBelow->setCurrentItem(0); VSpace const space_bottom = @@ -149,7 +149,7 @@ void QParagraph::apply() string(dialog_->valueBelow->text()), string(dialog_->unitBelow->currentText()), dialog_->keepBelow->isChecked()); - + controller().params().spaceBottom(space_bottom); /* alignment */ @@ -171,7 +171,7 @@ void QParagraph::apply() align = LYX_ALIGN_BLOCK; } controller().params().align(align); - + /* get spacing */ Spacing::Space linespacing = Spacing::Default; string other; @@ -196,7 +196,7 @@ void QParagraph::apply() Spacing const spacing(linespacing, other); controller().params().spacing(spacing); - + /* lines and pagebreaks */ controller().params().lineTop(dialog_->lineAbove->isChecked()); controller().params().lineBottom(dialog_->lineBelow->isChecked()); @@ -241,7 +241,7 @@ void setWidgetsFromVSpace(VSpace const & space, case VSpace::VFILL: item = 5; break; - case VSpace::LENGTH: + case VSpace::LENGTH: item = 6; value->setEnabled(true); unit->setEnabled(true); @@ -303,7 +303,7 @@ void QParagraph::update_contents() break; } dialog_->align->setCurrentItem(i); - + //LyXAlignment alignpos = controller().alignPossible(); @@ -366,7 +366,3 @@ void QParagraph::update_contents() /* no indent */ dialog_->noindent->setChecked(controller().params().noindent()); } - - - - diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 8358003fd3..711b285813 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,7 +1,11 @@ +2002-07-29 Lars Gullik Bjønnes + + * several files: strip,frontStrip -> trim,ltrim,rtrim + 2002-07-25 John Levon * lyx_gui.C: - * XWorkArea.C: using dec + * XWorkArea.C: using dec 2002-07-25 Juergen Spitzmueller @@ -33,7 +37,7 @@ 2002-07-25 John Levon * forms/form_float.fd: "Span columns" - + 2002-07-25 Juergen Spitzmueller * FormFloat.C: @@ -59,7 +63,7 @@ 2002-07-24 Jean-Marc Lasgouttes * Menubar_pimpl.C (create_submenu): updates due to changes in - menubackend. + menubackend. 2002-07-22 Lars Gullik Bjønnes @@ -72,12 +76,12 @@ 2002-07-22 John Levon - * XFormsView.C: don't call toolbar_->set() + * XFormsView.C: don't call toolbar_->set() * Toolbar_pimpl.h: * Toolbar_pimpl.C: rationalise code, remove half-working update stuff into simple add() - + 2002-07-22 John Levon * lyx_gui.C: add lyx_gui::exit() diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index d4cc950828..39d7bf9085 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -495,7 +495,7 @@ void FormCitation::updateBrowser(FL_OBJECT * browser, for (vector::const_iterator it = keys.begin(); it < keys.end(); ++it) { - string key = frontStrip(strip(*it)); + string key = trim(*it); if (!key.empty()) fl_add_browser_line(browser, key.c_str()); } diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 37b23e3422..4df665fe18 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -461,7 +461,7 @@ bool FormDocument::input(FL_OBJECT * ob, long) bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3) || paperchoice == 2 || paperchoice > 5; int const default_unit = metric ? 8 : 9; - if (strip(fl_get_input(class_->input_doc_skip)).empty()) + if (rtrim(fl_get_input(class_->input_doc_skip)).empty()) fl_set_choice(class_->choice_default_skip_units, default_unit); } @@ -537,31 +537,31 @@ bool FormDocument::input(FL_OBJECT * ob, long) bool const metric = (defsize && lyxrc.default_papersize > 3) || paperchoice == 2 || paperchoice > 5; int const default_unit = metric ? 8 : 9; - if (strip(fl_get_input(paper_->input_custom_width)).empty()) + if (rtrim(fl_get_input(paper_->input_custom_width)).empty()) fl_set_choice(paper_->choice_custom_width_units, default_unit); - if (strip(fl_get_input(paper_->input_custom_height)).empty()) + if (rtrim(fl_get_input(paper_->input_custom_height)).empty()) fl_set_choice(paper_->choice_custom_height_units, default_unit); - if (strip(fl_get_input(paper_->input_top_margin)).empty()) + if (rtrim(fl_get_input(paper_->input_top_margin)).empty()) fl_set_choice(paper_->choice_top_margin_units, default_unit); - if (strip(fl_get_input(paper_->input_bottom_margin)).empty()) + if (rtrim(fl_get_input(paper_->input_bottom_margin)).empty()) fl_set_choice(paper_->choice_bottom_margin_units, default_unit); - if (strip(fl_get_input(paper_->input_inner_margin)).empty()) + if (rtrim(fl_get_input(paper_->input_inner_margin)).empty()) fl_set_choice(paper_->choice_inner_margin_units, default_unit); - if (strip(fl_get_input(paper_->input_outer_margin)).empty()) + if (rtrim(fl_get_input(paper_->input_outer_margin)).empty()) fl_set_choice(paper_->choice_outer_margin_units, default_unit); - if (strip(fl_get_input(paper_->input_head_height)).empty()) + if (rtrim(fl_get_input(paper_->input_head_height)).empty()) fl_set_choice(paper_->choice_head_height_units, default_unit); - if (strip(fl_get_input(paper_->input_head_sep)).empty()) + if (rtrim(fl_get_input(paper_->input_head_sep)).empty()) fl_set_choice(paper_->choice_head_sep_units, default_unit); - if (strip(fl_get_input(paper_->input_foot_skip)).empty()) + if (rtrim(fl_get_input(paper_->input_foot_skip)).empty()) fl_set_choice(paper_->choice_foot_skip_units, default_unit); } diff --git a/src/frontends/xforms/FormFiledialog.C b/src/frontends/xforms/FormFiledialog.C index 3c77c919e8..aeb7528a21 100644 --- a/src/frontends/xforms/FormFiledialog.C +++ b/src/frontends/xforms/FormFiledialog.C @@ -710,7 +710,7 @@ string const FileDialog::Private::Select(string const & title, if (!filename.empty()) { for (int i = 0; i < fl_get_browser_maxline(file_dlg_form_->List); ++i) { string s = fl_get_browser_line(file_dlg_form_->List, i + 1); - s = strip(frontStrip(s)); + s = trim(s); if (s == filename) { sel = i + 1; break; diff --git a/src/frontends/xforms/FormInclude.C b/src/frontends/xforms/FormInclude.C index 82ae3453a4..fc5edcd837 100644 --- a/src/frontends/xforms/FormInclude.C +++ b/src/frontends/xforms/FormInclude.C @@ -138,10 +138,10 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long) } else if (ob == dialog_->button_load) { string const in_name = fl_get_input(dialog_->input_filename); - if (!strip(in_name).empty() && controller().fileExists(in_name)) { + if (!rtrim(in_name).empty() && controller().fileExists(in_name)) { // ApplyButton(); OKButton(); - controller().load(strip(in_name)); + controller().load(rtrim(in_name)); action = ButtonPolicy::SMI_NOOP; } @@ -157,7 +157,7 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long) } else if (ob == dialog_->input_filename) { string const in_name = fl_get_input(dialog_->input_filename); - if (strip(in_name).empty()) + if (rtrim(in_name).empty()) action = ButtonPolicy::SMI_INVALID; } diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index 5261614445..1e8ecc082d 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -171,7 +171,7 @@ void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length) // If a vspace kind is "Length" but there's no text in // the input field, reset the kind to "None". - string const input = strip(getString(input_length)); + string const input = rtrim(getString(input_length)); if (input.empty()) fl_set_choice(choice_type, 1); } @@ -449,7 +449,7 @@ void synchronizeSpaceWidgets(FL_OBJECT * choice_type, string const length = getString(input_length); - if (strip(length).empty()) { + if (rtrim(length).empty()) { bool const metric = lyxrc.default_papersize > 3; int const default_unit = metric ? 8 : 9; diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 67427f2f2b..d9c53c5875 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -499,10 +499,10 @@ void FormPreferences::Colors::build() string const FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const { - if (ob == dialog_->browser_lyx_objs) + if (ob == dialog_->browser_lyx_objs) return _("LyX objects that can be assigned a color."); - if (ob == dialog_->button_modify) + if (ob == dialog_->button_modify) return _("Modify the LyX object's color. Note: you must then \"Apply\" the change."); if (ob == dialog_->dial_hue || @@ -513,7 +513,7 @@ FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const ob == dialog_->slider_blue) return _("Find a new color."); - if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv) + if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv) return _("Toggle between RGB and HSV color spaces."); return string(); @@ -951,7 +951,7 @@ void FormPreferences::Converters::build() string const FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const { - if (ob == dialog_->browser_all) + if (ob == dialog_->browser_all) return _("All the currently defined converters known to LyX."); if (ob == dialog_->choice_from) @@ -962,25 +962,25 @@ FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const if (ob == dialog_->input_converter) return _("The conversion command. $$i is the input file name, " - "$$b is the file name without its extension and $$o is " - "the name of the output file. $$s can be used as path to " - "LyX's own collection of conversion scripts."); + "$$b is the file name without its extension and $$o is " + "the name of the output file. $$s can be used as path to " + "LyX's own collection of conversion scripts."); if (ob == dialog_->input_flags) return _("Extra information for the Converter class, whether and " - "how to parse the result, and various other things."); + "how to parse the result, and various other things."); if (ob == dialog_->button_delete) return _("Remove the current converter from the list of available " - "converters. Note: you must then \"Apply\" the change."); + "converters. Note: you must then \"Apply\" the change."); if (ob == dialog_->button_add) { if (string(ob->label) == _("Add")) return _("Add the current converter to the list of available " - "converters. Note: you must then \"Apply\" the change."); + "converters. Note: you must then \"Apply\" the change."); else return _("Modify the contents of the current converter. " - "Note: you must then \"Apply\" the change."); + "Note: you must then \"Apply\" the change."); } return string(); @@ -998,10 +998,10 @@ bool FormPreferences::Converters::input(FL_OBJECT const * const ob) || ob == dialog_->input_flags) return Input(); - if (ob == dialog_->button_add) + if (ob == dialog_->button_add) return Add(); - if (ob == dialog_->button_delete) + if (ob == dialog_->button_delete) return erase(); return true; @@ -1120,7 +1120,7 @@ bool FormPreferences::Converters::Input() setEnabled(dialog_->button_delete, true); } - string const command = strip(fl_get_input(dialog_->input_converter)); + string const command = rtrim(fl_get_input(dialog_->input_converter)); bool const enable = !(command.empty() || from == to); setEnabled(dialog_->button_add, enable); @@ -1220,7 +1220,7 @@ void FormPreferences::Formats::build() string const FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const { - if (ob == dialog_->browser_all) + if (ob == dialog_->browser_all) return _("All the currently defined formats known to LyX."); if (ob == dialog_->input_format) @@ -1231,7 +1231,7 @@ FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const if (ob == dialog_->input_shrtcut) return _("The keyboard accelerator. Use a letter in the GUI name. " - "Case sensitive."); + "Case sensitive."); if (ob == dialog_->input_extension) return _("Used to recognize the file. E.g., ps, pdf, tex."); @@ -1241,15 +1241,15 @@ FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const if (ob == dialog_->button_delete) return _("Remove the current format from the list of available " - "formats. Note: you must then \"Apply\" the change."); + "formats. Note: you must then \"Apply\" the change."); - if (ob == dialog_->button_add) { + if (ob == dialog_->button_add) { if (string(ob->label) == _("Add")) return _("Add the current format to the list of available " - "formats. Note: you must then \"Apply\" the change."); + "formats. Note: you must then \"Apply\" the change."); else return _("Modify the contents of the current format. Note: " - "you must then \"Apply\" the change."); + "you must then \"Apply\" the change."); } return string(); @@ -1258,7 +1258,7 @@ FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const bool FormPreferences::Formats::input(FL_OBJECT const * const ob) { - if (ob == dialog_->browser_all) + if (ob == dialog_->browser_all) return Browser(); if (ob == dialog_->input_format @@ -1268,10 +1268,10 @@ bool FormPreferences::Formats::input(FL_OBJECT const * const ob) || ob == dialog_->input_viewer) return Input(); - if (ob == dialog_->button_add) + if (ob == dialog_->button_add) return Add(); - if (ob == dialog_->button_delete) + if (ob == dialog_->button_delete) return erase(); return false; @@ -1362,7 +1362,7 @@ bool FormPreferences::Formats::erase() if (local_converters.formatIsUsed(name)) { parent_.postWarning(_("Cannot remove a Format used by a Converter. " - "Remove the converter first.")); + "Remove the converter first.")); setEnabled(dialog_->button_delete, false); return false; } @@ -2760,7 +2760,7 @@ void FormPreferences::SpellOptions::apply() { string choice = fl_get_choice_text(dialog_->choice_spell_command); - choice = strip(frontStrip(choice)); + choice = trim(choice); lyxrc.isp_command = choice; diff --git a/src/frontends/xforms/FormSendto.C b/src/frontends/xforms/FormSendto.C index e126ced8d6..11050fbfa3 100644 --- a/src/frontends/xforms/FormSendto.C +++ b/src/frontends/xforms/FormSendto.C @@ -93,7 +93,7 @@ ButtonPolicy::SMInput FormSendto::input(FL_OBJECT *, long) return ButtonPolicy::SMI_INVALID; string cmd = getString(dialog_->input_command); - cmd = strip(frontStrip(cmd)); + cmd = trim(cmd); if (cmd.empty()) return ButtonPolicy::SMI_INVALID; diff --git a/src/frontends/xforms/FormThesaurus.C b/src/frontends/xforms/FormThesaurus.C index 9ce8b49eda..e7f351dec7 100644 --- a/src/frontends/xforms/FormThesaurus.C +++ b/src/frontends/xforms/FormThesaurus.C @@ -150,7 +150,7 @@ void FormThesaurus::setReplace(string const & templ, string const & nstr) ButtonPolicy::SMInput FormThesaurus::input(FL_OBJECT * obj, long) { if (obj == dialog_->input_entry) { - string s = strip(frontStrip(fl_get_input(dialog_->input_entry))); + string s = trim(fl_get_input(dialog_->input_entry)); updateMeanings(s); @@ -174,7 +174,7 @@ ButtonPolicy::SMInput FormThesaurus::input(FL_OBJECT * obj, long) int const line = fl_get_browser(obj); if (line > 0) { setReplace(fl_get_input(dialog_->input_entry), - strip(frontStrip(fl_get_browser_line(obj, line)))); + trim(fl_get_browser_line(obj, line))); } if (clickline_ == fl_get_browser(obj)) { diff --git a/src/frontends/xforms/Tooltips.C b/src/frontends/xforms/Tooltips.C index cf639e598e..255b40c123 100644 --- a/src/frontends/xforms/Tooltips.C +++ b/src/frontends/xforms/Tooltips.C @@ -79,7 +79,7 @@ void Tooltips::init(FL_OBJECT * ob, string const & tip) if (it != tooltipsMap.end()) return; - string const str = strip(frontStrip(tip)); + string const str = trim(tip); if (str.empty()) return; @@ -147,7 +147,7 @@ void Tooltips::init(FL_OBJECT * ob, string const & tip) if (it != tooltipsMap.end()) return; - string const str = strip(frontStrip(tip)); + string const str = trim(tip); if (str.empty()) return; diff --git a/src/frontends/xforms/XWorkArea.C b/src/frontends/xforms/XWorkArea.C index 1cd6e63897..3270cec09f 100644 --- a/src/frontends/xforms/XWorkArea.C +++ b/src/frontends/xforms/XWorkArea.C @@ -270,7 +270,7 @@ void XWorkArea::redraw(int width, int height) width, height, fl_get_visual_depth()); - + workAreaResize(); } diff --git a/src/frontends/xforms/input_validators.C b/src/frontends/xforms/input_validators.C index ae1e3ad3a8..3cb159ba21 100644 --- a/src/frontends/xforms/input_validators.C +++ b/src/frontends/xforms/input_validators.C @@ -116,13 +116,12 @@ void fl_print_range_filter(FL_OBJECT * ob, code below. */ string pages = subst(fl_get_input(fd_form_print->input_pages), ';',','); - pages = subst(pages, '+',','); - pages = frontStrip(strip(pages)) ; + pages = trim(subst(pages, '+', ',')); + while (!pages.empty()) { // a page range was given string piece ; pages = split (pages, piece, ',') ; - piece = strip(piece) ; - piece = frontStrip(piece) ; + piece = trim(piece); if (!stringOnlyContains (piece, "0123456789-")) { Alert::alert(_("ERROR! Unable to print!"), _("Check 'range of pages'!")); diff --git a/src/frontends/xforms/xformsImage.C b/src/frontends/xforms/xformsImage.C index 918a226ab6..a82f0c0c80 100644 --- a/src/frontends/xforms/xformsImage.C +++ b/src/frontends/xforms/xformsImage.C @@ -172,7 +172,7 @@ bool xformsImage::isDrawable() const return pixmap_; } - + Pixmap xformsImage::getPixmap() const { if (!pixmap_status_ == PIXMAP_SUCCESS) @@ -366,7 +366,7 @@ int status_report(FL_IMAGE * ob, const char *s) { lyx::Assert(ob && ob->u_vdata); - string const str = s ? strip(s) : string(); + string const str = s ? rtrim(s) : string(); if (str.empty()) return 0; @@ -385,7 +385,7 @@ static void error_report(FL_IMAGE * ob, const char *s) { lyx::Assert(ob && ob->u_vdata); - string const str = s ? strip(s) : string(); + string const str = s ? rtrim(s) : string(); if (str.empty()) return; diff --git a/src/frontends/xforms/xforms_helpers.C b/src/frontends/xforms/xforms_helpers.C index e4f20f6234..e57b623b92 100644 --- a/src/frontends/xforms/xforms_helpers.C +++ b/src/frontends/xforms/xforms_helpers.C @@ -50,24 +50,24 @@ void setEnabled(FL_OBJECT * ob, bool enable) vector const getVector(FL_OBJECT * ob) { vector vec; - + switch (ob->objclass) { case FL_CHOICE: for(int i = 0; i < fl_get_choice_maxitems(ob); ++i) { string const text = fl_get_choice_item_text(ob, i+1); - vec.push_back(strip(frontStrip(text))); + vec.push_back(trim(text)); } break; case FL_BROWSER: for(int i = 0; i < fl_get_browser_maxline(ob); ++i) { string const text = fl_get_browser_line(ob, i+1); - vec.push_back(strip(frontStrip(text))); + vec.push_back(trim(text)); } break; default: lyx::Assert(0); } - + return vec; } @@ -85,33 +85,33 @@ string const getString(FL_OBJECT * ob, int line) case FL_BROWSER: if (line == -1) line = fl_get_browser(ob); - + if (line >= 1 && line <= fl_get_browser_maxline(ob)) tmp = fl_get_browser_line(ob, line); break; - + case FL_CHOICE: if (line == -1) line = fl_get_choice(ob); - + if (line >= 1 && line <= fl_get_choice_maxitems(ob)) tmp = fl_get_choice_item_text(ob, line); break; - + default: lyx::Assert(0); - } + } - return (tmp) ? frontStrip(strip(tmp)) : string(); + return (tmp) ? trim(tmp) : string(); } - + string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice) { // Paranoia check lyx::Assert(input && input->objclass == FL_INPUT && choice && choice->objclass == FL_CHOICE); - string const length = strip(frontStrip(fl_get_input(input))); + string const length = trim(fl_get_input(input)); if (length.empty()) return string(); @@ -119,7 +119,7 @@ string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice) if (isValidGlueLength(length)) return length; - string unit = strip(frontStrip(fl_get_choice_text(choice))); + string unit = trim(fl_get_choice_text(choice)); unit = subst(unit, "%%", "%"); return length + unit; diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index baccf95342..58127cb9aa 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,9 @@ +2002-07-29 Lars Gullik Bjønnes + + * PreviewLoader.C (setFontScalingFactor): strip,frontStrip -> + trim,ltrim,rtrim + (setAscentFractions): ditto + 2002-07-28 Lars Gullik Bjønnes * PreviewLoader.C (setAscentFractions): modify because of strip diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index cea9a7f523..f049a488ac 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -681,7 +681,7 @@ double setFontScalingFactor(Buffer & buffer) getline(ifs, str); // To get the default font size, look for a line like // "\ExecuteOptions{letterpaper,10pt,oneside,onecolumn,final}" - if (!prefixIs(frontStrip(str), "\\ExecuteOptions")) + if (!prefixIs(ltrim(str), "\\ExecuteOptions")) continue; // str contains just the options of \ExecuteOptions @@ -737,7 +737,7 @@ void setAscentFractions(vector & ascent_fractions, if (!ifs.good() || page != "%%Page" || - !isStrUnsignedInt(strip(page_id, ":"))) { + !isStrUnsignedInt(rtrim(page_id, ":"))) { lyxerr[Debug::GRAPHICS] << "setAscentFractions(" << metrics_file << ")\n" << "Error reading file!" diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 032d120859..0a4930d322 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2002-07-29 Lars Gullik Bjønnes + + * several files: strip,frontStrip -> trim,ltrim,rtrim + 2002-07-28 Lars Gullik Bjønnes * insetbib.C (latex): modify because of strip changes diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 738e4ecd92..fafa51ae86 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -206,7 +206,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os, db_out += ','; db_in= split(db_in, adb,','); } - db_out = strip(db_out, ","); + db_out = rtrim(db_out, ","); os << "\\bibliography{" << db_out << "}\n"; return 2; } @@ -253,7 +253,7 @@ vector > const InsetBibtex::getKeys(Buffer const * buffer) ifstream ifs(it->c_str()); string linebuf0; while (getline(ifs, linebuf0)) { - string linebuf = frontStrip(strip(linebuf0)); + string linebuf = trim(linebuf0); if (linebuf.empty()) continue; if (prefixIs(linebuf, "@")) { linebuf = subst(linebuf, '{', '('); @@ -263,8 +263,7 @@ vector > const InsetBibtex::getKeys(Buffer const * buffer) if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble")) { linebuf = split(linebuf, tmp, ','); - tmp = frontStrip(tmp); - tmp = frontStrip(tmp,"\t"); + tmp = ltrim(tmp, " \t"); if (!tmp.empty()) { keys.push_back(pair(tmp,string())); } diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index f4a5f41bb8..0cdc98d2b5 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -172,7 +172,7 @@ string const getNatbibLabel(Buffer const * buffer, label += year + sep_str; } } - label = strip(strip(label), sep); + label = rtrim(rtrim(label), sep); if (!after_str.empty()) { if (cite_type == "citet") { @@ -207,10 +207,10 @@ string const getBasicLabel(string const & keyList, string const & after) if (contains(keys, ",")) { // Final comma allows while loop to cover all keys - keys = frontStrip(split(keys, label, ',')) + ","; + keys = ltrim(split(keys, label, ',')) + ","; while (contains(keys, ",")) { string key; - keys = frontStrip(split(keys, key, ',')); + keys = ltrim(split(keys, key, ',')); label += ", " + key; } } else diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 0d7d406164..67a5bd0e53 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -157,7 +157,7 @@ private: InsetGraphics::Cache::Cache(InsetGraphics & p) : old_ascent(0), checksum(0), parent_(p) { - loader.connect(boost::bind(&InsetGraphics::statusChanged, &parent_)); + loader.connect(boost::bind(&InsetGraphics::statusChanged, &parent_)); } @@ -550,7 +550,7 @@ string const InsetGraphics::createLatexOptions() const // before writing it to the output stream. ostringstream options; if (!params().bb.empty()) - options << " bb=" << strip(params().bb) << ",\n"; + options << " bb=" << rtrim(params().bb) << ",\n"; if (params().draft) options << " draft,\n"; if (params().clip) @@ -644,7 +644,7 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const unsigned long const new_checksum = cache_->loader.checksum(); bool const file_has_changed = cache_->checksum != new_checksum; if (file_has_changed) - cache_->checksum = new_checksum; + cache_->checksum = new_checksum; // temp_file will contain the file for LaTeX to act on if, for example, // we move it to a temp dir or uncompress it. diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 9c0167f39f..5ce9b705c3 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -46,7 +46,7 @@ void InsetLabel::edit(BufferView * bv, int, int, mouse_button::state) { pair result = Alert::askForText(_("Enter label:"), getContents()); if (result.first) { - string new_contents = frontStrip(strip(result.second)); + string new_contents = trim(result.second); if (!new_contents.empty() && getContents() != new_contents) { bv->buffer()->markDirty(); diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index fdbafa4cb7..2034364e54 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -55,7 +55,7 @@ void InsetLatexAccent::checkContents() // REMOVE IN 0.13 // Dirty Hack for backward compability. remove in 0.13 (Lgb) - contents = frontStrip(strip(contents)); + contents = trim(contents); if (!contains(contents, "{") && !contains(contents, "}")) { if (contents.length() == 2) { string tmp; @@ -274,7 +274,7 @@ int InsetLatexAccent::ascent(BufferView *, LyXFont const & font) const max = font_metrics::ascent('a', font); else max = font_metrics::ascent(ic, font); - if (plusasc) + if (plusasc) max += (font_metrics::maxAscent(font) + 3) / 3; } else max = font_metrics::maxAscent(font) + 4; @@ -286,12 +286,12 @@ int InsetLatexAccent::descent(BufferView *, LyXFont const & font) const { int max; if (candisp) { - if (ic == ' ') + if (ic == ' ') max = font_metrics::descent('a', font); - else - max = font_metrics::descent(ic, font); - if (plusdesc) - max += 3; + else + max = font_metrics::descent(ic, font); + if (plusdesc) + max += 3; } else max = font_metrics::maxDescent(font) + 4; return max; @@ -302,8 +302,8 @@ int InsetLatexAccent::width(BufferView *, LyXFont const & font) const { if (candisp) return font_metrics::width(ic, font); - else - return font_metrics::width(contents, font) + 4; + else + return font_metrics::width(contents, font) + 4; } @@ -430,7 +430,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0, // now the rest - draw within (x, y, x+wid, y+hg) switch (modtype) { case ACUTE: // acute 0xB4 - { + { pain.text(int(x2 - (font_metrics::rbearing(0xB4, font) - font_metrics::lbearing(0xB4, font)) / 2), baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0xB4, font) - (font_metrics::ascent(0xB4, font) + font_metrics::descent(0xB4, font)) / 2, char(0xB4), font); diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index b060e91901..4dd2f92080 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -77,7 +77,7 @@ InsetNote::InsetNote(Buffer const * buf, string const & contents, font.setLanguage(default_language); lyx::pos_type pos = 0; - buf->insertStringAsLines(par, pos, font, strip(contents, "\n")); + buf->insertStringAsLines(par, pos, font, rtrim(contents, "\n")); } diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 86c2c3bd91..3c43db7997 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -1803,7 +1803,7 @@ bool InsetTabular::tabularFeatures(BufferView * bv, string const & what) return false; string const val = - frontStrip(what.substr(tabularFeature[i].feature.length())); + ltrim(what.substr(tabularFeature[i].feature.length())); tabularFeatures(bv, action, val); return true; } @@ -2325,7 +2325,7 @@ FuncStatus InsetTabular::getStatus(string const & what) const return status.unknown(true); } - string const argument = frontStrip(what.substr(tabularFeature[i].feature.length())); + string const argument = ltrim(what.substr(tabularFeature[i].feature.length())); int sel_row_start; int sel_row_end; @@ -2768,7 +2768,7 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str, updateLocal(bv, FULL, false); return true; } - } + } return false; } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index ba68ea6323..840f859582 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -466,7 +466,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg) pair result = Alert::askForText(_("Enter new label to insert:"), text); if (result.first) { - label = frontStrip(strip(result.second)); + label = trim(result.second); } } if (!label.empty()) { diff --git a/src/lyx_main.C b/src/lyx_main.C index b515374768..47c2fdd300 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -678,7 +678,7 @@ void LyX::readUIFile(string const & name) break; default: - if (!strip(lex.getString()).empty()) + if (!rtrim(lex.getString()).empty()) lex.printError("LyX::ReadUIFile: " "Unknown menu tag: `$$Token'"); break; diff --git a/src/lyx_main.h b/src/lyx_main.h index 0b9f38adb8..1445dc13cf 100644 --- a/src/lyx_main.h +++ b/src/lyx_main.h @@ -26,7 +26,7 @@ class LastFiles; class Buffer; class kb_keymap; - + /// extern string user_lyxdir; /// @@ -35,7 +35,7 @@ extern string system_lyxdir; extern string system_tempdir; /// extern boost::scoped_ptr lastfiles; - + class LyX : boost::noncopyable { public: diff --git a/src/lyxfont.C b/src/lyxfont.C index e684207226..1d93bac550 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -571,7 +571,7 @@ string const LyXFont::stateText(BufferParams * params) const ost << _(" Number ") << _(GUIMiscNames[number()]); string buf(ost.str().c_str()); - buf = strip(buf, ", "); + buf = rtrim(buf, ", "); return buf; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 9856b6331a..32d597631b 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1569,7 +1569,7 @@ void LyXFunc::sendDispatchMessage(string const & msg, kb_action action, string c } if (!comname.empty()) { - comname = strip(comname); + comname = rtrim(comname); dispatch_msg += "(" + comname + ')'; } diff --git a/src/lyxlex.C b/src/lyxlex.C index 2e8e8e32f1..e9c8beb0c4 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -161,7 +161,7 @@ string const LyXLex::getLongString(string const & endtoken) // blank line in the file being read continue; - string const token = frontStrip(strip(getString()), " \t"); + string const token = trim(getString(), " \t"); lyxerr[Debug::PARSER] << "LongString: `" << getString() << '\'' << endl; @@ -186,7 +186,7 @@ string const LyXLex::getLongString(string const & endtoken) && prefixIs(tmpstr, prefix)) { tmpstr.erase(0, prefix.length() - 1); } - str += frontStrip(tmpstr, "\t") + '\n'; + str += ltrim(tmpstr, "\t") + '\n'; } else // token == endtoken break; @@ -240,9 +240,9 @@ int LyXLex::findToken(char const * str[]) pimpl_->printError("file ended while scanning string token"); return -1; } - + int i = 0; - + if (compare(pimpl_->buff, "default")) { while (str[i][0] && compare(str[i], pimpl_->buff)) { ++i; @@ -252,6 +252,6 @@ int LyXLex::findToken(char const * str[]) i = -1; } } - + return i; } diff --git a/src/lyxserver.C b/src/lyxserver.C index ed4948919c..e9692fd6f4 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -270,7 +270,7 @@ void LyXComm::read_ready() while ((status = read(infd, charbuf, CMDBUFLEN-1))) { if (status > 0) { charbuf[status]= '\0'; // turn it into a c string - lsbuf += strip(charbuf, "\r"); + lsbuf += rtrim(charbuf, "\r"); // commit any commands read while (lsbuf.find('\n') != string::npos) { // split() grabs the entire string if diff --git a/src/lyxtextclass.C b/src/lyxtextclass.C index 271c9dd3cc..a86ef7e28d 100644 --- a/src/lyxtextclass.C +++ b/src/lyxtextclass.C @@ -253,7 +253,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) case TC_PAGESTYLE: lexrc.next(); - pagestyle_ = strip(lexrc.getString()); + pagestyle_ = rtrim(lexrc.getString()); break; case TC_DEFAULTFONT: @@ -476,11 +476,11 @@ void LyXTextClass::readClassOptions(LyXLex & lexrc) switch (static_cast(le)) { case CO_FONTSIZE: lexrc.next(); - opt_fontsize_ = strip(lexrc.getString()); + opt_fontsize_ = rtrim(lexrc.getString()); break; case CO_PAGESTYLE: lexrc.next(); - opt_pagestyle_ = strip(lexrc.getString()); + opt_pagestyle_ = rtrim(lexrc.getString()); break; case CO_OTHER: lexrc.next(); diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 671a420d53..62e93fc724 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2002-07-29 Lars Gullik Bjønnes + + * formula.C (localDispatch): strip,frontStrip -> trim,ltrim,rtrim + 2002-07-28 Lars Gullik Bjønnes * math_nestinset.C: add using std::vector diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 8f6ee33d0f..06960cfa1e 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -326,7 +326,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action, : Alert::askForText(_("Enter label:"), old_label); if (!res.first) break; - new_label = frontStrip(strip(res.second)); + new_label = trim(res.second); } //if (new_label == old_label) @@ -451,8 +451,8 @@ int InsetFormula::descent(BufferView *, LyXFont const &) const if (!preview_->usePreview()) return 1 + par_->descent(); - int const descent = preview_->pimage_->descent(); - return display() ? descent + 12 : descent; + int const descent = preview_->pimage_->descent(); + return display() ? descent + 12 : descent; } diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 6be371e6d3..49583a8153 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -348,9 +348,9 @@ void InsetFormulaBase::insetButtonPress(BufferView * bv, //delete mathcursor; return; } - + } - if (button == mouse_button::button3) { + if (button == mouse_button::button3) { if (mathcursor->dispatch("mouse-3-press")) { //delete mathcursor; return; @@ -366,11 +366,11 @@ void InsetFormulaBase::insetMotionNotify(BufferView * bv, if (!mathcursor) return; - if (button == mouse_button::button1) + if (button == mouse_button::button1) if (mathcursor->dispatch("mouse-1-motion")) return; - if (button == mouse_button::button3) + if (button == mouse_button::button3) if (mathcursor->dispatch("mouse-3-motion")) return; @@ -460,7 +460,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, case LFUN_ENDSEL: sel = true; // fall through case LFUN_END: - result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT; + result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT; updateLocal(bv, false); break; diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index b7c66d5d37..4b3a10a8de 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -80,7 +80,7 @@ MathCursor::~MathCursor() // ensure that 'notifyCursorLeave' is called while (popLeft()) ; -} +} void MathCursor::push(MathAtom & t) diff --git a/src/support/ChangeLog b/src/support/ChangeLog index c499c11ed3..f16bdcd5e8 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,15 @@ +2002-07-29 Lars Gullik Bjønnes + + * lstrings.[hC]: rename stip to rtrim and frontStrip to ltrim, + also add a trim function that is the equiv of + strip(frontStrip(...)), also reimplement the functions + (improvements still possible.) + + * filetools.C: strip,frontStrip -> trim,ltrim,rtrim + * forkedcall.C (generateChild): ditto + * lstrings.C: ditto + + 2002-07-28 Lars Gullik Bjønnes * filetools.C (GetEnvPath): modify because of strip changes @@ -10,7 +22,7 @@ (isStrDbl): ditto (contains): removed unneeded version of contains (containsOnly): removed uneeded versions of containsOnly - (strip, frontStrip): removed unneded versions, changed argument types. + (strip, frontStrip): removed unneded versions, changed argument types. 2002-07-22 Dekel Tsur diff --git a/src/support/filetools.C b/src/support/filetools.C index 1a8fc16363..82e9ce635c 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -364,7 +364,7 @@ string const GetEnvPath(string const & name) #else string const pathlist = os::slashify_path(GetEnv(name)); #endif - return strip(pathlist, ";"); + return rtrim(pathlist, ";"); } @@ -564,7 +564,7 @@ int DestroyLyXTmpDir(string const & tmpdir) // Creates directory. Returns true if succesfull bool createDirectory(string const & path, int permission) { - string temp(strip(os::slashify_path(path), "/")); + string temp(rtrim(os::slashify_path(path), "/")); if (temp.empty()) { Alert::alert(_("Internal error!"), @@ -1352,10 +1352,10 @@ string const findtexfile(string const & fil, string const & /*format*/) cmd_ret const c = RunCommand(kpsecmd); lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n" - << "kpse result = `" << strip(c.second, "\n") + << "kpse result = `" << rtrim(c.second, "\n") << "'" << endl; if (c.first != -1) - return os::internal_path(strip(strip(c.second, "\n"), "\r")); + return os::internal_path(rtrim(c.second, "\n\r")); else return string(); } @@ -1410,7 +1410,7 @@ string const readBB_from_PSFile(string const & file) string s; getline(is,s); if (contains(s,"%%BoundingBox:") && !contains(s,"atend")) { - string const bb = frontStrip(s.substr(14)); + string const bb = ltrim(s.substr(14)); readBB_lyxerrMessage(file_, zipped, bb); return bb; } diff --git a/src/support/forkedcall.C b/src/support/forkedcall.C index 8847ce7122..912b13e855 100644 --- a/src/support/forkedcall.C +++ b/src/support/forkedcall.C @@ -230,7 +230,7 @@ pid_t Forkedcall::generateChild() int index = 0; while (more) { - childcommand = frontStrip(childcommand); + childcommand = ltrim(childcommand); if (syscmd == 0) { syscmd = new char[childcommand.length() + 1]; childcommand.copy(syscmd, childcommand.length()); diff --git a/src/support/lstrings.C b/src/support/lstrings.C index 71efb39559..15ff13f37b 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -120,7 +120,7 @@ bool isStrInt(string const & str) if (str.empty()) return false; // Remove leading and trailing white space chars. - string const tmpstr = frontStrip(strip(str)); + string const tmpstr = trim(str); if (tmpstr.empty()) return false; string::const_iterator cit = tmpstr.begin(); @@ -138,7 +138,7 @@ bool isStrUnsignedInt(string const & str) if (str.empty()) return false; // Remove leading and trailing white space chars. - string const tmpstr = frontStrip(strip(str)); + string const tmpstr = trim(str); if (tmpstr.empty()) return false; string::const_iterator cit = tmpstr.begin(); @@ -154,7 +154,7 @@ int strToInt(string const & str) { if (isStrInt(str)) { // Remove leading and trailing white space chars. - string const tmpstr = frontStrip(strip(str)); + string const tmpstr = trim(str); // Do the conversion proper. return lyx::atoi(tmpstr); } else { @@ -167,7 +167,7 @@ unsigned int strToUnsignedInt(string const & str) { if (isStrUnsignedInt(str)) { // Remove leading and trailing white space chars. - string const tmpstr = frontStrip(strip(str)); + string const tmpstr = trim(str); // Do the conversion proper. return lyx::atoi(tmpstr); } else { @@ -181,7 +181,7 @@ bool isStrDbl(string const & str) if (str.empty()) return false; // Remove leading and trailing white space chars. - string const tmpstr = frontStrip(strip(str)); + string const tmpstr = trim(str); if (tmpstr.empty()) return false; // if (1 < tmpstr.count('.')) return false; @@ -210,7 +210,7 @@ double strToDbl(string const & str) { if (isStrDbl(str)) { // Remove leading and trailing white space chars. - string const tmpstr = frontStrip(strip(str)); + string const tmpstr = trim(str); // Do the conversion proper. return ::atof(tmpstr.c_str()); } else { @@ -494,40 +494,54 @@ string const subst(string const & a, } -string const strip(string const & a, char const * p) +string const trim(string const & a, char const * p) { lyx::Assert(p); - if (a.empty() || !*p) return a; - string tmp(a); - string::size_type i = tmp.find_last_not_of(p); - if (i == a.length() - 1) return tmp; // no c's at end of a - if (i != string::npos) - tmp.erase(i + 1, string::npos); -#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD) - // Ok This code is now suspect... (Lgb) - /// Needed for broken string::find_last_not_of - else if (tmp[0] != p[0]) { - if (a.length() == 1) return tmp; - tmp.erase(1, string::npos); - } -#endif - else - tmp.erase(); // only chars from p in the whole string - return tmp; + if (a.empty() || !*p) + return a; + + string::size_type r = a.find_last_not_of(p); + string::size_type l = a.find_first_not_of(p); + + // Is this the minimal test? (lgb) + if (r == string::npos && l == string::npos) + return string(); + + return a.substr(l, r - l + 1); } -string const frontStrip(string const & a, char const * p) +string const rtrim(string const & a, char const * p) { lyx::Assert(p); - if (a.empty() || !*p) return a; - string tmp(a); - string::size_type i = tmp.find_first_not_of(p); - if (i > 0) - tmp.erase(0, i); - return tmp; + if (a.empty() || !*p) + return a; + + string::size_type r = a.find_last_not_of(p); + + // Is this test really needed? (Lgb) + if (r == string::npos) + return string(); + + return a.substr(0, r + 1); +} + + +string const ltrim(string const & a, char const * p) +{ + lyx::Assert(p); + + if (a.empty() || !*p) + return a; + + string::size_type l = a.find_first_not_of(p); + + if (l == string::npos) + return string(); + + return a.substr(l, string::npos); } @@ -603,14 +617,14 @@ vector const getVectorFromString(string const & str, vector vec; if (str.empty()) return vec; - string keys(strip(str)); + string keys(rtrim(str)); for(;;) { string::size_type const idx = keys.find(delim); if (idx == string::npos) { - vec.push_back(frontStrip(keys)); + vec.push_back(ltrim(keys)); break; } - string const key = strip(frontStrip(keys.substr(0, idx))); + string const key = trim(keys.substr(0, idx)); if (!key.empty()) vec.push_back(key); string::size_type const start = idx + delim.size(); @@ -627,7 +641,7 @@ string const getStringFromVector(vector const & vec, int i = 0; for (vector::const_iterator it = vec.begin(); it != vec.end(); ++it) { - string item = strip(frontStrip(*it)); + string item = trim(*it); if (item.empty()) continue; if (i++ > 0) str += delim; diff --git a/src/support/lstrings.h b/src/support/lstrings.h index f47d592c83..8bcee0ae23 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -192,19 +192,26 @@ string const subst(string const & a, string const subst(string const & a, string const & oldstr, string const & newstr); -/** Strips characters off the end of a string. +/** Trims characters off the end and beginning of a string. \code - strip("abccc", "c") == "ab". + trim("ccabccc", "c") == "ab". \endcode */ -string const strip(string const & a, char const * p = " "); +string const trim(string const & a, char const * p = " "); -/** Strips characters off the beginning of a string. +/** Trims characters off the end of a string. \code - frontstrip("ababcdef", "ab") = "cdef" + rtrim("abccc", "c") == "ab". \endcode */ -string const frontStrip(string const & a, char const * p = " "); +string const rtrim(string const & a, char const * p = " "); + +/** Trims characters off the beginning of a string. + \code + ltrim("ababcdef", "ab") = "cdef" + \endcode +*/ +string const ltrim(string const & a, char const * p = " "); /** Splits the string by the first delim. Splits the string by the first appearance of delim. diff --git a/src/tabular.C b/src/tabular.C index c6652f3029..c20ac65f05 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -472,7 +472,7 @@ bool LyXTabular::LeftLine(int cell, bool onlycolumn) const #ifdef SPECIAL_COLUM_HANDLING if (cellinfo_of_cell(cell)->align_special.empty()) return cellinfo_of_cell(cell)->left_line; - return prefixIs(frontStrip(cellinfo_of_cell(cell)->align_special), "|"); + return prefixIs(ltrim(cellinfo_of_cell(cell)->align_special), "|"); #else return cellinfo_of_cell(cell)->left_line; #endif @@ -480,7 +480,7 @@ bool LyXTabular::LeftLine(int cell, bool onlycolumn) const #ifdef SPECIAL_COLUM_HANDLING if (column_info[column_of_cell(cell)].align_special.empty()) return column_info[column_of_cell(cell)].left_line; - return prefixIs(frontStrip(column_info[column_of_cell(cell)].align_special), "|"); + return prefixIs(ltrim(column_info[column_of_cell(cell)].align_special), "|"); #else return column_info[column_of_cell(cell)].left_line; #endif @@ -495,7 +495,7 @@ bool LyXTabular::RightLine(int cell, bool onlycolumn) const #ifdef SPECIAL_COLUM_HANDLING if (cellinfo_of_cell(cell)->align_special.empty()) return cellinfo_of_cell(cell)->right_line; - return suffixIs(strip(cellinfo_of_cell(cell)->align_special), "|"); + return suffixIs(rtrim(cellinfo_of_cell(cell)->align_special), "|"); #else return cellinfo_of_cell(cell)->right_line; #endif @@ -503,7 +503,7 @@ bool LyXTabular::RightLine(int cell, bool onlycolumn) const #ifdef SPECIAL_COLUM_HANDLING if (column_info[column_of_cell(cell)].align_special.empty()) return column_info[right_column_of_cell(cell)].right_line; - return suffixIs(strip(column_info[column_of_cell(cell)].align_special), "|"); + return suffixIs(rtrim(column_info[column_of_cell(cell)].align_special), "|"); #else return column_info[right_column_of_cell(cell)].right_line; #endif diff --git a/src/toc.C b/src/toc.C index 7a307b0565..8c8c92dbca 100644 --- a/src/toc.C +++ b/src/toc.C @@ -44,7 +44,7 @@ string const TocItem::asString() const return string(4 * depth, ' ') + str; } - + void TocItem::goTo(LyXView & lv_) const { string const tmp = tostr(par->id()); @@ -92,7 +92,7 @@ TocList const getTocList(Buffer const * buf) par->asString(buf, true)); toclist["TOC"].push_back(item); } - + // For each paragraph, traverse its insets and look for // FLOAT_CODE Paragraph::inset_iterator it = par->inset_iterator_begin(); @@ -101,9 +101,9 @@ TocList const getTocList(Buffer const * buf) if ((*it)->lyxCode() == Inset::FLOAT_CODE) { InsetFloat * il = static_cast(*it); - il->addToToc(toclist, buf); + il->addToToc(toclist, buf); } - } + } par = par->next(); } @@ -142,4 +142,3 @@ void asciiTocList(string const & type, Buffer const * buffer, ostream & os) } // namespace toc - diff --git a/src/vc-backend.C b/src/vc-backend.C index a998ac85c4..429014c026 100644 --- a/src/vc-backend.C +++ b/src/vc-backend.C @@ -107,7 +107,7 @@ void RCS::scanMaster() // get version here string tmv; ifs >> tmv; - tmv = strip(tmv, ";"); + tmv = rtrim(tmv, ";"); version_ = tmv; lyxerr[Debug::LYXVC] << "LyXVC: version found to be " << tmv << endl; @@ -127,7 +127,7 @@ void RCS::scanMaster() string s2; do { ifs >> tmpt; - s1 = strip(tmpt, ";"); + s1 = rtrim(tmpt, ";"); // tmp is now in the format : s1 = split(s1, s2, ':'); // s2 is user, and s1 is version @@ -265,7 +265,7 @@ void CVS::scanMaster() FileInfo fi(file_); // FIXME: must double check file is stattable/existing time_t mod = fi.getModificationTime(); - string mod_date = strip(asctime(gmtime(&mod)), "\n"); + string mod_date = rtrim(asctime(gmtime(&mod)), "\n"); lyxerr[Debug::LYXVC] << "Date in Entries: `" << file_date << "'\nModification date of file: `" diff --git a/src/vspace.C b/src/vspace.C index 18772db249..1444aa7de8 100644 --- a/src/vspace.C +++ b/src/vspace.C @@ -55,7 +55,7 @@ void lyx_advance(string & data, string::size_type n) inline bool isEndOfData(string const & data) { - return frontStrip(data).empty(); + return ltrim(data).empty(); } /** @@ -72,7 +72,7 @@ bool isEndOfData(string const & data) */ char nextToken(string & data) { - data = frontStrip(data); + data = ltrim(data); if (data.empty()) return '\0'; else if (data[0] == '+') { @@ -202,7 +202,7 @@ bool isValidGlueLength(string const & data, LyXGlueLength * result) if (data.empty()) return true; - string buffer = frontStrip(data); + string buffer = ltrim(data); // To make isValidGlueLength recognize negative values as // the first number this little hack is needed: @@ -346,7 +346,7 @@ VSpace::VSpace(string const & data) if (data.empty()) return; double value; - string input = strip(data); + string input = rtrim(data); string::size_type const length = input.length();