Include he/cua.bind (#12052)

To allow for its use, we add support to include a bind file from the
top dir (i.e., non-localized) via \bind_file ../<file>
This commit is contained in:
Juergen Spitzmueller 2022-11-25 11:30:20 +01:00
parent 794575a0ad
commit 315d347d3e
4 changed files with 49 additions and 9 deletions

View File

@ -25,18 +25,22 @@ dist_noinst_DATA = \
images/math/dots.svgz \
images/math/font.svgz
skbinddir = $(pkgdatadir)/bind/sk
dist_skbind_DATA = \
bind/sk/menus.bind
debinddir = $(pkgdatadir)/bind/de
dist_debind_DATA = \
bind/de/menus.bind
hebinddir = $(pkgdatadir)/bind/he
dist_hebind_DATA = \
bind/he/cua.bind
rubinddir = $(pkgdatadir)/bind/ru
dist_rubind_DATA = \
bind/ru/menus.bind
skbinddir = $(pkgdatadir)/bind/sk
dist_skbind_DATA = \
bind/sk/menus.bind
binddir = $(pkgdatadir)/bind
dist_bind_DATA = \
bind/broadway.bind \

28
lib/bind/he/cua.bind Normal file
View File

@ -0,0 +1,28 @@
# -*- text -*-
# file he/cua.bind
# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
# author Iddo Samet
# author Jürgen Spitzmüller
# Full author contact details are available in file CREDITS.
# This is the CUA (Common User Access) flavour bind file, based on
# bindings found in the Windows, Mac and Motif world, extended for Hebrew.
# DO NOT CHANGE THIS DEFAULT BINDING FILE! It will be replaced
# with every new install of LyX and your changes will be lost.
# Instead, customize a copy of this file placed in
# ~/.lyx/bind/he/cua.bind
#
# Happy tuning!
# Load the default cua.bind
# ../ just means that no localized bindfile
# should be loaded here
\bind_file ../cua.bind
# Add binding to switch to Hebrew
\bind "F12" "language hebrew"

View File

@ -218,9 +218,10 @@ void KeyMap::clear()
}
bool KeyMap::read(string const & bind_file, KeyMap * unbind_map, BindReadType rt)
bool KeyMap::read(string const & bind_file, KeyMap * unbind_map, BindReadType rt, bool i18n)
{
FileName bf = i18nLibFileSearch("bind", bind_file, "bind");
FileName bf = i18n ? i18nLibFileSearch("bind", bind_file, "bind")
: libFileSearch("bind", bind_file, "bind");
if (bf.empty()) {
if (rt == MissingOK)
return true;
@ -383,7 +384,13 @@ KeyMap::ReturnValues KeyMap::readWithoutConv(FileName const & bind_file, KeyMap
error = true;
break;
}
string const tmp = lexrc.getString();
string tmp = lexrc.getString();
if (prefixIs(tmp, "../")) {
tmp = split(tmp, '/');
// look in top dir
error |= !read(tmp, unbind_map, Default, false);
} else
// i18n search
error |= !read(tmp, unbind_map);
break;
}

View File

@ -82,9 +82,10 @@ public:
* @param bind_file bind file
* @param unbind_map pointer to a KeyMap that holds \unbind bindings
* @param rt how to respond if the file can't be found
* @param i18n whether to search in localized folders
*/
bool read(std::string const & bind_file, KeyMap * unbind_map = 0,
BindReadType rt = Default);
BindReadType rt = Default, bool i18n = true);
/** write to a bind file.
* @param append append to the bind_file instead of overwrite it