mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 16:31:13 +00:00
patch from Dekel, change lyxformat to int
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1313 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4e839f35c6
commit
716cd578ae
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
||||
2001-01-11 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/buffer.h: change format to int, and change name to file_format
|
||||
|
||||
* src/buffer.C: change LYX_FORMAT to int, and bump version number
|
||||
to 218.
|
||||
(readLyXformat2): handle it
|
||||
handle it
|
||||
(readFile): handle it
|
||||
(writeFile): handle it
|
||||
|
||||
2001-01-10 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* src/insets/insettext.C (LocalDispatch): Add handling of
|
||||
LFUN_BREAKPARAGRAPHKEEPLAYOUT.
|
||||
|
||||
2001-01-10 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/tabular.C (Write): write lowercase identifiers
|
||||
|
63
src/buffer.C
63
src/buffer.C
@ -113,7 +113,11 @@ extern BufferList bufferlist;
|
||||
extern LyXAction lyxaction;
|
||||
|
||||
|
||||
#if 0
|
||||
static const float LYX_FORMAT = 2.17;
|
||||
#else
|
||||
static const int LYX_FORMAT = 218;
|
||||
#endif
|
||||
|
||||
extern int tex_code_break_column;
|
||||
|
||||
@ -248,9 +252,13 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
|
||||
LyXParagraph * return_par = 0;
|
||||
LyXFont font(LyXFont::ALL_INHERIT, params.language);
|
||||
#if 0
|
||||
if (format < 2.16 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
|
||||
#else
|
||||
if (file_format < 216 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
#endif
|
||||
// If we are inserting, we cheat and get a token in advance
|
||||
bool has_token = false;
|
||||
string pretoken;
|
||||
@ -365,8 +373,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
#endif
|
||||
par->depth = depth;
|
||||
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
||||
#if 0
|
||||
if (format < 2.16 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
#else
|
||||
if (file_format < 216 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
#endif
|
||||
#ifndef NEW_INSETS
|
||||
} else if (token == "\\end_float") {
|
||||
if (!return_par)
|
||||
@ -381,8 +394,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
lex.EatLine();
|
||||
par->layout = LYX_DUMMY_LAYOUT;
|
||||
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
||||
#if 0
|
||||
if (format < 2.16 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
#else
|
||||
if (file_format < 216 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
#endif
|
||||
} else if (token == "\\begin_float") {
|
||||
int tmpret = lex.FindToken(string_footnotekinds);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
@ -1053,6 +1071,7 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par)
|
||||
string const token(lex.GetString());
|
||||
if (token == "\\lyxformat") { // the first token _must_ be...
|
||||
lex.EatLine();
|
||||
#if 0
|
||||
format = lex.GetFloat();
|
||||
if (format > 1.0) {
|
||||
if (LYX_FORMAT - format > 0.05) {
|
||||
@ -1085,6 +1104,44 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par)
|
||||
return false;
|
||||
}
|
||||
|
||||
#else
|
||||
string tmp_format = lex.GetString();
|
||||
//lyxerr << "LyX Format: `" << tmp_format << "'" << endl;
|
||||
// if present remove ".," from string.
|
||||
string::size_type dot = tmp_format.find_first_of(".,");
|
||||
//lyxerr << " dot found at " << dot << endl;
|
||||
if (dot != string::npos)
|
||||
tmp_format.erase(dot, 1);
|
||||
file_format = strToInt(tmp_format);
|
||||
if (file_format == LYX_FORMAT) {
|
||||
// current format
|
||||
} else if (file_format > LYX_FORMAT) {
|
||||
// future format
|
||||
WriteAlert(_("Warning!"),
|
||||
_("LyX file format is newer that what"),
|
||||
_("is supported in this LyX version. Expect some problems."));
|
||||
|
||||
} else if (file_format < LYX_FORMAT) {
|
||||
// old formats
|
||||
if (file_format < 200) {
|
||||
WriteAlert(_("ERROR!"),
|
||||
_("Old LyX file format found. "
|
||||
"Use LyX 0.10.x to read this!"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bool the_end = readLyXformat2(lex, par);
|
||||
setPaperStuff();
|
||||
// the_end was added in 213
|
||||
if (file_format < 213)
|
||||
the_end = true;
|
||||
|
||||
if (!the_end)
|
||||
WriteAlert(_("Warning!"),
|
||||
_("Reading of document is not complete"),
|
||||
_("Maybe the document is truncated"));
|
||||
return true;
|
||||
#endif
|
||||
} else { // "\\lyxformat" not found
|
||||
WriteAlert(_("ERROR!"), _("Not a LyX file!"));
|
||||
}
|
||||
@ -1225,6 +1282,7 @@ bool Buffer::writeFile(string const & fname, bool flag) const
|
||||
// write out a comment in the top of the file
|
||||
ofs << '#' << LYX_DOCVERSION
|
||||
<< " created this file. For more info see http://www.lyx.org/\n";
|
||||
#if 0
|
||||
ofs.setf(ios::showpoint|ios::fixed);
|
||||
ofs.precision(2);
|
||||
#ifndef HAVE_LOCALE
|
||||
@ -1233,6 +1291,9 @@ bool Buffer::writeFile(string const & fname, bool flag) const
|
||||
ofs << "\\lyxformat " << dummy_format << "\n";
|
||||
#else
|
||||
ofs << "\\lyxformat " << setw(4) << LYX_FORMAT << "\n";
|
||||
#endif
|
||||
#else
|
||||
ofs << "\\lyxformat" << LYX_FORMAT << "\n";
|
||||
#endif
|
||||
// now write out the buffer paramters.
|
||||
params.writeFile(ofs);
|
||||
|
@ -399,8 +399,11 @@ private:
|
||||
string filename;
|
||||
|
||||
/// Format number of buffer
|
||||
#if 0
|
||||
float format;
|
||||
|
||||
#else
|
||||
int file_format;
|
||||
#endif
|
||||
/** A list of views using this buffer.
|
||||
Why not keep a list of the BufferViews that use this buffer?
|
||||
|
||||
|
@ -991,6 +991,12 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
TEXT(bv)->BreakParagraph(bv, 0);
|
||||
UpdateLocal(bv, FULL, true);
|
||||
break;
|
||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
||||
if (!autoBreakRows)
|
||||
return DISPATCHED;
|
||||
TEXT(bv)->BreakParagraph(bv, 1);
|
||||
UpdateLocal(bv, FULL, true);
|
||||
break;
|
||||
case LFUN_BREAKLINE:
|
||||
if (!autoBreakRows)
|
||||
return DISPATCHED;
|
||||
|
Loading…
Reference in New Issue
Block a user