cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23553 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-08 08:20:36 +00:00
parent be624b3de0
commit 8be59017cf
3 changed files with 24 additions and 26 deletions

View File

@ -40,15 +40,12 @@
#include "support/Package.h" #include "support/Package.h"
#include "support/types.h" #include "support/types.h"
#include <boost/bind.hpp>
#include <QCheckBox> #include <QCheckBox>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <QValidator> #include <QValidator>
#include <algorithm>
#include <cmath> #include <cmath>
#include <utility> #include <utility>
@ -84,27 +81,30 @@ static void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
lengthCombo->currentLengthItem()); lengthCombo->currentLengthItem());
} }
template<class Pair> template<class Pair>
vector<typename Pair::first_type> const vector<typename Pair::first_type> getFirst(vector<Pair> const & pr)
getFirst(vector<Pair> const & pr)
{ {
vector<typename Pair::first_type> tmp(pr.size()); size_t const n = pr.size();
transform(pr.begin(), pr.end(), tmp.begin(), vector<typename Pair::first_type> tmp(n);
boost::bind(&Pair::first, _1)); for (size_t i = 0; i != n; ++i)
tmp[i] = pr[i].first;
return tmp; return tmp;
} }
/// ///
template<class Pair> template<class Pair>
vector<typename Pair::second_type> const vector<typename Pair::second_type> getSecond(vector<Pair> const & pr)
getSecond(vector<Pair> const & pr)
{ {
vector<typename Pair::second_type> tmp(pr.size()); size_t const n = pr.size();
transform(pr.begin(), pr.end(), tmp.begin(), vector<typename Pair::second_type> tmp(n);
boost::bind(&Pair::second, _1)); for (size_t i = 0; i != n; ++i)
tmp[i] = pr[i].second;
return tmp; return tmp;
} }
/// The (tranlated) GUI string and it's LaTeX equivalent. /// The (tranlated) GUI string and it's LaTeX equivalent.
typedef pair<docstring, string> RotationOriginPair; typedef pair<docstring, string> RotationOriginPair;
/// ///

View File

@ -51,8 +51,6 @@
#include "support/gettext.h" #include "support/gettext.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include <boost/bind.hpp>
#include "qt_helpers.h" #include "qt_helpers.h"
#include <QCursor> #include <QCursor>
@ -62,7 +60,6 @@
#include <ostream> #include <ostream>
using namespace std; using namespace std;
using boost::bind;
using namespace lyx::support; using namespace lyx::support;
@ -263,7 +260,7 @@ MenuItem::~MenuItem()
{} {}
void MenuItem::submenu(Menu * menu) void MenuItem::setSubmenu(Menu * menu)
{ {
submenu_.reset(menu); submenu_.reset(menu);
} }
@ -526,12 +523,13 @@ MenuItem const & Menu::operator[](size_type i) const
bool Menu::hasFunc(FuncRequest const & func) const bool Menu::hasFunc(FuncRequest const & func) const
{ {
return find_if(begin(), end(), for (const_iterator it = begin(), et = end(); it != et; ++it)
bind(equal_to<FuncRequest>(), if (it->func() == func)
bind(&MenuItem::func, _1), return true;
func)) != end(); return false;
} }
void Menu::checkShortcuts() const void Menu::checkShortcuts() const
{ {
// This is a quadratic algorithm, but we do not care because // This is a quadratic algorithm, but we do not care because
@ -843,7 +841,7 @@ void expandToc2(Menu & tomenu, Toc const & toc_list,
label, FuncRequest(toc_list[pos].action()))); label, FuncRequest(toc_list[pos].action())));
} else { } else {
MenuItem item(MenuItem::Submenu, label); MenuItem item(MenuItem::Submenu, label);
item.submenu(new Menu); item.setSubmenu(new Menu);
expandToc2(*item.submenu(), expandToc2(*item.submenu(),
toc_list, pos, new_pos, depth + 1); toc_list, pos, new_pos, depth + 1);
tomenu.add(item); tomenu.add(item);
@ -925,7 +923,7 @@ void expandToc(Menu & tomenu, Buffer const * buf)
else else
label = qt_("Other floats"); label = qt_("Other floats");
MenuItem item(MenuItem::Submenu, label); MenuItem item(MenuItem::Submenu, label);
item.submenu(menu.release()); item.setSubmenu(menu.release());
tomenu.add(item); tomenu.add(item);
} }
@ -1082,7 +1080,7 @@ void Menus::expand(Menu const & frommenu, Menu & tomenu,
case MenuItem::Submenu: { case MenuItem::Submenu: {
MenuItem item(*cit); MenuItem item(*cit);
item.submenu(new Menu(cit->submenuname())); item.setSubmenu(new Menu(cit->submenuname()));
expand(getMenu(cit->submenuname()), expand(getMenu(cit->submenuname()),
*item.submenu(), buf); *item.submenu(), buf);
tomenu.addWithStatusCheck(item); tomenu.addWithStatusCheck(item);

View File

@ -135,7 +135,7 @@ public:
/// ///
Menu * submenu() const { return submenu_.get(); } Menu * submenu() const { return submenu_.get(); }
/// ///
void submenu(Menu * menu); void setSubmenu(Menu * menu);
private: private:
/// ///