mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 01:08:45 +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>
|
||||
|
||||
* helper_funcs.C (get_invalid_chars_latex, printable_list): new
|
||||
@ -52,16 +70,16 @@
|
||||
|
||||
2004-04-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* ControlMath.C (find_xpm):
|
||||
* ControlBibtex.C (applyParamsToInset):
|
||||
* ControlMath.C (find_xpm):
|
||||
* ControlBibtex.C (applyParamsToInset):
|
||||
* ControlBibitem.C (applyParamsToInset): fix #warning directives
|
||||
|
||||
|
||||
* ControlDialog.tmpl (show, update, hide): gcc 3.4 compilation fix
|
||||
|
||||
2003-02-10 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* ControlInclude.C (Browse): replace masterFilename_ with
|
||||
parentFilename_.
|
||||
parentFilename_.
|
||||
|
||||
2003-06-06 John Levon <levon@movementarian.org>
|
||||
|
||||
@ -80,7 +98,7 @@
|
||||
2003-02-17 John Levon <levon@movementarian.org>
|
||||
|
||||
* ControlDialog.tmpl: do build before setParams for
|
||||
spellchecker's sake
|
||||
spellchecker's sake
|
||||
|
||||
* ControlSpellchecker.h:
|
||||
* ControlSpellchecker.C: rework
|
||||
@ -103,7 +121,7 @@
|
||||
2003-01-11 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
||||
|
||||
* helper_funcs.[Ch]: implement browseDir (browse directory) [bug 824]
|
||||
|
||||
|
||||
* ControlPrefs.[Ch]: implement browsedir for the use of use browseDir.
|
||||
|
||||
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"),
|
||||
string(lyxrc.document_path));
|
||||
return browseRelFile(&lv_, in_name, buffer()->filePath(),
|
||||
return browseRelFile(&lv_, true, in_name, buffer()->filePath(),
|
||||
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"),
|
||||
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> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
|
||||
// Show the file browser dialog
|
||||
return browseRelFile(&lv_, in_name, buffer()->filePath(),
|
||||
return browseRelFile(&lv_, true, in_name, buffer()->filePath(),
|
||||
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_);
|
||||
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return browseFile(&lv_, file, title, "*", true);
|
||||
return browseFile(&lv_, false, file, title, "*", true);
|
||||
}
|
||||
|
||||
|
||||
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";
|
||||
|
||||
// Show the file browser dialog
|
||||
return browseRelFile(&lv_, in_name, buffer()->filePath(),
|
||||
return browseRelFile(&lv_, false, in_name, buffer()->filePath(),
|
||||
title, pattern, true);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,9 @@ string const printable_list(string const & invalid_chars)
|
||||
} // 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 & pattern,
|
||||
bool save,
|
||||
@ -89,6 +91,8 @@ string const browseFile(LyXView * lv, string const & filename,
|
||||
result = fileDlg.open(lastPath, pattern,
|
||||
OnlyFilename(filename));
|
||||
|
||||
if (!check_returned_filename)
|
||||
break;
|
||||
if (invalid_chars.empty())
|
||||
break;
|
||||
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 & refpath,
|
||||
string const & title,
|
||||
string const & pattern,
|
||||
bool save,
|
||||
pair<string,string> const & dir1,
|
||||
pair<string,string> const & dir2)
|
||||
string const browseRelFile(LyXView * lv,
|
||||
bool check_returned_filename,
|
||||
string const & filename,
|
||||
string const & refpath,
|
||||
string const & title,
|
||||
string const & pattern,
|
||||
bool save,
|
||||
pair<string,string> const & dir1,
|
||||
pair<string,string> const & dir2)
|
||||
{
|
||||
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);
|
||||
string const reloutname = MakeRelPath(outname, refpath);
|
||||
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 & title,
|
||||
pair<string,string> const & dir1,
|
||||
pair<string,string> const & dir2)
|
||||
string const browseDir(LyXView * lv,
|
||||
bool check_returned_pathname,
|
||||
string const & pathname,
|
||||
string const & title,
|
||||
pair<string,string> const & dir1,
|
||||
pair<string,string> const & dir2)
|
||||
{
|
||||
string lastPath(".");
|
||||
if (!pathname.empty())
|
||||
@ -145,6 +154,8 @@ string const browseDir(LyXView * lv, string const & pathname,
|
||||
result = fileDlg.opendir(lastPath,
|
||||
OnlyFilename(pathname));
|
||||
|
||||
if (!check_returned_pathname)
|
||||
break;
|
||||
if (invalid_chars.empty())
|
||||
break;
|
||||
if (result_path.empty())
|
||||
|
@ -26,7 +26,9 @@ class LyXView;
|
||||
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
||||
*/
|
||||
string const
|
||||
browseFile(LyXView * lv, string const & filename,
|
||||
browseFile(LyXView * lv,
|
||||
bool check_returned_filename,
|
||||
string const & filename,
|
||||
string const & title,
|
||||
string const & pattern,
|
||||
bool save = false,
|
||||
@ -43,7 +45,9 @@ browseFile(LyXView * lv, string const & filename,
|
||||
intended to be useful for insets which encapsulate files/
|
||||
*/
|
||||
string const
|
||||
browseRelFile(LyXView * lv, string const & filename,
|
||||
browseRelFile(LyXView * lv,
|
||||
bool check_returned_filename,
|
||||
string const & filename,
|
||||
string const & refpath,
|
||||
string const & title,
|
||||
string const & pattern,
|
||||
@ -60,12 +64,14 @@ browseRelFile(LyXView * lv, string const & filename,
|
||||
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
||||
*/
|
||||
string const
|
||||
browseDir(LyXView * lv, string const & pathname,
|
||||
string const & title,
|
||||
std::pair<string,string> const & dir1 =
|
||||
std::make_pair(string(), string()),
|
||||
std::pair<string,string> const & dir2 =
|
||||
std::make_pair(string(), string()));
|
||||
browseDir(LyXView * lv,
|
||||
bool check_returned_pathname,
|
||||
string const & pathname,
|
||||
string const & title,
|
||||
std::pair<string,string> const & dir1 =
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user