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:
authorCampbell Barton <ideasman42@gmail.com>2019-01-15 15:24:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-15 16:26:16 +0300
commitd4c851b9765dc71f5633496fdf23bcae610f4ee8 (patch)
tree6ffde9a328fee4051776ce7edc494dbae9f69829 /source/blender/editors/interface
parentee789ccd4606a6f1c4816369cc3d0d3ce39a9e56 (diff)
Cleanup: comment line length (editors)
Prevents clang-format wrapping text before comments.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c24
-rw-r--r--source/blender/editors/interface/interface_align.c99
-rw-r--r--source/blender/editors/interface/interface_anim.c3
-rw-r--r--source/blender/editors/interface/interface_context_menu.c9
-rw-r--r--source/blender/editors/interface/interface_draw.c3
-rw-r--r--source/blender/editors/interface/interface_eyedropper_datablock.c3
-rw-r--r--source/blender/editors/interface/interface_handlers.c103
-rw-r--r--source/blender/editors/interface/interface_icons.c20
-rw-r--r--source/blender/editors/interface/interface_intern.h82
-rw-r--r--source/blender/editors/interface/interface_layout.c12
-rw-r--r--source/blender/editors/interface/interface_ops.c3
-rw-r--r--source/blender/editors/interface/interface_panel.c19
-rw-r--r--source/blender/editors/interface/interface_region_color_picker.c3
-rw-r--r--source/blender/editors/interface/interface_region_menu_pie.c3
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c3
-rw-r--r--source/blender/editors/interface/interface_region_search.c15
-rw-r--r--source/blender/editors/interface/interface_style.c3
-rw-r--r--source/blender/editors/interface/interface_templates.c39
-rw-r--r--source/blender/editors/interface/interface_widgets.c15
-rw-r--r--source/blender/editors/interface/resources.c3
-rw-r--r--source/blender/editors/interface/view2d.c55
-rw-r--r--source/blender/editors/interface/view2d_ops.c121
22 files changed, 417 insertions, 223 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 94b17209655..97520f00bf0 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -150,7 +150,8 @@ void ui_block_to_window_rctf(const ARegion *ar, uiBlock *block, rctf *rct_dst, c
ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
}
-void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */
+/* for mouse cursor */
+void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
{
float a, b, c, d, e, f, px, py;
int sx, sy, getsizex, getsizey;
@@ -413,7 +414,8 @@ static void ui_block_bounds_calc_popup(
ui_block_bounds_calc(block);
/* If given, adjust input coordinates such that they would generate real final popup position.
- * Needed to handle correctly floating panels once they have been dragged around, see T52999. */
+ * Needed to handle correctly floating panels once they have been dragged around,
+ * see T52999. */
if (r_xy) {
r_xy[0] = xy[0] + block->rect.xmin - raw_x;
r_xy[1] = xy[1] + block->rect.ymin - raw_y;
@@ -1950,7 +1952,8 @@ void ui_but_value_set(uiBut *but, double value)
case PROP_ENUM:
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
int ivalue = (int)value;
- ivalue ^= RNA_property_enum_get(&but->rnapoin, prop); /* toggle for enum/flag buttons */
+ /* toggle for enum/flag buttons */
+ ivalue ^= RNA_property_enum_get(&but->rnapoin, prop);
RNA_property_enum_set(&but->rnapoin, prop, ivalue);
}
else {
@@ -2155,7 +2158,8 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
{
int unit_type = RNA_SUBTYPE_UNIT_VALUE(UI_but_unit_type_get(but));
const double step_orig = step_default * UI_PRECISION_FLOAT_SCALE;
- /* Scaling up 'step_origg ' here is a bit arbitrary, its just giving better scales from user POV */
+ /* Scaling up 'step_origg ' here is a bit arbitrary,
+ * its just giving better scales from user POV */
const double scale_step = ui_get_but_scale_unit(but, step_orig * 10);
const double step = bUnit_ClosestScalar(scale_step, but->block->unit->system, unit_type);
@@ -2385,7 +2389,8 @@ bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double
bool is_unit_but = (ui_but_is_float(but) && ui_but_is_unit(but));
/* only enable verbose if we won't run again with units */
if (BPY_execute_string_as_number(C, NULL, str, is_unit_but == false, r_value)) {
- /* if the value parsed ok without unit conversion this button may still need a unit multiplier */
+ /* if the value parsed ok without unit conversion
+ * this button may still need a unit multiplier */
if (is_unit_but) {
char str_new[128];
@@ -3415,7 +3420,8 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
uiItemL(column, item->name, item->icon);
}
else {
- /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
+ /* Do not use uiItemL here, as our root layout is a menu one,
+ * it will add a fake blank icon! */
uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
}
@@ -4441,7 +4447,8 @@ void UI_but_func_search_set(
uiButSearchFunc search_func, void *arg,
uiButHandleFunc bfunc, void *active)
{
- /* needed since callers don't have access to internal functions (as an alternative we could expose it) */
+ /* needed since callers don't have access to internal functions
+ * (as an alternative we could expose it) */
if (search_create_func == NULL) {
search_create_func = ui_searchbox_create_generic;
}
@@ -4490,7 +4497,8 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c
RNA_property_enum_items_gettexted((bContext *)C, ptr, prop, &item_array, NULL, &do_free);
for (item = item_array; item->identifier; item++) {
- /* note: need to give the index rather than the identifier because the enum can be freed */
+ /* note: need to give the index rather than the
+ * identifier because the enum can be freed */
if (BLI_strcasestr(item->name, str)) {
if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), 0))
break;
diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c
index 36b0b938b5a..8e0cfa79289 100644
--- a/source/blender/editors/interface/interface_align.c
+++ b/source/blender/editors/interface/interface_align.c
@@ -42,22 +42,25 @@
#ifdef USE_UIBUT_SPATIAL_ALIGN
/**
- * This struct stores a (simplified) 2D representation of all buttons of a same align group, with their
- * immediate neighbors (if found), and needed value to compute 'stitching' of aligned buttons.
+ * This struct stores a (simplified) 2D representation of all buttons of a same align group,
+ * with their immediate neighbors (if found),
+ * and needed value to compute 'stitching' of aligned buttons.
*
- * \note This simplistic struct cannot fully represent complex layouts where buttons share some 'align space' with
- * several others (see schema below), we'd need linked list and more complex code to handle that.
- * However, looks like we can do without that for now, which is rather lucky!
+ * \note This simplistic struct cannot fully represent complex layouts where buttons share some
+ * 'align space' with several others (see schema below), we'd need linked list and more
+ * complex code to handle that. However, looks like we can do without that for now,
+ * which is rather lucky!
*
* <pre>
- * +-----------+-----------+
- * | BUT 1 | BUT 2 | BUT 3 has two 'top' neighbors...
- * |-----------------------| => In practice, we only store one of BUT 1 or 2 (which ones is not
- * | BUT 3 | really deterministic), and assume the other stores a ref to BUT 3.
- * +-----------------------+
+ * +--------+-------+
+ * | BUT 1 | BUT 2 | BUT 3 has two 'top' neighbors...
+ * |----------------| => In practice, we only store one of BUT 1 or 2 (which ones is not
+ * | BUT 3 | really deterministic), and assume the other stores a ref to BUT 3.
+ * +----------------+
* </pre>
*
- * This will probably not work in all possible cases, but not sure we want to support such exotic cases anyway.
+ * This will probably not work in all possible cases,
+ * but not sure we want to support such exotic cases anyway.
*/
typedef struct ButAlign {
uiBut *but;
@@ -71,13 +74,15 @@ typedef struct ButAlign {
/* Distances to the neighbors. */
float dists[4];
- /* Flags, used to mark whether we should 'stitch' the corners of this button with its neighbors' ones. */
+ /* Flags, used to mark whether we should 'stitch'
+ * the corners of this button with its neighbors' ones. */
char flags[4];
} ButAlign;
/* Side-related enums and flags. */
enum {
- /* Sides (used as indices, order is **crucial**, this allows us to factorize code in a loop over the four sides). */
+ /* Sides (used as indices, order is **crucial**,
+ * this allows us to factorize code in a loop over the four sides). */
LEFT = 0,
TOP = 1,
RIGHT = 2,
@@ -146,14 +151,17 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
for (side = 0; side < RIGHT; side++) {
- /* We are only interested in buttons which share a same line (LEFT/RIGHT sides) or column (TOP/DOWN sides). */
+ /* We are only interested in buttons which share a same line
+ * (LEFT/RIGHT sides) or column (TOP/DOWN sides). */
if (buts_share[IS_COLUMN(side)]) {
side_opp = OPPOSITE(side);
- /* We check both opposite sides at once, because with very small buttons, delta could be below max_delta for
- * the wrong side (that is, in horizontal case, the total width of two buttons can be below max_delta).
- * We rely on exact zero value here as an 'already processed' flag, so ensure we never actually
- * set a zero value at this stage. FLT_MIN is zero-enough for UI position computing. ;) */
+ /* We check both opposite sides at once, because with very small buttons,
+ * delta could be below max_delta for the wrong side
+ * (that is, in horizontal case, the total width of two buttons can be below max_delta).
+ * We rely on exact zero value here as an 'already processed' flag,
+ * so ensure we never actually set a zero value at this stage.
+ * FLT_MIN is zero-enough for UI position computing. ;) */
delta = max_ff(fabsf(*butal->borders[side] - *butal_other->borders[side_opp]), FLT_MIN);
delta_side_opp = max_ff(fabsf(*butal->borders[side_opp] - *butal_other->borders[side]), FLT_MIN);
if (delta_side_opp < delta) {
@@ -162,18 +170,21 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
if (delta < max_delta) {
- /* We are only interested in neighbors that are at least as close as already found ones. */
+ /* We are only interested in neighbors that are
+ * at least as close as already found ones. */
if (delta <= butal->dists[side]) {
{
/* We found an as close or closer neighbor.
* If both buttons are alignable, we set them as each other neighbors.
- * Else, we have an unalignable one, we need to reset the others matching neighbor to NULL
- * if its 'proximity distance' is really lower with current one.
+ * Else, we have an unalignable one, we need to reset the others matching
+ * neighbor to NULL if its 'proximity distance'
+ * is really lower with current one.
*
- * NOTE: We cannot only execute that piece of code in case we found a **closer** neighbor,
- * due to the limited way we represent neighbors (buttons only know **one** neighbor
- * on each side, when they can actually have several ones), it would prevent
- * some buttons to be properly 'neighborly-initialized'. */
+ * NOTE: We cannot only execute that piece of code in case we found a
+ * **closer** neighbor, due to the limited way we represent neighbors
+ * (buttons only know **one** neighbor on each side, when they can
+ * actually have several ones), it would prevent some buttons to be
+ * properly 'neighborly-initialized'. */
if (butal_can_align && butal_other_can_align) {
butal->neighbors[side] = butal_other;
butal_other->neighbors[side_opp] = butal;
@@ -201,10 +212,12 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
butal_other->neighbors[side_opp] = butal;
}
- /* We have a pair of neighbors, we have to check whether we can stitch their matching corners.
+ /* We have a pair of neighbors, we have to check whether we
+ * can stitch their matching corners.
* E.g. if butal_other is on the left of butal (that is, side == LEFT),
- * if both TOP (side_s1) coordinates of buttons are close enough, we can stitch
- * their upper matching corners, and same for DOWN (side_s2) side. */
+ * if both TOP (side_s1) coordinates of buttons are close enough,
+ * we can stitch their upper matching corners,
+ * and same for DOWN (side_s2) side. */
delta = fabsf(*butal->borders[side_s1] - *butal_other->borders[side_s1]);
if (delta < max_delta) {
butal->flags[side_s1] |= stitch;
@@ -217,7 +230,8 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
}
}
- /* We assume two buttons can only share one side at most - for until we have sperical UI... */
+ /* We assume two buttons can only share one side at most - for until
+ * we have sperical UI... */
return;
}
}
@@ -313,9 +327,10 @@ static int ui_block_align_butal_cmp(const void *a, const void *b)
return (*butal->borders[LEFT] > *butal_other->borders[LEFT]) ? 1 : -1;
}
- /* XXX We cannot actually assert here, since in some very compressed space cases, stupid UI code produces
- * widgets which have the same TOP and LEFT positions...
- * We do not care really, because this happens when UI is way too small to be usable anyway. */
+ /* XXX We cannot actually assert here, since in some very compressed space cases,
+ * stupid UI code produces widgets which have the same TOP and LEFT positions...
+ * We do not care really,
+ * because this happens when UI is way too small to be usable anyway. */
/* BLI_assert(0); */
return 0;
}
@@ -370,27 +385,29 @@ void ui_block_align_calc(uiBlock *block)
}
/* This will give us ButAlign items regrouped by align group, vertical and horizontal location.
- * Note that, given how buttons are defined in UI code, butal_array shall already be "nearly sorted"... */
+ * Note that, given how buttons are defined in UI code,
+ * butal_array shall already be "nearly sorted"... */
qsort(butal_array, (size_t)num_buttons, sizeof(*butal_array), ui_block_align_butal_cmp);
- /* Third loop: for each pair of buttons in the same align group, we compute their potential proximity.
- * Note that each pair is checked only once, and that we break early in case we know all remaining pairs will
- * always be too far away. */
+ /* Third loop: for each pair of buttons in the same align group,
+ * we compute their potential proximity. Note that each pair is checked only once, and that we
+ * break early in case we know all remaining pairs will always be too far away. */
for (i = 0, butal = butal_array; i < num_buttons; i++, butal++) {
const short alignnr = butal->but->alignnr;
for (j = i + 1, butal_other = &butal_array[i + 1]; j < num_buttons; j++, butal_other++) {
const float max_delta = MAX_DELTA;
- /* Since they are sorted, buttons after current butal can only be of same or higher group, and once
- * they are not of same group, we know we can break this sub-loop and start checking with next butal. */
+ /* Since they are sorted, buttons after current butal can only be of same or higher
+ * group, and once they are not of same group, we know we can break this sub-loop and
+ * start checking with next butal. */
if (butal_other->but->alignnr != alignnr) {
break;
}
- /* Since they are sorted vertically first, buttons after current butal can only be at same or lower height,
- * and once they are lower than a given threshold, we know we can break this sub-loop and
- * start checking with next butal. */
+ /* Since they are sorted vertically first, buttons after current butal can only be at
+ * same or lower height, and once they are lower than a given threshold, we know we can
+ * break this sub-loop and start checking with next butal. */
if ((*butal->borders[DOWN] - *butal_other->borders[TOP]) > max_delta) {
break;
}
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 10a23792e8f..5204127ee63 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -183,7 +183,8 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
}
/* make sure we have animdata for this */
- /* FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them */
+ /* FIXME: until materials can be handled by depsgraph,
+ * don't allow drivers to be created for them */
id = (ID *)but->rnapoin.id.data;
if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) {
if (G.debug & G_DEBUG)
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index 54e755f6cc6..ed6d590edf3 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -52,7 +52,8 @@
#include "WM_api.h"
#include "WM_types.h"
-/* This hack is needed because we don't have a good way to re-reference keymap items once added: T42944 */
+/* This hack is needed because we don't have a good way to
+ * re-reference keymap items once added: T42944 */
#define USE_KEYMAP_ADD_HACK
/* -------------------------------------------------------------------- */
@@ -130,7 +131,8 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
int kmi_id;
- /* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
+ /* XXX this guess_opname can potentially return a different keymap
+ * than being found on adding later... */
km = WM_keymap_guess_opname(C, but->optype->idname);
kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
kmi_id = kmi->id;
@@ -277,7 +279,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
/*bool is_idprop = RNA_property_is_idprop(prop);*/ /* XXX does not work as expected, not strictly needed */
bool is_set = RNA_property_is_set(ptr, prop);
- /* second slower test, saved people finding keyframe items in menus when its not possible */
+ /* second slower test,
+ * saved people finding keyframe items in menus when its not possible */
if (is_anim)
is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 13acc632929..7e3bc7e257c 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -630,7 +630,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
GLint scissor[4];
float colors[3][3];
float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
- float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */
+ /* colors pre multiplied by alpha for speed up */
+ float colors_alpha[3][3], colorsycc_alpha[3][3];
float min, max;
if (scopes == NULL) return;
diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c
index 43ccd65ddf2..21b34addb7a 100644
--- a/source/blender/editors/interface/interface_eyedropper_datablock.c
+++ b/source/blender/editors/interface/interface_eyedropper_datablock.c
@@ -114,7 +114,8 @@ static int datadropper_init(bContext *C, wmOperator *op)
type = RNA_property_pointer_type(&ddr->ptr, ddr->prop);
ddr->idcode = RNA_type_to_ID_code(type);
BLI_assert(ddr->idcode != 0);
- /* Note we can translate here (instead of on draw time), because this struct has very short lifetime. */
+ /* Note we can translate here (instead of on draw time),
+ * because this struct has very short lifetime. */
ddr->idcode_name = TIP_(BKE_idcode_to_name(ddr->idcode));
PointerRNA ptr = RNA_property_pointer_get(&ddr->ptr, ddr->prop);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ac60140e2d8..bae4a3f089f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -232,10 +232,14 @@ typedef struct uiButMultiState {
typedef struct uiHandleButtonMulti {
enum {
- BUTTON_MULTI_INIT_UNSET = 0, /* gesture direction unknown, wait until mouse has moved enough... */
- BUTTON_MULTI_INIT_SETUP, /* vertical gesture detected, flag buttons interactively (UI_BUT_DRAG_MULTI) */
- BUTTON_MULTI_INIT_ENABLE, /* flag buttons finished, apply horizontal motion to active and flagged */
- BUTTON_MULTI_INIT_DISABLE, /* vertical gesture _not_ detected, take no further action */
+ /** gesture direction unknown, wait until mouse has moved enough... */
+ BUTTON_MULTI_INIT_UNSET = 0,
+ /** vertical gesture detected, flag buttons interactively (UI_BUT_DRAG_MULTI) */
+ BUTTON_MULTI_INIT_SETUP,
+ /** flag buttons finished, apply horizontal motion to active and flagged */
+ BUTTON_MULTI_INIT_ENABLE,
+ /** vertical gesture _not_ detected, take no further action */
+ BUTTON_MULTI_INIT_DISABLE,
} init;
bool has_mbuts; /* any buttons flagged UI_BUT_DRAG_MULTI */
@@ -244,11 +248,12 @@ typedef struct uiHandleButtonMulti {
bool is_proportional;
- /* In some cases we directly apply the changes to multiple buttons, so we don't want to do it twice. */
+ /* In some cases we directly apply the changes to multiple buttons,
+ * so we don't want to do it twice. */
bool skip;
- /* before activating, we need to check gesture direction
- * accumulate signed cursor movement here so we can tell if this is a vertical motion or not. */
+ /* before activating, we need to check gesture direction accumulate signed cursor movement
+ * here so we can tell if this is a vertical motion or not. */
float drag_dir[2];
/* values copied direct from event->x,y
@@ -325,8 +330,10 @@ typedef struct uiHandleButtonData {
CBData *dragcbd;
#ifdef USE_CONT_MOUSE_CORRECT
- /* when ungrabbing buttons which are #ui_but_is_cursor_warp(), we may want to position them
- * FLT_MAX signifies do-nothing, use #ui_block_to_window_fl() to get this into a usable space */
+ /* when ungrabbing buttons which are #ui_but_is_cursor_warp(),
+ * we may want to position them.
+ * FLT_MAX signifies do-nothing, use #ui_block_to_window_fl()
+ * to get this into a usable space. */
float ungrab_mval[2];
#endif
@@ -1319,7 +1326,8 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
BLI_rctf_cent_y(&but->rect),
};
- /* check if this is a different button, chances are high the button wont move about :) */
+ /* check if this is a different button,
+ * chances are high the button wont move about :) */
if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) <
fabsf(drag_info->but_cent_start[1] - but_cent_new[1]))
@@ -1580,18 +1588,22 @@ static void ui_selectcontext_apply(
RNA_property_int_range(&but->rnapoin, prop, &min.i, &max.i);
}
else if (rna_type == PROP_ENUM) {
- delta.i = RNA_property_enum_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.i = RNA_property_enum_get(&but->rnapoin, prop);
}
else if (rna_type == PROP_BOOLEAN) {
if (is_array) {
- delta.b = RNA_property_boolean_get_index(&but->rnapoin, prop, index); /* not a delta infact */
+ /* not a delta infact */
+ delta.b = RNA_property_boolean_get_index(&but->rnapoin, prop, index);
}
else {
- delta.b = RNA_property_boolean_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.b = RNA_property_boolean_get(&but->rnapoin, prop);
}
}
else if (rna_type == PROP_POINTER) {
- delta.p = RNA_property_pointer_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.p = RNA_property_pointer_get(&but->rnapoin, prop);
}
#ifdef USE_ALLSELECT_LAYER_HACK
@@ -3302,7 +3314,8 @@ static void ui_do_but_textedit(
{
bool had_selection = but->selsta != but->selend;
- /* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */
+ /* exit on LMB only on RELEASE for searchbox, to mimic other popups,
+ * and allow multiple menu levels */
if (data->searchbox)
inbox = ui_searchbox_inside(data->searchbox, event->x, event->y);
@@ -3340,7 +3353,8 @@ static void ui_do_but_textedit(
changed = true;
}
else if (inbox) {
- /* if we allow activation on key press, it gives problems launching operators [#35713] */
+ /* if we allow activation on key press,
+ * it gives problems launching operators T35713. */
if (event->val == KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval = WM_UI_HANDLER_BREAK;
@@ -3788,7 +3802,8 @@ static bool ui_do_but_ANY_drag_toggle(
}
}
else if (data->state == BUTTON_STATE_WAIT_DRAG) {
- /* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into its own function */
+ /* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into
+ * its own function */
data->applied = false;
*r_retval = ui_do_but_EXIT(C, but, data, event);
return true;
@@ -4304,7 +4319,8 @@ static bool ui_numedit_but_NUM(
float non_linear_pixel_map;
float non_linear_scale;
- /* Use a non-linear mapping of the mouse drag especially for large floats (normal behavior) */
+ /* Use a non-linear mapping of the mouse drag especially for large floats
+ * (normal behavior) */
deler = 500;
if (is_float) {
/* not needed for smaller float buttons */
@@ -4397,8 +4413,10 @@ static int ui_do_but_NUM(
}
/* XXX hardcoded keymap check.... */
- if (type == MOUSEPAN && event->alt)
- retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */
+ if (type == MOUSEPAN && event->alt) {
+ /* allow accumulating values, otherwise scrolling gets preference */
+ retval = WM_UI_HANDLER_BREAK;
+ }
else if (type == WHEELDOWNMOUSE && event->ctrl) {
mx = but->rect.xmin;
click = 1;
@@ -4698,8 +4716,10 @@ static int ui_do_but_SLI(
}
/* XXX hardcoded keymap check.... */
- if (type == MOUSEPAN && event->alt)
- retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */
+ if (type == MOUSEPAN && event->alt) {
+ /* allow accumulating values, otherwise scrolling gets preference */
+ retval = WM_UI_HANDLER_BREAK;
+ }
else if (type == WHEELDOWNMOUSE && event->ctrl) {
mx = but->rect.xmin;
click = 2;
@@ -4714,7 +4734,8 @@ static int ui_do_but_SLI(
retval = WM_UI_HANDLER_BREAK;
}
#ifndef USE_ALLSELECT
- /* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons, and match wheel usage above */
+ /* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons,
+ * and match wheel usage above */
else if (event->type == LEFTMOUSE && event->alt) {
int halfpos = BLI_rctf_cent_x(&but->rect);
click = 2;
@@ -4819,7 +4840,8 @@ static int ui_do_but_SLI(
#if 0
if (but->type == SLI) {
- f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect)); /* same as below */
+ /* same as below */
+ f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect));
}
else
#endif
@@ -6075,7 +6097,8 @@ static bool ui_numedit_but_CURVE(
int a;
bool changed = false;
- /* evtx evty and drag coords are absolute mousecoords, prevents errors when editing when layout changes */
+ /* evtx evty and drag coords are absolute mousecoords,
+ * prevents errors when editing when layout changes */
mx = evtx;
my = evty;
ui_window_to_block(data->region, block, &mx, &my);
@@ -6243,7 +6266,8 @@ static int ui_do_but_CURVE(
changed = true;
- /* reset cmp back to the curve points again, rather than drawing segments */
+ /* reset cmp back to the curve points again,
+ * rather than drawing segments */
cmp = cuma->curve;
/* find newly added point and make it 'sel' */
@@ -7173,7 +7197,8 @@ void UI_but_tooltip_refresh(bContext *C, uiBut *but)
}
}
-/* removes tooltip timer from active but (meaning tooltip is disabled until it's reenabled again) */
+/* removes tooltip timer from active but
+ * (meaning tooltip is disabled until it's reenabled again) */
void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
{
uiHandleButtonData *data;
@@ -7916,7 +7941,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
uiBut *but_other = ui_but_find_mouse_over(ar, event);
bool exit = false;
- /* always deactivate button for pie menus, else moving to blank space will leave activated */
+ /* always deactivate button for pie menus,
+ * else moving to blank space will leave activated */
if ((!ui_block_is_menu(block) || ui_block_is_pie_menu(block)) &&
!ui_but_contains_point_px(ar, but, event->x, event->y))
{
@@ -7952,7 +7978,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
retval = WM_UI_HANDLER_CONTINUE;
break;
}
- /* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */
+ /* XXX hardcoded keymap check... but anyway,
+ * while view changes, tooltips should be removed */
case WHEELUPMOUSE:
case WHEELDOWNMOUSE:
case MIDDLEMOUSE:
@@ -8182,7 +8209,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
}
if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) {
- /* If we have a display order different from collection order, we have some work! */
+ /* If we have a display order different from
+ * collection order, we have some work! */
int *org_order = MEM_mallocN(dyn_data->items_shown * sizeof(int), __func__);
const int *new_order = dyn_data->items_filter_neworder;
int i, org_idx = -1, len = dyn_data->items_len;
@@ -8970,7 +8998,8 @@ static int ui_handle_menu_event(
}
}
else if (ELEM(event->val, KM_RELEASE, KM_CLICK)) {
- /* For buttons that use a hold function, exit when mouse-up outside the menu. */
+ /* For buttons that use a hold function,
+ * exit when mouse-up outside the menu. */
if (block->flag & UI_BLOCK_POPUP_HOLD) {
/* Note, we could check the cursor is over the parent button. */
menu->menuretval = UI_RETURN_CANCEL;
@@ -9214,7 +9243,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
bool is_click_style;
float dist;
- /* we block all events, this is modal interaction, except for drop events which is described below */
+ /* we block all events, this is modal interaction,
+ * except for drop events which is described below */
int retval = WM_UI_HANDLER_BREAK;
if (event->type == EVT_DROP) {
@@ -9361,7 +9391,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
block->pie_data.flags |= UI_PIE_DRAG_STYLE;
}
- /* here instead, we use the offset location to account for the initial direction timeout */
+ /* here instead, we use the offset location to account for the initial
+ * direction timeout */
if ((U.pie_menu_confirm > 0) &&
(dist >= U.pie_menu_threshold + U.pie_menu_confirm))
{
@@ -9479,7 +9510,8 @@ static int ui_handle_menus_recursive(
uiBlock *block = menu->region->uiblocks.first;
const bool is_menu = ui_block_is_menu(block);
bool inside = false;
- /* root pie menus accept the key that spawned them as double click to improve responsiveness */
+ /* root pie menus accept the key that spawned
+ * them as double click to improve responsiveness */
bool do_recursion = (!(block->flag & UI_BLOCK_RADIAL) || event->type != block->pie_data.event);
if (do_recursion) {
@@ -9743,7 +9775,8 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
{
uiPopupBlockHandle *menu = userdata;
struct ARegion *menu_region;
- /* we block all events, this is modal interaction, except for drop events which is described below */
+ /* we block all events, this is modal interaction,
+ * except for drop events which is described below */
int retval = WM_UI_HANDLER_BREAK;
bool reset_pie = false;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 7ef95ca87d4..871f72f948c 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -473,7 +473,10 @@ static void init_internal_icons(void)
if (icondir) {
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile);
- bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL); /* if the image is missing bbuf will just be NULL */
+
+ /* if the image is missing bbuf will just be NULL */
+ bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL);
+
if (bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
IMB_freeImBuf(bbuf);
@@ -1142,7 +1145,8 @@ static void icon_draw_size(
static void ui_id_preview_image_render_size(
const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job)
{
- if (((pi->flag[size] & PRV_CHANGED) || !pi->rect[size])) { /* changed only ever set by dynamic icons */
+ /* changed only ever set by dynamic icons */
+ if (((pi->flag[size] & PRV_CHANGED) || !pi->rect[size])) {
/* create the rect if necessary */
icon_set_image(C, scene, id, pi, size, use_job);
@@ -1155,10 +1159,14 @@ void UI_id_icon_render(const bContext *C, Scene *scene, ID *id, const bool big,
PreviewImage *pi = BKE_previewimg_id_ensure(id);
if (pi) {
- if (big)
- ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job); /* bigger preview size */
- else
- ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job); /* icon size */
+ if (big) {
+ /* bigger preview size */
+ ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job);
+ }
+ else {
+ /* icon size */
+ ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job);
+ }
}
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 671bd07b69e..f2d23944b74 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -173,13 +173,20 @@ extern const short ui_radial_dir_to_angle[8];
/* PieMenuData->flags */
enum {
- UI_PIE_DEGREES_RANGE_LARGE = (1 << 0), /* pie menu item collision is detected at 90 degrees */
- UI_PIE_INITIAL_DIRECTION = (1 << 1), /* use initial center of pie menu to calculate direction */
- UI_PIE_DRAG_STYLE = (1 << 2), /* pie menu is drag style */
- UI_PIE_INVALID_DIR = (1 << 3), /* mouse not far enough from center position */
- UI_PIE_CLICK_STYLE = (1 << 4), /* pie menu changed to click style, click to confirm */
- UI_PIE_ANIMATION_FINISHED = (1 << 5), /* pie animation finished, do not calculate any more motion */
- UI_PIE_GESTURE_END_WAIT = (1 << 6), /* pie gesture selection has been done, now wait for mouse motion to end */
+ /** pie menu item collision is detected at 90 degrees */
+ UI_PIE_DEGREES_RANGE_LARGE = (1 << 0),
+ /** use initial center of pie menu to calculate direction */
+ UI_PIE_INITIAL_DIRECTION = (1 << 1),
+ /** pie menu is drag style */
+ UI_PIE_DRAG_STYLE = (1 << 2),
+ /** mouse not far enough from center position */
+ UI_PIE_INVALID_DIR = (1 << 3),
+ /** pie menu changed to click style, click to confirm */
+ UI_PIE_CLICK_STYLE = (1 << 4),
+ /** pie animation finished, do not calculate any more motion */
+ UI_PIE_ANIMATION_FINISHED = (1 << 5),
+ /** pie gesture selection has been done, now wait for mouse motion to end */
+ UI_PIE_GESTURE_END_WAIT = (1 << 6),
};
#define PIE_CLICK_THRESHOLD_SQ 50.0f
@@ -264,7 +271,7 @@ struct uiBut {
void *rename_arg1;
void *rename_orig;
- /* Run an action when holding the button down. */
+ /** Run an action when holding the button down. */
uiButHandleHoldFunc hold_func;
void *hold_argN;
@@ -275,7 +282,7 @@ struct uiBut {
uiButToolTipFunc tip_func;
void *tip_argN;
- /* info on why button is disabled, displayed in tooltip */
+ /** info on why button is disabled, displayed in tooltip */
const char *disabled_info;
BIFIconID icon;
@@ -342,7 +349,7 @@ typedef struct ColorPickerData {
} ColorPickerData;
struct PieMenuData {
- /* store title and icon to allow access when pie levels are created */
+ /** store title and icon to allow access when pie levels are created */
const char *title;
int icon;
@@ -352,7 +359,8 @@ struct PieMenuData {
float last_pos[2];
double duration_gesture;
int flags;
- int event; /* initial event used to fire the pie menu, store here so we can query for release */
+ /** initial event used to fire the pie menu, store here so we can query for release */
+ int event;
float alphafac;
};
@@ -404,8 +412,10 @@ struct uiBlock {
short alignnr;
char direction;
- char theme_style; /* UI_BLOCK_THEME_STYLE_* */
- char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */
+ /** UI_BLOCK_THEME_STYLE_* */
+ char theme_style;
+ /** drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */
+ char dt;
bool auto_open;
char _pad[6];
double auto_open_last;
@@ -413,32 +423,46 @@ struct uiBlock {
const char *lockstr;
char lock;
- char active; /* to keep blocks while drawing and free them afterwards */
- char tooltipdisabled; /* to avoid tooltip after click */
- char endblock; /* UI_block_end done? */
-
- eBlockBoundsCalc bounds_type; /* for doing delayed */
+ /** to keep blocks while drawing and free them afterwards */
+ char active;
+ /** to avoid tooltip after click */
+ char tooltipdisabled;
+ /** UI_block_end done? */
+ char endblock;
+
+ /** for doing delayed */
+ eBlockBoundsCalc bounds_type;
int mx, my;
- int bounds, minbounds; /* for doing delayed */
+ /** for doing delayed */
+ int bounds, minbounds;
- rctf safety; /* pulldowns, to detect outside, can differ per case how it is created */
- ListBase saferct; /* uiSafetyRct list */
+ /** pulldowns, to detect outside, can differ per case how it is created */
+ rctf safety;
+ /** uiSafetyRct list */
+ ListBase saferct;
uiPopupBlockHandle *handle; /* handle */
- struct wmOperator *ui_operator; /* use so presets can find the operator, */
- /* across menus and from nested popups which fail for operator context. */
+ /** use so presets can find the operator,
+ * across menus and from nested popups which fail for operator context. */
+ struct wmOperator *ui_operator;
- void *evil_C; /* XXX hack for dynamic operator enums */
+ /** XXX hack for dynamic operator enums */
+ void *evil_C;
- struct UnitSettings *unit; /* unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. */
- ColorPickerData color_pickers; /* XXX, only accessed by color picker templates */
+ /** unit system, used a lot for numeric buttons so include here
+ * rather then fetching through the scene every time. */
+ struct UnitSettings *unit;
+ /** \note only accessed by color picker templates. */
+ ColorPickerData color_pickers;
bool color_profile; /* color profile for correcting linear colors for display */
- char display_device[64]; /* display device name used to display this block,
- * used by color widgets to transform colors from/to scene linear
- */
+ /** display device name used to display this block,
+ * used by color widgets to transform colors from/to scene linear
+ */
+ char display_device[64];
+
struct PieMenuData pie_data;
};
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 4324e050cec..48cecc96e73 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1086,7 +1086,8 @@ void uiItemsFullEnumO_items(
but = block->buttons.last;
}
else {
- /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
+ /* Do not use uiItemL here, as our root layout is a menu one,
+ * it will add a fake blank icon! */
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL,
0.0, 0.0, 0, 0, "");
@@ -1095,7 +1096,8 @@ void uiItemsFullEnumO_items(
}
else {
if (radial) {
- /* invisible dummy button to ensure all items are always at the same position */
+ /* invisible dummy button to ensure all items are
+ * always at the same position */
uiItemS(target);
}
else {
@@ -1812,7 +1814,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
UI_but_func_search_set(but, ui_searchbox_create_generic, rna_search_cb, but, NULL, NULL);
}
else if (but->type == UI_BTYPE_SEARCH_MENU) {
- /* In case we fail to find proper searchprop, so other code might have already set but->type to search menu... */
+ /* In case we fail to find proper searchprop,
+ * so other code might have already set but->type to search menu... */
but->flag |= UI_BUT_DISABLED;
}
}
@@ -1953,7 +1956,8 @@ static uiBut *ui_item_menu(
UI_block_emboss_set(block, UI_EMBOSS);
}
if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR) ||
- (force_menu && layout->root->type != UI_LAYOUT_MENU)) /* We never want a dropdown in menu! */
+ /* We never want a dropdown in menu! */
+ (force_menu && layout->root->type != UI_LAYOUT_MENU))
{
UI_but_type_set_menu_from_pulldown(but);
}
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 56f95cd929c..18b6e33cbf7 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -461,7 +461,8 @@ bool UI_context_copy_to_selected_list(
}
else if (GS(id->name) == ID_SCE) {
/* Sequencer's ID is scene :/ */
- /* Try to recursively find an RNA_Sequence ancestor, to handle situations like T41062... */
+ /* Try to recursively find an RNA_Sequence ancestor,
+ * to handle situations like T41062... */
if ((*r_path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Sequence)) != NULL) {
*r_lb = CTX_data_collection_get(C, "selected_editable_sequences");
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 8332ab77bb2..b146134e88b 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -28,7 +28,8 @@
*/
-/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */
+/* a full doc with API notes can be found in
+ * bf-blender/trunk/blender/doc/guides/interface_API.txt */
#include <math.h>
#include <stdlib.h>
@@ -1619,8 +1620,10 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
const int px = max_ii(1, round_fl_to_int(U.pixelsize));
const int category_tabs_width = round_fl_to_int(UI_PANEL_CATEGORY_MARGIN_WIDTH * zoom);
const float dpi_fac = UI_DPI_FAC;
- const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom); /* padding of tabs around text */
- const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom); /* padding between tabs */
+ /* padding of tabs around text */
+ const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom);
+ /* padding between tabs */
+ const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom);
const float tab_curve_radius = ((px * 3) * dpi_fac) * zoom;
const int roundboxtype = UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT;
bool is_alpha;
@@ -1873,7 +1876,8 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, ARegion *ar, c
const bool backwards = event->shift;
pc_dyn = backwards ? pc_dyn->prev : pc_dyn->next;
if (!pc_dyn) {
- /* proper cyclic behavior, back to first/last category (only used for ctrl+tab) */
+ /* proper cyclic behavior,
+ * back to first/last category (only used for ctrl+tab) */
pc_dyn = backwards ? ar->panels_category.last : ar->panels_category.first;
}
}
@@ -1940,10 +1944,13 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
/* checks for mouse position inside */
pa = block->panel;
- if (!pa || pa->paneltab != NULL)
+ if (!pa || pa->paneltab != NULL) {
continue;
- if (pa->type && pa->type->flag & PNL_NO_HEADER) /* XXX - accessed freed panels when scripts reload, need to fix. */
+ }
+ /* XXX - accessed freed panels when scripts reload, need to fix. */
+ if (pa->type && pa->type->flag & PNL_NO_HEADER) {
continue;
+ }
mouse_state = ui_panel_mouse_state_get(block, pa, mx, my);
diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c
index f1079957592..42d197100fa 100644
--- a/source/blender/editors/interface/interface_region_color_picker.c
+++ b/source/blender/editors/interface/interface_region_color_picker.c
@@ -155,7 +155,8 @@ static void ui_update_color_picker_buts_rgb(
if (block->color_profile)
display = ui_block_cm_display_get(block);
- /* this updates button strings, is hackish... but button pointers are on stack of caller function */
+ /* this updates button strings,
+ * is hackish... but button pointers are on stack of caller function */
for (bt = block->buttons.first; bt; bt = bt->next) {
if (bt->custom_data != cpicker)
continue;
diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c
index ef2d273bab6..0e5634db7b1 100644
--- a/source/blender/editors/interface/interface_region_menu_pie.c
+++ b/source/blender/editors/interface/interface_region_menu_pie.c
@@ -126,7 +126,8 @@ uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, co
pie->block_radial->puphash = ui_popup_menu_hash(title);
pie->block_radial->flag |= UI_BLOCK_RADIAL;
- /* if pie is spawned by a left click, release or click event, it is always assumed to be click style */
+ /* if pie is spawned by a left click, release or click event,
+ * it is always assumed to be click style */
if (event->type == LEFTMOUSE || ELEM(event->val, KM_RELEASE, KM_CLICK)) {
pie->block_radial->pie_data.flags |= UI_PIE_CLICK_STYLE;
pie->block_radial->pie_data.event = EVENT_NONE;
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index fac96fc2154..7a0775dd87a 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -388,7 +388,8 @@ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, const char *title, const char *
pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style);
/* note, this intentionally differs from the menu & submenu default because many operators
- * use popups like this to select one of their options - where having invoke doesn't make sense */
+ * use popups like this to select one of their options -
+ * where having invoke doesn't make sense */
uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
/* create in advance so we can let buttons point to retval already */
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c
index 8d4389c73e6..c7b41ebe5d9 100644
--- a/source/blender/editors/interface/interface_region_search.c
+++ b/source/blender/editors/interface/interface_region_search.c
@@ -89,10 +89,14 @@ typedef struct uiSearchboxData {
rcti bbox;
uiFontStyle fstyle;
uiSearchItems items;
- int active; /* index in items array */
- bool noback; /* when menu opened with enough space for this */
- bool preview; /* draw thumbnail previews, rather than list */
- bool use_sep; /* use the UI_SEP_CHAR char for splitting shortcuts (good for operators, bad for data) */
+ /** index in items array */
+ int active;
+ /** when menu opened with enough space for this */
+ bool noback;
+ /** draw thumbnail previews, rather than list */
+ bool preview;
+ /** use the UI_SEP_CHAR char for splitting shortcuts (good for operators, bad for data) */
+ bool use_sep;
int prv_rows, prv_cols;
} uiSearchboxData;
@@ -261,7 +265,8 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar)
return true;
}
else if (but->flag & UI_BUT_VALUE_CLEAR) {
- /* It is valid for _VALUE_CLEAR flavor to have no active element (it's a valid way to unlink). */
+ /* It is valid for _VALUE_CLEAR flavor to have no active element
+ * (it's a valid way to unlink). */
but->editstr[0] = '\0';
return true;
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 5991d99d980..519c798cba1 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -510,7 +510,8 @@ void uiStyleInit(void)
}
#endif
- /* XXX, this should be moved into a style, but for now best only load the monospaced font once. */
+ /* XXX, this should be moved into a style,
+ * but for now best only load the monospaced font once. */
BLI_assert(blf_mono_font == -1);
if (U.font_path_ui_mono[0]) {
blf_mono_font = BLF_load_unique(U.font_path_ui_mono);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index f9fcf9520be..636f0e1fdd2 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -813,7 +813,9 @@ void uiTemplateAnyID(
}
/* Start drawing UI Elements using standard defines */
- split = uiLayoutSplit(layout, 0.33f, false); /* NOTE: split amount here needs to be synced with normal labels */
+
+ /* NOTE: split amount here needs to be synced with normal labels */
+ split = uiLayoutSplit(layout, 0.33f, false);
/* FIRST PART ................................................ */
row = uiLayoutRow(split, false);
@@ -831,14 +833,20 @@ void uiTemplateAnyID(
row = uiLayoutRow(split, true);
/* ID-Type Selector - just have a menu of icons */
- sub = uiLayoutRow(row, true); /* HACK: special group just for the enum, otherwise we */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
+
+ /* HACK: special group just for the enum,
+ * otherwise we get ugly layout with text included too... */
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* ID-Block Selector - just use pointer widget... */
- sub = uiLayoutRow(row, true); /* HACK: special group to counteract the effects of the previous */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
+
+ /* HACK: special group to counteract the effects of the previous enum,
+ * which now pushes everything too far right. */
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND);
uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE);
}
@@ -874,7 +882,8 @@ void uiTemplatePathBuilder(
/* Path (existing string) Widget */
uiItemR(row, ptr, propname, 0, text, ICON_RNA);
- /* TODO: attach something to this to make allow searching of nested properties to 'build' the path */
+ /* TODO: attach something to this to make allow
+ * searching of nested properties to 'build' the path */
}
/************************ Modifier Template *************************/
@@ -912,7 +921,8 @@ static int modifier_can_delete(ModifierData *md)
return 1;
}
-/* Check whether Modifier is a simulation or not, this is used for switching to the physics/particles context tab */
+/* Check whether Modifier is a simulation or not,
+ * this is used for switching to the physics/particles context tab */
static int modifier_is_simulation(ModifierData *md)
{
/* Physic Tab */
@@ -1040,7 +1050,8 @@ static uiLayout *draw_modifier(
UI_block_align_end(block);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- /* When Modifier is a simulation, show button to switch to context rather than the delete button. */
+ /* When Modifier is a simulation,
+ * show button to switch to context rather than the delete button. */
if (modifier_can_delete(md) &&
(!modifier_is_simulation(md) ||
STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME)))
@@ -2205,7 +2216,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
rna_update_cb(C, cb_v, NULL);
}
-/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
+/* still unsure how this call evolves...
+ * we use labeltype for defining what curve-channels to show */
static void curvemap_buttons_layout(
uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels,
bool brush, bool neg_slope, RNAUpdateCb *cb)
@@ -2969,7 +2981,8 @@ static void uilist_prepare(
rows = min_ii(dyn_data->height, maxrows);
}
- /* If list length changes or list is tagged to check this, and active is out of view, scroll to it .*/
+ /* If list length changes or list is tagged to check this,
+ * and active is out of view, scroll to it .*/
if (ui_list->list_last_len != len || ui_list->flag & UILST_SCROLL_TO_ACTIVE_ITEM) {
if (activei_row < ui_list->list_scroll) {
ui_list->list_scroll = activei_row;
@@ -3595,7 +3608,8 @@ void uiTemplateOperatorPropertyButs(
/* menu */
if (op->type->flag & OPTYPE_PRESET) {
- /* XXX, no simple way to get WM_MT_operator_presets.bl_label from python! Label remains the same always! */
+ /* XXX, no simple way to get WM_MT_operator_presets.bl_label
+ * from python! Label remains the same always! */
PointerRNA op_ptr;
uiLayout *row;
@@ -4024,7 +4038,8 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
if (but->rnaprop) {
UI_but_func_set(but, keymap_item_modified, ptr->data, NULL);
- /* Otherwise the keymap will be re-generated which we're trying to edit, see: T47685 */
+ /* Otherwise the keymap will be re-generated which we're trying to edit,
+ * see: T47685 */
UI_but_flag_enable(but, UI_BUT_UPDATE_DELAY);
}
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 5aa56dda0ff..0db04842a1a 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -355,7 +355,8 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, const rcti *re
float maxxi = maxx - U.pixelsize;
float minyi = miny + U.pixelsize;
float maxyi = maxy - U.pixelsize;
- float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */
+ /* for uv, can divide by zero */
+ float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f;
float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
int a, tot = 0, minsize;
const int hnum = (
@@ -1032,7 +1033,8 @@ float UI_text_clip_middle_ex(
float strwidth;
/* Add some epsilon to OK width, avoids 'ellipsing' text that nearly fits!
- * Better to have a small piece of the last char cut out, than two remaining chars replaced by an ellipsis... */
+ * Better to have a small piece of the last char cut out,
+ * than two remaining chars replaced by an ellipsis... */
okwidth += 1.0f + UI_DPI_FAC;
BLI_assert(str[0]);
@@ -1261,7 +1263,8 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti
const char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2);
int bytes = cp2 - prev_utf8;
- /* shift the text after and including cp2 back by 1 char, +1 to include null terminator */
+ /* shift the text after and including cp2 back by 1 char,
+ * +1 to include null terminator */
memmove(cp2 - bytes, cp2, drawstr_len + 1);
cp2 -= bytes;
@@ -2082,7 +2085,8 @@ static void widget_state(uiWidgetType *wt, int state)
static void widget_state_numslider(uiWidgetType *wt, int state)
{
uiWidgetStateColors *wcol_state = wt->wcol_state;
- float blend = wcol_state->blend - 0.2f; /* XXX special tweak to make sure that bar will still be visible */
+ /* XXX special tweak to make sure that bar will still be visible */
+ float blend = wcol_state->blend - 0.2f;
/* call this for option button */
widget_state(wt, state);
@@ -3871,7 +3875,8 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case UI_BTYPE_HSVCUBE:
- if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) { /* vertical V slider, uses new widget draw now */
+ if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) {
+ /* vertical V slider, uses new widget draw now */
ui_draw_but_HSV_v(but, rect);
}
else { /* other HSV pickers... */
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 9681d771521..c4cd6d2b656 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -226,7 +226,8 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_HEADER:
cp = ts->header; break;
case TH_HEADERDESEL:
- /* we calculate a dynamic builtin header deselect color, also for pulldowns... */
+ /* we calculate a dynamic builtin header deselect color,
+ * also for pulldowns... */
cp = ts->header;
headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0;
headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0;
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index eebe0f6dfe6..d1ba88e717f 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -220,7 +220,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
*/
case V2D_COMMONVIEW_STANDARD:
{
- /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ /* for now, aspect ratio should be maintained,
+ * and zoom is clamped within sane default limits */
v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM);
v2d->minzoom = 0.01f;
v2d->maxzoom = 1000.0f;
@@ -275,7 +276,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
/* scroller settings are currently not set here... that is left for regions... */
break;
}
- /* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */
+ /* 'header' regions - zoom, aspect ratio,
+ * alignment, and panning restrictions are set here */
case V2D_COMMONVIEW_HEADER:
{
/* zoom + aspect ratio are locked */
@@ -308,7 +310,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
case V2D_COMMONVIEW_PANELS_UI:
{
- /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ /* for now, aspect ratio should be maintained,
+ * and zoom is clamped within sane default limits */
v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM | V2D_KEEPZOOM);
v2d->minzoom = 0.5f;
v2d->maxzoom = 2.0f;
@@ -343,7 +346,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
}
/* other view types are completely defined using their own settings already */
default:
- /* we don't do anything here, as settings should be fine, but just make sure that rect */
+ /* we don't do anything here,
+ * as settings should be fine, but just make sure that rect */
break;
}
@@ -358,7 +362,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
view2d_masks(v2d, 0);
/* set 'tot' rect before setting cur? */
- /* XXX confusing stuff here still - I made this function not check scroller hide - that happens in totrect_set */
+ /* XXX confusing stuff here still -
+ * I made this function not check scroller hide - that happens in totrect_set */
if (tot_changed)
UI_view2d_totRect_set_resize(v2d, winx, winy, !do_init);
else
@@ -467,7 +472,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
}
}
else {
- /* make sure sizes don't exceed that of the min/max sizes (even though we're not doing zoom clamping) */
+ /* make sure sizes don't exceed that of the min/max sizes
+ * (even though we're not doing zoom clamping) */
CLAMP(width, v2d->min[0], v2d->max[0]);
CLAMP(height, v2d->min[1], v2d->max[1]);
}
@@ -557,7 +563,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
v2d->oldwiny = (short)winy;
}
- /* Step 2: apply new sizes to cur rect, but need to take into account alignment settings here... */
+ /* Step 2: apply new sizes to cur rect,
+ * but need to take into account alignment settings here... */
if ((width != curwidth) || (height != curheight)) {
float temp, dh;
@@ -656,7 +663,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
* (XXX - in the past, max was favored... if there are bugs, swap!)
*/
if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) {
- /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
+ /* outside boundaries on both sides,
+ * so take middle-point of tot, and place in balanced way */
temp = BLI_rctf_cent_x(tot);
diff = curwidth * 0.5f;
@@ -706,7 +714,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
* We favour moving the 'minimum' across, as that's origin for most things
*/
if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) {
- /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
+ /* outside boundaries on both sides,
+ * so take middle-point of tot, and place in balanced way */
temp = BLI_rctf_cent_y(tot);
diff = curheight * 0.5f;
@@ -784,7 +793,8 @@ void UI_view2d_curRect_validate(View2D *v2d)
/* ------------------ */
-/* Called by menus to activate it, or by view2d operators to make sure 'related' views stay in synchrony */
+/* Called by menus to activate it, or by view2d operators
+ * to make sure 'related' views stay in synchrony */
void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
{
ScrArea *sa;
@@ -973,7 +983,8 @@ void UI_view2d_totRect_set(View2D *v2d, int width, int height)
UI_view2d_totRect_set_resize(v2d, width, height, 0);
- /* solve bad recursion... if scroller state changed, mask is different, so you get different rects */
+ /* solve bad recursion... if scroller state changed,
+ * mask is different, so you get different rects */
if (scroll != view2d_scroll_mapped(v2d->scroll)) {
UI_view2d_totRect_set_resize(v2d, width, height, 0);
}
@@ -1053,7 +1064,8 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
float sizex = BLI_rcti_size_x(&v2d->mask);
float sizey = BLI_rcti_size_y(&v2d->mask);
- /* prevent tiny or narrow regions to get invalid coordinates - mask can get negative even... */
+ /* prevent tiny or narrow regions to get
+ * invalid coordinates - mask can get negative even... */
if (sizex > 0.0f && sizey > 0.0f) {
float dx = BLI_rctf_size_x(&v2d->cur) / (sizex + 1);
float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1);
@@ -1090,7 +1102,8 @@ void UI_view2d_view_ortho(View2D *v2d)
if (sizey > 0)
yofs = eps * BLI_rctf_size_y(&v2d->cur) / sizey;
- /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
+ /* apply mask-based adjustments to cur rect (due to scrollers),
+ * to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked);
BLI_rctf_translate(&curmasked, -xofs, -yofs);
@@ -1129,7 +1142,8 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis)
xofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? GLA_PIXEL_OFS : 0.0f;
yofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? GLA_PIXEL_OFS : 0.0f;
- /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
+ /* apply mask-based adjustments to cur rect (due to scrollers),
+ * to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked);
/* only set matrix with 'cur' coordinates on relevant axes */
@@ -1189,7 +1203,9 @@ static void step_to_grid(float *step, int *power, int unit)
/* for frames, we want 1.0 frame intervals only */
if (unit == V2D_UNIT_FRAMES) {
rem = 1.0f;
- *step = 2.0f; /* use 2 since there are grid lines drawn in between, this way to get 1 line per frame */
+ /* use 2 since there are grid lines drawn in between,
+ * this way to get 1 line per frame */
+ *step = 2.0f;
}
/* prevents printing 1.0 2.0 3.0 etc */
@@ -1675,7 +1691,8 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
BLI_timecode_string_from_time_seconds(timecode_str, sizeof(timecode_str), power, val);
}
- /* get length of string, and adjust printing location to fit it into the horizontal scrollbar */
+ /* get length of string,
+ * and adjust printing location to fit it into the horizontal scrollbar */
len = strlen(timecode_str);
if (dir == 'h') {
/* seconds/timecode display has slightly longer strings... */
@@ -1798,7 +1815,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
break;
case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */
- /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */
+ /* HACK: although we're drawing horizontal,
+ * we make this draw as 'vertical', just to get degree signs */
scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
break;
}
@@ -1867,7 +1885,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
UI_ThemeColor(TH_TEXT);
val = grid->starty;
- /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */
+ /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer),
+ * apply correction */
if (vs->yclamp == V2D_GRID_CLAMP)
fac += 0.5f * dfac;
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index e08f9535e1f..5e8ad98f4bf 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -76,19 +76,28 @@ static bool view2d_poll(bContext *C)
/* temp customdata for operator */
typedef struct v2dViewPanData {
- bScreen *sc; /* screen where view pan was initiated */
- ScrArea *sa; /* area where view pan was initiated */
- ARegion *ar; /* region where view pan was initiated */
- View2D *v2d; /* view2d we're operating in */
+ /** screen where view pan was initiated */
+ bScreen *sc;
+ /** area where view pan was initiated */
+ ScrArea *sa;
+ /** region where view pan was initiated */
+ ARegion *ar;
+ /** view2d we're operating in */
+ View2D *v2d;
- float facx, facy; /* amount to move view relative to zoom */
+ /** amount to move view relative to zoom */
+ float facx, facy;
/* options for version 1 */
- int startx, starty; /* mouse x/y values in window when operator was initiated */
- int lastx, lasty; /* previous x/y values of mouse in window */
- int invoke_event; /* event starting pan, for modal exit */
-
- short in_scroller; /* for MMB in scrollers (old feature in past, but now not that useful) */
+ /** mouse x/y values in window when operator was initiated */
+ int startx, starty;
+ /** previous x/y values of mouse in window */
+ int lastx, lasty;
+ /** event starting pan, for modal exit */
+ int invoke_event;
+
+ /** for MMB in scrollers (old feature in past, but now not that useful) */
+ short in_scroller;
} v2dViewPanData;
/* initialize panning customdata */
@@ -260,7 +269,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-/* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */
+/* handle user input - calculations of mouse-movement
+ * need to be done here, not in the apply callback! */
static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewPanData *vpd = op->customdata;
@@ -672,7 +682,8 @@ static void view_zoomstep_apply_ex(
v2d->cur.xmax -= dx;
if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
- /* get zoom fac the same way as in ui_view2d_curRect_validate_resize - better keep in sync! */
+ /* get zoom fac the same way as in
+ * ui_view2d_curRect_validate_resize - better keep in sync! */
const float zoomx = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */
@@ -705,7 +716,8 @@ static void view_zoomstep_apply_ex(
v2d->cur.ymax -= dy;
if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
- /* get zoom fac the same way as in ui_view2d_curRect_validate_resize - better keep in sync! */
+ /* get zoom fac the same way as in
+ * ui_view2d_curRect_validate_resize - better keep in sync! */
const float zoomy = (float)(BLI_rcti_size_y(&v2d->mask) + 1) / BLI_rctf_size_y(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */
@@ -1032,7 +1044,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
fac = 0.01f * (event->prevy - event->y);
dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
- /* support trackpad zoom to always zoom entirely - the v2d code uses portrait or landscape exceptions */
+ /* support trackpad zoom to always zoom entirely - the v2d code uses portrait or
+ * landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy))
dy = dx;
@@ -1085,7 +1098,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_RUNNING_MODAL;
}
-/* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */
+/* handle user input - calculations of mouse-movement need to be done here,
+ * not in the apply callback! */
static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewZoomData *vzd = op->customdata;
@@ -1131,7 +1145,8 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
}
- /* support zoom to always zoom entirely - the v2d code uses portrait or landscape exceptions */
+ /* support zoom to always zoom entirely - the v2d code uses portrait or
+ * landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy))
dy = dx;
@@ -1260,7 +1275,8 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
*/
float zoom, center, size;
- /* TODO: is this zoom factor calculation valid? It seems to produce same results every time... */
+ /* TODO: is this zoom factor calculation valid?
+ * It seems to produce same results every time... */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
size = BLI_rctf_size_x(&cur_new);
zoom = size / BLI_rctf_size_x(&rect);
@@ -1477,7 +1493,8 @@ void UI_view2d_smooth_view(
if (v2d->smooth_timer)
WM_event_remove_timer(wm, win, v2d->smooth_timer);
/* TIMER1 is hardcoded in keymap */
- v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0); /* max 30 frs/sec */
+ /* max 30 frs/sec */
+ v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0);
ok = true;
}
@@ -1573,20 +1590,31 @@ static void VIEW2D_OT_smoothview(wmOperatorType *ot)
/* customdata for scroller-invoke data */
typedef struct v2dScrollerMove {
- View2D *v2d; /* View2D data that this operation affects */
- ARegion *ar; /* region that the scroller is in */
-
- short scroller; /* scroller that mouse is in ('h' or 'v') */
- short zone; /* -1 is min zoomer, 0 is bar, 1 is max zoomer */ // XXX find some way to provide visual feedback of this (active color?)
-
- float fac; /* view adjustment factor, based on size of region */
- float fac_round; /* for pixel rounding (avoid visible UI jitter) */
- float delta; /* amount moved by mouse on axis of interest */
-
- float scrollbarwidth; /* width of the scrollbar itself, used for page up/down clicks */
- int scrollbar_orig; /* initial location of scrollbar x/y, mouse relative */
+ /** View2D data that this operation affects */
+ View2D *v2d;
+ /** region that the scroller is in */
+ ARegion *ar;
- int lastx, lasty; /* previous mouse coordinates (in screen coordinates) for determining movement */
+ /** scroller that mouse is in ('h' or 'v') */
+ short scroller;
+ /* XXX find some way to provide visual feedback of this (active color?) */
+ /** -1 is min zoomer, 0 is bar, 1 is max zoomer */
+ short zone;
+
+ /** view adjustment factor, based on size of region */
+ float fac;
+ /** for pixel rounding (avoid visible UI jitter) */
+ float fac_round;
+ /** amount moved by mouse on axis of interest */
+ float delta;
+
+ /** width of the scrollbar itself, used for page up/down clicks */
+ float scrollbarwidth;
+ /** initial location of scrollbar x/y, mouse relative */
+ int scrollbar_orig;
+
+ /** previous mouse coordinates (in screen coordinates) for determining movement */
+ int lastx, lasty;
} v2dScrollerMove;
@@ -1694,8 +1722,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
*/
scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
- /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'.
- * In this cases moving the scroll bars has far too little effect and the view can get stuck [#31476] */
+ /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'. In this cases
+ * moving the scroll bars has far too little effect and the view can get stuck T31476. */
tot_cur_union = v2d->tot;
BLI_rctf_union(&tot_cur_union, &v2d->cur);
@@ -1841,10 +1869,12 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
if (ELEM(vsm->zone, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX)) {
/* if using bar (i.e. 'panning') or 'max' zoom widget */
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->lastx);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->lasty);
break;
}
@@ -1852,10 +1882,12 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
else if (vsm->zone == SCROLLHANDLE_MIN) {
/* using 'min' zoom widget */
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves with mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves with mouse) */
vsm->delta = (float)(vsm->lastx - event->x);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves with to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves with to mouse) */
vsm->delta = (float)(vsm->lasty - event->y);
break;
}
@@ -1897,7 +1929,8 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
}
-/* a click (or click drag in progress) should have occurred, so check if it happened in scrollbar */
+/* a click (or click drag in progress)
+ * should have occurred, so check if it happened in scrollbar */
static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
@@ -1907,7 +1940,8 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
/* check if mouse in scrollbars, if they're enabled */
in_scroller = UI_view2d_mouse_in_scrollers(C, v2d, event->x, event->y);
- /* if in a scroller, init customdata then set modal handler which will catch mousedown to start doing useful stuff */
+ /* if in a scroller, init customdata then set modal handler which will
+ * catch mousedown to start doing useful stuff */
if (in_scroller) {
v2dScrollerMove *vsm;
@@ -1918,10 +1952,12 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
/* support for quick jump to location - gtk and qt do this on linux */
if (event->type == MIDDLEMOUSE) {
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->scrollbar_orig);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->scrollbar_orig);
break;
}
@@ -1978,7 +2014,8 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL;
}
else {
- /* not in scroller, so nothing happened... (pass through let's something else catch event) */
+ /* not in scroller, so nothing happened...
+ * (pass through let's something else catch event) */
return OPERATOR_PASS_THROUGH;
}
}