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:
authorJulian Eisel <julian@blender.org>2021-07-13 18:06:15 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-07-15 17:12:36 +0300
commit0c83ef567c503abf1e8305062fc8b3e7de17b257 (patch)
tree4c16cfb4372222e23503d981eadaaa3afb570983 /source/blender/editors/interface/interface_intern.h
parent89fd3afd1efbb52ffc36aa253843317b63f7bdea (diff)
UI: Auto-scroll to keep active text buttons in view
If a text button is activated that is not in view (i.e. scrolled away), the scrolling will now be adjusted to have it in view (with some small additional margin). While entering text, the view may also be updated should the button move out of view, for whatever reason. For the most part, this feature shouldn't be needed and won't kick in, except when a clicked on text button is partially out of view or very close to the region edge. It's however quite important for the previously committed feature, that is, pressing Ctrl+F to start searching in a UI list. The end of the list where the scroll button appears may not be in view. Plus while filtering the number of visible items changes so the scrolling has to be updated to keep the search button visible. Note that I disabled the auto-scrolling for when the text button spawned an additional popup, like for search-box buttons. That is because current code assumes the button to have a fixed position while the popup is open. There is no code to update the popup position together with the button/scrolling. I also think that the logic added here could be used in more places, e.g. for the "ensure file in view" logic the File Browser does.
Diffstat (limited to 'source/blender/editors/interface/interface_intern.h')
-rw-r--r--source/blender/editors/interface/interface_intern.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index efc94b89046..a3a9776a510 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -597,11 +597,19 @@ typedef struct uiSafetyRct {
void ui_fontscale(short *points, float aspect);
+extern void ui_block_to_region_fl(const struct ARegion *region,
+ uiBlock *block,
+ float *r_x,
+ float *r_y);
extern void ui_block_to_window_fl(const struct ARegion *region,
uiBlock *block,
float *x,
float *y);
extern void ui_block_to_window(const struct ARegion *region, uiBlock *block, int *x, int *y);
+extern void ui_block_to_region_rctf(const struct ARegion *region,
+ uiBlock *block,
+ rctf *rct_dst,
+ const rctf *rct_src);
extern void ui_block_to_window_rctf(const struct ARegion *region,
uiBlock *block,
rctf *rct_dst,
@@ -620,6 +628,9 @@ extern void ui_window_to_region(const struct ARegion *region, int *x, int *y);
extern void ui_window_to_region_rcti(const struct ARegion *region,
rcti *rect_dst,
const rcti *rct_src);
+extern void ui_window_to_region_rctf(const struct ARegion *region,
+ rctf *rect_dst,
+ const rctf *rct_src);
extern void ui_region_to_window(const struct ARegion *region, int *x, int *y);
extern void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect);
@@ -944,6 +955,7 @@ extern void ui_but_execute_end(struct bContext *C,
uiBut *but,
void *active_back);
extern void ui_but_active_free(const struct bContext *C, uiBut *but);
+extern void ui_but_update_view_for_active(const struct bContext *C, const uiBlock *block);
extern int ui_but_menu_direction(uiBut *but);
extern void ui_but_text_password_hide(char password_str[128], uiBut *but, const bool restore);
extern uiBut *ui_but_find_select_in_enum(uiBut *but, int direction);