mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Slightly better toolbar session restoration, from Jurgen
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16950 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c0fad86431
commit
aaa544313d
@ -690,12 +690,22 @@ void GuiView::busy(bool yes)
|
||||
|
||||
Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarBackend::Toolbar const & tbb)
|
||||
{
|
||||
// get window size
|
||||
int w = width();
|
||||
int h = height();
|
||||
Session & session = LyX::ref().session();
|
||||
string val = session.sessionInfo().load("WindowWidth", false);
|
||||
if (!val.empty())
|
||||
w = convert<unsigned int>(val);
|
||||
val = session.sessionInfo().load("WindowHeight", false);
|
||||
if (!val.empty())
|
||||
h = convert<unsigned int>(val);
|
||||
QLToolbar * Tb = new QLToolbar(tbb, *this);
|
||||
|
||||
if (tbb.flags & ToolbarBackend::TOP) {
|
||||
addToolBar(Qt::TopToolBarArea, Tb);
|
||||
if (toolbarSize_.top_width > 0
|
||||
&& toolbarSize_.top_width + Tb->sizeHint().width() > width()) {
|
||||
&& toolbarSize_.top_width + Tb->sizeHint().width() > w) {
|
||||
insertToolBarBreak(Tb);
|
||||
toolbarSize_.top_width = Tb->sizeHint().width();
|
||||
} else
|
||||
@ -707,7 +717,7 @@ Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarBackend::Toolbar const & tbb)
|
||||
// Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
|
||||
#if (QT_VERSION >= 0x040202)
|
||||
if (toolbarSize_.bottom_width > 0
|
||||
&& toolbarSize_.bottom_width + Tb->sizeHint().width() > width()) {
|
||||
&& toolbarSize_.bottom_width + Tb->sizeHint().width() > w) {
|
||||
insertToolBarBreak(Tb);
|
||||
toolbarSize_.bottom_width = Tb->sizeHint().width();
|
||||
} else
|
||||
@ -720,7 +730,7 @@ Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarBackend::Toolbar const & tbb)
|
||||
// Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
|
||||
#if (QT_VERSION >= 0x040202)
|
||||
if (toolbarSize_.left_height > 0
|
||||
&& toolbarSize_.left_height + Tb->sizeHint().height() > height()) {
|
||||
&& toolbarSize_.left_height + Tb->sizeHint().height() > h) {
|
||||
insertToolBarBreak(Tb);
|
||||
toolbarSize_.left_height = Tb->sizeHint().height();
|
||||
} else
|
||||
@ -733,7 +743,7 @@ Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarBackend::Toolbar const & tbb)
|
||||
// Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
|
||||
#if (QT_VERSION >= 0x040202)
|
||||
if (toolbarSize_.right_height > 0
|
||||
&& toolbarSize_.right_height + Tb->sizeHint().height() > height()) {
|
||||
&& toolbarSize_.right_height + Tb->sizeHint().height() > h) {
|
||||
insertToolBarBreak(Tb);
|
||||
toolbarSize_.right_height = Tb->sizeHint().height();
|
||||
} else
|
||||
|
@ -653,10 +653,10 @@ LyXView * LyX::newLyXView()
|
||||
}
|
||||
// if lyxrc returns (0,0), then use session info
|
||||
else {
|
||||
string val = session().sessionInfo().load("WindowWidth");
|
||||
string val = session().sessionInfo().load("WindowWidth", false);
|
||||
if (!val.empty())
|
||||
width = convert<unsigned int>(val);
|
||||
val = session().sessionInfo().load("WindowHeight");
|
||||
val = session().sessionInfo().load("WindowHeight", false);
|
||||
if (!val.empty())
|
||||
height = convert<unsigned int>(val);
|
||||
if (session().sessionInfo().load("WindowIsMaximized") == "yes")
|
||||
|
Loading…
Reference in New Issue
Block a user