2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * ***** END GPL LICENSE BLOCK *****
20 #ifndef __WM_TOOLSYSTEM_H__
21 #define __WM_TOOLSYSTEM_H__
23 /** \file blender/windowmanager/WM_toolsystem.h
27 /* dna-savable wmStructs here */
28 #include "BLI_compiler_attrs.h"
35 struct bToolRef_Runtime;
37 struct wmMsgSubscribeKey;
38 struct wmMsgSubscribeValue;
39 struct wmOperatorType;
46 /* Values that define a categoey of active tool. */
47 typedef struct bToolKey { int space_type; int mode; } bToolKey;
49 struct bToolRef *WM_toolsystem_ref_from_context(struct bContext *C);
50 struct bToolRef *WM_toolsystem_ref_find(struct WorkSpace *workspace, const bToolKey *tkey);
51 bool WM_toolsystem_ref_ensure(
52 struct WorkSpace *workspace, const bToolKey *tkey,
53 struct bToolRef **r_tref);
54 struct bToolRef *WM_toolsystem_ref_set_by_name(
55 bContext *C, struct WorkSpace *workspace, const bToolKey *tkey,
56 const char *name, bool cycle);
58 struct bToolRef_Runtime *WM_toolsystem_runtime_from_context(struct bContext *C);
59 struct bToolRef_Runtime *WM_toolsystem_runtime_find(struct WorkSpace *workspace, const bToolKey *tkey);
61 void WM_toolsystem_unlink(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
62 void WM_toolsystem_refresh(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
63 void WM_toolsystem_reinit(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
65 void WM_toolsystem_unlink_all(struct bContext *C, struct WorkSpace *workspace);
66 void WM_toolsystem_refresh_all(struct bContext *C, struct WorkSpace *workspace);
67 void WM_toolsystem_reinit_all(struct bContext *C, struct wmWindow *win);
69 void WM_toolsystem_ref_set_from_runtime(
70 struct bContext *C, struct WorkSpace *workspace, struct bToolRef *tref,
71 const struct bToolRef_Runtime *tool, const char *idname);
73 void WM_toolsystem_init(struct bContext *C);
75 int WM_toolsystem_mode_from_spacetype(
76 struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa,
78 bool WM_toolsystem_key_from_context(
79 struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa,
81 void WM_toolsystem_update_from_context(
83 struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa);
85 void WM_toolsystem_update_from_context_view3d(struct bContext *C);
87 bool WM_toolsystem_active_tool_is_brush(const struct bContext *C);
89 void WM_toolsystem_do_msg_notify_tag_refresh(
90 struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val);
92 struct IDProperty *WM_toolsystem_ref_properties_ensure_idprops(struct bToolRef *tref);
93 void WM_toolsystem_ref_properties_ensure(struct bToolRef *tref, struct wmOperatorType *ot, struct PointerRNA *ptr);
95 void WM_toolsystem_ref_properties_init_for_keymap(
96 struct bToolRef *tref, struct PointerRNA *dst_ptr, struct PointerRNA *src_ptr, struct wmOperatorType *ot);
98 void WM_toolsystem_refresh_screen_area(struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa);
99 void WM_toolsystem_refresh_screen_all(struct Main *bmain);
105 #endif /* __WM_TOOLSYSTEM_API_H__ */