Various small fixes. Read Changelog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1040 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-09-26 13:10:34 +00:00
parent 26568c8786
commit 567e0d583f
12 changed files with 68 additions and 26 deletions

View File

@ -1,3 +1,36 @@
2000-09-26 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* 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 <Jean-Marc.Lasgouttes@inria.fr>
* 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 <Jean-Marc.Lasgouttes@inria.fr>
* 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 <jug@sad.it> 2000-09-26 Juergen Vigna <jug@sad.it>
* src/frontends/xforms/FormParagraph.C: fixed de/activation of fields, * src/frontends/xforms/FormParagraph.C: fixed de/activation of fields,

View File

@ -12,7 +12,7 @@ Menuset
Submenu "Refs|R" "refs" Submenu "Refs|R" "refs"
Submenu "Layout|L" "layout" Submenu "Layout|L" "layout"
Submenu "Insert|I" "insert" Submenu "Insert|I" "insert"
Submenu "Math|M" "math" Submenu "Math|a" "math"
Submenu "Options|O" "options" Submenu "Options|O" "options"
Submenu "Documents|D" "documents" Submenu "Documents|D" "documents"
Submenu "Help|H" "help" Submenu "Help|H" "help"

View File

@ -57,6 +57,8 @@ src/frontends/xforms/FormGraphics.C
src/frontends/xforms/form_graphics.C src/frontends/xforms/form_graphics.C
src/frontends/xforms/FormIndex.C src/frontends/xforms/FormIndex.C
src/frontends/xforms/form_index.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/FormPreferences.C
src/frontends/xforms/form_preferences.C src/frontends/xforms/form_preferences.C
src/frontends/xforms/FormPrint.C src/frontends/xforms/FormPrint.C

View File

@ -453,7 +453,7 @@ void LyXView::updateWindowTitle()
if (view()->available()) { if (view()->available()) {
string cur_title = buffer()->fileName(); string cur_title = buffer()->fileName();
if (!cur_title.empty()){ if (!cur_title.empty()){
title += ": " + MakeDisplayPath(cur_title); title += ": " + MakeDisplayPath(cur_title, 30);
if (!buffer()->isLyxClean()) if (!buffer()->isLyxClean())
title += _(" (Changed)"); title += _(" (Changed)");
if (buffer()->isReadonly()) if (buffer()->isReadonly())

View File

@ -1092,7 +1092,7 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par)
lex.next(); lex.next();
string token(lex.GetString()); string token(lex.GetString());
if (token == "\\lyxformat") { // the first token _must_ be... if (token == "\\lyxformat") { // the first token _must_ be...
lex.next(); lex.EatLine();
format = lex.GetFloat(); format = lex.GetFloat();
if (format > 1) { if (format > 1) {
if (LYX_FORMAT - format > 0.05) { if (LYX_FORMAT - format > 0.05) {

View File

@ -246,7 +246,7 @@ Converter::GetReachable(string const & from, bool only_viewable)
name += ":" + (*it).from; name += ":" + (*it).from;
string tmp; string tmp;
split((*it).command, tmp, ' '); split((*it).command, tmp, ' ');
prettyname += _("(using ") + tmp + ")"; prettyname += _(" (using ") + tmp + ")";
} }
if (!only_viewable || !format->viewer.empty()) if (!only_viewable || !format->viewer.empty())
result.push_back(pair<string,string>(name, prettyname)); result.push_back(pair<string,string>(name, prettyname));

View File

@ -4,7 +4,7 @@ _("Toc|T");
_("Refs|R"); _("Refs|R");
_("Layout|L"); _("Layout|L");
_("Insert|I"); _("Insert|I");
_("Math|M"); _("Math|a");
_("Options|O"); _("Options|O");
_("Documents|D"); _("Documents|D");
_("Help|H"); _("Help|H");

View File

@ -48,6 +48,11 @@ Intl::Intl()
otherkeymap = 0; otherkeymap = 0;
} }
Intl::~Intl()
{
delete trans;
}
int Intl::SetPrimary(string const & lang) int Intl::SetPrimary(string const & lang)
{ {
@ -274,22 +279,22 @@ void Intl::InitKeyMapper(bool on)
Language2->addto("default"); Language2->addto("default");
for (Languages::const_iterator cit = languages.begin(); for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); ++cit) { cit != languages.end(); ++cit) {
Language->addto((*cit).second.lang().c_str()); Language->addto((*cit).second.lang());
Language2->addto((*cit).second.lang().c_str()); Language2->addto((*cit).second.lang());
++n; ++n;
} }
Language->addto(_("other...")); Language->addto(_("other..."));
Language2->addto(_("other...")); Language2->addto(_("other..."));
otherkeymap = n + 1; otherkeymap = n + 1;
if (!Language->select_text(prim_lang.c_str())) { if (!Language->select_text(prim_lang)) {
Language->select(n+1); Language->select(n+1);
fl_set_input(fd_form_keymap->OtherKeymap, prim_lang.c_str()); fl_set_input(fd_form_keymap->OtherKeymap, prim_lang.c_str());
} }
else else
trans->SetPrimary(prim_lang); trans->SetPrimary(prim_lang);
if (!Language2->select_text(sec_lang.c_str())) { if (!Language2->select_text(sec_lang)) {
Language2->select(n + 1); Language2->select(n + 1);
fl_set_input(fd_form_keymap->OtherKeymap2, sec_lang.c_str()); fl_set_input(fd_form_keymap->OtherKeymap2, sec_lang.c_str());
} }
@ -300,7 +305,7 @@ void Intl::InitKeyMapper(bool on)
if (keymapon) if (keymapon)
Keymap(23); // turn primary on Keymap(23); // turn primary on
trans->setCharset(lyxrc.font_norm.c_str()); trans->setCharset(lyxrc.font_norm);
} }

View File

@ -32,6 +32,8 @@ class Intl {
public: public:
/// ///
Intl(); Intl();
///
~Intl();
/// show key mapping dialog /// show key mapping dialog
void MenuKeymap(); void MenuKeymap();

View File

@ -20,6 +20,7 @@
#include "lyxlex.h" #include "lyxlex.h"
#include "lyxlex_pimpl.h" #include "lyxlex_pimpl.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lstrings.h"
using std::ostream; using std::ostream;
using std::istream; using std::istream;
@ -111,8 +112,8 @@ int LyXLex::lex()
int LyXLex::GetInteger() const int LyXLex::GetInteger() const
{ {
if (pimpl_->buff[0] > ' ') if (isStrInt(pimpl_->GetString()))
return atoi(pimpl_->buff); return strToInt(pimpl_->GetString());
else { else {
pimpl_->printError("Bad integer `$$Token'"); pimpl_->printError("Bad integer `$$Token'");
return -1; return -1;
@ -122,12 +123,16 @@ int LyXLex::GetInteger() const
float LyXLex::GetFloat() const float LyXLex::GetFloat() const
{ {
if (pimpl_->buff[0] > ' ') // replace comma with dot in case the file was written with
return atof(pimpl_->buff); // the wrong locale (should be rare, but is easy enough to
else { // avoid).
pimpl_->printError("Bad float `$$Token'"); string str = subst(pimpl_->GetString(), ",", ".");
return -1; if (isStrDbl(str))
} return strToDbl(str);
else {
pimpl_->printError("Bad float `$$Token'");
return -1;
}
} }

View File

@ -415,11 +415,7 @@ lyxstring::lyxstring(value_type const * s, size_type n)
Assert(s && n < npos); // STD! Assert(s && n < npos); // STD!
static Srep empty_rep(0, ""); static Srep empty_rep(0, "");
if (*s && n) { // s is not empty string and n > 0 if (*s && n) { // s is not empty string and n > 0
size_type l = 0; rep = new Srep(n, s);
while (l < n && s[l])
l++;
rep = new Srep(l, s);
// rep = new Srep(min(strlen(s),n), s);
} else { } else {
++empty_rep.ref; ++empty_rep.ref;
rep = &empty_rep; rep = &empty_rep;

View File

@ -93,9 +93,8 @@ char nextToken(string & data)
if ((i = data.find_last_of("0123456789.")) != string::npos) { if ((i = data.find_last_of("0123456789.")) != string::npos) {
if (number_index > 3) return 'E'; // Error if (number_index > 3) return 'E'; // Error
string buffer = data.substr(0, i + 1); string buffer = data.substr(0, i + 1);
double x = strToDbl(buffer); if (isStrDbl(buffer)) {
if (x || (buffer[0] == '0')) { number[number_index] = strToDbl(buffer);
number[number_index] = x;
lyx_advance(data, i + 1); lyx_advance(data, i + 1);
++number_index; ++number_index;
return 'n'; return 'n';