I have created a patch at https://www.lyx.org/trac/ticket/10283.

On 23.09.2016 00:47, Guillaume Munch wrote:
Le 22/09/2016 à 09:18, racoon a écrit :
On 21.09.2016 17:24, Guillaume Munch wrote:
* I expected to find the lock toolbar option when right-clicking on the
toolbars. Do you know where to add this?

Yes, I do. But I think it should be like this:

1. There should be a LFUN for setting the icon size.
2. The four default icon sizes from the widget (LyX main window) context
menu should go to the Toolbars menu.
3. The whole Toolbars menu should appear when the widget's context menu
is opened.

I see what you mean. It really depends on how much effort you are ready
to put into this. It might be overkill.

I have not touched the context menu yet. I think that a separate issue. And I don't know at the moment how to fix it.

 GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiView & owner)
-    : QToolBar(toqstr(tbinfo.gui_name), &owner), visibility_(0),
+    : QToolBar(toqstr(tbinfo.gui_name), &owner), visibility_(0),
movability_(0),

I think this new variable is redundant with isMovable()/setMovable()
from qt and can be made without.

I just did a copy of the visibility for movability. I am also not sure
how to replace its functionality.

GuiToolbar inherits QToolBar::isMovable() whose value happens to
coincide with movability_ in your patch.

I have fixed this in the patch.

+    case LFUN_TOOLBAR_MOVABLE: {
+        string const name = cmd.getArg(0);
+        // use negation since locked == !movable
+        if (name == "*") {
+            // toolbar name * locks all toolbars
+            flag.setOnOff(!toolbarsMovable);
+

There must be a bug here because it is always shown as "on" for me.

I don't understand what is always "on" here. The "Lock Toolbars
Positions" menu entry does get checked and unchecked, right?

It's always checked for me, I don't really know why. But it correctly
switches movable status.

It works for me. So I don't know what to do about this really.

Actually I wonder whether it's useful to store the flag and update it
by hand, since it is not very expensive to compute it every time. Having
this flag looks like a premature optimisation.

I thought it is needed for the "Lock Toolbars Positions". Don't know how
to do without.

Instead of a member variable bool toolbarsMovable you could have a
function bool toolbarsMovable() const, that would compute the value as
you did previously.

I don't know at the moment how to do this. But it sounds easy.

Daniel

Reply via email to