2023-08-15 16:20:26 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2018-11-16 01:24:49 +01:00
|
|
|
#pragma once
|
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2018-11-16 01:24:49 +01:00
|
|
|
*/
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-11-16 01:24:49 +01:00
|
|
|
/** Based on #BKE_addon_pref_type_init and friends */
|
|
|
|
|
2018-11-18 20:14:20 +01:00
|
|
|
struct UserDef;
|
|
|
|
struct wmKeyConfigPref;
|
2019-10-25 12:05:12 +02:00
|
|
|
struct wmKeyMap;
|
|
|
|
struct wmKeyMapItem;
|
2018-11-18 20:14:20 +01:00
|
|
|
|
|
|
|
/** Actual data is stored in #wmKeyConfigPref. */
|
2018-11-16 01:24:49 +01:00
|
|
|
#if defined(__RNA_TYPES_H__)
|
|
|
|
typedef struct wmKeyConfigPrefType_Runtime {
|
|
|
|
char idname[64];
|
|
|
|
|
|
|
|
/* RNA integration */
|
2020-04-03 18:24:08 +02:00
|
|
|
ExtensionRNA rna_ext;
|
2018-11-16 01:24:49 +01:00
|
|
|
} wmKeyConfigPrefType_Runtime;
|
|
|
|
|
|
|
|
#else
|
|
|
|
typedef struct wmKeyConfigPrefType_Runtime wmKeyConfigPrefType_Runtime;
|
|
|
|
#endif
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/* KeyConfig preferences (#UserDef). */
|
|
|
|
|
2018-11-18 20:14:20 +01:00
|
|
|
struct wmKeyConfigPref *BKE_keyconfig_pref_ensure(struct UserDef *userdef, const char *kc_idname);
|
|
|
|
|
2021-02-05 06:23:34 +01:00
|
|
|
/* KeyConfig preferences (RNA). */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
2018-11-16 01:24:49 +01:00
|
|
|
struct wmKeyConfigPrefType_Runtime *BKE_keyconfig_pref_type_find(const char *idname, bool quiet);
|
|
|
|
void BKE_keyconfig_pref_type_add(struct wmKeyConfigPrefType_Runtime *kpt_rt);
|
|
|
|
void BKE_keyconfig_pref_type_remove(const struct wmKeyConfigPrefType_Runtime *kpt_rt);
|
|
|
|
|
|
|
|
void BKE_keyconfig_pref_type_init(void);
|
|
|
|
void BKE_keyconfig_pref_type_free(void);
|
|
|
|
|
2019-10-25 12:05:12 +02:00
|
|
|
/* Versioning. */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set select mouse, for versioning code.
|
|
|
|
*/
|
2019-10-25 12:05:12 +02:00
|
|
|
void BKE_keyconfig_pref_set_select_mouse(struct UserDef *userdef, int value, bool override);
|
|
|
|
|
|
|
|
struct wmKeyConfigFilterItemParams {
|
|
|
|
uint check_item : 1;
|
|
|
|
uint check_diff_item_add : 1;
|
|
|
|
uint check_diff_item_remove : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
void BKE_keyconfig_keymap_filter_item(struct wmKeyMap *keymap,
|
|
|
|
const struct wmKeyConfigFilterItemParams *params,
|
|
|
|
bool (*filter_fn)(struct wmKeyMapItem *kmi, void *user_data),
|
|
|
|
void *user_data);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Filter & optionally remove key-map items,
|
|
|
|
* intended for versioning, but may be used in other situations too.
|
|
|
|
*/
|
2019-10-25 12:05:12 +02:00
|
|
|
void BKE_keyconfig_pref_filter_items(struct UserDef *userdef,
|
|
|
|
const struct wmKeyConfigFilterItemParams *params,
|
|
|
|
bool (*filter_fn)(struct wmKeyMapItem *kmi, void *user_data),
|
|
|
|
void *user_data);
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|