Pavel Sanda wrote:
b. Probably the visual_cursor option should only be enabled if rtl_support is on --- if rtl_support is false, visual_cursor should definitely be false, and should be disabled in the GUI (only because it uses the bidi tables, which will not be computed in the non-rtl_support case). What's the best way of going about this --- both in terms of the GUI presentation,

one possibility is the way how Use hyperref support checkbox is done - you get
the disabling for free as qt do it for you.
pavel

Thanks, Pavel! Attached is the patch, after fixing it up as you suggested. Also, I added tooltips for rtl_support and visual_cursor, but see my separate post regarding this issue ("LyXRC descriptions / tooltips").

The only thing is that I don't love the visual appearance --- specifically, the fact that the checkboxes are not all in one line. I don't see any way to fix this, though, without breaking the layout and placing the widgets manually, which I imagine is not a very good idea? But I guess it's fine this way...

Thanks!
Dov
diff -r d6f32a79034d src/LyXRC.cpp
--- a/src/LyXRC.cpp     Thu Jan 31 23:50:16 2008 +0100
+++ b/src/LyXRC.cpp     Fri Feb 01 15:34:57 2008 +0200
@@ -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;
@@ -993,6 +995,11 @@ int LyXRC::read(Lexer & lexrc)
                case RC_RTL_SUPPORT:
                        if (lexrc.next()) {
                                rtl_support = lexrc.getBool();
+                       }
+                       break;
+               case RC_VISUAL_CURSOR:
+                       if (lexrc.next()) {
+                               visual_cursor = lexrc.getBool();
                        }
                        break;
                case RC_AUTO_NUMBER:
@@ -2144,6 +2151,13 @@ void LyXRC::write(ostream & os, bool ign
                }
                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(LyXRC
                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 -r d6f32a79034d src/LyXRC.h
--- a/src/LyXRC.h       Thu Jan 31 23:50:16 2008 +0100
+++ b/src/LyXRC.h       Fri Feb 01 15:34:57 2008 +0200
@@ -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 -r d6f32a79034d src/frontends/qt4/GuiPrefs.cpp
--- a/src/frontends/qt4/GuiPrefs.cpp    Thu Jan 31 23:50:16 2008 +0100
+++ b/src/frontends/qt4/GuiPrefs.cpp    Fri Feb 01 15:34:57 2008 +0200
@@ -1438,7 +1438,9 @@ PrefLanguage::PrefLanguage(QWidget * par
 {
        setupUi(this);
 
-       connect(rtlCB, SIGNAL(clicked()),
+       connect(rtlGB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
+       connect(visualCursorCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
        connect(markForeignCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
@@ -1476,7 +1478,8 @@ void PrefLanguage::apply(LyXRC & rc) con
 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() && visualCursorCB->isChecked();
        rc.mark_foreign_language = markForeignCB->isChecked();
        rc.language_auto_begin = autoBeginCB->isChecked();
        rc.language_auto_end = autoEndCB->isChecked();
@@ -1492,7 +1495,8 @@ void PrefLanguage::update(LyXRC const & 
 void PrefLanguage::update(LyXRC const & rc)
 {
        // FIXME: remove rtl_support bool
-       rtlCB->setChecked(rc.rtl_support);
+       rtlGB->setChecked(rc.rtl_support);
+       visualCursorCB->setChecked(rc.visual_cursor);
        markForeignCB->setChecked(rc.mark_foreign_language);
        autoBeginCB->setChecked(rc.language_auto_begin);
        autoEndCB->setChecked(rc.language_auto_end);
diff -r d6f32a79034d src/frontends/qt4/ui/PrefLanguageUi.ui
--- a/src/frontends/qt4/ui/PrefLanguageUi.ui    Thu Jan 31 23:50:16 2008 +0100
+++ b/src/frontends/qt4/ui/PrefLanguageUi.ui    Fri Feb 01 15:34:57 2008 +0200
@@ -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,12 +26,24 @@
      </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>
@@ -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" >
@@ -140,6 +86,87 @@
      <property name="buddy" >
       <cstring>startCommandED</cstring>
      </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>
+       <widget class="QCheckBox" name="visualCursorCB" >
+        <property name="toolTip" >
+         <string>Select to have visual bidi cursor movement, deselect for 
logical movement.</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Visual BiDi cursor movement</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
     </widget>
    </item>
   </layout>
@@ -154,7 +181,6 @@
   <tabstop>autoBeginCB</tabstop>
   <tabstop>autoEndCB</tabstop>
   <tabstop>markForeignCB</tabstop>
-  <tabstop>rtlCB</tabstop>
  </tabstops>
  <includes>
   <include location="local" >qt_helpers.h</include>

Reply via email to