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:
authorCampbell Barton <ideasman42@gmail.com>2020-03-15 09:32:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-03-15 13:42:06 +0300
commitaa60b9338ab679853d36322829458ccb7b4f06d0 (patch)
treedf1b32fcb9285d6c272415e8aac57110a5b9f265 /source/blender/editors/interface
parentb037816980dee7a74128c23eface983b9850d4a9 (diff)
Cleanup: use 'const' style argument
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c2
-rw-r--r--source/blender/editors/interface/interface_context_menu.c4
-rw-r--r--source/blender/editors/interface/interface_handlers.c23
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_layout.c27
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/interface/interface_region_menu_pie.c3
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c4
-rw-r--r--source/blender/editors/interface/interface_region_popover.c2
-rw-r--r--source/blender/editors/interface/interface_region_search.c2
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.c2
-rw-r--r--source/blender/editors/interface/interface_style.c6
-rw-r--r--source/blender/editors/interface/interface_templates.c6
-rw-r--r--source/blender/editors/interface/interface_widgets.c2
-rw-r--r--source/blender/editors/interface/view2d.c2
-rw-r--r--source/blender/editors/interface/view2d_ops.c2
16 files changed, 48 insertions, 45 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index b5fce7ea99f..3d8c0da78ea 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -366,7 +366,7 @@ void UI_block_translate(uiBlock *block, int x, int y)
static void ui_block_bounds_calc_text(uiBlock *block, float offset)
{
- uiStyle *style = UI_style_get();
+ const uiStyle *style = UI_style_get();
uiBut *bt, *init_col_bt, *col_bt;
int i = 0, j, x1addval = offset;
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index c9a46e00520..f6da9663daf 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -169,7 +169,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *region, void *arg)
wmKeyMapItem *kmi;
PointerRNA ptr;
uiLayout *layout;
- uiStyle *style = UI_style_get_dpi();
+ const uiStyle *style = UI_style_get_dpi();
IDProperty *prop;
const char *idname = shortcut_get_operator_property(C, but, &prop);
@@ -225,7 +225,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg)
wmKeyMapItem *kmi;
PointerRNA ptr;
uiLayout *layout;
- uiStyle *style = UI_style_get_dpi();
+ const uiStyle *style = UI_style_get_dpi();
int kmi_id;
IDProperty *prop;
const char *idname = shortcut_get_operator_property(C, but, &prop);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 3d7378181ad..f4dd114c312 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2848,10 +2848,9 @@ static bool ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
*/
static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, const float x)
{
- uiStyle *style = UI_style_get(); // XXX pass on as arg
- uiFontStyle *fstyle = &style->widget;
+ /* XXX pass on as arg. */
+ uiFontStyle fstyle = UI_style_get()->widget;
const float aspect = but->block->aspect;
- const short fstyle_points_prev = fstyle->points;
float startx = but->rect.xmin;
float starty_dummy = 0.0f;
@@ -2861,13 +2860,13 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con
ui_block_to_window_fl(data->region, but->block, &startx, &starty_dummy);
- ui_fontscale(&fstyle->points, aspect);
+ ui_fontscale(&fstyle.points, aspect);
- UI_fontstyle_set(fstyle);
+ UI_fontstyle_set(&fstyle);
- if (fstyle->kerning == 1) {
+ if (fstyle.kerning == 1) {
/* for BLF_width */
- BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
+ BLF_enable(fstyle.uifont_id, BLF_KERNING_DEFAULT);
}
ui_but_text_password_hide(password_str, but, false);
@@ -2889,7 +2888,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con
while (i > 0) {
if (BLI_str_cursor_step_prev_utf8(str, but->ofs, &i)) {
/* 0.25 == scale factor for less sensitivity */
- if (BLF_width(fstyle->uifont_id, str + i, (str_last - str) - i) > (startx - x) * 0.25f) {
+ if (BLF_width(fstyle.uifont_id, str + i, (str_last - str) - i) > (startx - x) * 0.25f) {
break;
}
}
@@ -2913,7 +2912,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con
but->pos = pos_prev = ((str_last - str) - but->ofs);
while (true) {
- cdist = startx + BLF_width(fstyle->uifont_id, str + but->ofs, (str_last - str) - but->ofs);
+ cdist = startx + BLF_width(fstyle.uifont_id, str + but->ofs, (str_last - str) - but->ofs);
/* check if position is found */
if (cdist < x) {
@@ -2945,13 +2944,11 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con
}
}
- if (fstyle->kerning == 1) {
- BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
+ if (fstyle.kerning == 1) {
+ BLF_disable(fstyle.uifont_id, BLF_KERNING_DEFAULT);
}
ui_but_text_password_hide(password_str, but, true);
-
- fstyle->points = fstyle_points_prev;
}
static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, const float x)
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index a2e239884a3..e2b4e8f2958 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -839,7 +839,7 @@ const struct uiWidgetColors *ui_tooltip_get_theme(void);
void ui_draw_widget_menu_back_color(const rcti *rect, bool use_shadow, const float color[4]);
void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow);
-void ui_draw_tooltip_background(struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
+void ui_draw_tooltip_background(const struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
extern void ui_draw_but(
const struct bContext *C, ARegion *region, struct uiStyle *style, uiBut *but, rcti *rect);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 1aa2670942f..64ff9d02cdc 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -91,7 +91,7 @@ typedef struct uiLayoutRoot {
uiMenuHandleFunc handlefunc;
void *argv;
- uiStyle *style;
+ const uiStyle *style;
uiBlock *block;
uiLayout *layout;
} uiLayoutRoot;
@@ -499,7 +499,7 @@ static void ui_item_array(uiLayout *layout,
bool compact,
bool show_text)
{
- uiStyle *style = layout->root->style;
+ const uiStyle *style = layout->root->style;
uiBut *but;
PropertyType type;
PropertySubType subtype;
@@ -3707,7 +3707,7 @@ static void ui_litem_layout_root(uiLayout *litem)
/* box layout */
static void ui_litem_estimate_box(uiLayout *litem)
{
- uiStyle *style = litem->root->style;
+ const uiStyle *style = litem->root->style;
ui_litem_estimate_column(litem, true);
@@ -3722,7 +3722,7 @@ static void ui_litem_estimate_box(uiLayout *litem)
static void ui_litem_layout_box(uiLayout *litem)
{
uiLayoutItemBx *box = (uiLayoutItemBx *)litem;
- uiStyle *style = litem->root->style;
+ const uiStyle *style = litem->root->style;
uiBut *but;
int w, h;
@@ -3767,7 +3767,7 @@ static void ui_litem_layout_box(uiLayout *litem)
/* multi-column layout, automatically flowing to the next */
static void ui_litem_estimate_column_flow(uiLayout *litem)
{
- uiStyle *style = litem->root->style;
+ const uiStyle *style = litem->root->style;
uiLayoutItemFlow *flow = (uiLayoutItemFlow *)litem;
uiItem *item;
int col, x, y, emh, emy, miny, itemw, itemh, maxw = 0;
@@ -3832,7 +3832,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
static void ui_litem_layout_column_flow(uiLayout *litem)
{
- uiStyle *style = litem->root->style;
+ const uiStyle *style = litem->root->style;
uiLayoutItemFlow *flow = (uiLayoutItemFlow *)litem;
uiItem *item;
int col, x, y, w, emh, emy, miny, itemw, itemh;
@@ -4071,7 +4071,7 @@ static void ui_litem_grid_flow_compute(ListBase *items,
static void ui_litem_estimate_grid_flow(uiLayout *litem)
{
- uiStyle *style = litem->root->style;
+ const uiStyle *style = litem->root->style;
uiLayoutItemGridFlow *gflow = (uiLayoutItemGridFlow *)litem;
const int space_x = style->columnspace;
@@ -4199,7 +4199,7 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
static void ui_litem_layout_grid_flow(uiLayout *litem)
{
int i;
- uiStyle *style = litem->root->style;
+ const uiStyle *style = litem->root->style;
uiLayoutItemGridFlow *gflow = (uiLayoutItemGridFlow *)litem;
uiItem *item;
@@ -5092,8 +5092,15 @@ static void ui_layout_add_padding_button(uiLayoutRoot *root)
}
}
-uiLayout *UI_block_layout(
- uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, uiStyle *style)
+uiLayout *UI_block_layout(uiBlock *block,
+ int dir,
+ int type,
+ int x,
+ int y,
+ int size,
+ int em,
+ int padding,
+ const uiStyle *style)
{
uiLayout *layout;
uiLayoutRoot *root;
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 70d64ff26ab..1f5855aed9e 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -434,7 +434,7 @@ void UI_panel_end(
static void ui_offset_panel_block(uiBlock *block)
{
- uiStyle *style = UI_style_get_dpi();
+ const uiStyle *style = UI_style_get_dpi();
/* compute bounds and offset */
ui_block_bounds_calc(block);
@@ -1938,7 +1938,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
// #define USE_FLAT_INACTIVE
const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(region->alignment != RGN_ALIGN_RIGHT);
View2D *v2d = &region->v2d;
- uiStyle *style = UI_style_get();
+ const uiStyle *style = UI_style_get();
const uiFontStyle *fstyle = &style->widget;
const int fontid = fstyle->uifont_id;
short fstyle_points = fstyle->points;
diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c
index f75f4c054a3..062a8383061 100644
--- a/source/blender/editors/interface/interface_region_menu_pie.c
+++ b/source/blender/editors/interface/interface_region_menu_pie.c
@@ -104,13 +104,12 @@ static float ui_pie_menu_title_width(const char *name, int icon)
uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, const wmEvent *event)
{
- uiStyle *style;
+ const uiStyle *style = UI_style_get_dpi();
uiPieMenu *pie;
short event_type;
wmWindow *win = CTX_wm_window(C);
- style = UI_style_get_dpi();
pie = MEM_callocN(sizeof(*pie), "pie menu");
pie->block_radial = UI_block_begin(C, NULL, __func__, UI_EMBOSS);
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index 1d066b6bbb1..9ceb864b278 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -310,7 +310,7 @@ uiPopupBlockHandle *ui_popup_menu_create(
bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg)
{
wmWindow *window = CTX_wm_window(C);
- uiStyle *style = UI_style_get_dpi();
+ const uiStyle *style = UI_style_get_dpi();
uiPopupBlockHandle *handle;
uiPopupMenu *pup;
@@ -380,7 +380,7 @@ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C,
const char *block_name,
int icon)
{
- uiStyle *style = UI_style_get_dpi();
+ const uiStyle *style = UI_style_get_dpi();
uiPopupMenu *pup = MEM_callocN(sizeof(uiPopupMenu), "popup menu");
uiBut *but;
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index 4e4854c8209..d3cd1ebd837 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -94,7 +94,7 @@ static void ui_popover_create_block(bContext *C, uiPopover *pup, int opcontext)
{
BLI_assert(pup->ui_size_x != 0);
- uiStyle *style = UI_style_get_dpi();
+ const uiStyle *style = UI_style_get_dpi();
pup->block = UI_block_begin(C, NULL, __func__, UI_EMBOSS);
UI_block_flag_enable(pup->block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_POPOVER);
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c
index 4481ad54d1a..89eb0658d5e 100644
--- a/source/blender/editors/interface/interface_region_search.c
+++ b/source/blender/editors/interface/interface_region_search.c
@@ -498,7 +498,7 @@ static void ui_searchbox_region_free_cb(ARegion *region)
ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but)
{
wmWindow *win = CTX_wm_window(C);
- uiStyle *style = UI_style_get();
+ const uiStyle *style = UI_style_get();
static ARegionType type;
ARegion *region;
uiSearchboxData *data;
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index c18c78c22a6..02c69e5cef6 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -1158,7 +1158,7 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
wmWindow *win = CTX_wm_window(C);
const int winx = WM_window_pixels_x(win);
const int winy = WM_window_pixels_y(win);
- uiStyle *style = UI_style_get();
+ const uiStyle *style = UI_style_get();
static ARegionType type;
ARegion *region;
int fonth, fontw;
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 192571044b9..fa1f222d27f 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -351,7 +351,7 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs,
/* ************** helpers ************************ */
/* XXX: read a style configure */
-uiStyle *UI_style_get(void)
+const uiStyle *UI_style_get(void)
{
#if 0
uiStyle *style = NULL;
@@ -364,9 +364,9 @@ uiStyle *UI_style_get(void)
}
/* for drawing, scaled with DPI setting */
-uiStyle *UI_style_get_dpi(void)
+const uiStyle *UI_style_get_dpi(void)
{
- uiStyle *style = UI_style_get();
+ const uiStyle *style = UI_style_get();
static uiStyle _style;
_style = *style;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index b752a1a1429..ae50090d791 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1137,7 +1137,7 @@ static void template_ID_tabs(bContext *C,
const int but_height = UI_UNIT_Y * 1.1;
uiBlock *block = uiLayoutGetBlock(layout);
- uiStyle *style = UI_style_get_dpi();
+ const uiStyle *style = UI_style_get_dpi();
ListBase ordered;
BKE_id_ordered_list(&ordered, template->idlb);
@@ -3049,7 +3049,7 @@ static void colorband_tools_dofunc(bContext *C, void *coba_v, int event)
static uiBlock *colorband_tools_func(bContext *C, ARegion *region, void *coba_v)
{
- uiStyle *style = UI_style_get_dpi();
+ const uiStyle *style = UI_style_get_dpi();
ColorBand *coba = coba_v;
uiBlock *block;
short yco = 0, menuwidth = 10 * UI_UNIT_X;
@@ -7135,7 +7135,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiLayout *ui_abs;
uiBlock *block;
uiBut *but;
- uiStyle *style = UI_style_get();
+ const uiStyle *style = UI_style_get();
int width;
int icon;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 31a1c150b12..220f5642052 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -5235,7 +5235,7 @@ void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow)
ui_draw_widget_back_color(UI_WTYPE_MENU_BACK, use_shadow, rect, NULL);
}
-void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect)
+void ui_draw_tooltip_background(const uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect)
{
uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
wt->state(wt, 0, 0);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index af32143df33..8ea1bd3ede6 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -243,7 +243,7 @@ static void view2d_masks(View2D *v2d, bool check_scrollers, const rcti *mask_scr
void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
{
bool tot_changed = false, do_init;
- uiStyle *style = UI_style_get();
+ const uiStyle *style = UI_style_get();
do_init = (v2d->flag & V2D_IS_INITIALISED) == 0;
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 7eea9e6a697..2c9803d1dd3 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -2155,7 +2155,7 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
static int reset_exec(bContext *C, wmOperator *UNUSED(op))
{
- uiStyle *style = UI_style_get();
+ const uiStyle *style = UI_style_get();
ARegion *region = CTX_wm_region(C);
View2D *v2d = &region->v2d;
int winx, winy;