mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-20 23:00:29 +00:00
Check that the file path returned from the file browser will make
sense to LaTeX only if the path will be passed to the LaTeX compiler. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9967 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
68a3856dc0
commit
01bf55b4db
@ -1,3 +1,21 @@
|
|||||||
|
2005-05-23 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* helper_funcs.[Ch] (browseFile, browseRelFile, browseDir): add
|
||||||
|
a boolean argument to denote whether the functions should check
|
||||||
|
the returned path name for spaces. (If the parent document is
|
||||||
|
a LaTeX file and if the latex compiler cannot handle such paths.)
|
||||||
|
|
||||||
|
* ControlBibtex.C (Browse):
|
||||||
|
* ControlExternal.C (Browse):
|
||||||
|
* ControlGraphics.C (Browse):
|
||||||
|
* ControlInclude.C (Browse): check whether the returned path
|
||||||
|
contains spaces and whether LaTeX can handle such a path.
|
||||||
|
|
||||||
|
* ControlPrefs.C (browsebind, browseUI, browsekbmap, browsedict)
|
||||||
|
(browse, browsedir):
|
||||||
|
* ControlPrint.C (Browse): do not check whether the returned
|
||||||
|
path contains spaces.
|
||||||
|
|
||||||
2005-05-18 Angus Leeming <leeming@lyx.org>
|
2005-05-18 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* helper_funcs.C (get_invalid_chars_latex, printable_list): new
|
* helper_funcs.C (get_invalid_chars_latex, printable_list): new
|
||||||
@ -52,16 +70,16 @@
|
|||||||
|
|
||||||
2004-04-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
2004-04-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
* ControlMath.C (find_xpm):
|
* ControlMath.C (find_xpm):
|
||||||
* ControlBibtex.C (applyParamsToInset):
|
* ControlBibtex.C (applyParamsToInset):
|
||||||
* ControlBibitem.C (applyParamsToInset): fix #warning directives
|
* ControlBibitem.C (applyParamsToInset): fix #warning directives
|
||||||
|
|
||||||
* ControlDialog.tmpl (show, update, hide): gcc 3.4 compilation fix
|
* ControlDialog.tmpl (show, update, hide): gcc 3.4 compilation fix
|
||||||
|
|
||||||
2003-02-10 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
2003-02-10 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
* ControlInclude.C (Browse): replace masterFilename_ with
|
* ControlInclude.C (Browse): replace masterFilename_ with
|
||||||
parentFilename_.
|
parentFilename_.
|
||||||
|
|
||||||
2003-06-06 John Levon <levon@movementarian.org>
|
2003-06-06 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
@ -80,7 +98,7 @@
|
|||||||
2003-02-17 John Levon <levon@movementarian.org>
|
2003-02-17 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* ControlDialog.tmpl: do build before setParams for
|
* ControlDialog.tmpl: do build before setParams for
|
||||||
spellchecker's sake
|
spellchecker's sake
|
||||||
|
|
||||||
* ControlSpellchecker.h:
|
* ControlSpellchecker.h:
|
||||||
* ControlSpellchecker.C: rework
|
* ControlSpellchecker.C: rework
|
||||||
@ -103,7 +121,7 @@
|
|||||||
2003-01-11 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
2003-01-11 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* helper_funcs.[Ch]: implement browseDir (browse directory) [bug 824]
|
* helper_funcs.[Ch]: implement browseDir (browse directory) [bug 824]
|
||||||
|
|
||||||
* ControlPrefs.[Ch]: implement browsedir for the use of use browseDir.
|
* ControlPrefs.[Ch]: implement browsedir for the use of use browseDir.
|
||||||
|
|
||||||
2002-12-02 Lars Gullik Bjønnes <larsbj@gullik.net>
|
2002-12-02 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||||
|
@ -60,7 +60,7 @@ string const ControlBibtex::Browse(string const & in_name,
|
|||||||
{
|
{
|
||||||
pair<string, string> dir1(_("Documents|#o#O"),
|
pair<string, string> dir1(_("Documents|#o#O"),
|
||||||
string(lyxrc.document_path));
|
string(lyxrc.document_path));
|
||||||
return browseRelFile(&lv_, in_name, buffer()->filePath(),
|
return browseRelFile(&lv_, true, in_name, buffer()->filePath(),
|
||||||
title, pattern, false, dir1);
|
title, pattern, false, dir1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,5 +150,5 @@ string const ControlExternal::Browse(string const & input) const
|
|||||||
std::pair<string, string> dir1(N_("Documents|#o#O"),
|
std::pair<string, string> dir1(N_("Documents|#o#O"),
|
||||||
string(lyxrc.document_path));
|
string(lyxrc.document_path));
|
||||||
|
|
||||||
return browseRelFile(&lv_, input, bufpath, title, pattern, false, dir1);
|
return browseRelFile(&lv_, true, input, bufpath, title, pattern, false, dir1);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ string const ControlGraphics::Browse(string const & in_name)
|
|||||||
pair<string, string> dir1(_("Clipart|#C#c"), clipdir);
|
pair<string, string> dir1(_("Clipart|#C#c"), clipdir);
|
||||||
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
|
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
|
||||||
// Show the file browser dialog
|
// Show the file browser dialog
|
||||||
return browseRelFile(&lv_, in_name, buffer()->filePath(),
|
return browseRelFile(&lv_, true, in_name, buffer()->filePath(),
|
||||||
title, "*.*", false, dir1, dir2);
|
title, "*.*", false, dir1, dir2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ string const ControlInclude::Browse(string const & in_name, Type in_type)
|
|||||||
|
|
||||||
string const docpath = OnlyPath(params().parentFilename_);
|
string const docpath = OnlyPath(params().parentFilename_);
|
||||||
|
|
||||||
return browseRelFile(&lv_, in_name, docpath, title, pattern, false, dir1);
|
return browseRelFile(&lv_, true, in_name, docpath, title, pattern, false, dir1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ string const ControlPrefs::browsebind(string const & file)
|
|||||||
name = _("User Bind|#U#u");
|
name = _("User Bind|#U#u");
|
||||||
pair<string,string> dir2(name, dir);
|
pair<string,string> dir2(name, dir);
|
||||||
|
|
||||||
return browseFile(&lv_, file, _("Choose bind file"), "*.bind", false, dir1, dir2);
|
return browseFile(&lv_, false, file, _("Choose bind file"), "*.bind", false, dir1, dir2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ string const ControlPrefs::browseUI(string const & file)
|
|||||||
name = _("User UI|#U#u");
|
name = _("User UI|#U#u");
|
||||||
pair<string,string> dir2(name, dir);
|
pair<string,string> dir2(name, dir);
|
||||||
|
|
||||||
return browseFile(&lv_, file, _("Choose UI file"), "*.ui", false, dir1, dir2);
|
return browseFile(&lv_, false, file, _("Choose UI file"), "*.ui", false, dir1, dir2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,25 +93,25 @@ string const ControlPrefs::browsekbmap(string const & file)
|
|||||||
string const name = _("Key maps|#K#k");
|
string const name = _("Key maps|#K#k");
|
||||||
pair<string, string> dir1(name, dir);
|
pair<string, string> dir1(name, dir);
|
||||||
|
|
||||||
return browseFile(&lv_, file, _("Choose keyboard map"), "*.kmap", false, dir1);
|
return browseFile(&lv_, false, file, _("Choose keyboard map"), "*.kmap", false, dir1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const ControlPrefs::browsedict(string const & file)
|
string const ControlPrefs::browsedict(string const & file)
|
||||||
{
|
{
|
||||||
return browseFile(&lv_, file, _("Choose personal dictionary"), "*.ispell");
|
return browseFile(&lv_, false, file, _("Choose personal dictionary"), "*.ispell");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const ControlPrefs::browse(string const & file, string const & title)
|
string const ControlPrefs::browse(string const & file, string const & title)
|
||||||
{
|
{
|
||||||
return browseFile(&lv_, file, title, "*", true);
|
return browseFile(&lv_, false, file, title, "*", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const ControlPrefs::browsedir(string const & path, string const & title)
|
string const ControlPrefs::browsedir(string const & path, string const & title)
|
||||||
{
|
{
|
||||||
return browseDir(&lv_, path, title);
|
return browseDir(&lv_, false, path, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ string const ControlPrint::Browse(string const & in_name)
|
|||||||
string const pattern = "*.ps";
|
string const pattern = "*.ps";
|
||||||
|
|
||||||
// Show the file browser dialog
|
// Show the file browser dialog
|
||||||
return browseRelFile(&lv_, in_name, buffer()->filePath(),
|
return browseRelFile(&lv_, false, in_name, buffer()->filePath(),
|
||||||
title, pattern, true);
|
title, pattern, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,9 @@ string const printable_list(string const & invalid_chars)
|
|||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
string const browseFile(LyXView * lv, string const & filename,
|
string const browseFile(LyXView * lv,
|
||||||
|
bool check_returned_filename,
|
||||||
|
string const & filename,
|
||||||
string const & title,
|
string const & title,
|
||||||
string const & pattern,
|
string const & pattern,
|
||||||
bool save,
|
bool save,
|
||||||
@ -89,6 +91,8 @@ string const browseFile(LyXView * lv, string const & filename,
|
|||||||
result = fileDlg.open(lastPath, pattern,
|
result = fileDlg.open(lastPath, pattern,
|
||||||
OnlyFilename(filename));
|
OnlyFilename(filename));
|
||||||
|
|
||||||
|
if (!check_returned_filename)
|
||||||
|
break;
|
||||||
if (invalid_chars.empty())
|
if (invalid_chars.empty())
|
||||||
break;
|
break;
|
||||||
if (result_path.empty())
|
if (result_path.empty())
|
||||||
@ -105,17 +109,20 @@ string const browseFile(LyXView * lv, string const & filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const browseRelFile(LyXView * lv, string const & filename,
|
string const browseRelFile(LyXView * lv,
|
||||||
string const & refpath,
|
bool check_returned_filename,
|
||||||
string const & title,
|
string const & filename,
|
||||||
string const & pattern,
|
string const & refpath,
|
||||||
bool save,
|
string const & title,
|
||||||
pair<string,string> const & dir1,
|
string const & pattern,
|
||||||
pair<string,string> const & dir2)
|
bool save,
|
||||||
|
pair<string,string> const & dir1,
|
||||||
|
pair<string,string> const & dir2)
|
||||||
{
|
{
|
||||||
string const fname = MakeAbsPath(filename, refpath);
|
string const fname = MakeAbsPath(filename, refpath);
|
||||||
|
|
||||||
string const outname = browseFile(lv, fname, title, pattern, save,
|
string const outname = browseFile(lv, check_returned_filename,
|
||||||
|
fname, title, pattern, save,
|
||||||
dir1, dir2);
|
dir1, dir2);
|
||||||
string const reloutname = MakeRelPath(outname, refpath);
|
string const reloutname = MakeRelPath(outname, refpath);
|
||||||
if (prefixIs(reloutname, "../"))
|
if (prefixIs(reloutname, "../"))
|
||||||
@ -125,10 +132,12 @@ string const browseRelFile(LyXView * lv, string const & filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const browseDir(LyXView * lv, string const & pathname,
|
string const browseDir(LyXView * lv,
|
||||||
string const & title,
|
bool check_returned_pathname,
|
||||||
pair<string,string> const & dir1,
|
string const & pathname,
|
||||||
pair<string,string> const & dir2)
|
string const & title,
|
||||||
|
pair<string,string> const & dir1,
|
||||||
|
pair<string,string> const & dir2)
|
||||||
{
|
{
|
||||||
string lastPath(".");
|
string lastPath(".");
|
||||||
if (!pathname.empty())
|
if (!pathname.empty())
|
||||||
@ -145,6 +154,8 @@ string const browseDir(LyXView * lv, string const & pathname,
|
|||||||
result = fileDlg.opendir(lastPath,
|
result = fileDlg.opendir(lastPath,
|
||||||
OnlyFilename(pathname));
|
OnlyFilename(pathname));
|
||||||
|
|
||||||
|
if (!check_returned_pathname)
|
||||||
|
break;
|
||||||
if (invalid_chars.empty())
|
if (invalid_chars.empty())
|
||||||
break;
|
break;
|
||||||
if (result_path.empty())
|
if (result_path.empty())
|
||||||
|
@ -26,7 +26,9 @@ class LyXView;
|
|||||||
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
||||||
*/
|
*/
|
||||||
string const
|
string const
|
||||||
browseFile(LyXView * lv, string const & filename,
|
browseFile(LyXView * lv,
|
||||||
|
bool check_returned_filename,
|
||||||
|
string const & filename,
|
||||||
string const & title,
|
string const & title,
|
||||||
string const & pattern,
|
string const & pattern,
|
||||||
bool save = false,
|
bool save = false,
|
||||||
@ -43,7 +45,9 @@ browseFile(LyXView * lv, string const & filename,
|
|||||||
intended to be useful for insets which encapsulate files/
|
intended to be useful for insets which encapsulate files/
|
||||||
*/
|
*/
|
||||||
string const
|
string const
|
||||||
browseRelFile(LyXView * lv, string const & filename,
|
browseRelFile(LyXView * lv,
|
||||||
|
bool check_returned_filename,
|
||||||
|
string const & filename,
|
||||||
string const & refpath,
|
string const & refpath,
|
||||||
string const & title,
|
string const & title,
|
||||||
string const & pattern,
|
string const & pattern,
|
||||||
@ -60,12 +64,14 @@ browseRelFile(LyXView * lv, string const & filename,
|
|||||||
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
||||||
*/
|
*/
|
||||||
string const
|
string const
|
||||||
browseDir(LyXView * lv, string const & pathname,
|
browseDir(LyXView * lv,
|
||||||
string const & title,
|
bool check_returned_pathname,
|
||||||
std::pair<string,string> const & dir1 =
|
string const & pathname,
|
||||||
std::make_pair(string(), string()),
|
string const & title,
|
||||||
std::pair<string,string> const & dir2 =
|
std::pair<string,string> const & dir1 =
|
||||||
std::make_pair(string(), string()));
|
std::make_pair(string(), string()),
|
||||||
|
std::pair<string,string> const & dir2 =
|
||||||
|
std::make_pair(string(), string()));
|
||||||
|
|
||||||
|
|
||||||
/// Returns a vector of units that can be used to create a valid LaTeX length.
|
/// Returns a vector of units that can be used to create a valid LaTeX length.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user