From: André Pönitz Date: Tue, 11 Sep 2007 22:31:24 +0000 (+0000) Subject: remove unnneded #include X-Git-Tag: 1.6.10~8381 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=887bd847c6bc413531c388dbc2fcb26411d2266c;p=lyx.git remove unnneded #include git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20233 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/controllers/ControlTexinfo.cpp b/src/frontends/controllers/ControlTexinfo.cpp index 1d2e7af7a0..0320afdceb 100644 --- a/src/frontends/controllers/ControlTexinfo.cpp +++ b/src/frontends/controllers/ControlTexinfo.cpp @@ -12,6 +12,7 @@ #include "ControlTexinfo.h" #include "FuncRequest.h" +#include "debug.h" #include "support/filetools.h" #include "support/FileName.h" @@ -21,6 +22,7 @@ using std::string; using std::vector; +using std::endl; namespace lyx { namespace frontend { @@ -29,6 +31,9 @@ using support::FileName; using support::contains; using support::split; using support::token; +using support::getExtension; +using support::libFileSearch; +using support::onlyFilename; ControlTexinfo::ControlTexinfo(Dialog & parent) @@ -43,6 +48,47 @@ void ControlTexinfo::viewFile(string const & filename) const } +/// 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")); diff --git a/src/frontends/controllers/ControlTexinfo.h b/src/frontends/controllers/ControlTexinfo.h index f0165a09a3..2a2f9309c8 100644 --- a/src/frontends/controllers/ControlTexinfo.h +++ b/src/frontends/controllers/ControlTexinfo.h @@ -19,8 +19,10 @@ 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: /// diff --git a/src/frontends/controllers/frontend_helpers.cpp b/src/frontends/controllers/frontend_helpers.cpp index 5ff3b865fd..e3b8d3f1e6 100644 --- a/src/frontends/controllers/frontend_helpers.cpp +++ b/src/frontends/controllers/frontend_helpers.cpp @@ -13,28 +13,20 @@ #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 #include #include @@ -50,7 +42,6 @@ namespace frontend { using support::addName; using support::bformat; -using support::contains; using support::FileFilterList; using support::FileName; using support::getExtension; @@ -212,18 +203,6 @@ docstring const browseDir(docstring const & pathname, } -vector const getLatexUnits() -{ - vector 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 @@ -254,55 +233,13 @@ void getTexFileList(string const & filename, std::vector & list) boost::RegEx regex("/{2,}"); std::vector::iterator it = list.begin(); std::vector::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 diff --git a/src/frontends/controllers/frontend_helpers.h b/src/frontends/controllers/frontend_helpers.h index cbaaf0a5aa..03356ad67d 100644 --- a/src/frontends/controllers/frontend_helpers.h +++ b/src/frontends/controllers/frontend_helpers.h @@ -19,25 +19,12 @@ #include #include -#include - namespace lyx { namespace support { class FileFilterList; } namespace frontend { -/// -template -std::vector const -getSecond(std::vector const & pr) -{ - std::vector tmp(pr.size()); - std::transform(pr.begin(), pr.end(), tmp.begin(), - boost::bind(&Pair::second, _1)); - return tmp; -} - /// typedef std::pair LanguagePair; @@ -108,10 +95,6 @@ browseDir(docstring const & pathname, std::make_pair(docstring(), docstring())); -/// Returns a vector of units that can be used to create a valid LaTeX length. -std::vector const getLatexUnits(); - - /** Build filelists of all availabe bst/cls/sty-files. Done through * kpsewhich and an external script, saved in *Files.lst. */ @@ -122,9 +105,6 @@ void rescanTexStyles(); */ void getTexFileList(std::string const & filename, std::vector & 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 diff --git a/src/frontends/qt4/GuiBox.cpp b/src/frontends/qt4/GuiBox.cpp index 0e6b55c3dd..fde1ba6b13 100644 --- a/src/frontends/qt4/GuiBox.cpp +++ b/src/frontends/qt4/GuiBox.cpp @@ -14,17 +14,12 @@ #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" @@ -34,16 +29,11 @@ #include -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") { @@ -210,7 +200,7 @@ void GuiBoxDialog::updateContents() 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++) { @@ -226,7 +216,7 @@ void GuiBoxDialog::updateContents() 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++) { @@ -366,7 +356,7 @@ void GuiBoxDialog::setInnerType(bool frameless, int i) innerBoxCO->setCurrentIndex(i - 1); } else { if (innerBoxCO->count() == 2) - i += 1; + ++i; innerBoxCO->clear(); innerBoxCO->addItem(qt_("None")); innerBoxCO->addItem(qt_("Parbox")); diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index b586395f54..2fb693eba5 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -23,10 +23,10 @@ #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" @@ -36,6 +36,8 @@ #include "support/lstrings.h" +#include + #include #include #include @@ -54,6 +56,17 @@ using std::vector; using std::string; +/// +template +std::vector const +getSecond(std::vector const & pr) +{ + std::vector 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", diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index 4ce719a1a3..577dc77214 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -23,8 +23,6 @@ #include "qt_helpers.h" #include "Validator.h" -#include "controllers/frontend_helpers.h" - #include "insets/InsetGraphicsParams.h" #include "support/convert.h" @@ -32,6 +30,8 @@ #include "support/lyxlib.h" #include "support/os.h" +#include + #include #include #include @@ -69,6 +69,17 @@ getFirst(std::vector const & pr) return tmp; } +/// +template +std::vector const +getSecond(std::vector const & pr) +{ + std::vector 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") { diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 26e23ac4a9..df7959d740 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -70,8 +70,6 @@ namespace frontend { // ///////////////////////////////////////////////////////////////////// -// FIXME: move to frontend_helpers.h - template static size_t findPos_helper(std::vector const & vec, A const & val) { @@ -1609,12 +1607,12 @@ PrefLanguage::PrefLanguage(QWidget * parent) // store the lang identifiers for later std::vector const langs = frontend::getLanguageData(false); - lang_ = getSecond(langs); - std::vector::const_iterator lit = langs.begin(); std::vector::const_iterator lend = langs.end(); + lang_.clear(); for (; lit != lend; ++lit) { defaultLanguageCO->addItem(toqstr(lit->first)); + lang_.push_back(lit->second); } } diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 1cd5c8e4b0..020e2b3689 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -20,8 +20,6 @@ #include "FuncRequest.h" #include "LaTeXFeatures.h" -#include "frontends/controllers/frontend_helpers.h" - #include "support/fs_extras.h" #include "support/lstrings.h" @@ -53,7 +51,7 @@ namespace { vector 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*", @@ -64,16 +62,16 @@ vector const init_possible_cite_commands() "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(pos, pos + size_pos); + return vector(possible, possible + size_possible); } vector const & possible_cite_commands() { - static vector const pos = init_possible_cite_commands(); - return pos; + static vector const possible = init_possible_cite_commands(); + return possible; } @@ -459,9 +457,7 @@ int InsetCitation::plaintext(Buffer const & buffer, odocstream & os, } -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(); @@ -478,8 +474,6 @@ docstring const cleanupWhitespace(docstring const & citelist) return result; } -// end anon namyspace -} int InsetCitation::docbook(Buffer const &, odocstream & os, OutputParams const &) const