mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Add a pref to disable OS keyboard language support
By default, the behavior is the same as before, except that the language of new document is not unconditionally en_US anymore. The new checkbox "Respect OS keyboard language" (off by default) governs this behavior. Update prefs format to 30.
This commit is contained in:
parent
a7d9982bfc
commit
c476c3766c
@ -1799,7 +1799,7 @@ if __name__ == '__main__':
|
||||
lyx_check_config = True
|
||||
lyx_kpsewhich = True
|
||||
outfile = 'lyxrc.defaults'
|
||||
lyxrc_fileformat = 29
|
||||
lyxrc_fileformat = 30
|
||||
rc_entries = ''
|
||||
lyx_keep_temps = False
|
||||
version_suffix = ''
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
# This file houses conversion information for the preferences file.
|
||||
|
||||
# The converter functions take a line as argument and return a list:
|
||||
# (Bool, NewLine),
|
||||
# where the Bool says if we've modified anything and the NewLine is
|
||||
# The converter functions take a line as argument and return a list:
|
||||
# (Bool, NewLine),
|
||||
# where the Bool says if we've modified anything and the NewLine is
|
||||
# the new line, if so, which will be used to replace the old line.
|
||||
|
||||
# Incremented to format 2, r39670 by jrioux
|
||||
@ -117,6 +117,10 @@
|
||||
# Incremented to format 29, by lasgouttes
|
||||
# Remove use_pixmap_cache
|
||||
|
||||
# Incremented to format 30, by lasgouttes
|
||||
# Add respect_os_kbd_language.
|
||||
# No convergence necessary.
|
||||
|
||||
# NOTE: The format should also be updated in LYXRC.cpp and
|
||||
# in configure.py.
|
||||
|
||||
@ -464,5 +468,6 @@ conversions = [
|
||||
[ 26, [remove_font_encoding]],
|
||||
[ 27, []],
|
||||
[ 28, [remove_date_insert_format]],
|
||||
[ 29, [remove_use_pixmap_cache]]
|
||||
[ 29, [remove_use_pixmap_cache]],
|
||||
[ 30, []]
|
||||
]
|
||||
|
@ -2401,6 +2401,8 @@ bool notifyCursorLeavesOrEnters(Cursor const & old, Cursor & cur)
|
||||
|
||||
void Cursor::setLanguageFromInput()
|
||||
{
|
||||
if (!lyxrc.respect_os_kbd_language)
|
||||
return;
|
||||
string const & code = theApp()->inputLanguageCode();
|
||||
Language const * lang = languages.getFromCode(code, buffer()->getLanguages());
|
||||
if (lang) {
|
||||
|
@ -61,7 +61,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 = 29; // spitz: remove \\date_insert_format
|
||||
static unsigned int const LYXRC_FILEFORMAT = 30; // lasgouttes: add \respect_os_kbd_language
|
||||
// when adding something to this array keep it sorted!
|
||||
LexerKeyword lyxrcTags[] = {
|
||||
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
|
||||
@ -159,6 +159,7 @@ LexerKeyword lyxrcTags[] = {
|
||||
{ "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
|
||||
{ "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
|
||||
{ "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
|
||||
{ "\\respect_os_kbd_language", LyXRC::RC_RESPECT_OS_KBD_LANGUAGE },
|
||||
{ "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
|
||||
{ "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
|
||||
{ "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
|
||||
@ -797,6 +798,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
|
||||
case RC_LANGUAGE_COMMAND_LOCAL:
|
||||
lexrc >> language_command_local;
|
||||
break;
|
||||
case RC_RESPECT_OS_KBD_LANGUAGE:
|
||||
lexrc >> respect_os_kbd_language;
|
||||
break;
|
||||
case RC_VISUAL_CURSOR:
|
||||
lexrc >> visual_cursor;
|
||||
break;
|
||||
@ -2421,6 +2425,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
os << "\\mark_foreign_language " <<
|
||||
convert<string>(mark_foreign_language) << '\n';
|
||||
}
|
||||
// fall through
|
||||
case RC_RESPECT_OS_KBD_LANGUAGE:
|
||||
if (ignore_system_lyxrc ||
|
||||
respect_os_kbd_language
|
||||
!= system_lyxrc.respect_os_kbd_language) {
|
||||
os << "\\respect_os_kbd_language " <<
|
||||
convert<string>(respect_os_kbd_language) << '\n';
|
||||
}
|
||||
//fall through
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
|
||||
@ -2778,6 +2791,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
||||
case LyXRC::RC_MACRO_EDIT_STYLE:
|
||||
case LyXRC::RC_MAKE_BACKUP:
|
||||
case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
|
||||
case LyXRC::RC_RESPECT_OS_KBD_LANGUAGE:
|
||||
case LyXRC::RC_MOUSE_WHEEL_SPEED:
|
||||
case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
|
||||
case LyXRC::RC_NUMLASTFILES:
|
||||
@ -3099,6 +3113,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
|
||||
str = _("Select to control the highlighting of words with a language foreign to that of the document.");
|
||||
break;
|
||||
|
||||
case RC_RESPECT_OS_KBD_LANGUAGE:
|
||||
str = _("Select to use the current keyboard language, as set from the operating system, as default input language.");
|
||||
break;
|
||||
|
||||
case RC_MOUSE_WHEEL_SPEED:
|
||||
str = _("The scrolling speed of the mouse wheel.");
|
||||
break;
|
||||
|
@ -135,6 +135,7 @@ public:
|
||||
RC_PRINTPAPERDIMENSIONFLAG,
|
||||
RC_PRINTPAPERFLAG,
|
||||
RC_PYGMENTIZE_COMMAND,
|
||||
RC_RESPECT_OS_KBD_LANGUAGE,
|
||||
RC_SAVE_COMPRESSED,
|
||||
RC_SAVE_ORIGIN,
|
||||
RC_SCREEN_DPI,
|
||||
@ -399,6 +400,8 @@ public:
|
||||
///
|
||||
std::string gui_language = "auto";
|
||||
///
|
||||
bool respect_os_kbd_language = false;
|
||||
///
|
||||
std::string default_otf_view_format = "pdf4";
|
||||
///
|
||||
std::string default_platex_view_format = "pdf3";
|
||||
|
@ -2394,6 +2394,8 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
|
||||
this, SIGNAL(changed()));
|
||||
connect(markForeignCB, SIGNAL(clicked()),
|
||||
this, SIGNAL(changed()));
|
||||
connect(respectOSkbdCB, SIGNAL(clicked()),
|
||||
this, SIGNAL(changed()));
|
||||
connect(autoBeginCB, SIGNAL(clicked()),
|
||||
this, SIGNAL(changed()));
|
||||
connect(autoEndCB, SIGNAL(clicked()),
|
||||
@ -2469,6 +2471,7 @@ void PrefLanguage::applyRC(LyXRC & rc) const
|
||||
{
|
||||
rc.visual_cursor = visualCursorRB->isChecked();
|
||||
rc.mark_foreign_language = markForeignCB->isChecked();
|
||||
rc.respect_os_kbd_language = respectOSkbdCB->isChecked();
|
||||
rc.language_auto_begin = autoBeginCB->isChecked();
|
||||
rc.language_auto_end = autoEndCB->isChecked();
|
||||
int const p = languagePackageCO->currentIndex();
|
||||
@ -2498,6 +2501,7 @@ void PrefLanguage::updateRC(LyXRC const & rc)
|
||||
else
|
||||
logicalCursorRB->setChecked(true);
|
||||
markForeignCB->setChecked(rc.mark_foreign_language);
|
||||
respectOSkbdCB->setChecked(rc.respect_os_kbd_language);
|
||||
autoBeginCB->setChecked(rc.language_auto_begin);
|
||||
autoEndCB->setChecked(rc.language_auto_end);
|
||||
languagePackageCO->setCurrentIndex(rc.language_package_selection);
|
||||
|
@ -208,7 +208,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="3">
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="respectOSkbdCB">
|
||||
<property name="toolTip">
|
||||
<string>Select to use the current keyboard language, as set from the operating system, as default input language.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Respect &OS keyboard language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="rtlGB2">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
@ -276,7 +286,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="12" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -301,10 +311,12 @@
|
||||
<tabstop>startCommandED</tabstop>
|
||||
<tabstop>endCommandED</tabstop>
|
||||
<tabstop>defaultDecimalPointLE</tabstop>
|
||||
<tabstop>defaultLengthUnitCO</tabstop>
|
||||
<tabstop>globalCB</tabstop>
|
||||
<tabstop>autoBeginCB</tabstop>
|
||||
<tabstop>autoEndCB</tabstop>
|
||||
<tabstop>markForeignCB</tabstop>
|
||||
<tabstop>respectOSkbdCB</tabstop>
|
||||
<tabstop>logicalCursorRB</tabstop>
|
||||
<tabstop>visualCursorRB</tabstop>
|
||||
</tabstops>
|
||||
|
Loading…
Reference in New Issue
Block a user