Get rid of rtl_support preference

This variable was introduced to guard against any bad consequence of the then-new right-to-left
languages support. Let's be bold and get rid of it altogether!

Now right to left support is always enabled.
This commit is contained in:
Jean-Marc Lasgouttes 2014-07-09 20:12:06 +02:00
parent 9d5c947110
commit 45eb314a86
11 changed files with 27 additions and 68 deletions

View File

@ -50,7 +50,4 @@ What is done:
* Remove homebrew Arabic and Hebrew support from Encoding.cpp. We now
rely on Qt to do handle complex scripts.
Next steps:
* Maybe get rid of LyXRC::rtl_support, which does not have a real use case.
* Get rid of LyXRC::rtl_support, which does not have a real use case.

View File

@ -1479,7 +1479,7 @@ if __name__ == '__main__':
lyx_check_config = True
lyx_kpsewhich = True
outfile = 'lyxrc.defaults'
lyxrc_fileformat = 16
lyxrc_fileformat = 17
rc_entries = ''
lyx_keep_temps = False
version_suffix = ''

View File

@ -70,6 +70,9 @@
# Incremented to format 16, by lasgouttes
# Remove force_paint_single_char rc.
# Incremented to format 17, by lasgouttes
# Remove rtl_support rc.
# NOTE: The format should also be updated in LYXRC.cpp and
# in configure.py.
@ -321,6 +324,11 @@ def remove_force_paint_single_char(line):
return no_match
return (True, "")
def remove_rtl(line):
if not line.lower().startswith("\\rtl "):
return no_match
return (True, "")
# End conversions for LyX 2.1 to 2.2
####################################
@ -346,5 +354,6 @@ conversions = [
[ 13, [mac_cursor_movement]],
[ 14, []],
[ 15, []],
[ 16, [remove_force_paint_single_char]]
[ 16, [remove_force_paint_single_char]],
[ 17, [remove_rtl]]
]

View File

@ -57,10 +57,6 @@ void Bidi::computeTables(Paragraph const & par,
Buffer const & buf, Row const & row)
{
same_direction_ = true;
if (!lyxrc.rtl_support) {
start_ = -1;
return;
}
if (par.inInset().forceLTR()) {
start_ = -1;
@ -192,7 +188,7 @@ void Bidi::computeTables(Paragraph const & par,
bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par,
pos_type pos) const
{
if (!lyxrc.rtl_support || pos == 0)
if (pos == 0)
return false;
if (!inRange(pos - 1)) {
@ -212,9 +208,6 @@ bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par,
bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par,
pos_type pos, Font const & font) const
{
if (!lyxrc.rtl_support)
return false; // This is just for speedup
bool const rtl = font.isVisibleRightToLeft();
bool const rtl2 = inRange(pos)
? level(pos) % 2

View File

@ -803,14 +803,12 @@ bool BufferView::moveToPosition(pit_type bottom_pit, pos_type bottom_pos,
void BufferView::translateAndInsert(char_type c, Text * t, Cursor & cur)
{
if (lyxrc.rtl_support) {
if (d->cursor_.real_current_font.isRightToLeft()) {
if (d->intl_.keymap == Intl::PRIMARY)
d->intl_.keyMapSec();
} else {
if (d->intl_.keymap == Intl::SECONDARY)
d->intl_.keyMapPrim();
}
if (d->cursor_.real_current_font.isRightToLeft()) {
if (d->intl_.keymap == Intl::PRIMARY)
d->intl_.keyMapSec();
} else {
if (d->intl_.keymap == Intl::SECONDARY)
d->intl_.keyMapPrim();
}
d->intl_.getTransManager().translateAndInsert(c, t, cur);

View File

@ -58,7 +58,7 @@ namespace {
// The format should also be updated in configure.py, and conversion code
// should be added to prefs2prefs_prefs.py.
static unsigned int const LYXRC_FILEFORMAT = 16; // lasgouttes: remove \\force_paint_single_char
static unsigned int const LYXRC_FILEFORMAT = 17; // lasgouttes: remove \\rtl
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
@ -170,7 +170,6 @@ LexerKeyword lyxrcTags[] = {
{ "\\print_to_file", LyXRC::RC_PRINTTOFILE },
{ "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
{ "\\printer", LyXRC::RC_PRINTER },
{ "\\rtl", LyXRC::RC_RTL_SUPPORT },
{ "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
{ "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
{ "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
@ -313,7 +312,6 @@ void LyXRC::setDefaults()
completion_minlength = 6;
spellcheck_notes = true;
use_kbmap = false;
rtl_support = true;
visual_cursor = false;
auto_number = true;
mark_foreign_language = true;
@ -1042,9 +1040,6 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
case RC_LANGUAGE_COMMAND_LOCAL:
lexrc >> language_command_local;
break;
case RC_RTL_SUPPORT:
lexrc >> rtl_support;
break;
case RC_VISUAL_CURSOR:
lexrc >> visual_cursor;
break;
@ -2537,13 +2532,6 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
if (tag != RC_LAST)
break;
case RC_RTL_SUPPORT:
if (ignore_system_lyxrc ||
rtl_support != system_lyxrc.rtl_support) {
os << "\\rtl " << convert<string>(rtl_support) << '\n';
}
if (tag != RC_LAST)
break;
case RC_VISUAL_CURSOR:
if (ignore_system_lyxrc ||
visual_cursor != system_lyxrc.visual_cursor) {
@ -3015,7 +3003,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
case LyXRC::RC_PRINTTOPRINTER:
case LyXRC::RC_PRINT_ADAPTOUTPUT:
case LyXRC::RC_PRINT_COMMAND:
case LyXRC::RC_RTL_SUPPORT:
case LyXRC::RC_SAVE_COMPRESSED:
case LyXRC::RC_SCREEN_DPI:
case LyXRC::RC_SCREEN_FONT_ROMAN:
@ -3423,10 +3410,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
break;
case RC_RTL_SUPPORT:
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;

View File

@ -146,7 +146,6 @@ public:
RC_PRINTTOPRINTER,
RC_PRINT_ADAPTOUTPUT,
RC_PRINT_COMMAND,
RC_RTL_SUPPORT,
RC_SAVE_COMPRESSED,
RC_SCREEN_DPI,
RC_SCREEN_FONT_ROMAN,
@ -410,8 +409,6 @@ public:
};
///
LangPackageSelection language_package_selection;
///
bool rtl_support;
/// bidi cursor movement: true = visual, false = logical
bool visual_cursor;
///

View File

@ -1928,7 +1928,7 @@ FontSize Paragraph::highestFontInRange
char_type Paragraph::getUChar(BufferParams const & bparams, pos_type pos) const
{
char_type c = d->text_[pos];
if (!lyxrc.rtl_support || !getFontSettings(bparams, pos).isRightToLeft())
if (!getFontSettings(bparams, pos).isRightToLeft())
return c;
// FIXME: The arabic special casing is due to the difference of arabic
@ -3304,8 +3304,7 @@ Paragraph::getParLanguage(BufferParams const & bparams) const
bool Paragraph::isRTL(BufferParams const & bparams) const
{
return lyxrc.rtl_support
&& getParLanguage(bparams)->rightToLeft()
return getParLanguage(bparams)->rightToLeft()
&& !inInset().getLayout().forceLTR();
}

View File

@ -290,7 +290,7 @@ Font TextMetrics::displayFont(pit_type pit, pos_type pos) const
bool TextMetrics::isRTL(CursorSlice const & sl, bool boundary) const
{
if (!lyxrc.rtl_support || !sl.text())
if (!sl.text())
return false;
int correction = 0;
@ -304,7 +304,7 @@ bool TextMetrics::isRTL(CursorSlice const & sl, bool boundary) const
bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos) const
{
// no RTL boundary at paragraph start
if (!lyxrc.rtl_support || pos == 0)
if (pos == 0)
return false;
Font const & left_font = displayFont(pit, pos - 1);
@ -319,9 +319,8 @@ bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos) const
bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos,
Font const & font) const
{
if (!lyxrc.rtl_support
// no RTL boundary at paragraph start
|| pos == 0
if (// no RTL boundary at paragraph start
pos == 0
// if the metrics have not been calculated, then we are not
// on screen and can safely ignore issues about boundaries.
|| !contains(pit))

View File

@ -2261,8 +2261,6 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
{
setupUi(this);
connect(rtlGB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(visualCursorRB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(logicalCursorRB, SIGNAL(clicked()),
@ -2346,9 +2344,7 @@ void PrefLanguage::on_languagePackageCO_currentIndexChanged(int i)
void PrefLanguage::apply(LyXRC & rc) const
{
// FIXME: remove rtl_support bool
rc.rtl_support = rtlGB->isChecked();
rc.visual_cursor = rtlGB->isChecked() && visualCursorRB->isChecked();
rc.visual_cursor = visualCursorRB->isChecked();
rc.mark_foreign_language = markForeignCB->isChecked();
rc.language_auto_begin = autoBeginCB->isChecked();
rc.language_auto_end = autoEndCB->isChecked();
@ -2374,8 +2370,6 @@ void PrefLanguage::apply(LyXRC & rc) const
void PrefLanguage::update(LyXRC const & rc)
{
// FIXME: remove rtl_support bool
rtlGB->setChecked(rc.rtl_support);
if (rc.visual_cursor)
visualCursorRB->setChecked(true);
else

View File

@ -224,16 +224,6 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="rtlGB">
<property name="toolTip">
<string>Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).</string>
</property>
<property name="text">
<string>Enable &amp;RTL support</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>