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:
Diffstat (limited to 'source/blender/editors/interface/interface_region_tooltip.cc')
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.cc35
1 files changed, 16 insertions, 19 deletions
diff --git a/source/blender/editors/interface/interface_region_tooltip.cc b/source/blender/editors/interface/interface_region_tooltip.cc
index a6e37d3f36f..2a06267d90b 100644
--- a/source/blender/editors/interface/interface_region_tooltip.cc
+++ b/source/blender/editors/interface/interface_region_tooltip.cc
@@ -56,7 +56,7 @@
#include "interface_regions_intern.hh"
#define UI_TIP_PAD_FAC 1.3f
-#define UI_TIP_PADDING (int)(UI_TIP_PAD_FAC * UI_UNIT_Y)
+#define UI_TIP_PADDING int(UI_TIP_PAD_FAC * UI_UNIT_Y)
#define UI_TIP_MAXWIDTH 600
#define UI_TIP_STR_MAX 1024
@@ -109,8 +109,7 @@ struct uiTooltipData {
#define UI_TIP_LC_MAX 6
-BLI_STATIC_ASSERT(UI_TIP_LC_MAX == static_cast<int>(uiTooltipFormat::ColorID::Alert) + 1,
- "invalid lc-max");
+BLI_STATIC_ASSERT(UI_TIP_LC_MAX == int(uiTooltipFormat::ColorID::Alert) + 1, "invalid lc-max");
BLI_STATIC_ASSERT(sizeof(uiTooltipFormat) <= sizeof(int), "oversize");
static uiTooltipField *text_field_add_only(uiTooltipData *data)
@@ -158,7 +157,7 @@ static void rgb_tint(float col[3], float h, float h_strength, float v, float v_s
hsv_to_rgb_v(col_hsv_to, col);
}
-static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region)
+static void ui_tooltip_region_draw_cb(const bContext * /*C*/, ARegion *region)
{
const float pad_px = UI_TIP_PADDING;
uiTooltipData *data = static_cast<uiTooltipData *>(region->regiondata);
@@ -168,12 +167,12 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
uchar drawcol[4] = {0, 0, 0, 255}; /* to store color in while drawing (alpha is always 255) */
/* The color from the theme. */
- float *main_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Main)];
- float *value_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Value)];
- float *active_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Active)];
- float *normal_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Normal)];
- float *python_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Python)];
- float *alert_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Alert)];
+ float *main_color = tip_colors[int(uiTooltipFormat::ColorID::Main)];
+ float *value_color = tip_colors[int(uiTooltipFormat::ColorID::Value)];
+ float *active_color = tip_colors[int(uiTooltipFormat::ColorID::Active)];
+ float *normal_color = tip_colors[int(uiTooltipFormat::ColorID::Normal)];
+ float *python_color = tip_colors[int(uiTooltipFormat::ColorID::Python)];
+ float *alert_color = tip_colors[int(uiTooltipFormat::ColorID::Alert)];
float background_color[3];
@@ -224,7 +223,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
fs_params.word_wrap = true;
/* Draw header and active data (is done here to be able to change color). */
- rgb_float_to_uchar(drawcol, tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Main)]);
+ rgb_float_to_uchar(drawcol, tip_colors[int(uiTooltipFormat::ColorID::Main)]);
UI_fontstyle_set(&data->fstyle);
UI_fontstyle_draw(&data->fstyle, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params);
@@ -235,8 +234,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
bbox.xmin += xofs;
bbox.ymax -= yofs;
- rgb_float_to_uchar(drawcol,
- tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Active)]);
+ rgb_float_to_uchar(drawcol, tip_colors[int(uiTooltipFormat::ColorID::Active)]);
UI_fontstyle_draw(
&data->fstyle, &bbox, field->text_suffix, UI_TIP_STR_MAX, drawcol, &fs_params);
@@ -254,8 +252,8 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
UI_fontstyle_set(&fstyle_mono);
/* XXX: needed because we don't have mono in 'U.uifonts'. */
- BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.pixelsize, U.dpi);
- rgb_float_to_uchar(drawcol, tip_colors[static_cast<int>(field->format.color_id)]);
+ BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.dpi_fac);
+ rgb_float_to_uchar(drawcol, tip_colors[int(field->format.color_id)]);
UI_fontstyle_draw(&fstyle_mono, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params);
}
else {
@@ -265,7 +263,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
fs_params.word_wrap = true;
/* Draw remaining data. */
- rgb_float_to_uchar(drawcol, tip_colors[static_cast<int>(field->format.color_id)]);
+ rgb_float_to_uchar(drawcol, tip_colors[int(field->format.color_id)]);
UI_fontstyle_set(&data->fstyle);
UI_fontstyle_draw(&data->fstyle, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params);
}
@@ -1133,7 +1131,7 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
int font_id;
if (field->format.style == uiTooltipFormat::Style::Mono) {
- BLF_size(blf_mono_font, data->fstyle.points * U.pixelsize, U.dpi);
+ BLF_size(blf_mono_font, data->fstyle.points * U.dpi_fac);
font_id = blf_mono_font;
}
else {
@@ -1398,8 +1396,7 @@ ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
{
wmWindow *win = CTX_wm_window(C);
const float aspect = 1.0f;
- float init_position[2] = {static_cast<float>(win->eventstate->xy[0]),
- static_cast<float>(win->eventstate->xy[1])};
+ float init_position[2] = {float(win->eventstate->xy[0]), float(win->eventstate->xy[1])};
uiTooltipData *data = ui_tooltip_data_from_gizmo(C, gz);
if (data == nullptr) {