Stephan Witt
2011-01-03 11:52:12 UTC
But somehow there is a connection between visibility flags and the
toolbar type, isn't it? The allowauto_ flag depends on visibility.
This looks a little bit weird.
Yes, this is just an example of bad programming practice.toolbar type, isn't it? The allowauto_ flag depends on visibility.
This looks a little bit weird.
In the Visibility enum, we are now mixing up flags indicating where to
show and when to show a toolbar. This seems bad, but ok.
But then GuiToolbar::setVisibility says that all items in the
Visibility enum >= Toolbars::MATH are auto_toggling. This is just bad,
because someone else adds a new item to the Visibility enum and can't
possibly know that somewhere else in the code, this new item implies a
different behaviour because it's added to the end.
So, when the SAMEROW flag is set, we also set allow_auto_, which is a BUG.
{{{
...
enum Visibility {
....
ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE;
...
}
allowauto_ = visibility & Toolbars::ALLOWAUTO;
}}}
Furthermore, I'm not sure yet what causes the bug, because it seems
that if the user sets the toolbar visibility from within LyX, this
setting is lost again on the new start-up of LyX.
The wrong settings are saved again?that if the user sets the toolbar visibility from within LyX, this
setting is lost again on the new start-up of LyX.
Perhaps it's not a failure of restoreSession but a save of wrong
toolbar settings. I cannot tell for sure.
I'm sure in the saved preferences all toolbar visibility settings
had a 0 assigned when I had the problem. And I can trigger the
misbehavior when saving a 0 with the property list editor.
In any case it shouldn't happen that visibility is restored as 0.
No, if we can't restore from QSettings, we should set the visibilityto the default I guess.
The removed private name_ member in GuiToolbar.h isn't used anywhere.
@Abdel: I don't have the energy to start with a git repository somewhere.
Either I apply it to svn or you or Vincent take over.
The patch is attached.
Stephan