diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-03-15 09:32:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-03-15 13:42:06 +0300 |
commit | aa60b9338ab679853d36322829458ccb7b4f06d0 (patch) | |
tree | df1b32fcb9285d6c272415e8aac57110a5b9f265 | |
parent | b037816980dee7a74128c23eface983b9850d4a9 (diff) |
Cleanup: use 'const' style argument
24 files changed, 69 insertions, 67 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 6a88ef2468e..3e416cd8057 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1807,7 +1807,7 @@ uiLayout *UI_block_layout(uiBlock *block, int size, int em, int padding, - struct uiStyle *style); + const struct uiStyle *style); void UI_block_layout_set_current(uiBlock *block, uiLayout *layout); void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y); @@ -2433,8 +2433,8 @@ int UI_fontstyle_height_max(const struct uiFontStyle *fs); void UI_draw_icon_tri(float x, float y, char dir, const float[4]); -struct uiStyle *UI_style_get(void); /* use for fonts etc */ -struct uiStyle *UI_style_get_dpi(void); /* DPI scaled settings for drawing */ +const struct uiStyle *UI_style_get(void); /* use for fonts etc */ +const struct uiStyle *UI_style_get_dpi(void); /* DPI scaled settings for drawing */ /* linker workaround ack! */ void UI_template_fix_linking(void); 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 = ®ion->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 = ®ion->v2d; int winx, winy; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index cff7052ca58..b5cd6219c04 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2351,7 +2351,7 @@ static void ed_panel_draw(const bContext *C, int em, bool vertical) { - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); /* draw panel */ uiBlock *block = UI_block_begin(C, region, pt->idname, UI_EMBOSS); @@ -2734,7 +2734,7 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *region) void ED_region_header_layout(const bContext *C, ARegion *region) { - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); uiBlock *block; uiLayout *layout; HeaderType *ht; @@ -2960,7 +2960,7 @@ void ED_region_info_draw_multiline(ARegion *region, const bool full_redraw) { const int header_height = UI_UNIT_Y; - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); int fontid = style->widget.uifont_id; int scissor[4]; int num_lines = 0; @@ -3266,7 +3266,7 @@ void ED_region_image_metadata_draw( { float box_y; rctf rect; - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); if (!ibuf->metadata) { return; @@ -3521,7 +3521,7 @@ void ED_region_cache_draw_background(ARegion *region) void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y) { - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); int fontid = style->widget.uifont_id; char numstr[32]; float font_dims[2] = {0.0f, 0.0f}; diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index e5c82a4a80e..72c140011a9 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -296,7 +296,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) SpaceClip *sc = CTX_wm_space_clip(C); View2D *v2d = ®ion->v2d; MovieClip *clip = ED_space_clip_get_clip(sc); - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); int fontid = style->widget.uifont_id; if (!clip) { diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 116bd262d19..d7682a41570 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -170,7 +170,6 @@ static void file_draw_string(int sx, eFontStyle_Align align, const uchar col[4]) { - uiStyle *style; uiFontStyle fs; rcti rect; char fname[FILE_MAXFILE]; @@ -179,7 +178,7 @@ static void file_draw_string(int sx, return; } - style = UI_style_get(); + const uiStyle *style = UI_style_get(); fs = style->widgetlabel; BLI_strncpy(fname, string, FILE_MAXFILE); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index ef7ecff5da7..d07db12eeac 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -639,7 +639,7 @@ FileAttributeColumnType file_attribute_column_type_find_isect(const View2D *v2d, float file_string_width(const char *str) { - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); float width; UI_fontstyle_set(&style->widget); @@ -661,12 +661,12 @@ float file_font_pointsize(void) #if 0 float s; char tmp[2] = "X"; - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); UI_fontstyle_set(&style->widget); s = BLF_height(style->widget.uifont_id, tmp); return style->widget.points; #else - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); UI_fontstyle_set(&style->widget); return style->widget.points * UI_DPI_FAC; #endif diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 4c96b03f333..c8c86ade07a 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -2818,7 +2818,7 @@ static uiBlock *block_create_autorun_warning(struct bContext *C, void *UNUSED(arg1)) { wmWindowManager *wm = CTX_wm_manager(C); - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); uiBlock *block = UI_block_begin(C, region, "autorun_warning_popup", UI_EMBOSS); UI_block_flag_enable( @@ -3056,7 +3056,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, { wmGenericCallback *post_action = (wmGenericCallback *)arg1; Main *bmain = CTX_data_main(C); - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); const int dialog_width = U.widget_unit * 22; const short icon_size = 64 * U.dpi_fac; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 93ba5016ed7..1bd98cdc996 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1319,7 +1319,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *region, void *arg_op) wmOperator *op = arg_op; uiBlock *block; uiLayout *layout; - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); int width = 15 * UI_UNIT_X; block = UI_block_begin(C, region, __func__, UI_EMBOSS); @@ -1401,7 +1401,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *region, void *userD wmOperator *op = data->op; uiBlock *block; uiLayout *layout; - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_flag_disable(block, UI_BLOCK_LOOP); @@ -1450,7 +1450,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *region, void *userDa wmOperator *op = data->op; uiBlock *block; uiLayout *layout; - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_flag_disable(block, UI_BLOCK_LOOP); @@ -2308,7 +2308,7 @@ static void radial_control_paint_curve(uint pos, Brush *br, float radius, int li static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void *customdata) { RadialControl *rc = customdata; - 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/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index 6e77cb23ed3..dcf09e9cbc5 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -81,7 +81,7 @@ static void wm_block_splash_add_label(uiBlock *block, const char *label, int x, return; } - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.pixelsize * U.dpi); int label_width = BLF_width(style->widgetlabel.uifont_id, label, strlen(label)); @@ -259,7 +259,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSE { uiBlock *block; uiBut *but; - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); block = UI_block_begin(C, region, "splash", UI_EMBOSS); |