-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 2001 The LyX Team.
+/**
+ * \file ControlTexinfo.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * ======================================================
+ * \author Herbert Voss
*
- * \file ControlTexinfo.C
- * \author Herbert Voss <voss@lyx.org>
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "ControlTexinfo.h"
-#include "Dialogs.h"
-#include "BufferView.h"
-#include "gettext.h"
-#include "helper_funcs.h"
-#include "tex_helpers.h"
-
-#include "frontends/LyXView.h"
+#include "funcrequest.h"
-#include "support/filetools.h" // FileSearch
-#include "support/path.h"
-#include "support/lstrings.h"
-extern string user_lyxdir; // home of *Files.lst
-
-
-ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
- : ControlDialogBI(lv, d)
-{}
-
-
-// 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
+void getTexFileList(ControlTexinfo::texFileSuffix type,
+ std::vector<string> & list)
{
+ string filename;
switch (type) {
- case bst:
- return getTexFileList("bstFiles.lst", withFullPath);
+ case ControlTexinfo::bst:
+ filename = "bstFiles.lst";
break;
- case cls:
- return getTexFileList("clsFiles.lst", withFullPath);
+ case ControlTexinfo::cls:
+ filename = "clsFiles.lst";
break;
- case 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);
+ }
}
-void ControlTexinfo::viewFile(string const filename) const
+ControlTexinfo::ControlTexinfo(Dialog & parent)
+ : Dialog::Controller(parent)
+{}
+
+
+void ControlTexinfo::viewFile(string const & filename) const
{
- lv_.getDialogs()->showFile(filename);
+ string const arg = "file " + filename;
+ kernel().dispatch(FuncRequest(LFUN_DIALOG_SHOW, arg));
}