]> git.lyx.org Git - features.git/commitdiff
Patch from Dekel: display text RTL in spellchecker and TOC
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 28 Apr 2000 14:54:53 +0000 (14:54 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 28 Apr 2000 14:54:53 +0000 (14:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@705 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
lib/lyxrc.example
src/lyx_cb.C
src/spellchecker.C

index d60a82a6bd5aba8f8dac33473a791493fd1c8c9c..3e35fef347f4f4931590a481714c7d3f85400ccc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2000-04-27  Dekel Tsur  <dekel@math.tau.ac.il>
+
+       * src/lyx_cb.C (TocUpdateCB): Reverse strings for Hebrew paragraphs
+
+       * src/spellchecker.C (RunSpellChecker): Reverse Hebrew strings in
+       the spellchecker popup. 
+
+       * lib/lyxrc.example:  Removed the \number_inset section
+
 2000-04-28  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * src/insets/figinset.C (various): Use IsFileReadable() to make
index 8541debdebdba5c59bab085664ae596047db7be8..681d96099917e30ad859958eb95b11a3549dab95 100644 (file)
 # Arabic). Default is false.
 #\rtl true
 
-# If number_inset is set to "true", each time a digit key is pressed,
-# LyX will automatically open a new number inset.
-# If number_inset is set to "rtl", the above behavior will take place
-# only when the cursor is on right-to-left text.
-# Default is rtl.
-#\number_inset true
-
 # The latex command for loading the language package.
 # Default is \usepackage{babel}.
 #\language_package "\usepackage{omega}"
index 95718cf7167557f8931d1704db8919ab68a5ae44..cefd98ae82d70d3e977905696ae9dba55a66080a 100644 (file)
@@ -3226,6 +3226,7 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
         
                        line[pos] = ' ';
                        ++pos;
+                       int pos0 = pos;
                        
                        /* now the contents */
                        LyXParagraph::size_type i = 0;
@@ -3237,6 +3238,8 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
                                }
                                ++i;
                        }
+                       if (par->isRightToLeftPar())
+                               reverse(line+pos0,line+pos);
                        line[pos] = '\0';
                        fl_add_browser_line(fd_form_toc->browser_toc, line);
                        
index 514c014242ef277ae02339e6ae4f177c2692abf1..623668c5f456237f815ea5ddb93cc0c1ae2aca60 100644 (file)
@@ -37,6 +37,8 @@
 #include <sys/select.h>
 #endif
 
+#include <algorithm>
+
 #include "LString.h"
 #include "sp_form.h"
 #include "spellchecker.h"
@@ -643,6 +645,7 @@ bool RunSpellChecker(BufferView * bv)
        FL_OBJECT * obj;
 
        string tmp = (lyxrc.isp_use_alt_lang) ? lyxrc.isp_alt_lang : bv->buffer()->GetLanguage();
+       bool rtl = tmp == "hebrew" || tmp == "arabic";
 
        int oldval = 0;  /* used for updating slider only when needed */
        float newval = 0.0;
@@ -704,11 +707,21 @@ bool RunSpellChecker(BufferView * bv)
                case ISP_MISSED:
                {
                        bv->selectLastWord();
-                       fl_set_object_label(fd_form_spell_check->text, word);
+                       if (rtl) {
+                               string tmp = word;
+                               reverse(tmp.begin(),tmp.end());
+                               fl_set_object_label(fd_form_spell_check->text, tmp.c_str());
+                       } else
+                               fl_set_object_label(fd_form_spell_check->text, word);
                        fl_set_input(fd_form_spell_check->input, word);
                        fl_clear_browser(fd_form_spell_check->browser);
                        for (i = 0; i < result->count; ++i) {
-                               fl_add_browser_line(fd_form_spell_check->browser, result->misses[i]);
+                               if (rtl) {
+                                       string tmp = result->misses[i];
+                                       reverse(tmp.begin(),tmp.end());
+                                       fl_add_browser_line(fd_form_spell_check->browser, tmp.c_str());
+                               } else
+                                       fl_add_browser_line(fd_form_spell_check->browser, result->misses[i]);
                        }
 
                        int clickline = -1;
@@ -741,10 +754,17 @@ bool RunSpellChecker(BufferView * bv)
                                                break;
                                        }
                                        clickline = fl_get_browser(fd_form_spell_check->browser);
-                                       fl_set_input(fd_form_spell_check->input, 
-                                                    fl_get_browser_line(fd_form_spell_check->browser,
-                                                                        fl_get_browser(fd_form_spell_check->browser)));
-                                                    
+                                       /// Why not use
+                                       /// fl_set_input(fd_form_spell_check->input, result->misses[clickline-1]); ?
+                                       if (rtl) {
+                                               string tmp = fl_get_browser_line(fd_form_spell_check->browser,
+                                                                                clickline);
+                                               reverse(tmp.begin(),tmp.end());
+                                               fl_set_input(fd_form_spell_check->input, tmp.c_str());
+                                       } else
+                                               fl_set_input(fd_form_spell_check->input,
+                                                            fl_get_browser_line(fd_form_spell_check->browser,
+                                                                                clickline));
                                }
                                if (obj == fd_form_spell_check->stop) {
                                        delete result;