#include "ControlTexinfo.h"
#include "FuncRequest.h"
+#include "debug.h"
#include "support/filetools.h"
#include "support/FileName.h"
using std::string;
using std::vector;
+using std::endl;
namespace lyx {
namespace frontend {
using support::contains;
using support::split;
using support::token;
+using support::getExtension;
+using support::libFileSearch;
+using support::onlyFilename;
ControlTexinfo::ControlTexinfo(Dialog & parent)
}
+/// get a class with full path from the list
+string const getTexFileFromList(string const & file, string const & type)
+{
+ string file_ = file;
+ // do we need to add the suffix?
+ if (!(getExtension(file) == type))
+ file_ += '.' + type;
+
+ lyxerr << "Searching for file " << file_ << endl;
+
+ string lstfile = type + "Files.lst";
+ 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";
+ FileName const abslstfile = libFileSearch(string(), lstfile);
+ if (abslstfile.empty()) {
+ lyxerr << "File `'" << lstfile << "' not found." << endl;
+ return string();
+ }
+ string const allClasses = getFileContents(abslstfile);
+ int entries = 0;
+ string classfile = token(allClasses, '\n', entries);
+ int count = 0;
+ while ((!contains(classfile, file) ||
+ (onlyFilename(classfile) != file)) &&
+ (++count < 1000)) {
+ classfile = token(allClasses, '\n', ++entries);
+ }
+
+ // now we have filename with full path
+ lyxerr << "with full path: " << classfile << endl;
+
+ return classfile;
+}
+
+
string const ControlTexinfo::getClassOptions(string const & classname) const
{
FileName const filename(getTexFileFromList(classname, "cls"));
namespace lyx {
namespace frontend {
-/** A controller for Texinfo dialogs. */
+std::string const getTexFileFromList(std::string const & file,
+ std::string const & type);
+/** A controller for Texinfo dialogs. */
class ControlTexinfo : public Controller {
public:
///
#include "frontend_helpers.h"
-#include "Buffer.h"
-#include "BufferParams.h"
-#include "Color.h"
-#include "debug.h"
#include "gettext.h"
#include "Language.h"
-#include "Length.h"
#include "frontends/FileDialog.h"
#include "frontends/alert.h"
#include "support/filetools.h"
#include "support/lstrings.h"
-#include "support/Package.h"
-#include "support/lstrings.h"
#include "support/lyxalgo.h"
#include "support/os.h"
#include "support/Package.h"
#include "support/Path.h"
#include "support/Systemcall.h"
-#include <boost/cregex.hpp>
#include <boost/regex.hpp>
#include <algorithm>
using support::addName;
using support::bformat;
-using support::contains;
using support::FileFilterList;
using support::FileName;
using support::getExtension;
}
-vector<docstring> const getLatexUnits()
-{
- vector<docstring> units;
- int i = 0;
- char const * str = stringFromUnit(i);
- for (; str != 0; ++i, str = stringFromUnit(i))
- units.push_back(from_ascii(str));
-
- return units;
-}
-
-
void rescanTexStyles()
{
// Run rescan in user lyx directory
boost::RegEx regex("/{2,}");
std::vector<string>::iterator it = list.begin();
std::vector<string>::iterator end = list.end();
- for (; it != end; ++it) {
+ for (; it != end; ++it)
*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 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";
- FileName const abslstfile = libFileSearch(string(), lstfile);
- if (abslstfile.empty()) {
- lyxerr << "File `'" << lstfile << "' not found." << endl;
- return string();
- }
- string const allClasses = getFileContents(abslstfile);
- int entries = 0;
- string classfile = token(allClasses, '\n', entries);
- int count = 0;
- while ((!contains(classfile, file) ||
- (onlyFilename(classfile) != file)) &&
- (++count < 1000)) {
- classfile = token(allClasses, '\n', ++entries);
- }
-
- // now we have filename with full path
- lyxerr << "with full path: " << classfile << endl;
-
- return classfile;
-}
-
} // namespace frontend
} // namespace lyx
#include <vector>
#include <string>
-#include <boost/bind.hpp>
-
namespace lyx {
namespace support { class FileFilterList; }
namespace frontend {
-///
-template<class Pair>
-std::vector<typename Pair::second_type> const
-getSecond(std::vector<Pair> const & pr)
-{
- std::vector<typename Pair::second_type> tmp(pr.size());
- std::transform(pr.begin(), pr.end(), tmp.begin(),
- boost::bind(&Pair::second, _1));
- return tmp;
-}
-
///
typedef std::pair<docstring, std::string> LanguagePair;
std::make_pair(docstring(), docstring()));
-/// Returns a vector of units that can be used to create a valid LaTeX length.
-std::vector<docstring> const getLatexUnits();
-
-
/** Build filelists of all availabe bst/cls/sty-files. Done through
* kpsewhich and an external script, saved in *Files.lst.
*/
*/
void getTexFileList(std::string const & filename, std::vector<std::string> & contents);
-/// get a class with full path from the list
-std::string const getTexFileFromList(std::string const & classname, std::string const & type);
-
} // namespace frontend
} // namespace lyx
#include "GuiBox.h"
-#include "ControlBox.h"
-
#include "LengthCombo.h"
#include "qt_helpers.h"
#include "lengthcommon.h"
#include "LyXRC.h" // to set the default length values
#include "Validator.h"
-#include "controllers/ControlBox.h"
-#include "controllers/frontend_helpers.h"
-
#include "insets/InsetBox.h"
#include "support/lstrings.h"
#include <QCloseEvent>
-using lyx::support::getStringFromVector;
-using lyx::support::isStrDbl;
-using lyx::support::subst;
using std::string;
-
namespace lyx {
namespace frontend {
-
GuiBoxDialog::GuiBoxDialog(LyXView & lv)
: GuiDialog(lv, "box")
{
lengthToWidgets(widthED, widthUnitsLC,
(controller().params().width).asString(), default_unit);
- string const special(controller().params().special);
+ string const special = controller().params().special;
if (!special.empty() && special != "none") {
QString spc;
for (unsigned int i = 0; i < gui_names_spec_.size(); i++) {
lengthToWidgets(heightED, heightUnitsLC,
(controller().params().height).asString(), default_unit);
- string const height_special(controller().params().height_special);
+ string const height_special = controller().params().height_special;
if (!height_special.empty() && height_special != "none") {
QString hspc;
for (unsigned int i = 0; i < gui_names_spec_.size(); i++) {
innerBoxCO->setCurrentIndex(i - 1);
} else {
if (innerBoxCO->count() == 2)
- i += 1;
+ ++i;
innerBoxCO->clear();
innerBoxCO->addItem(qt_("None"));
innerBoxCO->addItem(qt_("Parbox"));
#include "GuiViewSource.h" // For latexHighlighter use in the preamble.
+#include "frontend_helpers.h"
#include "BufferParams.h"
#include "Encoding.h"
#include "gettext.h"
-#include "frontend_helpers.h" // getSecond()
#include "Language.h"
#include "LyXRC.h" // defaultUnit
#include "TextClassList.h"
#include "support/lstrings.h"
+#include <boost/bind.hpp>
+
#include <QCloseEvent>
#include <QScrollBar>
#include <QTextCursor>
using std::string;
+///
+template<class Pair>
+std::vector<typename Pair::second_type> const
+getSecond(std::vector<Pair> const & pr)
+{
+ std::vector<typename Pair::second_type> tmp(pr.size());
+ std::transform(pr.begin(), pr.end(), tmp.begin(),
+ boost::bind(&Pair::second, _1));
+ return tmp;
+}
+
char const * const tex_graphics[] =
{
"default", "dvips", "dvitops", "emtex",
#include "qt_helpers.h"
#include "Validator.h"
-#include "controllers/frontend_helpers.h"
-
#include "insets/InsetGraphicsParams.h"
#include "support/convert.h"
#include "support/lyxlib.h"
#include "support/os.h"
+#include <boost/bind.hpp>
+
#include <QCheckBox>
#include <QCloseEvent>
#include <QLabel>
return tmp;
}
+///
+template<class Pair>
+std::vector<typename Pair::second_type> const
+getSecond(std::vector<Pair> const & pr)
+{
+ std::vector<typename Pair::second_type> tmp(pr.size());
+ std::transform(pr.begin(), pr.end(), tmp.begin(),
+ boost::bind(&Pair::second, _1));
+ return tmp;
+}
+
GuiGraphicsDialog::GuiGraphicsDialog(LyXView & lv)
: GuiDialog(lv, "graphics")
{
//
/////////////////////////////////////////////////////////////////////
-// FIXME: move to frontend_helpers.h
-
template<class A>
static size_t findPos_helper(std::vector<A> const & vec, A const & val)
{
// store the lang identifiers for later
std::vector<LanguagePair> const langs = frontend::getLanguageData(false);
- lang_ = getSecond(langs);
-
std::vector<LanguagePair>::const_iterator lit = langs.begin();
std::vector<LanguagePair>::const_iterator lend = langs.end();
+ lang_.clear();
for (; lit != lend; ++lit) {
defaultLanguageCO->addItem(toqstr(lit->first));
+ lang_.push_back(lit->second);
}
}
#include "FuncRequest.h"
#include "LaTeXFeatures.h"
-#include "frontends/controllers/frontend_helpers.h"
-
#include "support/fs_extras.h"
#include "support/lstrings.h"
vector<string> const init_possible_cite_commands()
{
- char const * const pos[] = {
+ char const * const possible[] = {
"cite", "citet", "citep", "citealt", "citealp",
"citeauthor", "citeyear", "citeyearpar",
"citet*", "citep*", "citealt*", "citealp*", "citeauthor*",
"footcitealp", "footciteauthor", "footciteyear", "footciteyearpar",
"citefield", "citetitle", "cite*"
};
- size_t const size_pos = sizeof(pos) / sizeof(pos[0]);
+ size_t const size_possible = sizeof(possible) / sizeof(possible[0]);
- return vector<string>(pos, pos + size_pos);
+ return vector<string>(possible, possible + size_possible);
}
vector<string> const & possible_cite_commands()
{
- static vector<string> const pos = init_possible_cite_commands();
- return pos;
+ static vector<string> const possible = init_possible_cite_commands();
+ return possible;
}
}
-namespace {
-
-docstring const cleanupWhitespace(docstring const & citelist)
+static docstring const cleanupWhitespace(docstring const & citelist)
{
docstring::const_iterator it = citelist.begin();
docstring::const_iterator end = citelist.end();
return result;
}
-// end anon namyspace
-}
int InsetCitation::docbook(Buffer const &, odocstream & os,
OutputParams const &) const