4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
20 /** Launch a file dialog and return the chosen file.
21 filename: a suggested filename.
22 title: the title of the dialog.
24 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
27 browseFile(std::string const & filename,
28 std::string const & title,
29 std::string const & pattern,
31 std::pair<std::string,std::string> const & dir1 =
32 std::make_pair(std::string(), std::string()),
33 std::pair<std::string,std::string> const & dir2 =
34 std::make_pair(std::string(), std::string()));
37 /* Wrapper around browseFile which tries to provide a filename
38 relative to relpath. If the relative path is of the form "foo.txt"
39 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
40 of the form "../baz/foo.txt", an absolute path is returned. This is
41 intended to be useful for insets which encapsulate files/
44 browseRelFile(std::string const & filename,
45 std::string const & refpath,
46 std::string const & title,
47 std::string const & pattern,
49 std::pair<std::string,std::string> const & dir1 =
50 std::make_pair(std::string(), std::string()),
51 std::pair<std::string,std::string> const & dir2 =
52 std::make_pair(std::string(), std::string()));
55 /** Launch a file dialog and return the chosen directory.
56 pathname: a suggested pathname.
57 title: the title of the dialog.
58 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
61 browseDir(std::string const & pathname,
62 std::string const & title,
63 std::pair<std::string,std::string> const & dir1 =
64 std::make_pair(std::string(), std::string()),
65 std::pair<std::string,std::string> const & dir2 =
66 std::make_pair(std::string(), std::string()));
69 /// Returns a vector of units that can be used to create a valid LaTeX length.
70 std::vector<std::string> const getLatexUnits();
73 /** Functions to extract vectors of the first and second elems from a
81 typedef typename Pair::first_type first_type;
82 first_type const & operator()(Pair const & p) { return p.first; }
87 typedef typename Pair::second_type second_type;
88 second_type const & operator()(Pair const & p) { return p.second; }
95 std::vector<typename Pair::first_type> const
96 getFirst(std::vector<Pair> const & pr)
98 std::vector<typename Pair::first_type> tmp(pr.size());
99 std::transform(pr.begin(), pr.end(), tmp.begin(),
100 detail::firster<Pair>());
106 std::vector<typename Pair::second_type> const
107 getSecond(std::vector<Pair> const & pr)
109 std::vector<typename Pair::second_type> tmp(pr.size());
110 std::transform(pr.begin(), pr.end(), tmp.begin(),
111 detail::seconder<Pair>());
116 #endif // HELPERFUNCS_H