LyX-13x: Copying Graphics Files to tmp dir

2005-01-05 Thread Bennett Helm
I'm not sure when this happened, but recently LyX's attempts to copy 
graphics files from their original directories to the tmp directory 
results in files of 0K. This is with LyX 1.3.x (current CVS) on Mac OS 
X.

LyX 1.4.0 does not have this problem.
Any clues what may be going wrong?
Bennett


Re: Packaging corner case

2005-01-05 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> Angus> As it stands, if LyX is found to be run in-place, then the
> Angus> "-sysdir" command line and the "LYX_DIR_13X" environment
> Angus> variable are both ignored. (They're checked in
> Angus> get_system_lyxdir().)
> 
> Angus> Is this acceptable, or should we be able to specify an
> Angus> arbitrary system_lyxdir when running lyx from the build tree?
> 
> I think that's OK. When running in place, we should use the original
> source tree as system_lyxdir.

Ok.

One more question. I've slotted this packaging stuff into LyX 1.3.x. All it
does is set the paths in the package class. The rest of LyX uses the
existing stuff. Running in-place I get this output:


system_lyxdir /home/angus/lyx/13x/lib
build_lyxdir /home/angus/lyx/13x/build-xforms/lib/
user_lyxdir /home/angus/.lyx-1.3.6cvs/
localedir /usr/local/share/locale
documentdir /home/angus
tmpdir /tmp
homedir /home/angus
<\package>

Question. Should localedir be set unless I explicitly define the
LYX_LOCALEDIR environment variable? It's being set above with the
LOCALEDIR macro being passed to package.C by the compiler.

g++ -DHAVE_CONFIG_H -I. -I../../../src/support -I../../src
-I../../../src/support/.. -I../../../boost  -isystem /usr/X11R6/include 
-g -O -W -Wall \
-DLYX_DIR=\"/usr/local/share/lyx-1.3.6cvs\" \
-DTOP_SRCDIR=\"../../..\" \
-DLOCALEDIR=\"/usr/local/share/locale\" \
-c ../../../src/support/package.C

I attach the patch should (any of) you wish to try it out.

-- 
Angus

package_13x.diff.bz2
Description: BZip2 compressed data


[patch] float2str #4 (Spacing)

2005-01-05 Thread Juergen Spitzmueller
The last one. Please have a look at the changes in Spacing.C, especially at 
the #if 0 clause.

This patch also fixes an undetected bug (custom document spacing was broken).

There are still some float values in lyxlayout.C (parsep, labelbottomsep, 
bottomsep, topsep, itemsep and parskip). I didn't change them because they 
are not used by the frontends.

OK?

Regards,
Jürgen

Index: ParagraphParameters.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ParagraphParameters.C,v
retrieving revision 1.44
diff -u -r1.44 ParagraphParameters.C
--- ParagraphParameters.C	5 Oct 2004 12:56:20 -	1.44
+++ ParagraphParameters.C	5 Jan 2005 21:17:03 -
@@ -223,7 +223,7 @@
 			} else if (tmp == "other") {
 lex.next();
 spacing(Spacing(Spacing::Other,
-		 lex.getFloat()));
+		 lex.getString()));
 			} else {
 lex.printError("Unknown spacing token: '$$Token'");
 			}
Index: Spacing.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Spacing.C,v
retrieving revision 1.37
diff -u -r1.37 Spacing.C
--- Spacing.C	16 Sep 2004 20:37:33 -	1.37
+++ Spacing.C	5 Jan 2005 21:17:03 -
@@ -12,12 +12,15 @@
 #include 
 
 #include "Spacing.h"
+#include "support/lstrings.h"
+#include "support/tostr.h"
 
 #include 
 #include 
 
+using lyx::support::strToDbl;
+
 using std::ios;
-using std::istringstream;
 using std::ostream;
 using std::ostringstream;
 using std::string;
@@ -26,24 +29,37 @@
 string const Spacing::spacing_string[]
 	= {"single", "onehalf", "double", "other"};
 
-float Spacing::getValue() const
+
+string const Spacing::getValueAsString() const
 {
 	switch (space) {
 	case Default: // nothing special should happen with this...
-	case Single: return 1.0;
-	case Onehalf: return 1.25;
-	case Double: return 1.667;
+	case Single: return "1.0";
+	case Onehalf: return "1.25";
+	case Double: return "1.667";
 	case Other: return value;
 	}
-	return 1.0;
+	return "1.0";
+}
+
+
+double Spacing::getValue() const
+{
+	return strToDbl(getValueAsString());
 }
 
 
 void Spacing::set(Spacing::Space sp, float val)
 {
+	set(sp, tostr(val));
+}
+
+
+void Spacing::set(Spacing::Space sp, string const & val)
+{
 	space = sp;
 	if (sp == Other) {
-		switch (int(val * 1000 + 0.5)) {
+		switch (int(strToDbl(val) * 1000 + 0.5)) {
 		case 1000: space = Single; break;
 		case 1250: space = Onehalf; break;
 		case 1667: space = Double; break;
@@ -53,15 +69,6 @@
 }
 
 
-void Spacing::set(Spacing::Space sp, string const & val)
-{
-	float fval = 0.0;
-	istringstream istr(val);
-	istr >> fval;
-	set(sp, fval);
-}
-
-
 void Spacing::writeFile(ostream & os, bool para) const
 {
 	if (space == Default) return;
@@ -69,10 +76,16 @@
 	string cmd = para ? "\\paragraph_spacing " : "\\spacing ";
 
 	if (getSpace() == Spacing::Other) {
+		#if 0
 		os.setf(ios::showpoint|ios::fixed);
 		os.precision(2);
 		os << cmd << spacing_string[getSpace()]
 		   << ' ' << getValue() << "\n";
+		#else
+		// should be sufficient, no?
+		os << cmd << spacing_string[getSpace()]
+		   << ' ' << getValueAsString() << "\n";
+		#endif
 	} else {
 		os << cmd << spacing_string[getSpace()] << "\n";
 	}
@@ -93,7 +106,7 @@
 	{
 		ostringstream ost;
 		ost << "\\begin{spacing}{"
-		<< getValue() << '}';
+		<< getValueAsString() << '}';
 		return ost.str();
 	}
 	}
Index: Spacing.h
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Spacing.h,v
retrieving revision 1.27
diff -u -r1.27 Spacing.h
--- Spacing.h	25 Jul 2004 12:59:12 -	1.27
+++ Spacing.h	5 Jan 2005 21:17:03 -
@@ -33,7 +33,7 @@
 		Default
 	};
 	///
-	Spacing() : space(Default), value(1.0) {}
+	Spacing() : space(Default), value("1.0") {}
 	///
 	Spacing(Spacing::Space sp, float val = 1.0) {
 		set(sp, val);
@@ -46,13 +46,15 @@
 		return space == Default;
 	}
 	///
-	float getValue() const;
+	std::string const getValueAsString() const;
+	///
+	double getValue() const;
 	///
 	Spacing::Space getSpace() const { return space; }
 	///
 	void set(Spacing::Space sp, float val = 1.0);
 	///
-	void set(Spacing::Space sp, std::string const & val) ;
+	void set(Spacing::Space sp, std::string const & val);
 	///
 	void writeFile(std::ostream &, bool para = false) const;
 	///
@@ -64,7 +66,7 @@
 	///
 	Space space;
 	///
-	float value;
+	std::string value;
 	/// names of line spacing
 	static std::string const spacing_string[];
 };
@@ -75,7 +77,7 @@
 bool operator==(Spacing const & a, Spacing const & b)
 {
 	return a.getSpace() == b.getSpace()
-		&& a.getValue() == b.getValue();
+		&& a.getValueAsString() == b.getValueAsString();
 }
 
 ///
Index: bufferparams.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferparams.C,v
retrieving revision 1.92
diff -u -r1.92 bufferparams.C
--- bufferparams.C	5 Jan 2005 20:21:24 -	1.92
+++ bufferparams.C	5 

Re: LyX needs help: Broken font metrics computation

2005-01-05 Thread Peter Kümmel
> Ruurd> 3.2.1 NC: top: -22 bottom: -12
> Ruurd> 3.3.3 Win32 Eval: top: -11 bottom: -1

I've fixed the wrong y-values of boundingBox.
qt/gpl now gives the same as "3.3.3 Win32 Eval".
I hope this is a step in the right direction.
Peter


Re: LyX needs help: Broken font metrics computation

2005-01-05 Thread Peter Kümmel

Ruurd> 3.2.1 NC: top: -22 bottom: -12 
Ruurd> 3.3.3 Win32 Eval: top: -11 bottom: -1

I've fixed the wrong y-values of boundingBox.
qt/gpl now gives the same as "3.3.3 Win32 Eval".
I hope this is a step in the right direction.
Peter


Passing LOCALEDIR, LYX_DIR and TOP_SRCDIR to package.C

2005-01-05 Thread Angus Leeming
In 1.3.x, we use the compiler to pass LOCALEDIR to main.C and to pass
LYX_DIR and TOP_SRCDIR to lyx_main.C:

g++ -DHAVE_CONFIG_H -I. -I../../src -I. -I../../boost -I/usr/include 
-isystem /usr/X11R6/include  -g -O -W -Wall
-DLOCALEDIR=\"/usr/local/share/locale\" -c ../../src/main.C

g++ -DHAVE_CONFIG_H -I. -I../../src -I. -I../../boost -I/usr/include 
-isystem /usr/X11R6/include  -g -O -W -Wall
-DLYX_DIR=\"/usr/local/share/lyx-1.3.6cvs\" \
  -DTOP_SRCDIR=\"../..\" -c ../../src/lyx_main.C

In 1.4.x, we take a different approach, using the configuration step to
generate support/path_defines.C from support/path_defines.C.in.

-   static string const ld = "%LYX_DIR%";
+   static string const ld = "/usr/local/share/lyx-1.4.0cvs";

-   static string const lts = "%TOP_SRCDIR%";
+   static string const lts = "/home/angus/lyx/devel";

-   static string const ll = "%LOCALEDIR%";
+   static string const ll = "/usr/local/share/locale";

-   static string const bl = "%BUILDDIR%";
+   static string const bl = "/home/angus/lyx/devel/build";

Should I do the same with support/package.C? Ie, pass it LOCALEDIR, LYX_DIR
and TOP_SRCDIR through the compiler in 1.3.x and generate it from
support/package.C.in in 1.4.x.?

Incidentally, "%BUILDDIR%" (returned by build_dir() in 1.4.x) isn't
actually used:
$ grep -r 'build_dir()' lyx/devel/src
lyx/devel/src/support/path_defines.C.in:string const & build_dir()

-- 
Angus



[patch] CPPFLAGS on info page

2005-01-05 Thread Lars Gullik Bjønnes

Make us have the CPPFLAGS also on the result-of-configure status page.

? Config
? cppflags-1.diff
? idxupdown2-1.diff
? includes-1.diff
? lib/help
Index: configure.ac
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/configure.ac,v
retrieving revision 1.34
diff -u -p -B -b -w -r1.34 configure.ac
--- configure.ac	4 Jan 2005 13:24:55 -	1.34
+++ configure.ac	5 Jan 2005 18:21:49 -
@@ -305,9 +305,9 @@ VERSION_INFO="Configuration\n\
   Host type:  ${host}\n\
   Special build flags:   ${lyx_flags}\n\
   C   Compiler:   ${CC}\n\
-  C   Compiler flags: ${CFLAGS}\n\
+  C   Compiler flags: ${CPPFLAGS} ${CFLAGS}\n\
   C++ Compiler:   ${CXX} ${CXX_VERSION}\n\
-  C++ Compiler flags: ${CXXFLAGS}\n\
+  C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\
   Linker flags:   ${LDFLAGS}\n\
 ${FRONTEND_INFO}\
   LyX binary dir: ${real_bindir}\n\

-- 
Lgb


Re: Compile LyX 1.4 on Win32 with MinGW

2005-01-05 Thread Lars Gullik Bjønnes
"Michael Schmitt" <[EMAIL PROTECTED]> writes:

| Dear Angus, Lars,
>
| I cannot compile LyX 1.4 with MinGW (all the latest packages) for
| several reasons. The first problem that makes g++ stop is a missing
| file in the boost library that is used for compling file cregex.cpp
| (which again calls shared_count.cpp indirectly).
>
| boost/detail/lwm_win32_nt.hpp
>
| Could somebody please add this file to the LyX sources?

fixed now.

-- 
Lgb



Defining USE_FOO_PACKAGING macros

2005-01-05 Thread Angus Leeming
Jean-Marc,

I've currently got this hard-coded in package.C:

#ifdef _WIN32
# define USE_WINDOWS_PACKAGING
#elif defined(macintosh) || defined(__APPLE__)
# define USE_MACOSX_PACKAGING
#else // (linux, cygwin, darwin, emx)
# define USE_POSIX_PACKAGING
#endif

I guess that's not how you envisage things ending up given that either
USE_MACOSX_PACKAGING or USE_POSIX_PACKAGING might be defined on the Mac.

I assume that the idea is to have a "--packaging={windows,macosx,posix}"
option to configure. Not passing "--packaging=foo" on the command line
will lead to the "native" packaging being chosen. The three macros above
will be defined appropriately in config.h.

However, it seems that this option should have an effect only on the Mac
and, moreover, will respect only the {macosx,posix} strings.

Could you outline how I should proceed?

-- 
Angus



Re: LyX needs help: Broken font metrics computation

2005-01-05 Thread Michael Schmitt
Jean-Marc,
Michael, a quick question: are you sure of your test program?
No, I am not sure. I just tried to create the smallest possible test case 
that does not crash and produces some "reasonable" output. To make sure we 
are not hunting a phantom, we can use the Qt example "examples/drawdemo/" 
and inject the code of the test case.

While
googling I found a message saying that asking for a font metrics
without a properly set QPainter was asking for trouble... Shouldn't
you use one?
Also, is the "times" font that you use a truetype one? I ask because I
found the following change in qt 3.3 here
http://www.google.fr/search?q=cache:mMYbZOysSPQJ:www.qbssoftware.com/product_info.asp%3Fcurrent%3DDETAILEDINFO%26product%3Dqt+qfontmetrics+qt+3.3&hl=fr
* QFontMetrics: (Windows only) fixed QFontMetrics::boundingRect(
  QChar c ) to work for non-TrueType fonts
I am not sure what it means, and I have not been able to find this
information on trolltech's site.
Me neither...
Michael 



Re: LyX 1.3.5 for Win32 released - a nasty bug

2005-01-05 Thread Michael Schmitt
Dear Uwe,
> - The blue boxes in the math insets are too small and the cursor too
> big, see the two attached screenshots.

It is all more or less related to the same problem. Once we have fixed the 
font metrics, math formula should look much better.

I hope this is easy to fix, because it is very annoying.
I hope so, too.
Michael



Re: LyX needs help: Broken font metrics computation

2005-01-05 Thread Jean-Marc Lasgouttes
> "Ruurd" == Ruurd Reitsma <[EMAIL PROTECTED]> writes:

>> What output do you have with Michael's testcase in Qt/Win 3.2.1 NC?

Ruurd> 3.2.1 NC: top: -22 bottom: -12 
Ruurd> 3.3.3 Win32 Eval: top: -11 bottom: -1

The second one is normal, according to 
http://doc.trolltech.com/3.3/qrect.html#details
and
http://doc.trolltech.com/3.3/qfontmetrics.html#boundingRect

The -1 is basically 0 (see description of QRect) and is consistent
with the fact that 'x' does not extend below the baseline. A 'g' would
have given a nonnegative bottom value.

The 3.2.1nc value is strange. It may be related to the QFontMetrics
change I just mentioned elsewhere in this thread. It may be that qt
3.2.x is not usable for us in windows, or that we have to translate
the values (one always have bottom-top=10 in this case).

However, I think the values returned by Qt/Win Free are completely
bogus. I guess we can make sense of them by reading the description
above, the source of QFontEngineWin::boundingBox(glyph_t) (which is
simple) and the description of GetGlyphOutline
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_52at.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_48he.asp

JMarc


Re: [Patch] More enable switches

2005-01-05 Thread Lars Gullik Bjønnes
[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes:

| This patch adds configure switches for:
|  - precompiled headers
|  - concept checks
|  - libstdc++ debug mode

This is the updated patch that I am going to commit.

? Config
? config-1.diff
? cppflags-1.diff
? cppflags-2.diff
? enable-1.diff
? enable-2.diff
? inset-1.diff
? lyxsocket-1.diff
? lyxsocket-2.diff
? lyxsocket-3.diff
? lyxsocket-4.diff
? stuff.diff
? test
? test.C
? work.diff
? lib/help
? src/make.log
? src/frontends/qt2/output
? src/frontends/xforms/FormExternal.ii
? src/frontends/xforms/FormExternal.s
? src/frontends/xforms/FormExternal2.cc
? src/frontends/xforms/pch.ii
? src/frontends/xforms/pch.s
? src/insets/render_graphic.ii
? src/insets/render_graphic.s
? src/insets/test.C
? src/insets/test.ii
? src/insets/test.s
? src/support/FM.C
? src/support/FM.ii.gz
? src/support/FM.s
? src/support/FileMonitor-2.ii
? src/support/FileMonitor.ii
? src/support/FileMonitor.s
Index: config/lyxinclude.m4
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/lyxinclude.m4,v
retrieving revision 1.103
diff -u -p -B -b -w -r1.103 lyxinclude.m4
--- config/lyxinclude.m4	28 Dec 2004 13:48:48 -	1.103
+++ config/lyxinclude.m4	5 Jan 2005 16:03:07 -
@@ -178,12 +178,28 @@ fi
 ### We might want to disable debug
 AC_ARG_ENABLE(debug,
   AC_HELP_STRING([--enable-debug],[enable debug information]),,
-  [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes && test $ac_cv_prog_gxx = yes ; then
+  [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
 	enable_debug=yes;
 else
 	enable_debug=no;
 fi;])
 
+AC_ARG_ENABLE(stdlib-debug,
+  AC_HELP_STRING([--enable-stdlib-debug],[enable debug mode in the standard library]),,
+  [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
+  enable_debug_mode=yes;
+else
+  enable_debug_mode=no;
+fi;])
+
+AC_ARG_ENABLE(concept-checks,
+  AC_HELP_STRING([--enable-concept-checks],[enable concept checks]),,
+  [ if test $lyx_devel_version = yes -o $lyx-prerelease = yes ; then
+	enable_concept_checks=yes;
+else
+enable_concept_checks=no;
+fi;])
+
 ### set up optimization
 AC_ARG_ENABLE(optimization,
   AC_HELP_STRING([--enable-optimization[=value]],[enable compiler optimisation]),,
@@ -194,9 +210,12 @@ case $enable_optimization in
 *) lyx_opt=${enable_optimization};;
 esac
 
+AC_ARG_ENABLE(pch,
+  AC_HELP_STRING([--enable-pch],[enable precompiled headers]),,
+	enable_pch=yes;)
 lyx_pch_comp=no
 
-# set the debug flags correctly.
+# set the compiler options correctly.
 if test x$GXX = xyes; then
   dnl Useful for global version info
   gxx_version=`${CXX} -dumpversion`
@@ -209,40 +228,50 @@ if test x$GXX = xyes; then
   2.95.1)  CXXFLAGS="$lyx_opt -fpermissive -ftemplate-depth-30";;
   2.95.*)  CXXFLAGS="$lyx_opt -Wno-non-template-friend -ftemplate-depth-30";;
   2.96*)  CXXFLAGS="$lyx_opt -fno-exceptions -ftemplate-depth-30 -Wno-non-template-friend";;
-  3.0*)CXXFLAGS="$lyx_opt";;
   3.1*)CXXFLAGS="$lyx_opt -finline-limit=500 -fno-exceptions";;
-  3.2*)CXXFLAGS="$lyx_opt -fno-exceptions";;
-  3.3*)CXXFLAGS="$lyx_opt -fno-exceptions";;
+  3.2*|3.3*)CXXFLAGS="$lyx_opt -fno-exceptions";;
   3.4*|4.0*)
 	CXXFLAGS="$lyx_opt -fno-exceptions"
-	lyx_pch_comp=yes;;
+	test $enable_pch = yes && lyx_pch_comp=yes
+	;;
   *)   CXXFLAGS="$lyx_opt";;
 esac
 if test x$enable_debug = xyes ; then
+	CXXFLAGS="-g $CXXFLAGS"
+fi
+  fi
+  if test x$enable_stdlib_debug = xyes ; then
 	case $gxx_version in
-	3.3*) CXXFLAGS="-g $CXXFLAGS"
-		AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
-		;;
-	3.4*|4.0*) CXXFLAGS="-g $CXXFLAGS"
-		AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
+  3.4*|4.0*)
+lyx_flags="$lyx_flags stdlib-debug"
 		AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode])
 		AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode])
 		;;
-	*)CXXFLAGS="-g $CXXFLAGS";;
 	esac
 fi
+  if test x$enable_concept_checks = xyes ; then
+lyx_flags="$lyx_flags concept-checks"
+case $gxx_version in
+  3.3*)
+AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
+	;;
+  3.4*|4.0*)
+	AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
+	;;
+esac
   fi
   if test x$enable_warnings = xyes ; then
 case $gxx_version in
-	2.95.*) CPPFLAGS="$CPPFLAGS -W -Wall";;
-	2.96*)  CPPFLAGS="$CPPFLAGS -W -Wall";;
-	3.1*) CPPFLAGS="$CPPFLAGS -W -Wall";;
-	3.2*) CPPFLAGS="$CPPFLAGS -W -Wall";;
-	3.3*) CPPFLAGS="$CPPFLAGS -W -Wall";;
-	*)CPPFLAGS="$CPPFLAGS -Wextra -Wall";;
+  2.*|3.1*|3.2*|3.3*)
+CPPFLAGS="$CPPFLAGS -W -Wall"
+;;
+  *)
+CPPFLAGS="$CPPFLAGS -Wextra -Wall"
+;;
 esac
   fi
 fi
+test "$lyx_pch_comp" = yes && lyx_flags="$lyx_flags pch"

Re: lyx2lyx patch

2005-01-05 Thread Jose' Matos
On Monday 03 January 2005 18:50, Jose' Matos wrote:
> Hi,
>   this is an intermediate patch to make lyx2lyx more robust in the stable
> versions.
>
>   This patch makes all the filter have the same call syntax.
>
>   I will apply it tomorrow if no one objects. The next phase implies to
> catch exceptions if the lyx2lyx version is stable.

Here follows the second part.

The goal was to concentrate all the convertions into a single place.

  Now it is possible to catch exceptions thrown from the convertion steps.
  It is now easy to be more verbose about the convertion steps, helping to 
debug the transformations.

  I hope the code is easier to follow, since I move some of the convertion 
logic from the plugins to LyX.py
-- 
Josà AbÃlio
Index: LyX.py
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/LyX.py,v
retrieving revision 1.7
diff -u -p -r1.7 LyX.py
--- LyX.py	5 Jan 2005 10:57:37 -	1.7
+++ LyX.py	5 Jan 2005 15:31:22 -
@@ -23,7 +23,7 @@ import sys
 import re
 import string
 
-version = "1.4.0cvs"
+version_lyx2lyx = "1.4.0cvs"
 default_debug_level = 2
 
 # Regular expressions used
@@ -224,7 +224,7 @@ class LyX_Base:
 
 def set_version(self):
 " Set the header with the version used."
-self.header[0] = "#LyX %s created this file. For more info see http://www.lyx.org/"; % version
+self.header[0] = "#LyX %s created this file. For more info see http://www.lyx.org/"; % version_lyx2lyx
 if self.header[1][0] == '#':
 del self.header[1]
 
@@ -265,8 +265,28 @@ class LyX_Base:
 self.warning("convertion chain: " + str(convertion_chain), 3)
 
 for step in convertion_chain:
-convert_step = getattr(__import__("lyx_" + step), mode)
-convert_step(self)
+steps = getattr(__import__("lyx_" + step), mode)
+
+if not steps:
+self.error("The convertion to an older format (%s) is not implemented." % self.format)
+
+if len(steps) == 1:
+version, table = steps[0]
+for conv in table:
+conv(self)
+self.format = version
+continue
+
+for version, table in steps:
+if self.format >= version and mode == "convert":
+continue
+if self.format <= version and mode == "revert":
+continue
+for conv in table:
+conv(self)
+self.format = version
+if self.end_format == self.format:
+return
 
 
 def chain(self):
Index: lyx2lyx
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v
retrieving revision 1.31
diff -u -p -r1.31 lyx2lyx
--- lyx2lyx	16 Oct 2004 22:56:10 -	1.31
+++ lyx2lyx	5 Jan 2005 15:31:22 -
@@ -51,7 +51,7 @@ def parse_options(argv):
 usage()
 sys.exit()
 if o in ("-v", "--version"):
-print "lyx2lyx, version %s" %(LyX.version)
+print "lyx2lyx, version %s" %(LyX.version_lyx2lyx)
 print "Copyright (C) 2002-2004 José Matos and Dekel Tsur"
 sys.exit()
 if o in ("-d", "--debug"):
Index: lyx_0_12.py
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx_0_12.py,v
retrieving revision 1.5
diff -u -p -r1.5 lyx_0_12.py
--- lyx_0_12.py	5 Jan 2005 10:57:37 -	1.5
+++ lyx_0_12.py	5 Jan 2005 15:31:22 -
@@ -137,11 +137,6 @@ def update_space_units(file):
 lines[i] = string.replace(lines[i], old, new)
 
 
-def update_inset_accent(file):
-lines = file.body
-pass
-
-
 def remove_cursor(file):
 lines = file.body
 i = 0
@@ -278,22 +273,13 @@ def update_latexaccents(file):
 i = i + 1
 
 
-def convert(file):
-table = [header_update, add_end_document, remove_cursor,
- final_dot, update_inset_label, update_latexdel,
- update_space_units, update_inset_accent,
- space_before_layout, formula_inset_space_eat,
- update_tabular, update_vfill, remove_empty_insets,
- remove_formula_latex, update_latexaccents]
-
-for conv in table:
-conv(file)
-
-file.format = 215
-
-
-def revert(file):
-file.error("The convertion to an older format (%s) is not implemented." % file.format)
+convert = [[215, [header_update, add_end_document, remove_cursor,
+  final_dot, update_inset_label, update_latexdel,
+  update_space_units, space_before_layout,
+  formula_inset_space_eat, update_tabular,
+  update_vfill, remove_empty_insets,
+  remove_formula_latex, update_latexaccents]]]
+revert  = []
 
 
 if __name__ == "__main__":
Index: lyx_1_0_0.py
==

Re: Packaging corner case

2005-01-05 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> As it stands, if LyX is found to be run in-place, then the
Angus> "-sysdir" command line and the "LYX_DIR_13X" environment
Angus> variable are both ignored. (They're checked in
Angus> get_system_lyxdir().)

Angus> Is this acceptable, or should we be able to specify an
Angus> arbitrary system_lyxdir when running lyx from the build tree?

I think that's OK. When running in place, we should use the original
source tree as system_lyxdir.

JMarc


Re: LyX needs help: Broken font metrics computation

2005-01-05 Thread Jean-Marc Lasgouttes
> "Michael" == Michael Schmitt <[EMAIL PROTECTED]> writes:

Michael> Dear Ralf, Christian, and all others, as you have already
Michael> noticed, the LyX team is working on a native Win32 port of
Michael> their text processor, using your GPL'd QT/Win32. Things have
Michael> progressed nicely in the last couple of weeks and Qt/Win32
Michael> seems to work quite well.

Michael, a quick question: are you sure of your test program? While
googling I found a message saying that asking for a font metrics
without a properly set QPainter was asking for trouble... Shouldn't
you use one?

Also, is the "times" font that you use a truetype one? I ask because I
found the following change in qt 3.3 here
http://www.google.fr/search?q=cache:mMYbZOysSPQJ:www.qbssoftware.com/product_info.asp%3Fcurrent%3DDETAILEDINFO%26product%3Dqt+qfontmetrics+qt+3.3&hl=fr


 * QFontMetrics: (Windows only) fixed QFontMetrics::boundingRect(
   QChar c ) to work for non-TrueType fonts

I am not sure what it means, and I have not been able to find this
information on trolltech's site.

JMarc



Re: LyX needs help: Broken font metrics computation

2005-01-05 Thread Ruurd Reitsma
"Jean-Marc Lasgouttes" <[EMAIL PROTECTED]>
wrote in message news:[EMAIL PROTECTED]
> > "Ruurd" == Ruurd Reitsma
<[EMAIL PROTECTED]> writes:
>
> Ruurd> On the Lyx side, this helps:
> [...]
> Ruurd> At least, with Non-Commercial 3.2.1.
>
> So you mean that official Qt/Win and Qt/X have different semantics for
> font metrics? This is mind-boggling.
>
> What output do you have with Michael's testcase in Qt/Win 3.2.1 NC?

3.2.1 NC:
top: -22   bottom: -12
3.3.3 Win32 Eval:
top: -11   bottom: -1

I´m lost The only thing I see is consistancy in it being negative
numbers on all official Trolltech versions.

>
> Ruurd> Here, the lyx_gui::needs_ugly_metrics_hack() is also needed.
> Ruurd> This ugly_metrics_hack is not needed for the free 3.3.3.
>
> We have to sort out this too, and I suspect this is related.

Isn´t this a bug in the math fonts itself? Maybe this is fixed by the new Qt
3.3.x font handling.

Ruurd





Packaging corner case

2005-01-05 Thread Angus Leeming
Jean-Marc,

My little package test code ascertains the system_lyxdir so:

// Is LyX being run in-place from the build tree?
boost::tie(build_lyxdir_, system_lyxdir_) = get_build_dirs(abs_binary);

if (build_lyxdir_.empty())
system_lyxdir_ = 
get_system_lyxdir(abs_binary, command_line_system_lyxdir);

As it stands, if LyX is found to be run in-place, then the "-sysdir"
command line and the "LYX_DIR_13X" environment variable are both ignored.
(They're checked in get_system_lyxdir().)

Is this acceptable, or should we be able to specify an arbitrary
system_lyxdir when running lyx from the build tree?

-- 
Angus



Re: LyX needs help: Broken font metrics computation

2005-01-05 Thread Jean-Marc Lasgouttes
> "Ruurd" == Ruurd Reitsma <[EMAIL PROTECTED]> writes:

Ruurd> On the Lyx side, this helps:
[...]
Ruurd> At least, with Non-Commercial 3.2.1. 

So you mean that official Qt/Win and Qt/X have different semantics for
font metrics? This is mind-boggling.

What output do you have with Michael's testcase in Qt/Win 3.2.1 NC?

Ruurd> Here, the lyx_gui::needs_ugly_metrics_hack() is also needed.
Ruurd> This ugly_metrics_hack is not needed for the free 3.3.3.

We have to sort out this too, and I suspect this is related.

JMarc


Re: LyX needs help: Broken font metrics computation

2005-01-05 Thread Ruurd Reitsma
"Michael Schmitt" <[EMAIL PROTECTED]>
wrote in message news:[EMAIL PROTECTED]
> However, we have a serious problem with the computation of font metrics. I
> have generated a small test case that illustrates the problem:
>
> #include 
>
> int main(int argc, char **argv) {
>   QApplication app(argc, argv);
>   QFont f("times",18,QFont::Bold);
>   QFontMetrics fm(f);
>   QRect r = fm.boundingRect('x');
>   printf( "top: %d   bottom: %d", r.top(), r.bottom());
>   return 0;
> }
>
> If you compile and run this program with GPL'd Qt/Win32, it outputs
>
>top: 16  bottom:36
>
> However, if you run exactly the same program with Qt/X11 on cygwin (or on
> Linux), you get the following output:
>
>   top: -9  bottom: -1
>

On the Lyx side, this helps:

--- ../../qfont_metrics.C   2003-02-14 12:22:48.0 +0100
+++ frontends/qt2/qfont_metrics.C   2005-01-05 14:32:20.677692800 +0100
@@ -77,7 +77,11 @@
if (!lyxrc.use_gui)
return 1;
QRect const & r = metrics(f).boundingRect(c);
+#if defined(Q_WS_WIN)
+   return -r.bottom()-1;
+#else
return r.bottom()+1;
+#endif
 }

At least, with Non-Commercial 3.2.1. Here, the
lyx_gui::needs_ugly_metrics_hack() is also needed. This ugly_metrics_hack is
not needed for the free 3.3.3.

Anyway, I don´t have a X11 LyX handy to compare with. I suspect the
horizontal metrics are also inverted (accents etc.)

Ruurd









Re: [PATCH 13x only] FileInfo -> lyx::FileInfo

2005-01-05 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> I think that's overkill for the 1.3.x tree, but I do propose
Angus> moving FileInfo into namespace lyx.

Angus> Patch attached. Ok?

Yes, OK.

JMarc


[PATCH 13x only] FileInfo -> lyx::FileInfo

2005-01-05 Thread Angus Leeming
Jean-Marc,

Andreas reports that
#include 
which is needed to compile the code below to ascertain the user_lyxdir on
the Mac
FSRef fsref;
OSErr const error_code =
FSFindFolder(kUserDomain, kApplicationSupportFolderType,
 kDontCreateFolder, &fsref);
if (error_code != 0)
return string();

char application_support[PATH_MAX + 1];
OSStatus const status_code =
FSRefMakePath(&fsref, application_support, PATH_MAX);
if (status_code != 0)
return string();

return AddPath(application_support, PACKAGE);

pulls in a type 'FileInfo' that clashes with our own FileInfo class.

There's no problem in the 1.4.x tree, because our class is hidden away:
namespace lyx {
namespace support {
class FileInfo;
} // namespace support
} namespace lyx

I think that's overkill for the 1.3.x tree, but I do propose moving
FileInfo into namespace lyx.

Patch attached. Ok?

-- 
Angus

FileInfo.diff.bz2
Description: BZip2 compressed data


Re: [Patch] More enable switches

2005-01-05 Thread Angus Leeming
Lars Gullik Bjønnes wrote:
> | Lars Gullik Bjønnes wrote:
>>> what you also can try is to ask make why it thinks rebuilding
>>> pch.h.gch is necessary.
>>> 
>>> make -d pch.h.gch
>>> 
>>> (will give a lot of output, interesting stuff at end I think)
>>
> | Lars, could you run this for me please. Here's what I get:
>>
> | $ cd build/make
> | $ make -d pch.h.gch > make.log 2>&1
> | $ grep Prerequisite make.log | grep -v older
> |Prerequisite `stamp-h1' is newer than target `config.h'.
> |  Prerequisite `config.h' is newer than target `pch.h.gch'.
> |  Prerequisite `../../boost/boost/config/compiler/gcc.hpp' is newer than
> | target `pch.h.gch'.
> 
> grep Prerequisite make.log | grep -v older
>Prerequisite `stamp-h1' is newer than target `config.h'.
> 
> Is all I get.
> 
> what happens if you touch pch.h.gch before running the make cmd?

The same as you. Just the stamp-h1 file. I've repeated the exercise with
the pch.h.gch files in the other problem directories and all is now fine.

Many thanks for your help.
-- 
Angus



Re: [Patch] More enable switches

2005-01-05 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
>> what you also can try is to ask make why it thinks rebuilding
>> pch.h.gch is necessary.
>> 
>> make -d pch.h.gch
>> 
>> (will give a lot of output, interesting stuff at end I think)
>
| Lars, could you run this for me please. Here's what I get:
>
| $ cd build/make
| $ make -d pch.h.gch > make.log 2>&1
| $ grep Prerequisite make.log | grep -v older
|Prerequisite `stamp-h1' is newer than target `config.h'.
|  Prerequisite `config.h' is newer than target `pch.h.gch'.
|  Prerequisite `../../boost/boost/config/compiler/gcc.hpp' is newer than
| target `pch.h.gch'.

grep Prerequisite make.log | grep -v older
   Prerequisite `stamp-h1' is newer than target `config.h'.

Is all I get.

what happens if you touch pch.h.gch before running the make cmd?

-- 
Lgb



Re: [Patch] More enable switches

2005-01-05 Thread Angus Leeming
Lars Gullik Bjønnes wrote:
> what you also can try is to ask make why it thinks rebuilding
> pch.h.gch is necessary.
> 
> make -d pch.h.gch
> 
> (will give a lot of output, interesting stuff at end I think)

Lars, could you run this for me please. Here's what I get:

$ cd build/make
$ make -d pch.h.gch > make.log 2>&1
$ grep Prerequisite make.log | grep -v older
   Prerequisite `stamp-h1' is newer than target `config.h'.
 Prerequisite `config.h' is newer than target `pch.h.gch'.
 Prerequisite `../../boost/boost/config/compiler/gcc.hpp' is newer than
target `pch.h.gch'.

-- 
Angus



Re: [Patch] More enable switches

2005-01-05 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
>> | Ok, Lars, here's the output of
>> | $ make > make.log 2>&1
>>>
>> | Note all those unnecessary compilations of the precompiled headers.
>> | Note also that the executables were not linked, so somehow make knows
>> | that these steps were unnecessary.
>> 
>> "all those" I see 3 different placens (one double):
>> 
>>  - build/src/support
>>  - build/src (twice)
>>  - build/src/frontends/xforms/forms
>> 
>> I have no idea why these are run.
>> 
>> | Any ideas on how to proceed further?
>> 
>> what about having a look at pch.h.gch.dep?
>
| Could you email me your copies of this file for the three directories and
| I'll compare and contrast.

what you also can try is to ask make why it thinks rebuilding
pch.h.gch is necessary.

make -d pch.h.gch

(will give a lot of output, interesting stuff at end I think)

-- 
Lgb



Re: [PATCH 13x, 14x] getting rid of lib/configure.cmd

2005-01-05 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Ok, here they are remade. Still happy?

Yes.

JMarc


Re: [Patch] More enable switches

2005-01-05 Thread Angus Leeming
Lars Gullik Bjønnes wrote:
> | Ok, Lars, here's the output of
> | $ make > make.log 2>&1
>>
> | Note all those unnecessary compilations of the precompiled headers.
> | Note also that the executables were not linked, so somehow make knows
> | that these steps were unnecessary.
> 
> "all those" I see 3 different placens (one double):
> 
>  - build/src/support
>  - build/src (twice)
>  - build/src/frontends/xforms/forms
> 
> I have no idea why these are run.
> 
> | Any ideas on how to proceed further?
> 
> what about having a look at pch.h.gch.dep?

Could you email me your copies of this file for the three directories and
I'll compare and contrast.

-- 
Angus



Re: [patch] float2str #3

2005-01-05 Thread Juergen Spitzmueller
Lars Gullik Bjønnes wrote:
> I think getDPI should be an int. a float does not really make sense.

OK, that's how I have changed it in the meantime. I'm gonna commit the stuff.

Jürgen