/** Commands to separate environments (context menu version). */
EnvironmentSeparatorsContext,
/** This is the list of quotation marks available */
- SwitchQuotes
+ SwitchQuotes,
+ /** Options in the Zoom menu **/
+ ZoomOptions
};
explicit MenuItem(Kind kind) : kind_(kind), optional_(false) {}
void expandFormats(MenuItem::Kind const kind, Buffer const * buf);
void expandFloatListInsert(Buffer const * buf);
void expandFloatInsert(Buffer const * buf);
- void expandFlexInsert(Buffer const * buf, InsetLayout::InsetLyXType type);
+ void expandFlexInsert(Buffer const * buf, InsetLyXType type);
void expandTocSubmenu(std::string const & type, Toc const & toc_list);
void expandToc2(Toc const & toc_list, size_t from, size_t to, int depth, const string & toc_type);
void expandToc(Buffer const * buf);
void expandCaptions(Buffer const * buf, bool switchcap = false);
void expandEnvironmentSeparators(BufferView const *, bool contextmenu = false);
void expandQuotes(BufferView const *);
+ void expandZoomOptions(BufferView const *);
///
ItemList items_;
///
md_switchcaptions,
md_env_separators,
md_env_separatorscontext,
- md_switchquotes
+ md_switchquotes,
+ md_zoomoptions
};
LexerKeyword menutags[] = {
{ "toc", md_toc },
{ "toolbars", md_toolbars },
{ "updateformats", md_updateformats },
- { "viewformats", md_viewformats }
+ { "viewformats", md_viewformats },
+ { "zoomoptions", md_zoomoptions }
};
lex.pushTable(menutags);
add(MenuItem(MenuItem::SwitchQuotes));
break;
+ case md_zoomoptions:
+ add(MenuItem(MenuItem::ZoomOptions));
+ break;
+
case md_optsubmenu:
case md_submenu: {
lex.next(true);
true, // match word
false, // all words
true, // forward
- false))); // find next
+ false, // find next
+ false, // auto-wrap
+ false))); // only selection
if (i < m)
add(w);
else
docstring const arg = wl.word() + " " + from_ascii(wl.lang()->lang());
add(MenuItem(MenuItem::Command, qt_("Add to personal dictionary|n"),
FuncRequest(LFUN_SPELLING_ADD, arg)));
- add(MenuItem(MenuItem::Command, qt_("Ignore all|I"),
+ add(MenuItem(MenuItem::Command, qt_("Ignore this occurrence|g"),
+ FuncRequest(LFUN_FONT_NO_SPELLCHECK, arg)));
+ add(MenuItem(MenuItem::Command, qt_("Ignore all for this session|I"),
FuncRequest(LFUN_SPELLING_IGNORE, arg)));
+ add(MenuItem(MenuItem::Command, qt_("Ignore all in this document|d"),
+ FuncRequest(LFUN_SPELLING_ADD_LOCAL, arg)));
}
}
break;
- case SpellChecker::LEARNED_WORD: {
- LYXERR(Debug::GUI, "Learned Word.");
+ case SpellChecker::WORD_OK: {
+ if (wl.word().empty())
+ break;
+ LYXERR(Debug::GUI, "Valid Word.");
docstring const arg = wl.word() + " " + from_ascii(wl.lang()->lang());
add(MenuItem(MenuItem::Command, qt_("Remove from personal dictionary|r"),
FuncRequest(LFUN_SPELLING_REMOVE, arg)));
}
break;
+ case SpellChecker::DOCUMENT_LEARNED_WORD: {
+ LYXERR(Debug::GUI, "Document-Learned Word.");
+ docstring const arg = wl.word() + " " + from_ascii(wl.lang()->lang());
+ add(MenuItem(MenuItem::Command, qt_("Remove from document dictionary|r"),
+ FuncRequest(LFUN_SPELLING_REMOVE_LOCAL, arg)));
+ }
+ break;
case SpellChecker::NO_DICTIONARY:
LYXERR(Debug::GUI, "No dictionary for language " + from_ascii(wl.lang()->lang()));
// FALLTHROUGH
- case SpellChecker::WORD_OK:
- case SpellChecker::COMPOUND_WORD:
- case SpellChecker::ROOT_FOUND:
- case SpellChecker::IGNORED_WORD:
- break;
}
}
MenuItem item(MenuItem::Submenu, qt_("Hidden|H"));
item.setSubmenu(MenuDefinition(qt_("Hidden|H")));
- Buffer * first = theBufferList().first();
+ Buffer * const first = theBufferList().first();
if (!first) {
add(MenuItem(MenuItem::Info, qt_("(No Documents Open)")));
return;
if (!b.isClean())
label += "*";
if (b.notifiesExternalModification())
- label += QChar(0x26a0);
+ label += QChar(0x26a0); // warning sign ⚠
if (i < 10)
label = QString::number(i) + ". " + label + '|' + QString::number(i);
add(MenuItem(MenuItem::Command, label,
void MenuDefinition::expandFlexInsert(
- Buffer const * buf, InsetLayout::InsetLyXType type)
+ Buffer const * buf, InsetLyXType type)
{
if (!buf)
return;
}
}
// FIXME This is a little clunky.
- if (items_.empty() && type == InsetLayout::CUSTOM && !buf->hasReadonlyFlag())
+ if (items_.empty() && type == InsetLyXType::CUSTOM && !buf->hasReadonlyFlag())
add(MenuItem(MenuItem::Help, qt_("(No Custom Insets Defined)")));
}
label += QString::number(++shortcut_count);
}
}
- add(MenuItem(MenuItem::Command, label,
- FuncRequest(toc_list[i].action())));
+ add(MenuItem(MenuItem::Command, label, toc_list[i].action()));
// separator after the menu heading
if (toc_list[i].depth() < depth)
add(MenuItem(MenuItem::Separator));
break;
}
if (new_pos == pos + 1) {
- add(MenuItem(MenuItem::Command,
- label, FuncRequest(toc_list[pos].action())));
+ add(MenuItem(MenuItem::Command, label, toc_list[pos].action()));
} else {
MenuDefinition sub;
sub.expandToc2(toc_list, pos, new_pos, depth + 1, toc_type);
Toolbars::Infos::const_iterator cit = guiApp->toolbars().begin();
Toolbars::Infos::const_iterator end = guiApp->toolbars().end();
for (; cit != end; ++cit) {
- MenuItem const item(MenuItem::Command, toqstr(cit->gui_name),
- FuncRequest(LFUN_TOOLBAR_TOGGLE, cit->name));
+ MenuItem item(MenuItem::Command, toqstr(cit->gui_name),
+ FuncRequest(LFUN_TOOLBAR_TOGGLE, cit->name));
+ if (cit->allow_auto) {
+ MenuDefinition tristate;
+ tristate.add(MenuItem(MenuItem::Command, qt_("[[Toolbar]]On|O"),
+ FuncRequest(LFUN_TOOLBAR_SET, cit->name + " on")));
+ tristate.add(MenuItem(MenuItem::Command, qt_("[[Toolbar]]Off|f"),
+ FuncRequest(LFUN_TOOLBAR_SET, cit->name + " off")));
+ tristate.add(MenuItem(MenuItem::Command, qt_("[[Toolbar]]Automatic|A"),
+ FuncRequest(LFUN_TOOLBAR_SET, cit->name + " auto")));
+ item = MenuItem(MenuItem::Submenu,toqstr(cit->gui_name));
+ item.setSubmenu(tristate);
+ }
if (guiApp->toolbars().isMainToolbar(cit->name))
add(item);
else
}
+void MenuDefinition::expandZoomOptions(BufferView const * bv)
+{
+ if (!bv)
+ return;
+
+ add(MenuItem(MenuItem::Command,
+ toqstr(bformat(_("Reset to Default (%1$d%)|R"),
+ lyxrc.defaultZoom)),
+ FuncRequest(LFUN_BUFFER_ZOOM)));
+ add(MenuItem(MenuItem::Command, qt_("Zoom In|I"),
+ FuncRequest(LFUN_BUFFER_ZOOM_IN)));
+ add(MenuItem(MenuItem::Command, qt_("Zoom Out|O"),
+ FuncRequest(LFUN_BUFFER_ZOOM_OUT)));
+ add(MenuItem(MenuItem::Separator));
+ // Offer some fractional values of the default
+ int z = lyxrc.defaultZoom * 1.75;
+ add(MenuItem(MenuItem::Command,
+ toqstr(bformat(_("[[ZOOM]]%1$d%"), z)),
+ FuncRequest(LFUN_BUFFER_ZOOM, convert<string>(z))));
+ z = lyxrc.defaultZoom * 1.5;
+ add(MenuItem(MenuItem::Command,
+ toqstr(bformat(_("[[ZOOM]]%1$d%"), z)),
+ FuncRequest(LFUN_BUFFER_ZOOM, convert<string>(z))));
+ z = lyxrc.defaultZoom * 1.25;
+ add(MenuItem(MenuItem::Command,
+ toqstr(bformat(_("[[ZOOM]]%1$d%"), z)),
+ FuncRequest(LFUN_BUFFER_ZOOM, convert<string>(z))));
+ z = lyxrc.defaultZoom * 0.75;
+ add(MenuItem(MenuItem::Command,
+ toqstr(bformat(_("[[ZOOM]]%1$d%"), z)),
+ FuncRequest(LFUN_BUFFER_ZOOM, convert<string>(z))));
+ z = lyxrc.defaultZoom * 0.5;
+ add(MenuItem(MenuItem::Command,
+ toqstr(bformat(_("[[ZOOM]]%1$d%"), z)),
+ FuncRequest(LFUN_BUFFER_ZOOM, convert<string>(z))));
+ z = lyxrc.defaultZoom * 0.25;
+ add(MenuItem(MenuItem::Command,
+ toqstr(bformat(_("[[ZOOM]]%1$d%"), z)),
+ FuncRequest(LFUN_BUFFER_ZOOM, convert<string>(z))));
+}
+
+
void MenuDefinition::expandQuotes(BufferView const * bv)
{
if (!bv)
}
case MenuItem::CharStyles:
- tomenu.expandFlexInsert(buf, InsetLayout::CHARSTYLE);
+ tomenu.expandFlexInsert(buf, InsetLyXType::CHARSTYLE);
break;
case MenuItem::Custom:
- tomenu.expandFlexInsert(buf, InsetLayout::CUSTOM);
+ tomenu.expandFlexInsert(buf, InsetLyXType::CUSTOM);
break;
case MenuItem::FloatListInsert:
tomenu.expandQuotes(bv);
break;
+ case MenuItem::ZoomOptions:
+ tomenu.expandZoomOptions(bv);
+ break;
+
case MenuItem::Submenu: {
MenuItem item(*cit);
item.setSubmenu(MenuDefinition(cit->submenuname()));