diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index d327d32901..6705b08aed 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -163,7 +163,8 @@ keyword_item lyxrcTags[] = { { "\\user_name", LyXRC::RC_USER_NAME }, { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION }, // compatibility with versions older than 1.4.0 only - { "\\viewer", LyXRC::RC_VIEWER} + { "\\viewer", LyXRC::RC_VIEWER}, + { "\\visual_cursor" ,LyXRC::RC_VISUAL_CURSOR} }; const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item); @@ -247,6 +248,7 @@ void LyXRC::setDefaults() { isp_use_esc_chars = false; use_kbmap = false; rtl_support = true; + visual_cursor = false; auto_number = true; mark_foreign_language = true; language_auto_begin = true; @@ -995,6 +997,11 @@ int LyXRC::read(Lexer & lexrc) rtl_support = lexrc.getBool(); } break; + case RC_VISUAL_CURSOR: + if (lexrc.next()) { + visual_cursor = lexrc.getBool(); + } + break; case RC_AUTO_NUMBER: if (lexrc.next()) { auto_number = lexrc.getBool(); @@ -2144,6 +2151,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_VISUAL_CURSOR: + if (ignore_system_lyxrc || + visual_cursor != system_lyxrc.visual_cursor) { + os << "\\visual_cursor " << convert(visual_cursor) << '\n'; + } + if (tag != RC_LAST) + break; case RC_LANGUAGE_PACKAGE: if (ignore_system_lyxrc || language_package != system_lyxrc.language_package) { @@ -2654,6 +2668,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic)."); break; + case RC_VISUAL_CURSOR: + str = _("Select to have visual bidi cursor movement, unselect for logical movement."); + break; + case RC_SCREEN_DPI: str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here."); break; diff --git a/src/LyXRC.h b/src/LyXRC.h index ace663e113..3976a58f16 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -145,6 +145,7 @@ public: RC_USE_SPELL_LIB, RC_VIEWDVI_PAPEROPTION, RC_VIEWER, + RC_VISUAL_CURSOR, RC_LAST }; @@ -336,6 +337,8 @@ public: bool language_use_babel; /// bool rtl_support; + /// bidi cursor movement: true = visual, false = logical + bool visual_cursor; /// bool auto_number; /// diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 7601cd28c1..6946811992 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1438,7 +1438,11 @@ PrefLanguage::PrefLanguage(QWidget * parent) { setupUi(this); - connect(rtlCB, SIGNAL(clicked()), + connect(rtlGB, SIGNAL(clicked()), + this, SIGNAL(changed())); + connect(visualCursorRB, SIGNAL(clicked()), + this, SIGNAL(changed())); + connect(logicalCursorRB, SIGNAL(clicked()), this, SIGNAL(changed())); connect(markForeignCB, SIGNAL(clicked()), this, SIGNAL(changed())); @@ -1476,7 +1480,8 @@ PrefLanguage::PrefLanguage(QWidget * parent) void PrefLanguage::apply(LyXRC & rc) const { // FIXME: remove rtl_support bool - rc.rtl_support = rtlCB->isChecked(); + rc.rtl_support = rtlGB->isChecked(); + rc.visual_cursor = rtlGB->isChecked() && visualCursorRB->isChecked(); rc.mark_foreign_language = markForeignCB->isChecked(); rc.language_auto_begin = autoBeginCB->isChecked(); rc.language_auto_end = autoEndCB->isChecked(); @@ -1492,7 +1497,11 @@ void PrefLanguage::apply(LyXRC & rc) const void PrefLanguage::update(LyXRC const & rc) { // FIXME: remove rtl_support bool - rtlCB->setChecked(rc.rtl_support); + rtlGB->setChecked(rc.rtl_support); + if (rc.visual_cursor) + visualCursorRB->setChecked(true); + else + logicalCursorRB->setChecked(true); markForeignCB->setChecked(rc.mark_foreign_language); autoBeginCB->setChecked(rc.language_auto_begin); autoEndCB->setChecked(rc.language_auto_end); diff --git a/src/frontends/qt4/ui/PrefLanguageUi.ui b/src/frontends/qt4/ui/PrefLanguageUi.ui index 7fc209311b..816f068fad 100644 --- a/src/frontends/qt4/ui/PrefLanguageUi.ui +++ b/src/frontends/qt4/ui/PrefLanguageUi.ui @@ -5,8 +5,8 @@ 0 0 - 329 - 300 + 345 + 401 @@ -19,19 +19,6 @@ 6 - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -39,13 +26,25 @@ - - + + + + + + + + - Mark &foreign languages + Language pac&kage: + + + languagePackageED + + + @@ -62,51 +61,10 @@ - - + + - Auto &end - - - - - - - &Right-to-left language support - - - - - - - &Global - - - - - - - Auto &begin - - - - - - - Language pac&kage: - - - languagePackageED - - - - - - - Command e&nd: - - - endCommandED + Mark &foreign languages @@ -120,18 +78,6 @@ - - - - - - - - - - - - @@ -142,6 +88,114 @@ + + + + + + + Command e&nd: + + + endCommandED + + + + + + + &Global + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Auto &end + + + + + + + Auto &begin + + + + + + + Select to enable support of right-to-left languages (e.g. Hebrew, Arabic). + + + &Right-to-left language support + + + false + + + true + + + + 4 + + + 6 + + + + + 0 + + + 6 + + + + + Cursor movement: + + + false + + + + + + + Logical + + + true + + + + + + + Visual + + + + + + + + @@ -154,7 +208,6 @@ autoBeginCB autoEndCB markForeignCB - rtlCB qt_helpers.h