X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FMenuBackend.cpp;h=7865786ff3ff326297b4c0c1e704c8a5aeead262;hb=38a3692a0fce8b0531cef794a08d179e9e33ac33;hp=bde9cc0a7b3262aa76bf9e933696476876c9995c;hpb=897436efbb9bd641b61467d185a2dfae9839e575;p=lyx.git diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index bde9cc0a7b..7865786ff3 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -460,7 +460,7 @@ void expandDocuments(Menu & tomenu) Strings const names = theBufferList().getFileNames(); if (names.empty()) { - tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"), + tomenu.add(MenuItem(MenuItem::Command, _("No Document Open!"), FuncRequest(LFUN_NOACTION))); return; } @@ -497,7 +497,7 @@ void expandFormats(MenuItem::Kind kind, Menu & tomenu, Buffer const * buf) { if (!buf && kind != MenuItem::ImportFormats) { tomenu.add(MenuItem(MenuItem::Command, - _("No Documents Open!"), + _("No Document Open!"), FuncRequest(LFUN_NOACTION))); return; } @@ -569,7 +569,7 @@ void expandFloatListInsert(Menu & tomenu, Buffer const * buf) { if (!buf) { tomenu.add(MenuItem(MenuItem::Command, - _("No Documents Open!"), + _("No Document Open!"), FuncRequest(LFUN_NOACTION))); return; } @@ -591,7 +591,7 @@ void expandFloatInsert(Menu & tomenu, Buffer const * buf) { if (!buf) { tomenu.add(MenuItem(MenuItem::Command, - _("No Documents Open!"), + _("No Document Open!"), FuncRequest(LFUN_NOACTION))); return; } @@ -614,7 +614,7 @@ void expandCharStyleInsert(Menu & tomenu, Buffer const * buf) { if (!buf) { tomenu.add(MenuItem(MenuItem::Command, - _("No Documents Open!"), + _("No Document Open!"), FuncRequest(LFUN_NOACTION))); return; } @@ -700,11 +700,15 @@ void expandToc(Menu & tomenu, Buffer const * buf) if (!buf) { tomenu.add(MenuItem(MenuItem::Command, - _("No Documents Open!"), + _("No Document Open!"), FuncRequest(LFUN_NOACTION))); return; } + Buffer* cbuf = const_cast(buf); + cbuf->tocBackend().update(); + cbuf->structureChanged(); + // Add an entry for the master doc if this is a child doc Buffer const * const master = buf->getMasterBuffer(); if (buf != master) { @@ -789,9 +793,10 @@ void expandToolbars(Menu & tomenu) for (; cit != end; ++cit) { docstring label = _(cit->gui_name); - // frontends are not supposed to turn on/off toolbars, if they cannot - // update ToolbarBackend::flags. That is to say, ToolbarsBackend::flags - // should reflect the true state of toolbars. + // frontends are not supposed to turn on/off toolbars, + // if they cannot update ToolbarBackend::flags. That + // is to say, ToolbarsBackend::flags should reflect + // the true state of toolbars. // // menu is displayed as // on/off review @@ -801,17 +806,27 @@ void expandToolbars(Menu & tomenu) if (cit->flags & ToolbarInfo::AUTO) label += _(" (auto)"); tomenu.add(MenuItem(MenuItem::Command, label, - FuncRequest(LFUN_TOOLBAR_TOGGLE_STATE, cit->name))); + FuncRequest(LFUN_TOOLBAR_TOGGLE, cit->name + " allowauto"))); } } void expandBranches(Menu & tomenu, Buffer const * buf) { - if (!buf) + if (!buf) { + tomenu.add(MenuItem(MenuItem::Command, + _("No Document Open!"), + FuncRequest(LFUN_NOACTION))); return; + } BufferParams const & params = buf->getMasterBuffer()->params(); + if (params.branchlist().empty()) { + tomenu.add(MenuItem(MenuItem::Command, + _("No Branch in Document!"), + FuncRequest(LFUN_NOACTION))); + return; + } BranchList::const_iterator cit = params.branchlist().begin(); BranchList::const_iterator end = params.branchlist().end();