Auto-scan for texinfo and bibtex dialogs

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4446 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-06-20 23:35:10 +00:00
parent b3c975de36
commit 5b2f35382e
6 changed files with 57 additions and 20 deletions

View File

@ -1,3 +1,14 @@
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* ControlTexinfo.C: do the same for Texinfo
* tex_helpers.C: don't try to read a file that isn't there
2002-06-21 Herbert Voss <voss@perce.de>
* ControlBibtex.C: do an automatic update, when no bst-list
exists
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* GUI.h: createIndex() changed

View File

@ -25,6 +25,7 @@
#include "helper_funcs.h"
#include "tex_helpers.h"
#include "gettext.h"
#include "support/lstrings.h"
#include "frontends/LyXView.h"
@ -69,7 +70,13 @@ string const ControlBibtex::Browse(string const & in_name,
string const ControlBibtex::getBibStyles() const
{
return getTexFileList("bstFiles.lst", false);
string list = getTexFileList("bstFiles.lst", false);
// test, if we have a valid list, otherwise run rescan
if (list.empty()) {
rescanBibStyles();
list = getTexFileList("bstFiles.lst", false);
}
return list;
}

View File

@ -32,6 +32,25 @@
extern string user_lyxdir; // home of *Files.lst
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();
}
}
ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
@ -55,18 +74,14 @@ void ControlTexinfo::runTexhash() const
string const
ControlTexinfo::getContents(texFileSuffix type, bool withFullPath) const
{
switch (type) {
case bst:
return getTexFileList("bstFiles.lst", withFullPath);
break;
case cls:
return getTexFileList("clsFiles.lst", withFullPath);
break;
case sty:
return getTexFileList("styFiles.lst", withFullPath);
break;
string list(getFileList(type, withFullPath));
// initial scan
if (list.empty()) {
rescanStyles();
list = getFileList(type, withFullPath);
}
return string();
return list;
}

View File

@ -66,15 +66,17 @@ void texhash()
string const getTexFileList(string const & filename, bool withFullPath)
{
vector<string> dbase = getVectorFromString(
GetFileContents(LibFileSearch(string(),filename)), "\n");
string const file = LibFileSearch("", filename);
if (file.empty())
return string();
vector<string> dbase =
getVectorFromString(GetFileContents(file), "\n");
lyx::eliminate_duplicates(dbase);
string const str_out = withFullPath ?
getStringFromVector(dbase, "\n") :
getStringFromVector(listWithoutPath(dbase), "\n");
// everything ok?
if (str_out.empty())
return _("Missing filelist. try Rescan");
return str_out;
}
@ -92,8 +94,6 @@ string const getListOfOptions(string const & classname,
s = s.substr(s.find("DeclareOption"));
s = split(s,'{'); // cut front
s = token(s,'}',0); // cut end
// FIXME: why is this commented out ?
// s = s.substr(0, s.find('}')+1); // format entry
optionList += (s + '\n');
}
}

View File

@ -1,3 +1,7 @@
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* forms/form_texinfo.fd: "Update List" not "Rescan"
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* guiapi.C: createIndex() changed

View File

@ -186,7 +186,7 @@ alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Rescan|#R
label: Update List|#U
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast