mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* frontends/LyXView.h:
* frontends/qt4/GuiView.C: * frontends/qt4/GuiView.h: * frontends/qt4/QLToolbar.C: * frontends/Toolbars.C: * frontends/Toolbars.h: * ToolbarBackend.C: use better names for ToolbarInfo variables git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17894 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4eb04fdbc1
commit
db36eae4c0
@ -42,9 +42,9 @@ class ToolbarNamesEqual : public std::unary_function<ToolbarInfo, bool> {
|
||||
public:
|
||||
ToolbarNamesEqual(string const & name)
|
||||
: name_(name) {}
|
||||
bool operator()(ToolbarInfo const & tb) const
|
||||
bool operator()(ToolbarInfo const & tbinfo) const
|
||||
{
|
||||
return tb.name == name_;
|
||||
return tbinfo.name == name_;
|
||||
}
|
||||
private:
|
||||
string name_;
|
||||
@ -236,9 +236,9 @@ void ToolbarBackend::readToolbars(LyXLex & lex)
|
||||
while (lex.isOK() && !quit) {
|
||||
switch (lex.lex()) {
|
||||
case TO_TOOLBAR: {
|
||||
ToolbarInfo tb;
|
||||
tb.read(lex);
|
||||
toolbars.push_back(tb);
|
||||
ToolbarInfo tbinfo;
|
||||
tbinfo.read(lex);
|
||||
toolbars.push_back(tbinfo);
|
||||
break;
|
||||
}
|
||||
case TO_ENDTOOLBARSET:
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
/// show busy cursor
|
||||
virtual void busy(bool) = 0;
|
||||
|
||||
virtual Toolbars::ToolbarPtr makeToolbar(ToolbarInfo const & tbb, bool newline) = 0;
|
||||
virtual Toolbars::ToolbarPtr makeToolbar(ToolbarInfo const & tbinfo, bool newline) = 0;
|
||||
|
||||
//@{ generic accessor functions
|
||||
|
||||
|
@ -40,11 +40,11 @@ Toolbars::Toolbars(LyXView & owner)
|
||||
#define TurnOnFlag(x) flags |= ToolbarInfo::x
|
||||
#define TurnOffFlag(x) flags &= ~ToolbarInfo::x
|
||||
|
||||
void Toolbars::initFlags(ToolbarInfo & tbb)
|
||||
void Toolbars::initFlags(ToolbarInfo & tbinfo)
|
||||
{
|
||||
ToolbarSection::ToolbarInfo & info = LyX::ref().session().toolbars().load(tbb.name);
|
||||
ToolbarSection::ToolbarInfo & info = LyX::ref().session().toolbars().load(tbinfo.name);
|
||||
|
||||
unsigned int flags = static_cast<unsigned int>(tbb.flags);
|
||||
unsigned int flags = static_cast<unsigned int>(tbinfo.flags);
|
||||
|
||||
// Remove default.ui positions. Only when a valid postion is stored
|
||||
// in the session file the default.ui value will be overwritten
|
||||
@ -55,7 +55,7 @@ void Toolbars::initFlags(ToolbarInfo & tbb)
|
||||
TurnOffFlag(LEFT);
|
||||
|
||||
bool valid_location = true;
|
||||
// init tbb.flags with saved location
|
||||
// init tbinfo.flags with saved location
|
||||
if (info.location == ToolbarSection::ToolbarInfo::TOP)
|
||||
TurnOnFlag(TOP);
|
||||
else if (info.location == ToolbarSection::ToolbarInfo::BOTTOM)
|
||||
@ -73,7 +73,7 @@ void Toolbars::initFlags(ToolbarInfo & tbb)
|
||||
// invalid location is for a new toolbar that has no saved information,
|
||||
// so info.visible is not used for this case.
|
||||
if (valid_location) {
|
||||
// init tbb.flags with saved visibility,
|
||||
// init tbinfo.flags with saved visibility,
|
||||
TurnOffFlag(ON);
|
||||
TurnOffFlag(OFF);
|
||||
TurnOffFlag(AUTO);
|
||||
@ -99,7 +99,7 @@ void Toolbars::initFlags(ToolbarInfo & tbb)
|
||||
<< std::endl;
|
||||
*/
|
||||
// now set the flags
|
||||
tbb.flags = static_cast<lyx::ToolbarInfo::Flags>(flags);
|
||||
tbinfo.flags = static_cast<lyx::ToolbarInfo::Flags>(flags);
|
||||
}
|
||||
|
||||
|
||||
@ -316,12 +316,12 @@ void Toolbars::clearLayoutList()
|
||||
}
|
||||
|
||||
|
||||
void Toolbars::add(ToolbarInfo const & tbb, bool newline)
|
||||
void Toolbars::add(ToolbarInfo const & tbinfo, bool newline)
|
||||
{
|
||||
ToolbarPtr tb_ptr = owner_.makeToolbar(tbb, newline);
|
||||
toolbars_[tbb.name] = tb_ptr;
|
||||
ToolbarPtr tb_ptr = owner_.makeToolbar(tbinfo, newline);
|
||||
toolbars_[tbinfo.name] = tb_ptr;
|
||||
|
||||
if (tbb.flags & ToolbarInfo::ON)
|
||||
if (tbinfo.flags & ToolbarInfo::ON)
|
||||
tb_ptr->show(false);
|
||||
else
|
||||
tb_ptr->hide(false);
|
||||
@ -331,10 +331,10 @@ void Toolbars::add(ToolbarInfo const & tbb, bool newline)
|
||||
}
|
||||
|
||||
|
||||
void Toolbars::displayToolbar(ToolbarInfo const & tbb,
|
||||
void Toolbars::displayToolbar(ToolbarInfo const & tbinfo,
|
||||
bool show_it)
|
||||
{
|
||||
ToolbarsMap::iterator it = toolbars_.find(tbb.name);
|
||||
ToolbarsMap::iterator it = toolbars_.find(tbinfo.name);
|
||||
BOOST_ASSERT(it != toolbars_.end());
|
||||
|
||||
if (show_it)
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
/** update toolbar information
|
||||
* ToolbarInfo will then be saved by session
|
||||
*/
|
||||
virtual void saveInfo(ToolbarSection::ToolbarInfo & info) = 0;
|
||||
virtual void saveInfo(ToolbarSection::ToolbarInfo & tbinfo) = 0;
|
||||
|
||||
/// Refresh the contents of the bar.
|
||||
virtual void update() = 0;
|
||||
@ -118,9 +118,9 @@ public:
|
||||
|
||||
private:
|
||||
/// Add a new toolbar. if newline==true, start from a new line
|
||||
void add(ToolbarInfo const & tb, bool newline);
|
||||
void add(ToolbarInfo const & tbinfo, bool newline);
|
||||
/// Show or hide a toolbar.
|
||||
void displayToolbar(ToolbarInfo const & tb, bool show);
|
||||
void displayToolbar(ToolbarInfo const & tbinfo, bool show);
|
||||
/// Update the state of the icons
|
||||
void update();
|
||||
|
||||
@ -144,7 +144,7 @@ private:
|
||||
int last_textclass_;
|
||||
|
||||
// load flags with saved values
|
||||
void initFlags(ToolbarInfo & tbb);
|
||||
void initFlags(ToolbarInfo & tbinfo);
|
||||
};
|
||||
|
||||
/// Set the layout in the kernel when an entry has been selected
|
||||
|
@ -695,17 +695,17 @@ void GuiView::busy(bool yes)
|
||||
}
|
||||
|
||||
|
||||
Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarInfo const & tbb, bool newline)
|
||||
Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarInfo const & tbinfo, bool newline)
|
||||
{
|
||||
QLToolbar * Tb = new QLToolbar(tbb, *this);
|
||||
QLToolbar * Tb = new QLToolbar(tbinfo, *this);
|
||||
|
||||
if (tbb.flags & ToolbarInfo::TOP) {
|
||||
if (tbinfo.flags & ToolbarInfo::TOP) {
|
||||
if (newline)
|
||||
addToolBarBreak(Qt::TopToolBarArea);
|
||||
addToolBar(Qt::TopToolBarArea, Tb);
|
||||
}
|
||||
|
||||
if (tbb.flags & ToolbarInfo::BOTTOM) {
|
||||
if (tbinfo.flags & ToolbarInfo::BOTTOM) {
|
||||
// Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
|
||||
#if (QT_VERSION >= 0x040202)
|
||||
if (newline)
|
||||
@ -714,7 +714,7 @@ Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarInfo const & tbb, bool newline)
|
||||
addToolBar(Qt::BottomToolBarArea, Tb);
|
||||
}
|
||||
|
||||
if (tbb.flags & ToolbarInfo::LEFT) {
|
||||
if (tbinfo.flags & ToolbarInfo::LEFT) {
|
||||
// Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
|
||||
#if (QT_VERSION >= 0x040202)
|
||||
if (newline)
|
||||
@ -723,7 +723,7 @@ Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarInfo const & tbb, bool newline)
|
||||
addToolBar(Qt::LeftToolBarArea, Tb);
|
||||
}
|
||||
|
||||
if (tbb.flags & ToolbarInfo::RIGHT) {
|
||||
if (tbinfo.flags & ToolbarInfo::RIGHT) {
|
||||
// Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
|
||||
#if (QT_VERSION >= 0x040202)
|
||||
if (newline)
|
||||
@ -732,10 +732,10 @@ Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarInfo const & tbb, bool newline)
|
||||
addToolBar(Qt::RightToolBarArea, Tb);
|
||||
}
|
||||
|
||||
// The following does not work so I can not restore to exact toolbar location
|
||||
// The following does not work so I cannot restore to exact toolbar location
|
||||
/*
|
||||
ToolbarSection::ToolbarInfo & info = LyX::ref().session().toolbars().load(tbb.name);
|
||||
Tb->move(info.posx, info.posy);
|
||||
ToolbarSection::ToolbarInfo & tbinfo = LyX::ref().session().toolbars().load(tbinfo.name);
|
||||
Tb->move(tbinfo.posx, tbinfo.posy);
|
||||
*/
|
||||
|
||||
return Toolbars::ToolbarPtr(Tb);
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
virtual void saveGeometry();
|
||||
virtual void busy(bool);
|
||||
/// add toolbar, if newline==true, add a toolbar break before the toolbar
|
||||
Toolbars::ToolbarPtr makeToolbar(ToolbarInfo const & tbb, bool newline);
|
||||
Toolbars::ToolbarPtr makeToolbar(ToolbarInfo const & tbinfo, bool newline);
|
||||
virtual void updateStatusBar();
|
||||
virtual void message(lyx::docstring const & str);
|
||||
virtual void clearMessage();
|
||||
|
@ -161,8 +161,8 @@ void QLayoutBox::selected(const QString & str)
|
||||
}
|
||||
|
||||
|
||||
QLToolbar::QLToolbar(ToolbarInfo const & tbb, GuiView & owner)
|
||||
: QToolBar(qt_(tbb.gui_name), &owner), owner_(owner)
|
||||
QLToolbar::QLToolbar(ToolbarInfo const & tbinfo, GuiView & owner)
|
||||
: QToolBar(qt_(tbinfo.gui_name), &owner), owner_(owner)
|
||||
{
|
||||
// give visual separation between adjacent toolbars
|
||||
addSeparator();
|
||||
@ -170,8 +170,8 @@ QLToolbar::QLToolbar(ToolbarInfo const & tbb, GuiView & owner)
|
||||
// TODO: save toolbar position
|
||||
setMovable(true);
|
||||
|
||||
ToolbarInfo::item_iterator it = tbb.items.begin();
|
||||
ToolbarInfo::item_iterator end = tbb.items.end();
|
||||
ToolbarInfo::item_iterator it = tbinfo.items.begin();
|
||||
ToolbarInfo::item_iterator end = tbinfo.items.end();
|
||||
for (; it != end; ++it)
|
||||
add(*it);
|
||||
}
|
||||
@ -215,9 +215,9 @@ void QLToolbar::add(ToolbarItem const & item)
|
||||
|
||||
IconPalette * panel = new IconPalette(tb);
|
||||
connect(this, SIGNAL(updated()), panel, SLOT(updateParent()));
|
||||
ToolbarInfo const & tbb = toolbarbackend.getToolbar(item.name_);
|
||||
ToolbarInfo::item_iterator it = tbb.items.begin();
|
||||
ToolbarInfo::item_iterator const end = tbb.items.end();
|
||||
ToolbarInfo const & tbinfo = toolbarbackend.getToolbar(item.name_);
|
||||
ToolbarInfo::item_iterator it = tbinfo.items.begin();
|
||||
ToolbarInfo::item_iterator const end = tbinfo.items.end();
|
||||
for (; it != end; ++it)
|
||||
if (!lyx::getStatus(it->func_).unknown()) {
|
||||
Action * action = new Action(owner_,
|
||||
@ -228,7 +228,7 @@ void QLToolbar::add(ToolbarItem const & item)
|
||||
panel->addButton(action);
|
||||
ActionVector.push_back(action);
|
||||
// use the icon of first action for the toolbar button
|
||||
if (it == tbb.items.begin())
|
||||
if (it == tbinfo.items.begin())
|
||||
tb->setIcon(QPixmap(getIcon(it->func_).c_str()));
|
||||
}
|
||||
connect(tb, SIGNAL(clicked(bool)), panel, SLOT(setVisible(bool)));
|
||||
@ -249,9 +249,9 @@ void QLToolbar::add(ToolbarItem const & item)
|
||||
|
||||
ButtonMenu * m = new ButtonMenu(toqstr(item.label_), tb);
|
||||
connect(this, SIGNAL(updated()), m, SLOT(updateParent()));
|
||||
ToolbarInfo const & tbb = toolbarbackend.getToolbar(item.name_);
|
||||
ToolbarInfo::item_iterator it = tbb.items.begin();
|
||||
ToolbarInfo::item_iterator const end = tbb.items.end();
|
||||
ToolbarInfo const & tbinfo = toolbarbackend.getToolbar(item.name_);
|
||||
ToolbarInfo::item_iterator it = tbinfo.items.begin();
|
||||
ToolbarInfo::item_iterator const end = tbinfo.items.end();
|
||||
for (; it != end; ++it)
|
||||
if (!lyx::getStatus(it->func_).unknown()) {
|
||||
Action * action = new Action(owner_,
|
||||
@ -297,34 +297,34 @@ void QLToolbar::show(bool)
|
||||
}
|
||||
|
||||
|
||||
void QLToolbar::saveInfo(ToolbarSection::ToolbarInfo & info)
|
||||
void QLToolbar::saveInfo(ToolbarSection::ToolbarInfo & tbinfo)
|
||||
{
|
||||
// if info.state == auto *do not* set on/off
|
||||
if (info.state != ToolbarSection::ToolbarInfo::AUTO) {
|
||||
// if tbinfo.state == auto *do not* set on/off
|
||||
if (tbinfo.state != ToolbarSection::ToolbarInfo::AUTO) {
|
||||
if (QLToolbar::isVisible())
|
||||
info.state = ToolbarSection::ToolbarInfo::ON;
|
||||
tbinfo.state = ToolbarSection::ToolbarInfo::ON;
|
||||
else
|
||||
info.state = ToolbarSection::ToolbarInfo::OFF;
|
||||
tbinfo.state = ToolbarSection::ToolbarInfo::OFF;
|
||||
}
|
||||
//
|
||||
// no need to save it here.
|
||||
Qt::ToolBarArea loc = owner_.toolBarArea(this);
|
||||
|
||||
if (loc == Qt::TopToolBarArea)
|
||||
info.location = ToolbarSection::ToolbarInfo::TOP;
|
||||
tbinfo.location = ToolbarSection::ToolbarInfo::TOP;
|
||||
else if (loc == Qt::BottomToolBarArea)
|
||||
info.location = ToolbarSection::ToolbarInfo::BOTTOM;
|
||||
tbinfo.location = ToolbarSection::ToolbarInfo::BOTTOM;
|
||||
else if (loc == Qt::RightToolBarArea)
|
||||
info.location = ToolbarSection::ToolbarInfo::RIGHT;
|
||||
tbinfo.location = ToolbarSection::ToolbarInfo::RIGHT;
|
||||
else if (loc == Qt::LeftToolBarArea)
|
||||
info.location = ToolbarSection::ToolbarInfo::LEFT;
|
||||
tbinfo.location = ToolbarSection::ToolbarInfo::LEFT;
|
||||
else
|
||||
info.location = ToolbarSection::ToolbarInfo::NOTSET;
|
||||
tbinfo.location = ToolbarSection::ToolbarInfo::NOTSET;
|
||||
|
||||
// save toolbar position. They are not used to restore toolbar position
|
||||
// now because move(x,y) does not work for toolbar.
|
||||
info.posx = pos().x();
|
||||
info.posy = pos().y();
|
||||
tbinfo.posx = pos().x();
|
||||
tbinfo.posy = pos().y();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user