From: Jean-Marc Lasgouttes Date: Tue, 26 Sep 2000 13:10:34 +0000 (+0000) Subject: Various small fixes. Read Changelog X-Git-Tag: 1.6.10~21974 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=567e0d583fe716c2b3889f868e4902a6dfdab13a;p=features.git Various small fixes. Read Changelog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1040 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index dafb744228..665d509373 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2000-09-26 Jean-Marc Lasgouttes + + * src/buffer.C (readFile): make sure that the whole version number + is read after \lyxformat (even when it contains a comma) + + * lib/ui/default.ui: change shortcut of math menu to M-a. + +2000-09-25 Jean-Marc Lasgouttes + + * src/vspace.C (nextToken): use isStrDbl() to check for proper + double values. + + * src/LyXView.C (updateWindowTitle): show the full files name in + window title, limited to 30 characters. + + * src/support/lyxstring.C (lyxstring): fix it correctly this time. + When a number of characters has been given, we should not assume + that the string is 0-terminated. + + * src/intl.C (InitKeyMapper): remove a bunch of string::c_str() + calls (fixes some memory leaks) + + * src/intl.[Ch]: add a destructor for Intl, in order to delete the + trans member on exit. + +2000-09-22 Jean-Marc Lasgouttes + + * src/converter.C (GetReachable): fix typo. + + * src/lyxlex.C (GetFloat): rewrite to use strToDbl() and + understand ',' instead of '.'. + (GetInteger): rewrite to use strToInt(). + 2000-09-26 Juergen Vigna * src/frontends/xforms/FormParagraph.C: fixed de/activation of fields, diff --git a/lib/ui/default.ui b/lib/ui/default.ui index bf9f6ce932..3c655137b2 100644 --- a/lib/ui/default.ui +++ b/lib/ui/default.ui @@ -12,7 +12,7 @@ Menuset Submenu "Refs|R" "refs" Submenu "Layout|L" "layout" Submenu "Insert|I" "insert" - Submenu "Math|M" "math" + Submenu "Math|a" "math" Submenu "Options|O" "options" Submenu "Documents|D" "documents" Submenu "Help|H" "help" diff --git a/po/POTFILES.in b/po/POTFILES.in index 325bf1569c..97bca017d1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -57,6 +57,8 @@ src/frontends/xforms/FormGraphics.C src/frontends/xforms/form_graphics.C src/frontends/xforms/FormIndex.C src/frontends/xforms/form_index.C +src/frontends/xforms/FormParagraph.C +src/frontends/xforms/form_paragraph.C src/frontends/xforms/FormPreferences.C src/frontends/xforms/form_preferences.C src/frontends/xforms/FormPrint.C diff --git a/src/LyXView.C b/src/LyXView.C index 4fc8f999b5..ecba3b8bb8 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -453,7 +453,7 @@ void LyXView::updateWindowTitle() if (view()->available()) { string cur_title = buffer()->fileName(); if (!cur_title.empty()){ - title += ": " + MakeDisplayPath(cur_title); + title += ": " + MakeDisplayPath(cur_title, 30); if (!buffer()->isLyxClean()) title += _(" (Changed)"); if (buffer()->isReadonly()) diff --git a/src/buffer.C b/src/buffer.C index 486030271e..37b16e5bda 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1092,7 +1092,7 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par) lex.next(); string token(lex.GetString()); if (token == "\\lyxformat") { // the first token _must_ be... - lex.next(); + lex.EatLine(); format = lex.GetFloat(); if (format > 1) { if (LYX_FORMAT - format > 0.05) { diff --git a/src/converter.C b/src/converter.C index c16f8a083b..c964d685c9 100644 --- a/src/converter.C +++ b/src/converter.C @@ -246,7 +246,7 @@ Converter::GetReachable(string const & from, bool only_viewable) name += ":" + (*it).from; string tmp; split((*it).command, tmp, ' '); - prettyname += _("(using ") + tmp + ")"; + prettyname += _(" (using ") + tmp + ")"; } if (!only_viewable || !format->viewer.empty()) result.push_back(pair(name, prettyname)); diff --git a/src/ext_l10n.h b/src/ext_l10n.h index 9f82efc742..5b23fc4886 100644 --- a/src/ext_l10n.h +++ b/src/ext_l10n.h @@ -4,7 +4,7 @@ _("Toc|T"); _("Refs|R"); _("Layout|L"); _("Insert|I"); -_("Math|M"); +_("Math|a"); _("Options|O"); _("Documents|D"); _("Help|H"); diff --git a/src/intl.C b/src/intl.C index a3b93fe55b..c6292d7ddc 100644 --- a/src/intl.C +++ b/src/intl.C @@ -48,6 +48,11 @@ Intl::Intl() otherkeymap = 0; } +Intl::~Intl() +{ + delete trans; +} + int Intl::SetPrimary(string const & lang) { @@ -274,22 +279,22 @@ void Intl::InitKeyMapper(bool on) Language2->addto("default"); for (Languages::const_iterator cit = languages.begin(); cit != languages.end(); ++cit) { - Language->addto((*cit).second.lang().c_str()); - Language2->addto((*cit).second.lang().c_str()); + Language->addto((*cit).second.lang()); + Language2->addto((*cit).second.lang()); ++n; } Language->addto(_("other...")); Language2->addto(_("other...")); otherkeymap = n + 1; - if (!Language->select_text(prim_lang.c_str())) { + if (!Language->select_text(prim_lang)) { Language->select(n+1); fl_set_input(fd_form_keymap->OtherKeymap, prim_lang.c_str()); } else trans->SetPrimary(prim_lang); - if (!Language2->select_text(sec_lang.c_str())) { + if (!Language2->select_text(sec_lang)) { Language2->select(n + 1); fl_set_input(fd_form_keymap->OtherKeymap2, sec_lang.c_str()); } @@ -300,7 +305,7 @@ void Intl::InitKeyMapper(bool on) if (keymapon) Keymap(23); // turn primary on - trans->setCharset(lyxrc.font_norm.c_str()); + trans->setCharset(lyxrc.font_norm); } diff --git a/src/intl.h b/src/intl.h index f6a7caa1db..b30d41de83 100644 --- a/src/intl.h +++ b/src/intl.h @@ -32,6 +32,8 @@ class Intl { public: /// Intl(); + /// + ~Intl(); /// show key mapping dialog void MenuKeymap(); diff --git a/src/lyxlex.C b/src/lyxlex.C index 7bb8ea59c2..9c23930a74 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -20,6 +20,7 @@ #include "lyxlex.h" #include "lyxlex_pimpl.h" #include "support/filetools.h" +#include "support/lstrings.h" using std::ostream; using std::istream; @@ -111,8 +112,8 @@ int LyXLex::lex() int LyXLex::GetInteger() const { - if (pimpl_->buff[0] > ' ') - return atoi(pimpl_->buff); + if (isStrInt(pimpl_->GetString())) + return strToInt(pimpl_->GetString()); else { pimpl_->printError("Bad integer `$$Token'"); return -1; @@ -122,12 +123,16 @@ int LyXLex::GetInteger() const float LyXLex::GetFloat() const { - if (pimpl_->buff[0] > ' ') - return atof(pimpl_->buff); - else { - pimpl_->printError("Bad float `$$Token'"); - return -1; - } + // replace comma with dot in case the file was written with + // the wrong locale (should be rare, but is easy enough to + // avoid). + string str = subst(pimpl_->GetString(), ",", "."); + if (isStrDbl(str)) + return strToDbl(str); + else { + pimpl_->printError("Bad float `$$Token'"); + return -1; + } } diff --git a/src/support/lyxstring.C b/src/support/lyxstring.C index a15cac0f37..ce010fad4c 100644 --- a/src/support/lyxstring.C +++ b/src/support/lyxstring.C @@ -415,11 +415,7 @@ lyxstring::lyxstring(value_type const * s, size_type n) Assert(s && n < npos); // STD! static Srep empty_rep(0, ""); if (*s && n) { // s is not empty string and n > 0 - size_type l = 0; - while (l < n && s[l]) - l++; - rep = new Srep(l, s); - // rep = new Srep(min(strlen(s),n), s); + rep = new Srep(n, s); } else { ++empty_rep.ref; rep = &empty_rep; diff --git a/src/vspace.C b/src/vspace.C index 392b80c102..38d2eda026 100644 --- a/src/vspace.C +++ b/src/vspace.C @@ -93,9 +93,8 @@ char nextToken(string & data) if ((i = data.find_last_of("0123456789.")) != string::npos) { if (number_index > 3) return 'E'; // Error string buffer = data.substr(0, i + 1); - double x = strToDbl(buffer); - if (x || (buffer[0] == '0')) { - number[number_index] = x; + if (isStrDbl(buffer)) { + number[number_index] = strToDbl(buffer); lyx_advance(data, i + 1); ++number_index; return 'n';