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>
* src/frontends/xforms/FormParagraph.C: fixed de/activation of fields,

View File

@ -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"

View File

@ -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

View File

@ -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())

View File

@ -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) {

View File

@ -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<string,string>(name, prettyname));

View File

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

View File

@ -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);
}

View File

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

View File

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

View File

@ -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;

View File

@ -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';