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.
15 #include <boost/bind.hpp>
25 } // namespace support
30 /** Launch a file dialog and return the chosen file.
31 filename: a suggested filename.
32 title: the title of the dialog.
34 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
37 browseFile(std::string const & filename,
38 std::string const & title,
39 support::FileFilterList const & filters,
41 std::pair<std::string,std::string> const & dir1 =
42 std::make_pair(std::string(), std::string()),
43 std::pair<std::string,std::string> const & dir2 =
44 std::make_pair(std::string(), std::string()));
47 /* Wrapper around browseFile which tries to provide a filename
48 relative to relpath. If the relative path is of the form "foo.txt"
49 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
50 of the form "../baz/foo.txt", an absolute path is returned. This is
51 intended to be useful for insets which encapsulate files/
54 browseRelFile(std::string const & filename,
55 std::string const & refpath,
56 std::string const & title,
57 support::FileFilterList const & filters,
59 std::pair<std::string,std::string> const & dir1 =
60 std::make_pair(std::string(), std::string()),
61 std::pair<std::string,std::string> const & dir2 =
62 std::make_pair(std::string(), std::string()));
65 /** Launch a file dialog and return the chosen directory.
66 pathname: a suggested pathname.
67 title: the title of the dialog.
68 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
71 browseDir(std::string const & pathname,
72 std::string const & title,
73 std::pair<std::string,std::string> const & dir1 =
74 std::make_pair(std::string(), std::string()),
75 std::pair<std::string,std::string> const & dir2 =
76 std::make_pair(std::string(), std::string()));
79 /// Returns a vector of units that can be used to create a valid LaTeX length.
80 std::vector<std::string> const getLatexUnits();
83 /** Functions to extract vectors of the first and second elems from a
87 std::vector<typename Pair::first_type> const
88 getFirst(std::vector<Pair> const & pr)
90 std::vector<typename Pair::first_type> tmp(pr.size());
91 std::transform(pr.begin(), pr.end(), tmp.begin(),
92 boost::bind(&Pair::first, _1));
97 std::vector<typename Pair::second_type> const
98 getSecond(std::vector<Pair> const & pr)
100 std::vector<typename Pair::second_type> tmp(pr.size());
101 std::transform(pr.begin(), pr.end(), tmp.begin(),
102 boost::bind(&Pair::second, _1));
106 } // namespace frontend
109 #endif // NOT HELPERFUNCS_H