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:
Diffstat (limited to 'source/blender/editors/screen/area_utils.c')
-rw-r--r--source/blender/editors/screen/area_utils.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/source/blender/editors/screen/area_utils.c b/source/blender/editors/screen/area_utils.c
index 2137d98d226..1a99210b73d 100644
--- a/source/blender/editors/screen/area_utils.c
+++ b/source/blender/editors/screen/area_utils.c
@@ -42,18 +42,20 @@
/**
* Callback for #ARegionType.message_subscribe
*/
-void ED_region_generic_tools_region_message_subscribe(
- const struct bContext *UNUSED(C),
- struct WorkSpace *UNUSED(workspace), struct Scene *UNUSED(scene),
- struct bScreen *UNUSED(screen), struct ScrArea *UNUSED(sa), struct ARegion *ar,
- struct wmMsgBus *mbus)
+void ED_region_generic_tools_region_message_subscribe(const struct bContext *UNUSED(C),
+ struct WorkSpace *UNUSED(workspace),
+ struct Scene *UNUSED(scene),
+ struct bScreen *UNUSED(screen),
+ struct ScrArea *UNUSED(sa),
+ struct ARegion *ar,
+ struct wmMsgBus *mbus)
{
- wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
- .notify = ED_region_do_msg_notify_tag_redraw,
- };
- WM_msg_subscribe_rna_anon_prop(mbus, WorkSpace, tools, &msg_sub_value_region_tag_redraw);
+ wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
+ .owner = ar,
+ .user_data = ar,
+ .notify = ED_region_do_msg_notify_tag_redraw,
+ };
+ WM_msg_subscribe_rna_anon_prop(mbus, WorkSpace, tools, &msg_sub_value_region_tag_redraw);
}
/**
@@ -61,23 +63,23 @@ void ED_region_generic_tools_region_message_subscribe(
*/
int ED_region_generic_tools_region_snap_size(const ARegion *ar, int size, int axis)
{
- if (axis == 0) {
- /* Note, this depends on the icon size: see #ICON_DEFAULT_HEIGHT_TOOLBAR. */
- const float snap_units[] = {2 + 0.8f, 4 + 0.8f};
- const float aspect = BLI_rctf_size_x(&ar->v2d.cur) / (BLI_rcti_size_x(&ar->v2d.mask) + 1);
- int best_diff = INT_MAX;
- int best_size = size;
- for (uint i = 0; i < ARRAY_SIZE(snap_units); i += 1) {
- const int test_size = (snap_units[i] * U.widget_unit) / (UI_DPI_FAC * aspect);
- const int test_diff = ABS(test_size - size);
- if (test_diff < best_diff) {
- best_size = test_size;
- best_diff = test_diff;
- }
- }
- return best_size;
- }
- return size;
+ if (axis == 0) {
+ /* Note, this depends on the icon size: see #ICON_DEFAULT_HEIGHT_TOOLBAR. */
+ const float snap_units[] = {2 + 0.8f, 4 + 0.8f};
+ const float aspect = BLI_rctf_size_x(&ar->v2d.cur) / (BLI_rcti_size_x(&ar->v2d.mask) + 1);
+ int best_diff = INT_MAX;
+ int best_size = size;
+ for (uint i = 0; i < ARRAY_SIZE(snap_units); i += 1) {
+ const int test_size = (snap_units[i] * U.widget_unit) / (UI_DPI_FAC * aspect);
+ const int test_diff = ABS(test_size - size);
+ if (test_diff < best_diff) {
+ best_size = test_size;
+ best_diff = test_diff;
+ }
+ }
+ return best_size;
+ }
+ return size;
}
/** \} */