Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-08-02 16:09:15 +0300
committerJeroen Bakker <jeroen@blender.org>2021-08-02 16:13:21 +0300
commitd60a7a87445c140a42b6470ef2c54c411d8e4bf3 (patch)
tree5c6c61b07c5fe2f03d99d2262967315f9c9e4963 /source/blender/editors/space_text
parent8edb2222ae0c954771a9cddc2d8c02a7a4d68eae (diff)
WindowManager: Support Dynamic tooltips when dragging.
Originally the operator name was drawn next to the dragging content. After that there was an option to add custom, static text with the dragging content. This patch allows dynamic text to be drawn. The custom text was implemented as out parameter of the poll function what made the code unclear. This patch introduces a tooltip function that separates tooltip generation from the poll function. NOTE: the text should always be returned in its own memory block. This block will be freed after it is copied in the drag struct. Reviewed By: Severin Differential Revision: https://developer.blender.org/D12104
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/space_text.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index af783051661..89e92231657 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -312,10 +312,7 @@ static void text_cursor(wmWindow *win, ScrArea *area, ARegion *region)
/* ************* dropboxes ************* */
-static bool text_drop_poll(bContext *UNUSED(C),
- wmDrag *drag,
- const wmEvent *UNUSED(event),
- const char **UNUSED(r_tooltip))
+static bool text_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_PATH) {
/* rule might not work? */
@@ -332,10 +329,7 @@ static void text_drop_copy(wmDrag *drag, wmDropBox *drop)
RNA_string_set(drop->ptr, "filepath", drag->path);
}
-static bool text_drop_paste_poll(bContext *UNUSED(C),
- wmDrag *drag,
- const wmEvent *UNUSED(event),
- const char **UNUSED(r_tooltip))
+static bool text_drop_paste_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
return (drag->type == WM_DRAG_ID);
}
@@ -356,8 +350,8 @@ static void text_dropboxes(void)
{
ListBase *lb = WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW);
- WM_dropbox_add(lb, "TEXT_OT_open", text_drop_poll, text_drop_copy, NULL);
- WM_dropbox_add(lb, "TEXT_OT_insert", text_drop_paste_poll, text_drop_paste, NULL);
+ WM_dropbox_add(lb, "TEXT_OT_open", text_drop_poll, text_drop_copy, NULL, NULL);
+ WM_dropbox_add(lb, "TEXT_OT_insert", text_drop_paste_poll, text_drop_paste, NULL, NULL);
}
/* ************* end drop *********** */