Re: MSVC wrapper

2004-12-16 Thread Angus Leeming
Ruurd Reitsma wrote:

 By request, this the wrapper tool that I use to compile LyX with MSVC.
 All thanks to the Coin3D project. Cygwin is used to run the autotools and
 make, but compilation is native Win32 with MSVC.
 
 IMO this is the most time efficient way to do it. I have fiddled with
 Visual Studio projects and Qt .pro files for a while, but it´s hard to
 keep up with the automake tools.

Incidentally, Ruurd, do you need this wrapper at all? Why not patch the
scripts in config to generate Makefiles that 'just do the right thing'?

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Lars Gullik Bjønnes
Angus Leeming [EMAIL PROTECTED] writes:

| As promised, I'm posting the remainder of the changes that are needed to
| compile LyX with MinGW. This patch is much less intrusive than the
| original because the offensive os_win32.h is how #included only by
| those .C files that actually need it.

I am not sure I like that solution.

We should work hard to get all platform specific code out of the
regular .C files.

If a support/os.h works equally well we should use that instead.
(and no conditionals)

| Index: src/insets/insetgraphics.C
| ===
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
| retrieving revision 1.146.2.4
| diff -u -p -r1.146.2.4 insetgraphics.C
| --- src/insets/insetgraphics.C7 Dec 2004 10:49:34 -   
1.146.2.4
| +++ src/insets/insetgraphics.C16 Dec 2004 01:04:46 -
| @@ -623,6 +623,8 @@ string const InsetGraphics::prepareFile(
|   // without dots and again with ext
|   temp_file = ChangeExtension(
|   subst(temp_file, ., _), ext_tmp);
| + //Remove drive letter on Win32
| + if (temp_file[1] == ':') temp_file = temp_file.erase(0,2);

split on two lines

|   // now we have any_dir_file.ext
|   temp_file = MakeAbsPath(temp_file, buf-tmppath);
|   lyxerr[Debug::GRAPHICS]
| Index: src/support/FileInfo.C
| ===
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/FileInfo.C,v
| retrieving revision 1.18.2.2
| diff -u -p -r1.18.2.2 FileInfo.C
| --- src/support/FileInfo.C15 Dec 2004 21:40:03 -  1.18.2.2
| +++ src/support/FileInfo.C16 Dec 2004 01:04:46 -
| @@ -174,10 +178,20 @@ void FileInfo::init()
|  
|  void FileInfo::dostat(bool link)
|  {
| + string name(fname_);
| +#ifdef _WIN32
| + // Win32 stat() doesn't dig trailing slashes
| + if (name.at(name.size()-1) == '/') name.erase(name.size() -1);

ditto 

| Index: src/support/filetools.C
| ===
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
| retrieving revision 1.146.2.7
| diff -u -p -r1.146.2.7 filetools.C
| --- src/support/filetools.C   15 Dec 2004 19:35:11 -  1.146.2.7
| +++ src/support/filetools.C   16 Dec 2004 01:04:48 -
| @@ -193,10 +196,12 @@ string const FileOpenSearch(string const
|   notfound = false;
|   }
|   }
| -#ifdef __EMX__
| +#if defined(__EMX__) || defined(_WIN32) 
|   if (ext.empty()  notfound) {
|   real_file = FileOpenSearch(path, name, exe);
| - if (notfound) real_file = FileOpenSearch(path, name, cmd);
| +#ifdef __EMX__
| + if (notfound) real_file = FileOpenSearch(path, name,
| cmd);

ditto (even if not done before)

| Index: src/support/kill.C
| ===
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/kill.C,v
| retrieving revision 1.7
| diff -u -p -r1.7 kill.C
| --- src/support/kill.C10 Jun 2002 17:31:57 -  1.7
| +++ src/support/kill.C16 Dec 2004 01:04:48 -
| @@ -5,7 +5,40 @@
|  #include sys/types.h
|  #include csignal
|  
| +#ifdef _WIN32
| +#include debug.h
| +#include os.h
| +
| +#include windows.h
| +#include errno.h

 cerrno ??

| +
| +using std::endl;
| +#endif //_WIN32

and debug.h, os.h, std::endl is not specific enough for WIN32 to be
inside a ifdef, just put them outside.

| +
|  int lyx::kill(int pid, int sig)
|  {
| +#ifdef _WIN32
| + if (pid == (int)GetCurrentProcessId())
| + return -(raise(sig));

Hmm.. Do we ever send signals to ourselves. Perhaps we should just
assert on that condition.

Either that or handle win/non-win in the same way.

| + else{
| + HANDLE hProcess;
| + if (!(hProcess =
| + OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid))) {
| + lyxerr  kill OpenProcess failed!  endl;
| + return -1;
| + }
| + else {
| + if (!TerminateProcess(hProcess, sig)){
| + lyxerr  kill process failed!  endl;
| + CloseHandle(hProcess);
| + return -1;
| + }
| + CloseHandle(hProcess);
| + }
| + }
| + return 0;
| +
| +#else
|   return ::kill(pid, sig);

And we should probably check this for errors as well.
(and log them)

-- 
Lgb



Re: MSVC wrapper

2004-12-16 Thread Ruurd Reitsma
Angus Leeming [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Incidentally, Ruurd, do you need this wrapper at all? Why not patch the
 scripts in config to generate Makefiles that 'just do the right thing'?

I did try that at first, but I wasn´t very successfull. If remember
correctly, there is some rudimentary support for msvc in the autotools. It
worked, but was horribly slow. Handling all that stuff in C++ did speed it
up by a very large factor.

Maybe some other cross platform open source project has figured out a more
elegant solution by now

Ruurd





Re: [PATCH 13x, 14x] configure tests for mkdir

2004-12-16 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus It turned out that this solution was incorrect. Compilation
Angus failed on the Windows machine because the definition of a mkdir
Angus macro in config.h conflicted with another mkdir macro defined
Angus in mingw/include/os.h.

Angus I have therefore removed these nasty macros and placed the
Angus #ifdef HAVE_MKDIR conditional block inside the support/mkdir.C
Angus routine. Much more robust.

That is much much better anyway.

JMarc


Re: sideways tables/figures

2004-12-16 Thread Jean-Marc Lasgouttes
 Edwin == Edwin Leuven [EMAIL PROTECTED] writes:

Edwin PPS trying to open a doc, lyx crashes:

What doc was that?

JMarc



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Lars Gullik Bjønnes wrote:
 | As promised, I'm posting the remainder of the changes that are needed
 | to compile LyX with MinGW. This patch is much less intrusive than the
 | original because the offensive os_win32.h is how #included only by
 | those .C files that actually need it.
 
 I am not sure I like that solution.
 
 We should work hard to get all platform specific code out of the
 regular .C files.
 
 If a support/os.h works equally well we should use that instead.
 (and no conditionals)

You misunderstand me. (I was unable to express myself clearly at one 
o'clock in the morning.)

I am not proposing that this patch should go into the tree. Anything but. 
I am saying that this is the patch that is needed to make LyX compile on 
Windows. Things in the patch can be classified in three groups:

1. Things to do with using LyX on a Windows machine. That is, the stuff in 
os_win32.C (The .C file, not the .h file which is a kludge). The 
insetgraphics.C fix. These things will probably go into the tree pretty 
much as-is (once I actually understand what they do ;-))

2. Things to do with files. For example, symbolic links do not exist on 
Windows. There are changes to filetools.C and FileInfo.C that will be 
needed but which are masked by the empty macros in os_win32.h. These 
things will need some configure-magic but the basic code is probably fine.

3. Things to do with external processes. Launching, 'em, communicating 
with 'em throught FIFOs and killing 'em. ispell.C, lyxserver.C, 
lyx_cb.C, kill.C, forkedcall.C, forkedcontrl.C. The empty macros of 
os_win32.h hide the fact that the Windows API is fundamentally different 
to the Posix one. This code will need to be re-written entirely in order 
to provide Windows users with the same power as *nix ones.

Addressing the issues in the first two of these groups is straightforward. 
Group 3 will need more work and the changes may well be unsuited to the 
1.3.x branch. Time will tell.

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus As promised, I'm posting the remainder of the changes that are
Angus needed to compile LyX with MinGW. This patch is much less
Angus intrusive than the original because the offensive os_win32.h is
Angus how #included only by those .C files that actually need it.

   +#ifdef _WIN32
   +# include support/os_win32.h
   +#endif
   +

I am not very fond of this thing. Could you at least in each of these
instance add a comment telling what construct is missing? Then we
could try to have a strategy on avoiding some of this stuff. 

The same holds for the other instances.
 
   +#ifdef HAVE_UNISTD_H
   +# include unistd.h
   +#endif
   +

cunistd?

 
   +#ifdef HAVE_SELECT
   retval = ::select(SELECT_TYPE_ARG1 (max(pipeout[0], pipeerr[0]) + 1),
   SELECT_TYPE_ARG234 (infds),
   0,
   0,
   SELECT_TYPE_ARG5 (tv));
   +#else
   +retval = -1;
   +#endif

Does it mean that ispell will not work in windows?

   @@ -289,7 +293,7 @@ void LyX::init(bool gui)
   do {
   // Path of binary/../share/name of binary/
   searchpath += NormalizePath(AddPath(binpath, ../share/) +
   -  OnlyFilename(binname)) + ';';
   +  ChangeExtension(OnlyFilename(binname),)) + ';';

Don't we need something more selective, like removing .exe from the
end of the string if it is here? Actually, I guess the whole LyX::init
strategy should be rethought in the light of our platform support.

A little digression: instead of our current os:: namespace, wouldn't
it be better to have a hierarchy of os_foo classes with static
methods, so that some environment could inherit others (like cygwin =
unix + some stuff). The some of the code from this init method could
be moved to os_foo.C files.


   @@ -113,6 +113,7 @@ string const fromqstr(QString const  st
{
   QTextCodec * codec = QTextCodec::codecForLocale();
   QCString tmpstr = codec-fromUnicode(str);
   -char const * tmpcstr = tmpstr;
   +char const * tmpcstr = \0;
   +if (!tmpstr.isEmpty()) tmpcstr = tmpstr;
   return tmpcstr;
}

Do you know what this does exactly? The indentation is wrong anyway.

   @@ -623,6 +623,8 @@ string const InsetGraphics::prepareFile(
   // without dots and again with ext
   temp_file = ChangeExtension(
   subst(temp_file, ., _), ext_tmp);
   +//Remove drive letter on Win32
   +if (temp_file[1] == ':') temp_file = temp_file.erase(0,2);
   // now we have any_dir_file.ext
   temp_file = MakeAbsPath(temp_file, buf-tmppath);
   lyxerr[Debug::GRAPHICS]

I do not like this. Is there a reason why this should not be handled
by some generic function?

   @@ -193,10 +196,12 @@ string const FileOpenSearch(string const
   notfound = false;
   }
   }
   -#ifdef __EMX__
   +#if defined(__EMX__) || defined(_WIN32) 
   if (ext.empty()  notfound) {
   real_file = FileOpenSearch(path, name, exe);
   -if (notfound) real_file = FileOpenSearch(path, name, cmd);
   +#ifdef __EMX__
   +if (notfound) real_file = FileOpenSearch(path, name, cmd);
   +#endif

If OS/2 looks for .cmd, should win32 look for .bat? 

The test should be on two lines.

   @@ -366,7 +371,7 @@ string const GetEnv(string const  envna

string const GetEnvPath(string const  name)
{
   -#ifndef __EMX__
   +#if !defined(__EMX__)  !defined(_WIN32)
   string const pathlist = subst(GetEnv(name), ':', ';');
#else
   string const pathlist = os::slashify_path(GetEnv(name));

First, there are a lot of lines like
  src/lyx_main.C:using lyx::support::GetEnvPath;
that should be removed from the source

Then, when you look at the remaining uses of GetEnvPath (in HEAD), you
find two categories:

- stuff in os_foo.C, which can have its own code without ifdef

- stuff in path_defines.C.in, which does not consider list of paths
  anyway

So I think we could maybe get rid of the function. Also we could
decide to change os::slashify_path so that it does the :-;
substitution as needed.

JMarc


Re: The remainder of Ruurd's changes

2004-12-16 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes [EMAIL PROTECTED] writes:

|+#ifdef HAVE_UNISTD_H
|+# include unistd.h
|+#endif
|+

| cunistd?

No such thing.

-- 
Lgb



Re: sideways tables/figures

2004-12-16 Thread Edwin Leuven
What doc was that?
it crashes on the attached...
regards, ed.
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass article
\begin_preamble
\usepackage{mathptmx}
\usepackage[scaled=0.9]{helvet}
\usepackage{courier}
\usepackage{rotating}
\date{}
\usepackage{dcolumn}
\newcolumntype{d}{D{.}{.}{6}}

[EMAIL PROTECTED] [EMAIL PROTECTED]
   {-3.5ex [EMAIL PROTECTED] -1ex [EMAIL 
PROTECTED] -.2ex}%
   {2.3ex [EMAIL PROTECTED]
   [EMAIL PROTECTED]
[EMAIL PROTECTED]@}%
 [EMAIL PROTECTED] -1ex [EMAIL PROTECTED] 
-.2ex}%
 {1.5ex [EMAIL PROTECTED] .2ex}%
 [EMAIL PROTECTED]
[EMAIL PROTECTED]@}%
 [EMAIL PROTECTED] -1ex [EMAIL PROTECTED] 
-.2ex}%
 {-1em}%
 [EMAIL PROTECTED]
\end_preamble
\options a4paper
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize 11
\spacing onehalf 
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 1
\use_natbib 1
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Standard


\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
begin{sidewaysfigure} 
\backslash 
centering 
\end_inset 


\layout Standard


\begin_inset Graphics
filename /home/leuven/projects/bapo2/cohort2.eps
scale 70

\end_inset 


\layout Caption

Average working time relative to full-time, by age and gender (1999-2002)
\begin_inset LatexCommand \label{fig: wtf+bapo}

\end_inset 


\layout Standard


\begin_inset ERT
status Open

\layout Standard

\backslash 
end{sidewaysfigure}
\end_inset 


\the_end


[patch] bug 1214

2004-12-16 Thread Juergen Spitzmueller
http://bugzilla.lyx.org/show_bug.cgi?id=1214

This one fixes a bug in xforms' math panel. mathed should always get only one 
dispatch, not two separate ones. The qt frontend does this since genesis.

OK?

Jürgen

P.S.: This is also a 1.3.6 candidate
Index: FormMathsBitmap.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormMathsBitmap.C,v
retrieving revision 1.46
diff -u -r1.46 FormMathsBitmap.C
--- FormMathsBitmap.C	19 May 2004 15:11:35 -	1.46
+++ FormMathsBitmap.C	16 Dec 2004 12:59:39 -
@@ -173,13 +173,7 @@
 
 void FormMathsBitmap::apply()
 {
-	string::size_type const i = latex_chosen_.find(' ');
-	if (i != string::npos) {
-		controller().dispatchFunc(LFUN_MATH_MODE);
-		controller().dispatchInsert(latex_chosen_.substr(0,i));
-		controller().dispatchInsert('\\' + latex_chosen_.substr(i + 1));
-	} else
-		controller().dispatchInsert(latex_chosen_);
+	controller().dispatchInsert(latex_chosen_);
 }
 
 


Re: [patch] encoding error

2004-12-16 Thread Juergen Spitzmueller
Martin Vermeer wrote:
 These are meant to be the units Ångström and Ørsted. So you need a
 Swedish Å (\AA is OK I think) and a Danish Ø (\O).

Patch attached. The only drawback is that it gets rendered as AA and O. I 
don't know how to add the commands \AA and \O to lib/symbols or whereever.

Jürgen
Index: ControlMath.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlMath.C,v
retrieving revision 1.26
diff -u -r1.26 ControlMath.C
--- ControlMath.C	19 May 2004 15:11:30 -	1.26
+++ ControlMath.C	16 Dec 2004 13:08:08 -
@@ -177,7 +177,7 @@
 	angle, top, bot, Vert, neg,
 	flat, natural, sharp, surd, triangle,
 	diamondsuit, heartsuit, clubsuit, spadesuit,
-	textrm ?, textrm ?, mathcircumflex, _,
+	textrm \\AA, textrm \\O, mathcircumflex, _,
 	mathrm T,
 	mathbb N, mathbb Z, mathbb Q,
 	mathbb R, mathbb C, mathbb H,


Re: The remainder of Ruurd's changes

2004-12-16 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes [EMAIL PROTECTED] writes:

 Lars == Lars Gullik Bjønnes [EMAIL PROTECTED] writes:

| | cunistd?

| Lars No such thing.

| What can unistd.h do that no c* header does?

unixy things. Lots of stuff just have a look at the header on your own
box.

The c* header are basically just the C-standard headers in C++
wrapping.

-- 
Lgb



Re: sideways tables/figures

2004-12-16 Thread Alfredo Braunstein
Edwin Leuven wrote:

 What doc was that?
 
 it crashes on the attached...

| \layoutCaption
|
| 
Averageworkingtimerelativetofull-time,byageandgender(1999-2002)

THe problem is a caption in a top paragraph. In top paragraphs the
inset_owner is not set on reading and so it crashes.


// the caption hack:
if (layout-labeltype == LABEL_SENSITIVE) {
pit_type end = paragraphs().size();
pit_type tmppit = pit;
InsetBase * in = 0;
bool isOK = false;
while (tmppit != end) {
in = pars_[tmppit].inInset();
if (in-lyxCode() == InsetBase::FLOAT_CODE ||
in-lyxCode() == InsetBase::WRAP_CODE) {


A dead easy solution is to check for inInset() != 0 before using it
A better solution is to set the owner inset of top paragraphs
A much better solution is to get rid of inset_owner.

Alfredo




Re: [PATCH] Hyphenation, the latex way

2004-12-16 Thread Jean-Marc Lasgouttes
 Andre == Andre Poenitz [EMAIL PROTECTED] writes:

Andre On Tue, Dec 07, 2004 at 04:32:59PM +, Angus Leeming wrote:
 Isn't it possible to define \mesg only when \typeout's argument
 starts Babel:
 
 {\def\typeout#1{if #1 starts with Babel then
 \global\def\mesg{#1}} \the\everyjob}

Andre We could simply collect all typeout arguments and cut out the
Andre interesting part later

Andre \def\mesg{} {\def\typeout#1{\global\edef\mesg{\mesg #1}}
Andre \the\everyjob}

This is basically what I do.

JMarc


Re: [PATCH] Hyphenation, the latex way

2004-12-16 Thread Jean-Marc Lasgouttes
 Jean-Marc == Jean-Marc Lasgouttes [EMAIL PROTECTED] writes:

 Angus == Angus Leeming [EMAIL PROTECTED] writes:
Angus Isn't it possible to define \mesg only when \typeout's argument
Angus starts Babel:

Jean-Marc I thought about that (and I do not know how to do it...),
Jean-Marc but a better solution has been proposed on fctt:
Jean-Marc concatenate all the \typeout messages into the \mesg macro,
Jean-Marc and find the languages in there. This gives the following
Jean-Marc updated patch, where I have added some comments to explain
Jean-Marc the code.

I have committed this code, along with a slight change to
LaTeXConfig.lyx.in.

JMarc


Re: [patch] encoding error

2004-12-16 Thread Jean-Marc Lasgouttes
 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen Martin Vermeer wrote:
 These are meant to be the units Ångström and Ørsted. So you need a
 Swedish Å (\AA is OK I think) and a Danish Ø (\O).

Juergen Patch attached. The only drawback is that it gets rendered as
Juergen AA and O. I don't know how to add the commands \AA and \O
Juergen to lib/symbols or whereever.

Why do we need the \\textrm? I'd think we should just insets the
characters as they are...

JMarc



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 A little digression: instead of our current os:: namespace, wouldn't
 it be better to have a hierarchy of os_foo classes with static
 methods, so that some environment could inherit others (like cygwin =
 unix + some stuff). The some of the code from this init method could
 be moved to os_foo.C files.

You can't have static virtual member functions, but you could have either 
a class os (à la 13x) or a namespace os (à la 14x) that hid the 
implementation:

class os {
public:
static void init(int argc, char * argv[]);

static string const  binpath();
static string const  binname();
static string const  homepath();
static string const  nulldev();
private:
struct impl {
virtual string const  binpath() const = 0;
virtual string const  binname() const = 0;
virtual string const  homepath() const = 0;
virtual string const  nulldev() const = 0;
};
static boost::scoped_ptrimpl pimpl_;
};

Each os_cygwin, os_os2, os_unix, os_win32 class would inherit from 
os::impl.

However, I don't think that such a change should go in the 1.3.x series 
and I don't really see what it would give 1.4.x. Can we leave this for 
1.5.x?

-- 
Angus



Re: [patch] bug 1214

2004-12-16 Thread Juergen Spitzmueller
Martin Vermeer wrote:
 E.g., the real numbers R is sent as mathbb R and then dispatched as
 \mathbb (creating a little blue font box), followed by R (to be put
 inside it).

 This *used* to work, but doesn't anymore. Jürgen, is this what you are
 fixing?

Basically yes.

Jürgen

P.S.: If you select Insert-Math-Inline Formula, the Inset contains the 
string on. This is unrelated to my patch, but certainly weird.


[PATCH 14x only] removing redundant using directives.

2004-12-16 Thread Angus Leeming
Cruft left over from the 'OS abstraction of HOME and the null device' 
patch. Thanks to Jean-Marc for spotting this stuff.

Committing now...

AngusIndex: src/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2060
diff -u -p -r1.2060 ChangeLog
--- src/ChangeLog	15 Dec 2004 19:35:42 -	1.2060
+++ src/ChangeLog	16 Dec 2004 14:48:14 -
@@ -1,3 +1,9 @@
+2004-12-16  Angus Leeming  [EMAIL PROTECTED]
+
+	* bufferlist.C:
+	* lyx_main.C: 
+	* messages.C: remove redundant using lyx::support::GetEnvPath;
+
 2004-12-14  Angus Leeming  [EMAIL PROTECTED]
 
 	* LaTeX.C: (startscript): use os::nulldev() rather than /dev/null.
Index: src/bufferlist.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferlist.C,v
retrieving revision 1.146
diff -u -p -r1.146 bufferlist.C
--- src/bufferlist.C	15 Dec 2004 19:35:42 -	1.146
+++ src/bufferlist.C	16 Dec 2004 14:48:14 -
@@ -36,7 +36,6 @@
 
 using lyx::support::AddName;
 using lyx::support::bformat;
-using lyx::support::GetEnvPath;
 using lyx::support::MakeAbsPath;
 using lyx::support::MakeDisplayPath;
 using lyx::support::OnlyFilename;
Index: src/lyx_main.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_main.C,v
retrieving revision 1.188
diff -u -p -r1.188 lyx_main.C
--- src/lyx_main.C	15 Dec 2004 19:35:43 -	1.188
+++ src/lyx_main.C	16 Dec 2004 14:48:15 -
@@ -65,7 +65,6 @@ using lyx::support::createLyXTmpDir;
 using lyx::support::FileInfo;
 using lyx::support::FileSearch;
 using lyx::support::GetEnv;
-using lyx::support::GetEnvPath;
 using lyx::support::i18nLibFileSearch;
 using lyx::support::LibFileSearch;
 using lyx::support::Path;
Index: src/messages.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/messages.C,v
retrieving revision 1.17
diff -u -p -r1.17 messages.C
--- src/messages.C	19 Oct 2004 09:11:00 -	1.17
+++ src/messages.C	16 Dec 2004 14:48:15 -
@@ -15,7 +15,6 @@
 
 #include boost/regex.hpp
 
-using lyx::support::GetEnvPath;
 using lyx::support::lyx_localedir;
 
 using std::string;
Index: src/client/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/ChangeLog,v
retrieving revision 1.8
diff -u -p -r1.8 ChangeLog
--- src/client/ChangeLog	14 Dec 2004 10:41:05 -	1.8
+++ src/client/ChangeLog	16 Dec 2004 14:48:15 -
@@ -1,3 +1,7 @@
+2004-12-16  Angus Leeming  [EMAIL PROTECTED]
+
+	* messages.C: remove redundant using lyx::support::GetEnvPath;
+
 2004-12-14  Angus Leeming  [EMAIL PROTECTED]
 
 	* Makefile.am (AM_CPPFLAGS): Remove trailing slash from -Ifoo/
Index: src/client/messages.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/messages.C,v
retrieving revision 1.1
diff -u -p -r1.1 messages.C
--- src/client/messages.C	4 Sep 2004 12:13:50 -	1.1
+++ src/client/messages.C	16 Dec 2004 14:48:15 -
@@ -13,7 +13,6 @@
 #include support/filetools.h
 #include support/path_defines.h
 
-using lyx::support::GetEnvPath;
 using lyx::support::lyx_localedir;
 
 using std::string;
Index: src/frontends/xforms/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.956
diff -u -p -r1.956 ChangeLog
--- src/frontends/xforms/ChangeLog	15 Dec 2004 21:40:11 -	1.956
+++ src/frontends/xforms/ChangeLog	16 Dec 2004 14:48:18 -
@@ -1,3 +1,7 @@
+2004-12-16  Angus Leeming  [EMAIL PROTECTED]
+
+	* FormFiledialog.C: remove redundant using lyx::support::GetEnvPath;
+
 2004-12-15  Angus Leeming  [EMAIL PROTECTED]
 
 	* FormFiledialog.C (Reread): no longer use FileInfo::getNumberOfLinks().
Index: src/frontends/xforms/FormFiledialog.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormFiledialog.C,v
retrieving revision 1.61
diff -u -p -r1.61 FormFiledialog.C
--- src/frontends/xforms/FormFiledialog.C	15 Dec 2004 21:40:11 -	1.61
+++ src/frontends/xforms/FormFiledialog.C	16 Dec 2004 14:48:18 -
@@ -66,7 +66,6 @@ using lyx::support::ExpandPath;
 using lyx::support::FileFilterList;
 using lyx::support::FileInfo;
 using lyx::support::getcwd;
-using lyx::support::GetEnvPath;
 using lyx::support::LyXReadLink;
 using lyx::support::MakeAbsPath;
 using lyx::support::OnlyFilename;


Configure problems for lyx-140 on Mac

2004-12-16 Thread Bennett Helm
Trying to build the latest CVS of lyx-140 in Mac OS X forced rerunning 
configure, which fails. I get variants of the following error with each 
of ostream, istream, sstream, locale, ios, and Aiksaurus:

checking ostream usability... no
checking ostream presence... yes
configure: WARNING: ostream: present but cannot be compiled
configure: WARNING: ostream: check for missing prerequisite headers?
configure: WARNING: ostream: proceeding with the preprocessor's result
configure: WARNING: ##  ##
configure: WARNING: ## Report this to [EMAIL PROTECTED] ##
configure: WARNING: ##  ##
checking for ostream... yes
The result is a failure to find the Qt library name.
I'm using gcc-3.3 (the latest version from Apple, which I installed 
several weeks ago, with no problems then). (These problems do not occur 
for gcc-3.1.)

Any suggestions?
Thanks.
Bennett


Re: Configure problems for lyx-140 on Mac

2004-12-16 Thread Angus Leeming
Bennett Helm wrote:

 Trying to build the latest CVS of lyx-140 in Mac OS X forced rerunning
 configure, which fails. I get variants of the following error with each
 of ostream, istream, sstream, locale, ios, and Aiksaurus:
 
 checking ostream usability... no
 checking ostream presence... yes
 configure: WARNING: ostream: present but cannot be compiled
 configure: WARNING: ostream: check for missing prerequisite headers?
 configure: WARNING: ostream: proceeding with the preprocessor's result
 configure: WARNING: ##  ##
 configure: WARNING: ## Report this to
 [EMAIL PROTECTED] ##
 configure: WARNING: ##  ##
 checking for ostream... yes
 
 The result is a failure to find the Qt library name.
 
 I'm using gcc-3.3 (the latest version from Apple, which I installed
 several weeks ago, with no problems then). (These problems do not occur
 for gcc-3.1.)
 
 Any suggestions?

Try running

$ ./autogen.sh
$ ./configure your options

explicitly. If that doesn't work, try backing out the recent changes to 
configure.ac

$ cvs -q diff -r 1.30 configure.ac  tmp.diff
$ patch -p0 -R  tmp.diff
$ ./autogen.sh
$ ./configure your options

(Although I can't see what difference that would make.)

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus Jean-Marc Lasgouttes wrote:
 A little digression: instead of our current os:: namespace,
 wouldn't it be better to have a hierarchy of os_foo classes with
 static methods, so that some environment could inherit others (like
 cygwin = unix + some stuff). The some of the code from this init
 method could be moved to os_foo.C files.

Angus You can't have static virtual member functions, but you could
Angus have either a class os (à la 13x) or a namespace os (à la
Angus 14x) that hid the implementation:

Did I say virtual? I thought of static member functions and os.h would
do

#if in unix 
#include os_unix.h
typedef os_unix os;
#else if in win32
#include os_win32.h
typedef os_win32 os;
...

JMarc


Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:

@@ -289,7 +293,7 @@ void LyX::init(bool gui)
do {
// Path of binary/../share/name of binary/
searchpath += NormalizePath(AddPath(binpath,
../share/) +
-OnlyFilename(binname)) + ';';
+ChangeExtension(OnlyFilename(binname),)) + ';';
 
 Don't we need something more selective, like removing .exe from the
 end of the string if it is here? Actually, I guess the whole LyX::init
 strategy should be rethought in the light of our platform support.

This is an equivalent can of worms to the whole --with-version-suffix 
discussion isn't it? One plausible suggestion (made by Lars?) is to 
hard-code the location of the system-wide shared data as
/Path of binary/../share/lyx/13x/

where 13x would actually have been 130 for LyX 1.3.0 to 1.3.3 and would 
have changed to 134 for LyX version 1.3.4 when a change to the text class 
format was introduced. Maybe that's a bit too cute and each separate LyX 
version should have its own directory.

Ditto, the userdir would become:
os::homepath()/.lyx/13x/

It seems to me that such a scheme would work on all platforms. Am I 
missing something?

Returning to the particular point raised by the proposed patch. Would you 
be happy if I explicitly stripped .exe for the Win32 case? Something 
like:

do {
// Path of binary/../share/name of binary/
string const exe_name = OnlyFilename(binname);
string const lyx_system_dir_name =
#ifdef _WIN32
suffixIs(exe_name, .exe) ?
ChangeExtension(exe_name, ) :
exe_name;
#else
exe_name;
#endif
string const shared_dir_name =
NormalizePath(AddPath(binpath, ../share/);
searchpath += shared_dir_name + lyx_system_dir_name + ';';

Or do you want to propogate an entire new scheme back into the 13x series?

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
@@ -623,6 +623,8 @@ string const InsetGraphics::prepareFile(
// without dots and again with ext
temp_file = ChangeExtension(
subst(temp_file, ., _), ext_tmp);
+  //Remove drive letter on Win32
+  if (temp_file[1] == ':') temp_file = temp_file.erase(0,2);
// now we have any_dir_file.ext
temp_file = MakeAbsPath(temp_file, buf-tmppath);
lyxerr[Debug::GRAPHICS]
 
 I do not like this. Is there a reason why this should not be handled
 by some generic function?

It is in 1.4.x. The file name is stored as a FileName variable and this 
mangling is done via FileName::mangledFilename()

Anyway, I think that the proposal should be:

+  // Mangle drive name on Win32
+  if (temp_file[1] == ':') temp_file[1] = '_';

Ie, the temporary file's name should include this information about the 
drive.

I'll prepare patches.

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
 A little digression: instead of our current os:: namespace,
 wouldn't it be better to have a hierarchy of os_foo classes with
 static methods, so that some environment could inherit others (like
 cygwin = unix + some stuff). The some of the code from this init
 method could be moved to os_foo.C files.
 
 Angus You can't have static virtual member functions, but you could
 Angus have either a class os (à la 13x) or a namespace os (à la
 Angus 14x) that hid the implementation:
 
 Did I say virtual? I thought of static member functions and os.h would
 do
 
 #if in unix
 #include os_unix.h
 typedef os_unix os;
 #else if in win32
 #include os_win32.h
 typedef os_win32 os;
 ...

You're just too clever for me ;-) However, static member functions can't 
inherit, which is what I thought the point was:

class os_unix {};
class os_cygwin : public os_unix {
// Override some specific member function.
};

If you want to do something like that, then some sort of indirection with 
class os hiding a member variable, is inevitable I fear.

Anyway, the principle point remains. Do you want to do this in the 1.3.x 
series or should we leave that as ugly but working?
-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus Thanks for the commentary, Jean-Marc. I like the ideas of a
Angus hierarchy of os classes and of getting rid of GetEnvPath.
Angus I'll continue the process of small, self contained patches.

Sure.

Angus I think that, as a rule, we should be a little less worried
Angus about indentation issues. As often as not the only comments
Angus that a patch gets are about indentation and whitespace. Let's
Angus assume that I'll get that right and concentrate on the
Angus substance of the proposed changes ;-)

Agreed.

Angus Summary, the above code is a bug fix, pure and simple, although
Angus I'd write is as:

Angus { QTextCodec const * const codec =
Angus QTextCodec::codecForLocale(); QCString const tmpstr =
Angus codec-fromUnicode(str); return tmpstr.isEmpty() ? string() :
Angus string(tmpstr);
Angus }

Angus Patches attached. Happy if I commit?

Yes. I was wondering whether this is related to the string-related
crashes people have been experiencing with some versions of Qt (with
non-existing fonts). I believe this has been fixed in 1.4.0cvs, but
not in 1.3.6cvs.

JMarc



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Lars Gullik Bjønnes wrote:
 | class os {
 | public:
 | static void init(int argc, char * argv[]);

 | static string const  binpath();
 | static string const  binname();
 | static string const  homepath();
 | static string const  nulldev();
 | private:
 | struct impl {
 | virtual string const  binpath() const = 0;
 | virtual string const  binname() const = 0;
 | virtual string const  homepath() const = 0;
 | virtual string const  nulldev() const = 0;
 | };
 | static boost::scoped_ptrimpl pimpl_;
 | };
 
 Will this work? Remember that you can call a static function without
 the object.
 
 (Ok I see what you want to do. (init should be private probably))

No, os::init() is called from main(int argc, char * argv).

A lot of these 'theoretical' problems with global data and order of 
initialization would go away if we had a single global LyX variable that 
held all other, currently global, variables.

Anyway, I class this all as a 'make the code nicer' project with no real 
user gains. I don't really see what it has to do with trying to get LyX 
running on Windows. In fact, producing something that works but is even 
clunkier than the existing code base (more #ifdefs) might provide even 
more motivation to refactor this piece of the code ;-)

Whereever this conversation goes, I don't think that any refactoring 
should be backported into the 1.3.x tree.

-- 
Angus



Re: [PATCH 13x, 14x] determining the name of the LyX system dir

2004-12-16 Thread Lars Gullik Bjønnes
Angus Leeming [EMAIL PROTECTED] writes:

| @@ -217,8 +217,19 @@ bool setLyxPaths()
|   bool followlink;
|   do {
|   // Path of binary/../share/name of binary/
| - searchpath += NormalizePath(AddPath(binpath, ../share/) +
| -   OnlyFilename(binname)) + ';';
| +
| + string const exe_name = OnlyFilename(binname);
| + string const lyx_system_dir_name =
| +#ifdef _WIN32
| + suffixIs(exe_name, .exe) ?
| + ChangeExtension(exe_name, ) :
| + exe_name;
| +#else
| + exe_name;
| +#endif

Can we please not split statements with ifdef?

| +#ifdef _WIN32
| + string const lyx_system_dir_name =
| + suffixIs(exe_name, .exe) ?
| + ChangeExtension(exe_name, ) :
| + exe_name;
| +#else
| + string const lyx_system_dir_name = exe_name;
| +#endif

would be nicer.

-- 
Lgb



Re: [PATCH 13x, 14x] mangling temporary file names

2004-12-16 Thread Georg Baum
Angus Leeming wrote:

 Do you agree that my approach is better? If so, are you happy with the
 attached patches for the 13x and 14x trees?

Yes and yes.


Georg



Re: [PATCH 13x, 14x] mangling temporary file names

2004-12-16 Thread Kuba Ober
On czwartek 16 grudzie 2004 11:59 am, Angus Leeming wrote:
 Given a file name C:/foo/bar, I believe that the name of the temporary
 file should be C__foo_bar. Ie, the drive name should be included in the
 mangling. Ruurd was addressing this idea in his patch, but he simply
 removed the drive prefix from the mangled name.

[...]

I vaguely recall this idea being raised at one point or another, but can't the 
temporary file names be simply generated from some kind of a unique global 
counter, maybe merged with PID?

Say if PID is 16940, you'd get 16940_.tmp, ..., 16940_000a.tmp and so on? 
That would preclude any need for mangling.

But I presume there must be some other reason for mangling? I'm just trying to 
understand.

Cheers, Kuba Ober


Running LyX/Win32 -dbg init

2004-12-16 Thread Angus Leeming
As promised Jean-Marc here is the output from lyx -dbg init. This is with
the 'remainder of Ruurd's changes' patch applied to the current 13x CVS.
I've also applied today's two proposals 'mangling temporary file names'
and 'determining the name of the LyX system dir'.

$ cd qt3/bin
$ ~/lyx-13x/build-qt/src/lyx.exe -dbg init

Setting debug level to init
Debugging `init' (Program initialisation)
Initializing LyX::init...
Name of binary: J:\MinSYS\home\Angus\lyx-13x\build-qt\src\lyx.exe
Path of binary: J:/MinSYS/home/Angus/qt3/bin/
Checking whether LyX is run in place... no
System directory search path: J:/MinSYS/home/Angus/qt3/Resources/J
\MinSYS\home\Angus\lyx-13x\build-qt\src\lyx.exe/;J:/MinSYS/home/Angus/qt3/share/J:/MinSYS/home/Angus/lyx-13x/build-qt/src/lyx;J:/MinSYS/local/share/lyx-1.3.6cvs
LyX Warning! Couldn't determine system directory. Try the '-sysdir' command
line parameter or set the environment variable LYX_DIR_13x to the LyX
system directory containing the file `chkconfig.ltx'.
Couldn't even find the default LYX_DIR.
Giving up.

Name of binary:
 Windows-style path but otherwise correct.
Path of binary:
 Unix-style path but actually the directory from which I
 executed the  command to run LyX.
System directory search path:
 Note that there is no ';' between the fist two elements.
 Note also an entertaining mix of Unix and Windows-style paths.

This shouldn't be too hard to fix. I would investigate further, but it
takes 24minutes just to link the bloody thing and I'm off to bed ;-)

I see that MinGW ships with objcopy. I'll try running that magic that I
posted a year ago on the .o files and see if that reduces link times to
something manageable. Mañana.

#! /bin/sh

test $# -gt 0 || exit

while (true); do
objcopy --set-section-flags .debug_str=contents,debug $1
shift
test $# -eq 0  break;
done

-- 
Angus



Re: Configure problems for lyx-140 on Mac

2004-12-16 Thread Andreas Vox
Angus Leeming [EMAIL PROTECTED] writes:

 
 Bennett Helm wrote:
 
  Trying to build the latest CVS of lyx-140 in Mac OS X forced rerunning
  configure, which fails. I get variants of the following error with each
  of ostream, istream, sstream, locale, ios, and Aiksaurus:

Same with me.

 
 Try running
 
 $ ./autogen.sh
 $ ./configure your options

Doesn't make a difference (well, it does, before the make failed
with:

 
cd .  /bin/sh /Users/vox/LYX/lyx-devel/config/missing --run aclocal-1.6 -I m4
cd .  \
  /bin/sh /Users/vox/LYX/lyx-devel/config/missing --run automake-1.6 --foreign  
Makefile
cd .  /bin/sh /Users/vox/LYX/lyx-devel/config/missing --run autoconf
configure.ac:270: error: possibly undefined macro: AC_FUNC_MKDIR
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.
make: *** [configure] Error 1
___

After auogen.sh I get Bennets errors)

I checked the config.log file and it says:

___
configure:4923: checking istream usability
configure:4936: g++ -c -g -Os -fno-exceptions  -W -Wall conftest.cc 5
In file included from /usr/include/gcc/darwin/3.3/c++/bits/concept_check.h:60,
 from /usr/include/gcc/darwin/3.3/c++/bits/stl_iterator_base_fun
cs.h:68,
 from /usr/include/gcc/darwin/3.3/c++/bits/stl_algobase.h:74,
 from /usr/include/gcc/darwin/3.3/c++/memory:54,
 from /usr/include/gcc/darwin/3.3/c++/string:48,
 from /usr/include/gcc/darwin/3.3/c++/bits/locale_classes.h:47,
 from /usr/include/gcc/darwin/3.3/c++/bits/ios_base.h:47,
 from /usr/include/gcc/darwin/3.3/c++/ios:49,
 from /usr/include/gcc/darwin/3.3/c++/istream:44,
 from configure:4987:
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h: In member function 
   `void __gnu_cxx::_InputIteratorConcept_Tp::__constraints()':
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h:415: error: parse 
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h:417: error: parse 
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h: In member function 
   `void __gnu_cxx::_ForwardIteratorConcept_Tp::__constraints()':
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h:450: error: parse 
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h: In member function 
   `void __gnu_cxx::_RandomAccessIteratorConcept_Tp::__constraints()':
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h:502: error: parse 
   error before `;' token
configure:4939: $? = 1
configure: failed program was:
| #line 4925 configure
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME lyx
| #define PACKAGE_TARNAME lyx
| #define PACKAGE_VERSION 1.4.0cvs
| #define PACKAGE_STRING lyx 1.4.0cvs
| #define PACKAGE_BUGREPORT [EMAIL PROTECTED]
| #define DEVEL_VERSION 1
| #define PACKAGE lyx
| #define VERSION 1.4.0cvs
| #define HAVE_KPSEWHICH 1
| #ifdef __cplusplus
| #include stdlib.h
| #endif
| #define WITH_WARNINGS 1
| #define _GLIBCPP_CONCEPT_CHECKS 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_OSTREAM 1
| /* end confdefs.h.  */
| #include stdio.h
| #if HAVE_SYS_TYPES_H
| # include sys/types.h
| #endif
| #if HAVE_SYS_STAT_H
| # include sys/stat.h
| #endif
| #if STDC_HEADERS
| # include stdlib.h
| # include stddef.h
| #else
| # if HAVE_STDLIB_H
| #  include stdlib.h
| # endif
| #endif
| #if HAVE_STRING_H
| # if !STDC_HEADERS  HAVE_MEMORY_H
| #  include memory.h
| # endif
| # include string.h
| #endif
| #if HAVE_STRINGS_H
| # include strings.h
| #endif
| #if HAVE_INTTYPES_H
| # include inttypes.h
| #else
| # if HAVE_STDINT_H
| #  include stdint.h
| # endif
| #endif
| #if HAVE_UNISTD_H
| # include unistd.h
| #endif
| #include istream
configure:4955: result: no
configure:4959: checking istream presence
__



So: Boost? Concept checks? Anyone any idea?


/Andreas



Re: [PATCH 13x, 14x] mangling temporary file names

2004-12-16 Thread Georg Baum
Kuba Ober wrote:

 I vaguely recall this idea being raised at one point or another, but can't
 the temporary file names be simply generated from some kind of a unique
 global counter, maybe merged with PID?

We have a global counter, it is prepended to the mangled name. Otherwise it
would not be unique. The reason for the additional mangling is that people
get a clue where a file comes from when something goes wrong.


Georg



Re: [PATCH 13x, 14x] remove FileInfo::getNumberOfLinks

2004-12-16 Thread Jean-Marc Lasgouttes
 Angus == Angus Leeming [EMAIL PROTECTED] writes:

Angus As suggested by JMarc. Committing now... 

Actually, I was advocating removing the whole information line, but it
may have been too drastic :)

JMarc


Re: [patch] bug 1214

2004-12-16 Thread Jean-Marc Lasgouttes
 Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

Juergen http://bugzilla.lyx.org/show_bug.cgi?id=1214 This one fixes a
Juergen bug in xforms' math panel. mathed should always get only one
Juergen dispatch, not two separate ones. The qt frontend does this
Juergen since genesis.

What kind of values can latex_chosen_ have?

Juergen P.S.: This is also a 1.3.6 candidate

Sure, provided you test it.

JMarc


Re: The remainder of Ruurd's changes

2004-12-16 Thread Jean-Marc Lasgouttes
 Lars == Lars Gullik Bjønnes [EMAIL PROTECTED] writes:

| cunistd?

Lars No such thing.

What can unistd.h do that no c* header does?

JMarc


Re: [patch] encoding error

2004-12-16 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:
  Juergen == Juergen Spitzmueller [EMAIL PROTECTED] writes:

 Juergen Martin Vermeer wrote:
  These are meant to be the units Ångström and Ørsted. So you need a
  Swedish Å (\AA is OK I think) and a Danish Ø (\O).

 Juergen Patch attached. The only drawback is that it gets rendered as
 Juergen AA and O. I don't know how to add the commands \AA and \O
 Juergen to lib/symbols or whereever.

 Why do we need the \\textrm? I'd think we should just insets the
 characters as they are...

This does not work (inserts an empty blue box).

Jürgen

 JMarc


Re: The remainder of Ruurd's changes

2004-12-16 Thread Lars Gullik Bjønnes
Angus Leeming [EMAIL PROTECTED] writes:

| Jean-Marc Lasgouttes wrote:
 A little digression: instead of our current os:: namespace, wouldn't
 it be better to have a hierarchy of os_foo classes with static
 methods, so that some environment could inherit others (like cygwin =
 unix + some stuff). The some of the code from this init method could
 be moved to os_foo.C files.

| You can't have static virtual member functions, but you could have either 
| a class os (à la 13x) or a namespace os (à la 14x) that hid the 
| implementation:

| class os {
| public:
| static void init(int argc, char * argv[]);

| static string const  binpath();
| static string const  binname();
| static string const  homepath();
| static string const  nulldev();
| private:
| struct impl {
| virtual string const  binpath() const = 0;
| virtual string const  binname() const = 0;
| virtual string const  homepath() const = 0;
| virtual string const  nulldev() const = 0;
| };
| static boost::scoped_ptrimpl pimpl_;
| };

Will this work? Remember that you can call a static function without
the object.

(Ok I see what you want to do. (init should be private probably))

-- 
Lgb


[PATCH 13x, 14x] mangling temporary file names

2004-12-16 Thread Angus Leeming
Given a file name C:/foo/bar, I believe that the name of the temporary 
file should be C__foo_bar. Ie, the drive name should be included in the 
mangling. Ruurd was addressing this idea in his patch, but he simply 
removed the drive prefix from the mangled name.

Do you agree that my approach is better? If so, are you happy with the 
attached patches for the 13x and 14x trees?

Jean-Marc, I'll hang back and await your feedback on this; I've been a bit 
rushy with my application of some of the other patches. Sorry 'bout that.

-- 
AngusIndex: src/insets/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.552.2.18
diff -u -p -r1.552.2.18 ChangeLog
--- src/insets/ChangeLog	14 Dec 2004 10:40:08 -	1.552.2.18
+++ src/insets/ChangeLog	16 Dec 2004 16:48:54 -
@@ -1,3 +1,9 @@
+2004-12-16  Angus Leeming  [EMAIL PROTECTED]
+
+	* insetgraphics.C (prepareFile): Given a Windows-style path, don't
+	forget to mangle the drive letter too when generating a unique
+	temporary file name.
+
 2004-12-14  Angus Leeming  [EMAIL PROTECTED]
 
 	* Makefile.am (INCLUDES): Remove trailing slash from -Ifoo/
Index: src/insets/insetgraphics.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.146.2.4
diff -u -p -r1.146.2.4 insetgraphics.C
--- src/insets/insetgraphics.C	7 Dec 2004 10:49:34 -	1.146.2.4
+++ src/insets/insetgraphics.C	16 Dec 2004 16:48:54 -
@@ -623,6 +623,13 @@ string const InsetGraphics::prepareFile(
 		// without dots and again with ext
 		temp_file = ChangeExtension(
 			subst(temp_file, ., _), ext_tmp);
+
+#if defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_WIN32)
+		// Mangle the drive letter in a Windows-style path.
+		if (temp_file.size() = 2  temp_file[1] == ':')
+			temp_file[1] = '_';
+#endif
+
 		// now we have any_dir_file.ext
 		temp_file = MakeAbsPath(temp_file, buf-tmppath);
 		lyxerr[Debug::GRAPHICS]
Index: src/support/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.287
diff -u -p -r1.287 ChangeLog
--- src/support/ChangeLog	16 Dec 2004 01:03:34 -	1.287
+++ src/support/ChangeLog	16 Dec 2004 16:46:10 -
@@ -1,5 +1,11 @@
 2004-12-16  Angus Leeming  [EMAIL PROTECTED]
 
+	* filename.C (mangledFilename): Given a Windows-style path, don't
+	forget to mangle the drive letter too when generating a unique
+	temporary file name.
+
+2004-12-16  Angus Leeming  [EMAIL PROTECTED]
+
 	* mkdir.C: move the HAVE_MKDIR conditional code out of config.h
 	and into here.
 
Index: src/support/filename.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filename.C,v
retrieving revision 1.10
diff -u -p -r1.10 filename.C
--- src/support/filename.C	7 Nov 2004 13:22:51 -	1.10
+++ src/support/filename.C	16 Dec 2004 16:46:10 -
@@ -86,6 +86,13 @@ string const FileName::mangledFilename()
 	mname = subst(mname, ., _);
 	// Add the extension back on
 	mname = ChangeExtension(mname, GetExtension(name_));
+
+#if defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_WIN32)
+	// Mangle the drive letter in a Windows-style path.
+	if (mname.size() = 2  mname[1] == ':')
+		mname[1] = '_';
+#endif
+
 	// Prepend a counter to the filename. This is necessary to make
 	// the mangled name unique.
 	static int counter = 0;


[PATCH 13x, 14x] determining the name of the LyX system dir

2004-12-16 Thread Angus Leeming
Ok, Jean-Marc. Here is a refinement of Ruurd's patch to determine the name 
of the LyX system directory from the name of the LyX binary. Are you happy 
with this or should we discuss it some more?

-- 
AngusIndex: src/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1021.2.53
diff -u -p -r1.1021.2.53 ChangeLog
--- src/ChangeLog	15 Dec 2004 19:35:06 -	1.1021.2.53
+++ src/ChangeLog	16 Dec 2004 17:25:25 -
@@ -1,4 +1,11 @@
- 2004-12-14  Angus Leeming  [EMAIL PROTECTED]
+2004-12-16  Angus Leeming  [EMAIL PROTECTED]
+
+	* lyx_main.C (init): on a Windows build, remove the .exe
+	extension from the name of the LyX binary when trying to
+	ascertain the name of the LyX system directory.
+	(Usually, path to binary/../share/name of binary/).
+
+2004-12-14  Angus Leeming  [EMAIL PROTECTED]
  
 	* LaTeX.C: (operator()): use os::nulldev() rather than /dev/null.
 
Index: src/lyx_main.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_main.C,v
retrieving revision 1.134.2.5
diff -u -p -r1.134.2.5 lyx_main.C
--- src/lyx_main.C	15 Dec 2004 19:35:10 -	1.134.2.5
+++ src/lyx_main.C	16 Dec 2004 17:25:25 -
@@ -288,8 +288,19 @@ void LyX::init(bool gui)
 	bool followlink;
 	do {
 		// Path of binary/../share/name of binary/
-		searchpath += NormalizePath(AddPath(binpath, ../share/) +
-		  OnlyFilename(binname)) + ';';
+
+		string const exe_name = OnlyFilename(binname);
+		string const lyx_system_dir_name =
+#ifdef _WIN32
+			suffixIs(exe_name, .exe) ?
+ChangeExtension(exe_name, ) :
+exe_name;
+#else
+			exe_name;
+#endif
+		string const shared_dir_name =
+			NormalizePath(AddPath(binpath, ../share/));
+		searchpath += shared_dir_name + lyx_system_dir_name + ';';
 
 		// Follow Symlinks
 		FileInfo file(fullbinpath, true);
Index: src/support/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.287
diff -u -p -r1.287 ChangeLog
--- src/support/ChangeLog	16 Dec 2004 01:03:34 -	1.287
+++ src/support/ChangeLog	16 Dec 2004 17:25:40 -
@@ -1,5 +1,10 @@
 2004-12-16  Angus Leeming  [EMAIL PROTECTED]
 
+	* path_defines.C.in (setLyxPaths): on a Windows build, remove the
+	.exe extension from the name of the LyX binary when trying to
+	ascertain the name of the LyX system directory.
+	(Usually, path to binary/../share/name of binary/).
+
 	* mkdir.C: move the HAVE_MKDIR conditional code out of config.h
 	and into here.
 
Index: src/support/path_defines.C.in
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/path_defines.C.in,v
retrieving revision 1.14
diff -u -p -r1.14 path_defines.C.in
--- src/support/path_defines.C.in	15 Dec 2004 19:35:43 -	1.14
+++ src/support/path_defines.C.in	16 Dec 2004 17:25:40 -
@@ -217,8 +217,19 @@ bool setLyxPaths()
 	bool followlink;
 	do {
 		// Path of binary/../share/name of binary/
-		searchpath += NormalizePath(AddPath(binpath, ../share/) +
-		  OnlyFilename(binname)) + ';';
+
+		string const exe_name = OnlyFilename(binname);
+		string const lyx_system_dir_name =
+#ifdef _WIN32
+			suffixIs(exe_name, .exe) ?
+ChangeExtension(exe_name, ) :
+exe_name;
+#else
+			exe_name;
+#endif
+		string const shared_dir_name =
+			NormalizePath(AddPath(binpath, ../share/));
+		searchpath += shared_dir_name + lyx_system_dir_name + ';';
 
 		// Follow Symlinks
 		FileInfo file(fullbinpath, true);


Re: [PATCH 13x, 14x] determining the name of the LyX system dir

2004-12-16 Thread Angus Leeming
Lars Gullik Bjønnes wrote:

 Angus Leeming [EMAIL PROTECTED] writes:
 
 | @@ -217,8 +217,19 @@ bool setLyxPaths()
 |  bool followlink;
 |  do {
 |  // Path of binary/../share/name of binary/
 | -   searchpath += NormalizePath(AddPath(binpath, ../share/) +
 | - OnlyFilename(binname)) + ';';
 | +
 | +   string const exe_name = OnlyFilename(binname);
 | +   string const lyx_system_dir_name =
 | +#ifdef _WIN32
 | +   suffixIs(exe_name, .exe) ?
 | +   ChangeExtension(exe_name, ) :
 | +   exe_name;
 | +#else
 | +   exe_name;
 | +#endif
 
 Can we please not split statements with ifdef?

Sure, but that is just more 'whitespace commentary'. Are you in favour of 
the substance of the proposal or should we take this back to the drawing 
board?

-- 
Angus


Re: MSVC wrapper

2004-12-16 Thread Angus Leeming
Ruurd Reitsma wrote:

> By request, this the wrapper tool that I use to compile LyX with MSVC.
> All thanks to the Coin3D project. Cygwin is used to run the autotools and
> make, but compilation is native Win32 with MSVC.
> 
> IMO this is the most time efficient way to do it. I have fiddled with
> Visual Studio projects and Qt .pro files for a while, but it´s hard to
> keep up with the automake tools.

Incidentally, Ruurd, do you need this wrapper at all? Why not patch the
scripts in config to generate Makefiles that 'just do the right thing'?

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes:

| As promised, I'm posting the remainder of the changes that are needed to
| compile LyX with MinGW. This patch is much less intrusive than the
| original because the offensive os_win32.h is how #included only by
| those .C files that actually need it.

I am not sure I like that solution.

We should work hard to get all platform specific code out of the
regular .C files.

If a support/os.h works equally well we should use that instead.
(and no conditionals)

| Index: src/insets/insetgraphics.C
| ===
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
| retrieving revision 1.146.2.4
| diff -u -p -r1.146.2.4 insetgraphics.C
| --- src/insets/insetgraphics.C7 Dec 2004 10:49:34 -   
1.146.2.4
| +++ src/insets/insetgraphics.C16 Dec 2004 01:04:46 -
| @@ -623,6 +623,8 @@ string const InsetGraphics::prepareFile(
|   // without dots and again with ext
|   temp_file = ChangeExtension(
|   subst(temp_file, ".", "_"), ext_tmp);
| + //Remove drive letter on Win32
| + if (temp_file[1] == ':') temp_file = temp_file.erase(0,2);

split on two lines

|   // now we have any_dir_file.ext
|   temp_file = MakeAbsPath(temp_file, buf->tmppath);
|   lyxerr[Debug::GRAPHICS]
| Index: src/support/FileInfo.C
| ===
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/FileInfo.C,v
| retrieving revision 1.18.2.2
| diff -u -p -r1.18.2.2 FileInfo.C
| --- src/support/FileInfo.C15 Dec 2004 21:40:03 -  1.18.2.2
| +++ src/support/FileInfo.C16 Dec 2004 01:04:46 -
| @@ -174,10 +178,20 @@ void FileInfo::init()
|  
|  void FileInfo::dostat(bool link)
|  {
| + string name(fname_);
| +#ifdef _WIN32
| + // Win32 stat() doesn't dig trailing slashes
| + if (name.at(name.size()-1) == '/') name.erase(name.size() -1);

ditto 

| Index: src/support/filetools.C
| ===
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
| retrieving revision 1.146.2.7
| diff -u -p -r1.146.2.7 filetools.C
| --- src/support/filetools.C   15 Dec 2004 19:35:11 -  1.146.2.7
| +++ src/support/filetools.C   16 Dec 2004 01:04:48 -
| @@ -193,10 +196,12 @@ string const FileOpenSearch(string const
|   notfound = false;
|   }
|   }
| -#ifdef __EMX__
| +#if defined(__EMX__) || defined(_WIN32) 
|   if (ext.empty() && notfound) {
|   real_file = FileOpenSearch(path, name, "exe");
| - if (notfound) real_file = FileOpenSearch(path, name, "cmd");
| +#ifdef __EMX__
| + if (notfound) real_file = FileOpenSearch(path, name,
| "cmd");

ditto (even if not done before)

| Index: src/support/kill.C
| ===
| RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/kill.C,v
| retrieving revision 1.7
| diff -u -p -r1.7 kill.C
| --- src/support/kill.C10 Jun 2002 17:31:57 -  1.7
| +++ src/support/kill.C16 Dec 2004 01:04:48 -
| @@ -5,7 +5,40 @@
|  #include 
|  #include 
|  
| +#ifdef _WIN32
| +#include "debug.h"
| +#include "os.h"
| +
| +#include 
| +#include 

  ??

| +
| +using std::endl;
| +#endif //_WIN32

and debug.h, os.h, std::endl is not specific enough for WIN32 to be
inside a ifdef, just put them outside.

| +
|  int lyx::kill(int pid, int sig)
|  {
| +#ifdef _WIN32
| + if (pid == (int)GetCurrentProcessId())
| + return -(raise(sig));

Hmm.. Do we ever send signals to ourselves. Perhaps we should just
assert on that condition.

Either that or handle win/non-win in the same way.

| + else{
| + HANDLE hProcess;
| + if (!(hProcess =
| + OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid))) {
| + lyxerr << "kill OpenProcess failed!" << endl;
| + return -1;
| + }
| + else {
| + if (!TerminateProcess(hProcess, sig)){
| + lyxerr << "kill process failed!" << endl;
| + CloseHandle(hProcess);
| + return -1;
| + }
| + CloseHandle(hProcess);
| + }
| + }
| + return 0;
| +
| +#else
|   return ::kill(pid, sig);

And we should probably check this for errors as well.
(and log them)

-- 
Lgb



Re: MSVC wrapper

2004-12-16 Thread Ruurd Reitsma
"Angus Leeming" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Incidentally, Ruurd, do you need this wrapper at all? Why not patch the
> scripts in config to generate Makefiles that 'just do the right thing'?

I did try that at first, but I wasn´t very successfull. If remember
correctly, there is some rudimentary support for msvc in the autotools. It
worked, but was horribly slow. Handling all that stuff in C++ did speed it
up by a very large factor.

Maybe some other cross platform open source project has figured out a more
elegant solution by now

Ruurd





Re: [PATCH 13x, 14x] configure tests for mkdir

2004-12-16 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> It turned out that this solution was incorrect. Compilation
Angus> failed on the Windows machine because the definition of a mkdir
Angus> macro in config.h conflicted with another mkdir macro defined
Angus> in mingw/include/os.h.

Angus> I have therefore removed these nasty macros and placed the
Angus> #ifdef HAVE_MKDIR conditional block inside the support/mkdir.C
Angus> routine. Much more robust.

That is much much better anyway.

JMarc


Re: sideways tables/figures

2004-12-16 Thread Jean-Marc Lasgouttes
> "Edwin" == Edwin Leuven <[EMAIL PROTECTED]> writes:

Edwin> PPS trying to open a doc, lyx crashes:

What doc was that?

JMarc



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Lars Gullik Bjønnes wrote:
> | As promised, I'm posting the remainder of the changes that are needed
> | to compile LyX with MinGW. This patch is much less intrusive than the
> | original because the offensive os_win32.h is how #included only by
> | those .C files that actually need it.
> 
> I am not sure I like that solution.
> 
> We should work hard to get all platform specific code out of the
> regular .C files.
> 
> If a support/os.h works equally well we should use that instead.
> (and no conditionals)

You misunderstand me. (I was unable to express myself clearly at one 
o'clock in the morning.)

I am not proposing that this patch should go into the tree. Anything but. 
I am saying that this is the patch that is needed to make LyX compile on 
Windows. Things in the patch can be classified in three groups:

1. Things to do with using LyX on a Windows machine. That is, the stuff in 
os_win32.C (The .C file, not the .h file which is a kludge). The 
insetgraphics.C fix. These things will probably go into the tree pretty 
much as-is (once I actually understand what they do ;-))

2. Things to do with files. For example, symbolic links do not exist on 
Windows. There are changes to filetools.C and FileInfo.C that will be 
needed but which are masked by the empty macros in os_win32.h. These 
things will need some configure-magic but the basic code is probably fine.

3. Things to do with external processes. Launching, 'em, communicating 
with 'em throught FIFOs and killing 'em. ispell.C, lyxserver.C, 
lyx_cb.C, kill.C, forkedcall.C, forkedcontrl.C. The empty macros of 
os_win32.h hide the fact that the Windows API is fundamentally different 
to the Posix one. This code will need to be re-written entirely in order 
to provide Windows users with the same power as *nix ones.

Addressing the issues in the first two of these groups is straightforward. 
Group 3 will need more work and the changes may well be unsuited to the 
1.3.x branch. Time will tell.

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> As promised, I'm posting the remainder of the changes that are
Angus> needed to compile LyX with MinGW. This patch is much less
Angus> intrusive than the original because the offensive os_win32.h is
Angus> how #included only by those .C files that actually need it.

   +#ifdef _WIN32
   +# include "support/os_win32.h"
   +#endif
   +

I am not very fond of this thing. Could you at least in each of these
instance add a comment telling what construct is missing? Then we
could try to have a strategy on avoiding some of this stuff. 

The same holds for the other instances.
 
   +#ifdef HAVE_UNISTD_H
   +# include 
   +#endif
   +

?

 
   +#ifdef HAVE_SELECT
   retval = ::select(SELECT_TYPE_ARG1 (max(pipeout[0], pipeerr[0]) + 1),
   SELECT_TYPE_ARG234 (),
   0,
   0,
   SELECT_TYPE_ARG5 ());
   +#else
   +retval = -1;
   +#endif

Does it mean that ispell will not work in windows?

   @@ -289,7 +293,7 @@ void LyX::init(bool gui)
   do {
   // Path of binary/../share/name of binary/
   searchpath += NormalizePath(AddPath(binpath, "../share/") +
   -  OnlyFilename(binname)) + ';';
   +  ChangeExtension(OnlyFilename(binname),"")) + ';';

Don't we need something more selective, like removing ".exe" from the
end of the string if it is here? Actually, I guess the whole LyX::init
strategy should be rethought in the light of our platform support.

A little digression: instead of our current os:: namespace, wouldn't
it be better to have a hierarchy of os_foo classes with static
methods, so that some environment could inherit others (like cygwin =
unix + some stuff). The some of the code from this init method could
be moved to os_foo.C files.


   @@ -113,6 +113,7 @@ string const fromqstr(QString const & st
{
   QTextCodec * codec = QTextCodec::codecForLocale();
   QCString tmpstr = codec->fromUnicode(str);
   -char const * tmpcstr = tmpstr;
   +char const * tmpcstr = "\0";
   +if (!tmpstr.isEmpty()) tmpcstr = tmpstr;
   return tmpcstr;
}

Do you know what this does exactly? The indentation is wrong anyway.

   @@ -623,6 +623,8 @@ string const InsetGraphics::prepareFile(
   // without dots and again with ext
   temp_file = ChangeExtension(
   subst(temp_file, ".", "_"), ext_tmp);
   +//Remove drive letter on Win32
   +if (temp_file[1] == ':') temp_file = temp_file.erase(0,2);
   // now we have any_dir_file.ext
   temp_file = MakeAbsPath(temp_file, buf->tmppath);
   lyxerr[Debug::GRAPHICS]

I do not like this. Is there a reason why this should not be handled
by some generic function?

   @@ -193,10 +196,12 @@ string const FileOpenSearch(string const
   notfound = false;
   }
   }
   -#ifdef __EMX__
   +#if defined(__EMX__) || defined(_WIN32) 
   if (ext.empty() && notfound) {
   real_file = FileOpenSearch(path, name, "exe");
   -if (notfound) real_file = FileOpenSearch(path, name, "cmd");
   +#ifdef __EMX__
   +if (notfound) real_file = FileOpenSearch(path, name, "cmd");
   +#endif

If OS/2 looks for .cmd, should win32 look for .bat? 

The test should be on two lines.

   @@ -366,7 +371,7 @@ string const GetEnv(string const & envna

string const GetEnvPath(string const & name)
{
   -#ifndef __EMX__
   +#if !defined(__EMX__) && !defined(_WIN32)
   string const pathlist = subst(GetEnv(name), ':', ';');
#else
   string const pathlist = os::slashify_path(GetEnv(name));

First, there are a lot of lines like
  src/lyx_main.C:using lyx::support::GetEnvPath;
that should be removed from the source

Then, when you look at the remaining uses of GetEnvPath (in HEAD), you
find two categories:

- stuff in os_foo.C, which can have its own code without ifdef

- stuff in path_defines.C.in, which does not consider list of paths
  anyway

So I think we could maybe get rid of the function. Also we could
decide to change os::slashify_path so that it does the :->;
substitution as needed.

JMarc


Re: The remainder of Ruurd's changes

2004-12-16 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

|+#ifdef HAVE_UNISTD_H
|+# include 
|+#endif
|+

| ?

No such thing.

-- 
Lgb



Re: sideways tables/figures

2004-12-16 Thread Edwin Leuven
What doc was that?
it crashes on the attached...
regards, ed.
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass article
\begin_preamble
\usepackage{mathptmx}
\usepackage[scaled=0.9]{helvet}
\usepackage{courier}
\usepackage{rotating}
\date{}
\usepackage{dcolumn}
\newcolumntype{d}{D{.}{.}{6}}

[EMAIL PROTECTED] [EMAIL PROTECTED]
   {-3.5ex [EMAIL PROTECTED] -1ex [EMAIL 
PROTECTED] -.2ex}%
   {2.3ex [EMAIL PROTECTED]
   [EMAIL PROTECTED]
[EMAIL PROTECTED]@}%
 [EMAIL PROTECTED] -1ex [EMAIL PROTECTED] 
-.2ex}%
 {1.5ex [EMAIL PROTECTED] .2ex}%
 [EMAIL PROTECTED]
[EMAIL PROTECTED]@}%
 [EMAIL PROTECTED] -1ex [EMAIL PROTECTED] 
-.2ex}%
 {-1em}%
 [EMAIL PROTECTED]
\end_preamble
\options a4paper
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize 11
\spacing onehalf 
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 1
\use_natbib 1
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Standard


\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
begin{sidewaysfigure} 
\backslash 
centering 
\end_inset 


\layout Standard


\begin_inset Graphics
filename /home/leuven/projects/bapo2/cohort2.eps
scale 70

\end_inset 


\layout Caption

Average working time relative to full-time, by age and gender (1999-2002)
\begin_inset LatexCommand \label{fig: wtf+bapo}

\end_inset 


\layout Standard


\begin_inset ERT
status Open

\layout Standard

\backslash 
end{sidewaysfigure}
\end_inset 


\the_end


[patch] bug 1214

2004-12-16 Thread Juergen Spitzmueller
http://bugzilla.lyx.org/show_bug.cgi?id=1214

This one fixes a bug in xforms' math panel. mathed should always get only one 
dispatch, not two separate ones. The qt frontend does this since genesis.

OK?

Jürgen

P.S.: This is also a 1.3.6 candidate
Index: FormMathsBitmap.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormMathsBitmap.C,v
retrieving revision 1.46
diff -u -r1.46 FormMathsBitmap.C
--- FormMathsBitmap.C	19 May 2004 15:11:35 -	1.46
+++ FormMathsBitmap.C	16 Dec 2004 12:59:39 -
@@ -173,13 +173,7 @@
 
 void FormMathsBitmap::apply()
 {
-	string::size_type const i = latex_chosen_.find(' ');
-	if (i != string::npos) {
-		controller().dispatchFunc(LFUN_MATH_MODE);
-		controller().dispatchInsert(latex_chosen_.substr(0,i));
-		controller().dispatchInsert('\\' + latex_chosen_.substr(i + 1));
-	} else
-		controller().dispatchInsert(latex_chosen_);
+	controller().dispatchInsert(latex_chosen_);
 }
 
 


Re: [patch] encoding error

2004-12-16 Thread Juergen Spitzmueller
Martin Vermeer wrote:
> These are meant to be the units Ångström and Ørsted. So you need a
> Swedish Å (\AA is OK I think) and a Danish Ø (\O).

Patch attached. The only drawback is that it gets rendered as "AA" and "O". I 
don't know how to add the commands \AA and \O to lib/symbols or whereever.

Jürgen
Index: ControlMath.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlMath.C,v
retrieving revision 1.26
diff -u -r1.26 ControlMath.C
--- ControlMath.C	19 May 2004 15:11:30 -	1.26
+++ ControlMath.C	16 Dec 2004 13:08:08 -
@@ -177,7 +177,7 @@
 	"angle", "top", "bot", "Vert", "neg",
 	"flat", "natural", "sharp", "surd", "triangle",
 	"diamondsuit", "heartsuit", "clubsuit", "spadesuit",
-	"textrm Ã?", "textrm Ã?", "mathcircumflex", "_",
+	"textrm \\AA", "textrm \\O", "mathcircumflex", "_",
 	"mathrm T",
 	"mathbb N", "mathbb Z", "mathbb Q",
 	"mathbb R", "mathbb C", "mathbb H",


Re: The remainder of Ruurd's changes

2004-12-16 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:
>
| | ?
>
| Lars> No such thing.
>
| What can unistd.h do that no  header does?

unixy things. Lots of stuff just have a look at the header on your own
box.

The  header are basically just the C-standard headers in C++
wrapping.

-- 
Lgb



Re: sideways tables/figures

2004-12-16 Thread Alfredo Braunstein
Edwin Leuven wrote:

>> What doc was that?
> 
> it crashes on the attached...

| \layoutÂCaption
|
| 
AverageÂworkingÂtimeÂrelativeÂtoÂfull-time,ÂbyÂageÂandÂgenderÂ(1999-2002)

THe problem is a caption in a top paragraph. In top paragraphs the
inset_owner is not set on reading and so it crashes.


// the caption hack:
if (layout->labeltype == LABEL_SENSITIVE) {
pit_type end = paragraphs().size();
pit_type tmppit = pit;
InsetBase * in = 0;
bool isOK = false;
while (tmppit != end) {
in = pars_[tmppit].inInset();
if (in->lyxCode() == InsetBase::FLOAT_CODE ||
in->lyxCode() == InsetBase::WRAP_CODE) {


A dead easy solution is to check for inInset() != 0 before using it
A better solution is to set the owner inset of top paragraphs
A much better solution is to get rid of inset_owner.

Alfredo




Re: [PATCH] Hyphenation, the latex way

2004-12-16 Thread Jean-Marc Lasgouttes
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes:

Andre> On Tue, Dec 07, 2004 at 04:32:59PM +, Angus Leeming wrote:
>> Isn't it possible to define \mesg only when \typeout's argument
>> starts "Babel":
>> 
>> {\def\typeout#1{if #1 starts with "Babel" then
>> \global\def\mesg{#1}} \the\everyjob}

Andre> We could simply collect all typeout arguments and cut out the
Andre> interesting part later

Andre> \def\mesg{} {\def\typeout#1{\global\edef\mesg{\mesg #1}}
Andre> \the\everyjob}

This is basically what I do.

JMarc


Re: [PATCH] Hyphenation, the latex way

2004-12-16 Thread Jean-Marc Lasgouttes
> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
Angus> Isn't it possible to define \mesg only when \typeout's argument
Angus> starts "Babel":

Jean-Marc> I thought about that (and I do not know how to do it...),
Jean-Marc> but a better solution has been proposed on fctt:
Jean-Marc> concatenate all the \typeout messages into the \mesg macro,
Jean-Marc> and find the languages in there. This gives the following
Jean-Marc> updated patch, where I have added some comments to explain
Jean-Marc> the code.

I have committed this code, along with a slight change to
LaTeXConfig.lyx.in.

JMarc


Re: [patch] encoding error

2004-12-16 Thread Jean-Marc Lasgouttes
> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Martin Vermeer wrote:
>> These are meant to be the units Ångström and Ørsted. So you need a
>> Swedish Å (\AA is OK I think) and a Danish Ø (\O).

Juergen> Patch attached. The only drawback is that it gets rendered as
Juergen> "AA" and "O". I don't know how to add the commands \AA and \O
Juergen> to lib/symbols or whereever.

Why do we need the \\textrm? I'd think we should just insets the
characters as they are...

JMarc



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
> A little digression: instead of our current os:: namespace, wouldn't
> it be better to have a hierarchy of os_foo classes with static
> methods, so that some environment could inherit others (like cygwin =
> unix + some stuff). The some of the code from this init method could
> be moved to os_foo.C files.

You can't have static virtual member functions, but you could have either 
a "class os" (à la 13x) or a "namespace os" (à la 14x) that hid the 
implementation:

class os {
public:
static void init(int argc, char * argv[]);

static string const & binpath();
static string const & binname();
static string const & homepath();
static string const & nulldev();
private:
struct impl {
virtual string const & binpath() const = 0;
virtual string const & binname() const = 0;
virtual string const & homepath() const = 0;
virtual string const & nulldev() const = 0;
};
static boost::scoped_ptr pimpl_;
};

Each os_cygwin, os_os2, os_unix, os_win32 class would inherit from 
os::impl.

However, I don't think that such a change should go in the 1.3.x series 
and I don't really see what it would give 1.4.x. Can we leave this for 
1.5.x?

-- 
Angus



Re: [patch] bug 1214

2004-12-16 Thread Juergen Spitzmueller
Martin Vermeer wrote:
> E.g., the real numbers R is sent as "mathbb R" and then dispatched as
> "\mathbb" (creating a little blue font box), followed by "R" (to be put
> inside it).
>
> This *used* to work, but doesn't anymore. Jürgen, is this what you are
> fixing?

Basically yes.

Jürgen

P.S.: If you select Insert->Math->Inline Formula, the Inset contains the 
string "on". This is unrelated to my patch, but certainly weird.


[PATCH 14x only] removing redundant using directives.

2004-12-16 Thread Angus Leeming
Cruft left over from the 'OS abstraction of "HOME" and the null device' 
patch. Thanks to Jean-Marc for spotting this stuff.

Committing now...

AngusIndex: src/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2060
diff -u -p -r1.2060 ChangeLog
--- src/ChangeLog	15 Dec 2004 19:35:42 -	1.2060
+++ src/ChangeLog	16 Dec 2004 14:48:14 -
@@ -1,3 +1,9 @@
+2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* bufferlist.C:
+	* lyx_main.C: 
+	* messages.C: remove redundant "using lyx::support::GetEnvPath;"
+
 2004-12-14  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* LaTeX.C: (startscript): use os::nulldev() rather than "/dev/null".
Index: src/bufferlist.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferlist.C,v
retrieving revision 1.146
diff -u -p -r1.146 bufferlist.C
--- src/bufferlist.C	15 Dec 2004 19:35:42 -	1.146
+++ src/bufferlist.C	16 Dec 2004 14:48:14 -
@@ -36,7 +36,6 @@
 
 using lyx::support::AddName;
 using lyx::support::bformat;
-using lyx::support::GetEnvPath;
 using lyx::support::MakeAbsPath;
 using lyx::support::MakeDisplayPath;
 using lyx::support::OnlyFilename;
Index: src/lyx_main.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_main.C,v
retrieving revision 1.188
diff -u -p -r1.188 lyx_main.C
--- src/lyx_main.C	15 Dec 2004 19:35:43 -	1.188
+++ src/lyx_main.C	16 Dec 2004 14:48:15 -
@@ -65,7 +65,6 @@ using lyx::support::createLyXTmpDir;
 using lyx::support::FileInfo;
 using lyx::support::FileSearch;
 using lyx::support::GetEnv;
-using lyx::support::GetEnvPath;
 using lyx::support::i18nLibFileSearch;
 using lyx::support::LibFileSearch;
 using lyx::support::Path;
Index: src/messages.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/messages.C,v
retrieving revision 1.17
diff -u -p -r1.17 messages.C
--- src/messages.C	19 Oct 2004 09:11:00 -	1.17
+++ src/messages.C	16 Dec 2004 14:48:15 -
@@ -15,7 +15,6 @@
 
 #include 
 
-using lyx::support::GetEnvPath;
 using lyx::support::lyx_localedir;
 
 using std::string;
Index: src/client/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/ChangeLog,v
retrieving revision 1.8
diff -u -p -r1.8 ChangeLog
--- src/client/ChangeLog	14 Dec 2004 10:41:05 -	1.8
+++ src/client/ChangeLog	16 Dec 2004 14:48:15 -
@@ -1,3 +1,7 @@
+2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* messages.C: remove redundant "using lyx::support::GetEnvPath;"
+
 2004-12-14  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Makefile.am (AM_CPPFLAGS): Remove trailing slash from -Ifoo/
Index: src/client/messages.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/messages.C,v
retrieving revision 1.1
diff -u -p -r1.1 messages.C
--- src/client/messages.C	4 Sep 2004 12:13:50 -	1.1
+++ src/client/messages.C	16 Dec 2004 14:48:15 -
@@ -13,7 +13,6 @@
 #include "support/filetools.h"
 #include "support/path_defines.h"
 
-using lyx::support::GetEnvPath;
 using lyx::support::lyx_localedir;
 
 using std::string;
Index: src/frontends/xforms/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.956
diff -u -p -r1.956 ChangeLog
--- src/frontends/xforms/ChangeLog	15 Dec 2004 21:40:11 -	1.956
+++ src/frontends/xforms/ChangeLog	16 Dec 2004 14:48:18 -
@@ -1,3 +1,7 @@
+2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* FormFiledialog.C: remove redundant "using lyx::support::GetEnvPath;"
+
 2004-12-15  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* FormFiledialog.C (Reread): no longer use FileInfo::getNumberOfLinks().
Index: src/frontends/xforms/FormFiledialog.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormFiledialog.C,v
retrieving revision 1.61
diff -u -p -r1.61 FormFiledialog.C
--- src/frontends/xforms/FormFiledialog.C	15 Dec 2004 21:40:11 -	1.61
+++ src/frontends/xforms/FormFiledialog.C	16 Dec 2004 14:48:18 -
@@ -66,7 +66,6 @@ using lyx::support::ExpandPath;
 using lyx::support::FileFilterList;
 using lyx::support::FileInfo;
 using lyx::support::getcwd;
-using lyx::support::GetEnvPath;
 using lyx::support::LyXReadLink;
 using lyx::support::MakeAbsPath;
 using lyx::support::OnlyFilename;


Configure problems for lyx-140 on Mac

2004-12-16 Thread Bennett Helm
Trying to build the latest CVS of lyx-140 in Mac OS X forced rerunning 
configure, which fails. I get variants of the following error with each 
of ostream, istream, sstream, locale, ios, and Aiksaurus:

checking ostream usability... no
checking ostream presence... yes
configure: WARNING: ostream: present but cannot be compiled
configure: WARNING: ostream: check for missing prerequisite headers?
configure: WARNING: ostream: proceeding with the preprocessor's result
configure: WARNING: ##  ##
configure: WARNING: ## Report this to [EMAIL PROTECTED] ##
configure: WARNING: ##  ##
checking for ostream... yes
The result is a failure to find the Qt library name.
I'm using gcc-3.3 (the latest version from Apple, which I installed 
several weeks ago, with no problems then). (These problems do not occur 
for gcc-3.1.)

Any suggestions?
Thanks.
Bennett


Re: Configure problems for lyx-140 on Mac

2004-12-16 Thread Angus Leeming
Bennett Helm wrote:

> Trying to build the latest CVS of lyx-140 in Mac OS X forced rerunning
> configure, which fails. I get variants of the following error with each
> of ostream, istream, sstream, locale, ios, and Aiksaurus:
> 
> checking ostream usability... no
> checking ostream presence... yes
> configure: WARNING: ostream: present but cannot be compiled
> configure: WARNING: ostream: check for missing prerequisite headers?
> configure: WARNING: ostream: proceeding with the preprocessor's result
> configure: WARNING: ##  ##
> configure: WARNING: ## Report this to
> [EMAIL PROTECTED] ##
> configure: WARNING: ##  ##
> checking for ostream... yes
> 
> The result is a failure to find the Qt library name.
> 
> I'm using gcc-3.3 (the latest version from Apple, which I installed
> several weeks ago, with no problems then). (These problems do not occur
> for gcc-3.1.)
> 
> Any suggestions?

Try running

$ ./autogen.sh
$ ./configure 

explicitly. If that doesn't work, try backing out the recent changes to 
configure.ac

$ cvs -q diff -r 1.30 configure.ac > tmp.diff
$ patch -p0 -R < tmp.diff
$ ./autogen.sh
$ ./configure 

(Although I can't see what difference that would make.)

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Jean-Marc Lasgouttes wrote:
>> A little digression: instead of our current os:: namespace,
>> wouldn't it be better to have a hierarchy of os_foo classes with
>> static methods, so that some environment could inherit others (like
>> cygwin = unix + some stuff). The some of the code from this init
>> method could be moved to os_foo.C files.

Angus> You can't have static virtual member functions, but you could
Angus> have either a "class os" (à la 13x) or a "namespace os" (à la
Angus> 14x) that hid the implementation:

Did I say virtual? I thought of static member functions and os.h would
do

#if in unix 
#include "os_unix.h"
typedef os_unix os;
#else if in win32
#include "os_win32.h"
typedef os_win32 os;
...

JMarc


Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:

>@@ -289,7 +293,7 @@ void LyX::init(bool gui)
>do {
>// Path of binary/../share/name of binary/
>searchpath += NormalizePath(AddPath(binpath,
>"../share/") +
>-OnlyFilename(binname)) + ';';
>+ChangeExtension(OnlyFilename(binname),"")) + ';';
> 
> Don't we need something more selective, like removing ".exe" from the
> end of the string if it is here? Actually, I guess the whole LyX::init
> strategy should be rethought in the light of our platform support.

This is an equivalent can of worms to the whole "--with-version-suffix" 
discussion isn't it? One plausible suggestion (made by Lars?) is to 
hard-code the location of the system-wide shared data as
/Path of binary/../share/lyx/13x/

where 13x would actually have been 130 for LyX 1.3.0 to 1.3.3 and would 
have changed to 134 for LyX version 1.3.4 when a change to the text class 
format was introduced. Maybe that's a bit too cute and each separate LyX 
version should have its own directory.

Ditto, the userdir would become:
os::homepath()/.lyx/13x/

It seems to me that such a scheme would work on all platforms. Am I 
missing something?

Returning to the particular point raised by the proposed patch. Would you 
be happy if I explicitly stripped ".exe" for the Win32 case? Something 
like:

do {
// Path of binary/../share/name of binary/
string const exe_name = OnlyFilename(binname);
string const lyx_system_dir_name =
#ifdef _WIN32
suffixIs(exe_name, ".exe") ?
ChangeExtension(exe_name, "") :
exe_name;
#else
exe_name;
#endif
string const shared_dir_name =
NormalizePath(AddPath(binpath, "../share/");
searchpath += shared_dir_name + lyx_system_dir_name + ';';

Or do you want to propogate an entire new scheme back into the 13x series?

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
>@@ -623,6 +623,8 @@ string const InsetGraphics::prepareFile(
>// without dots and again with ext
>temp_file = ChangeExtension(
>subst(temp_file, ".", "_"), ext_tmp);
>+  //Remove drive letter on Win32
>+  if (temp_file[1] == ':') temp_file = temp_file.erase(0,2);
>// now we have any_dir_file.ext
>temp_file = MakeAbsPath(temp_file, buf->tmppath);
>lyxerr[Debug::GRAPHICS]
> 
> I do not like this. Is there a reason why this should not be handled
> by some generic function?

It is in 1.4.x. The file name is stored as a FileName variable and this 
mangling is done via FileName::mangledFilename()

Anyway, I think that the proposal should be:

>+  // Mangle drive name on Win32
>+  if (temp_file[1] == ':') temp_file[1] = '_';

Ie, the temporary file's name should include this information about the 
drive.

I'll prepare patches.

-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Jean-Marc Lasgouttes wrote:
>>> A little digression: instead of our current os:: namespace,
>>> wouldn't it be better to have a hierarchy of os_foo classes with
>>> static methods, so that some environment could inherit others (like
>>> cygwin = unix + some stuff). The some of the code from this init
>>> method could be moved to os_foo.C files.
> 
> Angus> You can't have static virtual member functions, but you could
> Angus> have either a "class os" (à la 13x) or a "namespace os" (à la
> Angus> 14x) that hid the implementation:
> 
> Did I say virtual? I thought of static member functions and os.h would
> do
> 
> #if in unix
> #include "os_unix.h"
> typedef os_unix os;
> #else if in win32
> #include "os_win32.h"
> typedef os_win32 os;
> ...

You're just too clever for me ;-) However, static member functions can't 
inherit, which is what I thought the point was:

class os_unix {};
class os_cygwin : public os_unix {
// Override some specific member function.
};

If you want to do something like that, then some sort of indirection with 
"class os" hiding a member variable, is inevitable I fear.

Anyway, the principle point remains. Do you want to do this in the 1.3.x 
series or should we leave that as "ugly but working"?
-- 
Angus



Re: The remainder of Ruurd's changes

2004-12-16 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Thanks for the commentary, Jean-Marc. I like the ideas of a
Angus> hierarchy of "os" classes and of getting rid of GetEnvPath.
Angus> I'll continue the process of small, self contained patches.

Sure.

Angus> I think that, as a rule, we should be a little less worried
Angus> about indentation issues. As often as not the only comments
Angus> that a patch gets are about indentation and whitespace. Let's
Angus> assume that I'll get that right and concentrate on the
Angus> substance of the proposed changes ;-)

Agreed.

Angus> Summary, the above code is a bug fix, pure and simple, although
Angus> I'd write is as:

Angus> { QTextCodec const * const codec =
Angus> QTextCodec::codecForLocale(); QCString const tmpstr =
Angus> codec->fromUnicode(str); return tmpstr.isEmpty() ? string() :
Angus> string(tmpstr);
Angus> }

Angus> Patches attached. Happy if I commit?

Yes. I was wondering whether this is related to the string-related
crashes people have been experiencing with some versions of Qt (with
non-existing fonts). I believe this has been fixed in 1.4.0cvs, but
not in 1.3.6cvs.

JMarc



Re: The remainder of Ruurd's changes

2004-12-16 Thread Angus Leeming
Lars Gullik Bjønnes wrote:
> | class os {
> | public:
> | static void init(int argc, char * argv[]);
>>
> | static string const & binpath();
> | static string const & binname();
> | static string const & homepath();
> | static string const & nulldev();
> | private:
> | struct impl {
> | virtual string const & binpath() const = 0;
> | virtual string const & binname() const = 0;
> | virtual string const & homepath() const = 0;
> | virtual string const & nulldev() const = 0;
> | };
> | static boost::scoped_ptr pimpl_;
> | };
> 
> Will this work? Remember that you can call a static function without
> the object.
> 
> (Ok I see what you want to do. (init should be private probably))

No, os::init() is called from main(int argc, char * argv).

A lot of these 'theoretical' problems with global data and order of 
initialization would go away if we had a single global LyX variable that 
held all other, currently global, variables.

Anyway, I class this all as a 'make the code nicer' project with no real 
user gains. I don't really see what it has to do with trying to get LyX 
running on Windows. In fact, producing something that works but is even 
clunkier than the existing code base (more #ifdefs) might provide even 
more motivation to refactor this piece of the code ;-)

Whereever this conversation goes, I don't think that any refactoring 
should be backported into the 1.3.x tree.

-- 
Angus



Re: [PATCH 13x, 14x] determining the name of the LyX system dir

2004-12-16 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes:

| @@ -217,8 +217,19 @@ bool setLyxPaths()
|   bool followlink;
|   do {
|   // Path of binary/../share/name of binary/
| - searchpath += NormalizePath(AddPath(binpath, "../share/") +
| -   OnlyFilename(binname)) + ';';
| +
| + string const exe_name = OnlyFilename(binname);
| + string const lyx_system_dir_name =
| +#ifdef _WIN32
| + suffixIs(exe_name, ".exe") ?
| + ChangeExtension(exe_name, "") :
| + exe_name;
| +#else
| + exe_name;
| +#endif

Can we please not split statements with ifdef?

| +#ifdef _WIN32
| + string const lyx_system_dir_name =
| + suffixIs(exe_name, ".exe") ?
| + ChangeExtension(exe_name, "") :
| + exe_name;
| +#else
| + string const lyx_system_dir_name = exe_name;
| +#endif

would be nicer.

-- 
Lgb



Re: [PATCH 13x, 14x] mangling temporary file names

2004-12-16 Thread Georg Baum
Angus Leeming wrote:

> Do you agree that my approach is better? If so, are you happy with the
> attached patches for the 13x and 14x trees?

Yes and yes.


Georg



Re: [PATCH 13x, 14x] mangling temporary file names

2004-12-16 Thread Kuba Ober
On czwartek 16 grudzieÅ 2004 11:59 am, Angus Leeming wrote:
> Given a file name "C:/foo/bar", I believe that the name of the temporary
> file should be "C__foo_bar". Ie, the drive name should be included in the
> mangling. Ruurd was addressing this idea in his patch, but he simply
> removed the drive prefix from the mangled name.

[...]

I vaguely recall this idea being raised at one point or another, but can't the 
temporary file names be simply generated from some kind of a unique global 
counter, maybe merged with PID?

Say if PID is 16940, you'd get 16940_.tmp, ..., 16940_000a.tmp and so on? 
That would preclude any need for mangling.

But I presume there must be some other reason for mangling? I'm just trying to 
understand.

Cheers, Kuba Ober


Running LyX/Win32 -dbg init

2004-12-16 Thread Angus Leeming
As promised Jean-Marc here is the output from lyx -dbg init. This is with
the 'remainder of Ruurd's changes' patch applied to the current 13x CVS.
I've also applied today's two proposals 'mangling temporary file names'
and 'determining the name of the LyX system dir'.

$ cd qt3/bin
$ ~/lyx-13x/build-qt/src/lyx.exe -dbg init

Setting debug level to init
Debugging `init' (Program initialisation)
Initializing LyX::init...
Name of binary: J:\MinSYS\home\Angus\lyx-13x\build-qt\src\lyx.exe
Path of binary: J:/MinSYS/home/Angus/qt3/bin/
Checking whether LyX is run in place... no
System directory search path: J:/MinSYS/home/Angus/qt3/Resources/J
\MinSYS\home\Angus\lyx-13x\build-qt\src\lyx.exe/;J:/MinSYS/home/Angus/qt3/share/J:/MinSYS/home/Angus/lyx-13x/build-qt/src/lyx;J:/MinSYS/local/share/lyx-1.3.6cvs
LyX Warning! Couldn't determine system directory. Try the '-sysdir' command
line parameter or set the environment variable LYX_DIR_13x to the LyX
system directory containing the file `chkconfig.ltx'.
Couldn't even find the default LYX_DIR.
Giving up.

Name of binary:
 Windows-style path but otherwise correct.
Path of binary:
 Unix-style path but actually the directory from which I
 executed the  command to run LyX.
System directory search path:
 Note that there is no ';' between the fist two elements.
 Note also an entertaining mix of Unix and Windows-style paths.

This shouldn't be too hard to fix. I would investigate further, but it
takes 24minutes just to link the bloody thing and I'm off to bed ;-)

I see that MinGW ships with objcopy. I'll try running that magic that I
posted a year ago on the .o files and see if that reduces link times to
something manageable. Mañana.

#! /bin/sh

test $# -gt 0 || exit

while (true); do
objcopy --set-section-flags .debug_str=contents,debug $1
shift
test $# -eq 0 && break;
done

-- 
Angus



Re: Configure problems for lyx-140 on Mac

2004-12-16 Thread Andreas Vox
Angus Leeming <[EMAIL PROTECTED]> writes:

> 
> Bennett Helm wrote:
> 
> > Trying to build the latest CVS of lyx-140 in Mac OS X forced rerunning
> > configure, which fails. I get variants of the following error with each
> > of ostream, istream, sstream, locale, ios, and Aiksaurus:

Same with me.

> 
> Try running
> 
> $ ./autogen.sh
> $ ./configure 

Doesn't make a difference (well, it does, before the make failed
with:

 
cd . && /bin/sh /Users/vox/LYX/lyx-devel/config/missing --run aclocal-1.6 -I m4
cd . && \
  /bin/sh /Users/vox/LYX/lyx-devel/config/missing --run automake-1.6 --foreign  
Makefile
cd . && /bin/sh /Users/vox/LYX/lyx-devel/config/missing --run autoconf
configure.ac:270: error: possibly undefined macro: AC_FUNC_MKDIR
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.
make: *** [configure] Error 1
___

After auogen.sh I get Bennets errors)

I checked the config.log file and it says:

___
configure:4923: checking istream usability
configure:4936: g++ -c -g -Os -fno-exceptions  -W -Wall conftest.cc >&5
In file included from /usr/include/gcc/darwin/3.3/c++/bits/concept_check.h:60,
 from /usr/include/gcc/darwin/3.3/c++/bits/stl_iterator_base_fun
cs.h:68,
 from /usr/include/gcc/darwin/3.3/c++/bits/stl_algobase.h:74,
 from /usr/include/gcc/darwin/3.3/c++/memory:54,
 from /usr/include/gcc/darwin/3.3/c++/string:48,
 from /usr/include/gcc/darwin/3.3/c++/bits/locale_classes.h:47,
 from /usr/include/gcc/darwin/3.3/c++/bits/ios_base.h:47,
 from /usr/include/gcc/darwin/3.3/c++/ios:49,
 from /usr/include/gcc/darwin/3.3/c++/istream:44,
 from configure:4987:
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h: In member function 
   `void __gnu_cxx::_InputIteratorConcept<_Tp>::__constraints()':
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h:415: error: parse 
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h:417: error: parse 
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h: In member function 
   `void __gnu_cxx::_ForwardIteratorConcept<_Tp>::__constraints()':
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h:450: error: parse 
   error before `;' token
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h: In member function 
   `void __gnu_cxx::_RandomAccessIteratorConcept<_Tp>::__constraints()':
/usr/include/gcc/darwin/3.3/c++/bits/boost_concept_check.h:502: error: parse 
   error before `;' token
configure:4939: $? = 1
configure: failed program was:
| #line 4925 "configure"
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "lyx"
| #define PACKAGE_TARNAME "lyx"
| #define PACKAGE_VERSION "1.4.0cvs"
| #define PACKAGE_STRING "lyx 1.4.0cvs"
| #define PACKAGE_BUGREPORT "[EMAIL PROTECTED]"
| #define DEVEL_VERSION 1
| #define PACKAGE "lyx"
| #define VERSION "1.4.0cvs"
| #define HAVE_KPSEWHICH 1
| #ifdef __cplusplus
| #include 
| #endif
| #define WITH_WARNINGS 1
| #define _GLIBCPP_CONCEPT_CHECKS 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_OSTREAM 1
| /* end confdefs.h.  */
| #include 
| #if HAVE_SYS_TYPES_H
| # include 
| #endif
| #if HAVE_SYS_STAT_H
| # include 
| #endif
| #if STDC_HEADERS
| # include 
| # include 
| #else
| # if HAVE_STDLIB_H
| #  include 
| # endif
| #endif
| #if HAVE_STRING_H
| # if !STDC_HEADERS && HAVE_MEMORY_H
| #  include 
| # endif
| # include 
| #endif
| #if HAVE_STRINGS_H
| # include 
| #endif
| #if HAVE_INTTYPES_H
| # include 
| #else
| # if HAVE_STDINT_H
| #  include 
| # endif
| #endif
| #if HAVE_UNISTD_H
| # include 
| #endif
| #include 
configure:4955: result: no
configure:4959: checking istream presence
__



So: Boost? Concept checks? Anyone any idea?


/Andreas



Re: [PATCH 13x, 14x] mangling temporary file names

2004-12-16 Thread Georg Baum
Kuba Ober wrote:

> I vaguely recall this idea being raised at one point or another, but can't
> the temporary file names be simply generated from some kind of a unique
> global counter, maybe merged with PID?

We have a global counter, it is prepended to the mangled name. Otherwise it
would not be unique. The reason for the additional mangling is that people
get a clue where a file comes from when something goes wrong.


Georg



Re: [PATCH 13x, 14x] remove FileInfo::getNumberOfLinks

2004-12-16 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> As suggested by JMarc. Committing now... 

Actually, I was advocating removing the whole information line, but it
may have been too drastic :)

JMarc


Re: [patch] bug 1214

2004-12-16 Thread Jean-Marc Lasgouttes
> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> http://bugzilla.lyx.org/show_bug.cgi?id=1214 This one fixes a
Juergen> bug in xforms' math panel. mathed should always get only one
Juergen> dispatch, not two separate ones. The qt frontend does this
Juergen> since genesis.

What kind of values can latex_chosen_ have?

Juergen> P.S.: This is also a 1.3.6 candidate

Sure, provided you test it.

JMarc


Re: The remainder of Ruurd's changes

2004-12-16 Thread Jean-Marc Lasgouttes
> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:

| ?

Lars> No such thing.

What can unistd.h do that no  header does?

JMarc


Re: [patch] encoding error

2004-12-16 Thread Juergen Spitzmueller
Jean-Marc Lasgouttes wrote:
> > "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:
>
> Juergen> Martin Vermeer wrote:
> >> These are meant to be the units Ångström and Ørsted. So you need a
> >> Swedish Å (\AA is OK I think) and a Danish Ø (\O).
>
> Juergen> Patch attached. The only drawback is that it gets rendered as
> Juergen> "AA" and "O". I don't know how to add the commands \AA and \O
> Juergen> to lib/symbols or whereever.
>
> Why do we need the \\textrm? I'd think we should just insets the
> characters as they are...

This does not work (inserts an empty blue box).

Jürgen

> JMarc


Re: The remainder of Ruurd's changes

2004-12-16 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes:

| Jean-Marc Lasgouttes wrote:
>> A little digression: instead of our current os:: namespace, wouldn't
>> it be better to have a hierarchy of os_foo classes with static
>> methods, so that some environment could inherit others (like cygwin =
>> unix + some stuff). The some of the code from this init method could
>> be moved to os_foo.C files.
>
| You can't have static virtual member functions, but you could have either 
| a "class os" (à la 13x) or a "namespace os" (à la 14x) that hid the 
| implementation:
>
| class os {
| public:
| static void init(int argc, char * argv[]);
>
| static string const & binpath();
| static string const & binname();
| static string const & homepath();
| static string const & nulldev();
| private:
| struct impl {
| virtual string const & binpath() const = 0;
| virtual string const & binname() const = 0;
| virtual string const & homepath() const = 0;
| virtual string const & nulldev() const = 0;
| };
| static boost::scoped_ptr pimpl_;
| };

Will this work? Remember that you can call a static function without
the object.

(Ok I see what you want to do. (init should be private probably))

-- 
Lgb


[PATCH 13x, 14x] mangling temporary file names

2004-12-16 Thread Angus Leeming
Given a file name "C:/foo/bar", I believe that the name of the temporary 
file should be "C__foo_bar". Ie, the drive name should be included in the 
mangling. Ruurd was addressing this idea in his patch, but he simply 
removed the drive prefix from the mangled name.

Do you agree that my approach is better? If so, are you happy with the 
attached patches for the 13x and 14x trees?

Jean-Marc, I'll hang back and await your feedback on this; I've been a bit 
rushy with my application of some of the other patches. Sorry 'bout that.

-- 
AngusIndex: src/insets/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.552.2.18
diff -u -p -r1.552.2.18 ChangeLog
--- src/insets/ChangeLog	14 Dec 2004 10:40:08 -	1.552.2.18
+++ src/insets/ChangeLog	16 Dec 2004 16:48:54 -
@@ -1,3 +1,9 @@
+2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* insetgraphics.C (prepareFile): Given a Windows-style path, don't
+	forget to mangle the drive letter too when generating a unique
+	temporary file name.
+
 2004-12-14  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Makefile.am (INCLUDES): Remove trailing slash from -Ifoo/
Index: src/insets/insetgraphics.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.146.2.4
diff -u -p -r1.146.2.4 insetgraphics.C
--- src/insets/insetgraphics.C	7 Dec 2004 10:49:34 -	1.146.2.4
+++ src/insets/insetgraphics.C	16 Dec 2004 16:48:54 -
@@ -623,6 +623,13 @@ string const InsetGraphics::prepareFile(
 		// without dots and again with ext
 		temp_file = ChangeExtension(
 			subst(temp_file, ".", "_"), ext_tmp);
+
+#if defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_WIN32)
+		// Mangle the drive letter in a Windows-style path.
+		if (temp_file.size() >= 2 && temp_file[1] == ':')
+			temp_file[1] = '_';
+#endif
+
 		// now we have any_dir_file.ext
 		temp_file = MakeAbsPath(temp_file, buf->tmppath);
 		lyxerr[Debug::GRAPHICS]
Index: src/support/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.287
diff -u -p -r1.287 ChangeLog
--- src/support/ChangeLog	16 Dec 2004 01:03:34 -	1.287
+++ src/support/ChangeLog	16 Dec 2004 16:46:10 -
@@ -1,5 +1,11 @@
 2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
 
+	* filename.C (mangledFilename): Given a Windows-style path, don't
+	forget to mangle the drive letter too when generating a unique
+	temporary file name.
+
+2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
+
 	* mkdir.C: move the HAVE_MKDIR conditional code out of config.h
 	and into here.
 
Index: src/support/filename.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filename.C,v
retrieving revision 1.10
diff -u -p -r1.10 filename.C
--- src/support/filename.C	7 Nov 2004 13:22:51 -	1.10
+++ src/support/filename.C	16 Dec 2004 16:46:10 -
@@ -86,6 +86,13 @@ string const FileName::mangledFilename()
 	mname = subst(mname, ".", "_");
 	// Add the extension back on
 	mname = ChangeExtension(mname, GetExtension(name_));
+
+#if defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_WIN32)
+	// Mangle the drive letter in a Windows-style path.
+	if (mname.size() >= 2 && mname[1] == ':')
+		mname[1] = '_';
+#endif
+
 	// Prepend a counter to the filename. This is necessary to make
 	// the mangled name unique.
 	static int counter = 0;


[PATCH 13x, 14x] determining the name of the LyX system dir

2004-12-16 Thread Angus Leeming
Ok, Jean-Marc. Here is a refinement of Ruurd's patch to determine the name 
of the LyX system directory from the name of the LyX binary. Are you happy 
with this or should we discuss it some more?

-- 
AngusIndex: src/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1021.2.53
diff -u -p -r1.1021.2.53 ChangeLog
--- src/ChangeLog	15 Dec 2004 19:35:06 -	1.1021.2.53
+++ src/ChangeLog	16 Dec 2004 17:25:25 -
@@ -1,4 +1,11 @@
- 2004-12-14  Angus Leeming  <[EMAIL PROTECTED]>
+2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* lyx_main.C (init): on a Windows build, remove the ".exe"
+	extension from the name of the LyX binary when trying to
+	ascertain the name of the LyX system directory.
+	(Usually, /../share//).
+
+2004-12-14  Angus Leeming  <[EMAIL PROTECTED]>
  
 	* LaTeX.C: (operator()): use os::nulldev() rather than "/dev/null".
 
Index: src/lyx_main.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_main.C,v
retrieving revision 1.134.2.5
diff -u -p -r1.134.2.5 lyx_main.C
--- src/lyx_main.C	15 Dec 2004 19:35:10 -	1.134.2.5
+++ src/lyx_main.C	16 Dec 2004 17:25:25 -
@@ -288,8 +288,19 @@ void LyX::init(bool gui)
 	bool followlink;
 	do {
 		// Path of binary/../share/name of binary/
-		searchpath += NormalizePath(AddPath(binpath, "../share/") +
-		  OnlyFilename(binname)) + ';';
+
+		string const exe_name = OnlyFilename(binname);
+		string const lyx_system_dir_name =
+#ifdef _WIN32
+			suffixIs(exe_name, ".exe") ?
+ChangeExtension(exe_name, "") :
+exe_name;
+#else
+			exe_name;
+#endif
+		string const shared_dir_name =
+			NormalizePath(AddPath(binpath, "../share/"));
+		searchpath += shared_dir_name + lyx_system_dir_name + ';';
 
 		// Follow Symlinks
 		FileInfo file(fullbinpath, true);
Index: src/support/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.287
diff -u -p -r1.287 ChangeLog
--- src/support/ChangeLog	16 Dec 2004 01:03:34 -	1.287
+++ src/support/ChangeLog	16 Dec 2004 17:25:40 -
@@ -1,5 +1,10 @@
 2004-12-16  Angus Leeming  <[EMAIL PROTECTED]>
 
+	* path_defines.C.in (setLyxPaths): on a Windows build, remove the
+	".exe" extension from the name of the LyX binary when trying to
+	ascertain the name of the LyX system directory.
+	(Usually, /../share//).
+
 	* mkdir.C: move the HAVE_MKDIR conditional code out of config.h
 	and into here.
 
Index: src/support/path_defines.C.in
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/path_defines.C.in,v
retrieving revision 1.14
diff -u -p -r1.14 path_defines.C.in
--- src/support/path_defines.C.in	15 Dec 2004 19:35:43 -	1.14
+++ src/support/path_defines.C.in	16 Dec 2004 17:25:40 -
@@ -217,8 +217,19 @@ bool setLyxPaths()
 	bool followlink;
 	do {
 		// Path of binary/../share/name of binary/
-		searchpath += NormalizePath(AddPath(binpath, "../share/") +
-		  OnlyFilename(binname)) + ';';
+
+		string const exe_name = OnlyFilename(binname);
+		string const lyx_system_dir_name =
+#ifdef _WIN32
+			suffixIs(exe_name, ".exe") ?
+ChangeExtension(exe_name, "") :
+exe_name;
+#else
+			exe_name;
+#endif
+		string const shared_dir_name =
+			NormalizePath(AddPath(binpath, "../share/"));
+		searchpath += shared_dir_name + lyx_system_dir_name + ';';
 
 		// Follow Symlinks
 		FileInfo file(fullbinpath, true);


Re: [PATCH 13x, 14x] determining the name of the LyX system dir

2004-12-16 Thread Angus Leeming
Lars Gullik Bjønnes wrote:

> Angus Leeming <[EMAIL PROTECTED]> writes:
> 
> | @@ -217,8 +217,19 @@ bool setLyxPaths()
> |  bool followlink;
> |  do {
> |  // Path of binary/../share/name of binary/
> | -   searchpath += NormalizePath(AddPath(binpath, "../share/") +
> | - OnlyFilename(binname)) + ';';
> | +
> | +   string const exe_name = OnlyFilename(binname);
> | +   string const lyx_system_dir_name =
> | +#ifdef _WIN32
> | +   suffixIs(exe_name, ".exe") ?
> | +   ChangeExtension(exe_name, "") :
> | +   exe_name;
> | +#else
> | +   exe_name;
> | +#endif
> 
> Can we please not split statements with ifdef?

Sure, but that is just more 'whitespace commentary'. Are you in favour of 
the substance of the proposal or should we take this back to the drawing 
board?

-- 
Angus