Adding preference for visual mode for bidi cursor movement

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22928 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dov Feldstern 2008-02-10 19:51:23 +00:00
parent 76ec27281b
commit a9770a18cd
4 changed files with 162 additions and 79 deletions

View File

@ -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<string>(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;

View File

@ -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;
///

View File

@ -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);

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>329</width>
<height>300</height>
<width>345</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle" >
@ -19,19 +19,6 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" >
<widget class="QCheckBox" name="useBabelCB" >
<property name="text" >
@ -39,13 +26,25 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="2" >
<widget class="QCheckBox" name="markForeignCB" >
<item row="0" column="1" >
<widget class="QComboBox" name="defaultLanguageCO" />
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="startCommandED" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="languagePackageLA" >
<property name="text" >
<string>Mark &amp;foreign languages</string>
<string>Language pac&amp;kage:</string>
</property>
<property name="buddy" >
<cstring>languagePackageED</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="languagePackageED" />
</item>
<item row="10" column="0" colspan="2" >
<spacer>
<property name="orientation" >
@ -62,51 +61,10 @@
</property>
</spacer>
</item>
<item row="7" column="0" >
<widget class="QCheckBox" name="autoEndCB" >
<item row="8" column="0" colspan="2" >
<widget class="QCheckBox" name="markForeignCB" >
<property name="text" >
<string>Auto &amp;end</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2" >
<widget class="QCheckBox" name="rtlCB" >
<property name="text" >
<string>&amp;Right-to-left language support</string>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QCheckBox" name="globalCB" >
<property name="text" >
<string>&amp;Global</string>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QCheckBox" name="autoBeginCB" >
<property name="text" >
<string>Auto &amp;begin</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="languagePackageLA" >
<property name="text" >
<string>Language pac&amp;kage:</string>
</property>
<property name="buddy" >
<cstring>languagePackageED</cstring>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="endCommandLA" >
<property name="text" >
<string>Command e&amp;nd:</string>
</property>
<property name="buddy" >
<cstring>endCommandED</cstring>
<string>Mark &amp;foreign languages</string>
</property>
</widget>
</item>
@ -120,18 +78,6 @@
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="defaultLanguageCO" />
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="languagePackageED" />
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="startCommandED" />
</item>
<item row="3" column="1" >
<widget class="QLineEdit" name="endCommandED" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="startCommandLA" >
<property name="text" >
@ -142,6 +88,114 @@
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QLineEdit" name="endCommandED" />
</item>
<item row="3" column="0" >
<widget class="QLabel" name="endCommandLA" >
<property name="text" >
<string>Command e&amp;nd:</string>
</property>
<property name="buddy" >
<cstring>endCommandED</cstring>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QCheckBox" name="globalCB" >
<property name="text" >
<string>&amp;Global</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0" >
<widget class="QCheckBox" name="autoEndCB" >
<property name="text" >
<string>Auto &amp;end</string>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QCheckBox" name="autoBeginCB" >
<property name="text" >
<string>Auto &amp;begin</string>
</property>
</widget>
</item>
<item row="9" column="0" >
<widget class="QGroupBox" name="rtlGB" >
<property name="toolTip" >
<string>Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).</string>
</property>
<property name="title" >
<string>&amp;Right-to-left language support</string>
</property>
<property name="flat" >
<bool>false</bool>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>4</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Cursor movement:</string>
</property>
<property name="scaledContents" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="logicalCursorRB" >
<property name="text" >
<string>Logical</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="visualCursorRB" >
<property name="text" >
<string>Visual</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
@ -154,7 +208,6 @@
<tabstop>autoBeginCB</tabstop>
<tabstop>autoEndCB</tabstop>
<tabstop>markForeignCB</tabstop>
<tabstop>rtlCB</tabstop>
</tabstops>
<includes>
<include location="local" >qt_helpers.h</include>