removed most uses of toupper and friends, removed <config.h> from headers and added it to some source files, applied patch from John for search&replace, and perhaps other things you will discover by browsing Changelog :)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3255 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-12-20 15:11:51 +00:00
parent feed97be54
commit 1070702ea4
32 changed files with 106 additions and 67 deletions

View File

@ -9,7 +9,6 @@ src/converter.C
src/CutAndPaste.C
src/debug.C
src/exporter.C
src/ext_l10n.h
src/figure_form.C
src/figureForm.C
src/FontLoader.C

View File

@ -1,3 +1,27 @@
2001-12-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Thesaurus.C: always include <config.h> in sources.
* Painter.h:
* lyxlookup.h:
* box.h: do not include <config.h> in header files
* text.C (paintLastRow): remove unused variable
* text.C (transformChar):
(insertChar):
* tabular-old.C (getTokenValue): use IsDigit instead of isdigit.
* Painter.C (text):
* font.C (width): rewrite to use uppercase() instead of
islower/toupper.
* lyxfind.C (IsStringInText): use uppercase instead of toupper.
2001-12-12 John Levon <moz@compsoc.man.ac.uk>
* lyxfind.C: clean up of find failure position change
2001-12-20 Juergen Vigna <jug@sad.it>
* Makefile.am (lyx_SOURCES): added tabular_funcs.[hC].
@ -11,6 +35,7 @@
* tabular_funcs.[hC]: added and moved here all not classfunctions
of LyXTabular.
>>>>>>> 1.472
2001-12-19 Juergen Vigna <jug@sad.it>
* tabular.[Ch]: better support for longtabular options (not finished
@ -22,6 +47,7 @@
the last character to compute the size of *_BOX. This makes more
sense and avoids a crash with empty paragraphs.
Use Painter::rectangle to draw EMPTY_BOX.
2001-12-19 Juergen Vigna <jug@sad.it>
* undo_funcs.C (textHandleUndo): fixed setting of inset_owner of

View File

@ -224,17 +224,16 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls,
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
int tmpx = x;
for (size_t i = 0; i < ls; ++i) {
char c = s[i];
if (islower(static_cast<unsigned char>(c))) {
c = toupper(c);
char const c = uppercase(s[i]);
if (c != s[i]) {
lyxfont::XSetFont(display, gc, smallfont);
XDrawString(display, owner.getPixmap(),
gc, tmpx, y, &c, 1);
XDrawString(display, owner.getPixmap(), gc,
tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth(smallfont, &c, 1);
} else {
lyxfont::XSetFont(display, gc, f);
XDrawString(display, owner.getPixmap(),
gc, tmpx, y, &c, 1);
XDrawString(display, owner.getPixmap(), gc,
tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth(f, &c, 1);
}
}
@ -261,17 +260,22 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls,
static XChar2b c;
int tmpx = x;
for (int i = 0; i < ls; ++i) {
if (s[i].byte1 == 0 && islower(s[i].byte2)) {
c.byte2 = toupper(s[i].byte2);
if (s[i].byte1)
c = s[i];
else {
c.byte1 = s[i].byte1;
c.byte2 = uppercase(s[i].byte2);
}
if (c.byte2 != s[i].byte2) {
lyxfont::XSetFont(display, gc, smallfont);
XDrawString16(display, owner.getPixmap(),
gc, tmpx, y, &c, 1);
XDrawString16(display, owner.getPixmap(), gc,
tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth16(smallfont, &c, 1);
} else {
lyxfont::XSetFont(display, gc, f);
XDrawString16(display, owner.getPixmap(),
gc, tmpx, y, &s[i], 1);
tmpx += lyxfont::XTextWidth16(f, const_cast<XChar2b *>(&s[i]), 1);
XDrawString16(display, owner.getPixmap(), gc,
tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth16(f, &c, 1);
}
}
}

View File

@ -15,7 +15,6 @@
#pragma interface
#endif
#include <config.h>
#include "LString.h"
// This is only included to provide stuff for the non-public sections

View File

@ -6,6 +6,8 @@
* \author John Levon
*/
#include <config.h>
#include "Thesaurus.h"
Thesaurus thesaurus;

View File

@ -12,8 +12,6 @@
#include <vector>
#include <config.h>
#include "LString.h"
#ifdef HAVE_LIBAIKSAURUS
#include "AikSaurus.h"

View File

@ -16,7 +16,6 @@
#pragma interface
#endif
#include <config.h>
#include FORMS_H_LOCATION
#include "LyXView.h"

View File

@ -9,10 +9,6 @@
#ifndef BOX_H
#define BOX_H
#include <config.h>
#include "debug.h"
/**
* A simple class representing rectangular regions.
* It is expected that the box be constructed in

View File

@ -14,6 +14,7 @@
#pragma implementation
#endif
#include "support/lstrings.h"
#include "font.h"
#include "FontLoader.h"
#include "lyxrc.h"
@ -22,7 +23,6 @@
#include <boost/smart_ptr.hpp>
#include <cctype>
namespace {
@ -136,14 +136,11 @@ int lyxfont::width(char const * s, size_t n, LyXFont const & f)
} else {
// emulate smallcaps since X doesn't support this
unsigned int result = 0;
char c;
LyXFont smallfont(f);
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
for (size_t i = 0; i < n; ++i) {
c = s[i];
// when islower is a macro, the cast is needed (JMarc)
if (islower(static_cast<unsigned char>(c))) {
c = toupper(c);
char const c = uppercase(s[i]);
if (c != s[i]) {
result += ::XTextWidth(getXFontstruct(smallfont), &c, 1);
} else {
result += ::XTextWidth(getXFontstruct(f), &c, 1);
@ -179,8 +176,13 @@ int lyxfont::width(XChar2b const * s, int n, LyXFont const & f)
LyXFont smallfont(f);
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
for (int i = 0; i < n; ++i) {
if (s[i].byte1 == 0 && islower(s[i].byte2)) {
c.byte2 = toupper(s[i].byte2);
if (s[i].byte1)
c = s[i];
else {
c.byte1 = s[i].byte1;
c.byte2 = uppercase(s[i].byte2);
}
if (c.byte2 != s[i].byte2) {
result += ::XTextWidth16(getXFontstruct(smallfont), &c, 1);
} else {
result += ::XTextWidth16(getXFontstruct(f), &s[i], 1);

View File

@ -1,6 +1,12 @@
2001-12-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Timeout.h:
* FileDialog.h: do not include <config.h> in header files.
2001-12-12 Angus Leeming <a.leeming@ic.ac.uk>
* Alert.h: remove spurious semi-colon at the end of the namespace scope.
* Alert.h: remove spurious semi-colon at the end of the namespace
scope.
2001-11-22 John Levon <moz@compsoc.man.ac.uk>

View File

@ -15,7 +15,6 @@
#pragma interface
#endif
#include <config.h>
#include <utility>
#include "commandtags.h"

View File

@ -10,8 +10,6 @@
#ifndef TIMEOUT_H
#define TIMEOUT_H
#include <config.h>
#ifdef __GNUG__
#pragma interface
#endif

View File

@ -1,3 +1,7 @@
2001-12-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* ControlThesaurus.h: do not include <config.h> in header files
2001-11-04 John Levon <moz@compsoc.man.ac.uk>
* ControlToc.C: changes for floatlist

View File

@ -16,7 +16,6 @@
#endif
#include <vector>
#include <config.h>
#include "LString.h"
#include "Thesaurus.h"

View File

@ -1,3 +1,7 @@
2001-12-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Timeout_pimpl.h: do not include <config.h> in header files.
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormCitation.C:

View File

@ -9,8 +9,6 @@
#ifndef TIMEOUTPIMPL_H
#define TIMEOUTPIMPL_H
#include <config.h>
#include "frontends/Timeout.h"
#include "glib.h" // for gint

View File

@ -1,3 +1,7 @@
2001-12-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* LyXImage.h: do not include <config.h> in header files
2001-06-14 Angus Leeming <a.leeming@ic.ac.uk>
* LyXImage.C:

View File

@ -13,7 +13,6 @@
#define LYXIMAGE_H
// We need it to know what version to use.
#include <config.h>
#ifndef X_DISPLAY_MISSING
#include "LyXImage_X.h"

View File

@ -1,3 +1,12 @@
2001-12-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* DropDown.C: always include <config.h> in sources.
* xforms_helpers.h:
* FormFiledialog.h:
* Timeout_pimpl.h:
* DropDown.h: do not include <config.h> in headers
2001-12-20 Juergen Vigna <jug@sad.it>
* FormTabular.C (update): final LT-h/f support modifications.

View File

@ -6,6 +6,8 @@
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include "DropDown.h"
#include <iostream>

View File

@ -9,8 +9,6 @@
#ifndef DROPDOWN_H
#define DROPDOWN_H
#include <config.h>
#include "LyXView.h"
#include <sigc++/signal_system.h>
#include "LString.h"

View File

@ -18,8 +18,6 @@
#pragma interface
#endif
#include <config.h>
#include "LString.h"
#include FORMS_H_LOCATION
#include "form_filedialog.h"

View File

@ -10,8 +10,6 @@
#ifndef TIMEOUTPIMPL_H
#define TIMEOUTPIMPL_H
#include <config.h>
#include "frontends/Timeout.h"
#include <sigc++/signal_system.h>

View File

@ -7,8 +7,6 @@
#pragma interface
#endif
#include <config.h>
#include FORMS_H_LOCATION
#include "Color.h"

View File

@ -1,3 +1,7 @@
2001-12-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* GraphicsCacheItem.h: do not include <config.h> in header files
2001-09-21 Angus Leeming <a.leeming@ic.ac.uk>
* ImageLoaderXPM.C (runImageLoader): If the pixmap contains a

View File

@ -12,8 +12,6 @@
#ifndef GRAPHICSCACHEITEM_H
#define GRAPHICSCACHEITEM_H
#include <config.h>
#ifdef __GNUG__
#pragma interface
#endif

View File

@ -199,7 +199,7 @@ bool IsStringInText(Paragraph * par, pos_type pos,
while (((pos + i) < par->size())
&& (string::size_type(i) < size)
&& (cs ? (str[i] == par->getChar(pos + i))
: (toupper(str[i]) == toupper(par->getChar(pos + i)))))
: (uppercase(str[i]) == uppercase(par->getChar(pos + i)))))
{
++i;
}
@ -225,7 +225,6 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str,
Paragraph * par = text->cursor.par();
pos_type pos = text->cursor.pos();
Paragraph * prev_par = par;
pos_type prev_pos;
UpdatableInset * inset;
while (par && !IsStringInText(par, pos, str, cs, mw)) {
@ -245,8 +244,6 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str,
if (pos >= par->size()) {
prev_par = par;
// consider 0-sized empty pars
prev_pos = std::min(pos, par->size());
par = par->next();
pos = 0;
}
@ -258,7 +255,7 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str,
} else {
// make sure we end up at the end of the text,
// not the start point of the last search
text->setCursor(bv, prev_par, prev_pos);
text->setCursor(bv, prev_par, prev_par->size());
return SR_NOT_FOUND;
}
}
@ -274,13 +271,11 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text,
Paragraph * par = text->cursor.par();
pos_type pos = text->cursor.pos();
Paragraph * prev_par = par;
pos_type prev_pos = pos;
do {
if (pos > 0)
--pos;
else {
prev_pos = pos;
prev_par = par;
// We skip empty paragraphs (Asger)
do {
@ -308,7 +303,7 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text,
return SR_FOUND;
} else {
// go to the last part of the unsuccessful search
text->setCursor(bv, prev_par, prev_pos);
text->setCursor(bv, prev_par, 0);
return SR_NOT_FOUND;
}
}

View File

@ -15,7 +15,6 @@
#ifndef LYXLOOKUP_H
#define LYXLOOKUP_H
#include <config.h>
#include <X11/Xlib.h>
/// Initialize the compose key handling

View File

@ -1,3 +1,7 @@
2001-12-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* lstrings.h: do not include <cctype>
2001-12-12 Ben Stanley <bds02@uow.edu.au>
* lyxsum.C: portability fix for mmap patch

View File

@ -17,7 +17,7 @@
#endif
//#include <cstring>
#include <cctype>
//#include <cctype>
#include "Lsstream.h"

View File

@ -15,6 +15,7 @@
#include "tabular.h"
#include "debug.h"
#include "support/lstrings.h"
#include "support/textutils.h"
using std::istream;
using std::getline;
@ -59,12 +60,12 @@ bool getTokenValue(string const & str, char const * token, int & num)
pos += strlen(token) + 1;
ch = str[pos];
if ((ch != '"') && (ch != '\'')) { // only read till next space
if (!isdigit(ch))
if (!IsDigit(ch))
return false;
ret += ch;
}
++pos;
while ((pos < str.length() - 1) && isdigit(str[pos]))
while ((pos < str.length() - 1) && IsDigit(str[pos]))
ret += str[pos++];
num = strToInt(ret);
@ -112,12 +113,12 @@ bool getTokenValue(string const & str, char const * token, bool & flag)
pos += strlen(token) + 1;
ch = str[pos];
if ((ch != '"') && (ch != '\'')) { // only read till next space
if (!isdigit(ch))
if (!IsDigit(ch))
return false;
ret += ch;
}
++pos;
while ((pos < str.length() - 1) && isdigit(str[pos]))
while ((pos < str.length() - 1) && IsDigit(str[pos]))
ret += str[pos++];
flag = strToInt(ret);

View File

@ -137,7 +137,7 @@ unsigned char LyXText::transformChar(unsigned char c, Paragraph * par,
pos_type pos) const
{
if (!Encodings::is_arabic(c))
if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && isdigit(c))
if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && IsDigit(c))
return c + (0xb0 - '0');
else
return c;
@ -1785,7 +1785,7 @@ void LyXText::insertChar(BufferView * bview, char c)
static string const number_seperators = ".,:";
if (current_font.number() == LyXFont::ON) {
if (!isdigit(c) && !contains(number_operators, c) &&
if (!IsDigit(c) && !contains(number_operators, c) &&
!(contains(number_seperators, c) &&
cursor.pos() >= 1 &&
cursor.pos() < cursor.par()->size() &&
@ -1797,7 +1797,7 @@ void LyXText::insertChar(BufferView * bview, char c)
cursor.pos() - 1).number() == LyXFont::ON)
)
number(bview); // Set current_font.number to OFF
} else if (isdigit(c) &&
} else if (IsDigit(c) &&
real_current_font.isVisibleRightToLeft()) {
number(bview); // Set current_font.number to ON
@ -3501,7 +3501,6 @@ void LyXText::paintLastRow(DrawRowParams & p)
y_bottom -= asc;
}
pos_type const last = rowLastPrintable(p.row);
bool const is_rtl = p.row->par()->isRightToLeftPar(p.bv->buffer()->params);
int const endlabel = par->getEndLabel(buffer->params);