small fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1154 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-10-25 13:10:04 +00:00
parent db5199aa9d
commit ddbec11708
5 changed files with 38 additions and 11 deletions

View File

@ -1,3 +1,16 @@
2000-10-25 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/filetools.C (MakeRelPath): change some types to
string::size_type
* src/frontends/ButtonPolicies.h (operator<<): new operator for
ButtonPolicy::SMInput and ButtonPolicy::State.
* src/FontLoader.C (reset): small cleanup
(unload): small cleanup
* src/FontInfo.C (getFontname): initialize error to 10000.0
2000-10-24 Angus Leeming <a.leeming@ic.ac.uk>
* src/frontends/xforms/FormPreferences.[Ch]:

View File

@ -32,7 +32,7 @@ string const FontInfo::getFontname(int size)
return string();
int closestind = -1;
double error = 100000;
double error = 100000.0;
for (int i = 0; i < matches; ++i) {
if (sizes[i] == 0) {

View File

@ -58,11 +58,11 @@ void FontLoader::update()
void FontLoader::reset()
{
// Clear font infos, font structs and font metrics
for (int i1 = 0; i1<4; i1++)
for (int i2 = 0; i2<2; i2++)
for (int i3 = 0; i3<4; i3++) {
for (int i1 = 0; i1 < 4; ++i1)
for (int i2 = 0; i2 < 2; ++i2)
for (int i3 = 0; i3 < 4; ++i3) {
fontinfo[i1][i2][i3] = 0;
for (int i4 = 0; i4<10; i4++) {
for (int i4 = 0; i4<10; ++i4) {
fontstruct[i1][i2][i3][i4] = 0;
}
}
@ -72,14 +72,14 @@ void FontLoader::reset()
void FontLoader::unload()
{
// Unload all fonts
for (int i1 = 0; i1<4; i1++)
for (int i2 = 0; i2<2; i2++)
for (int i3 = 0; i3<4; i3++) {
for (int i1 = 0; i1 < 4; ++i1)
for (int i2 = 0; i2 < 2; ++i2)
for (int i3 = 0; i3 < 4; ++i3) {
if (fontinfo[i1][i2][i3]) {
delete fontinfo[i1][i2][i3];
fontinfo[i1][i2][i3] = 0;
}
for (int i4 = 0; i4<10; i4++) {
for (int i4 = 0; i4 < 10; ++i4) {
if (fontstruct[i1][i2][i3][i4]) {
XFreeFont(fl_get_display(), fontstruct[i1][i2][i3][i4]);
fontstruct[i1][i2][i3][i4] = 0;

View File

@ -159,6 +159,20 @@ public:
};
inline
ostream & operator<<(ostream & os, ButtonPolicy::SMInput smi)
{
os << int(smi);
return os;
}
inline
ostream & operator<<(ostream & os, ButtonPolicy::State st)
{
os << int(st);
return os;
}
//--------------------- Actual Policy Classes -----------------------------
/** Ok and Cancel buttons for dialogs with read-only operation.

View File

@ -857,7 +857,7 @@ string const MakeRelPath(string const & abspath0, string const & basepath0)
string::size_type const baselen = basepath.length();
// Find first different character
int i = 0;
string::size_type i = 0;
while (i < abslen && i < baselen && abspath[i] == basepath[i]) ++i;
// Go back to last /
@ -877,7 +877,7 @@ string const MakeRelPath(string const & abspath0, string const & basepath0)
// Count how many dirs there are in basepath above match
// and append as many '..''s into relpath
string buf;
int j = i;
string::size_type j = i;
while (j < baselen) {
if (basepath[j] == '/') {
if (j + 1 == baselen) break;