+2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * ControlBibtex.C: sort bst files (bug 1936)
+
+ * ControlTeXInfo.[Ch]: new member getFileType that returns the extension
+ of the supported files.
+ * ControlTeXInfo.[Ch] (getTeXFileList): takes bool withPath and sorts
+ correctly when no path is requested (bug 1936)
+
+ * tex_helpers.C (getTeXFileList): remove empty items from the list
+ (bug 1936); proper support the other file types than *cls.
+
2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ControlToc.[Ch]: getGuiName takes a type argument now.
for (; it != end; ++it) {
*it = OnlyFilename(*it);
}
+ // sort on filename only (no path)
+ std::sort(data.begin(), data.end());
}
for (; it != end; ++it) {
*it = OnlyFilename(*it);
}
+ // sort on filename only (no path)
+ std::sort(data.begin(), data.end());
}
#include "ControlTexinfo.h"
#include "funcrequest.h"
+#include "support/filetools.h"
+
using std::string;
+using std::vector;
namespace lyx {
+
+using support::OnlyFilename;
+
namespace frontend {
void getTexFileList(ControlTexinfo::texFileSuffix type,
- std::vector<string> & list)
+ std::vector<string> & list, bool withPath)
{
string filename;
switch (type) {
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());
}
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
void viewFile(std::string const & filename) const;
/// show all classoptions
std::string const getClassOptions(std::string const & filename) const;
+ /// return file type as string
+ std::string const getFileType(ControlTexinfo::texFileSuffix type) const;
private:
///
virtual void apply() {}
* Each entry in the file list is returned as a pair<name_with_path, name_only>
*/
void getTexFileList(ControlTexinfo::texFileSuffix type,
- std::vector<std::string> & contents);
+ std::vector<std::string> & contents, bool withPath);
} // namespace frontend
} // namespace lyx
namespace lyx {
using support::contains;
+using support::GetExtension;
using support::GetFileContents;
using support::getVectorFromString;
using support::LibFileSearch;
*it = regex.Merge((*it), "/");
}
+ // remove empty items and duplicates
+ list.erase(std::remove(list.begin(), list.end(), ""), list.end());
eliminate_duplicates(list);
}
string const getTexFileFromList(string const & file,
string const & type)
{
- string const file_ = (type == "cls") ? file + ".cls" : file + ".sty";
-
- lyxerr << "Search for classfile " << file_ << endl;
-
- string const lstfile =
- ((type == "cls") ? "clsFiles.lst" : "styFiles.lst");
+ string file_ = file;
+ // do we need to add the suffix?
+ if (!(GetExtension(file) == type))
+ file_ += '.' + type;
+
+ lyxerr << "Searching for file " << file_ << endl;
+
+ string lstfile;
+ if (type == "cls")
+ lstfile = "clsFiles.lst";
+ else if (type == "sty")
+ lstfile = "styFiles.lst";
+ else if (type == "bst")
+ lstfile = "bstFiles.lst";
+ else if (type == "bib")
+ lstfile = "bibFiles.lst";
string const allClasses = GetFileContents(LibFileSearch(string(),
lstfile));
int entries = 0;
+2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * GTexInfo.C: Load and display full-path and no-path
+ lists correctly (bug 1936)
+
2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* GToc.C (update, updateContents): Do not compare against
(*itemsstore_->get_iter(path))[listColIndex_];
ContentsType const & data = texdata_[activeStyle];
+
+ string file = data[choice];
+ if (!fullpathcheck_->get_active())
+ file = getTexFileFromList(data[choice],
+ controller().getFileType(activeStyle));
+
if (choice >= 0 && choice <= data.size() - 1)
- controller().viewFile(data[choice]);
+ controller().viewFile(file);
}
void GTexinfo::updateStyles()
{
ContentsType & data = texdata_[activeStyle];
- getTexFileList(activeStyle, data);
-
bool const withFullPath = fullpathcheck_->get_active();
+ getTexFileList(activeStyle, data, withFullPath);
itemsstore_->clear();
ContentsType::const_iterator it = data.begin();
ContentsType::const_iterator end = data.end();
for (int rowindex = 0; it != end; ++it, ++rowindex) {
- string const line = withFullPath ? *it : OnlyFilename(*it);
Gtk::TreeModel::iterator row = itemsstore_->append();
- (*row)[listCol_] = line;
+ (*row)[listCol_] = *it;
(*row)[listColIndex_] = rowindex;
}
}
+2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * QBibTeX.C: Do not insert empty items to bst combo.
+
+ * QTexInfo.C:
+ * QTexInfoDialog.c: Load and display full-path and no-path
+ lists correctly (bug 1936)
+
2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* QToc.C (update_contents): fix missing qstring->string translation.
dialog_->styleCB->insertItem(toqstr(item));
}
- if (item_nr == -1) {
+ if (item_nr == -1 && !bibstyle.empty()) {
dialog_->styleCB->insertItem(toqstr(bibstyle));
item_nr = dialog_->styleCB->count() - 1;
}
- dialog_->styleCB->setCurrentItem(item_nr);
+ if (item_nr != -1)
+ dialog_->styleCB->setCurrentItem(item_nr);
+ else
+ dialog_->styleCB->clearEdit();
}
void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
{
ContentsType & data = texdata_[whichStyle];
- getTexFileList(whichStyle, data);
-
bool const withFullPath = dialog_->path->isChecked();
+ getTexFileList(whichStyle, data, withFullPath);
+
dialog_->fileList->clear();
ContentsType::const_iterator it = data.begin();
ContentsType::const_iterator end = data.end();
- for (; it != end; ++it) {
- string const line = withFullPath ? *it : OnlyFilename(*it);
- dialog_->fileList->insertItem(toqstr(line));
- }
+ for (; it != end; ++it)
+ dialog_->fileList->insertItem(toqstr(*it));
activeStyle = whichStyle;
}
#include "QTexinfoDialog.h"
#include "QTexinfo.h"
+#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlistbox.h>
#include <qpushbutton.h>
{
vector<string>::size_type const fitem = fileList->currentItem();
vector<string> const & data = form_->texdata_[form_->activeStyle];
- form_->controller().viewFile(data[fitem]);
+ string file = data[fitem];
+ if (!path->isChecked())
+ file = getTexFileFromList(data[fitem],
+ form_->controller().getFileType(form_->activeStyle));
+ form_->controller().viewFile(file);
}
+2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * FormTexInfo.C: Load and display full-path and no-path
+ lists correctly (bug 1936)
+
2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormToc.C (updateType, update_contents): Do not compare against
// double click in browser: view selected file
ContentsType::size_type const sel = fl_get_browser(ob);
ContentsType const & data = texdata_[activeStyle];
+ string file = data[sel-1];
+ if (!fl_get_button(dialog_->check_fullpath))
+ file = getTexFileFromList(data[sel-1],
+ controller().getFileType(activeStyle));
if (sel >= 1 && sel <= data.size())
- controller().viewFile(data[sel-1]);
+ controller().viewFile(file);
// reset the browser so that the following single-click
// callback doesn't do anything
void FormTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
{
ContentsType & data = texdata_[whichStyle];
- getTexFileList(whichStyle, data);
-
bool const withFullPath = fl_get_button(dialog_->check_fullpath);
+ getTexFileList(whichStyle, data, withFullPath);
fl_clear_browser(dialog_->browser);
ContentsType::const_iterator it = data.begin();
ContentsType::const_iterator end = data.end();
- for (; it != end; ++it) {
- string const line = withFullPath ? *it : OnlyFilename(*it);
- fl_add_browser_line(dialog_->browser, line.c_str());
- }
+ for (; it != end; ++it)
+ fl_add_browser_line(dialog_->browser, (*it).c_str());
activeStyle = whichStyle;
}