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

View File

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

View File

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