Enrico Forestieri wrote:
No, this is not acceptable because you are changing the behaviour on
the other systems (currently only cygwin and OSX).

So the Windows file associations are also used on Cygwin? I added that to the attached patch.

I think we don't have auto-detection for Mac OS X. Or am I overlooking something?

Moreover, I think that configure.py should still try to find some
suitable application for a given task, such that, when no defaults
are set in the OS, the ones find by the lookup can be used.

It has been decided that the OS settings will be used for viewers. It is not the task of LyX to detect specific ones.

Joost
Index: lib/configure.py
===================================================================
--- lib/configure.py    (revision 15338)
+++ lib/configure.py    (working copy)
@@ -176,7 +176,14 @@
 
 def checkViewer(description, progs, rc_entry = [], path = []):
     ''' The same as checkProg, but for viewers and editors '''
-    return checkProg(description, progs, rc_entry, path, not_found = 'auto')
+    if (os.name == 'nt' or sys.platform == 'cygwin'):
+        # We don't need to detect viewers on Windows, let auto detection 
handle it
+        if len(rc_entry) > 0:  # the last one.
+            addToRC(rc_entry[-1].replace('%%', 'auto'))
+        return ['', 'auto']
+    else:
+        # Detect viewers for UNIX
+        return checkProg(description, progs, rc_entry, path, not_found = 
'auto')
 
 
 def checkLatex():
@@ -242,7 +249,7 @@
         (iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, 
ie, iv, ie) )
     #
     checkViewer('a text editor', ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate', 
\
-        'nedit', 'gedit', 'notepad'],
+        'nedit', 'gedit'],
         rc_entry = [r'''\Format asciichess asc    "Plain text (chess output)"  
"" ""   "%%"
 \Format asciiimage asc    "Plain text (image)"         "" ""   "%%"
 \Format asciixfig  asc    "Plain text (Xfig output)"   "" ""   "%%"
@@ -263,9 +270,16 @@
         rc_entry = [r'''\Format eps        eps     EPS                    "" 
"%%"      ""
 \Format ps         ps      Postscript             t  "%%"      ""'''])
     #
-    checkViewer('a PDF previewer', ['acrobat', 'acroread', 'gv', 'ghostview', \
-                            'xpdf', 'kpdf', 'kghostview'],
-        rc_entry = [r'''\Format pdf        pdf    "PDF (ps2pdf)"          P  
"%%"      ""
+    if ((os.name == 'nt' or sys.platform == 'cygwin') and checkProg('PDF 
viewer', ['pdfview']) != ['', '']):
+        # Windows only: Windows only: PDF viewer with auto-detection and a 
solution for file locking
+        addToRC(r'''\Format pdf        pdf    "PDF (ps2pdf)"          P  
"pdfview"     ""
+\Format pdf2       pdf    "PDF (pdflatex)"        F  "pdfview" ""
+\Format pdf3       pdf    "PDF (dvipdfm)"         m  "pdfview" ""''')
+    else:
+        #
+        checkViewer('a PDF previewer', ['acrobat', 'acroread', 'gv', 
'ghostview', \
+            'xpdf', 'kpdf', 'kghostview'],
+            rc_entry = [r'''\Format pdf        pdf    "PDF (ps2pdf)"          
P  "%%"  ""
 \Format pdf2       pdf    "PDF (pdflatex)"        F  "%%"      ""
 \Format pdf3       pdf    "PDF (dvipdfm)"         m  "%%"      ""'''])
     #
Index: src/format.C
===================================================================
--- src/format.C        (revision 15338)
+++ src/format.C        (working copy)
@@ -168,14 +168,17 @@
        if (cmd.empty() || cmd == "none")
                return string();
 
-       // Does the OS manage this format?
-       if (os::canAutoOpenFile(ext, mode))
-               return "auto";
+       // if configure.py found nothing, let the OS manage it
+       if (token(cmd, ' ', 0) == "auto") {
+               if (os::canAutoOpenFile(ext, mode)) {
+                       // the OS has a viewer
+                       return "auto";
+               } else {
+                       // we don't have a viewer
+                       return string();
+               }
+       }
 
-       // if configure.py found nothing, clear the command
-       if (token(cmd, ' ', 0) == "auto")
-               return string();
-
        // use the command found by configure.py
        return cmd;
 }

Reply via email to