mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
8c93f63b48
letter start with a lower letter. * All other .C and .h in the cs: adjust for above change git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13603 a592a061-630c-0410-9148-cb99ea01b6c8
101 lines
2.0 KiB
C
101 lines
2.0 KiB
C
/**
|
|
* \file ControlTexinfo.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Herbert Voß
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#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, bool withPath)
|
|
{
|
|
string filename;
|
|
switch (type) {
|
|
case ControlTexinfo::bst:
|
|
filename = "bstFiles.lst";
|
|
break;
|
|
case ControlTexinfo::cls:
|
|
filename = "clsFiles.lst";
|
|
break;
|
|
case ControlTexinfo::sty:
|
|
filename = "styFiles.lst";
|
|
break;
|
|
}
|
|
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);
|
|
}
|
|
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());
|
|
}
|
|
|
|
|
|
ControlTexinfo::ControlTexinfo(Dialog & parent)
|
|
: Dialog::Controller(parent)
|
|
{}
|
|
|
|
|
|
void ControlTexinfo::viewFile(string const & filename) const
|
|
{
|
|
string const arg = "file " + filename;
|
|
kernel().dispatch(FuncRequest(LFUN_DIALOG_SHOW, arg));
|
|
}
|
|
|
|
|
|
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
|