|
Blender V4.3
|
#include <climits>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include "MEM_guardedalloc.h"#include "DNA_userdef_types.h"#include "BLI_listbase.h"#include "BLI_rect.h"#include "BLI_string.h"#include "BLI_utildefines.h"#include "BKE_global.hh"#include "BLF_api.hh"#include "UI_interface.hh"#include "interface_intern.hh"Go to the source code of this file.
Functions | |
| static void | fontstyle_set_ex (const uiFontStyle *fs, const float dpi_fac) |
| static uiStyle * | ui_style_new (ListBase *styles, const char *name, short uifont_id) |
| static uiFont * | uifont_to_blfont (int id) |
| void | UI_fontstyle_draw_ex (const uiFontStyle *fs, const rcti *rect, const char *str, const size_t str_len, const uchar col[4], const uiFontStyleDraw_Params *fs_params, int *r_xofs, int *r_yofs, ResultBLF *r_info) |
| void | UI_fontstyle_draw (const uiFontStyle *fs, const rcti *rect, const char *str, const size_t str_len, const uchar col[4], const uiFontStyleDraw_Params *fs_params) |
| void | UI_fontstyle_draw_rotated (const uiFontStyle *fs, const rcti *rect, const char *str, const uchar col[4]) |
| void | UI_fontstyle_draw_simple (const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4]) |
| void | UI_fontstyle_draw_simple_backdrop (const uiFontStyle *fs, float x, float y, const blender::StringRef str, const float col_fg[4], const float col_bg[4]) |
| const uiStyle * | UI_style_get () |
| const uiStyle * | UI_style_get_dpi () |
| int | UI_fontstyle_string_width (const uiFontStyle *fs, const char *str) |
| int | UI_fontstyle_string_width_with_block_aspect (const uiFontStyle *fs, const char *str, const float aspect) |
| int | UI_fontstyle_height_max (const uiFontStyle *fs) |
| void | uiStyleInit () |
| void | UI_fontstyle_set (const uiFontStyle *fs) |
|
static |
Definition at line 493 of file interface_style.cc.
References BLF_character_weight(), BLF_size(), uiFontStyle::character_weight, uiFontStyle::points, uiFontStyle::uifont_id, and uifont_to_blfont().
Referenced by UI_fontstyle_set(), and UI_fontstyle_string_width_with_block_aspect().
| void UI_fontstyle_draw | ( | const uiFontStyle * | fs, |
| const rcti * | rect, | ||
| const char * | str, | ||
| const size_t | str_len, | ||
| const uchar | col[4], | ||
| const uiFontStyleDraw_Params * | fs_params ) |
Definition at line 196 of file interface_style.cc.
References col, str, and UI_fontstyle_draw_ex().
Referenced by draw_marker_name(), file_draw_string(), icon_draw_size(), panel_draw_aligned_widgets(), ui_draw_menu_item(), ui_draw_preview_item_stateless(), ui_tooltip_region_draw_cb(), and widget_draw_text().
| void UI_fontstyle_draw_ex | ( | const uiFontStyle * | fs, |
| const rcti * | rect, | ||
| const char * | str, | ||
| const size_t | str_len, | ||
| const uchar | col[4], | ||
| const uiFontStyleDraw_Params * | fs_params, | ||
| int * | r_xofs, | ||
| int * | r_yofs, | ||
| ResultBLF * | r_info ) |
Definition at line 125 of file interface_style.cc.
References uiFontStyleDraw_Params::align, BLF_ascender(), BLF_BOLD, BLF_CLIPPING, BLF_clipping(), BLF_color4ubv(), BLF_descender(), BLF_disable(), BLF_draw(), BLF_enable(), BLF_height_max(), BLF_ITALIC, BLF_position(), BLF_SHADOW, BLF_shadow(), BLF_shadow_offset(), BLF_width(), BLF_WORD_WRAP, BLI_rcti_size_x(), BLI_rcti_size_y(), uiFontStyle::bold, ceil(), col, floor(), uiFontStyle::italic, uiFontStyle::shadow, uiFontStyle::shadowalpha, uiFontStyle::shadowcolor, uiFontStyle::shadx, uiFontStyle::shady, str, UI_fontstyle_set(), UI_STYLE_TEXT_CENTER, UI_STYLE_TEXT_RIGHT, uiFontStyle::uifont_id, uiFontStyleDraw_Params::word_wrap, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by file_draw_string_multiline(), ui_draw_menu_item(), UI_fontstyle_draw(), and widget_draw_text().
| void UI_fontstyle_draw_rotated | ( | const uiFontStyle * | fs, |
| const rcti * | rect, | ||
| const char * | str, | ||
| const uchar | col[4] ) |
Drawn same as UI_fontstyle_draw, but at 90 degree angle.
Definition at line 206 of file interface_style.cc.
References angle(), BLF_ascender(), BLF_CLIPPING, BLF_clipping(), BLF_color4ubv(), BLF_descender(), BLF_disable(), BLF_draw(), BLF_DRAW_STR_DUMMY_MAX, BLF_enable(), BLF_position(), BLF_ROTATION, BLF_rotation(), BLF_SHADOW, BLF_shadow(), BLF_shadow_offset(), BLF_width(), BLI_rcti_size_x(), BLI_rcti_size_y(), ceil(), col, M_PI_2, uiFontStyle::shadow, uiFontStyle::shadowalpha, uiFontStyle::shadowcolor, uiFontStyle::shadx, uiFontStyle::shady, str, UI_fontstyle_set(), uiFontStyle::uifont_id, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
| void UI_fontstyle_draw_simple | ( | const uiFontStyle * | fs, |
| float | x, | ||
| float | y, | ||
| const char * | str, | ||
| const uchar | col[4] ) |
Similar to UI_fontstyle_draw but ignore alignment, shadow & no clipping rect.
For drawing on-screen labels.
Definition at line 265 of file interface_style.cc.
References BLF_color4ubv(), BLF_draw(), BLF_DRAW_STR_DUMMY_MAX, BLF_position(), col, str, UI_fontstyle_set(), and uiFontStyle::uifont_id.
Referenced by ANIM_channel_draw(), draw_current_frame(), file_draw_list(), blender::ed::outliner::outliner_draw_tree_element(), and wm_drag_draw_item_name().
| void UI_fontstyle_draw_simple_backdrop | ( | const uiFontStyle * | fs, |
| float | x, | ||
| float | y, | ||
| blender::StringRef | str, | ||
| const float | col_fg[4], | ||
| const float | col_bg[4] ) |
Same as UI_fontstyle_draw but draw a colored backdrop.
Definition at line 274 of file interface_style.cc.
References BLF_color4fv(), BLF_descender(), BLF_draw(), BLF_height_max(), BLF_position(), BLF_width(), str, UI_CNR_ALL, UI_draw_roundbox_4fv(), UI_draw_roundbox_corner_set(), UI_fontstyle_set(), uiFontStyle::uifont_id, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by eyedropper_draw_cursor_text_ex(), wm_drop_operator_draw(), and wm_drop_redalert_draw().
| int UI_fontstyle_height_max | ( | const uiFontStyle * | fs | ) |
Definition at line 360 of file interface_style.cc.
References BLF_height_max(), UI_fontstyle_set(), and uiFontStyle::uifont_id.
Referenced by text_size_get().
| void UI_fontstyle_set | ( | const uiFontStyle * | fs | ) |
Definition at line 501 of file interface_style.cc.
References fontstyle_set_ex(), and UI_SCALE_FAC.
Referenced by file_font_pointsize(), file_string_width(), ui_block_bounds_calc_text(), ui_draw_menu_item(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), UI_fontstyle_draw_simple(), UI_fontstyle_draw_simple_backdrop(), UI_fontstyle_height_max(), UI_fontstyle_string_width(), ui_searchbox_create_generic_ex(), ui_text_clip_cursor(), UI_text_clip_middle_ex(), ui_text_clip_right_label(), ui_textedit_set_cursor_pos(), ui_tooltip_create_with_data(), ui_tooltip_region_draw_cb(), uiTemplateReportsBanner(), uiTemplateStatusInfo(), view3d_draw_region_info(), widget_draw_text(), and wm_block_dialog_create().
| int UI_fontstyle_string_width | ( | const uiFontStyle * | fs, |
| const char * | str ) |
Definition at line 344 of file interface_style.cc.
References BLF_DRAW_STR_DUMMY_MAX, BLF_width(), int, str, UI_fontstyle_set(), and uiFontStyle::uifont_id.
| int UI_fontstyle_string_width_with_block_aspect | ( | const uiFontStyle * | fs, |
| const char * | str, | ||
| const float | aspect ) |
Definition at line 350 of file interface_style.cc.
References BLF_DRAW_STR_DUMMY_MAX, BLF_width(), fontstyle_set_ex(), int, str, UI_SCALE_FAC, and uiFontStyle::uifont_id.
| const uiStyle * UI_style_get | ( | ) |
Read a style (without any scaling applied).
Definition at line 305 of file interface_style.cc.
References BLI_findstring().
Referenced by clip_draw_dopesheet_channels(), component_menu(), drw_text_cache_draw_ex(), ED_region_cache_draw_curfra_label(), file_draw_list(), file_draw_string(), file_draw_string_multiline(), file_font_pointsize(), file_string_width(), blender::ed::space_node::frame_node_draw_label(), blender::ed::spreadsheet::get_column_width(), blender::ed::spreadsheet::get_index_column_width(), radial_control_paint_cursor(), reset_exec(), slider_draw(), ui_block_bounds_calc_text(), ui_def_but_rna__menu(), UI_panel_category_draw_all(), ui_searchbox_create_generic_ex(), UI_style_get_dpi(), ui_textedit_set_cursor_pos(), ui_tooltip_create_with_data(), ui_tooltip_data_from_button_or_extra_icon(), ui_tooltip_region_draw_cb(), UI_view2d_region_reinit(), uiTemplateReportsBanner(), uiTemplateStatusInfo(), blender::ed::object::voxel_size_edit_draw(), widget_preview_tile(), WM_operator_confirm_ex(), and WM_operator_props_dialog_popup().
| const uiStyle * UI_style_get_dpi | ( | ) |
Read a style (with the current DPI applied).
Definition at line 317 of file interface_style.cc.
References uiStyle::boxspace, uiStyle::buttonspacex, uiStyle::buttonspacey, uiStyle::columnspace, uiStyle::grouplabel, uiStyle::panelouter, uiStyle::panelspace, uiStyle::paneltitle, uiFontStyle::shadx, uiFontStyle::shady, uiStyle::templatespace, uiStyle::tooltip, UI_SCALE_FAC, UI_style_get(), and uiStyle::widget.
Referenced by blender::ed::space_node::add_panel_items_recursive(), blender::ed::asset::shelf::add_tab_button(), button_section_bounds_calc(), colorband_tools_fn(), blender::ed::space_node::draw_tree_path(), ed_panel_draw(), ED_region_header_layout(), ED_region_image_metadata_draw(), ED_region_info_draw_multiline(), ED_region_property_search(), ED_time_scrub_channel_search_draw(), blender::ed::spreadsheet::get_index_column_width(), blender::ed::asset::shelf::main_region_padding_y(), menu_add_shortcut(), menu_change_shortcut(), menu_items_from_ui_create(), blender::ed::space_node::node_update_basis_buttons(), blender::ed::space_node::node_update_basis_socket(), blender::ui::padded_item_height(), blender::ed::asset::shelf::region_layout(), blender::ui::region_views_find_drop_target_at(), blender::ed::spreadsheet::spreadsheet_footer_region_draw(), template_ID_tabs(), text_size_get(), UI_block_draw(), ui_litem_layout_panel_body(), ui_litem_layout_panel_header(), ui_offset_panel_block(), UI_pie_menu_begin(), ui_popover_create_block(), ui_popover_panel_create(), ui_popup_menu_create_block(), uiItemsAlertBox(), blender::ed::outliner::unused_message_popup_width_compute(), wm_block_about_create(), wm_block_create_redo(), wm_block_dialog_create(), wm_block_insert_unicode_create(), wm_block_splash_create(), and wm_operator_ui_create().
This is a complete set of layout rules, the 'state' of the Layout Engine. Multiple styles are possible, defined via C or Python. Styles get a name, and will typically get activated per region type, like Header, or Listview or Toolbar. Properties of Style definitions are:
Definition at line 57 of file interface_style.cc.
References BLI_addtail(), uiStyle::boxspace, uiStyle::buttonspacex, uiStyle::buttonspacey, uiFontStyle::character_weight, uiStyle::columnspace, uiStyle::grouplabel, uiStyle::name, uiStyle::panelouter, uiStyle::panelspace, uiStyle::paneltitle, uiStyle::panelzoom, uiFontStyle::points, uiFontStyle::shadow, uiFontStyle::shadowalpha, uiFontStyle::shadowcolor, uiFontStyle::shadx, uiFontStyle::shady, STRNCPY, uiStyle::templatespace, uiStyle::tooltip, UI_DEFAULT_TEXT_POINTS, UI_DEFAULT_TITLE_POINTS, UI_DEFAULT_TOOLTIP_POINTS, uiFontStyle::uifont_id, and uiStyle::widget.
Referenced by uiStyleInit().
Definition at line 111 of file interface_style.cc.
Referenced by fontstyle_set_ex().
| void uiStyleInit | ( | ) |
Called on each startup.blend read, reading without uiFont will create one.
Second for rendering else we get threading problems,
Definition at line 368 of file interface_style.cc.
References BLF_cache_flush_set_fn(), BLF_default_set(), BLF_default_size(), BLF_disable(), BLF_enable(), BLF_HINTING_FULL, BLF_HINTING_NONE, BLF_HINTING_SLIGHT, BLF_load(), BLF_load_default(), BLF_load_font_stack(), BLF_load_mono_default(), BLF_load_unique(), blf_mono_font, blf_mono_font_render, BLF_MONOCHROME, BLF_RENDER_SUBPIXELAA, BLF_unload_all(), BLI_addtail(), BLI_assert, CLAMP, uiFont::filepath, G, G_DEBUG, LISTBASE_FOREACH, uiFontStyle::points, printf, STRNCPY, ui_style_new(), UI_widgetbase_draw_cache_flush(), UIFONT_CUSTOM1, UIFONT_DEFAULT, uiFont::uifont_id, USER_TEXT_DISABLE_AA, USER_TEXT_HINTING_FULL, USER_TEXT_HINTING_NONE, USER_TEXT_HINTING_SLIGHT, USER_TEXT_RENDER_SUBPIXELAA, and uiStyle::widget.
Referenced by UI_init_userdef(), UI_reinit_font(), and UI_style_init_default().