sys.exit(1)
-def checkCygwinPath(srcdir):
- ''' Adjust PATH for Win32 (Cygwin) '''
- cygwin_path_fix = ''
- if os.name == 'nt':
- cygwin_path_fix = 'true'
- elif sys.platform == 'cygwin':
+def checkTeXPaths():
+ ''' Determine the path-style needed by the TeX engine on Win32 (Cygwin) '''
+ windows_style_tex_paths = ''
+ if os.name == 'nt' or sys.platform == 'cygwin':
from tempfile import mkstemp
- fd, tmpfname = mkstemp(suffix='.ltx', dir='/tmp')
+ fd, tmpfname = mkstemp(suffix='.ltx')
+ # a wrapper file
+ wfd, wtmpfname = mkstemp(suffix='.ltx')
+ if os.name == 'nt':
+ inpname = tmpfname.replace('\\', '/')
+ wtmpfname = wtmpfname.replace('\\', '/')
+ else:
+ inpname = cmdOutput('cygpath -m ' + tmpfname)
+ wtmpfname = cmdOutput('cygpath -m ' + wtmpfname)
os.write(fd, r'''
\documentstyle{article}
\begin{document}\end{document}
''')
os.close(fd)
- inpname = cmdOutput('cygpath -m ' + tmpfname)
- # a wrapper file
- wfd, wtmpfname = mkstemp(suffix='.ltx', dir='/tmp')
- wtmpfname = cmdOutput('cygpath -m ' + wtmpfname)
- os.write(wfd, r'\input{' + inpname + '}' )
+ os.write(wfd, r'\input{' + inpname.replace('~', '\\string~') + '}' )
os.close(wfd)
if cmdOutput('latex ' + wtmpfname).find('Error') != -1:
- print "configure: cygwin detected; path correction is not needed"
- cygwin_path_fix = 'false'
+ print "configure: TeX engine needs posix-style paths in latex files"
+ windows_style_tex_paths = 'false'
else:
- print "configure: cygwin detected; path correction"
- srcdir = cmdOutput('cygpath -m ' + srcdir)
- print "srcdir = ", srcdir
- cygwin_path_fix = 'true'
+ print "configure: TeX engine needs windows-style paths in latex files"
+ windows_style_tex_paths = 'true'
tmpbname,ext = os.path.splitext(os.path.basename(tmpfname))
wtmpbname,ext = os.path.splitext(os.path.basename(wtmpfname))
removeFiles( [ tmpfname, wtmpfname, tmpbname + '.log', \
tmpbname + '.aux', wtmpbname + '.log', wtmpbname + '.aux' ] )
- return cygwin_path_fix
+ return windows_style_tex_paths
## Searching some useful programs
sys.exit(1)
setEnviron()
createDirectories()
- cygwin_path_fix = checkCygwinPath(srcdir)
+ windows_style_tex_paths = checkTeXPaths()
## Write the first part of outfile
writeToFile(outfile, '''# This file has been automatically generated by LyX' lib/configure.py
# script. It contains default settings that have been determined by
(chk_linuxdoc, bool_linuxdoc, linuxdoc_cmd) = checkLinuxDoc()
(chk_docbook, bool_docbook, docbook_cmd) = checkDocBook()
checkTeXAllowSpaces()
+ if windows_style_tex_paths != '':
+ addToRC(r'\tex_expects_windows_paths %s' % windows_style_tex_paths)
checkOtherEntries()
- if cygwin_path_fix != '':
- addToRC(r'\cygwin_path_fix_needed %s' % cygwin_path_fix)
# --without-latex-config can disable lyx_check_config
checkLatexConfig( lyx_check_config and LATEX != '', bool_docbook, bool_linuxdoc)
createLaTeXConfig()
src/frontends/controllers/ControlAboutlyx.C
src/frontends/controllers/ControlBibtex.C
src/frontends/controllers/ControlBox.C
+src/frontends/controllers/ControlDocument.C
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlGraphics.C
src/frontends/controllers/ControlInclude.C
src/frontends/qt4/BulletsModule.C
src/frontends/qt4/Dialogs.C
src/frontends/qt4/FileDialog.C
+src/frontends/qt4/GuiView.C
src/frontends/qt4/QAbout.C
src/frontends/qt4/QBibitem.C
src/frontends/qt4/QBibtex.C
src/frontends/qt4/QVSpace.C
src/frontends/qt4/QWrap.C
src/frontends/qt4/Qt2BC.h
-src/frontends/qt4/QtView.C
src/frontends/qt4/floatplacement.C
src/frontends/qt4/validators.C
src/frontends/xforms/Alert_pimpl.C
src/support/filefilterlist.C
src/support/package.C.in
src/support/userinfo.C
+src/tex-strings.C
src/text.C
src/text2.C
src/text3.C
#include "ui/QPrefLatexModule.h"
#include "ui/QPrefScreenFontsModule.h"
#include "ui/QPrefColorsModule.h"
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
#include "ui/QPrefCygwinPathModule.h"
#endif
#include "ui/QPrefDisplayModule.h"
rc.date_insert_format = fromqstr(datemod->DateED->text());
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
QPrefCygwinPathModule * cygwinmod(dialog_->cygwinpathModule);
- rc.cygwin_path_fix = !cygwinmod->pathCB->isChecked();
+ rc.windows_style_tex_paths = cygwinmod->pathCB->isChecked();
#endif
QPrefLatexModule * latexmod(dialog_->latexModule);
datemod->DateED->setText(toqstr(rc.date_insert_format));
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
QPrefCygwinPathModule * cygwinmod(dialog_->cygwinpathModule);
- cygwinmod->pathCB->setChecked(!rc.cygwin_path_fix);
+ cygwinmod->pathCB->setChecked(rc.windows_style_tex_paths);
#endif
QPrefLatexModule * latexmod(dialog_->latexModule);
#include "ui/QPrefLatexModule.h"
#include "ui/QPrefScreenFontsModule.h"
#include "ui/QPrefColorsModule.h"
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
#include "ui/QPrefCygwinPathModule.h"
#endif
#include "ui/QPrefDisplayModule.h"
latexModule = new QPrefLatexModule(this);
screenfontsModule = new QPrefScreenFontsModule(this);
colorsModule = new QPrefColorsModule(this);
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
cygwinpathModule = new QPrefCygwinPathModule(this);
#endif
displayModule = new QPrefDisplayModule(this);
prefsPS->addPanel(asciiModule, _("Plain text"), op);
prefsPS->addPanel(dateModule, _("Date format"), op);
prefsPS->addPanel(latexModule, _("LaTeX"), op);
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
prefsPS->addPanel(cygwinpathModule, _("Paths"), op);
#endif
prefsPS->addPanel(printerModule, _("Printer"), op);
connect(asciiModule->asciiLinelengthSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
connect(asciiModule->asciiRoffED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(dateModule->DateED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
connect(cygwinpathModule->pathCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
#endif
connect(latexModule->latexEncodingED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
QPrefLatexModule * latexModule;
QPrefScreenFontsModule * screenfontsModule;
QPrefColorsModule * colorsModule;
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
QPrefCygwinPathModule * cygwinpathModule;
#endif
QPrefDisplayModule * displayModule;
</rect>
</property>
<property name="text">
- <string>&Use Cygwin-style paths</string>
+ <string>&Use Windows-style paths in LaTeX files</string>
</property>
<property name="toolTip" stdset="0">
<string></string>
</property>
<property name="whatsThis" stdset="0">
- <string>Select if LyX should output Cygwin-style paths rather than Windows-style paths. Useful if you're using the Cygwin teTeX rather than a native Windows MikTeX. Note, however, that you'll need to write shell script wrappers for all your converters.</string>
+ <string>Select if LyX should output Windows-style paths rather than Posix-style paths to LaTeX files. Useful if you're using the native Windows MikTeX rather than the Cygwin teTeX.</string>
</property>
</widget>
<spacer>
void PrefCygwinPath::apply(LyXRC & rc) const
{
- rc.cygwin_path_fix = pathCB->isChecked();
+ rc.windows_style_tex_paths = pathCB->isChecked();
}
void PrefCygwinPath::update(LyXRC const & rc)
{
- pathCB->setChecked(rc.cygwin_path_fix);
+ pathCB->setChecked(rc.windows_style_tex_paths);
}
add(new PrefScreenFonts(form_));
add(new PrefColors(form_));
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
add(new PrefCygwinPath);
#endif
<string/>
</property>
<property name="whatsThis" >
- <string>Select if LyX should output Cygwin-style paths rather than Windows-style paths. Useful if you're using the Cygwin teTeX rather than a native Windows MikTeX. Note, however, that you'll need to write shell script wrappers for all your converters.</string>
+ <string>Select if LyX should output Windows-style paths rather than Posix-style paths to LaTeX files. Useful if you're using the native Windows MikTeX rather than the Cygwin teTeX.</string>
</property>
<property name="text" >
- <string>&Use Cygwin-style paths</string>
+ <string>&Use Windows-style paths in LaTeX files</string>
</property>
</widget>
</widget>
rc.view_dvi_paper_option = getString(dialog_->input_paperoption);
rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
- rc.cygwin_path_fix = fl_get_button(dialog_->check_cygwin_path);
+#if defined(__CYGWIN__) || defined(_WIN32)
+ rc.windows_style_tex_paths =
+ fl_get_button(dialog_->check_windows_style_tex_paths);
#endif
}
fl_set_input_return(dialog_->input_index, FL_RETURN_CHANGED);
fl_set_input_return(dialog_->input_paperoption, FL_RETURN_CHANGED);
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#if defined(__CYGWIN__) || defined(_WIN32)
#else
- setEnabled(dialog_->check_cygwin_path, false);
+ setEnabled(dialog_->check_windows_style_tex_paths, false);
#endif
fl_addto_choice(dialog_->choice_default_papersize,
setPrehandler(dialog_->input_index);
setPrehandler(dialog_->input_paperoption);
setPrehandler(dialog_->check_autoreset_classopt);
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
- setPrehandler(dialog_->check_cygwin_path);
+#if defined(__CYGWIN__) || defined(_WIN32)
+ setPrehandler(dialog_->check_windows_style_tex_paths);
#endif
}
return LyXRC::getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION);
if (ob == dialog_->check_autoreset_classopt)
return LyXRC::getDescription(LyXRC::RC_AUTORESET_OPTIONS);
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
- if (ob == dialog_->check_cygwin_path)
- return _("Select if LyX should output Cygwin-style paths "
- "rather than Windows-style paths. Useful if you're "
- "using the Cygwin teTeX rather than a native Windows "
- "MikTeX. Note, however, that you'll need to write "
- "shell script wrappers for all your converters.");
+#if defined(__CYGWIN__) || defined(_WIN32)
+ if (ob == dialog_->check_windows_style_tex_paths)
+ return _("Select if LyX should output Windows-style paths "
+ "rather than Posix-style paths to LaTeX files. "
+ "Useful if you're using the native Windows MikTeX "
+ "rather than the Cygwin teTeX.");
#endif
return string();
}
rc.view_dvi_paper_option.c_str());
fl_set_button(dialog_->check_autoreset_classopt,
rc.auto_reset_options);
-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
- fl_set_button(dialog_->check_cygwin_path, rc.cygwin_path_fix);
+#if defined(__CYGWIN__) || defined(_WIN32)
+ fl_set_button(dialog_->check_windows_style_tex_paths,
+ rc.windows_style_tex_paths);
#endif
}
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Use Cygwin Paths|#s
+label: Use Windows Paths for LaTeX|#s
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: check_cygwin_path
+name: check_windows_style_tex_paths
callback: C_FormDialogView_InputCB
argument: 0
if (lyxerr.debugging(Debug::LYXRC))
lyxrc.print();
- os::cygwin_path_fix(lyxrc.cygwin_path_fix);
+ os::windows_style_tex_paths(lyxrc.windows_style_tex_paths);
if (!lyxrc.path_prefix.empty())
prependEnvPath("PATH", lyxrc.path_prefix);
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
case LyXRC::RC_CUSTOM_EXPORT_COMMAND:
case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
- case LyXRC::RC_CYGWIN_PATH_FIX:
- if (lyxrc_orig.cygwin_path_fix != lyxrc_new.cygwin_path_fix) {
- namespace os = lyx::support::os;
- os::cygwin_path_fix(lyxrc_new.cygwin_path_fix);
- }
case LyXRC::RC_DATE_INSERT_FORMAT:
case LyXRC::RC_DEFAULT_LANGUAGE:
case LyXRC::RC_DEFAULT_PAPERSIZE:
case LyXRC::RC_TEMPDIRPATH:
case LyXRC::RC_TEMPLATEPATH:
case LyXRC::RC_TEX_ALLOWS_SPACES:
+ case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
+ if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
+ namespace os = lyx::support::os;
+ os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
+ }
case LyXRC::RC_UIFILE:
case LyXRC::RC_USER_EMAIL:
case LyXRC::RC_USER_NAME:
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
{ "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
{ "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
- { "\\cygwin_path_fix_needed", LyXRC::RC_CYGWIN_PATH_FIX },
{ "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
{ "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
{ "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
{ "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
{ "\\template_path", LyXRC::RC_TEMPLATEPATH },
{ "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
+ { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
{ "\\ui_file", LyXRC::RC_UIFILE },
{ "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
{ "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
language_command_local = "\\foreignlanguage{$$lang}{";
default_language = "english";
show_banner = true;
- cygwin_path_fix = false;
+ windows_style_tex_paths = false;
tex_allows_spaces = false;
date_insert_format = "%A, %e %B %Y";
cursor_follows_scrollbar = false;
}
break;
- case RC_CYGWIN_PATH_FIX:
+ case RC_TEX_EXPECTS_WINDOWS_PATHS:
if (lexrc.next()) {
- cygwin_path_fix = lexrc.getBool();
+ windows_style_tex_paths = lexrc.getBool();
}
break;
index_command != system_lyxrc.index_command) {
os << "\\index_command \"" << index_command << "\"\n";
}
- case RC_CYGWIN_PATH_FIX:
+ case RC_TEX_EXPECTS_WINDOWS_PATHS:
if (ignore_system_lyxrc ||
- cygwin_path_fix != system_lyxrc.cygwin_path_fix) {
- os << "\\cygwin_path_fix_needed "
- << convert<string>(cygwin_path_fix) << '\n';
+ windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
+ os << "\\tex_expects_windows_paths "
+ << convert<string>(windows_style_tex_paths) << '\n';
}
case RC_TEX_ALLOWS_SPACES:
if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
case RC_CUSTOM_EXPORT_FORMAT:
break;
- case RC_CYGWIN_PATH_FIX:
- break;
-
case RC_DATE_INSERT_FORMAT:
//xgettext:no-c-format
str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
case RC_TEX_ALLOWS_SPACES:
break;
+ case RC_TEX_EXPECTS_WINDOWS_PATHS:
+ break;
+
case RC_UIFILE:
str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
break;
RC_CURSOR_FOLLOWS_SCROLLBAR,
RC_CUSTOM_EXPORT_COMMAND,
RC_CUSTOM_EXPORT_FORMAT,
- RC_CYGWIN_PATH_FIX,
RC_DATE_INSERT_FORMAT,
RC_DEFAULT_LANGUAGE,
RC_DEFAULT_PAPERSIZE,
RC_TEMPDIRPATH,
RC_TEMPLATEPATH,
RC_TEX_ALLOWS_SPACES,
+ RC_TEX_EXPECTS_WINDOWS_PATHS,
RC_UIFILE,
RC_USER_EMAIL,
RC_USER_NAME,
std::string user_name;
/// user email
std::string user_email;
- ///
- bool cygwin_path_fix;
+ /// True if the TeX engine cannot handle posix paths
+ bool windows_style_tex_paths;
/// True if the TeX engine can handle file names containing spaces
bool tex_allows_spaces;
/** Prepend paths to the PATH environment variable.
*/
char path_separator();
-/** If @c use_cygwin_paths is true, LyX will output cygwin style paths
- * rather than native Win32 ones. Obviously, this option is used only
- * under Cygwin.
+/** If @c use_windows_paths is true, LyX will output Windows-style paths to
+ * latex files rather than posix ones. Obviously, this option is used only
+ * under Windows.
*/
-void cygwin_path_fix(bool use_cygwin_paths);
+void windows_style_tex_paths(bool use_windows_paths);
enum auto_open_mode {
VIEW,
namespace {
-bool cygwin_path_fix_ = false;
+bool windows_style_tex_paths_ = false;
// In both is_posix_path() and is_windows_path() it is assumed that
// a valid posix or pseudo-windows path is passed. They simply tell
string external_path(string const & p)
{
- return convert_path(p, cygwin_path_fix_ ? PathStyle(windows)
- : PathStyle(posix));
+ return convert_path(p, PathStyle(windows));
}
string external_path_list(string const & p)
{
- return convert_path_list(p, cygwin_path_fix_ ? PathStyle(windows)
- : PathStyle(posix));
+ return convert_path_list(p, PathStyle(windows));
}
string latex_path(string const & p)
{
// We may need a posix style path or a windows style path (depending
- // on cygwin_path_fix_), but we use always forward slashes, since it
- // gets written into a .tex file.
+ // on windows_style_tex_paths_), but we use always forward slashes,
+ // since it gets written into a .tex file.
- if (cygwin_path_fix_ && is_absolute_path(p)) {
+ if (windows_style_tex_paths_ && is_absolute_path(p)) {
string dos_path = convert_path(p, PathStyle(windows));
lyxerr[Debug::LATEX]
- << "<Cygwin path correction> ["
+ << "<Path correction for LaTeX> ["
<< p << "]->>["
<< dos_path << ']' << endl;
return dos_path;
}
-void cygwin_path_fix(bool use_cygwin_paths)
+void windows_style_tex_paths(bool use_windows_paths)
{
- cygwin_path_fix_ = use_cygwin_paths;
+ windows_style_tex_paths_ = use_windows_paths;
}
{
// reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc
// /platform/shell/reference/functions/shellexecute.asp
- string const win_path =
- os::convert_path(filename, os::PathStyle(os::windows));
+ string const win_path = convert_path(filename, PathStyle(windows));
char const * action = (mode == VIEW) ? "open" : "edit";
return reinterpret_cast<int>(ShellExecute(NULL, action,
win_path.c_str(), NULL, NULL, 1)) > 32;
}
-void cygwin_path_fix(bool)
+void windows_style_tex_paths(bool)
{}
bool canAutoOpenFile(string const & ext, auto_open_mode const mode)
namespace {
-bool cygwin_path_fix_ = false;
+bool windows_style_tex_paths_ = true;
string cygdrive = "/cygdrive";
string latex_path(string const & p)
{
// We may need a posix style path or a windows style path (depending
- // on cygwin_path_fix_), but we use always forward slashes, since it
- // gets written into a .tex file.
+ // on windows_style_tex_paths_), but we use always forward slashes,
+ // since it gets written into a .tex file.
- if (cygwin_path_fix_ && is_absolute_path(p)) {
+ if (!windows_style_tex_paths_ && is_absolute_path(p)) {
string const drive = p.substr(0, 2);
string const cygprefix = cygdrive + "/" + drive.substr(0, 1);
string const cygpath = subst(subst(p, '\\', '/'), drive, cygprefix);
lyxerr[Debug::LATEX]
- << "<Cygwin path correction> ["
+ << "<Path correction for LaTeX> ["
<< p << "]->>["
<< cygpath << ']' << endl;
return cygpath;
}
-void cygwin_path_fix(bool use_cygwin_paths)
+void windows_style_tex_paths(bool use_windows_paths)
{
- cygwin_path_fix_ = !use_cygwin_paths;
+ windows_style_tex_paths_ = use_windows_paths;
}