The Cygwin path fix.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9478 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-01-14 15:53:30 +00:00
parent 4d0cbd59af
commit 7b214dd05e
19 changed files with 276 additions and 19 deletions

View File

@ -1,3 +1,7 @@
2005-01-02 Kayvan A. Sylvan <kayvan@sylvan.com>
* configure.m4: add \cygwin_path_fix_needed to lyrxc.defaults.
2005-01-12 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* reLyX/configure.ac: make sure the prefix is correctly quoted.

View File

@ -174,6 +174,7 @@ if test ! -r "${srcdir}"/chkconfig.ltx ; then
fi
#### Adjust PATH for Win32 (Cygwin)
use_cygwin_path_fix=''
case `uname -s` in
CYGWIN*)
tmpfname="/tmp/x$$.ltx";
@ -188,8 +189,10 @@ case `uname -s` in
echo "configure: cygwin detected; path correction"
srcdir=`cygpath -w "${srcdir}" | tr '\\\\' /`
echo "srcdir=${srcdir}"
use_cygwin_path_fix='true'
else
echo "configure: cygwin detected; path correction is not needed"
use_cygwin_path_fix='false'
fi
;;
esac
@ -659,6 +662,11 @@ $rc_entries
\\font_encoding "$chk_fontenc"
EOF
if [ "x$use_cygwin_path_fix" != "x" ]
then
echo "\\cygwin_path_fix_needed $use_cygwin_path_fix" >> $outfile
fi
######## X FONTS
# create a fonts.dir file to make X fonts available to LyX
echo "checking for TeX fonts"

View File

@ -1,3 +1,14 @@
2005-01-13 Angus Leeming <leeming@lyx.org>
* lyxrc.C (read): use LyXRC::cygwin_path_fix to set the value of
os::cygwin_path_fix.
(write): output LyXRC::cygwin_path_fix as necessary.
2005-01-02 Kayvan Sylvan <kayvan@sylvan.com>
* lyxrc.h:
* lyxrc.C (read): Added RC_CYGWIN_PATH_FIX, cygwin_path_fix.
2005-01-12 Angus Leeming <leeming@lyx.org>
* lyx_main.C (init): set the PATH variable to include the

View File

@ -1,3 +1,16 @@
2005-01-13 Angus Leeming <leeming@lyx.org>
* Makefile.dialogs: add QPrefCygwinPathModule.ui.
* ui/QPrefCygwinPathModule.ui: new file. Defines a pane containing
only a check box "Use Cygwin paths".
* QPrefs.C (apply, update_contents): code to get/set the value
of the Cygwin check box. Compiled only under Cygwin.
* QPrefsDialog.[Ch]: code to add teh Cygwin paths module to the
dialog.
2005-01-10 Angus Leeming <leeming@lyx.org>
* lyx_gui.C: use support/package.h to provide the paths to the

View File

@ -41,6 +41,7 @@ UIFILES = \
QPrefColorsModule.ui \
QPrefConvertersModule.ui \
QPrefCopiersModule.ui \
QPrefCygwinPathModule.ui \
QPrefDateModule.ui \
QPrefDisplayModule.ui \
QPrefFileformatsModule.ui \

View File

@ -23,6 +23,9 @@
#include "ui/QPrefLatexModule.h"
#include "ui/QPrefScreenFontsModule.h"
#include "ui/QPrefColorsModule.h"
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
#include "ui/QPrefCygwinPathModule.h"
#endif
#include "ui/QPrefDisplayModule.h"
#include "ui/QPrefPathsModule.h"
#include "ui/QPrefSpellcheckerModule.h"
@ -185,6 +188,10 @@ void QPrefs::apply()
rc.date_insert_format = fromqstr(datemod->DateED->text());
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
QPrefCygwinPathModule * cygwinmod(dialog_->cygwinpathModule);
rc.cygwin_path_fix = cygwinmod->pathCB->isChecked();
#endif
QPrefLatexModule * latexmod(dialog_->latexModule);
@ -505,6 +512,10 @@ void QPrefs::update_contents()
datemod->DateED->setText(toqstr(rc.date_insert_format));
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
QPrefCygwinPathModule * cygwinmod(dialog_->cygwinpathModule);
cygwinmod->pathCB->setChecked(rc.cygwin_path_fix);
#endif
QPrefLatexModule * latexmod(dialog_->latexModule);

View File

@ -25,6 +25,9 @@
#include "ui/QPrefLatexModule.h"
#include "ui/QPrefScreenFontsModule.h"
#include "ui/QPrefColorsModule.h"
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
#include "ui/QPrefCygwinPathModule.h"
#endif
#include "ui/QPrefDisplayModule.h"
#include "ui/QPrefPathsModule.h"
#include "ui/QPrefSpellcheckerModule.h"
@ -74,6 +77,9 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
latexModule = new QPrefLatexModule(this);
screenfontsModule = new QPrefScreenFontsModule(this);
colorsModule = new QPrefColorsModule(this);
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
cygwinpathModule = new QPrefCygwinPathModule(this);
#endif
displayModule = new QPrefDisplayModule(this);
pathsModule = new QPrefPathsModule(this);
spellcheckerModule = new QPrefSpellcheckerModule(this);
@ -103,6 +109,9 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
prefsPS->addPanel(asciiModule, _("ASCII"), op);
prefsPS->addPanel(dateModule, _("Date format"), op);
prefsPS->addPanel(latexModule, _("LaTeX"), op);
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
prefsPS->addPanel(cygwinpathModule, _("Paths"), op);
#endif
prefsPS->addPanel(printerModule, _("Printer"), op);
prefsPS->addPanel(identityModule, _("Identity"));
@ -222,6 +231,9 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
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__)
connect(cygwinpathModule->pathCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
#endif
connect(latexModule->latexEncodingED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(latexModule->latexChecktexED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(latexModule->latexBibtexED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));

View File

@ -25,6 +25,7 @@ class QPrefKeyboardModule;
class QPrefLatexModule;
class QPrefScreenFontsModule;
class QPrefColorsModule;
class QPrefCygwinPathModule;
class QPrefDisplayModule;
class QPrefPathsModule;
class QPrefSpellcheckerModule;
@ -105,6 +106,9 @@ private:
QPrefLatexModule * latexModule;
QPrefScreenFontsModule * screenfontsModule;
QPrefColorsModule * colorsModule;
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
QPrefCygwinPathModule * cygwinpathModule;
#endif
QPrefDisplayModule * displayModule;
QPrefPathsModule * pathsModule;
QPrefSpellcheckerModule * spellcheckerModule;

View File

@ -0,0 +1,78 @@
<!DOCTYPE UI><UI>
<class>QPrefCygwinPathModule</class>
<include location="global">config.h</include>
<include location="local">qt_helpers.h</include>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>QPrefCygwinPathModule</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<height>91</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Cygwin Paths</string>
</property>
<spacer>
<property>
<name>name</name>
<cstring>Spacer1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>pathCB</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>10</x>
<y>10</y>
<width>260</width>
<height>26</height>
</rect>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Use Cygwin-style paths</string>
</property>
<property>
<name>toolTip</name>
<string></string>
</property>
<property>
<name>whatsThis</name>
<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>
</property>
</widget>
</widget>
</UI>

View File

@ -1,3 +1,11 @@
2005-01-13 Angus Leeming <leeming@lyx.org>
* FormPreferences.C: code to get/set the value
of the Cygwin check box. Compiled only under Cygwin.
* forms/form_preferences.fd: add a Cygwin paths check box to the
Outputs->Misc tab.
2005-01-13 Angus Leeming <leeming@lyx.org>
* FormPreferences.C: use getString, a safe wrapper around fl_get_input.

View File

@ -2072,6 +2072,10 @@ void FormPreferences::OutputsMisc::apply(LyXRC & rc) const
rc.index_command = getString(dialog_->input_index);
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);
#endif
}
@ -2089,6 +2093,11 @@ void FormPreferences::OutputsMisc::build()
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__)
#else
setEnabled(dialog_->check_cygwin_path, false);
#endif
fl_addto_choice(dialog_->choice_default_papersize,
_(" default | US letter | US legal "
"| US executive | A3 | A4 | A5 | B5 ").c_str());
@ -2103,6 +2112,9 @@ void FormPreferences::OutputsMisc::build()
setPrehandler(dialog_->input_index);
setPrehandler(dialog_->input_paperoption);
setPrehandler(dialog_->check_autoreset_classopt);
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
setPrehandler(dialog_->check_cygwin_path);
#endif
}
@ -2127,6 +2139,14 @@ FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
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.");
#endif
return string();
}
@ -2151,7 +2171,9 @@ void FormPreferences::OutputsMisc::update(LyXRC const & rc)
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);
#endif
}

View File

@ -2880,13 +2880,13 @@ argument:
=============== FORM ===============
Name: form_preferences_outputs_misc
Width: 455
Height: 400
Number of Objects: 12
Height: 435
Number of Objects: 13
--------------------
class: FL_BOX
type: FLAT_BOX
box: 0 0 455 400
box: 0 0 455 435
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -2904,7 +2904,7 @@ argument:
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 10 10 435 165
box: 10 15 435 190
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
@ -2980,7 +2980,7 @@ argument: 0
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 10 190 435 200
box: 10 220 435 200
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
@ -2998,7 +2998,7 @@ argument:
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 145 205 285 30
box: 145 235 285 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -3016,7 +3016,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 145 240 285 30
box: 145 270 285 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -3034,7 +3034,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 145 275 285 30
box: 145 305 285 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -3052,12 +3052,12 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 140 30 30
box: 400 140 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Autoreset Class Options on change|#u
shortcut:
@ -3070,7 +3070,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 145 310 285 30
box: 145 340 285 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -3088,7 +3088,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 145 345 285 30
box: 145 375 285 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -3103,5 +3103,23 @@ name: input_index
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 400 170 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Use Cygwin Paths|#s
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_cygwin_path
callback: C_FormDialogView_InputCB
argument: 0
==============================
create_the_forms

View File

@ -33,9 +33,10 @@
#include "graphics/GraphicsTypes.h"
#include "support/convert.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/convert.h"
#include "support/os.h"
#include "support/userinfo.h"
using lyx::support::ascii_lowercase;
@ -45,6 +46,8 @@ using lyx::support::GetEnv;
using lyx::support::LibFileSearch;
using lyx::support::token;
namespace os = lyx::support::os;
using std::cout;
using std::endl;
@ -76,6 +79,7 @@ keyword_item lyxrcTags[] = {
{ "\\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 },
@ -264,8 +268,7 @@ void LyXRC::setDefaults() {
language_command_local = "\\foreignlanguage{$$lang}{";
default_language = "english";
show_banner = true;
//
cygwin_path_fix = false;
date_insert_format = "%A, %e %B %Y";
cursor_follows_scrollbar = false;
dialogs_iconify_with_main = false;
@ -388,6 +391,13 @@ int LyXRC::read(LyXLex & lexrc)
}
break;
case RC_CYGWIN_PATH_FIX:
if (lexrc.next()) {
cygwin_path_fix = lexrc.getBool();
os::cygwin_path_fix(cygwin_path_fix);
}
break;
case RC_KBMAP_PRIMARY:
if (lexrc.next()) {
string const kmap(lexrc.getString());
@ -1296,6 +1306,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
use_kbmap != system_lyxrc.use_kbmap) {
os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
}
case RC_CYGWIN_PATH_FIX:
if (ignore_system_lyxrc ||
cygwin_path_fix != system_lyxrc.cygwin_path_fix) {
os << "\\cygwin_path_fix_needed "
<< convert<string>(cygwin_path_fix) << '\n';
}
case RC_KBMAP_PRIMARY:
if (ignore_system_lyxrc ||
primary_kbmap != system_lyxrc.primary_kbmap) {

View File

@ -133,6 +133,7 @@ enum LyXRCTags {
RC_USER_NAME,
RC_USER_EMAIL,
RC_INDEX_COMMAND,
RC_CYGWIN_PATH_FIX,
RC_LAST
};
@ -374,6 +375,8 @@ public:
std::string user_name;
/// user email
std::string user_email;
///
bool cygwin_path_fix;
};

View File

@ -1,3 +1,14 @@
2005-01-02 Kayvan Sylvan <kayvan@sylvan.com>
* os_win32.C (external_path): Check the new cygwin_path_fix_ bool
before translating external paths to Win32 paths.
2005-01-13 Angus Leeming <leeming@lyx.org>
* os.h, os_os2.C, os_unix.C, os_win32.C (cygwin_path_fix): new
function flagging whether LyX should output native Win32 paths
or cygwin paths. Obviously operative only under Cygwin.
2005-01-13 Angus Leeming <leeming@lyx.org>
* package.C.in: use "%n$s" rather than "%n%" for n=1,2,3... when
@ -39,7 +50,7 @@
* Makefile.am: remove path_defines.{C.in,h}. Add package.{C.in,h}.
* filetools.C[Ch] (GetEnvPath): remove.
* filetools.[Ch] (GetEnvPath): remove.
(getEnvPath): replacement. Returns a vector<string> of paths.
* filetools.C:

View File

@ -60,6 +60,12 @@ char const * popen_read_mode();
*/
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.
*/
void cygwin_path_fix(bool use_cygwin_paths);
} // namespace os
} // namespace support
} // namespace lyx

View File

@ -208,6 +208,10 @@ char path_separator()
return ';';
}
void cygwin_path_fix(bool)
{}
} // namespace os
} // namespace support
} // namespace lyx

View File

@ -87,11 +87,16 @@ shell_type shell()
return UNIX;
}
char path_separator()
{
return ':';
}
void cygwin_path_fix(bool)
{}
} // namespace os
} // namespace support
} // namespace lyx

View File

@ -72,13 +72,22 @@ string::size_type common_path(string const & p1, string const & p2)
}
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
namespace {
bool cygwin_path_fix_ = false;
} // namespace anon
#endif
string external_path(string const & p)
{
string dos_path;
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
// Translate from cygwin path syntax to dos path syntax
if (is_absolute_path(p)) {
if (cygwin_path_fix_ && is_absolute_path(p)) {
char dp[PATH_MAX];
cygwin_conv_to_full_win32_path(p.c_str(), dp);
dos_path = !dp ? "" : dp;
@ -163,6 +172,7 @@ shell_type shell()
#endif
}
char path_separator()
{
#if defined (_WIN32)
@ -172,6 +182,17 @@ char path_separator()
#endif
}
void cygwin_path_fix(bool use_cygwin_paths)
{
#if defined (_WIN32)
// Silence warning.
(void)use_cygwin_paths;
#else // Cygwin
use_cygwin_paths_ = use_cygwin_paths;
#endif
}
} // namespace os
} // namespace support
} // namespace lyx