LYXERR(Debug::DEBUG) << BOOST_CURRENT_FUNCTION << endl;
updateMetrics(false);
- switchKeyMap();
}
}
-void BufferView::switchKeyMap()
+void BufferView::translateAndInsert(char_type c, Text * t, Cursor & cur)
{
- if (!lyxrc.rtl_support)
- return;
-
- if (cursor_.innerText()->real_current_font.isRightToLeft()) {
- if (intl_->keymap == Intl::PRIMARY)
- intl_->keyMapSec();
- } else {
- if (intl_->keymap == Intl::SECONDARY)
- intl_->keyMapPrim();
+ if (lyxrc.rtl_support) {
+ if (cursor_.innerText()->real_current_font.isRightToLeft()) {
+ if (intl_->keymap == Intl::PRIMARY)
+ intl_->keyMapSec();
+ } else {
+ if (intl_->keymap == Intl::SECONDARY)
+ intl_->keyMapPrim();
+ }
}
+
+ intl_->getTransManager().translateAndInsert(c, t, cur);
}
{
FuncStatus flag;
+ Cursor & cur = cursor_;
+
switch (cmd.action) {
case LFUN_UNDO:
case LFUN_FILE_INSERT_PLAINTEXT:
case LFUN_BOOKMARK_SAVE:
// FIXME: Actually, these LFUNS should be moved to Text
- flag.enabled(cursor_.inTexted());
+ flag.enabled(cur.inTexted());
break;
case LFUN_FONT_STATE:
case LFUN_LABEL_INSERT:
case LFUN_NOTE_NEXT:
case LFUN_REFERENCE_NEXT:
case LFUN_WORD_FIND:
- case LFUN_WORD_REPLACE:
case LFUN_MARK_OFF:
case LFUN_MARK_ON:
case LFUN_MARK_TOGGLE:
flag.enabled(true);
break;
+ case LFUN_WORD_REPLACE:
+ flag.enabled(!cur.paragraph().isDeleted(cur.pos()));
+ break;
+
case LFUN_LABEL_GOTO: {
flag.enabled(!cmd.argument().empty()
- || getInsetByCode<InsetRef>(cursor_, Inset::REF_CODE));
+ || getInsetByCode<InsetRef>(cur, Inset::REF_CODE));
break;
}
cur.message(_("No further undo information"));
updateFlags = Update::None;
}
- switchKeyMap();
break;
case LFUN_REDO:
cur.message(_("No further redo information"));
updateFlags = Update::None;
}
- switchKeyMap();
break;
case LFUN_FILE_INSERT:
if (b == buffer_) {
// Set the cursor
setCursor(makeDocIterator(par, 0));
- switchKeyMap();
} else {
// Switch to other buffer view and resend cmd
theLyXFunc().dispatch(FuncRequest(
FileDialog fileDlg(_("Select LyX document to insert"),
LFUN_FILE_INSERT,
make_pair(_("Documents|#o#O"), from_utf8(lyxrc.document_path)),
- make_pair(_("Examples|#E#e"), from_utf8(addPath(package().system_support().absFilename(), "examples"))));
+ make_pair(_("Examples|#E#e"),
+ from_utf8(addPath(package().system_support().absFilename(),
+ "examples"))));
FileDialog::Result result =
fileDlg.open(from_utf8(initpath),