#include "support/strfwd.h"
-#include "support/shared_ptr.h"
-
+#include <memory>
#include <vector>
namespace lyx {
namespace support {
- class FileName;
+ class FileName;
}
/// Defines key maps and actions for key sequences
};
enum BindReadType {
MissingOK, //< It's OK if this file is missing.
- Fallback, //< If missing, fallback to default "cua". This should only
+ Fallback, //< If missing, fallback to default "cua". This should only
//< be used when attempting to read the user-secified bind file.
Default //< Report error and return.
};
unsigned int r = 0);
- /// returns the function bound to this key sequence, or
- /// FuncRequest::unknown if no binding exists for it.
+ /// returns the function bound to this key sequence, or:
+ /// * FuncRequest::unknown if no binding exists for it;
+ /// * FuncRequest::prefix if this is the start of longer keysequences
/// @param r an internal recursion counter
// FIXME Surely there's a better way to do that?
FuncRequest getBinding(KeySequence const & seq, unsigned int r = 0);
/// clear all bindings
void clear();
- /** Parse a bind file. If a valid unbind_map is given, put \unbind
+ /** Parse a bind file. If a valid unbind_map is given, put \unbind
* bindings to a separate KeyMap. This is used in the Shortcut preference
* dialog where main and user bind files are loaded separately so \unbind
* in user.bind can not nullify \bind in the master bind file.
* @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);
+ bool read(std::string const & bind_file, KeyMap * unbind_map = 0,
+ BindReadType rt = Default, bool i18n = true);
/** write to a bind file.
* @param append append to the bind_file instead of overwrite it
/// Given an action, print the keybindings.
docstring printBindings(FuncRequest const & func,
- KeySequence::outputFormat format) const;
+ KeySequence::outputFormat format,
+ bool const untranslated = false) const;
struct Binding {
Binding(FuncRequest const & r, KeySequence const & s, ItemType t)
FuncRequest request;
KeySequence sequence;
KeyMap::ItemType tag;
- };
+ };
typedef std::vector<Binding> BindingList;
/**
* Return all lfun and their associated bindings.
/// Modifier masks
ModifierPair mod;
/// Keymap for prefix keys
- shared_ptr<KeyMap> prefixes;
+ std::shared_ptr<KeyMap> prefixes;
/// Action for !prefix keys
FuncRequest func;
};
+ enum ReturnValues {
+ ReadOK,
+ ReadError,
+ FileError,
+ FormatMismatch
+ };
///
bool read(support::FileName const & bind_file, KeyMap * unbind_map = 0);
+ ///
+ ReturnValues readWithoutConv(support::FileName const & bind_file, KeyMap * unbind_map = 0);
/**
* Given an action, find all keybindings
*/
Bindings findBindings(FuncRequest const & func,
KeySequence const & prefix) const;
-
+
void listBindings(BindingList & list, KeySequence const & prefix,
ItemType tag) const;