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
path: root/source
diff options
context:
space:
mode:
authorPablo Vazquez <pablo@blender.org>2021-09-21 19:33:14 +0300
committerPablo Vazquez <pablo@blender.org>2021-09-21 20:53:42 +0300
commit499dbb626acb816de1dcbca10fdb2d8ca27dbcc9 (patch)
treec572846071b9e3402ad856a9417de996404e8c6a /source
parentb37d36a60f9f60d8beb34142b4768f7bcd7bf987 (diff)
UI: Style drag-drop indicators as tooltips
Currently, the drop indicator colors are hardcoded to white text on semi-transparent black background. This patch makes the drop indicator use the tooltip theme settings, as they serve a similar purpose. {F10530482, size=full} All built-in themes seem to work well and got improved readability. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D12588
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_eyedropper.c11
-rw-r--r--source/blender/editors/interface/interface_style.c7
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c12
3 files changed, 21 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index 2e7b0ce532c..58a9f362488 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -24,6 +24,8 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "BLI_math_color.h"
+
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -107,8 +109,13 @@ static void eyedropper_draw_cursor_text_ex(const int x, const int y, const char
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
- const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f};
- const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f};
+ /* Use the theme settings from tooltips. */
+ const bTheme *btheme = UI_GetTheme();
+ const uiWidgetColors *wcol = &btheme->tui.wcol_tooltip;
+
+ float col_fg[4], col_bg[4];
+ rgba_uchar_to_float(col_fg, wcol->text);
+ rgba_uchar_to_float(col_bg, wcol->inner);
UI_fontstyle_draw_simple_backdrop(fstyle, x, y + U.widget_unit, name, col_fg, col_bg);
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 804156ba48c..6b1ff92a855 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -312,11 +312,8 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs,
const float decent = BLF_descender(fs->uifont_id);
const float margin = height / 4.0f;
- /* backdrop */
- const float color[4] = {col_bg[0], col_bg[1], col_bg[2], 0.5f};
-
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(
+ UI_draw_roundbox_4fv(
&(const rctf){
.xmin = x - margin,
.xmax = x + width + margin,
@@ -325,7 +322,7 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs,
},
true,
margin,
- color);
+ col_bg);
}
BLF_position(fs->uifont_id, x, y, 0.0f);
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 76bb93b681c..b6a04251ffb 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -34,6 +34,7 @@
#include "BLT_translation.h"
#include "BLI_blenlib.h"
+#include "BLI_math_color.h"
#include "BIF_glutil.h"
@@ -50,6 +51,7 @@
#include "UI_interface.h"
#include "UI_interface_icons.h"
+#include "UI_resources.h"
#include "RNA_access.h"
@@ -463,8 +465,14 @@ void WM_drag_free_imported_drag_ID(struct Main *bmain, wmDrag *drag, wmDropBox *
static void wm_drop_operator_draw(const char *name, int x, int y)
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
- const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f};
- const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f};
+
+ /* Use the theme settings from tooltips. */
+ const bTheme *btheme = UI_GetTheme();
+ const uiWidgetColors *wcol = &btheme->tui.wcol_tooltip;
+
+ float col_fg[4], col_bg[4];
+ rgba_uchar_to_float(col_fg, wcol->text);
+ rgba_uchar_to_float(col_bg, wcol->inner);
UI_fontstyle_draw_simple_backdrop(fstyle, x, y, name, col_fg, col_bg);
}