Bennett Helm
Thu, 05 Jan 2006 06:27:01 -0800
On Jan 5, 2006, at 5:01 AM, Jean-Marc Lasgouttes wrote:
Anders> - "New from Template..." gives a Open dialogue in the
Anders> /Applications directory. Templates are in the (hidden)
Anders> LyX-package and difficult to access from this Open-dialogue
This is strange. Bennett, do you see this too?
The problem, I take it, is not that Anders is getting an Open
dialog rather than a New from Template dialog. (The two look the
same on screen, but they behave differently.) Rather, it is that
Anders is trying to access template files inside the LyX.app
bundle, but the Mac native file browser we now use won't let him
inside. (Even setting /Applications/LyX.app/Contents/Resources/LyX/
templates as the path in LyX's preferences won't do the trick: it
just brings up the / Applications folder.)
There must be a way to get the native browser to go inside
application bundles, though I wonder whether that's desirable in
general, as it flouts Mac conventions.
An alternative would be to create a new folder at ~/Library/
Application Support/LyX/templates/default in which we copy the
default templates from the application bundle (overwriting files
that are there) whenever LyX is installed. (User templates could
still be left at ~/Library/Application Support/LyX/templates.) This
would require clear warnings when the installer that people
shouldn't modify files in the default templates folder.
Bennett
Looking at how some other applications have solved this:
- Microsoft puts the Microsoft Word.app and a Templates-folder as
separate entities in the directory in /Applications/Microsoft Office
2004/ The same approach is used by AppleWorks.
- Apple's Pages put its templates in /Applications/iWork/Pages.app/
Contents/Resources/English.lproj/Templates/ (below they have two
folders named ISO and Traditional with sub-folders for the templates).
In all of these cases, templates are selected through a pop-up menu
and not a New... or Open... dialogue.
(In all of the cases, you store your created templates using a
standard save dialogue. There may be a dedicated folder for personal
templates (either in ~/Library/Application Support/Program_Directory
[used by Pages] or in /Applications/Program_Directory/Templates/
[used by MS Office] (where the Save... dialogue is initially directed
and I assume the program looks for user-defined templates), but you
are basically free to choose whichever location you like for the
templates.)
If a pop-up menu is difficult to implement, the MS Office version is
probably easiest to adopt (though the risk is that since the
templates are easily accessible they may be tinkered with, cf
Bennett's remark above)
Perhaps the best way to solve the problem is by AbiWords approach,
which is similar to what Pages uses (templates stored in the
Application bundle and user-defined templates in the ~/
LibraryApplication Support/Program_Directory). The difference is that
they use a "list dialogue" instead of a pop-up menu (i.e. you select
your template from a list of available templates and click OK). Since
AbiWord is OpenSource I guess it would be possible to study the code
or ask the developers how this was implemented.
It could be noted that with the current version it is possible to
access the templates using the Apple+Shift+G short-cut and type in
the path to the templates. However this is of-course not a user-
friendly solution...
The next problem with the templates is that once you manage to open
them you get (for some) a "missing TeX-class" error and have to go
through the procedure outlined in http://wiki.lyx.org/pmwiki.php/FAQ/
MacInstall It would make the application much more user-friendly if
the needed .cls-files are copied directly at installation if this is
possible.
/Anders