2001-10-09 15:20:10 +00:00
|
|
|
/* This file is part of
|
2002-03-21 21:21:28 +00:00
|
|
|
* ======================================================
|
2001-10-09 15:20:10 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 2001 The LyX Team.
|
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* \file ControlTexinfo.C
|
|
|
|
* \author Herbert Voss <voss@lyx.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include "ControlTexinfo.h"
|
2001-10-09 15:20:10 +00:00
|
|
|
#include "Dialogs.h"
|
|
|
|
#include "gettext.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
#include "helper_funcs.h"
|
2002-06-20 20:41:00 +00:00
|
|
|
#include "tex_helpers.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
|
|
|
|
#include "frontends/LyXView.h"
|
|
|
|
|
2001-10-09 15:20:10 +00:00
|
|
|
#include "support/filetools.h" // FileSearch
|
|
|
|
#include "support/path.h"
|
2001-10-10 16:45:05 +00:00
|
|
|
#include "support/lstrings.h"
|
2001-10-09 15:20:10 +00:00
|
|
|
|
2001-10-10 16:45:05 +00:00
|
|
|
extern string user_lyxdir; // home of *Files.lst
|
2001-10-09 15:20:10 +00:00
|
|
|
|
2002-06-20 23:35:10 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
string getFileList(ControlTexinfo::texFileSuffix type, bool withFullPath)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case ControlTexinfo::bst:
|
|
|
|
return getTexFileList("bstFiles.lst", withFullPath);
|
|
|
|
break;
|
|
|
|
case ControlTexinfo::cls:
|
|
|
|
return getTexFileList("clsFiles.lst", withFullPath);
|
|
|
|
break;
|
|
|
|
case ControlTexinfo::sty:
|
|
|
|
return getTexFileList("styFiles.lst", withFullPath);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return string();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2002-02-16 18:34:30 +00:00
|
|
|
|
2001-10-09 15:20:10 +00:00
|
|
|
ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
|
2002-01-16 14:47:58 +00:00
|
|
|
: ControlDialogBI(lv, d)
|
2002-06-18 15:44:30 +00:00
|
|
|
{}
|
2001-10-09 15:20:10 +00:00
|
|
|
|
2002-02-16 18:34:30 +00:00
|
|
|
|
2001-10-09 15:20:10 +00:00
|
|
|
// build filelists of all availabe bst/cls/sty-files. done through
|
|
|
|
// kpsewhich and an external script, saved in *Files.lst
|
2001-10-10 16:45:05 +00:00
|
|
|
void ControlTexinfo::rescanStyles() const
|
2001-10-09 15:20:10 +00:00
|
|
|
{
|
2002-06-20 20:41:00 +00:00
|
|
|
rescanTexStyles();
|
2001-10-09 15:20:10 +00:00
|
|
|
}
|
|
|
|
|
2001-10-10 16:45:05 +00:00
|
|
|
|
|
|
|
void ControlTexinfo::runTexhash() const
|
2001-10-09 15:20:10 +00:00
|
|
|
{
|
2002-06-20 20:41:00 +00:00
|
|
|
texhash();
|
2001-10-10 16:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const
|
|
|
|
ControlTexinfo::getContents(texFileSuffix type, bool withFullPath) const
|
|
|
|
{
|
2002-06-20 23:35:10 +00:00
|
|
|
string list(getFileList(type, withFullPath));
|
|
|
|
|
|
|
|
// initial scan
|
|
|
|
if (list.empty()) {
|
|
|
|
rescanStyles();
|
|
|
|
list = getFileList(type, withFullPath);
|
2001-10-10 16:45:05 +00:00
|
|
|
}
|
2002-06-20 23:35:10 +00:00
|
|
|
return list;
|
2001-10-10 16:45:05 +00:00
|
|
|
}
|
|
|
|
|
2002-06-20 20:41:00 +00:00
|
|
|
|
2001-10-10 16:45:05 +00:00
|
|
|
void ControlTexinfo::viewFile(string const filename) const
|
2001-10-09 15:20:10 +00:00
|
|
|
{
|
2002-08-13 14:40:38 +00:00
|
|
|
lv_.getDialogs().showFile(filename);
|
2001-10-09 15:20:10 +00:00
|
|
|
}
|
2002-06-20 20:41:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
string const ControlTexinfo::getClassOptions(string const & filename) const
|
|
|
|
{
|
|
|
|
return getListOfOptions(filename, "cls");
|
|
|
|
}
|