pos=string::npos for regex not found, use handcoded transform in lstring.C, fix the crash in Delete, move to pre ind/dec instead of post inc/dec, try to use ostream_iterator in lastfiles.C, remove some debug output, change the rest of the .cdef files, make display of umlaut better

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@443 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-01-24 18:34:46 +00:00
parent d07ed2ae94
commit d8b96c598c
54 changed files with 646 additions and 580 deletions

View File

@ -1,3 +1,31 @@
2000-01-24 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/LSubstring.C (LSubstring): set pos to string::npos
when regex was not found.
* src/support/lstrings.C (lowercase): use handcoded transform always.
(uppercase): ditto
* src/text.C (Delete): fixed the crash. cursor.par->prev and
old_cursor.par->prev could be 0.
* several files: changed post inc/dec to pre inc/dec
* src/lastfiles.C (writeFile): use ostream_iterator and copy to
write the lastfiles to file.
* src/BufferView.C (buffer): only show TextCache info when debugging
(buffer): ditto
(resizeCurrentBuffer): ditto
(workAreaExpose): ditto
* lib/kbd/iso8859-7.cdef: changed to new quoting scheme
* lib/kbd/iso8859-2.cdef: changed to new quoting scheme
* src/insets/insetlatexaccent.C (Draw): make the display of UMLAUT
a bit better by removing the special case for \i and \j.
2000-01-24 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyx_main.C (easyParse): remove test for bad comand line
@ -7,6 +35,7 @@
declared in header. On an alpha, long is _not_ the same as int.
* src/support/LOstream.h: add a "using std::flush;"
* src/insets/figinset.C: ditto.
2000-01-21 Lars Gullik Bjønnes <larsbj@lyx.org>

View File

@ -22,6 +22,10 @@ that you:
the code.
- take advantage of the C++ standard library.
- we use the preincrement operator whenever possible, it has potential
of beeing faster than postincrement. (same goes for decrement)
- we try to give variables minimal scope.
These guidelines should save us a lot of work while cleaning up the code and
help us to have quality code. LyX has been haunted by problems coming from
unfinished projects by people who have left the team. Those problems will

View File

@ -46,16 +46,21 @@ towards code quality:
o always try to use POSIX commands.
o switch to use POSIX signals
o make as much as possible of the code reentreanant(?)
should make it easier to move to threads later.
o signal slot mechanism (borrowed from GTK-- project)
better interface, leaner code, typesafe. I have
been using this for another project and it works
should make it easier to move to threads later. Albeit
this is not a huge goal we have some parts of the code
that would benefit from threads. (forking is not that
nice...)
o signal slot mechanism
We are going to use the signal/slot implementation
found in libsigc++. This will hopefully give us better
interface, leaner code, typesafe "callbacks". I have
been using signal/slots for other projects and it works
like a charm.
o other code rewrites to make multiple buffers/windows
possible, without too much hassle.
- get rid of most of the global variables.
- get rid of most of the global variables. In
perticular current_view is a problem.
- non shared variables in shared structures
(i.e. the cursor in the text class)
o make source documentation better. Remember that the better
we document LyX internals the easier is it for new
developers to begin working on LyX.
@ -74,6 +79,9 @@ Some other things related to structure and services in the code:
the processes can take place.
o pass an inforeceiver around in the object structure.
(this instead of passing minibuffers, and lyxerrors.)
o remove code that is never used, or close to never used.
Support for reverse video, fast selection and mono
video comes to mind.
================
@ -143,7 +151,10 @@ to make it into 0.14:
process.
o online configuration
So that users should not need to edit lyxrc
manualy
manualy. This has now been "half" done; it is now
possible to save the current configuration with the
lyx command "preferences-save". We need to add code so
that the preferences can be set from inside LyX too.
o better fontsupport
T1-lib font renderer.
o better latex code quality

View File

@ -4,98 +4,98 @@
# (c) 1996 by Petr Mejzlík, mejzlik@fi.muni.cz
# Modified by Asger Alstrup (not checked, but better)
161 "\\c{A}" # A cedilla
162 "\\u{}" # breve
163 "\\L{}" # L slash
161 "\c{A}" # A cedilla
162 "\u{}" # breve
163 "\L{}" # L slash
#164
165 "\\q{L}" # L caron
166 "\\'{S}" # S acute
167 "\\S{}" # section mark
168 "\\\"{}" # umlaut
169 "\\v{S}" # S caron
170 "\\c{S}" # S cedilla
171 "\\v{T}" # T caron
172 "\\'{Z}" # Z acute
173 "\\-{}" # dash
174 "\\v{Z}" # Z caron
175 "\\.{Z}" # Z dot
176 "\\r{}" # circle
177 "\\c{a}" # a cedilla
178 "\\k{}" #
179 "\\l{}" # l slash
180 "\\'{}" # acute
181 "\\q{l}" # l caron
182 "\\'{s}" # s acute
183 "\\v{}" # caron
184 "\\c{}" # cedilla
185 "\\v{s}" # s caron
186 "\\c{s}" # s cedilla
187 "\\q{t}" # t caron
188 "\\'{z}" # z acute
189 "\\H{}" #
190 "\\v{z}" # z caron
191 "\\.{z}" # z dot
192 "\\'{R}" # R acute
193 "\\'{A}" # A acute
194 "\\^{A}" # A circumflex
195 "\\u{A}" # A breve
196 "\\\"{A}" # A umlaut
197 "\\'{L}" # L acute
198 "\\'{C}" # C acute
199 "\\c{C}" # C cedilla
200 "\\v{C}" # C caron
201 "\\'{E}" # E acute
202 "\\k{E}"
203 "\\\"{E}" # E umlaut
204 "\\v{E}" # E caron
205 "\\'{I}" # I acute
206 "\\^{I}" # I circumflex
207 "\\v{D}" # D caron
208 "\\DH{}" #
209 "\\'{N}" # N acute
210 "\\v{N}" # N caron
211 "\\'{O}" # O acute
212 "\\^{O}" # O circumflex
213 "\\H{O}" #
214 "\\\"{O}" # O umlaut
215 "$\\times$"
216 "\\v{R}" # R caron
217 "\\r{U}" # U circle
218 "\\'{U}" # U acute
219 "\\H{U}" #
220 "\\\"{U}" # U umlaut
221 "\\'{Y}" # Y acute
222 "\\c{T}" # T cedilla
223 "\\ss{}" #
224 "\\'{r}" # r acute
225 "\\'{a}" # a acute
226 "\\^{a}" # a circumflex
227 "\\u{a}" # a breve
228 "\\\"{a}" # a umlaut
229 "\\'{l}" # l acute
230 "\\'{c}" # c acute
231 "\\c{c}" # c cedilla
232 "\\v{c}" # c caron
233 "\\'{e}" # e acute
234 "\\k{e}" #
235 "\\\"{e}" # e umlaut
236 "\\v{e}" # e caron
237 "\\'{\\i}" # i acute
238 "\\^{\\i}" # i circumflex
239 "\\q{d}" # d caron
240 "\\dh{}" #
241 "\\'{n}" # n acute
242 "\\v{n}" # n caron
243 "\\'{o}" # o acute
244 "\\^{o}" # o caron
245 "\\H{o}" #
246 "\\\"{o}" # o umlaut
247 "$\\div$"
248 "\\v{r}" # r caron
249 "\\r{u}" # u circle
250 "\\'{u}" # u acute
251 "\\H{u}" #
252 "\\\"{u}" # u umlaut
253 "\\'{y}" # y acute
254 "\\c{t}" # t cedilla
255 "\\.{}" # dot
165 "\q{L}" # L caron
166 "\'{S}" # S acute
167 "\S{}" # section mark
168 "\"{}" # umlaut
169 "\v{S}" # S caron
170 "\c{S}" # S cedilla
171 "\v{T}" # T caron
172 "\'{Z}" # Z acute
173 "\-{}" # dash
174 "\v{Z}" # Z caron
175 "\.{Z}" # Z dot
176 "\r{}" # circle
177 "\c{a}" # a cedilla
178 "\k{}" #
179 "\l{}" # l slash
180 "\'{}" # acute
181 "\q{l}" # l caron
182 "\'{s}" # s acute
183 "\v{}" # caron
184 "\c{}" # cedilla
185 "\v{s}" # s caron
186 "\c{s}" # s cedilla
187 "\q{t}" # t caron
188 "\'{z}" # z acute
189 "\H{}" # doubleacute or hungarian umlaut
190 "\v{z}" # z caron
191 "\.{z}" # z dot
192 "\'{R}" # R acute
193 "\'{A}" # A acute
194 "\^{A}" # A circumflex
195 "\u{A}" # A breve
196 "\"{A}" # A umlaut
197 "\'{L}" # L acute
198 "\'{C}" # C acute
199 "\c{C}" # C cedilla
200 "\v{C}" # C caron
201 "\'{E}" # E acute
202 "\k{E}"
203 "\"{E}" # E umlaut
204 "\v{E}" # E caron
205 "\'{I}" # I acute
206 "\^{I}" # I circumflex
207 "\v{D}" # D caron
208 "\DH{}" #
209 "\'{N}" # N acute
210 "\v{N}" # N caron
211 "\'{O}" # O acute
212 "\^{O}" # O circumflex
213 "\H{O}" #
214 "\"{O}" # O umlaut
215 "$\times$"
216 "\v{R}" # R caron
217 "\r{U}" # U circle
218 "\'{U}" # U acute
219 "\H{U}" #
220 "\"{U}" # U umlaut
221 "\'{Y}" # Y acute
222 "\c{T}" # T cedilla
223 "\ss{}" #
224 "\'{r}" # r acute
225 "\'{a}" # a acute
226 "\^{a}" # a circumflex
227 "\u{a}" # a breve
228 "\"{a}" # a umlaut
229 "\'{l}" # l acute
230 "\'{c}" # c acute
231 "\c{c}" # c cedilla
232 "\v{c}" # c caron
233 "\'{e}" # e acute
234 "\k{e}" #
235 "\"{e}" # e umlaut
236 "\v{e}" # e caron
237 "\'{\i}" # i acute
238 "\^{\i}" # i circumflex
239 "\q{d}" # d caron
240 "\dh{}" #
241 "\'{n}" # n acute
242 "\v{n}" # n caron
243 "\'{o}" # o acute
244 "\^{o}" # o caron
245 "\H{o}" #
246 "\"{o}" # o umlaut
247 "$\div$"
248 "\v{r}" # r caron
249 "\r{u}" # u circle
250 "\'{u}" # u acute
251 "\H{u}" #
252 "\"{u}" # u umlaut
253 "\'{y}" # y acute
254 "\c{t}" # t cedilla
255 "\.{}" # dot

View File

@ -4,15 +4,15 @@
# (c)1997 by Alkis Polyzotis, npoly@dbnet.ece.ntua.gr
#
182 "\\'{A}" # accented A
184 "\\'{E}" # accented E
185 "\\'{H}" # accented H
186 "\\'{I}" # accented I
188 "\\'{O}"
190 "\\'{Y}" # accented Upsilon
191 "\\'{V}" # accented Omega
192 "\\'{\\\"{\\i}}" # accented iota with dyalitika
192 "\\\"{\\'{\\i}}"
182 "\'{A}" # accented A
184 "\'{E}" # accented E
185 "\'{H}" # accented H
186 "\'{I}" # accented I
188 "\'{O}"
190 "\'{Y}" # accented Upsilon
191 "\'{V}" # accented Omega
192 "\'{\"{\i}}" # accented iota with dyalitika
192 "\"{\'{\i}}"
193 "A"
194 "B"
195 "G"
@ -38,14 +38,14 @@
215 "X"
216 "C"
217 "V"
218 "\\\"{I}"
219 "\\\"{Y}"
220 "\\'{a}" # accented alpha
221 "\\'{e}"
222 "\\'{h}"
223 "\\'{\\i}"
224 "\\'{\\\"{y}}"
224 "\\\"{\\'{y}}"
218 "\"{I}"
219 "\"{Y}"
220 "\'{a}" # accented alpha
221 "\'{e}"
222 "\'{h}"
223 "\'{\i}"
224 "\'{\"{y}}"
224 "\"{\'{y}}"
225 "a"
226 "b"
227 "g"
@ -71,8 +71,8 @@
247 "x"
248 "c"
249 "v"
250 "\\\"{\\i}"
251 "\\\"{y}"
252 "\\'{o}"
253 "\\'{y}"
254 "\\'{v}"
250 "\"{\i}"
251 "\"{y}"
252 "\'{o}"
253 "\'{y}"
254 "\'{v}"

View File

@ -212,7 +212,8 @@ void BufferView::buffer(Buffer * b)
buffer_->delUser(this);
// Put the old text into the TextCache.
textcache.push_back(text);
showTextCache("buffer");
if (lyxerr.debugging())
showTextCache("buffer");
// delete text;
text = 0;
}
@ -254,7 +255,8 @@ void BufferView::buffer(Buffer * b)
updateScrollbar();
fl_redraw_object(work_area);
// Also remove all remaining text's from the testcache.
showTextCache("buffer delete all");
if (lyxerr.debugging())
showTextCache("buffer delete all");
while (!textcache.empty()) {
LyXText * tt = textcache.front();
textcache.erase(textcache.begin());
@ -431,7 +433,8 @@ int BufferView::resizeCurrentBuffer()
text = *it;
// take it out of textcache.
textcache.erase(it);
showTextCache("resizeCurrentBuffer");
if (lyxerr.debugging())
showTextCache("resizeCurrentBuffer");
} else {
text = new LyXText(work_area->w, buffer_);
}
@ -1407,7 +1410,8 @@ int BufferView::workAreaExpose()
bufferlist.resize();
// Remove all texts from the textcache
showTextCache("Expose delete all");
if (lyxerr.debugging())
showTextCache("Expose delete all");
while(!textcache.empty()) {
LyXText * tt = textcache.front();
textcache.erase(textcache.begin());

View File

@ -4,8 +4,8 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
*
* ====================================================== */

View File

@ -109,7 +109,7 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
FontInfo * fi = new FontInfo();
fontinfo[family][series][shape] = fi;
for (int cfam = 0; cfam < 2; cfam++) {
for (int cfam = 0; cfam < 2; ++cfam) {
// Determine family name
switch (family) {
case LyXFont::ROMAN_FAMILY:
@ -136,7 +136,7 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
default: ;
}
for (int cser = 0; cser < 4; cser++) {
for (int cser = 0; cser < 4; ++cser) {
// Determine series name
switch (series) {
case LyXFont::MEDIUM_SERIES:
@ -159,7 +159,7 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
default: ;
}
for (int csha = 0; csha < 2; csha++) {
for (int csha = 0; csha < 2; ++csha) {
// Determine shape name
switch (shape) {
case LyXFont::UP_SHAPE:

View File

@ -518,7 +518,7 @@ int LaTeX::scanLogFile(TeXErrors & terr)
<< "Desc: " << desc << '\n'
<< "Text: " << errstr << endl;
terr.insertError(line, desc, errstr);
num_errors++;
++num_errors;
}
} else {
// information messages, TeX warnings and other

View File

@ -122,7 +122,7 @@ int Literate::scanLiterateLogFile()
retval |= LATEX_ERROR;
lyxerr[Debug::LATEX] << "Build Error." << endl;
// this is not correct yet
num_errors++;
++num_errors;
}
}
return retval;
@ -151,7 +151,7 @@ int Literate::scanBuildLogFile()
retval |= LATEX_ERROR;
lyxerr[Debug::LATEX] << "Build Error." << endl;
// this is not correct yet
num_errors++;
++num_errors;
}
}
return retval;

View File

@ -325,7 +325,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
} else if (token == "\\layout") {
if (!return_par)
return_par = par;
@ -445,7 +445,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->start_of_appendix = true;
} else if (token == "\\paragraph_separation") {
tmpret = lex.FindToken(string_paragraph_separation);
if (tmpret == -1) tmpret++;
if (tmpret == -1) ++tmpret;
if (tmpret != LYX_LAYOUT_DEFAULT)
params.paragraph_separation =
static_cast<BufferParams::PARSEP>(tmpret);
@ -465,7 +465,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
params.readGraphicsDriver(lex);
} else if (token == "\\quotes_language") {
tmpret = lex.FindToken(string_quotes_language);
if (tmpret == -1) tmpret++;
if (tmpret == -1) ++tmpret;
if (tmpret != LYX_LAYOUT_DEFAULT) {
InsetQuotes::quote_language tmpl =
InsetQuotes::EnglishQ;
@ -511,13 +511,13 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
tmpret = lex.FindToken(string_oldpapersize);
#endif
if (tmpret == -1)
tmpret++;
++tmpret;
else
params.papersize2 = tmpret;
} else if (token == "\\paperpackage") {
tmpret = lex.FindToken(string_paperpackages);
if (tmpret == -1) {
tmpret++;
++tmpret;
params.paperpackage = BufferParams::PACKAGE_NONE;
} else
params.paperpackage = tmpret;
@ -529,7 +529,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
params.use_amsmath = lex.GetInteger();
} else if (token == "\\paperorientation") {
tmpret = lex.FindToken(string_orientation);
if (tmpret == -1) tmpret++;
if (tmpret == -1) ++tmpret;
if (tmpret != LYX_LAYOUT_DEFAULT)
params.orientation = static_cast<BufferParams::PAPER_ORIENTATION>(tmpret);
} else if (token == "\\paperwidth") {
@ -701,7 +701,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
font.setLyXColor(lex.GetString());
} else if (token == "\\align") {
tmpret = lex.FindToken(string_align);
if (tmpret == -1) tmpret++;
if (tmpret == -1) ++tmpret;
if (tmpret != LYX_LAYOUT_DEFAULT) { // tmpret != 99 ???
tmpret2 = 1;
for (; tmpret > 0; --tmpret)
@ -751,7 +751,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
#if 0 // should not be used any more
} else if (tmptok == "Latex") {
// This one is on its way out
@ -774,7 +774,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
#endif
#if 0 // should not be used any more
} else if (tmptok == "LatexDel") {
@ -852,7 +852,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
#endif
} else if (tmptok == "\\i") {
inset = new InsetLatexAccent;
@ -860,28 +860,28 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
} else if (tmptok == "FormulaMacro") {
inset = new InsetFormulaMacro;
inset->Read(lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
} else if (tmptok == "Formula") {
inset = new InsetFormula;
inset->Read(lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
} else if (tmptok == "Figure") {
inset = new InsetFig(100, 100, this);
inset->Read(lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
#if 0
} else if (tmptok == "Label") {
// Kept for compability. Remove in 0.13.
@ -893,7 +893,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
}
#endif
} else if (tmptok == "Info") {
@ -902,14 +902,14 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
} else if (tmptok == "Include") {
inset = new InsetInclude(string(), this);
inset->Read(lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
pos++;
++pos;
} else if (tmptok == "LatexCommand") {
InsetCommand inscmd;
inscmd.Read(lex);
@ -1277,12 +1277,12 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
if (depth != par->depth) {
if (par->depth > depth) {
while (par->depth > depth) {
depth++;
++depth;
}
}
else {
while (par->depth < depth) {
depth--;
--depth;
}
}
}
@ -1450,7 +1450,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
case LyXParagraph::META_NEWLINE:
if (par->table) {
if (par->table->NumberOfCellsInRow(actcell) <= cell) {
for(j = actpos; j < clen[cell-1];j++)
for(j = actpos; j < clen[cell - 1]; ++j)
ofs << ' ';
ofs << " |\n";
for(j = 0; j < depth; ++j)
@ -2618,7 +2618,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
// "TeX"-Mode on == > SGML-Mode on.
if (c!= '\0')
os << c; // see LaTeX-Generation...
char_line_count++;
++char_line_count;
} else if (c == LyXParagraph::META_INSET) {
inset = par->GetInset(i);
string tmp_out;
@ -2633,7 +2633,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
// non-breaking characters
// char is ' '
if (desc_on == 1) {
char_line_count++;
++char_line_count;
linux_doc_line_break(os, char_line_count, 6);
os << "</tag>";
desc_on = 2;
@ -3013,7 +3013,7 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
char_line_count = depth;
if(!style.free_spacing)
for (j= 0;j< depth;j++)
for (j = 0; j < depth; ++j)
file += ' ';
/* parsing main loop */
@ -3062,7 +3062,7 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
// "TeX"-Mode on ==> SGML-Mode on.
if (c!= '\0')
file += c;
char_line_count++;
++char_line_count;
}
else {
string sgml_string;
@ -3072,7 +3072,7 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
// non-breaking characters
// char is ' '
if (desc_on == 1) {
char_line_count++;
++char_line_count;
file += '\n';
file += "</term><listitem><para>";
desc_on = 2;
@ -3488,7 +3488,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
c = par->GetChar(i);
if (par->table->IsContRow(cell)) {
if (c == LyXParagraph::META_NEWLINE)
cell++;
++cell;
continue;
}
font2 = par->GetFontSettings(i);
@ -3524,7 +3524,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
if (par->table->CellHasContRow(cell)>= 0)
par->RoffContTableRows(ofs, i+1, cell);
par->table->RoffEndOfCell(ofs, cell);
cell++;
++cell;
break;
case LyXParagraph::META_HFILL:
break;
@ -3809,7 +3809,7 @@ string Buffer::getIncludeonlyList(char delim)
lst += ChangeExtension(insetinc->getContents(), string(), true);
}
}
pos++;
++pos;
}
par = par->next;
}
@ -3836,12 +3836,12 @@ string Buffer::getReferenceList(char delim)
while (par){
pos = -1;
while ((inset = par->ReturnNextInsetPointer(pos))){
for (int i = 0; i < inset->GetNumberOfLabels(); i++) {
for (int i = 0; i < inset->GetNumberOfLabels(); ++i) {
if (!lst.empty())
lst += delim;
lst += inset->getLabel(i);
}
pos++;
++pos;
}
par = par->next;
}
@ -3893,7 +3893,7 @@ string Buffer::getBibkeyList(char delim)
bibkeys += bk;
}
}
pos++;
++pos;
}
par = par->next;
}
@ -3918,7 +3918,7 @@ bool BufferView::gotoLabel(string const & label)
while (par) {
pos = -1;
while ((inset = par->ReturnNextInsetPointer(pos))){
for (int i = 0; i < inset->GetNumberOfLabels(); i++) {
for (int i = 0; i < inset->GetNumberOfLabels(); ++i) {
if (label == inset->getLabel(i)) {
beforeChange();
text->SetCursor(par, pos);
@ -3927,7 +3927,7 @@ bool BufferView::gotoLabel(string const & label)
return true;
}
}
pos++;
++pos;
}
par = par->next;
}

View File

@ -49,7 +49,7 @@ struct DEPCLEAN {
///
string master;
///
DEPCLEAN *next;
DEPCLEAN * next;
};
/** The buffer object.
@ -249,7 +249,7 @@ public:
void setParentName(string const &);
/// Is buffer read-only?
bool isReadonly() { return read_only; }
bool isReadonly() const { return read_only; }
/// Set buffer read-only flag
void setReadonly(bool flag = true) {

View File

@ -52,7 +52,7 @@ BufferParams::BufferParams()
sides = LyXTextClass::OneSide;
columns = 1;
pagestyle = "default";
for(int iter = 0; iter < 4; iter++) {
for(int iter = 0; iter < 4; ++iter) {
user_defined_bullets[iter] = temp_bullets[iter]
= ITEMIZE_DEFAULTS[iter];
}

View File

@ -127,7 +127,7 @@ void Combox::addline(char const* text)
bool Combox::select_text(char const* t)
{
if (!browser || !t) return false;
for (int i= 1; i<= fl_get_browser_maxline(browser); i++) {
for (int i = 1; i <= fl_get_browser_maxline(browser); ++i) {
if (!strcmp(t, fl_get_browser_line(browser, i))) {
select(i);
return true;

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
#ifndef _CREDITS_H
#define _CREDITS_H
#ifndef CREDITS_H
#define CREDITS_H
void ShowCredits();
void ShowCopyright();

View File

@ -876,7 +876,7 @@ void sigchldchecker(pid_t pid, int * status)
p->broken = true;
}
makeupdatelist(bitmaps[i]);
gsrunning--;
--gsrunning;
runqueue();
pid_handled = true;
}

View File

@ -4,8 +4,8 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1999 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* ====================================================== */

View File

@ -118,12 +118,12 @@ void InsetCommand::scanCommand(string const & cmd)
if (nestdepth == 0) {
state = WS;
} else {
nestdepth--;
--nestdepth;
}
}
if ((state == Option && c == '[') ||
(state == Content && c == '{')) {
nestdepth++;
++nestdepth;
}
switch (state) {
case Command: tcommand += c; break;

View File

@ -32,6 +32,7 @@ InsetLatexAccent::InsetLatexAccent()
}
#if 0 // the compiler generated version should be ok.
InsetLatexAccent::InsetLatexAccent(InsetLatexAccent const & other)
: Inset(), contents(other.contents),
candisp(other.candisp),
@ -41,7 +42,7 @@ InsetLatexAccent::InsetLatexAccent(InsetLatexAccent const & other)
plusdesc(other.plusdesc),
ic(other.ic)
{}
#endif
InsetLatexAccent::InsetLatexAccent(string const & string)
: contents(string)
@ -289,7 +290,7 @@ int InsetLatexAccent::Descent(LyXFont const & font) const
if (candisp) {
if (ic == ' ')
max = font.descent('a');
else
else
max = font.descent(ic);
if (plusdesc)
max += 3;
@ -549,27 +550,23 @@ void InsetLatexAccent::Draw(LyXFont font,
}
case UMLAUT: // umlaut
{
float tmpadd = y;
tmpadd += (remdot) ?
asc / 3.0 :
asc / 5.0; // if (remdot) -> i or j
float rad = hg / 2.0;
if (rad <= 1.0) {
scr.drawPoint(pgc,
int(x2 - ((4.0 * hg) / 7.0)),
tmpadd);
y);
scr.drawPoint(pgc,
int(x2 + ((4.0 * hg) / 7.0)),
tmpadd);
y);
} else {
rad += .5; // this ensures that f.ex. 1.5 will
// not be rounded down to .5 and then
// converted to int = 0
scr.fillArc(pgc, int(x2 - ((2.0 * hg) / 4.0)),
tmpadd,
y,
rad, rad, 0, 360*64);
scr.fillArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
tmpadd,
y,
rad, rad, 0, 360*64);
}
break;

View File

@ -33,8 +33,10 @@ public:
InsetLatexAccent();
///
InsetLatexAccent(string const & string);
#if 0 // the compiler generated version should be ok.
///
InsetLatexAccent(InsetLatexAccent const &);
#endif
///
int Ascent(LyXFont const & font) const;
///

View File

@ -4,7 +4,7 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1997-1999 LyX Team
* Copyright 1997-1999 LyX Team
*
* ====================================================== */

View File

@ -288,7 +288,7 @@ void Intl::InitKeyMapper(bool on)
else {
Language->addto(tex_babel[n]);
Language2->addto(tex_babel[n]);
n++;
++n;
}
Language->addto(_("other..."));

View File

@ -70,11 +70,23 @@ void LastFiles::writeFile(string const & filename) const
{
ofstream ofs(filename.c_str());
if (ofs) {
#if 0
for (Files::const_iterator cit = files.begin();
cit != files.end();
++cit) {
ofs << (*cit) << '\n';
}
#else
// Ok, ok. It is not required to do it this way...but it
// is kindo nice and shows the versiality of iterators and
// algorithms. I'll leave this in, and if I get reports
// about compilations errors I take it out again before
// 1.1.4. (Lgb)
using std::copy;
using std::ostream_iterator;
copy(files.begin(), files.end(),
ostream_iterator<string>(ofs, "\n"));
#endif
} else
lyxerr << "LyX: Warning: unable to save LastFiles: "
<< filename << endl;

View File

@ -3785,7 +3785,7 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
pos < (labeltype -
textclasslist.TextClass(current_view->buffer()->
params.textclass).maxcounter()) * 4 + 2;
pos++)
++pos)
line[pos] = ' ';
// Then the labestring
@ -3793,8 +3793,8 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
string::size_type i = 0;
while (pos < 199 && i < par->labelstring.length()) {
line[pos] = par->labelstring[i];
i++;
pos++;
++i;
++pos;
}
}
@ -3807,7 +3807,7 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
c = par->GetChar(i);
if (isprint(c) || c >= 128) {
line[pos] = c;
pos++;
++pos;
}
++i;
}
@ -3897,7 +3897,7 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long)
#if FL_REVISION > 85
fl_addto_browser_chars(brow, refs.c_str());
int total_lines = fl_get_browser_maxline(brow);
for (int i = 1; i <= total_lines ; i++) {
for (int i = 1; i <= total_lines ; ++i) {
if (fl_get_browser_line(brow, i) == currentstr) {
topline = i;
break;
@ -3914,7 +3914,7 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long)
if (curr_ref.empty())
break;
fl_add_browser_line(brow, curr_ref.c_str());
ref_num++;
++ref_num;
}
#endif

View File

@ -156,12 +156,12 @@ void cb_select_phoneno(FL_OBJECT *, long)
char *buf = new char [strlen(line)+1];
strcpy(buf, line);
for(i = LEN_PHONE;(i>0) && (buf[i] == ' ');i--)
for(i = LEN_PHONE; (i > 0) && (buf[i] == ' '); --i)
;
buf[i+1] = 0;
for(i = LEN_PHONE+LEN_NAME+1;(i>LEN_PHONE) && (buf[i] == ' ');i--)
buf[i + 1] = 0;
for(i = LEN_PHONE + LEN_NAME + 1; (i > LEN_PHONE) && (buf[i] == ' '); --i)
;
buf[i+1] = 0;
buf[i + 1] = 0;
fl_set_input(fd_xsendfax->Input_Phone, buf);
fl_set_input(fd_xsendfax->Input_Name, buf+LEN_PHONE+1);
fl_set_input(fd_xsendfax->Input_Enterprise, buf+LEN_PHONE+LEN_NAME+2);
@ -183,7 +183,7 @@ void cb_add_phoneno(FL_OBJECT *, long )
if (!strlen(phone))
return;
char *buf = new char [50+strlen(enterprise)];
char * buf = new char [50 + strlen(enterprise)];
sprintf(buf, "%-*.*s %-*.*s %s",
LEN_PHONE, LEN_PHONE, phone,
@ -197,7 +197,7 @@ void cb_add_phoneno(FL_OBJECT *, long )
n = 0;
}
}
for(i = 1; i <= n; i++) {
for(i = 1; i <= n; ++i) {
line = fl_get_browser_line(fd_phonebook->browser, i);
if (!strncmp(buf, line, 46))
break;
@ -236,7 +236,7 @@ void cb_delete_phoneno(FL_OBJECT *, long )
n = 0;
}
}
for(i= 1;i<= n;i++) {
for(i = 1; i <= n; ++i) {
line = fl_get_browser_line(fd_phonebook->browser, i);
if (!strncmp(buf, line, 46))
break;
@ -270,7 +270,7 @@ void cb_save_phoneno(FL_OBJECT *, long )
n = 0;
}
}
for(i= 1;i<= n;i++) {
for(i = 1; i <= n; ++i) {
line = fl_get_browser_line(fd_phonebook->browser, i);
fprintf(fp, "%s\n", line);
}

View File

@ -679,7 +679,7 @@ int LyXFont::latexWriteStartChanges(string & file, LyXFont const & base) const
// If we didn't open an environment above, we open one here
if (!env) {
file += '{';
count++;
++count;
}
file += '\\';
file += LaTeXSizeNames[f.size()];

View File

@ -1049,7 +1049,7 @@ string LyXFunc::Dispatch(int ac,
if (sel == 0)
return string(); // illegal argument
sel--; // sel 1..., but layout 0...
--sel; // sel 1..., but layout 0...
// Pretend we got the name instead.
Dispatch(int(LFUN_LAYOUT),

View File

@ -436,7 +436,7 @@ public:
&& (IsNewline(0)
|| IsLineSeparator(0))){
Erase(0);
i++;
++i;
}
}
return i;
@ -448,7 +448,7 @@ public:
one (or more) paragraphs with the footnote, and finally
the a paragraph with the text after the footnote. Only the
first paragraph keeps information about layoutparameters, */
bool IsDummy() const{
bool IsDummy() const {
return (footnoteflag == LyXParagraph::NO_FOOTNOTE && previous
&& previous->footnoteflag != LyXParagraph::NO_FOOTNOTE);
}

View File

@ -401,7 +401,7 @@ LyXServer::~LyXServer()
// modified june 1999 by stefano@zool.su.se to send as many bye
// messages as there are clients, each with client's name.
string message;
for (int i= 0; i<numclients; i++) {
for (int i= 0; i<numclients; ++i) {
message = "LYXSRV:" + clients[i] + ":bye\n";
pipes.send(message);
}
@ -440,7 +440,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
string client;
while(*p && *p != ':')
client += char(*p++);
if(*p == ':') p++;
if(*p == ':') ++p;
if(!*p) return;
// --- 3. get function name ---
@ -453,7 +453,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
if(!server_only && *p == ':' && *(++p)) {
while(*p && *p != '\n')
arg += char(*p++);
if(*p) p++;
if(*p) ++p;
}
lyxerr[Debug::LYXSERVER]
@ -478,7 +478,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
int i= 0; //find place in clients[]
while (!serv->clients[i].empty()
&& i<serv->numclients)
i++;
++i;
serv->clients[i] = client;
serv->numclients++;
buf = "LYXSRV:" + client + ":hello\n";
@ -489,11 +489,11 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
} else if (cmd == "bye") {
// If clients == 0 maybe we should reset the pipes
// to prevent fake callbacks
int i; //look if client is registered
for (i= 0; i<serv->numclients; i++) {
int i = 0; //look if client is registered
for (; i < serv->numclients; ++i) {
if (serv->clients[i] == client) break;
}
if (i<serv->numclients) {
if (i < serv->numclients) {
serv->numclients--;
serv->clients[i].clear();
lyxerr[Debug::LYXSERVER]

View File

@ -900,13 +900,13 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
short type = par->GetType();
bool oldf = (type == LM_OT_PARN || type == LM_OT_MPARN);
if (oldf) {
type--;
--type;
if (!label.empty()) {
label.clear();
}
current_view->owner()->getMiniBuffer()->Set(_("No number"));
} else {
type++;
++type;
current_view->owner()->getMiniBuffer()->Set(_("Number"));
}
par->SetType(type);

View File

@ -974,7 +974,7 @@ XPoint * MathedCursor::SelGetArea(int & np)
np = i;
// lyxerr << "AN[" << x << " " << y << " " << x1 << " " << y1 << "] ";
// lyxerr << "MT[" << a << " " << d << " " << a1 << " " << d1 << "] ";
// for (i= 0; i<np; i++)
// for (i = 0; i < np; ++i)
// lyxerr << "XY[" << point[i].x << " " << point[i].y << "] ";
return &point[0];

View File

@ -272,9 +272,8 @@ void Matriz::escala(float x, float y)
void Matriz::matmat(matriz_data& a)
{
int i;
matriz_data c;
for (i= 0;i<2; i++) {
for (int i = 0;i < 2; ++i) {
c[0][i] = a[0][0]*m[0][i] + a[0][1]*m[1][i];
c[1][i] = a[1][0]*m[0][i] + a[1][1]*m[1][i];
}
@ -293,7 +292,7 @@ static int search_deco(int code)
{
int i= 0;
while (math_deco_table[i].code && math_deco_table[i].code!= code) i++;
while (math_deco_table[i].code && math_deco_table[i].code!= code) ++i;
if (!math_deco_table[i].code) i = -1;
return i;
}
@ -486,10 +485,10 @@ MathAccentInset::Metrics()
void
MathDotsInset::Draw(int x, int y)
{
mathed_draw_deco(pm, x+2, y-dh, width-2, ascent, code);
if (code == LM_vdots||code == LM_ddots) x++;
if (code!= LM_vdots) y--;
mathed_draw_deco(pm, x+2, y-dh, width-2, ascent, code);
mathed_draw_deco(pm, x + 2, y - dh, width - 2, ascent, code);
if (code == LM_vdots || code == LM_ddots) ++x;
if (code!= LM_vdots) --y;
mathed_draw_deco(pm, x + 2, y - dh, width - 2, ascent, code);
}
void

View File

@ -199,7 +199,7 @@ MathParInset::Metrics()
}
data.setTab(x-tb, tab);
tb = x;
tab++;
++tab;
limits = false;
data.Next();
} else
@ -282,7 +282,7 @@ MathFracInset::Draw(int x, int y)
short sizex = size;
idx = 0;
if (size == LM_ST_DISPLAY) size++;
if (size == LM_ST_DISPLAY) ++size;
MathParInset::Draw(x+(width-w0)/2, y - des0);
den->Draw(x+(width-w1)/2, y + den->Ascent() + 2 - dh);
size = sizex;
@ -302,7 +302,7 @@ MathFracInset::Metrics()
short idxp = idx;
short sizex = size;
idx = 0;
if (size == LM_ST_DISPLAY) size++;
if (size == LM_ST_DISPLAY) ++size;
MathParInset::Metrics();
size = sizex;
w0 = width;
@ -339,7 +339,7 @@ MathBigopInset::Draw(int x, int y)
if (sym == LM_oint) {
XDrawArc(fl_display, pm, mathLineGC, x, y-5*width/4, width, width, 0, 23040);
XFlush(fl_display);
x++;
++x;
}
XDrawString(fl_display, pm, mathGC, x, y, s, ls);
XFlush(fl_display);

View File

@ -65,21 +65,21 @@ byte MathedIter::GetChar()
{
if (IsFont()) {
fcode = array->bf[pos];
pos++;
++pos;
}
return array->bf[pos];
}
byte* MathedIter::GetString(int& len)
byte * MathedIter::GetString(int& len)
{
if (IsFont()) {
fcode = array->bf[++pos];
pos++;
++pos;
}
byte *s = &array->bf[pos];
byte * s = &array->bf[pos];
len = pos;
while (array->bf[pos]>= ' ' && pos<array->last) pos++;
while (array->bf[pos] >= ' ' && pos<array->last) ++pos;
len = pos-len;
return s;
@ -88,7 +88,7 @@ byte* MathedIter::GetString(int& len)
MathedInset* MathedIter::GetInset()
{
if (IsInset()) {
MathedInset* p;
MathedInset * p;
my_memcpy(&p, &array->bf[pos+1], sizeof(p));
return p;
} else {
@ -116,17 +116,17 @@ bool MathedIter::Next()
if (array->bf[pos]<' ') {
fcode = -1;
if (IsTab()) col++;
if (IsTab()) ++col;
if (IsCR()) {
col = 0;
row++;
++row;
}
}
if (IsInset())
pos += sizeof(char*) + 2;
else
pos++;
++pos;
if (IsFont()) {
fcode = array->bf[pos++];
@ -180,25 +180,25 @@ void MathedIter::Insert(byte c, MathedTextCodes t)
if (IsFont() && array->bf[pos] == t) {
fcode = t;
pos++;
++pos;
} else
if (t!= fcode && pos>0 && MathIsFont(array->bf[pos-1])) {
pos--;
int k;
for (k= pos-1; k>= 0 && array->bf[k]>= ' '; k--);
--pos;
int k = pos - 1;
for (; k >= 0 && array->bf[k]>= ' '; --k);
fcode = (k >= 0 && MathIsFont(array->bf[k])) ? array->bf[k]: -1;
}
short f = (array->bf[pos]<' ') ? 0: fcode;
int shift = (t == fcode) ? 1: ((f) ? 3: 2);
if (t == LM_TC_TAB || t == LM_TC_CR) {
shift--;
--shift;
c = t;
if (t == LM_TC_CR) {
row++;
++row;
col = 0;
} else
col++;
++col;
}
if (pos < array->last)
@ -231,10 +231,10 @@ void MathedIter::split(int shift)
bool fg = false;
if (array->bf[pos]>= ' ') {
if (pos> 0 && MathIsFont(array->bf[pos-1]))
pos--;
--pos;
else {
fg = true;
shift++;
++shift;
}
}
array->Move(pos, shift);
@ -252,18 +252,18 @@ void MathedIter::split(int shift)
// I assume that both pos and pos2 are legal positions
void MathedIter::join(int pos2)
{
if (!OK() || pos2<= pos)
if (!OK() || pos2 <= pos)
return;
short f= fcode;
if (pos>0 && array->bf[pos]>= ' ' && MathIsFont(array->bf[pos-1]))
pos--;
short f = fcode;
if (pos > 0 && array->bf[pos] >= ' ' && MathIsFont(array->bf[pos-1]))
--pos;
if (MathIsFont(array->bf[pos2-1]))
pos2--;
--pos2;
if (array->bf[pos2]>= ' ') {
for (int p= pos2; p>0; p--)
if (array->bf[pos2] >= ' ') {
for (int p = pos2; p > 0; --p)
if (MathIsFont(array->bf[p])) {
f = array->bf[p];
break;
@ -300,8 +300,8 @@ bool MathedIter::Delete()
if (MathIsFont(array->bf[pos-1]) && array->bf[pos+1]<' ') {
int i;
shift = 2;
pos--;
for (i= pos-1; i>0 && !MathIsFont(array->bf[i]); i--);
--pos;
for (i = pos - 1; i > 0 && !MathIsFont(array->bf[i]); --i);
if (i>0 && MathIsFont(array->bf[i]))
fcode = array->bf[i];
} else
@ -311,7 +311,7 @@ bool MathedIter::Delete()
shift = sizeof(char*) + 2;
else
if (c == LM_TC_TAB || c == LM_TC_CR) {
shift++;
++shift;
// lyxerr <<"Es un tab.";
}
else {
@ -338,23 +338,24 @@ LyxArrayBase *MathedIter::Copy(int pos1, int pos2)
// int posx = pos;
ipush();
LyxArrayBase *t= array, *a;
LyxArrayBase * t = array, *a;
if (pos1>0 || pos2<= array->last) {
if (pos1 > 0 || pos2 <= array->last) {
short fc= 0;
if (pos1>0 && array->bf[pos1]>' ') {
for (int p= pos1; p>= 0; p--)
for (int p = pos1; p >= 0; --p)
if (MathIsFont(array->bf[p])) {
if (p!= pos1-1)
fc = array->bf[p];
else
pos1--;
--pos1;
break;
}
}
if (pos2>0 && array->bf[pos2]>= ' ' && MathIsFont(array->bf[pos2-1]))
pos2--;
if (pos2 > 0 && array->bf[pos2] >= ' '
&& MathIsFont(array->bf[pos2-1]))
--pos2;
int dx = pos2 - pos1;
a = new LyxArrayBase(dx+LyxArrayBase::ARRAY_MIN_SIZE);
@ -362,7 +363,7 @@ LyxArrayBase *MathedIter::Copy(int pos1, int pos2)
my_memcpy(&a->bf[(fc) ? 1: 0], &array->bf[pos1], dx);
if (fc) {
a->bf[0] = fc;
dx++;
++dx;
}
a->last = dx;
a->bf[dx] = '\0';
@ -813,7 +814,7 @@ void MathedXIter::ipop()
if (p) {
crow = p->getRowSt();
if (crow)
for (int i= 0; i<row; i++)
for (int i = 0; i < row; ++i)
crow = crow->next;
}
}

View File

@ -66,7 +66,7 @@ MathMacro::MathMacro(MathMacroTemplate* t):
/* int k = tmplate->getMacroPar(i)->GetColumns();
if (k>0) {
args[i].array = new LyxArrayBase;
for (int j= 0; j<k-1; j++) args[i].array->Insert(j, LM_TC_TAB);
for (int j= 0; j<k-1; ++j) args[i].array->Insert(j, LM_TC_TAB);
}*/
}
idx = 0;
@ -273,11 +273,11 @@ MathMacroTemplate::MathMacroTemplate(char const * nm, int na, int flg):
MathParInset(LM_ST_TEXT, nm, LM_OT_MACRO),
flags(flg), nargs(na)
{
if (nargs>0) {
if (nargs > 0) {
tcode = LM_TC_ACTIVE_INSET;
args = new MathMacroArgument[nargs];
for (int i= 0; i<nargs; i++) {
args[i].setNumber(i+1);
for (int i = 0; i < nargs; ++i) {
args[i].setNumber(i + 1);
}
} else
tcode = LM_TC_INSET;
@ -287,7 +287,7 @@ MathMacroTemplate::MathMacroTemplate(char const * nm, int na, int flg):
MathMacroTemplate::~MathMacroTemplate()
{
// prevent to delete already deleted objects
for (int i= 0; i<nargs; i++) {
for (int i = 0; i < nargs; ++i) {
args[i].SetData(0);
}
delete[] args;
@ -339,17 +339,17 @@ void MathMacroTemplate::Metrics()
bool expnd = (nargs>0) ? args[0].getExpand(): false;
if (flags & MMF_Edit) {
for (int i= 0; i<nargs; i++) {
for (int i = 0; i < nargs; ++i) {
args[i].setExpand(false);
}
} else {
for (int i= 0; i<nargs; i++) {
for (int i = 0; i < nargs; ++i) {
args[i].setExpand(true);
}
}
MathParInset::Metrics();
for (int i= 0; i<nargs; i++) {
for (int i = 0; i < nargs; ++i) {
args[i].setExpand(expnd);
}
}
@ -358,7 +358,7 @@ void MathMacroTemplate::Metrics()
void MathMacroTemplate::update(MathMacro * macro)
{
int idx = (macro) ? macro->getArgumentIdx(): 0;
for (int i= 0; i<nargs; i++) {
for (int i = 0; i < nargs; ++i) {
if (macro) {
macro->setArgumentIdx(i);
args[i].SetData(macro->GetData());

View File

@ -208,7 +208,7 @@ void matrix_cb(FL_OBJECT *, long data)
case 2:
{
int nx = int(fl_get_slider_value(fd_matrix->columns)+0.5);
for (int i= 0; i<nx; i++) h_align_str[i] = 'c';
for (int i = 0; i < nx; ++i) h_align_str[i] = 'c';
//memset(h_align_str, 'c', nx);
h_align_str[nx] = '\0';
// fl_freeze_form(fd_form_main->form_main);

View File

@ -232,7 +232,7 @@ static int yylex(void)
*p = c;
yyis->get(cc);
c = cc;
p++;
++p;
}
*p = '\0';
if (yyis->good()) yyis->putback(c);
@ -241,10 +241,10 @@ static int yylex(void)
if (l->token == LM_TK_BEGIN || l->token == LM_TK_END) {
int i;
LexGetArg('{');
// for (i= 0; i<5 && strncmp(yytext, latex_mathenv[i],
// strlen(latex_mathenv[i])); i++);
// for (i = 0; i < 5 && strncmp(yytext, latex_mathenv[i],
// strlen(latex_mathenv[i])); ++i);
for (i = 0; i < 6 && strcmp(yytext, latex_mathenv[i]); i++);
for (i = 0; i < 6 && strcmp(yytext, latex_mathenv[i]); ++i);
yylval.i = i;
} else
if (l->token == LM_TK_SPACE)
@ -399,7 +399,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
}
case LM_TK_OPEN:
{
brace++;
++brace;
if (accent && tprev == LM_TK_ACCENT) {
acc_braces[acc_brace++] = brace;
break;
@ -418,14 +418,14 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
}
case LM_TK_CLOSE:
{
brace--;
--brace;
if (brace < 0) {
mathPrintError("Unmatching braces");
panic = true;
break;
}
if (acc_brace && brace == acc_braces[acc_brace-1]-1) {
acc_brace--;
--acc_brace;
break;
}
if (flags & FLAG_BRACE_FONT) {
@ -435,7 +435,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
break;
}
if (brace == 0 && (flags & FLAG_BRACE_LAST)) {
plevel--;
--plevel;
return array;
} else {
data.Insert ('}', LM_TC_TEX);
@ -461,7 +461,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
case ']':
{
if (flags & FLAG_BRACK_END) {
plevel--;
--plevel;
return array;
} else
data.Insert (']');
@ -625,7 +625,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
case LM_TK_RIGHT:
{
if (flags & FLAG_RIGHT) {
plevel--;
--plevel;
return array;
} else {
mathPrintError("Unmatched right delimiter");
@ -684,7 +684,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
data.Insert(doAccent(p), p->getTCode());
else
data.Insert(p, p->getTCode());
for (int i = 0; p->setArgumentIdx(i); i++)
for (int i = 0; p->setArgumentIdx(i); ++i)
p->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
}
else {
@ -704,7 +704,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
// debug info [made that conditional -JMarc]
if (lyxerr.debugging(Debug::MATHED))
lyxerr << "[" << yylval.i << "]" << endl;
plevel--;
--plevel;
if (mt) { // && (flags & FLAG_END)) {
mt->SetData(array);
array = 0;
@ -766,7 +766,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
data.Insert(p, p->getTCode());
p->setArgumentIdx(0);
mathed_parse(FLAG_END, p->GetData(), reinterpret_cast<MathParInset**>(&p));
// for (int i= 0; p->setArgumentIdx(i); i++)
// for (int i = 0; p->setArgumentIdx(i); ++i)
// p->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
} else
mathPrintError("Unrecognized environment");
@ -834,7 +834,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
break;
}
}
plevel--;
--plevel;
return array;
}

View File

@ -211,12 +211,12 @@ BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, unsigned char cons
void BitmapMenu::Create()
{
if (i<nb) {
if (i < nb) {
lyxerr << "Error: Bitmaps not created!" << endl;
return;
}
form = fl_bgn_form(FL_UP_BOX, w, h);
for (i= 0; i<nb; i++) {
for (i = 0; i < nb; ++i) {
fl_add_object(form, bitmap[i]);
bitmap[i]->u_vdata = this;
}
@ -228,7 +228,7 @@ int BitmapMenu::GetIndex(FL_OBJECT* ob)
{
if (active == this) {
int k = 0;
for (i= 0; i<nb; i++) {
for (i = 0; i < nb; ++i) {
if (bitmap[i] == ob)
return k+fl_get_bmtable(ob);
k += fl_get_bmtable_maxitems(bitmap[i]);
@ -454,7 +454,7 @@ char const ** pixmapFromBitmapData(char const * s, int wx, int hx)
case 5: latex_str = latex_misc; break;
}
for (int k = 0; latex_str[k][0]>' '; k++) {
for (int k = 0; latex_str[k][0] > ' '; ++k) {
if (strcmp(latex_str[k], s) == 0) {
id = k;
break;

View File

@ -309,8 +309,8 @@ void MathParInset::Write(string & outf)
(data.FCode() == LM_TC_SPECIAL))
outf += '\\';
else {
if (*s == '{') brace++;
if (*s == '}') brace--;
if (*s == '{') ++brace;
if (*s == '}') --brace;
}
if (*s == '}' && data.FCode() == LM_TC_TEX && brace<0)
lyxerr <<"Math warning: Unexpected closing brace."
@ -318,7 +318,7 @@ void MathParInset::Write(string & outf)
else
outf += char(*s);
}
s++; ls--;
++s; --ls;
}
if (data.FCode()>= LM_TC_RM && data.FCode()<= LM_TC_TEXTRM)
outf += '}';
@ -355,7 +355,7 @@ void MathParInset::Write(string & outf)
crow = crow->getNext();
}
outf += "\\\\\n";
number_of_newlines++;
++number_of_newlines;
data.Next();
break;
}
@ -377,7 +377,7 @@ void MathParInset::Write(string & outf)
}
while (brace>0) {
outf += '}';
brace--;
--brace;
}
}
@ -404,14 +404,14 @@ void MathMatrixInset::Write(string & outf)
outf += '{';
outf += h_align;
outf += "}\n";
number_of_newlines++;
++number_of_newlines;
}
MathParInset::Write(outf);
if (GetType() == LM_OT_MATRIX){
outf += "\n\\end{";
outf += name;
outf += '}';
number_of_newlines++;
++number_of_newlines;
}
}
@ -446,7 +446,7 @@ void mathed_write(MathParInset * p, string & outf, int * newlines,
// Modified to work in a cleaner and hopefully more general way
// (JMarc)
outf += "\n";
number_of_newlines++;
++number_of_newlines;
}
if (mathed_env == LM_EN_DISPLAY){
outf += "\\[\n";
@ -456,14 +456,14 @@ void mathed_write(MathParInset * p, string & outf, int * newlines,
outf += latex_mathenv[mathed_env];
outf += "}\n";
}
number_of_newlines++;
++number_of_newlines;
}
if (label && label[0]>' ' && mathed_env == LM_EN_EQUATION){
outf += "\\label{";
outf += label;
outf += "}\n";
number_of_newlines++;
++number_of_newlines;
}
p->Write(outf);
@ -474,13 +474,13 @@ void mathed_write(MathParInset * p, string & outf, int * newlines,
}
else if (mathed_env == LM_EN_DISPLAY){
outf += "\\]\n";
number_of_newlines++;
++number_of_newlines;
}
else {
outf += "\n\\end{";
outf += latex_mathenv[mathed_env];
outf += "}\n";
number_of_newlines+= 2;
number_of_newlines += 2;
}
*newlines = number_of_newlines;
}

View File

@ -1325,7 +1325,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
fl_setpup_shortcut(InsertMenu, 17, scex(_("IM|Uu#u#U")));
if (tmpbuffer->isReadonly()) {
for (int ii = 1; ii <= 16; ii++)
for (int ii = 1; ii <= 16; ++ii)
fl_setpup_mode(InsertMenu, ii, FL_PUP_GREY);
fl_setpup_mode(InsertMenu, 17, FL_PUP_GREY);
}
@ -1449,7 +1449,7 @@ void Menus::ShowMathMenu(FL_OBJECT * ob, long)
fl_setpup_shortcut(MathMenu, 9, scex(_("MM|Pp#p#P")));
if (tmpbuffer->isReadonly())
for (int ii = 1; ii <= 9; ii++)
for (int ii = 1; ii <= 9; ++ii)
fl_setpup_mode(MathMenu, ii, FL_PUP_GREY);

View File

@ -83,7 +83,7 @@ private:
void addHistory(string const &cmd) {
if (history_cnt == 0 || (history_cnt>0 && cmd!= history[(history_cnt-1) % MAX_HISTORY])) {
history[history_cnt % MAX_HISTORY] = cmd;
history_cnt++;
++history_cnt;
}
history_idx = history_cnt;
}

View File

@ -4,8 +4,8 @@
*
* LyX, the High Level Word Processor
*
* Copyright (C) 1995Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1998 The LyX Team.
*
* ======================================================
A few prototypes and definitions needed for Windows NT */

View File

@ -153,13 +153,13 @@ void LyXParagraph::writeFile(ostream & os, BufferParams & params,
if (depth > dth) {
while (depth > dth) {
os << "\n\\begin_deeper ";
dth++;
++dth;
}
}
else {
while (depth < dth) {
os << "\n\\end_deeper ";
dth--;
--dth;
}
}
}
@ -253,8 +253,8 @@ void LyXParagraph::writeFile(ostream & os, BufferParams & params,
font1 = LyXFont(LyXFont::ALL_INHERIT);
column = 0;
for (size_type i = 0; i < size(); i++) {
if (!i){
for (size_type i = 0; i < size(); ++i) {
if (!i) {
os << "\n";
column = 0;
}
@ -320,7 +320,7 @@ void LyXParagraph::writeFile(ostream & os, BufferParams & params,
else
lyxerr << "ERROR (LyXParagraph::writeFile):"
" NULL char in structure." << endl;
column++;
++column;
break;
}
}
@ -1161,7 +1161,7 @@ string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
int firstpos = lastpos;
while ((firstpos >= 0) && !IsLetter(firstpos))
firstpos--;
--firstpos;
// now find the beginning by looking for a nonletter
@ -1688,19 +1688,19 @@ void LyXParagraph::BreakParagraph(LyXParagraph::size_type pos,
// to the new paragraph
pos_first = 0;
while (ParFromPos(pos_first) != par)
pos_first++;
++pos_first;
pos_end = pos_first + par->text.size() - 1;
// The constructor has already reserved 500 elements
//if (pos_end > pos)
// tmp->text.reserve(pos_end - pos);
for (i = pos; i <= pos_end; i++) {
for (i = pos; i <= pos_end; ++i) {
par->CutIntoMinibuffer(i - pos_first);
tmp->InsertFromMinibuffer(i - pos);
}
tmp->text.resize(tmp->text.size());
for (i = pos_end; i >= pos; i--)
for (i = pos_end; i >= pos; --i)
par->Erase(i - pos_first);
par->text.resize(par->text.size());
@ -1794,7 +1794,7 @@ LyXParagraph * LyXParagraph::Clone() const
// copy everything behind the break-position to the new paragraph
for (size_type i = 0; i < size(); i++) {
for (size_type i = 0; i < size(); ++i) {
CopyIntoMinibuffer(i);
result->InsertFromMinibuffer(i);
}
@ -1893,10 +1893,9 @@ void LyXParagraph::PasteParagraph()
size_type pos_end = the_next->text.size() - 1;
size_type pos_insert = Last();
size_type i;
// ok, now copy the paragraph
for (i = 0; i <= pos_end; i++) {
for (size_type i = 0; i <= pos_end; ++i) {
the_next->CutIntoMinibuffer(i);
InsertFromMinibuffer(pos_insert + i);
}
@ -2182,7 +2181,7 @@ int LyXParagraph::AutoDeleteInsets()
tmpi = tmpi->next;
if (tmpi2->inset) {
if (tmpi2->inset->AutoDelete()) {
i++;
++i;
Erase(tmpi2->pos);
}
} else {
@ -2472,10 +2471,10 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
&& !IsDummy()) {
if (style.isCommand()) {
file += '{';
column++;
++column;
} else if (align != LYX_ALIGN_LAYOUT) {
file += '{';
column++;
++column;
return_value = true;
}
}
@ -2676,9 +2675,9 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
for (size_type i = 0; i < size(); ++i) {
char c = GetChar(i);
if (table->IsContRow(current_cell_number+1)) {
if (table->IsContRow(current_cell_number + 1)) {
if (c == LyXParagraph::META_NEWLINE)
current_cell_number++;
++current_cell_number;
continue;
}
++column;
@ -2731,9 +2730,9 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
}
basefont = getFont(-1);
running_font = basefont;
current_cell_number++;
++current_cell_number;
if (table->CellHasContRow(current_cell_number) >= 0) {
TeXContTableRows(file, i+1,
TeXContTableRows(file, i + 1,
current_cell_number,
column, texrow);
}
@ -2741,20 +2740,20 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
// put the EndOfCell because it is put after the
// for(...)
if (table->ShouldBeVeryLastCell(current_cell_number)) {
current_cell_number--;
--current_cell_number;
break;
}
int tmp = table->TexEndOfCell(file,
current_cell_number);
if (tmp>0) {
if (tmp > 0) {
column = 0;
} else if (tmp < 0) {
tmp = -tmp;
}
for (;tmp--;) {
for (; tmp--;) {
texrow.newline();
}
texrow.start(this, i+1);
texrow.start(this, i + 1);
} else {
SimpleTeXSpecialChars(file, texrow,
font, running_font, basefont,
@ -2766,7 +2765,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
if (open_font) {
running_font.latexWriteEndChanges(file, basefont);
}
current_cell_number++;
++current_cell_number;
tmp = table->TexEndOfCell(file, current_cell_number);
for (; tmp > 0; --tmp)
texrow.newline();
@ -2806,7 +2805,7 @@ bool LyXParagraph::TeXContTableRows(string & file,
for (; (i < size()) && (current_cell_number<cell); ++i) {
c = GetChar(i);
if (c == LyXParagraph::META_NEWLINE)
current_cell_number++;
++current_cell_number;
}
lastpos = i;
c = GetChar(i);
@ -3016,7 +3015,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
emph_flag= false;
}
font1 = font2 = getFont(-1);
current_cell_number++;
++current_cell_number;
if (table->CellHasContRow(current_cell_number) >= 0) {
DocBookContTableRows(file, extra, desc_on, i+1,
current_cell_number,
@ -3026,11 +3025,12 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
// put the EndOfCell because it is put after the
// for(...)
if (table->ShouldBeVeryLastCell(current_cell_number)) {
current_cell_number--;
--current_cell_number;
break;
}
tmp= table->DocBookEndOfCell(file, current_cell_number,
depth);
tmp = table->DocBookEndOfCell(file,
current_cell_number,
depth);
if (tmp > 0)
column = 0;
@ -3075,7 +3075,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
// non-breaking characters
// char is ' '
if (desc_on == 1) {
char_line_count++;
++char_line_count;
file += '\n';
file += "</term><listitem><para>";
desc_on = 2;
@ -3158,7 +3158,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
for (; i < size() && current_cell_number < cell; ++i) {
c = GetChar(i);
if (c == LyXParagraph::META_NEWLINE)
current_cell_number++;
++current_cell_number;
}
lastpos = i;
c = GetChar(i);
@ -3228,7 +3228,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
// non-breaking characters
// char is ' '
if (desc_on == 1) {
char_line_count++;
++char_line_count;
file += '\n';
file += "</term><listitem><para>";
desc_on = 2;
@ -3318,7 +3318,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
} else {
column += file.length() - len;
}
for (;tmp--;) {
for (; tmp--;) {
texrow.newline();
}
}

View File

@ -341,7 +341,7 @@ void create_ispell_pipe(string const & lang)
// free the memory used by string::copy in the
// setup of argv
for (int i= 0; i < argc -1; i++)
for (int i= 0; i < argc -1; ++i)
delete[] argv[i];
lyxerr << "LyX: Failed to start ispell!" << endl;
@ -449,11 +449,11 @@ isp_result *ispell_check_word(char *word)
if (count) result->misses = new char*[count];
p = strpbrk(nb, ":");
p += 2;
for (i = 0; i<count; i++) {
for (i = 0; i < count; ++i) {
result->misses[i] = p;
p = strpbrk(p, ",\n");
*p = 0;
p+= 2;
p += 2;
}
break;
}
@ -671,7 +671,7 @@ bool RunSpellChecker(string const & lang)
while (true) {
word = current_view->nextWord(newval);
if (word == 0) break;
word_count++;
++word_count;
// Update slider if and only if value has changed
newvalue = int(100.0*newval);
@ -707,7 +707,7 @@ bool RunSpellChecker(string const & lang)
fl_set_object_label(fd_form_spell_check->text, word);
fl_set_input(fd_form_spell_check->input, word);
fl_clear_browser(fd_form_spell_check->browser);
for (i= 0; i<result->count; i++) {
for (i = 0; i < result->count; ++i) {
fl_add_browser_line(fd_form_spell_check->browser, result->misses[i]);
}

View File

@ -167,6 +167,7 @@ FileInfo & FileInfo::newFile(int fildes)
}
// should not be in FileInfo
char const * FileInfo::typeIndicator() const
{
if (S_ISDIR(buf.st_mode)) return ("/");
@ -190,6 +191,7 @@ mode_t FileInfo::getMode() const
return buf.st_mode;
}
long FileInfo::getBlockSize() const
{
#ifndef __EMX__
@ -200,6 +202,8 @@ long FileInfo::getBlockSize() const
#endif
}
// should not be in FileInfo
void FileInfo::modeString(char * szString) const
{
szString[0] = typeLetter();
@ -211,6 +215,7 @@ void FileInfo::modeString(char * szString) const
}
// should not be in FileInfo
char FileInfo::typeLetter() const
{
#ifdef S_ISBLK
@ -238,6 +243,7 @@ char FileInfo::typeLetter() const
}
// should not be in FileInfo
void FileInfo::flagRWX(unsigned short i, char * szString) const
{
szString[0] = (i & S_IRUSR) ? 'r' : '-';
@ -246,6 +252,7 @@ void FileInfo::flagRWX(unsigned short i, char * szString) const
}
// should not be in FileInfo
void FileInfo::setSticky(char * szString) const
{
#ifdef S_ISUID
@ -281,7 +288,7 @@ time_t FileInfo::getAccessTime() const
}
time_t FileInfo::getStatusChangeTime() const
time_t FileInfo::getStatusChangeTime() const
{
return buf.st_ctime;
}
@ -372,6 +379,7 @@ bool FileInfo::isSocket() const
}
// should not be in FileInfo
bool FileInfo::access(int p)
{
// if we don't have a filename we fail

View File

@ -45,7 +45,7 @@ LSubstring::LSubstring(string & s, LRegex const & r)
pos = res.first;
} else {
n = 0;
pos = 0;
pos = string::npos;
}
}

View File

@ -98,15 +98,15 @@ int strToInt(string const & str)
string lowercase(string const & a)
{
string tmp(a);
#ifdef __GLIBCPP__
//#ifdef __GLIBCPP__
string::iterator result = tmp.begin();
for (string::iterator first = tmp.begin();
first != tmp.end(); ++first, ++result) {
*result = tolower(*first);
}
#else
transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
#endif
//#else
// transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
//#endif
return tmp;
}
@ -114,15 +114,15 @@ string lowercase(string const & a)
string uppercase(string const & a)
{
string tmp(a);
#ifdef __GLIBCPP__
//#ifdef __GLIBCPP__
string::iterator result = tmp.begin();
for (string::iterator first = tmp.begin();
first != tmp.end(); ++first, ++result) {
*result = toupper(*first);
}
#else
transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
#endif
//#else
// transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
//#endif
return tmp;
}

View File

@ -16,7 +16,7 @@ public:
Startcontroller();
~Startcontroller();
static SystemcallsSingletoncontroller * getController();
void reduceRefcount() { refcount--; }
void reduceRefcount() { --refcount; }
private:
static SystemcallsSingletoncontroller * contr;
static int refcount;

View File

@ -33,6 +33,6 @@ SystemcallsSingletoncontroller::Startcontroller::getController()
// Create the global controller
contr = new SystemcallsSingletoncontroller;
}
refcount++;
++refcount;
return contr;
}

View File

@ -419,7 +419,7 @@ bool LyXTable::TopAlreadyDrawed(int cell)
while (column
&& cell_info[row-1][column].multicolumn
== LyXTable::CELL_PART_OF_MULTICOLUMN)
column--;
--column;
if (cell_info[row-1][column].multicolumn
== LyXTable::CELL_NORMAL)
return row_info[row-1].bottom_line;
@ -439,31 +439,32 @@ bool LyXTable::VeryLastRow(int cell)
int LyXTable::AdditionalHeight(int cell)
{
int row = row_of_cell(cell);
int top = 1;
int bottom = 1;
if (!row) return 0;
int top = 1; // bool top = true; ??
int bottom = 1; // bool bottom = true; ??
int column;
if (row){
for (column = 0;column < columns-1 && bottom;column++){
switch (cell_info[row-1][column].multicolumn){
case LyXTable::CELL_BEGIN_OF_MULTICOLUMN:
bottom = cell_info[row-1][column].bottom_line;
break;
case LyXTable::CELL_NORMAL:
bottom = row_info[row-1].bottom_line;
}
for (column = 0; column < columns - 1 && bottom; ++column) {
switch (cell_info[row - 1][column].multicolumn) {
case LyXTable::CELL_BEGIN_OF_MULTICOLUMN:
bottom = cell_info[row - 1][column].bottom_line;
break;
case LyXTable::CELL_NORMAL:
bottom = row_info[row - 1].bottom_line;
}
for (column = 0;column < columns-1 && top;column++){
switch (cell_info[row][column].multicolumn){
case LyXTable::CELL_BEGIN_OF_MULTICOLUMN:
top = cell_info[row][column].top_line;
break;
case LyXTable::CELL_NORMAL:
top = row_info[row].top_line;
}
}
if (top && bottom)
return WIDTH_OF_LINE;
}
for (column = 0; column < columns - 1 && top; ++column) {
switch (cell_info[row][column].multicolumn){
case LyXTable::CELL_BEGIN_OF_MULTICOLUMN:
top = cell_info[row][column].top_line;
break;
case LyXTable::CELL_NORMAL:
top = row_info[row].top_line;
}
}
if (top && bottom)
return WIDTH_OF_LINE;
return 0;
}
@ -486,9 +487,9 @@ int LyXTable::WidthOfColumn(int cell)
{
int column1 = column_of_cell(cell);
int column2 = right_column_of_cell(cell);
int i;
int result = 0;
for (i = column1; i<= column2;i++){
int i = column1;
for (; i <= column2; ++i) {
result += column_info[i].width_of_column;
}
return result;
@ -509,16 +510,15 @@ bool LyXTable::SetWidthOfMulticolCell(int cell, int new_width)
int row = row_of_cell(cell);
int column1 = column_of_cell(cell);
int column2 = right_column_of_cell(cell);
int i;
int width = 0;
// first set columns to 0 so we can calculate the right width
for (i = column1; i<= column2;i++) {
int i = column1;
for (; i <= column2; ++i) {
cell_info[row][i].width_of_cell = 0;
}
// set the width to MAX_WIDTH until width > 0
width = (new_width + 2*WIDTH_OF_LINE);
for (i = column1; (i<column2) && (width > 0);i++){
int width = (new_width + 2 * WIDTH_OF_LINE);
for (i = column1; (i < column2) && (width > 0); ++i) {
cell_info[row][i].width_of_cell = column_info[i].width_of_column;
width -= column_info[i].width_of_column;
}
@ -528,24 +528,25 @@ bool LyXTable::SetWidthOfMulticolCell(int cell, int new_width)
return true;
}
void LyXTable::recalculateMulticolCells(int cell, int new_width)
{
int
row = row_of_cell(cell),
column1 = column_of_cell(cell),
column2 = right_column_of_cell(cell),
i;
int row = row_of_cell(cell);
int column1 = column_of_cell(cell);
int column2 = right_column_of_cell(cell);
// first set columns to 0 so we can calculate the right width
for (i = column1; i<= column2;++i)
int i = column1;
for (; i <= column2; ++i)
cell_info[row][i].width_of_cell = 0;
for(i = cell+1;(i<numberofcells) && (!IsMultiColumn(i));++i)
for(i = cell + 1; (i < numberofcells) && (!IsMultiColumn(i)); ++i)
;
if (i < numberofcells)
recalculateMulticolCells(i, GetWidthOfCell(i)-(2*WIDTH_OF_LINE));
recalculateMulticolCells(i, GetWidthOfCell(i) - (2 * WIDTH_OF_LINE));
SetWidthOfMulticolCell(cell, new_width);
}
/* returns 1 if a complete update is necessary, otherwise 0 */
bool LyXTable::SetWidthOfCell(int cell, int new_width)
{
@ -694,9 +695,9 @@ int LyXTable::GetWidthOfCell(int cell)
int row = row_of_cell(cell);
int column1 = column_of_cell(cell);
int column2 = right_column_of_cell(cell);
int i;
int result = 0;
for (i = column1; i<= column2;i++){
int i = column1;
for (; i <= column2; ++i) {
result += cell_info[row][i].width_of_cell;
}
@ -734,30 +735,26 @@ bool LyXTable::IsFirstCell(int cell)
bool LyXTable::IsLastCell(int cell)
{
return (right_column_of_cell(cell) == (columns-1));
return (right_column_of_cell(cell) == (columns - 1));
}
bool LyXTable::calculate_width_of_column(int column)
{
int i, max;
int old_column_width = column_info[column].width_of_column;
max = 0;
for (i = 0; i<rows; i++) {
if (cell_info[i][column].width_of_cell > max) {
max = cell_info[i][column].width_of_cell;
}
int maximum = 0;
for (int i = 0; i < rows; ++i) {
maximum = max(cell_info[i][column].width_of_cell, maximum);
}
column_info[column].width_of_column = max;
column_info[column].width_of_column = maximum;
return (column_info[column].width_of_column != old_column_width);
}
bool LyXTable::calculate_width_of_column_NMC(int column)
{
int i, max;
int old_column_width = column_info[column].width_of_column;
max = 0;
for (i = 0; i<rows; ++i) {
int max = 0;
for (int i = 0; i < rows; ++i) {
if (!IsMultiColumn(GetCellNumber(column, i)) &&
(cell_info[i][column].width_of_cell > max)) {
max = cell_info[i][column].width_of_cell;
@ -802,7 +799,7 @@ int LyXTable::right_column_of_cell(int cell)
int column = column_of_cell(cell);
while (column < columns - 1 &&
cell_info[row][column+1].multicolumn == LyXTable::CELL_PART_OF_MULTICOLUMN)
column++;
++column;
return column;
}
@ -970,28 +967,28 @@ int LyXTable::TexEndOfCell(string & file, int cell)
file += '}';
if (RotateCell(cell)) {
file += "\n\\end{sideways}";
ret++;
++ret;
}
file += "\\\\\n";
ret++;
++ret;
tmp = 0;
fcell = cell;
while (!IsFirstCell(fcell))fcell--;
for (i = 0; i < NumberOfCellsInRow(fcell); i++){
if (BottomLine(fcell+i))
tmp++;
while (!IsFirstCell(fcell)) --fcell;
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
if (BottomLine(fcell + i))
++tmp;
}
if (tmp == NumberOfCellsInRow(fcell)){
if (tmp == NumberOfCellsInRow(fcell)) {
file += "\\hline ";
} else {
tmp = 0;
for (i = 0; i < NumberOfCellsInRow(fcell); i++){
if (BottomLine(fcell+i)){
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
if (BottomLine(fcell + i)) {
file += "\\cline{";
file += tostr(column_of_cell(fcell+i)+1);
file += tostr(column_of_cell(fcell + i) + 1);
file += '-';
file += tostr(right_column_of_cell(fcell+i)+1);
file += tostr(right_column_of_cell(fcell + i) + 1);
file += "} ";
tmp = 1;
}
@ -999,7 +996,7 @@ int LyXTable::TexEndOfCell(string & file, int cell)
}
if (tmp){
file += '\n';
ret++;
++ret;
}
if (is_long_table)
file += "\\end{longtable}";
@ -1007,21 +1004,21 @@ int LyXTable::TexEndOfCell(string & file, int cell)
file += "\\end{tabular}";
if (rotate) {
file += "\n\\end{sideways}";
ret++;
++ret;
}
} else {
nvcell = NextVirtualCell(cell+1);
nvcell = NextVirtualCell(cell + 1);
if (cell < 0){
// preamble
if (rotate) {
file += "\\begin{sideways}\n";
ret++;
++ret;
}
if (is_long_table)
file += "\\begin{longtable}{";
else
file += "\\begin{tabular}{";
for (i = 0; i<columns;i++){
for (i = 0; i < columns; ++i) {
if (column_info[i].left_line)
file += '|';
if (!column_info[i].align_special.empty()) {
@ -1047,24 +1044,24 @@ int LyXTable::TexEndOfCell(string & file, int cell)
file += '|';
}
file += "}\n";
ret++;
++ret;
tmp = 0;
if (GetNumberOfCells()){
if (GetNumberOfCells()) {
fcell = 0;
for (i = 0; i < NumberOfCellsInRow(fcell); i++){
if (TopLine(fcell+i))
tmp++;
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
if (TopLine(fcell + i))
++tmp;
}
if (tmp == NumberOfCellsInRow(fcell)){
file += "\\hline ";
} else {
tmp = 0;
for (i = 0; i < NumberOfCellsInRow(fcell); i++){
if (TopLine(fcell+i)){
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
if (TopLine(fcell + i)) {
file += "\\cline{";
file += tostr(column_of_cell(fcell+i)+1);
file += tostr(column_of_cell(fcell + i) + 1);
file += '-';
file += tostr(right_column_of_cell(fcell+i)+1);
file += tostr(right_column_of_cell(fcell + i) + 1);
file += "} ";
tmp = 1;
}
@ -1072,12 +1069,12 @@ int LyXTable::TexEndOfCell(string & file, int cell)
}
if (tmp){
file += '\n';
ret++;
++ret;
}
}
if (RotateCell(0)) {
file += "\\begin{sideways}\n";
ret++;
++ret;
}
} else {
// usual cells
@ -1088,21 +1085,20 @@ int LyXTable::TexEndOfCell(string & file, int cell)
}
if (RotateCell(cell)) {
file += "\n\\end{sideways}";
ret++;
++ret;
}
if (IsLastCell(cell)) {
int row = row_of_cell(cell);
string hline1, hline2;
bool print_hline = true;
bool pr_top_hline, flag1, flag2;
flag1 = IsLongTable() &&
bool flag1 = IsLongTable() &&
((row == endhead) || (row == endfirsthead) ||
(row == endfoot) || (row == endlastfoot));
row++;
flag2 = IsLongTable() &&
++row;
bool flag2 = IsLongTable() &&
((row <= endhead) || (row <= endfirsthead) ||
(row <= endfoot) || (row <= endlastfoot));
row--;
--row;
// print the bottom hline only if (otherwise it is doubled):
// - is no LongTable
// - there IS a first-header
@ -1110,34 +1106,34 @@ int LyXTable::TexEndOfCell(string & file, int cell)
// & this row is no special header/footer
// - the next row is a special header/footer
// & this row is a special header/footer
pr_top_hline = (flag1 && flag2) || (!flag1 && !flag2) ||
bool pr_top_hline = (flag1 && flag2) || (!flag1 && !flag2) ||
(endfirsthead == endhead);
file += "\\\\\n";
ret++;
++ret;
tmp = 0;
fcell = cell;
while (!IsFirstCell(fcell))
fcell--;
for (i = 0; i < NumberOfCellsInRow(cell); i++){
if (BottomLine(fcell+i))
tmp++;
--fcell;
for (i = 0; i < NumberOfCellsInRow(cell); ++i) {
if (BottomLine(fcell + i))
++tmp;
}
if (tmp == NumberOfCellsInRow(cell)){
file += "\\hline ";
hline1 = "\\hline ";
} else {
tmp = 0;
for (i = 0; i < NumberOfCellsInRow(fcell); i++){
if (BottomLine(fcell+i)){
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
if (BottomLine(fcell + i)){
file += "\\cline{";
file += tostr(column_of_cell(fcell+i)+1);
file += tostr(column_of_cell(fcell + i) + 1);
file += '-';
file += tostr(right_column_of_cell(fcell+i)+1);
file += tostr(right_column_of_cell(fcell + i) + 1);
file += "} ";
hline1 += "\\cline{";
hline1 += tostr(column_of_cell(fcell+i)+1);
hline1 += tostr(column_of_cell(fcell + i) + 1);
hline1 += '-';
hline1 += tostr(right_column_of_cell(fcell+i)+1);
hline1 += tostr(right_column_of_cell(fcell + i) + 1);
hline1 += "} ";
tmp = 1;
}
@ -1145,40 +1141,39 @@ int LyXTable::TexEndOfCell(string & file, int cell)
}
if (tmp){
file += '\n';
ret++;
++ret;
}
if (IsLongTable() && (row == endfoot)) {
file += "\\endfoot\n";
ret++;
++ret;
print_hline = false; // no double line below footer
}
if (IsLongTable() && (row == endlastfoot)) {
file += "\\endlastfoot\n";
ret++;
++ret;
print_hline = false; // no double line below footer
}
if (IsLongTable() && row_info[row].newpage) {
file += "\\newpage\n";
ret++;
++ret;
print_hline = false; // no line below a \\newpage-command
}
tmp = 0;
if (nvcell < numberofcells && (cell < GetNumberOfCells()-1) &&
if (nvcell < numberofcells && (cell < GetNumberOfCells() - 1) &&
!ShouldBeVeryLastCell(cell)) {
fcell = nvcell;
for (i = 0; i < NumberOfCellsInRow(fcell); i++){
if (TopLine(fcell+i))
tmp++;
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
if (TopLine(fcell + i))
++tmp;
}
if (tmp == NumberOfCellsInRow(fcell)){
if (tmp == NumberOfCellsInRow(fcell)) {
if (print_hline)
file += "\\hline ";
hline2 = "\\hline ";
}
else {
} else {
tmp = 0;
for (i = 0; i < NumberOfCellsInRow(fcell); i++){
if (TopLine(fcell+i)){
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
if (TopLine(fcell + i)) {
if (print_hline) {
file += "\\cline{";
file += tostr(column_of_cell(fcell+i)+1);
@ -1197,7 +1192,7 @@ int LyXTable::TexEndOfCell(string & file, int cell)
}
if (tmp && print_hline){
file += '\n';
ret++;
++ret;
}
}
// the order here is important as if one defines two
@ -1207,45 +1202,45 @@ int LyXTable::TexEndOfCell(string & file, int cell)
// lastfooter is NOT displayed!!!
bool sflag2 = (row == endhead) || (row == endfirsthead) ||
(row == endfoot) || (row == endlastfoot);
row--;
--row;
// sflag2 = IsLongTable() && (row >= 0) &&
// (sflag2 || (row == endhead) || (row == endfirsthead));
row += 2;
bool sflag1 = IsLongTable() && (row != endhead) &&
(row != endfirsthead) &&
((row == endfoot) || (row == endlastfoot));
row--;
--row;
if (IsLongTable() && (row == endhead)) {
file += "\\endhead\n";
ret++;
++ret;
}
if (IsLongTable() && (row == endfirsthead)) {
file += "\\endfirsthead\n";
ret++;
++ret;
}
if (sflag1) { // add the \hline for next foot row
if (!hline1.empty()) {
file += hline1 + '\n';
ret++;
++ret;
}
}
// add the \hline for the first row
if (pr_top_hline && sflag2) {
if (!hline2.empty()) {
file += hline2 + '\n';
ret++;
++ret;
}
}
if (nvcell < numberofcells && RotateCell(nvcell)) {
file += "\\begin{sideways}\n";
ret++;
++ret;
}
} else {
file += "&\n";
ret++;
++ret;
if (nvcell < numberofcells && RotateCell(nvcell)) {
file += "\\begin{sideways}\n";
ret++;
++ret;
}
}
}
@ -1296,7 +1291,6 @@ int LyXTable::TexEndOfCell(string & file, int cell)
// returns the number of printed newlines
int LyXTable::RoffEndOfCell(ostream & os, int cell)
{
int i, j;
int ret = 0;
if (cell == GetNumberOfCells() - 1){
@ -1306,19 +1300,19 @@ int LyXTable::RoffEndOfCell(ostream & os, int cell)
++ret;
}
os << "\n";
ret++;
++ret;
if (row_info[row_of_cell(cell)].bottom_line) {
os << "_\n";
++ret;
}
os << ".TE\n.pl 1c";
} else {
if (cell < 0){
if (cell < 0) {
int fcell = 0;
// preamble
os << "\n.pl 500c\n.TS\n";
for (j = 0; j<rows; ++j) {
for (i = 0; i<columns; ++i, ++fcell) {
for (int j = 0; j < rows; ++j) {
for (int i = 0; i < columns; ++i, ++fcell) {
if (column_info[i].left_line)
os << " | ";
if (cell_info[j][i].multicolumn == CELL_PART_OF_MULTICOLUMN)
@ -1465,7 +1459,7 @@ int LyXTable::DocBookEndOfCell(string & file, int cell, int &depth)
file += tostr(columns);
file += "' COLSEP='1' ROWSEP='1'>";
addNewlineAndDepth(file,++depth);
ret++;
++ret;
for (i = 0; i < columns; ++i) {
file += "<COLSPEC ALIGN='";
file += getDocBookAlign(i, true);
@ -1485,7 +1479,7 @@ int LyXTable::DocBookEndOfCell(string & file, int cell, int &depth)
}
file += "'>";
addNewlineAndDepth(file, depth);
ret++;
++ret;
#ifdef NOT_HANDLED_YET_AS_I_DONT_KNOW_HOW
if (column_info[i].left_line)
file += '|';
@ -1579,7 +1573,7 @@ void LyXTable::SetMultiColumn(int cell, int number)
cellinfo_of_cell(fvcell)->alignment = column_info[column_of_cell(fvcell)].alignment;
cellinfo_of_cell(fvcell)->top_line = row_info[row_of_cell(fvcell)].top_line;
cellinfo_of_cell(fvcell)->bottom_line = row_info[row_of_cell(fvcell)].bottom_line;
for (number--;number>0;number--){
for (number--; number > 0; --number) {
cellinfo_of_cell(fvcell+number)->multicolumn =
LyXTable::CELL_PART_OF_MULTICOLUMN;
new_width += cellinfo_of_cell(fvcell+number)->width_of_cell;
@ -1594,11 +1588,11 @@ int LyXTable::cells_in_multicolumn(int cell)
int row = row_of_cell(cell);
int column = column_of_cell(cell);
int result = 1;
column++;
++column;
while (column < columns && cell_info[row][column].multicolumn
== LyXTable::CELL_PART_OF_MULTICOLUMN){
result++;
column++;
++result;
++column;
}
return result;
}
@ -1615,14 +1609,14 @@ int LyXTable::UnsetMultiColumn(int cell)
if (cell_info[row][column].multicolumn
== LyXTable::CELL_BEGIN_OF_MULTICOLUMN){
cell_info[row][column].multicolumn = LyXTable::CELL_NORMAL;
column++;
++column;
while (column < columns &&
cell_info[row][column].multicolumn
== LyXTable::CELL_PART_OF_MULTICOLUMN){
cell_info[row][column].multicolumn =
LyXTable::CELL_NORMAL;
column++;
result++;
++column;
++result;
}
}
set_row_column_number_info();
@ -1633,39 +1627,41 @@ int LyXTable::UnsetMultiColumn(int cell)
void LyXTable::delete_column(int column)
{
int i, j;
columnstruct *column_info2 = new columnstruct[columns-1];
columnstruct * column_info2 = new columnstruct[columns-1];
for (i = 0; i<column; i++){
for (i = 0; i < column; ++i) {
column_info2[i] = column_info[i];
}
for (i = column; i<columns-1; i++){
column_info2[i] = column_info[i+1];
for (i = column; i < columns - 1; ++i) {
column_info2[i] = column_info[i + 1];
}
delete[] column_info;
column_info = column_info2;
for (i = 0; i<rows;i++){
cellstruct* tmp = cell_info[i];
cell_info[i] = new cellstruct[columns-1];
for (j = 0; j<column; j++){
for (i = 0; i < rows; ++i) {
cellstruct * tmp = cell_info[i];
cell_info[i] = new cellstruct[columns - 1];
for (j = 0; j < column; ++j) {
cell_info[i][j] = tmp[j];
}
for (j = column; j<columns-1; j++){
cell_info[i][j] = tmp[j+1];
for (j = column; j < columns - 1; ++j) {
cell_info[i][j] = tmp[j + 1];
}
delete[] tmp;
}
columns--;
--columns;
Reinit();
}
void LyXTable::SetLongTable(int what)
{
is_long_table = what;
}
bool LyXTable::IsLongTable()
{
return is_long_table;
@ -1695,8 +1691,8 @@ bool LyXTable::NeedRotating()
{
if (rotate)
return true;
for (int i = 0; i<rows;i++){
for (int j = 0;j<columns;j++){
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < columns; ++j) {
if (cell_info[i][j].rotate)
return true;
}
@ -1747,7 +1743,7 @@ int LyXTable::FirstVirtualCell(int cell)
return cell;
int row = row_of_cell(cell);
int column = column_of_cell(cell);
for(;(row>0) && IsContRow(cell_info[row][column].cellno); row--)
for(; (row > 0) && IsContRow(cell_info[row][column].cellno); --row)
;
return cell_info[row][column].cellno;
}
@ -1776,7 +1772,7 @@ bool LyXTable::ShouldBeVeryLastCell(int cell)
if (!IsContRow(fcell))
return false;
while((fcell < GetNumberOfCells() - 1) && IsContRow(fcell))
fcell++;
++fcell;
if (fcell < GetNumberOfCells() - 1)
return false;
return true;
@ -1786,10 +1782,10 @@ bool LyXTable::ShouldBeVeryLastRow(int cell)
{
if (CellHasContRow(cell)>= 0)
return false;
int row = row_of_cell(cell)+1;
int row = row_of_cell(cell) + 1;
int column = column_of_cell(cell);
while((row < rows) && IsContRow(cell_info[row][column].cellno))
row++;
++row;
if (row < rows)
return false; // found another valid row
// I do not have any valid row after the actual

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef _TEX_ACCENT_
#define _TEX_ACCENT_
#ifndef TEX_ACCENT
#define TEX_ACCENT
#include "commandtags.h"

View File

@ -210,7 +210,7 @@ void LyXText::Draw(Row const * row, LyXParagraph::size_type & pos,
scr.drawLine(gc_foot, offset + row->baseline,
int(tmpx), int(x - tmpx));
pos++;
++pos;
return;
} else if (c == LyXParagraph::META_INSET) {
Inset * tmpinset = row->par->GetInset(pos);
@ -576,8 +576,8 @@ int LyXText::NumberOfCell(LyXParagraph * par,
LyXParagraph::size_type tmp_pos = 0;
while (tmp_pos < pos) {
if (par->IsNewline(tmp_pos))
cell++;
tmp_pos++;
++cell;
++tmp_pos;
}
return cell;
}
@ -589,10 +589,10 @@ int LyXText::WidthOfCell(LyXParagraph * par,
int w = 0;
while (pos < par->Last() && !par->IsNewline(pos)) {
w += SingleWidth(par, pos);
pos++;
++pos;
}
if (par->IsNewline(pos))
pos++;
++pos;
return w;
}
@ -693,7 +693,7 @@ LyXText::NextBreakPoint(Row const * row, int width) const
if (pos < last-1) {
last_separator = i;
if (IsLineSeparatorChar(par->GetChar(i+1)))
last_separator++;
++last_separator;
} else
last_separator = last; // to avoid extra rows
} else
@ -1006,7 +1006,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
labeladdon = 0;
// Check if any insets are larger
for (pos = row_ptr->pos; pos <= pos_end; pos++) {
for (pos = row_ptr->pos; pos <= pos_end; ++pos) {
if (row_ptr->par->GetChar(pos) == LyXParagraph::META_INSET) {
tmpfont = GetFont(row_ptr->par, pos);
tmpinset = row_ptr->par->GetInset(pos);
@ -1024,7 +1024,8 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
// Check if any custom fonts are larger (Asger)
// This is not completely correct, but we can live with the small,
// cosmetic error for now.
LyXFont::FONT_SIZE maxsize = row_ptr->par->HighestFontInRange(row_ptr->pos, pos_end);
LyXFont::FONT_SIZE maxsize = row_ptr->par->HighestFontInRange(row_ptr->pos,
pos_end);
if (maxsize > font.size()) {
font.setSize(maxsize);
@ -1045,8 +1046,8 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
/* table stuff -- end*/
// This is nicer with box insets:
maxasc++;
maxdesc++;
++maxasc;
++maxdesc;
row_ptr->ascent_of_text = maxasc;
@ -1252,7 +1253,7 @@ void LyXText::AppendParagraph(Row * row) const
// Insert the new row
if (z < lastposition) {
z++;
++z;
InsertRow(row, row->par, z);
row = row->next;
@ -1287,7 +1288,7 @@ void LyXText::BreakAgain(Row * row) const
row->height = 0;
} else {
row = row->next;
z++;
++z;
if (row->pos == z)
not_ready = false; // the rest will not change
else {
@ -1325,14 +1326,14 @@ void LyXText::BreakAgainOneRow(Row * row)
if (z < row->par->Last() ) {
if (!row->next || (row->next && row->next->par != row->par)) {
/* insert a new row */
z++;
++z;
InsertRow(row, row->par, z);
row = row->next;
row->height = 0;
}
else {
row= row->next;
z++;
++z;
if (row->pos != z)
row->pos = z;
}
@ -1483,7 +1484,8 @@ void LyXText::OpenFootnote()
/* ok, move the cursor right before the footnote */
/* just a little faster than using CursorRight() */
for (cursor.pos= 0; cursor.par->ParFromPos(cursor.pos)!= par; cursor.pos++);
for (cursor.pos = 0;
cursor.par->ParFromPos(cursor.pos) != par; cursor.pos++);
/* now the cursor is at the beginning of the physical par */
SetCursor(cursor.par,
cursor.pos + cursor.par->ParFromPos(cursor.pos)->text.size());
@ -1590,31 +1592,31 @@ void LyXText::TableFeatures(int feature) const
!cursor.par->table->IsContRow(cell)) {
while (pos < cursor.par->Last() &&
!cursor.par->IsNewline(pos))
pos++;
++pos;
if (pos < cursor.par->Last())
pos++;
cell++;
++pos;
++cell;
}
while((pos < cursor.par->Last()) &&
cursor.par->table->IsContRow(cell)) {
while (pos < cursor.par->Last() &&
!cursor.par->IsNewline(pos))
pos++;
++pos;
if (pos < cursor.par->Last())
pos++;
cell++;
++pos;
++cell;
}
cell_org = --cell;
if (pos < cursor.par->Last())
pos--;
--pos;
}
while (pos < cursor.par->Last() &&
(cell == cell_org || !cursor.par->table->IsFirstCell(cell))){
while (pos < cursor.par->Last() && !cursor.par->IsNewline(pos))
pos++;
++pos;
if (pos < cursor.par->Last())
pos++;
cell++;
++pos;
++cell;
}
/* insert the new cells */
@ -1646,16 +1648,15 @@ void LyXText::TableFeatures(int feature) const
(cell == cell_org
|| !cursor.par->table->IsFirstCell(cell))){
while (pos < cursor.par->Last() && !cursor.par->IsNewline(pos))
pos++;
++pos;
if (pos < cursor.par->Last())
pos++;
cell++;
++pos;
++cell;
}
/* insert the new cells */
int number = cursor.par->table->NumberOfCellsInRow(cell_org);
int i;
for (i= 0; i<number; i++)
for (int i = 0; i < number; ++i)
cursor.par->InsertChar(pos, LyXParagraph::META_NEWLINE);
/* append the row into the table */
@ -1784,9 +1785,9 @@ void LyXText::TableFeatures(int feature) const
if (!selection){
cursor.par->table->SetRightLine(actCell, lineSet);
} else {
LyXParagraph::size_type i;
int n = -1, m = -2;
for (i= sel_start_cursor.pos; i<= sel_end_cursor.pos; i++){
LyXParagraph::size_type i = sel_start_cursor.pos;
for (; i <= sel_end_cursor.pos; ++i) {
if ((n= NumberOfCell(sel_start_cursor.par, i)) != m) {
cursor.par->table->SetRightLine(n, lineSet);
m = n;
@ -1802,9 +1803,9 @@ void LyXText::TableFeatures(int feature) const
if (!selection){
cursor.par->table->SetAlignment(actCell, setAlign);
} else {
LyXParagraph::size_type i;
int n = -1, m = -2;
for (i= sel_start_cursor.pos; i<= sel_end_cursor.pos; i++){
LyXParagraph::size_type i = sel_start_cursor.pos;
for (; i <= sel_end_cursor.pos; ++i) {
if ((n= NumberOfCell(sel_start_cursor.par, i)) != m) {
cursor.par->table->SetAlignment(n, setAlign);
m = n;
@ -1840,8 +1841,8 @@ void LyXText::TableFeatures(int feature) const
int newlines = cursor.par->table->UnsetMultiColumn(actCell);
LyXParagraph::size_type pos = cursor.pos;
while (pos < cursor.par->Last() && !cursor.par->IsNewline(pos))
pos++;
for (;newlines;newlines--)
++pos;
for (; newlines; --newlines)
cursor.par->InsertChar(pos, LyXParagraph::META_NEWLINE);
RedoParagraph();
return;
@ -1871,9 +1872,9 @@ void LyXText::TableFeatures(int feature) const
sel_start_cursor.par->InsertChar(i, ' ');
else {
sel_end_cursor.pos--;
i--;
--i;
}
number++;
++number;
}
}
cursor.par->table->
@ -1942,9 +1943,9 @@ void LyXText::TableFeatures(int feature) const
if (!selection){
cursor.par->table->SetRotateCell(actCell, false);
} else {
LyXParagraph::size_type i;
int n = -1, m = -2;
for (i= sel_start_cursor.pos; i<= sel_end_cursor.pos; i++){
LyXParagraph::size_type i = sel_start_cursor.pos;
for (; i <= sel_end_cursor.pos; ++i) {
if ((n= NumberOfCell(sel_start_cursor.par, i)) != m) {
cursor.par->table->SetRotateCell(n, false);
m = n;
@ -2088,7 +2089,7 @@ void LyXText::CheckParagraphInTable(LyXParagraph * par,
LyXParagraph::size_type tmp_pos = pos;
/* update the table information */
while (tmp_pos && !par->IsNewline(tmp_pos - 1))
tmp_pos--;
--tmp_pos;
if (par->table->SetWidthOfCell(NumberOfCell(par, pos),
WidthOfCell(par, tmp_pos))) {
LyXCursor tmpcursor = cursor;
@ -2581,7 +2582,7 @@ void LyXText::CursorRightOneWord() const
{
// printf("Current pos1 %d", tmpcursor.pos) ;
tmpcursor.pos++;
steps++;
++steps;
}
// Advance through word.
while ( tmpcursor.pos < tmpcursor.par->Last() &&
@ -2589,7 +2590,7 @@ void LyXText::CursorRightOneWord() const
{
// printf("Current pos2 %d", tmpcursor.pos) ;
tmpcursor.pos++;
steps++;
++steps;
}
}
SetCursor(tmpcursor.par, tmpcursor.pos);
@ -2931,7 +2932,8 @@ void LyXText::Delete()
LyXCursor old_cursor = cursor;
int old_cur_par_id = old_cursor.par->id();
int old_cur_par_prev_id = old_cursor.par->previous->id();
int old_cur_par_prev_id = old_cursor.par->previous ?
old_cursor.par->previous->id() : 0;
// just move to the right
CursorRightIntern();
@ -2942,7 +2944,8 @@ void LyXText::Delete()
// old_cursor. Will a solution where we compare paragraph id's
//work better?
#if 1
if (cursor.par->previous->id() == old_cur_par_prev_id
if ((cursor.par->previous ? cursor.par->previous->id() : 0)
== old_cur_par_prev_id
&& cursor.par->id() != old_cur_par_id)
return; // delete-empty-paragraph-mechanism has done it
#else
@ -3661,11 +3664,11 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset,
on_off);
x_old = x;
/* take care about the alignment and other spaces */
cell++;
++cell;
x += row_ptr->par->table->GetBeginningOfTextInCell(cell);
if (row_ptr->par->table->IsFirstCell(cell))
cell--; // little hack, sorry
pos++;
--cell; // little hack, sorry
++pos;
} else if (row_ptr->par->IsHfill(pos)) {
x += 1;
@ -3673,7 +3676,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset,
offset + row_ptr->baseline - DefaultHeight()/2,
offset + row_ptr->baseline);
x += 2;
pos++;
++pos;
} else {
if (row_ptr->par->IsSeparator(pos)) {
tmpx = x;
@ -3702,7 +3705,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset,
int(x - tmpx));
}
}
pos++;
++pos;
} else
Draw(row_ptr, pos, scr, offset, x);
}
@ -3772,7 +3775,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset,
offset + row_ptr->baseline);
}
x += 2;
pos++;
++pos;
} else {
if (row_ptr->par->IsSeparator(pos)) {
tmpx = x;
@ -3803,7 +3806,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset,
int(x - tmpx));
}
}
pos++;
++pos;
} else
Draw(row_ptr, pos, scr, offset, x);
}
@ -3869,7 +3872,7 @@ int LyXText::GetColumnNearX(Row * row, int & x) const
int last = RowLast(row);
if (row->par->IsNewline(last))
last--;
--last;
LyXLayout const & layout = textclasslist.Style(parameters->textclass,
row->par->GetLayout());
@ -3888,7 +3891,7 @@ int LyXText::GetColumnNearX(Row * row, int & x) const
if (x_old + row->par->table->WidthOfColumn(cell) <= x){
tmpx = x_old + row->par->table->WidthOfColumn(cell);
x_old = tmpx;
cell++;
++cell;
tmpx += row->par->table->GetBeginningOfTextInCell(cell);
++c;
} else
@ -3923,7 +3926,7 @@ int LyXText::GetColumnNearX(Row * row, int & x) const
&& row->par->IsSeparator(c)) {
tmpx+= fill_separator;
}
c++;
++c;
if (c == main_body
&& row->par->IsLineSeparator(c - 1)) {
tmpx += GetFont(row->par, -2)

View File

@ -256,7 +256,7 @@ void LyXText::InsertRow(Row * row, LyXParagraph * par,
if (row == lastrow)
lastrow = tmprow;
number_of_rows++; // one more row
++number_of_rows; // one more row
}
@ -1371,13 +1371,13 @@ void LyXText::SetCounter(LyXParagraph * par) const
par->Previous()->GetLayout()
).labeltype != LABEL_BIBLIO
&& layout.labeltype == LABEL_BIBLIO)) {
for (int i = 0; i<10; i++) {
for (int i = 0; i < 10; ++i) {
par->setCounter(i, par->Previous()->GetFirstCounter(i));
}
par->appendix = par->Previous()->FirstPhysicalPar()->appendix;
if (!par->appendix && par->start_of_appendix){
par->appendix = true;
for (int i = 0; i<10; i++) {
for (int i = 0; i < 10; ++i) {
par->setCounter(i, 0);
}
}
@ -1385,7 +1385,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
par->itemdepth = par->Previous()->FirstPhysicalPar()->itemdepth;
}
else {
for (int i = 0; i<10; i++) {
for (int i = 0; i < 10; ++i) {
par->setCounter(i, 0);
}
par->appendix = par->start_of_appendix;
@ -1448,7 +1448,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
/* reset the counters.
* A depth change is like a breaking layout
*/
for (int i = 6 + par->enumdepth + 1; i<10;i++)
for (int i = 6 + par->enumdepth + 1; i < 10; ++i)
par->setCounter(i, 0);
}
@ -2752,7 +2752,7 @@ int LyXText::SwitchLayoutsBetweenClasses(char class1, char class2,
par->layout = lay;
if (name != textclasslist.NameOfLayout(class2, par->layout)) {
ret++;
++ret;
string s = "Layout had to be changed from\n"
+ name + " to " + textclasslist.NameOfLayout(class2, par->layout)
+ "\nbecause of class conversion from\n"
@ -2943,11 +2943,11 @@ void LyXText::SetCursorIntern(LyXParagraph * par,
int cell = NumberOfCell(row->par, row->pos);
float x_old = x;
x += row->par->table->GetBeginningOfTextInCell(cell);
for (pos = row->pos; pos < cursor.pos; pos++) {
for (pos = row->pos; pos < cursor.pos; ++pos) {
if (row->par->IsNewline(pos)) {
x = x_old + row->par->table->WidthOfColumn(cell);
x_old = x;
cell++;
++cell;
x += row->par->table->GetBeginningOfTextInCell(cell);
} else {
x += SingleWidth(row->par, pos);
@ -2956,7 +2956,7 @@ void LyXText::SetCursorIntern(LyXParagraph * par,
} else
/* table stuff -- end*/
for (pos = row->pos; pos < cursor.pos; pos++) {
for (pos = row->pos; pos < cursor.pos; ++pos) {
if (pos && pos == main_body
&& !row->par->IsLineSeparator(pos - 1)) {
x += GetFont(row->par, -2).stringWidth(

View File

@ -3,9 +3,9 @@
* ======================================================
*
* LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich
* Copyright 1995 Matthias Ettrich
*
* This file is Copyright (C) 1996-1999
* This file is Copyright 1996-1999
* Lars Gullik Bjønnes
*
* ====================================================== */