]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlTexinfo.C
* filetools.[Ch]: Make functions that start with a capital
[lyx.git] / src / frontends / controllers / ControlTexinfo.C
index c9d91c280e0d828851ecb65714d5bd97441a75c7..a6dfab8c2f7595e08e0d984d258ce05e72512699 100644 (file)
 #include "ControlTexinfo.h"
 #include "funcrequest.h"
 
+#include "support/filetools.h"
+
+#include <algorithm>
 
 using std::string;
+using std::vector;
+
+namespace lyx {
+
+using support::onlyFilename;
 
+namespace frontend {
 
 void getTexFileList(ControlTexinfo::texFileSuffix type,
-                   std::vector<string> & list)
+                   std::vector<string> & list, bool withPath)
 {
        string filename;
        switch (type) {
@@ -40,6 +49,15 @@ void getTexFileList(ControlTexinfo::texFileSuffix type,
                rescanTexStyles();
                getTexFileList(filename, list);
        }
+       if (withPath)
+               return;
+       vector<string>::iterator it  = list.begin();
+       vector<string>::iterator end = list.end();
+       for (; it != end; ++it) {
+               *it = onlyFilename(*it);
+       }
+       // sort on filename only (no path)
+       std::sort(list.begin(), list.end());
 }
 
 
@@ -59,3 +77,24 @@ string const ControlTexinfo::getClassOptions(string const & filename) const
 {
        return getListOfOptions(filename, "cls");
 }
+
+
+string const ControlTexinfo::getFileType(ControlTexinfo::texFileSuffix type) const
+{
+       string ftype;
+       switch (type) {
+       case ControlTexinfo::bst:
+               ftype = "bst";
+               break;
+       case ControlTexinfo::cls:
+               ftype = "cls";
+               break;
+       case ControlTexinfo::sty:
+               ftype = "sty";
+               break;
+       }
+       return ftype;
+}
+
+} // namespace frontend
+} // namespace lyx