]> git.lyx.org Git - features.git/commitdiff
Include he/cua.bind (#12052)
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 25 Nov 2022 10:30:20 +0000 (11:30 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 27 Nov 2022 15:30:21 +0000 (16:30 +0100)
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
lib/bind/he/cua.bind [new file with mode: 0644]
src/KeyMap.cpp
src/KeyMap.h

index 81cf05ee2b274c6701da6f6b0ce9d697085a4ad4..7ceaeaac3556a264a3013e30aed479c6147b10d0 100644 (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 \
diff --git a/lib/bind/he/cua.bind b/lib/bind/he/cua.bind
new file mode 100644 (file)
index 0000000..aa86f7d
--- /dev/null
@@ -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"
index b4a87d227c911881544b4b59db6e52cc072c7940..1fb82c2f195cbf7b39e70f51918d3d57fb89f83d 100644 (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,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;
                }
 
index 849ba0cdad6ee5f089a0ff1b478cb76128a0fe1d..9386c1fee41716893c4321f32473ace31b45ddcb 100644 (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