Patch from Dekel: display text RTL in spellchecker and TOC

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@705 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-04-28 14:54:53 +00:00
parent 0ffa79de9d
commit 42a571c8c1
4 changed files with 38 additions and 13 deletions

View File

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

View File

@ -631,13 +631,6 @@
# 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}"

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

View 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;