mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-20 06:49:56 +00:00
BUG3127 Toolbar display: restore all toolbars to different lines. Not good but better than the current situation. qt > 4.2.2 is required.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16895 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dfcc879239
commit
66b7c7eebf
@ -691,30 +691,37 @@ void GuiView::busy(bool yes)
|
|||||||
Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarBackend::Toolbar const & tbb)
|
Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarBackend::Toolbar const & tbb)
|
||||||
{
|
{
|
||||||
QLToolbar * Tb = new QLToolbar(tbb, *this);
|
QLToolbar * Tb = new QLToolbar(tbb, *this);
|
||||||
//static QLToolbar * lastTb = 0;
|
|
||||||
|
|
||||||
|
/* NOTE:
|
||||||
|
saved toolbar position can not be restored with simple move(x,y),
|
||||||
|
Consequently, toolbars from different lines will be restore to one
|
||||||
|
line. I therefore add addToolBarBreak after each toolbar to restore
|
||||||
|
toolbars to separate lines, although toolbars in the same line can
|
||||||
|
not be restored correctly.
|
||||||
|
NOTE: qt < 4.2.2 cannot handle addToolBarBreak on non-TOP dock.
|
||||||
|
*/
|
||||||
if (tbb.flags & ToolbarBackend::TOP) {
|
if (tbb.flags & ToolbarBackend::TOP) {
|
||||||
addToolBar(Qt::TopToolBarArea, Tb);
|
addToolBar(Qt::TopToolBarArea, Tb);
|
||||||
addToolBarBreak(Qt::TopToolBarArea);
|
addToolBarBreak(Qt::TopToolBarArea);
|
||||||
}
|
}
|
||||||
if (tbb.flags & ToolbarBackend::BOTTOM) {
|
if (tbb.flags & ToolbarBackend::BOTTOM) {
|
||||||
addToolBar(Qt::BottomToolBarArea, Tb);
|
addToolBar(Qt::BottomToolBarArea, Tb);
|
||||||
/*
|
addToolBarBreak(Qt::BottomToolBarArea);
|
||||||
// Qt bug:
|
|
||||||
// http://www.trolltech.com/developer/task-tracker/index_html?id=137015&method=entry
|
|
||||||
// Doesn't work because the toolbar will evtl. be hidden.
|
|
||||||
if (lastTb)
|
|
||||||
insertToolBarBreak(lastTb);
|
|
||||||
lastTb = Tb;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
if (tbb.flags & ToolbarBackend::LEFT) {
|
if (tbb.flags & ToolbarBackend::LEFT) {
|
||||||
addToolBar(Qt::LeftToolBarArea, Tb);
|
addToolBar(Qt::LeftToolBarArea, Tb);
|
||||||
|
addToolBarBreak(Qt::LeftToolBarArea);
|
||||||
}
|
}
|
||||||
if (tbb.flags & ToolbarBackend::RIGHT) {
|
if (tbb.flags & ToolbarBackend::RIGHT) {
|
||||||
addToolBar(Qt::RightToolBarArea, Tb);
|
addToolBar(Qt::RightToolBarArea, Tb);
|
||||||
|
addToolBarBreak(Qt::RightToolBarArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The following does not work so saved toolbar location can not be used.
|
||||||
|
/*
|
||||||
|
ToolbarSection::ToolbarInfo & info = LyX::ref().session().toolbars().load(tbb.name);
|
||||||
|
Tb->move(info.posx, info.posy);
|
||||||
|
*/
|
||||||
return Toolbars::ToolbarPtr(Tb);
|
return Toolbars::ToolbarPtr(Tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,6 +241,11 @@ void QLToolbar::saveInfo(ToolbarSection::ToolbarInfo & info)
|
|||||||
info.location = ToolbarSection::ToolbarInfo::LEFT;
|
info.location = ToolbarSection::ToolbarInfo::LEFT;
|
||||||
else
|
else
|
||||||
info.location = ToolbarSection::ToolbarInfo::NOTSET;
|
info.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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,11 +332,14 @@ void ToolbarSection::read(istream & is)
|
|||||||
string key = tmp.substr(0, pos);
|
string key = tmp.substr(0, pos);
|
||||||
int state;
|
int state;
|
||||||
int location;
|
int location;
|
||||||
|
int posx;
|
||||||
|
int posy;
|
||||||
istringstream value(tmp.substr(pos + 3));
|
istringstream value(tmp.substr(pos + 3));
|
||||||
value >> state;
|
value >> state;
|
||||||
value.ignore(1); // ignore " "
|
|
||||||
value >> location;
|
value >> location;
|
||||||
toolbars[key] = ToolbarInfo(state, location);
|
value >> posx;
|
||||||
|
value >> posy;
|
||||||
|
toolbars[key] = ToolbarInfo(state, location, posx, posy);
|
||||||
} else
|
} else
|
||||||
lyxerr[Debug::INIT] << "LyX: Warning: Ignore toolbar info: " << tmp << endl;
|
lyxerr[Debug::INIT] << "LyX: Warning: Ignore toolbar info: " << tmp << endl;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -353,7 +356,9 @@ void ToolbarSection::write(ostream & os) const
|
|||||||
tb != toolbars.end(); ++tb) {
|
tb != toolbars.end(); ++tb) {
|
||||||
os << tb->first << " = "
|
os << tb->first << " = "
|
||||||
<< static_cast<int>(tb->second.state) << " "
|
<< static_cast<int>(tb->second.state) << " "
|
||||||
<< static_cast<int>(tb->second.location) << '\n';
|
<< static_cast<int>(tb->second.location) << " "
|
||||||
|
<< tb->second.posx << " "
|
||||||
|
<< tb->second.posy << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,10 +258,14 @@ public:
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
ToolbarInfo() :
|
ToolbarInfo() :
|
||||||
state(ON), location(NOTSET) { }
|
state(ON), location(NOTSET), posx(0), posy(0) { }
|
||||||
///
|
///
|
||||||
ToolbarInfo(int s, int loc) :
|
ToolbarInfo(int s, int loc, int x=0, int y=0) :
|
||||||
state(static_cast<State>(s)), location(static_cast<Location>(loc)) { }
|
state(static_cast<State>(s)),
|
||||||
|
location(static_cast<Location>(loc)),
|
||||||
|
posx(x),
|
||||||
|
posy(y)
|
||||||
|
{ }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum State {
|
enum State {
|
||||||
@ -284,6 +288,12 @@ public:
|
|||||||
|
|
||||||
Location location;
|
Location location;
|
||||||
|
|
||||||
|
/// x-position of the toolbar
|
||||||
|
int posx;
|
||||||
|
|
||||||
|
/// y-position of the toolbar
|
||||||
|
int posy;
|
||||||
|
|
||||||
/// potentially, icons
|
/// potentially, icons
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user