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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-26 18:44:35 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-26 19:24:09 +0300
commitcbe82f81e1e02c201235d030b3e59025747bf9c4 (patch)
tree3a5fa59f1ccfd59dc6b10063dc6a9ed9209db8e2 /source
parentb2a569dd68357e535c79c8a4a74947773f21023f (diff)
UI: allow fractical unit size for layouts.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_interface.h8
-rw-r--r--source/blender/editors/interface/interface_layout.c12
-rw-r--r--source/blender/makesrna/intern/rna_ui.c16
3 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 779fac9bc15..923cda42a59 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -991,8 +991,8 @@ void uiLayoutSetAlignment(uiLayout *layout, char alignment);
void uiLayoutSetKeepAspect(uiLayout *layout, bool keepaspect);
void uiLayoutSetScaleX(uiLayout *layout, float scale);
void uiLayoutSetScaleY(uiLayout *layout, float scale);
-void uiLayoutSetUnitsX(uiLayout *layout, int unit);
-void uiLayoutSetUnitsY(uiLayout *layout, int unit);
+void uiLayoutSetUnitsX(uiLayout *layout, float unit);
+void uiLayoutSetUnitsY(uiLayout *layout, float unit);
void uiLayoutSetEmboss(uiLayout *layout, char emboss);
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep);
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep);
@@ -1006,8 +1006,8 @@ bool uiLayoutGetKeepAspect(uiLayout *layout);
int uiLayoutGetWidth(uiLayout *layout);
float uiLayoutGetScaleX(uiLayout *layout);
float uiLayoutGetScaleY(uiLayout *layout);
-int uiLayoutGetUnitsX(uiLayout *layout);
-int uiLayoutGetUnitsY(uiLayout *layout);
+float uiLayoutGetUnitsX(uiLayout *layout);
+float uiLayoutGetUnitsY(uiLayout *layout);
int uiLayoutGetEmboss(uiLayout *layout);
bool uiLayoutGetPropSep(uiLayout *layout);
bool uiLayoutGetPropDecorate(uiLayout *layout);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 0f78cfa0a3c..28627c3d44e 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -169,7 +169,7 @@ struct uiLayout {
bool variable_size; /* For layouts inside gridflow, they and their items shall never have a fixed maximal size. */
char alignment;
char emboss;
- int units[2]; /* for fixed width or height to avoid UI size changes */
+ float units[2]; /* for fixed width or height to avoid UI size changes */
};
typedef struct uiLayoutItemFlow {
@@ -3857,12 +3857,12 @@ void uiLayoutSetScaleY(uiLayout *layout, float scale)
layout->scale[1] = scale;
}
-void uiLayoutSetUnitsX(uiLayout *layout, int unit)
+void uiLayoutSetUnitsX(uiLayout *layout, float unit)
{
layout->units[0] = unit;
}
-void uiLayoutSetUnitsY(uiLayout *layout, int unit)
+void uiLayoutSetUnitsY(uiLayout *layout, float unit)
{
layout->units[1] = unit;
}
@@ -3932,12 +3932,12 @@ float uiLayoutGetScaleY(uiLayout *layout)
return layout->scale[1];
}
-int uiLayoutGetUnitsX(uiLayout *layout)
+float uiLayoutGetUnitsX(uiLayout *layout)
{
return layout->units[0];
}
-int uiLayoutGetUnitsY(uiLayout *layout)
+float uiLayoutGetUnitsY(uiLayout *layout)
{
return layout->units[1];
}
@@ -4033,7 +4033,7 @@ static void ui_item_estimate(uiItem *item)
break;
}
- /* force fixed size */
+ /* Force fixed size. */
if (litem->units[0] > 0) {
litem->w = UI_UNIT_X * litem->units[0];
}
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index eccf0e73d8e..7d9f547ea0d 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -947,22 +947,22 @@ static void rna_UILayout_scale_y_set(PointerRNA *ptr, float value)
uiLayoutSetScaleY(ptr->data, value);
}
-static int rna_UILayout_units_x_get(PointerRNA *ptr)
+static float rna_UILayout_units_x_get(PointerRNA *ptr)
{
return uiLayoutGetUnitsX(ptr->data);
}
-static void rna_UILayout_units_x_set(PointerRNA *ptr, int value)
+static void rna_UILayout_units_x_set(PointerRNA *ptr, float value)
{
uiLayoutSetUnitsX(ptr->data, value);
}
-static int rna_UILayout_units_y_get(PointerRNA *ptr)
+static float rna_UILayout_units_y_get(PointerRNA *ptr)
{
return uiLayoutGetUnitsY(ptr->data);
}
-static void rna_UILayout_units_y_set(PointerRNA *ptr, int value)
+static void rna_UILayout_units_y_set(PointerRNA *ptr, float value)
{
uiLayoutSetUnitsY(ptr->data, value);
}
@@ -1057,12 +1057,12 @@ static void rna_def_ui_layout(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, "rna_UILayout_scale_y_get", "rna_UILayout_scale_y_set", NULL);
RNA_def_property_ui_text(prop, "Scale Y", "Scale factor along the Y for items in this (sub)layout");
- prop = RNA_def_property(srna, "ui_units_x", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_UILayout_units_x_get", "rna_UILayout_units_x_set", NULL);
+ prop = RNA_def_property(srna, "ui_units_x", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, "rna_UILayout_units_x_get", "rna_UILayout_units_x_set", NULL);
RNA_def_property_ui_text(prop, "Units X", "Fixed Size along the X for items in this (sub)layout");
- prop = RNA_def_property(srna, "ui_units_y", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_UILayout_units_y_get", "rna_UILayout_units_y_set", NULL);
+ prop = RNA_def_property(srna, "ui_units_y", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, "rna_UILayout_units_y_get", "rna_UILayout_units_y_set", NULL);
RNA_def_property_ui_text(prop, "Units Y", "Fixed Size along the Y for items in this (sub)layout");
RNA_api_ui_layout(srna);