commit 315d347d3ef941ec8804fc7cb321c5d5a61d5305
Author: Juergen Spitzmueller <[email protected]>
Date: Fri Nov 25 11:30:20 2022 +0100
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>
---
lib/Makefile.am | 12 ++++++++----
lib/bind/he/cua.bind | 28 ++++++++++++++++++++++++++++
src/KeyMap.cpp | 15 +++++++++++----
src/KeyMap.h | 3 ++-
4 files changed, 49 insertions(+), 9 deletions(-)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 81cf05e..7ceaeaa 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -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 \
diff --git a/lib/bind/he/cua.bind b/lib/bind/he/cua.bind
new file mode 100644
index 0000000..aa86f7d
--- /dev/null
+++ b/lib/bind/he/cua.bind
@@ -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"
diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp
index b4a87d2..1fb82c2 100644
--- a/src/KeyMap.cpp
+++ b/src/KeyMap.cpp
@@ -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,8 +384,14 @@ KeyMap::ReturnValues KeyMap::readWithoutConv(FileName
const & bind_file, KeyMap
error = true;
break;
}
- string const tmp = lexrc.getString();
- error |= !read(tmp, unbind_map);
+ 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;
}
diff --git a/src/KeyMap.h b/src/KeyMap.h
index 849ba0c..9386c1f 100644
--- a/src/KeyMap.h
+++ b/src/KeyMap.h
@@ -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
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs