diff options
Diffstat (limited to 'source/blender/editors/interface/interface_intern.h')
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 159 |
1 files changed, 92 insertions, 67 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 47d0e29061c..03816a255ad 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -36,6 +36,7 @@ #include "BLI_compiler_attrs.h" #include "UI_resources.h" #include "RNA_types.h" +#include "DNA_listBase.h" struct ARegion; struct bContext; @@ -67,7 +68,7 @@ typedef enum { /* standard set */ UI_WTYPE_LABEL, UI_WTYPE_TOGGLE, - UI_WTYPE_OPTION, + UI_WTYPE_CHECKBOX, UI_WTYPE_RADIO, UI_WTYPE_NUMBER, UI_WTYPE_SLIDER, @@ -95,7 +96,7 @@ typedef enum { UI_WTYPE_ICON, UI_WTYPE_SWATCH, UI_WTYPE_RGB_PICKER, - UI_WTYPE_NORMAL, + UI_WTYPE_UNITVEC, UI_WTYPE_BOX, UI_WTYPE_SCROLL, UI_WTYPE_LISTITEM, @@ -212,20 +213,20 @@ struct uiBut { /* both these values use depends on the button type * (polymorphic struct or union would be nicer for this stuff) */ - /* (type == HSVCUBE), Use UI_GRAD_* values. - * (type == NUM), Use to store RNA 'step' value, for dragging and click-step. - * (type == LABEL), Use (a1 == 1.0f) to use a2 as a blending factor (wow, this is imaginative!). - * (type == SCROLL) Use as scroll size. - * (type == SEARCH_MENU) Use as number or rows. - * (type == COLOR) Use as indication of color palette + /* (type == UI_BTYPE_HSVCUBE), Use UI_GRAD_* values. + * (type == UI_BTYPE_NUM), Use to store RNA 'step' value, for dragging and click-step. + * (type == UI_BTYPE_LABEL), Use (a1 == 1.0f) to use a2 as a blending factor (wow, this is imaginative!). + * (type == UI_BTYPE_SCROLL) Use as scroll size. + * (type == UI_BTYPE_SEARCH_MENU) Use as number or rows. + * (type == UI_BTYPE_COLOR) Use as indication of color palette */ float a1; - /* (type == HSVCIRCLE ), Use to store the luminosity. - * (type == NUM), Use to store RNA 'precision' value, for dragging and click-step. - * (type == LABEL), If (a1 == 1.0f) use a2 as a blending factor. - * (type == SEARCH_MENU) Use as number or columns. - * (type == COLOR) Use as index in palette (not so good, needs refactor) + /* (type == UI_BTYPE_HSVCIRCLE ), Use to store the luminosity. + * (type == UI_BTYPE_NUM), Use to store RNA 'precision' value, for dragging and click-step. + * (type == UI_BTYPE_LABEL), If (a1 == 1.0f) use a2 as a blending factor. + * (type == UI_BTYPE_SEARCH_MENU) Use as number or columns. + * (type == UI_BTYPE_COLOR) Use as index in palette (not so good, needs refactor) */ float a2; @@ -253,21 +254,25 @@ struct uiBut { uiLink *link; short linkto[2]; /* region relative coords */ - const char *tip, *lockstr; + const char *tip; + uiButToolTipFunc tip_func; + void *tip_argN; + + const char *lockstr; BIFIconID icon; bool lock; - char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied from the block */ + char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */ signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */ char changed; /* could be made into a single flag */ unsigned char unit_type; /* so buttons can support unit systems which are not RNA */ short modifier_key; short iconadd; - /* BLOCK data */ + /* UI_BTYPE_BLOCK data */ uiBlockCreateFunc block_create_func; - /* PULLDOWN/MENU data */ + /* UI_BTYPE_PULLDOWN/UI_BTYPE_MENU data */ uiMenuCreateFunc menu_create_func; /* RNA data */ @@ -306,6 +311,16 @@ struct uiBut { uiBlock *block; }; +typedef struct ColorPicker { + struct ColorPicker *next, *prev; + float color_data[3]; /* colr data may be HSV or HSL for now */ + int representation; /* store hsv/hsl value */ +} ColorPicker; + +typedef struct ColorPickerData { + ListBase list; +} ColorPickerData; + struct PieMenuData { float pie_dir[2]; float pie_center_init[2]; @@ -365,7 +380,7 @@ struct uiBlock { short alignnr; char direction; - char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */ + char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */ bool auto_open; char _pad[7]; double auto_open_last; @@ -375,7 +390,7 @@ struct uiBlock { char lock; char active; /* to keep blocks while drawing and free them afterwards */ char tooltipdisabled; /* to avoid tooltip after click */ - char endblock; /* uiEndBlock done? */ + char endblock; /* UI_block_end done? */ eBlockBoundsCalc bounds_type; /* for doing delayed */ int mx, my; @@ -392,7 +407,7 @@ struct uiBlock { void *evil_C; /* XXX hack for dynamic operator enums */ struct UnitSettings *unit; /* unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. */ - float _hsv[3]; /* XXX, only access via ui_block_hsv_get() */ + ColorPickerData color_pickers; /* XXX, only accessed by color picker templates */ bool color_profile; /* color profile for correcting linear colors for display */ @@ -410,7 +425,7 @@ typedef struct uiSafetyRct { /* interface.c */ -extern void ui_delete_linkline(uiLinkLine *line, uiBut *but); +extern void ui_linkline_remove(uiLinkLine *line, uiBut *but); void ui_fontscale(short *points, float aspect); @@ -422,49 +437,50 @@ extern void ui_block_to_window_rctf(const struct ARegion *ar, uiBlock *block, rc extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y); extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y); extern void ui_window_to_region(const ARegion *ar, int *x, int *y); +extern void ui_region_to_window(const struct ARegion *ar, int *x, int *y); -extern double ui_get_but_val(uiBut *but); -extern void ui_set_but_val(uiBut *but, double value); -extern void ui_set_but_hsv(uiBut *but); -extern void ui_get_but_vectorf(uiBut *but, float vec[3]); -extern void ui_set_but_vectorf(uiBut *but, const float vec[3]); +extern double ui_but_value_get(uiBut *but); +extern void ui_but_value_set(uiBut *but, double value); +extern void ui_but_hsv_set(uiBut *but); +extern void ui_but_v3_get(uiBut *but, float vec[3]); +extern void ui_but_v3_set(uiBut *but, const float vec[3]); extern void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect, const float mx, const float my); extern void ui_hsvcircle_pos_from_vals(struct uiBut *but, const rcti *rect, float *hsv, float *xpos, float *ypos); extern void ui_hsvcube_pos_from_vals(struct uiBut *but, const rcti *rect, float *hsv, float *xp, float *yp); -bool ui_color_picker_use_display_colorspace(struct uiBut *but); +bool ui_but_is_colorpicker_display_space(struct uiBut *but); -extern void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision) ATTR_NONNULL(); -extern void ui_get_but_string(uiBut *but, char *str, const size_t maxlen) ATTR_NONNULL(); -extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) ATTR_NONNULL(); -extern bool ui_set_but_string(struct bContext *C, uiBut *but, const char *str) ATTR_NONNULL(); -extern bool ui_set_but_string_eval_num(struct bContext *C, uiBut *but, const char *str, double *value) ATTR_NONNULL(); -extern int ui_get_but_string_max_length(uiBut *but); -extern uiBut *ui_get_but_drag_multi_edit(uiBut *but); +extern void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision) ATTR_NONNULL(); +extern void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) ATTR_NONNULL(); +extern void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) ATTR_NONNULL(); +extern bool ui_but_string_set(struct bContext *C, uiBut *but, const char *str) ATTR_NONNULL(); +extern bool ui_but_string_set_eval_num(struct bContext *C, uiBut *but, const char *str, double *value) ATTR_NONNULL(); +extern int ui_but_string_get_max_length(uiBut *but); +extern uiBut *ui_but_drag_multi_edit_get(uiBut *but); -extern void ui_set_but_default(struct bContext *C, const bool all, const bool use_afterfunc); +extern void ui_but_default_set(struct bContext *C, const bool all, const bool use_afterfunc); -extern void ui_check_but(uiBut *but); -extern bool ui_is_but_float(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_bool(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_unit(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_compatible(const uiBut *but_a, const uiBut *but_b) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_rna_valid(uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_utf8(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern bool ui_is_but_search_unlink_visible(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern void ui_but_update(uiBut *but); +extern bool ui_but_is_float(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_bool(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_unit(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_compatible(const uiBut *but_a, const uiBut *but_b) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_rna_valid(uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_utf8(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern bool ui_but_is_search_unlink_visible(const uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern int ui_is_but_push_ex(uiBut *but, double *value) ATTR_WARN_UNUSED_RESULT; -extern int ui_is_but_push(uiBut *but) ATTR_WARN_UNUSED_RESULT; +extern int ui_but_is_pushed_ex(uiBut *but, double *value) ATTR_WARN_UNUSED_RESULT; +extern int ui_but_is_pushed(uiBut *but) ATTR_WARN_UNUSED_RESULT; -extern void ui_bounds_block(uiBlock *block); +extern void ui_block_bounds_calc(uiBlock *block); extern void ui_block_translate(uiBlock *block, int x, int y); -extern void ui_block_do_align(uiBlock *block); +extern void ui_block_align_calc(uiBlock *block); -extern struct ColorManagedDisplay *ui_block_display_get(uiBlock *block); -void ui_block_to_display_space_v3(uiBlock *block, float pixel[3]); -void ui_block_to_scene_linear_v3(uiBlock *block, float pixel[3]); +extern struct ColorManagedDisplay *ui_block_cm_display_get(uiBlock *block); +void ui_block_cm_to_display_space_v3(uiBlock *block, float pixel[3]); +void ui_block_cm_to_scene_linear_v3(uiBlock *block, float pixel[3]); /* interface_regions.c */ @@ -540,7 +556,7 @@ void ui_popup_menu_memory_set(uiBlock *block, struct uiBut *but); void ui_popup_translate(struct bContext *C, struct ARegion *ar, const int mdiff[2]); -float *ui_block_hsv_get(struct uiBlock *block); +ColorPicker *ui_block_colorpicker_create(struct uiBlock *block); void ui_popup_block_scrolltest(struct uiBlock *block); void ui_rgb_to_color_picker_compat_v(const float rgb[3], float r_cp[3]); @@ -557,7 +573,7 @@ int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but void ui_searchbox_event(struct bContext *C, struct ARegion *ar, uiBut *but, const struct wmEvent *event); bool ui_searchbox_apply(uiBut *but, struct ARegion *ar); void ui_searchbox_free(struct bContext *C, struct ARegion *ar); -void ui_but_search_test(uiBut *but); +void ui_but_search_refresh(uiBut *but); uiBlock *ui_popup_block_refresh(struct bContext *C, uiPopupBlockHandle *handle, ARegion *butregion, uiBut *but); @@ -570,7 +586,7 @@ uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C, struct ARegion *but void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle); -int ui_step_name_menu(uiBut *but, int step); +int ui_but_menu_step(uiBut *but, int step); struct AutoComplete; @@ -579,7 +595,7 @@ extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *eve extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, const rcti *rect, const bool show_pin); /* interface_draw.c */ -extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); +extern void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, const float alpha); @@ -587,7 +603,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_COLORBAND(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); -void ui_draw_but_NORMAL(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); +void ui_draw_but_UNITVEC(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_CURVE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect); @@ -596,25 +612,32 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol /* interface_handlers.c */ PointerRNA *ui_handle_afterfunc_add_operator(struct wmOperatorType *ot, int opcontext, bool create_props); extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val); -extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but); -extern void ui_button_activate_over(struct bContext *C, struct ARegion *ar, uiBut *but); -extern void ui_button_execute_begin(struct bContext *C, struct ARegion *ar, uiBut *but, void **active_back); -extern void ui_button_execute_end(struct bContext *C, struct ARegion *ar, uiBut *but, void *active_back); -extern void ui_button_active_free(const struct bContext *C, uiBut *but); -extern bool ui_button_is_active(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT; -extern int ui_button_open_menu_direction(uiBut *but); -extern void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, const bool restore); -extern uiBut *ui_but_find_activated(struct ARegion *ar); +extern void ui_but_activate_event(struct bContext *C, struct ARegion *ar, uiBut *but); +extern void ui_but_activate_over(struct bContext *C, struct ARegion *ar, uiBut *but); +extern void ui_but_execute_begin(struct bContext *C, struct ARegion *ar, uiBut *but, void **active_back); +extern void ui_but_execute_end(struct bContext *C, struct ARegion *ar, uiBut *but, void *active_back); +extern void ui_but_active_free(const struct bContext *C, uiBut *but); +extern bool ui_but_is_active(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT; +extern int ui_but_menu_direction(uiBut *but); +extern void ui_but_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, const bool restore); +extern uiBut *ui_but_find_select_in_enum(uiBut *but, int direction); +extern uiBut *ui_but_find_active_in_region(struct ARegion *ar); bool ui_but_is_editable(const uiBut *but); +bool ui_but_is_editable_as_text(const uiBut *but); void ui_but_pie_dir_visual(RadialDirection dir, float vec[2]); void ui_but_pie_dir(RadialDirection dir, float vec[2]); -float ui_block_calculate_pie_segment(struct uiBlock *block, const float event_xy[2]); +float ui_block_calc_pie_segment(struct uiBlock *block, const float event_xy[2]); -void ui_button_clipboard_free(void); +void ui_but_clipboard_free(void); void ui_panel_menu(struct bContext *C, ARegion *ar, Panel *pa); uiBut *ui_but_find_old(uiBlock *block_old, const uiBut *but_new); uiBut *ui_but_find_new(uiBlock *block_old, const uiBut *but_new); +#ifdef WITH_INPUT_IME +void ui_but_ime_reposition(uiBut *but, int x, int y, bool complete); +struct wmIMEData *ui_but_get_ime_data(uiBut *but); +#endif + /* interface_widgets.c */ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad, bool use_alpha); @@ -635,12 +658,13 @@ void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state); #define UI_TEXT_MARGIN_X 0.4f +#define UI_POPUP_MARGIN (UI_DPI_FAC * 12) /* interface_style.c */ void uiStyleInit(void); /* interface_icons.c */ -int ui_id_icon_get(struct bContext *C, struct ID *id, const bool big); +int ui_id_icon_get(const struct bContext *C, struct ID *id, const bool big); /* resources.c */ void init_userdef_do_versions(void); @@ -675,5 +699,6 @@ void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, fl /* interface_eyedropper.c */ void UI_OT_eyedropper_color(struct wmOperatorType *ot); void UI_OT_eyedropper_id(struct wmOperatorType *ot); +void UI_OT_eyedropper_depth(struct wmOperatorType *ot); #endif /* __INTERFACE_INTERN_H__ */ |