Am Samstag, 20. Mai 2006 19:32 schrieb Jean-Marc Lasgouttes: > Can't we get rid of 'none', since it is equivalent to empty?
Sure (but for 1.4 I would only remove it from configure.py, not from the reading code). I guess 'none' was only used because comparisons with empty strings can be difficult in some sh versions. What do you think of the attached? Georg
Index: src/format.C =================================================================== --- src/format.C (Revision 13892) +++ src/format.C (Arbeitskopie) @@ -176,7 +176,7 @@ string fixCommand(string const & cmd, st return "auto"; // if configure.py found nothing, clear the command - if (token(cmd, ' ', 0) == "none") + if (token(cmd, ' ', 0) == "auto") return string(); // use the command found by configure.py Index: src/frontends/xforms/FormPreferences.C =================================================================== --- src/frontends/xforms/FormPreferences.C (Revision 13892) +++ src/frontends/xforms/FormPreferences.C (Arbeitskopie) @@ -2930,7 +2930,7 @@ void FormPreferences::SpellOptions::appl rc.isp_command = choice; #if 0 - // If spellchecker == "none", all other input set to off. + // If spellchecker == "", all other input set to off. if (fl_get_choice(dialog_->choice_spell_command) == 1) { rc.isp_use_alt_lang = false; rc.isp_alt_lang.erase(); @@ -3044,7 +3044,7 @@ bool FormPreferences::SpellOptions::inpu // otherwise the function is called by an xforms CB via input(). #if 0 - // If spellchecker == "none", disable all input. + // If spellchecker == "", disable all input. if (!ob || ob == dialog_->choice_spell_command) { if (fl_get_choice(dialog_->choice_spell_command) == 1) { fl_deactivate_object(dialog_->check_alt_lang); @@ -3095,7 +3095,7 @@ void FormPreferences::SpellOptions::upda { int choice = 1; #if 0 - if (rc.isp_command == "none") + if (rc.isp_command == "") choice = 1; else if (rc.isp_command == "ispell") choice = 2; Index: src/lyxrc.C =================================================================== --- src/lyxrc.C (Revision 13892) +++ src/lyxrc.C (Arbeitskopie) @@ -1052,8 +1052,7 @@ int LyXRC::read(LyXLex & lexrc) if (lexrc.next()) { flags = lexrc.getString(); } - if (command.empty() - || token(command, ' ', 0) == "none") { + if (command.empty()) { converters.erase(from, to); } else { converters.add(from, to, command, flags); @@ -2146,7 +2145,7 @@ string const LyXRC::getDescription(LyXRC break; case RC_ASCIIROFF_COMMAND: - str = _("Use to define an external program to render tables in plain text output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"none\" is specified, an internal routine is used."); + str = _("Use to define an external program to render tables in plain text output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"\" is specified, an internal routine is used."); break; case RC_ASCII_LINELEN: Index: lib/doc/Customization.lyx =================================================================== --- lib/doc/Customization.lyx (Revision 13892) +++ lib/doc/Customization.lyx (Arbeitskopie) @@ -1794,6 +1794,25 @@ odify \end_layout \begin_layout Standard +If the operating system has a default viewer associated to a format it is + used instead of the one you can define via the +\family sans +\bar under +T +\bar default +ools\SpecialChar \menuseparator + +\bar under +P +\bar default +references:Conversion +\family default + dialog. + This does currently only work in the Windows® port of LyX, but it is planned + to implement this feature on all other ports that can support it, too. +\end_layout + +\begin_layout Standard Editors are like viewers: Each Format can have an Editor associated to it, and they can be altered via the \family sans Index: lib/configure.py =================================================================== --- lib/configure.py (Revision 13892) +++ lib/configure.py (Arbeitskopie) @@ -111,7 +111,7 @@ def checkCygwinPath(srcdir): ## Searching some useful programs -def checkProg(description, progs, rc_entry = [], path = [] ): +def checkProg(description, progs, rc_entry = [], path = [], not_found = ''): ''' This function will search a program in $PATH plus given path If found, return directory and program name (not the options). @@ -127,16 +127,19 @@ def checkProg(description, progs, rc_ent rc_entry: entry to outfile, can be 1. emtpy: no rc entry will be added 2. one pattern: %% will be replaced by the first found program, - or 'none' is no program is found. - 3. several patterns for each prog and 'none'. This is used + or '' if no program is found. + 3. several patterns for each prog and not_found. This is used when different programs have different usages. If you do not - want 'none' entry to be added to the RC file, you can specify - an entry for each prog and use '' for the 'none' entry. + want not_found entry to be added to the RC file, you can specify + an entry for each prog and use '' for the not_found entry. + + not_found: the value that should be used instead of '' if no program + was found ''' - # one rc entry for each progs plus none entry + # one rc entry for each progs plus not_found entry if len(rc_entry) > 1 and len(rc_entry) != len(progs) + 1: - print "rc entry should have one item or item for each prog and none." + print "rc entry should have one item or item for each prog and not_found." sys.exit(2) print 'checking for ' + description + '...' ## print '(' + ','.join(progs) + ')', @@ -161,8 +164,8 @@ def checkProg(description, progs, rc_ent print ' no' # write rc entries for 'not found' if len(rc_entry) > 0: # the last one. - addToRC(rc_entry[-1].replace('%%', 'none')) - return ['', 'none'] + addToRC(rc_entry[-1].replace('%%', not_found)) + return ['', not_found] def checkLatex(): @@ -171,7 +174,7 @@ def checkLatex(): path, LATEX = checkProg( 'a Latex2e program', ['pplatex $$i', 'latex $$i', 'latex2e $$i'], rc_entry = [ r'\converter latex dvi "%%" "latex"' ] ) # no latex - if LATEX != 'none': + if LATEX != '': # Check if latex is usable writeToFile('chklatex.ltx', ''' \\nonstopmode\\makeatletter @@ -193,20 +196,24 @@ def checkLatex(): def checkFormatEntries(): ''' Check all formats (\Format entries) ''' - checkProg('a Tgif viewer and editor', ['tgif'], - rc_entry = [ r'\Format tgif obj Tgif "" "%%" "%%" ""']) + checkProg('a Tif viewer and editor', ['tgif'], + rc_entry = [r'\Format tgif obj Tgif "" "%%" "%%" ""'], + not_found = 'auto') # checkProg('a FIG viewer and editor', ['xfig'], - rc_entry = [ r'\Format fig fig FIG "" "%%" "%%" ""'] ) + rc_entry = [r'\Format fig fig FIG "" "%%" "%%" ""'], + not_found = 'auto') # checkProg('a Grace viewer and editor', ['xmgrace'], - rc_entry = [ r'\Format agr agr Grace "" "%%" "%%" ""'] ) + rc_entry = [r'\Format agr agr Grace "" "%%" "%%" ""'], + not_found = 'auto') # checkProg('a FEN viewer and editor', ['xboard -lpf $$i -mode EditPosition'], - rc_entry = [ r'\Format fen fen FEN "" "%%" "%%" ""' ]) + rc_entry = [r'\Format fen fen FEN "" "%%" "%%" ""'], + not_found = 'auto') # - path, iv = checkProg('a raster image viewer', ['xv', 'kview', 'gimp']) - path, ie = checkProg('a raster image editor', ['gimp']) + path, iv = checkProg('a raster image viewer', ['xv', 'kview', 'gimp'], not_found = 'auto') + path, ie = checkProg('a raster image editor', ['gimp'], not_found = 'auto') addToRC(r'''\Format bmp bmp BMP "" "%s" "%s" "" \Format gif gif GIF "" "%s" "%s" "" \Format jpg jpg JPEG "" "%s" "%s" "" @@ -221,7 +228,7 @@ def checkFormatEntries(): # checkProg('a text editor', ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate', \ 'nedit', 'gedit', 'notepad'], - rc_entry = [ r'''\Format asciichess asc "Plain text (chess output)" "" "" "%%" "" + rc_entry = [r'''\Format asciichess asc "Plain text (chess output)" "" "" "%%" "" \Format asciiimage asc "Plain text (image)" "" "" "%%" "" \Format asciixfig asc "Plain text (Xfig output)" "" "" "%%" "" \Format dateout tmp "date (output)" "" "" "%%" "" @@ -232,25 +239,30 @@ def checkFormatEntries(): \Format linuxdoc sgml LinuxDoc x "" "%%" "document" \Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document" \Format text txt "Plain text" a "" "%%" "document" -\Format textparagraph txt "Plain text (paragraphs)" "" "" "%%" "document"''' ]) +\Format textparagraph txt "Plain text (paragraphs)" "" "" "%%" "document"''' ], + not_found = 'auto') # #checkProg('a Postscript interpreter', ['gs'], # rc_entry = [ r'\ps_command "%%"' ]) checkProg('a Postscript previewer', ['gv', 'ghostview -swap', 'kghostview'], - rc_entry = [ r'''\Format eps eps EPS "" "%%" "" "" -\Format ps ps Postscript t "%%" "" "document"''' ]) + rc_entry = [r'''\Format eps eps EPS "" "%%" "" "" +\Format ps ps Postscript t "%%" "" "document"'''], + not_found = 'auto') # checkProg('a PDF previewer', ['acrobat', 'acroread', 'gv', 'ghostview', \ 'xpdf', 'kpdf', 'kghostview'], - rc_entry = [ r'''\Format pdf pdf "PDF (ps2pdf)" P "%%" "" "document" + rc_entry = [r'''\Format pdf pdf "PDF (ps2pdf)" P "%%" "" "document" \Format pdf2 pdf "PDF (pdflatex)" F "%%" "" "document" -\Format pdf3 pdf "PDF (dvipdfm)" m "%%" "" "document"''' ]) +\Format pdf3 pdf "PDF (dvipdfm)" m "%%" "" "document"'''], + not_found = 'auto') # checkProg('a DVI previewer', ['xdvi', 'kdvi'], - rc_entry = [ r'\Format dvi dvi DVI D "%%" "" "document"' ]) + rc_entry = [r'\Format dvi dvi DVI D "%%" "" "document"'], + not_found = 'auto') # checkProg('a HTML previewer', ['mozilla file://$$p$$i', 'netscape'], - rc_entry = [ r'\Format html html HTML H "%%" "" "document"' ]) + rc_entry = [r'\Format html html HTML H "%%" "" "document"'], + not_found = 'auto') # # entried that do not need checkProg addToRC(r'''\Format date "" "date command" "" "" "" "" @@ -381,11 +393,11 @@ def checkLinuxDoc(): \converter linuxdoc latex "sgml2latex $$i" "" \converter linuxdoc dvi "sgml2latex -o dvi $$i" "" \converter linuxdoc html "sgml2html $$i" ""''', - r'''\converter linuxdoc lyx "none" "" -\converter linuxdoc latex "none" "" -\converter linuxdoc dvi "none" "" -\converter linuxdoc html "none" ""''' ]) - if LINUXDOC != 'none': + r'''\converter linuxdoc lyx "" "" +\converter linuxdoc latex "" "" +\converter linuxdoc dvi "" "" +\converter linuxdoc html "" ""''' ]) + if LINUXDOC != '': return ('yes', 'true', '\\def\\haslinuxdoc{yes}') else: return ('no', 'false', '') @@ -399,10 +411,10 @@ def checkDocBook(): \converter docbook html "sgmltools -b html $$i" ""''', r'''\converter docbook dvi "db2dvi $$i" "" \converter docbook html "db2html $$i" ""''', - r'''\converter docbook dvi "none" "" -\converter docbook html "none" ""''']) + r'''\converter docbook dvi "" "" +\converter docbook html "" ""''']) # - if DOCBOOK != 'none': + if DOCBOOK != '': return ('yes', 'true', '\\def\\hasdocbook{yes}') else: return ('no', 'false', '') @@ -414,7 +426,7 @@ def checkOtherEntries(): rc_entry = [ r'\ascii_roff_command "groff -t -Tlatin1 $$FName"', r'\ascii_roff_command "tbl $$FName | nroff"', - r'\ascii_roff_command "none"' ]) + r'\ascii_roff_command ""' ]) checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'], rc_entry = [ r'\chktex_command "%%"' ]) checkProg('a spellchecker', ['ispell'],