#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "ControlTexinfo.h"
+#include "funcrequest.h"
-#include "helper_funcs.h"
-#include "tex_helpers.h"
-
-#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
-
-#include "support/filetools.h" // FileSearch
-#include "support/path.h"
-#include "support/lstrings.h"
-extern string user_lyxdir; // home of *Files.lst
-
-namespace {
-
-string getFileList(ControlTexinfo::texFileSuffix type, bool withFullPath)
+void getTexFileList(ControlTexinfo::texFileSuffix type,
+ std::vector<string> & list)
{
+ string filename;
switch (type) {
- case ControlTexinfo::bst:
- return getTexFileList("bstFiles.lst", withFullPath);
+ case ControlTexinfo::bst:
+ filename = "bstFiles.lst";
break;
- case ControlTexinfo::cls:
- return getTexFileList("clsFiles.lst", withFullPath);
+ case ControlTexinfo::cls:
+ filename = "clsFiles.lst";
break;
- case ControlTexinfo::sty:
- return getTexFileList("styFiles.lst", withFullPath);
+ case ControlTexinfo::sty:
+ filename = "styFiles.lst";
break;
}
- return string();
+ getTexFileList(filename, list);
+ if (list.empty()) {
+ // build filelists of all availabe bst/cls/sty-files.
+ // Done through kpsewhich and an external script,
+ // saved in *Files.lst
+ rescanTexStyles();
+ getTexFileList(filename, list);
+ }
}
-} // namespace anon
-
-ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
- : ControlDialogBI(lv, d)
+ControlTexinfo::ControlTexinfo(Dialog & parent)
+ : Dialog::Controller(parent)
{}
-// build filelists of all availabe bst/cls/sty-files. done through
-// kpsewhich and an external script, saved in *Files.lst
-void ControlTexinfo::rescanStyles() const
-{
- rescanTexStyles();
-}
-
-
-void ControlTexinfo::runTexhash() const
-{
- texhash();
-}
-
-
-string const
-ControlTexinfo::getContents(texFileSuffix type, bool withFullPath) const
-{
- string list(getFileList(type, withFullPath));
-
- // initial scan
- if (list.empty()) {
- rescanStyles();
- list = getFileList(type, withFullPath);
- }
- return list;
-}
-
-
-void ControlTexinfo::viewFile(string const filename) const
+void ControlTexinfo::viewFile(string const & filename) const
{
- lv_.getDialogs().showFile(filename);
+ string const arg = "file " + filename;
+ kernel().dispatch(FuncRequest(LFUN_DIALOG_SHOW, arg));
}