* Menus.cpp:

- show name of default format.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31313 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-09-06 14:28:17 +00:00
parent 2c679d1481
commit 009cb16a41
2 changed files with 38 additions and 19 deletions

View File

@ -309,12 +309,10 @@ Menuset
Item "Fold Math Macro|d" "math-macro-fold"
Separator
Item "View Source|S" "dialog-toggle view-source"
Item "View Output|V" "buffer-view"
Item "Update Output|U" "buffer-update"
ViewFormats
UpdateFormats
OptItem "View Master Document|M" "master-buffer-view"
OptItem "Update Master Document|a" "master-buffer-update"
Submenu "View (Other Formats)|F" "view_others"
Submenu "Update (Other Formats)|p" "view_update"
Separator
Item "Split View Into Left and Right Half|i" "split-view horizontal"
Item "Split View Into Upper and Lower Half|e" "split-view vertical"
@ -325,14 +323,6 @@ Menuset
Documents
End
Menu "view_others"
ViewFormats
End
Menu "view_update"
UpdateFormats
End
Menu "toolbars"
Toolbars
End

View File

@ -851,6 +851,17 @@ void MenuDefinition::expandFormats(MenuItem::Kind kind, Buffer const * buf)
}
sort(formats.begin(), formats.end(), &compareFormat);
bool const view_update = (kind == MenuItem::ViewFormats
|| kind == MenuItem::UpdateFormats);
QString smenue;
if (view_update)
smenue = (kind == MenuItem::ViewFormats ?
qt_("View [Other Formats]|F")
: qt_("Update [Other Formats]|p"));
MenuItem item(MenuItem::Submenu, smenue);
item.setSubmenu(MenuDefinition(smenue));
Formats::const_iterator fit = formats.begin();
Formats::const_iterator end = formats.end();
for (; fit != end ; ++fit) {
@ -878,8 +889,15 @@ void MenuDefinition::expandFormats(MenuItem::Kind kind, Buffer const * buf)
break;
case MenuItem::ViewFormats:
case MenuItem::UpdateFormats:
if ((*fit)->name() == buf->getDefaultOutputFormat())
if ((*fit)->name() == buf->getDefaultOutputFormat()) {
docstring lbl = (kind == MenuItem::ViewFormats ?
bformat(_("View [%1$s]"), qstring_to_ucs4(label))
: bformat(_("Update [%1$s]"), qstring_to_ucs4(label)));
MenuItem w(MenuItem::Command, toqstr(lbl),
FuncRequest(action, (*fit)->name()));
add(w);
continue;
}
case MenuItem::ExportFormats:
if (!(*fit)->documentFormat())
continue;
@ -891,13 +909,24 @@ void MenuDefinition::expandFormats(MenuItem::Kind kind, Buffer const * buf)
if (!shortcut.isEmpty())
label += '|' + shortcut;
if (buf)
addWithStatusCheck(MenuItem(MenuItem::Command, label,
FuncRequest(action, (*fit)->name())));
else
add(MenuItem(MenuItem::Command, label,
FuncRequest(action, (*fit)->name())));
if (view_update) {
if (buf)
item.submenu().addWithStatusCheck(MenuItem(MenuItem::Command, label,
FuncRequest(action, (*fit)->name())));
else
item.submenu().add(MenuItem(MenuItem::Command, label,
FuncRequest(action, (*fit)->name())));
} else {
if (buf)
addWithStatusCheck(MenuItem(MenuItem::Command, label,
FuncRequest(action, (*fit)->name())));
else
add(MenuItem(MenuItem::Command, label,
FuncRequest(action, (*fit)->name())));
}
}
if (view_update)
add(item);
}